index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  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="auto"
  9. >
  10. <el-form-item label="单位" prop="unitName">
  11. <el-select v-model="queryParams.unitName" clearable placeholder="请选择单位">
  12. <el-option
  13. v-for="dict in deptOptions"
  14. :key="dict.deptId"
  15. :label="dict.deptName"
  16. :value="dict.deptId"
  17. ></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <!-- <el-form-item label="单位" prop="unitName">
  21. <el-select v-model="queryParams.unitName" placeholder="请选择单位" clearable size="small">
  22. <el-option label="请选择字典生成" value />
  23. </el-select>
  24. </el-form-item>-->
  25. <!-- <el-form-item label="部门ID" prop="unitId">
  26. <el-input
  27. v-model="queryParams.unitId"
  28. placeholder="请输入部门ID"
  29. clearable
  30. size="small"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>-->
  34. <el-form-item label="指挥员" prop="commanderName">
  35. <el-select
  36. v-model="queryParams.commanderName"
  37. @change="driverNamefun"
  38. filterable
  39. clearable
  40. placeholder="请选择指挥员"
  41. >
  42. <el-option v-for="item in rylist" :key="item.id" :label="item.name" :value="item"></el-option>
  43. </el-select>
  44. </el-form-item>
  45. <!-- <el-form-item label="指挥员" prop="commanderName">
  46. <el-select v-model="queryParams.commanderName" placeholder="请选择指挥员" clearable size="small">
  47. <el-option label="请选择字典生成" value />
  48. </el-select>
  49. </el-form-item>-->
  50. <!-- <el-form-item label="指挥员ID" prop="commanderId">
  51. <el-input
  52. v-model="queryParams.commanderId"
  53. placeholder="请输入指挥员ID"
  54. clearable
  55. size="small"
  56. @keyup.enter.native="handleQuery"
  57. />
  58. </el-form-item>
  59. <el-form-item label="指挥员电话" prop="commanderPhone">
  60. <el-input
  61. v-model="queryParams.commanderPhone"
  62. placeholder="请输入指挥员电话"
  63. clearable
  64. size="small"
  65. @keyup.enter.native="handleQuery"
  66. />
  67. </el-form-item>
  68. <el-form-item label="参加人员ID" prop="participantsId">
  69. <el-input
  70. v-model="queryParams.participantsId"
  71. placeholder="请输入参加人员ID"
  72. clearable
  73. size="small"
  74. @keyup.enter.native="handleQuery"
  75. />
  76. </el-form-item>-->
  77. <!-- <el-form-item label="开始时间" prop="startTime">
  78. <el-date-picker clearable size="small"
  79. v-model="queryParams.startTime"
  80. type="date"
  81. value-format="yyyy-MM-dd"
  82. placeholder="选择开始时间">
  83. </el-date-picker>
  84. </el-form-item>
  85. <el-form-item label="结束时间" prop="endTime">
  86. <el-date-picker clearable size="small"
  87. v-model="queryParams.endTime"
  88. type="date"
  89. value-format="yyyy-MM-dd"
  90. placeholder="选择结束时间">
  91. </el-date-picker>
  92. </el-form-item>
  93. <el-form-item label="所在位置" prop="adress">
  94. <el-input
  95. v-model="queryParams.adress"
  96. placeholder="请输入所在位置"
  97. clearable
  98. size="small"
  99. @keyup.enter.native="handleQuery"
  100. />
  101. </el-form-item>-->
  102. <el-form-item>
  103. <el-button type="primary" size="btn" @click="handleQuery">搜索</el-button>
  104. <el-button size="btr" @click="resetQuery">重置</el-button>
  105. </el-form-item>
  106. </el-form>
  107. <el-row :gutter="10" class="mb8">
  108. <el-col :span="1.5">
  109. <el-button
  110. type="primary"
  111. plain
  112. icon="el-icon-plus"
  113. size="mini"
  114. @click="handleAdd"
  115. v-hasPermi="['combatduty:taskdutyinfo:add']"
  116. >新增</el-button>
  117. </el-col>
  118. <el-col :span="1.5">
  119. <el-button
  120. type="success"
  121. plain
  122. icon="el-icon-edit"
  123. size="mini"
  124. :disabled="single"
  125. @click="handleUpdate"
  126. v-hasPermi="['combatduty:taskdutyinfo:edit']"
  127. >修改</el-button>
  128. </el-col>
  129. <el-col :span="1.5">
  130. <el-button
  131. type="danger"
  132. plain
  133. icon="el-icon-delete"
  134. size="mini"
  135. :disabled="multiple"
  136. @click="handleDelete"
  137. v-hasPermi="['combatduty:taskdutyinfo:remove']"
  138. >删除</el-button>
  139. </el-col>
  140. <!-- <el-col :span="1.5">
  141. <el-button
  142. type="warning"
  143. plain
  144. icon="el-icon-download"
  145. size="mini"
  146. :loading="exportLoading"
  147. @click="handleExport"
  148. v-hasPermi="['combatduty:taskdutyinfo:export']"
  149. >导出</el-button>
  150. </el-col>-->
  151. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  152. </el-row>
  153. <el-table
  154. v-loading="loading"
  155. :data="taskdutyinfoList"
  156. @selection-change="handleSelectionChange"
  157. :header-cell-style="{ background: '#003C69', color: 'white' }"
  158. >
  159. <el-table-column type="selection" width="55" align="center" />
  160. <el-table-column label="序号" align="center" type="index" />
  161. <!-- <el-table-column label="主键ID" align="center" prop="id" /> -->
  162. <el-table-column label="单位" align="center" prop="unitName" />
  163. <!-- <el-table-column label="部门ID" align="center" prop="unitId" /> -->
  164. <el-table-column label="指挥员" align="center" prop="commanderName" />
  165. <!-- <el-table-column label="指挥员ID" align="center" prop="commanderId" /> -->
  166. <el-table-column label="指挥员电话" align="center" prop="commanderPhone" />
  167. <!-- <el-table-column label="参加人员" align="center" prop="participantsName" /> -->
  168. <!-- <el-table-column label="参加人员ID" align="center" prop="participantsId" /> -->
  169. <el-table-column label="参加人员" align="center" prop="participantsIds" :formatter="unit2Format" />
  170. <el-table-column label="开始时间" align="center" prop="startTime" width="180">
  171. <template slot-scope="scope">
  172. <span>{{ parseTime(scope.row.startTime, "{y}-{m}-{d}") }}</span>
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="结束时间" align="center" prop="endTime" width="180">
  176. <template slot-scope="scope">
  177. <span>{{ parseTime(scope.row.endTime, "{y}-{m}-{d}") }}</span>
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="所在位置" align="center" prop="adress" />
  181. <el-table-column label="是由" show-overflow-tooltip align="center" prop="question" />
  182. <el-table-column label="备注" show-overflow-tooltip align="center" prop="remarks" />
  183. <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
  184. <template slot-scope="scope">
  185. <el-button
  186. size="btu"
  187. type="text"
  188. @click="handleUpdate(scope.row)"
  189. v-hasPermi="['combatduty:taskdutyinfo:edit']"
  190. >修改</el-button>
  191. <el-button
  192. size="btd"
  193. type="text"
  194. @click="handleDelete(scope.row)"
  195. v-hasPermi="['combatduty:taskdutyinfo:remove']"
  196. >删除</el-button>
  197. </template>
  198. </el-table-column>
  199. </el-table>
  200. <pagination
  201. v-show="total > 0"
  202. :total="total"
  203. :page.sync="queryParams.pageNum"
  204. :limit.sync="queryParams.pageSize"
  205. @pagination="getList"
  206. />
  207. <!-- 添加或修改执行任务对话框 -->
  208. <el-dialog :title="title" :visible.sync="open" width="1016px" append-to-body>
  209. <el-form ref="form" :model="form" :rules="rules" label-width="80px" :inline="true">
  210. <div class="jiben">基本信息</div>
  211. <el-form-item label="单位" prop="unitName">
  212. <el-select v-model="form.unitName" @change="unitNamechange" clearable placeholder="请选择单位">
  213. <el-option
  214. v-for="dict in deptOptions"
  215. :key="dict.deptId"
  216. :label="dict.deptName"
  217. :value="dict"
  218. ></el-option>
  219. </el-select>
  220. </el-form-item>
  221. <!-- <el-form-item label="部门ID" prop="unitId">
  222. <el-input v-model="form.unitId" placeholder="请输入部门ID" />
  223. </el-form-item>-->
  224. <el-form-item label="指挥员" prop="commanderName">
  225. <el-select
  226. v-model="form.commanderName"
  227. @change="driverNamefun"
  228. filterable
  229. clearable
  230. placeholder="请选择指挥员"
  231. >
  232. <el-option v-for="item in rylist" :key="item.id" :label="item.name" :value="item"></el-option>
  233. </el-select>
  234. </el-form-item>
  235. <!-- <el-form-item label="指挥员" prop="commanderId">
  236. <el-select v-model="form.commanderId" @change="driverNamefun" filterable clearable placeholder="请选择指挥员">
  237. <el-option v-for="item in rylist" :key="item.id" :label="item.name" :value="item"></el-option>
  238. </el-select>
  239. </el-form-item>-->
  240. <el-form-item label="指挥员电话" prop="commanderPhone">
  241. <el-input v-model="form.commanderPhone" placeholder="请输入指挥员电话" />
  242. </el-form-item>
  243. <!-- <el-form-item label="参加人员">
  244. <el-select
  245. v-model="form.participantsId"
  246. multiple
  247. filterable
  248. clearable
  249. placeholder="请选择参加人员"
  250. >
  251. <el-option v-for="item in rylist" :key="item.id" :label="item.name" :value="item.id"></el-option>
  252. </el-select>
  253. </el-form-item>-->
  254. <el-form-item label="参加人员" prop="participantsIds">
  255. <el-select
  256. v-model="form.participantsIds"
  257. multiple
  258. filterable
  259. clearable
  260. placeholder="请选择参加人员"
  261. >
  262. <el-option v-for="item in rylist" :key="item.id" :label="item.name" :value="item.id"></el-option>
  263. </el-select>
  264. </el-form-item>
  265. <el-form-item label="开始时间" prop="startTime">
  266. <el-date-picker
  267. clearable
  268. size="small"
  269. v-model="form.startTime"
  270. type="date"
  271. value-format="yyyy-MM-dd"
  272. placeholder="选择开始时间"
  273. ></el-date-picker>
  274. </el-form-item>
  275. <el-form-item label="结束时间" prop="endTime">
  276. <el-date-picker
  277. clearable
  278. size="small"
  279. v-model="form.endTime"
  280. type="date"
  281. value-format="yyyy-MM-dd"
  282. placeholder="选择结束时间"
  283. ></el-date-picker>
  284. </el-form-item>
  285. <el-form-item label="所在位置" prop="adress">
  286. <el-input v-model="form.adress" placeholder="请输入所在位置" />
  287. </el-form-item>
  288. <div class="jiben">事由</div>
  289. <el-form-item label prop="question">
  290. <el-input v-model="form.question" type="textarea" placeholder="请输入内容" />
  291. </el-form-item>
  292. <div class="jiben">备注</div>
  293. <el-form-item label prop="remarks">
  294. <el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" />
  295. </el-form-item>
  296. </el-form>
  297. <div slot="footer" class="dialog-footer">
  298. <el-button type="primary" @click="submitForm">确 定</el-button>
  299. <el-button @click="cancel">取 消</el-button>
  300. </div>
  301. </el-dialog>
  302. </div>
  303. </template>
  304. <script>
  305. import {
  306. listTaskdutyinfo,
  307. getTaskdutyinfo,
  308. delTaskdutyinfo,
  309. addTaskdutyinfo,
  310. updateTaskdutyinfo,
  311. exportTaskdutyinfo,
  312. rllist,
  313. listPeople,
  314. getDept
  315. } from "@/api/combatduty/taskdutyinfo";
  316. export default {
  317. name: "Taskdutyinfo",
  318. data() {
  319. return {
  320. // 遮罩层
  321. loading: true,
  322. // 导出遮罩层
  323. exportLoading: false,
  324. // 选中数组
  325. ids: [],
  326. // 非单个禁用
  327. single: true,
  328. // 非多个禁用
  329. multiple: true,
  330. // 显示搜索条件
  331. showSearch: true,
  332. // 总条数
  333. total: 0,
  334. // 执行任务表格数据
  335. taskdutyinfoList: [],
  336. // 弹出层标题
  337. title: "",
  338. // 是否显示弹出层
  339. open: false,
  340. // 查询参数
  341. queryParams: {
  342. pageNum: 1,
  343. pageSize: 10,
  344. unitName: null,
  345. unitId: null,
  346. commanderName: null,
  347. commanderId: null,
  348. commanderPhone: null,
  349. participantsId: null,
  350. participantsIds: null,
  351. startTime: null,
  352. endTime: null,
  353. adress: null,
  354. question: null,
  355. remarks: null
  356. },
  357. // 表单参数
  358. form: {},
  359. // 表单校验
  360. rules: {},
  361. //人员数据
  362. rylist: [],
  363. //单位数据
  364. deptOptions: [],
  365. qdflg: null
  366. };
  367. },
  368. created() {
  369. this.getList();
  370. this.gettreeselect();
  371. this.getrylist();
  372. },
  373. methods: {
  374. //获取人员
  375. getrylist() {
  376. listPeople().then(res => {
  377. if (res.code == 200) {
  378. this.rylist = res.rows;
  379. }
  380. });
  381. },
  382. gettreeselect() {
  383. getDept().then(res => {
  384. if (res.code == 200) {
  385. this.deptOptions = res.data;
  386. }
  387. });
  388. },
  389. //单位翻译
  390. // unitNameFormat(row, column) {
  391. // var deptName = "";
  392. // this.deptOptions.map(item => {
  393. // if (item.deptId == row.unitName) {
  394. // deptName = item.deptName;
  395. // }
  396. // });
  397. // return deptName;
  398. // },
  399. unit2Format(row, column) {
  400. var deptName = "";
  401. this.rylist.map(item => {
  402. row.participantsIds.forEach((items, index) => {
  403. if (item.id == items) {
  404. deptName += item.name + " ";
  405. }
  406. });
  407. });
  408. return deptName;
  409. },
  410. /** 查询执行任务列表 */
  411. getList() {
  412. this.loading = true;
  413. listTaskdutyinfo(this.queryParams).then(response => {
  414. this.taskdutyinfoList = response.rows;
  415. this.total = response.total;
  416. this.loading = false;
  417. });
  418. },
  419. // 取消按钮
  420. cancel() {
  421. this.open = false;
  422. this.reset();
  423. },
  424. // 表单重置
  425. reset() {
  426. this.form = {
  427. id: null,
  428. unitName: null,
  429. unitId: null,
  430. commanderName: null,
  431. commanderId: null,
  432. commanderPhone: null,
  433. participantsId: null,
  434. participantsIds: null,
  435. startTime: null,
  436. endTime: null,
  437. adress: null,
  438. question: null,
  439. remarks: null
  440. };
  441. this.resetForm("form");
  442. },
  443. /** 搜索按钮操作 */
  444. handleQuery() {
  445. this.queryParams.pageNum = 1;
  446. this.getList();
  447. },
  448. /** 重置按钮操作 */
  449. resetQuery() {
  450. this.resetForm("queryForm");
  451. this.handleQuery();
  452. },
  453. // 多选框选中数据
  454. handleSelectionChange(selection) {
  455. this.ids = selection.map(item => item.id);
  456. this.single = selection.length !== 1;
  457. this.multiple = !selection.length;
  458. },
  459. /** 新增按钮操作 */
  460. handleAdd() {
  461. this.reset();
  462. this.open = true;
  463. this.title = "添加执行任务";
  464. },
  465. /** 修改按钮操作 */
  466. handleUpdate(row) {
  467. this.reset();
  468. const id = row.id || this.ids;
  469. getTaskdutyinfo(id).then(response => {
  470. this.form = response.data;
  471. this.open = true;
  472. this.title = "修改执行任务";
  473. });
  474. },
  475. /** 提交按钮 */
  476. submitForm() {
  477. this.$refs["form"].validate(valid => {
  478. if (valid) {
  479. if (this.form.id != null) {
  480. updateTaskdutyinfo(this.form).then(response => {
  481. this.$modal.msgSuccess("修改成功");
  482. this.open = false;
  483. this.getList();
  484. });
  485. } else {
  486. addTaskdutyinfo(this.form).then(response => {
  487. this.$modal.msgSuccess("新增成功");
  488. this.open = false;
  489. this.getList();
  490. });
  491. }
  492. }
  493. });
  494. },
  495. /** 删除按钮操作 */
  496. handleDelete(row) {
  497. const ids = row.id || this.ids;
  498. this.$modal
  499. .confirm("是否确认删除该数据项?")
  500. .then(function() {
  501. return delTaskdutyinfo(ids);
  502. })
  503. .then(() => {
  504. this.getList();
  505. this.$modal.msgSuccess("删除成功");
  506. })
  507. .catch(() => {});
  508. },
  509. /** 导出按钮操作 */
  510. handleExport() {
  511. const queryParams = this.queryParams;
  512. this.$modal
  513. .confirm("是否确认导出所有执行任务数据项?")
  514. .then(() => {
  515. this.exportLoading = true;
  516. return exportTaskdutyinfo(queryParams);
  517. })
  518. .then(response => {
  519. this.$download.name(response.msg);
  520. this.exportLoading = false;
  521. })
  522. .catch(() => {});
  523. },
  524. //联系方式
  525. driverNamefun(val) {
  526. // console.log(val)
  527. this.form.commanderName = val.name;
  528. this.form.commanderPhone = val.phone;
  529. this.form.commanderId = val.id;
  530. },
  531. unitNamechange(val) {
  532. this.form.unitId = val.deptId;
  533. this.form.unitName = val.deptName;
  534. },
  535. }
  536. };
  537. </script>
  538. <style scoped>
  539. /* 对话框背景颜色 */
  540. ::v-deep .el-dialog {
  541. background: #004d86 !important;
  542. }
  543. ::v-deep .el-textarea__inner {
  544. width: 890px;
  545. height: 124px;
  546. margin-left: 29px;
  547. }
  548. ::v-deep .el-dialog__header {
  549. border-bottom: 1px solid #718a9d;
  550. }
  551. ::v-deep .el-dialog__title {
  552. color: #fff;
  553. font: 18px;
  554. }
  555. ::v-deep .el-dialog__headerbtn .el-dialog__close {
  556. color: #fff;
  557. }
  558. ::v-deep .el-form-item__label {
  559. font: 16px;
  560. color: #fff;
  561. width: 100px !important;
  562. }
  563. /* 对话框表单间距
  564. ::v-deep .el-dialog__body .el-form-item__label {
  565. width: 175px !important;
  566. }
  567. ::v-deep .el-dialog__body .el-form--inline .el-form-item {
  568. display: inline-block;
  569. margin-right: 10px;
  570. vertical-align: top;
  571. padding-left: 50px;
  572. } */
  573. ::v-deep .el-input__inner {
  574. /* width: 200px !important;
  575. height: 36px; */
  576. background: transparent;
  577. color: #fff;
  578. }
  579. /* 单位框背景颜色 */
  580. ::v-deep .vue-treeselect__control {
  581. background: #004d86 !important;
  582. }
  583. /* 基本信息背景 */
  584. .jiben {
  585. width: 952px;
  586. height: 32px;
  587. background-image: url(../../../images/小标题底.png);
  588. margin-bottom: 25px;
  589. color: #fff;
  590. padding-left: 16px;
  591. line-height: 32px;
  592. }
  593. /*调整表单间距 */
  594. ::v-deep .el-form-item__content {
  595. width: 200px;
  596. }
  597. /* 时间选择 */
  598. ::v-deep .el-input--small .el-input__inner {
  599. width: 200px;
  600. height: 36px;
  601. line-height: 36px;
  602. }
  603. .el-date-editor.el-input {
  604. width: 200px;
  605. height: 36px;
  606. line-height: 36px;
  607. }
  608. ::v-deep .el-date-editor.el-input .el-input__inner {
  609. height: 36px;
  610. line-height: 36px;
  611. }
  612. /* 计数器按钮 */
  613. ::v-deep .el-input-number__increase {
  614. background-color: transparent !important;
  615. border: none;
  616. color: #cccccc;
  617. border-bottom: none !important;
  618. }
  619. ::v-deep .el-input-number__decrease {
  620. background-color: transparent !important;
  621. border: none !important;
  622. color: #cccccc;
  623. }
  624. .el-radio-group {
  625. width: 216px;
  626. }
  627. /* 状态 */
  628. .el-checkbox__label {
  629. color: rgb(204, 198, 198);
  630. }
  631. .el-select-dropdown__item {
  632. /* background-color: white; */
  633. color: #000 !important;
  634. }
  635. .el-form-item ::v-deep .el-input__inner {
  636. width: 200px;
  637. height: 36px;
  638. background: #004d86;
  639. color: #fff important;
  640. border: 1px solid #fff !important;
  641. }
  642. </style>