workersList.vue 16 KB

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