workersList.vue 12 KB

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