workersList.vue 17 KB

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