index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. <template>
  2. <div class="tenant">
  3. <div class="content">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :tableHeight="tableHeight"
  8. :config="config"
  9. :loading="loading"
  10. highlight-current-row
  11. :selectConfig="selectConfig"
  12. :table-events="{}"
  13. :action-list="[]"
  14. :onMoreSearch="true"
  15. @moreSearch="clickMoreSearch"
  16. @get-list="getList"
  17. >
  18. <template #finishStatus="{ item }">
  19. <div>
  20. <span
  21. style="padding: 4px; color: #fff"
  22. :class="[item.finishStatus == 1 ? 'active' : 'disActive']"
  23. >
  24. {{
  25. proxy.dictValueLabel(item.finishStatus, finishStatusData)
  26. }}</span
  27. >
  28. </div>
  29. </template>
  30. </byTable>
  31. </div>
  32. <el-dialog
  33. :title="'高级检索'"
  34. v-model="dialogVisible"
  35. width="700"
  36. v-loading="loading"
  37. destroy-on-close
  38. >
  39. <byForm
  40. :formConfig="formConfig"
  41. :formOption="formOption"
  42. v-model="sourceList.pagination"
  43. :rules="rules"
  44. ref="byform"
  45. >
  46. </byForm>
  47. <template #footer>
  48. <el-button @click="moreSearchReset" size="large">重置</el-button>
  49. <el-button @click="moreSearchQuery" type="primary" size="large"
  50. >搜索</el-button
  51. >
  52. </template>
  53. </el-dialog>
  54. <el-dialog
  55. :title="'查看工序图纸'"
  56. v-model="dialogVisibleOne"
  57. width="700"
  58. destroy-on-close
  59. >
  60. <div>
  61. <div
  62. v-for="(item, index) in allData"
  63. :key="item.id"
  64. style="margin-bottom: 20px"
  65. >
  66. <div style="margin-top: 5px">
  67. 工序名称:{{ item.productionProcessesName }}
  68. </div>
  69. <div style="margin-top: 5px">
  70. 工序负责人:{{ item.personLiableName }}
  71. </div>
  72. <div style="margin-top: 5px">
  73. 工序图纸:
  74. <span
  75. v-for="file in item.fileList"
  76. :key="file.id"
  77. style="margin-right: 20px; cursor: pointer; color: #409eff"
  78. @click="handleOpenFile(file)"
  79. >{{ file.fileName }}</span
  80. >
  81. </div>
  82. </div>
  83. </div>
  84. <template #footer>
  85. <el-button @click="dialogVisibleOne = false" size="large"
  86. >取 消</el-button
  87. >
  88. </template>
  89. </el-dialog>
  90. </div>
  91. </template>
  92. <script setup>
  93. import { ElMessage, ElMessageBox } from "element-plus";
  94. import byTable from "@/components/byTable/index";
  95. import byForm from "@/components/byForm/index";
  96. const { proxy } = getCurrentInstance();
  97. const loading = ref(false);
  98. const submitLoading = ref(false);
  99. const sourceList = ref({
  100. data: [],
  101. pagination: {
  102. total: 3,
  103. pageNum: 1,
  104. pageSize: 10,
  105. keyword: "",
  106. contractCode: "",
  107. workOrderCode: "",
  108. productionPlanCode: "",
  109. productionTaskCode: "",
  110. productCode: "",
  111. productName: "",
  112. productSn: "",
  113. dueDate: "",
  114. productionProcessesName: "",
  115. personLiableName: "",
  116. getFinishStatus: "",
  117. getFinishTime: "",
  118. },
  119. });
  120. const tableHeight = ref(0);
  121. const getTableHeight = () => {
  122. tableHeight.value = window.innerHeight - 275;
  123. };
  124. getTableHeight();
  125. const finishStatusData = ref([
  126. {
  127. label: "未完成",
  128. value: "0",
  129. },
  130. {
  131. label: "完成",
  132. value: "1",
  133. },
  134. ]);
  135. const dialogVisible = ref(false);
  136. const modalType = ref("add");
  137. const rules = ref({
  138. workOrderId: [{ required: true, message: "请选择工单", trigger: "change" }],
  139. startDate: [
  140. { required: true, message: "请选择计划开始时间", trigger: "change" },
  141. ],
  142. stopDate: [
  143. { required: true, message: "请选择计划结束时间", trigger: "change" },
  144. ],
  145. quantity: [{ required: true, message: "请输入计划数量", trigger: "blur" }],
  146. });
  147. const workOrderData = ref([]);
  148. const workOrderDataOne = ref([]);
  149. const statusData = ref([
  150. {
  151. label: "未开始",
  152. value: "0",
  153. },
  154. {
  155. label: "进行中",
  156. value: "1",
  157. },
  158. {
  159. label: "完成",
  160. value: "2",
  161. },
  162. ]);
  163. const selectConfig = reactive([
  164. {
  165. label: "完成状态",
  166. prop: "getFinishStatus",
  167. data: finishStatusData.value,
  168. },
  169. ]);
  170. const config = computed(() => {
  171. return [
  172. {
  173. attrs: {
  174. label: "合同编号",
  175. prop: "contractCode",
  176. width: 110,
  177. },
  178. },
  179. {
  180. attrs: {
  181. label: "工单编号",
  182. prop: "workOrderCode",
  183. width: 110,
  184. },
  185. },
  186. // {
  187. // attrs: {
  188. // label: "计划编号",
  189. // prop: "productionPlanCode",
  190. // width: 110,
  191. // },
  192. // },
  193. // {
  194. // attrs: {
  195. // label: "任务编号",
  196. // prop: "productionTaskCode",
  197. // width: 110,
  198. // },
  199. // },
  200. {
  201. attrs: {
  202. label: "产品SN",
  203. prop: "productSn",
  204. width: 140,
  205. },
  206. },
  207. {
  208. attrs: {
  209. label: "产品编号",
  210. prop: "productCode",
  211. width: 100,
  212. },
  213. },
  214. {
  215. attrs: {
  216. label: "产品名称",
  217. prop: "productName",
  218. "min-width": 150,
  219. },
  220. },
  221. {
  222. attrs: {
  223. label: "产品规格",
  224. prop: "productSpec",
  225. width: 100,
  226. },
  227. },
  228. {
  229. attrs: {
  230. label: "任务完成期限",
  231. prop: "dueDate",
  232. width: 110,
  233. },
  234. },
  235. {
  236. attrs: {
  237. label: "工序名称列表",
  238. prop: "productionProcessesNames",
  239. "min-width": 250,
  240. },
  241. },
  242. {
  243. attrs: {
  244. label: "当前工序名称",
  245. prop: "productionProcessesName",
  246. width: 120,
  247. },
  248. },
  249. {
  250. attrs: {
  251. label: "当前工序负责人",
  252. prop: "personLiableName",
  253. width: 130,
  254. },
  255. },
  256. {
  257. attrs: {
  258. label: "完成状态",
  259. slot: "finishStatus",
  260. width: 80,
  261. align: "center",
  262. },
  263. // render(finishStatus) {
  264. // return proxy.dictValueLabel(finishStatus, finishStatusData.value);
  265. // },
  266. },
  267. {
  268. attrs: {
  269. label: "完成时间",
  270. prop: "finishTime",
  271. width: 160,
  272. },
  273. },
  274. {
  275. attrs: {
  276. label: "操作",
  277. width: "80",
  278. align: "center",
  279. },
  280. renderHTML(row) {
  281. return [
  282. {
  283. attrs: {
  284. label: "查看",
  285. type: "primary",
  286. text: true,
  287. },
  288. el: "button",
  289. click() {
  290. getDtl(row);
  291. },
  292. },
  293. ];
  294. },
  295. },
  296. ];
  297. });
  298. const formOption = reactive({
  299. inline: true,
  300. labelWidth: 100,
  301. itemWidth: 100,
  302. rules: [],
  303. });
  304. const byform = ref(null);
  305. const formConfig = computed(() => {
  306. return [
  307. {
  308. type: "input",
  309. itemType: "text",
  310. prop: "contractCode",
  311. label: "合同编号",
  312. itemWidth: 50,
  313. },
  314. {
  315. type: "input",
  316. itemType: "text",
  317. prop: "workOrderCode",
  318. label: "工单编号",
  319. itemWidth: 50,
  320. },
  321. {
  322. type: "input",
  323. itemType: "text",
  324. prop: "productionPlanCode",
  325. label: "计划编号",
  326. itemWidth: 50,
  327. },
  328. {
  329. type: "input",
  330. itemType: "text",
  331. prop: "productionTaskCode",
  332. label: "任务编号",
  333. itemWidth: 50,
  334. },
  335. {
  336. type: "input",
  337. itemType: "text",
  338. prop: "productCode",
  339. label: "产品编号",
  340. itemWidth: 50,
  341. },
  342. {
  343. type: "input",
  344. itemType: "text",
  345. prop: "productName",
  346. label: "产品名称",
  347. itemWidth: 50,
  348. },
  349. {
  350. type: "input",
  351. itemType: "text",
  352. prop: "productSn",
  353. label: "产品Sn",
  354. itemWidth: 50,
  355. },
  356. {
  357. type: "date",
  358. itemType: "date",
  359. prop: "dueDate",
  360. label: "任务完成期限",
  361. itemWidth: 50,
  362. style: {
  363. width: "100%",
  364. },
  365. },
  366. {
  367. type: "input",
  368. itemType: "text",
  369. prop: "productionProcessesName",
  370. label: "当前工序名称",
  371. itemWidth: 50,
  372. },
  373. {
  374. type: "input",
  375. itemType: "text",
  376. prop: "personLiableName",
  377. label: "当前工序负责人",
  378. itemWidth: 50,
  379. },
  380. {
  381. type: "select",
  382. prop: "getFinishStatus",
  383. label: "任务完成状态",
  384. itemWidth: 50,
  385. style: {
  386. width: "100%",
  387. },
  388. data: finishStatusData.value,
  389. },
  390. {
  391. type: "date",
  392. itemType: "date",
  393. prop: "getFinishTime",
  394. label: "任务完成时间",
  395. itemWidth: 50,
  396. style: {
  397. width: "100%",
  398. },
  399. },
  400. ];
  401. });
  402. const getList = async (req) => {
  403. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  404. loading.value = true;
  405. proxy
  406. .post("/productionTaskDetail/taskProgressPage", sourceList.value.pagination)
  407. .then((message) => {
  408. sourceList.value.data = message.rows;
  409. sourceList.value.pagination.total = message.total;
  410. setTimeout(() => {
  411. loading.value = false;
  412. }, 200);
  413. });
  414. };
  415. getList();
  416. const clickMoreSearch = () => {
  417. dialogVisible.value = true;
  418. };
  419. const moreSearchQuery = () => {
  420. dialogVisible.value = false;
  421. getList();
  422. };
  423. const moreSearchReset = () => {
  424. sourceList.value.pagination = {
  425. total: 0,
  426. pageNum: sourceList.value.pagination.pageNum,
  427. pageSize: sourceList.value.pagination.pageSize,
  428. keyword: "",
  429. contractCode: "",
  430. workOrderCode: "",
  431. productionPlanCode: "",
  432. productionTaskCode: "",
  433. productCode: "",
  434. productName: "",
  435. productSn: "",
  436. dueDate: "",
  437. productionProcessesName: "",
  438. personLiableName: "",
  439. getFinishStatus: "",
  440. getFinishTime: "",
  441. };
  442. moreSearchQuery();
  443. };
  444. const dialogVisibleOne = ref(false);
  445. const allData = ref([]);
  446. const getDtl = (row) => {
  447. proxy.post("/productionTaskDetail/detail", { id: row.id }).then((res) => {
  448. if (
  449. res.productionTaskDetailRecordList &&
  450. res.productionTaskDetailRecordList.length > 0
  451. ) {
  452. let ids = res.productionTaskDetailRecordList.map((x) => x.id);
  453. allData.value = res.productionTaskDetailRecordList;
  454. dialogVisibleOne.value = true;
  455. proxy
  456. .post("/fileInfo/getList", { businessIdList: ids })
  457. .then((fileObj) => {
  458. for (let i = 0; i < allData.value.length; i++) {
  459. const e = allData.value[i];
  460. for (const key in fileObj) {
  461. if (e.id === key) {
  462. e.fileList = fileObj[key];
  463. }
  464. }
  465. }
  466. });
  467. } else {
  468. return ElMessage({
  469. message: "该任务还未开始",
  470. type: "info",
  471. });
  472. }
  473. });
  474. };
  475. const handleOpenFile = (file) => {
  476. window.open(file.fileUrl, "_blank");
  477. };
  478. </script>
  479. <style lang="scss" scoped>
  480. .tenant {
  481. padding: 20px;
  482. }
  483. ::v-deep(.el-input-number .el-input__inner) {
  484. text-align: left;
  485. }
  486. .active {
  487. background: #a6dd82;
  488. }
  489. .disActive {
  490. background: #fa9841;
  491. }
  492. </style>