index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="68px"
  9. >
  10. <el-form-item label="" prop="address">
  11. <el-input
  12. v-model="queryParams.address"
  13. placeholder="请输入训练地点"
  14. clearable
  15. size="small"
  16. @keyup.enter.native="handleQuery"
  17. />
  18. </el-form-item>
  19. <el-form-item>
  20. <!-- <el-button
  21. type="primary"
  22. icon="el-icon-search"
  23. size="mini"
  24. @click="handleQuery"
  25. >搜索</el-button
  26. > -->
  27. <el-button size="btr" @click="resetQuery"
  28. >重置</el-button
  29. >
  30. </el-form-item>
  31. </el-form>
  32. <el-row :gutter="10" class="mb8">
  33. <el-col :span="1.5">
  34. <el-button
  35. type="primary"
  36. plain
  37. icon="el-icon-plus"
  38. size="mini"
  39. @click="handleAdd"
  40. v-hasPermi="['grassrootsregistration:bdgldrill:add']"
  41. >新增</el-button
  42. >
  43. </el-col>
  44. <!-- <el-col :span="1.5">
  45. <el-button
  46. type="success"
  47. plain
  48. icon="el-icon-edit"
  49. size="mini"
  50. :disabled="single"
  51. @click="handleUpdate"
  52. v-hasPermi="['grassrootsregistration:bdgldrill:edit']"
  53. >修改</el-button
  54. >
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button
  58. type="danger"
  59. plain
  60. icon="el-icon-delete"
  61. size="mini"
  62. :disabled="multiple"
  63. @click="handleDelete"
  64. v-hasPermi="['grassrootsregistration:bdgldrill:remove']"
  65. >删除</el-button
  66. >
  67. </el-col>
  68. <el-col :span="1.5">
  69. <el-button
  70. type="warning"
  71. plain
  72. icon="el-icon-download"
  73. size="mini"
  74. :loading="exportLoading"
  75. @click="handleExport"
  76. v-hasPermi="['grassrootsregistration:bdgldrill:export']"
  77. >导出</el-button
  78. >
  79. </el-col> -->
  80. <!-- <right-toolbar
  81. :showSearch.sync="showSearch"
  82. @queryTable="getList"
  83. ></right-toolbar> -->
  84. </el-row>
  85. <el-table
  86. v-loading="loading"
  87. :data="bdgldrillList"
  88. @selection-change="handleSelectionChange"
  89. :header-cell-style="{ background: '#003C69', color: 'white' }"
  90. >
  91. <el-table-column type="selection" width="55" align="center" />
  92. <!-- <el-table-column label="序号" align="center" prop="id" /> -->
  93. <el-table-column label="序号" type="index" width="50" align="center">
  94. <template scope="scope">
  95. <span>{{
  96. (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
  97. }}</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="单位" align="center" prop="unitId" />
  101. <el-table-column label="军事主官" align="center" prop="id" />
  102. <el-table-column label="训练项目" align="center" prop="project" />
  103. <!-- <el-table-column label="训练内容" align="center" prop="contents" /> -->
  104. <el-table-column
  105. label="训练时间"
  106. align="center"
  107. prop="drillTime"
  108. width="180"
  109. >
  110. <template slot-scope="scope">
  111. <span>{{ parseTime(scope.row.drillTime, "{y}-{m}-{d}") }}</span>
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="训练地点" align="center" prop="address" />
  115. <el-table-column label="应训" align="center" prop="oughtTo" />
  116. <el-table-column label="实训" align="center" prop="actual" />
  117. <!-- <el-table-column label="参训率" align="center" prop="probability" /> -->
  118. <!-- <el-table-column label="效果" align="center" prop="result" /> -->
  119. <el-table-column label="消耗" align="center" prop="expend" />
  120. <!-- <el-table-column label="备注" align="center" prop="remark" />
  121. <el-table-column label="军事主官" align="center" prop="peopleId" /> -->
  122. <el-table-column
  123. label="操作"
  124. align="center"
  125. class-name="small-padding fixed-width"
  126. width="200"
  127. >
  128. <template slot-scope="scope">
  129. <el-button
  130. size="btk"
  131. type="text"
  132. @click="handleChakan(scope.row)"
  133. v-hasPermi="['grassrootsregistration:bdgldiary:edit']"
  134. ><span class="chakan">查看</span></el-button
  135. >
  136. <el-button
  137. size="btu"
  138. type="text"
  139. @click="handleUpdate(scope.row)"
  140. v-hasPermi="['grassrootsregistration:bdgldrill:edit']"
  141. ><span class="edit">修改</span></el-button
  142. >
  143. <el-button
  144. size="btd"
  145. type="text"
  146. @click="handleDelete(scope.row)"
  147. v-hasPermi="['grassrootsregistration:bdgldrill:remove']"
  148. ><span class="delete">删除</span></el-button
  149. >
  150. </template>
  151. </el-table-column>
  152. </el-table>
  153. <pagination
  154. v-show="total > 0"
  155. :total="total"
  156. :page.sync="queryParams.pageNum"
  157. :limit.sync="queryParams.pageSize"
  158. @pagination="getList"
  159. />
  160. <!-- 添加或修改军事训练登记簿对话框 -->
  161. <el-dialog
  162. :title="title"
  163. :visible.sync="open"
  164. width="1016px"
  165. append-to-body
  166. :close-on-click-modal="false"
  167. >
  168. <div class="jiben">基本信息</div>
  169. <el-form
  170. ref="form"
  171. :model="form"
  172. :rules="rules"
  173. label-width="80px"
  174. :inline="true"
  175. >
  176. <el-form-item label="单位" prop="unitId">
  177. <el-input v-model="form.unitId" placeholder="请输入单位" />
  178. </el-form-item>
  179. <el-form-item label="训练类别" prop="project">
  180. <el-input v-model="form.project" placeholder="请输入训练类别" />
  181. </el-form-item>
  182. <el-form-item label="训练内容" prop="contents">
  183. <el-input v-model="form.contents" placeholder="请输入训练内容" />
  184. <!-- <el-input
  185. v-model="form.contents"
  186. type="textarea"
  187. placeholder="请输入内容"
  188. /> -->
  189. </el-form-item>
  190. <el-form-item label="训练时间" prop="drillTime">
  191. <el-date-picker
  192. clearable
  193. size="small"
  194. v-model="form.drillTime"
  195. type="date"
  196. value-format="yyyy-MM-dd"
  197. placeholder="请选择训练时间"
  198. :editable="false"
  199. >
  200. </el-date-picker>
  201. </el-form-item>
  202. <el-form-item label="训练地点" prop="address">
  203. <el-input v-model="form.address" placeholder="请输入训练地点" />
  204. </el-form-item>
  205. <el-form-item label="应训" prop="oughtTo">
  206. <el-input v-model="form.oughtTo" placeholder="请输入应训" />
  207. </el-form-item>
  208. <el-form-item label="实训" prop="actual">
  209. <el-input v-model="form.actual" placeholder="请输入实训" />
  210. </el-form-item>
  211. <el-form-item label="参训率" prop="probability">
  212. <el-input v-model="form.probability" placeholder="请输入参训率" />
  213. </el-form-item>
  214. <el-form-item label="效果" prop="result">
  215. <el-input v-model="form.result" placeholder="请输入效果" />
  216. </el-form-item>
  217. <el-form-item label="消耗" prop="expend">
  218. <el-input v-model="form.expend" placeholder="请输入消耗" />
  219. </el-form-item>
  220. <el-form-item label="军事主官" prop="peopleId">
  221. <el-input v-model="form.peopleId" placeholder="请输入军事主官" />
  222. </el-form-item>
  223. <div class="jiben">备注</div>
  224. <el-form-item label="" prop="remark">
  225. <div class="box4">
  226. <el-input
  227. v-model="form.remark"
  228. type="textarea"
  229. :rows="3"
  230. placeholder="请输入备注"
  231. autosize
  232. />
  233. </div>
  234. </el-form-item>
  235. </el-form>
  236. <div slot="footer" class="dialog-footer">
  237. <el-button type="primary" @click="submitForm(1)">确 定</el-button>
  238. <el-button @click="cancel" size="btn">取消</el-button>
  239. </div>
  240. </el-dialog>
  241. <div class="fff">
  242. <el-dialog
  243. :visible.sync="menuRoleVisible"
  244. :title="title"
  245. append-to-body
  246. id="chakan"
  247. :close-on-click-modal="false"
  248. >
  249. <bdgldrill
  250. v-if="menuRoleVisible"
  251. ref="menuRole"
  252. :message="wordInfo"
  253. ></bdgldrill>
  254. </el-dialog>
  255. </div>
  256. </div>
  257. </template>
  258. <script>
  259. import bdgldrill from "@/components/look_word/bdgldrill.vue";
  260. import {
  261. listBdgldrill,
  262. getBdgldrill,
  263. delBdgldrill,
  264. addBdgldrill,
  265. updateBdgldrill,
  266. exportBdgldrill,
  267. } from "@/api/grassrootsregistration/bdgldrill";
  268. export default {
  269. name: "Bdgldrill",
  270. components: {
  271. bdgldrill,
  272. },
  273. data() {
  274. return {
  275. //查看页面
  276. menuRoleVisible: false,
  277. wordInfo: {},
  278. //判断关闭
  279. style: "2",
  280. // 遮罩层
  281. loading: true,
  282. // 导出遮罩层
  283. exportLoading: false,
  284. // 选中数组
  285. ids: [],
  286. // 非单个禁用
  287. single: true,
  288. // 非多个禁用
  289. multiple: true,
  290. // 显示搜索条件
  291. showSearch: true,
  292. // 总条数
  293. total: 0,
  294. // 军事训练登记簿表格数据
  295. bdgldrillList: [],
  296. // 弹出层标题
  297. title: "",
  298. // 是否显示弹出层
  299. open: false,
  300. // 查询参数
  301. queryParams: {
  302. pageNum: 1,
  303. pageSize: 10,
  304. project: null,
  305. contents: null,
  306. drillTime: null,
  307. address: null,
  308. oughtTo: null,
  309. actual: null,
  310. probability: null,
  311. result: null,
  312. expend: null,
  313. unitId: null,
  314. peopleId: null,
  315. },
  316. // 表单参数
  317. form: {},
  318. // 表单校验
  319. rules: {
  320. unitId: [
  321. { required: true, message: "单位名称不能为空", trigger: "blur" },
  322. ],
  323. drillTime: [
  324. { required: true, message: "训练时间不能为空", trigger: "blur" },
  325. ],
  326. project: [
  327. { required: true, message: "训练项目不能为空", trigger: "blur" },
  328. ],
  329. address: [
  330. { required: true, message: "训练地点不能为空", trigger: "blur" },
  331. ],
  332. oughtTo: [{ required: true, message: "应讯不能为空", trigger: "blur" }],
  333. actual: [{ required: true, message: "实讯不能为空", trigger: "blur" }],
  334. probability: [
  335. { required: true, message: "参训不能为空", trigger: "blur" },
  336. ],
  337. result: [{ required: true, message: "效果不能为空", trigger: "blur" }],
  338. expend: [{ required: true, message: "消耗不能为空", trigger: "blur" }],
  339. peopleId: [
  340. { required: true, message: "军事主管不能为空", trigger: "blur" },
  341. ],
  342. remark: [{ required: true, message: "备注不能为空", trigger: "blur" }],
  343. },
  344. //下拉
  345. options: [],
  346. };
  347. },
  348. created() {
  349. this.getList();
  350. },
  351. methods: {
  352. /** 查询军事训练登记簿列表 */
  353. getList() {
  354. this.loading = true;
  355. listBdgldrill(this.queryParams).then((response) => {
  356. this.bdgldrillList = response.rows;
  357. this.total = response.total;
  358. this.loading = false;
  359. });
  360. },
  361. // 取消按钮
  362. cancel() {
  363. this.open = false;
  364. this.reset();
  365. },
  366. // 表单重置
  367. reset() {
  368. this.form = {
  369. id: null,
  370. project: null,
  371. contents: null,
  372. drillTime: null,
  373. address: null,
  374. oughtTo: null,
  375. actual: null,
  376. probability: null,
  377. result: null,
  378. expend: null,
  379. remark: null,
  380. unitId: null,
  381. peopleId: null,
  382. };
  383. this.resetForm("form");
  384. },
  385. /** 搜索按钮操作 */
  386. handleQuery() {
  387. this.queryParams.pageNum = 1;
  388. this.getList();
  389. },
  390. /** 重置按钮操作 */
  391. resetQuery() {
  392. this.resetForm("queryForm");
  393. this.handleQuery();
  394. },
  395. /** 对话框重置按钮操作 */
  396. resertwo() {
  397. this.reset();
  398. },
  399. //判断对话框添加事件
  400. // close(){
  401. // if(this.style!=1){
  402. // this.$confirm('您编辑的内容尚未保存,是否退出?', '保存提示', {
  403. // confirmButtonText: '确定',
  404. // cancelButtonText: '取消',
  405. // type: 'warning'
  406. // }).then(() => {
  407. // this.open = false
  408. // // this.submitForm ()
  409. // // this.$message({
  410. // // type: 'success',
  411. // // message: '删除成功!'
  412. // // });
  413. // }).catch(() => {
  414. // this.open = true
  415. // // this.$message({
  416. // // type: 'info',
  417. // // message: '已取消删除'
  418. // // });
  419. // });
  420. // }
  421. // },
  422. // 多选框选中数据
  423. handleSelectionChange(selection) {
  424. this.ids = selection.map((item) => item.id);
  425. this.single = selection.length !== 1;
  426. this.multiple = !selection.length;
  427. },
  428. /** 新增按钮操作 */
  429. handleAdd() {
  430. this.style = 2;
  431. this.reset();
  432. this.open = true;
  433. this.title = "添加军事训练登记簿";
  434. },
  435. /** 修改按钮操作 */
  436. handleUpdate(row) {
  437. this.reset();
  438. const id = row.id || this.ids;
  439. getBdgldrill(id).then((response) => {
  440. this.form = response.data;
  441. this.open = true;
  442. this.title = "修改军事训练登记簿";
  443. });
  444. },
  445. //查看按钮操作
  446. handleChakan(row) {
  447. // 是否隐藏按钮
  448. this.opens = false;
  449. const id = row.id || this.ids;
  450. getBdgldrill(id).then((response) => {
  451. this.wordInfo = response.data;
  452. this.title = "查看军事训练登记簿";
  453. this.menuRoleVisible = true;
  454. });
  455. },
  456. /** 提交按钮 */
  457. submitForm(style) {
  458. this.style = style;
  459. this.$refs["form"].validate((valid) => {
  460. if (valid) {
  461. if (this.form.id != null) {
  462. updateBdgldrill(this.form).then((response) => {
  463. this.$modal.msgSuccess("修改成功");
  464. this.open = false;
  465. this.getList();
  466. });
  467. } else {
  468. addBdgldrill(this.form).then((response) => {
  469. this.$modal.msgSuccess("新增成功");
  470. this.open = false;
  471. this.getList();
  472. });
  473. }
  474. }
  475. });
  476. },
  477. /** 删除按钮操作 */
  478. handleDelete(row) {
  479. const ids = row.id || this.ids;
  480. this.$modal
  481. // .confirm('是否确认删除军事训练登记簿编号为"' + ids + '"的数据项?')
  482. .confirm("是否确认删除该数据?")
  483. .then(function () {
  484. return delBdgldrill(ids);
  485. })
  486. .then(() => {
  487. this.getList();
  488. this.$modal.msgSuccess("删除成功");
  489. })
  490. .catch(() => {});
  491. },
  492. /** 导出按钮操作 */
  493. handleExport() {
  494. const queryParams = this.queryParams;
  495. this.$modal
  496. .confirm("是否确认导出所有军事训练登记簿数据项?")
  497. .then(() => {
  498. this.exportLoading = true;
  499. return exportBdgldrill(queryParams);
  500. })
  501. .then((response) => {
  502. this.$download.name(response.msg);
  503. this.exportLoading = false;
  504. })
  505. .catch(() => {});
  506. },
  507. },
  508. };
  509. </script>
  510. <style scoped>
  511. /* 对话框背景颜色 */
  512. ::v-deep .el-dialog {
  513. background: #004d86 !important;
  514. }
  515. ::v-deep .el-textarea__inner {
  516. width: 920px;
  517. height: 104px;
  518. margin: auto;
  519. }
  520. ::v-deep .el-dialog__header {
  521. border-bottom: 1px solid #718a9d;
  522. }
  523. ::v-deep .el-dialog__title {
  524. color: #fff;
  525. font: 18px;
  526. }
  527. ::v-deep .el-dialog__headerbtn .el-dialog__close {
  528. color: #fff;
  529. }
  530. ::v-deep .el-form-item__label {
  531. font: 16px;
  532. color: #fff;
  533. width: 100px !important;
  534. }
  535. ::v-deep .el-input__inner {
  536. /* width: 200px !important;
  537. height: 36px; */
  538. background: transparent;
  539. color: #fff;
  540. border: 1px solid white !important;
  541. border-color: #fff !important;
  542. }
  543. /* 单位框背景颜色 */
  544. ::v-deep .vue-treeselect__control {
  545. background: #004d86 !important;
  546. }
  547. /* 基本信息背景 */
  548. .jiben {
  549. width: 920px;
  550. height: 32px;
  551. background-image: url(../../../images/小标题底.png);
  552. margin-bottom: 25px;
  553. color: #fff;
  554. padding-left: 16px;
  555. line-height: 32px;
  556. }
  557. /*调整表单间距 */
  558. ::v-deep .el-form-item__content {
  559. width: 200px;
  560. }
  561. ::v-deep .el-input__inner {
  562. cursor: pointer !important;
  563. }
  564. /* 底部确定取消按钮 */
  565. ::v-deep .el-dialog__footer {
  566. padding: 30px 50px;
  567. }
  568. ::v-deep .el-dialog__body {
  569. margin: 10px 30px 20px 50px;
  570. padding-top: 20px !important;
  571. box-sizing: border-box;
  572. /* padding: 30px 12px 30px 28px; */
  573. }
  574. .contents {
  575. padding: 0px 40px !important;
  576. }
  577. /* 下拉菜单 */
  578. .el-dropdown-link {
  579. cursor: pointer;
  580. color: #409eff;
  581. }
  582. .el-icon-arrow-down {
  583. font-size: 12px;
  584. }
  585. /* 刷新图标 */
  586. /* .el-icon-refresh {
  587. width: 76px;
  588. height: 36px;
  589. color: #fff;
  590. background-color: #1d96ff !important;
  591. border-radius: 4px;
  592. border: none;
  593. margin-left: 20px;
  594. font-size: 14px;
  595. } */
  596. /* 下拉菜单字体/背景颜色 */
  597. .el-select-dropdown__item.hover,
  598. .el-select-dropdown__item:hover {
  599. background-color: #004d86;
  600. color: #fff;
  601. }
  602. .el-select-dropdown__item {
  603. color: #fff;
  604. }
  605. /* 时间选择 */
  606. ::v-deep .el-input--small .el-input__inner {
  607. width: 200px;
  608. height: 36px;
  609. line-height: 36px;
  610. }
  611. .el-date-editor.el-input {
  612. width: 200px;
  613. height: 36px;
  614. line-height: 36px;
  615. }
  616. ::v-deep .el-date-editor.el-input .el-input__inner {
  617. height: 36px;
  618. line-height: 36px;
  619. }
  620. /* 单位框背景颜色 */
  621. ::v-deep .vue-treeselect__control {
  622. background: #004d86 !important;
  623. color: #fff;
  624. }
  625. /* 单位下拉菜单选中字体颜色 */
  626. ::v-deep .vue-treeselect__single-value {
  627. color: #fff !important;
  628. }
  629. /* 分页按钮 */
  630. ::v-deep .el-pagination.is-background .el-pager li {
  631. background-color: #004d86;
  632. color: #fff;
  633. }
  634. ::v-deep .el-pagination.is-background .btn-next {
  635. background-color: #004d86;
  636. color: #fff;
  637. }
  638. /* 底部确定取消按钮 */
  639. ::v-deep .el-dialog__footer {
  640. padding: 18px 42px 30px 0px;
  641. margin-right: 30px;
  642. }
  643. /* 增加按钮弹框 */
  644. ::v-deep .el-dialog {
  645. width: 1060px !important;
  646. }
  647. ::v-deep .el-dialog__body {
  648. padding: none !important;
  649. }
  650. ::v-deep .box4 .el-textarea__inner {
  651. min-height: 120px !important;
  652. }
  653. /* 调整输入框提示文字颜色 */
  654. ::v-deep .vue-treeselect__placeholder {
  655. color: #bdbdbd4f !important;
  656. }
  657. ::v-deep input::-webkit-input-placeholder {
  658. color: #bdbdbd4f !important;
  659. }
  660. ::v-deep input:-moz-placeholder {
  661. color: #bdbdbd4f !important;
  662. }
  663. /* 文本域提示文字颜色 */
  664. ::v-deep ::-webkit-input-placeholder {
  665. color: #bdbdbd4f !important;
  666. }
  667. </style>