workersList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. <template>
  2. <div class="workersList-container">
  3. <simple-form
  4. :form="table_form"
  5. :handle="table_handle"
  6. @search="handleSearch"
  7. @summary="handleVisible('summary')"
  8. @add="handleVisible('add')"
  9. >
  10. </simple-form>
  11. <simple-table
  12. :list="table_list"
  13. :config="table_config"
  14. :loading="table_loading"
  15. :multiple="true"
  16. :handle-row="table_handle_row"
  17. @selection="handleSelect"
  18. @check="handleCheck"
  19. @edit="handleEdit"
  20. @approve="handleApprove"
  21. ></simple-table>
  22. <simple-pagination
  23. :page="page"
  24. :total="total"
  25. @change="handleChange"
  26. ></simple-pagination>
  27. <simple-dialog
  28. :title="title"
  29. :fullscreen="true"
  30. @cancel="handleVisible('add')"
  31. :visible="add_visible"
  32. >
  33. <el-form label-width="120px" :model="add_form" ref="add_ref">
  34. <el-form-item
  35. label="提出人"
  36. prop="proposer"
  37. :rules="{
  38. required: true,
  39. message: '提出人不能为空',
  40. trigger: 'blur',
  41. }"
  42. >
  43. <el-input v-model="add_form.proposer"></el-input>
  44. </el-form-item>
  45. <el-form-item
  46. label="联系电话"
  47. prop="telephone"
  48. :rules="{
  49. required: true,
  50. message: '联系电话不能为空',
  51. trigger: 'blur',
  52. }"
  53. >
  54. <el-input v-model="add_form.telephone"></el-input>
  55. </el-form-item>
  56. <el-form-item
  57. label="网格划分需求"
  58. prop="wanggeText"
  59. :rules="{
  60. required: true,
  61. message: '网格划分需求不能为空',
  62. trigger: 'blur',
  63. }"
  64. >
  65. <el-input type="textarea" v-model="add_form.wanggeText"></el-input>
  66. </el-form-item>
  67. <el-form-item label="附件上传" prop="file">
  68. <myUpload
  69. @uploadBack="uploadBack"
  70. :fileInfo="fileInfo"
  71. :fileList="fileInfo.fileList"
  72. ></myUpload>
  73. </el-form-item>
  74. <el-form-item label="审批轨迹" prop="" v-if="edit_visible">
  75. <simple-table
  76. :list="table_list_approve"
  77. :config="table_config_approve"
  78. :loading="table_loading_approve"
  79. ></simple-table>
  80. </el-form-item>
  81. <el-form-item
  82. label="审批意见"
  83. prop="desc"
  84. v-if="edit_visible && approve_visible"
  85. >
  86. <el-input type="textarea" v-model="add_form.remark"></el-input>
  87. </el-form-item>
  88. </el-form>
  89. <template v-slot:footer>
  90. <div v-if="title === '新建'">
  91. <el-button @click="handleSubmit('save')" type="primary"
  92. >保存</el-button
  93. >
  94. <el-button @click="handleSubmit('add')" type="primary"
  95. >提交</el-button
  96. >
  97. <el-button @click="handleVisible('add')" type="default"
  98. >取消</el-button
  99. >
  100. </div>
  101. <div v-else-if="title === '查看'">
  102. <div></div>
  103. </div>
  104. <div v-else-if="title === '发起人处理'">
  105. <el-button @click="handleSubmit('save')" type="primary"
  106. >保存</el-button
  107. >
  108. <el-button @click="handleSubmit('add')" type="primary">重新提交</el-button>
  109. <el-button @click="handleVisible('add')" type="default"
  110. >取消</el-button
  111. >
  112. </div>
  113. <div v-else>
  114. <el-button @click="handleSubmit('adopt')" type="primary"
  115. >保存</el-button
  116. >
  117. <el-button @click="handleSubmit('failed')" type="default"
  118. >退回修改</el-button
  119. >
  120. </div>
  121. </template>
  122. </simple-dialog>
  123. <simple-dialog
  124. title="工单汇总"
  125. width="40%"
  126. @cancel="handleVisible('summary')"
  127. @confirm="handleSummary"
  128. :visible="summary_visible"
  129. >
  130. <div class="summary">
  131. <p>是否要对所选工单进行汇总?</p>
  132. <p class="summary-tip">
  133. 可对未审批的区县网格划分审批工单合并为同一条工单,由相关审批人员进行审批,减少审批工作量
  134. </p>
  135. </div>
  136. </simple-dialog>
  137. </div>
  138. </template>
  139. <script>
  140. import myUpload from "../../../components/upload";
  141. import simpleForm from "../performance/components/form.vue";
  142. import simpleTable from "../performance/components/table.vue";
  143. import simpleDialog from "../performance/components/dialog.vue";
  144. import simplePagination from "../performance/components/pagination.vue";
  145. export default {
  146. components: {
  147. simpleForm,
  148. simpleDialog,
  149. myUpload,
  150. simpleTable,
  151. simplePagination,
  152. },
  153. data() {
  154. return {
  155. fileInfo: {
  156. limit: 3,
  157. url: "mkWangge/upload",
  158. fileList: [],
  159. },
  160. attList: [],
  161. page: 1,
  162. rows: 10,
  163. total: 0,
  164. // 模态框标题
  165. title: "",
  166. // 是否为查看状态
  167. isCheck: false,
  168. // 汇总id列表
  169. summaryIds: [],
  170. table_search: {},
  171. // 新建模态框
  172. add_visible: false,
  173. summary_visible: false,
  174. edit_visible: false,
  175. approve_visible: false,
  176. ids: [],
  177. add_form: {},
  178. table_handle: [
  179. {
  180. label: "工单汇总",
  181. props: "summary",
  182. },
  183. {
  184. label: "新建",
  185. props: "add",
  186. },
  187. ],
  188. table_form: [
  189. {
  190. label: "公司名称",
  191. props: "companyName",
  192. type: "input",
  193. },
  194. {
  195. label: "状态",
  196. props: "approve",
  197. type: "select",
  198. // 0.待办 1.已办
  199. dictionary: [
  200. {
  201. label: "待办",
  202. value: "0",
  203. },
  204. {
  205. label: "已办",
  206. value: "1",
  207. },
  208. ],
  209. },
  210. ],
  211. // 列表数据
  212. table_list: [
  213. // {
  214. // id: 1,
  215. // companyName: "xq",
  216. // proposer: "mll",
  217. // createTime: 1654563154824,
  218. // status: 0,
  219. // },
  220. // {
  221. // id: 2,
  222. // companyName: "xq",
  223. // proposer: "mll",
  224. // createTime: 1654963568455,
  225. // status: 1,
  226. // },
  227. ],
  228. table_loading: false,
  229. // 表格里的操作按钮
  230. table_handle_row: [
  231. {
  232. label: "查看",
  233. props: "check",
  234. },
  235. {
  236. label: "编辑",
  237. props: "edit",
  238. visible: {
  239. draft: ["0"],
  240. },
  241. },
  242. {
  243. label: "处理",
  244. props: "approve",
  245. visible: {
  246. deal: ["1"],
  247. },
  248. },
  249. ],
  250. // 表头配置
  251. table_config: [
  252. {
  253. label: "序号",
  254. props: "id",
  255. },
  256. {
  257. label: "公司名称",
  258. props: "companyName",
  259. },
  260. {
  261. label: "发起人",
  262. props: "proposer",
  263. },
  264. {
  265. label: "发起时间",
  266. props: "createTime",
  267. },
  268. {
  269. label: "状态",
  270. props: "sts",
  271. type: "dictionary",
  272. dictionary: { 0: "待办", 1: "已办" },
  273. },
  274. ],
  275. // 模态框内表数据
  276. table_list_approve: [],
  277. table_loading_approve: false,
  278. // 模态框内表头配置
  279. table_config_approve: [
  280. {
  281. label: "编号",
  282. props: "number",
  283. },
  284. {
  285. label: "流程环节",
  286. props: "procName",
  287. },
  288. {
  289. label: "处理人",
  290. props: "opName",
  291. },
  292. {
  293. label: "处理工号",
  294. props: "opNo",
  295. },
  296. {
  297. label: "处理时间",
  298. props: "opTime",
  299. type: "date",
  300. },
  301. {
  302. label: "审批意见",
  303. props: "remark",
  304. // type: "dictionary",
  305. // dictionary: { 0: "同意", 1: "不同意" },
  306. },
  307. ],
  308. };
  309. },
  310. mounted() {
  311. this.handleInit();
  312. },
  313. methods: {
  314. // 表格数据初始化
  315. handleInit() {
  316. // this.table_loading = true;
  317. // console.log(data);
  318. let reqdata = {
  319. ...this.table_search,
  320. type: "1",
  321. page: this.page,
  322. pageSize: this.rows,
  323. };
  324. this.$http({
  325. url: "/mkWangge/queryPage",
  326. method: "post",
  327. headers: {
  328. "Content-Type": "application/json",
  329. },
  330. data: reqdata,
  331. }).then(({ data: { count, data } }) => {
  332. this.table_loading = false;
  333. this.total = count;
  334. this.table_list = data.map((element) => ({
  335. ...element,
  336. deal: element.draft === "1" && element.sts === "0" ? "1" : "0",
  337. }));
  338. console.log(this.table_list);
  339. });
  340. },
  341. // 搜索事件
  342. handleSearch(data) {
  343. this.table_search = data;
  344. this.page = 1;
  345. this.handleInit();
  346. },
  347. handleVisible(props) {
  348. this.approve_visible = false;
  349. switch (props) {
  350. case "add":
  351. this.add_visible = !this.add_visible;
  352. this.edit_visible = false;
  353. this.approve_visible = false;
  354. this.title = "新建";
  355. this.isCheck = false;
  356. this.add_form = {};
  357. break;
  358. case "summary":
  359. this.summary_visible = !this.summary_visible;
  360. break;
  361. case "edit":
  362. this.edit_visible = !this.edit_visible;
  363. this.add_visible = !this.add_visible;
  364. this.title = "发起人处理";
  365. this.isCheck = false;
  366. break;
  367. case "check":
  368. this.edit_visible = !this.edit_visible;
  369. this.add_visible = !this.add_visible;
  370. this.title = "查看";
  371. this.isCheck = true;
  372. break;
  373. case "approve":
  374. this.edit_visible = !this.edit_visible;
  375. this.add_visible = !this.add_visible;
  376. this.title = "审批";
  377. this.isCheck = false;
  378. this.approve_visible = !this.approve_visible;
  379. break;
  380. }
  381. },
  382. handleSelect(val) {
  383. this.summaryIds = val.map((item) => {
  384. return item.id.toString();
  385. });
  386. // console.log(this.summaryIds);
  387. },
  388. //文件返回值
  389. uploadBack(v) {
  390. console.log(v);
  391. this.attList = v;
  392. },
  393. // 获取模态框信息
  394. getDialogData(row) {
  395. let id = row.id;
  396. let type = row.parentId === null ? "1" : "0";
  397. this.$http({
  398. url: "/mkWangge/getMkWanggeById",
  399. method: "get",
  400. headers: {
  401. "Content-Type": "application/json",
  402. },
  403. params: {
  404. id,
  405. type,
  406. },
  407. }).then(({ data }) => {
  408. let body = data.body;
  409. console.log(body, "body");
  410. this.ids = [body.id.toString()];
  411. this.add_form = {
  412. id: body.id,
  413. proposer: body.proposer,
  414. telephone: body.telephone,
  415. wanggeText: body.wanggeText,
  416. };
  417. this.table_list_approve = body.bpmTaskList;
  418. });
  419. },
  420. // 查看按钮
  421. handleCheck(row) {
  422. if (row.parentLevel === "1") {
  423. this.$router.push({
  424. path: "/approvalExamination",
  425. query: row,
  426. });
  427. } else {
  428. this.getDialogData(row)
  429. this.handleVisible("check");
  430. }
  431. },
  432. // 编辑按钮
  433. handleEdit(row) {
  434. this.getDialogData(row)
  435. this.handleVisible("edit");
  436. },
  437. // 处理按钮
  438. handleApprove(row) {
  439. if (row.parentLevel === "1") {
  440. this.$router.push({
  441. path: "/approvalExamination",
  442. query: {
  443. parentId:row.id.toString(),
  444. },
  445. });
  446. } else {
  447. this.getDialogData(row)
  448. this.handleVisible("approve");
  449. }
  450. },
  451. handleSubmit(type) {
  452. // console.log(this.add_form);
  453. // let _this = this;
  454. let draft = "";
  455. if (type === "add") {
  456. draft = "1";
  457. } else if (type === "save") {
  458. draft = "0";
  459. }
  460. let isAdopt = "";
  461. if (type === "adopt") {
  462. isAdopt = "0";
  463. } else if (type === "failed") {
  464. isAdopt = "1";
  465. }
  466. this.$refs.add_ref.validate((valid) => {
  467. if (valid) {
  468. let reqdata = [
  469. {
  470. ...this.add_form,
  471. procId: "729294602773110788",
  472. draft: draft,
  473. num: "1",
  474. },
  475. ];
  476. if (!this.approve_visible) {
  477. // 编辑/新增
  478. this.$http({
  479. url: "/mkWangge/saveOrUpdateList",
  480. method: "post",
  481. headers: {
  482. "Content-Type": "application/json",
  483. },
  484. data: reqdata,
  485. }).then((res) => {
  486. console.log(res);
  487. this.handleInit();
  488. });
  489. } else {
  490. // 审批
  491. let reqdata = {
  492. ids: this.ids,
  493. remark: this.add_form.remark,
  494. type: isAdopt,
  495. };
  496. console.log(reqdata, "reqdata");
  497. this.$http({
  498. url: "/mkWangge/review",
  499. method: "post",
  500. headers: {
  501. "Content-Type": "application/json",
  502. },
  503. data: {
  504. ...reqdata,
  505. },
  506. }).then((res) => {
  507. console.log(res);
  508. this.handleInit();
  509. });
  510. }
  511. this.edit_visible = false;
  512. this.add_visible = false;
  513. }
  514. });
  515. },
  516. handleSummary() {
  517. if (this.summaryIds.length === 0) {
  518. this.$message({
  519. message: "还未选择要合并的项目",
  520. type: "error",
  521. });
  522. this.handleVisible("summary");
  523. return;
  524. } else {
  525. this.$http({
  526. url: "/mkWangge/huizongWangge",
  527. method: "post",
  528. headers: {
  529. "Content-Type": "application/json",
  530. },
  531. data: this.summaryIds,
  532. }).then((res) => {
  533. console.log(res);
  534. if (res.data.result === 1) {
  535. this.$message({
  536. message: res.data.desc,
  537. type: "error",
  538. });
  539. } else {
  540. this.$message({
  541. message: res.data.desc,
  542. type: "success",
  543. });
  544. }
  545. this.handleInit();
  546. });
  547. this.handleVisible("summary");
  548. }
  549. },
  550. handleChange(page) {
  551. this.page = page;
  552. this.handleInit();
  553. },
  554. handleSelectFilter(row, index) {
  555. // 过滤可被选中的数组
  556. console.log(row, index);
  557. return row;
  558. },
  559. },
  560. };
  561. </script>
  562. <style lang="scss" scoped>
  563. .workersList-container {
  564. background: #ffffff;
  565. padding: 0 20px;
  566. margin: 15px;
  567. overflow: auto;
  568. width: calc(100% - 30px);
  569. max-width: calc(100% - 30px);
  570. height: 100%;
  571. overflow-x: hidden;
  572. }
  573. .simple-container .el-form-item {
  574. padding-bottom: 22px;
  575. }
  576. .summary {
  577. padding: 20px 50px 100px;
  578. font-size: 16px;
  579. .summary-tip {
  580. color: #7f7f7f;
  581. padding-top: 30px;
  582. }
  583. }
  584. ::v-deep .el-row {
  585. padding-top: 12px;
  586. padding-bottom: 12px;
  587. }
  588. </style>