workersList.vue 15 KB

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