index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
  1. <template>
  2. <div class="pageIndexClass">
  3. <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
  4. :selectConfig="selectConfig" :action-list="[ {
  5. text: '打印任务单',
  6. action: () => openModal('add'),
  7. disabled: selectIds.length==0,
  8. }
  9. ]" :table-events="{
  10. //element talbe事件都能传
  11. select: selectRow,
  12. 'select-all':selectRow
  13. }" @get-list="getList">
  14. <template #orderCode="{ item }">
  15. <div style="width: 100%" class="el-click" @click="lookDetails(item)">
  16. {{item.orderCode}}
  17. </div>
  18. </template>
  19. <template #pic="{ item }">
  20. <div v-if="item.fileList &&item.fileList.length > 0">
  21. <img :src="item.fileList[0].fileUrl" class="pic" @click="handleClickFile(item.fileList[0])" />
  22. </div>
  23. <div v-else></div>
  24. </template>
  25. <template #picOne="{ item }">
  26. <div v-if="item.fileListOne &&item.fileListOne.length > 0">
  27. <img :src="item.fileListOne[0].fileUrl" class="pic" @click="handleClickFile(item.fileListOne[0])" />
  28. </div>
  29. <div v-else></div>
  30. </template>
  31. <template #size="{ item }">
  32. <div v-if="item.productLength && item.productWidth && item.productHeight">
  33. <span>{{ item.productLength }}</span>*
  34. <span>{{ item.productWidth }}</span>*
  35. <span>{{ item.productHeight }}</span>
  36. </div>
  37. </template>
  38. <template #isOverdue="{item}">
  39. <div style="width: 100%">
  40. <span class="red" v-if="item.isOverdue=='1'"> 逾期 </span>
  41. </div>
  42. </template>
  43. <template #progress="{item}">
  44. <div style="width: 100%">
  45. <el-progress type="circle" :percentage="(Number(item.finishQuantity) / Number(item.quantity))*100" width="60"
  46. :status="(Number(item.finishQuantity) / Number(item.quantity))*100 == 100 ? 'success' : ''" />
  47. </div>
  48. </template>
  49. <template #prodTag="{ item }">
  50. <div style="width: 100%">
  51. <el-popover placement="top-start" :width="300" trigger="hover">
  52. <div>
  53. 备注:{{item.prodRemark}}
  54. </div>
  55. <template #reference>
  56. <div style="width:100%;display:inline-block">
  57. <el-tag style="margin-right: 8px" type="success" v-for="(tag, index) in item.prodTags" :key="index">
  58. {{ dictKeyValue(tag, contractTag) }}
  59. </el-tag>
  60. </div>
  61. </template>
  62. </el-popover>
  63. </div>
  64. </template>
  65. <template v-for="(slotItem, index) in processesData" v-slot:[slotItem.id]="{ item }" :key="slotItem.id">
  66. <div style="width:100%">
  67. <span v-if="isShowCotent(slotItem,item)" style="font-weight:700;min-width:50px;line-height:18px;display:inline-block"
  68. :class="showCotentQuantity(slotItem,item)">
  69. {{showCotent(slotItem,item)}}
  70. </span>
  71. <div v-else class="no-bk">
  72. -
  73. </div>
  74. </div>
  75. </template>
  76. </byTable>
  77. <el-dialog :title="'打印任务单'" v-model="dialogVisible" width="840px" destroy-on-close :before-close="beforeClose">
  78. <div style="height:calc(100vh - 280px);overflow:auto;padding: 0 10px">
  79. <div id="pdfDom" style="width:100%">
  80. <!-- <div style="font-size:20px;text-align:center">
  81. {{printData.name}}
  82. </div> -->
  83. <div v-for="item in printList" :key="item.id" style="margin-bottom:20px">
  84. <div style="font-size:32px;font-weight:700;color:#000;text-align:center">
  85. 生产任务单
  86. </div>
  87. <div style="float:right;margin: 20px 0px 5px 0;">
  88. {{printTime}}
  89. </div>
  90. <table class="table" border>
  91. <tr>
  92. <td style="width:25%">
  93. <div :ref="item.id">
  94. </div>
  95. </td>
  96. <td style="width:75%">
  97. <div style="display:flex;margin-bottom:10px">
  98. <div style="width:50%">
  99. <div class="top-title">
  100. 订单号
  101. </div>
  102. <div>
  103. {{item.orderCode}}
  104. </div>
  105. </div>
  106. <div style="width:50%">
  107. <div class="top-title">
  108. 交期
  109. </div>
  110. <div v-if="item.deliveryPeriod">
  111. {{item.deliveryPeriod.substr(0,10)}}
  112. </div>
  113. </div>
  114. </div>
  115. <div style="display:flex;margin-bottom:10px">
  116. <div style="width:50%">
  117. <div class="top-title">
  118. 产品编码
  119. </div>
  120. <div>
  121. {{item.productCode}}
  122. </div>
  123. </div>
  124. <div style="width:50%">
  125. <div class="top-title">
  126. 生产数量
  127. </div>
  128. <div>
  129. {{item.quantity}}
  130. </div>
  131. </div>
  132. </div>
  133. <div style="margin-bottom:10px">
  134. <div class="top-title">
  135. 产品名称
  136. </div>
  137. <div>
  138. {{item.productName}}
  139. </div>
  140. </div>
  141. <div style="margin-bottom:10px">
  142. <div class="top-title">
  143. 产品尺寸(cm)
  144. </div>
  145. <div>
  146. {{item.productLength}} * {{item.productWidth}} * {{item.productHeight}}
  147. </div>
  148. </div>
  149. </td>
  150. </tr>
  151. <tr>
  152. <td style="text-align:center" rowspan="4">
  153. <div>
  154. <div style="font-weight:700">产品图</div>
  155. <img v-if="item.fileList &&item.fileList.length > 0" class="bigImg" :src="item.fileList[0].fileUrl" alt="">
  156. </div>
  157. <div style="margin-top:20px">
  158. <div style="font-weight:700">设计图</div>
  159. <img v-if="item.fileListOne &&item.fileListOne.length > 0" class="bigImg" :src="item.fileListOne[0].fileUrl" alt="">
  160. </div>
  161. </td>
  162. <td style="height:60px;vertical-align:top">
  163. <div>
  164. <div class="top-title">
  165. 产品备注
  166. </div>
  167. <div>
  168. {{item.productRemark}}
  169. </div>
  170. </div>
  171. </td>
  172. </tr>
  173. <tr>
  174. <td style="height:60px;vertical-align:top">
  175. <div class="top-title">
  176. 生产工序
  177. </div>
  178. <div>
  179. <!-- <el-checkbox v-for="proess in item.productionTaskProgressList" :key="proess.processesId" :label="proess.progressName"
  180. size="small" /> -->
  181. <span v-for="(proess,index) in item.productionTaskProgressList" :key="proess.processesId">{{proess.progressName}} <span
  182. v-if="index<item.productionTaskProgressList.length-1"> > </span> </span>
  183. </div>
  184. </td>
  185. </tr>
  186. <tr>
  187. <td style="height:107px">
  188. <div style="margin-bottom:10px">
  189. <div class="top-title">
  190. 原材料编码
  191. </div>
  192. <div>
  193. {{item.rawMaterialCode}}
  194. </div>
  195. </div>
  196. <div>
  197. <div class="top-title">
  198. 原材料名称
  199. </div>
  200. <div>
  201. {{item.rawMaterialName}}
  202. </div>
  203. </div>
  204. </td>
  205. </tr>
  206. <tr>
  207. <td style="vertical-align:top">
  208. <div class="top-title">BOM</div>
  209. <div>
  210. <table border class="table son">
  211. <tr>
  212. <td style="width:85%">名称</td>
  213. <!-- <td style="width:15%">单价</td> -->
  214. <td style="width:15%">数量</td>
  215. </tr>
  216. <tr v-for="son in item.contractProductBomList" :key="son.id">
  217. <td>
  218. <div>
  219. {{son.productCode}}
  220. </div>
  221. <div>
  222. {{son.productName}}
  223. </div>
  224. </td>
  225. <!-- <td>{{son.price}}</td> -->
  226. <td>{{son.quantity}}</td>
  227. </tr>
  228. </table>
  229. </div>
  230. </td>
  231. </tr>
  232. </table>
  233. <div style="page-break-after: always"></div>
  234. </div>
  235. </div>
  236. </div>
  237. <template #footer>
  238. <el-button @click="dialogVisible = false" size="defualt">取 消</el-button>
  239. <el-button type="primary" v-print="printObj" size="defualt">打 印</el-button>
  240. </template>
  241. </el-dialog>
  242. <el-dialog title="备注" v-model="remarkDialog" width="500" destroy-on-close v-if="remarkDialog">
  243. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom" v-loading="submitLoading">
  244. </byForm>
  245. <template #footer>
  246. <el-button @click="remarkDialog = false" size="defualt" v-debounce>取 消</el-button>
  247. <el-button type="primary" @click="submitForm()" size="defualt" v-debounce>
  248. 确 定
  249. </el-button>
  250. </template>
  251. </el-dialog>
  252. <el-dialog title="记录查看" v-model="recordDialog" width="70%" destroy-on-close v-if="recordDialog">
  253. <byForm :formConfig="recordFormConfig" :formOption="recordFormOption" v-model="formData.recordData">
  254. <template #detail1>
  255. <div style="width:100%">
  256. <el-table :data="formData.recordData.purchaseProductList">
  257. <el-table-column label="商品图片" width="80">
  258. <template #default="{ row }">
  259. <div v-if="row.fileUrl">
  260. <img :src="row.fileUrl" class="pic" @click="openImg(row.fileUrl)" />
  261. </div>
  262. </template>
  263. </el-table-column>
  264. <el-table-column prop="productCode" label="商品编码" width="160" />
  265. <el-table-column prop="productName" label="商品名称" min-width="130" />
  266. <el-table-column label="尺寸 (cm)" width="140">
  267. <template #default="{ row, $index }">
  268. <div style="width: 100%">
  269. {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  270. </div>
  271. </template>
  272. </el-table-column>
  273. <el-table-column label="颜色" prop="productColor" width="160" />
  274. <el-table-column label="采购数量" prop="quantity" width="100" />
  275. </el-table>
  276. </div>
  277. </template>
  278. <template #detail2>
  279. <div style="width:100%">
  280. <el-table :data="formData.recordData.stockJournalDetailsList">
  281. <el-table-column label="类型" width="100" :formatter="(row) => row.opType=='1'?'入库':'出库'" />
  282. <el-table-column label="商品图片" width="80">
  283. <template #default="{ row }">
  284. <div v-if="row.fileUrl">
  285. <img :src="row.fileUrl" class="pic" @click="openImg(row.fileUrl)" />
  286. </div>
  287. </template>
  288. </el-table-column>
  289. <el-table-column prop="productCode" label="商品编码" width="160" />
  290. <el-table-column prop="productName" label="商品名称" min-width="130" />
  291. <el-table-column label="尺寸 (cm)" width="140">
  292. <template #default="{ row, $index }">
  293. <div style="width: 100%">
  294. {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  295. </div>
  296. </template>
  297. </el-table-column>
  298. <el-table-column label="颜色" prop="productColor" width="160" />
  299. <el-table-column label="数量" prop="quantity" width="100" />
  300. </el-table>
  301. </div>
  302. </template>
  303. </byForm>
  304. <!-- <template #footer>
  305. <el-button @click="recordDialog = false" size="defualt" v-debounce>关闭</el-button>
  306. </template> -->
  307. </el-dialog>
  308. </div>
  309. </template>
  310. <script setup>
  311. import byTable from "@/components/byTable/index";
  312. import byForm from "@/components/byForm/index";
  313. import QRCode from "qrcodejs2-fix";
  314. import moment from "moment";
  315. const { proxy } = getCurrentInstance();
  316. const contractTag = computed(
  317. () => proxy.useUserStore().allDict["contract_prod_tag"]
  318. );
  319. const companyData = ref([]);
  320. const loading = ref(false);
  321. const submitLoading = ref(false);
  322. const sourceList = ref({
  323. data: [],
  324. pagination: {
  325. total: 3,
  326. pageNum: 1,
  327. pageSize: 10,
  328. keyword: "",
  329. produceStatus: "",
  330. staDeliveryPeriod: "",
  331. endDeliveryPeriod: "",
  332. beginTime: "",
  333. endTime: "",
  334. isOverdue: "",
  335. },
  336. });
  337. const treeData = ref([]);
  338. const dialogVisible = ref(false);
  339. const remarkDialog = ref(false);
  340. const modalType = ref("add");
  341. const statusData = ref([
  342. {
  343. label: "未开始",
  344. value: "0",
  345. },
  346. {
  347. label: "生产中",
  348. value: "1",
  349. },
  350. {
  351. label: "生产完成",
  352. value: "2",
  353. },
  354. {
  355. label: "出库中",
  356. value: "5",
  357. },
  358. {
  359. label: "已出库",
  360. value: "10",
  361. },
  362. ]);
  363. const isOverdueData = ref([
  364. {
  365. label: "是",
  366. value: "1",
  367. },
  368. {
  369. label: "否",
  370. value: "0",
  371. },
  372. ]);
  373. const contractTypeData = ref([
  374. {
  375. dictKey: "3",
  376. dictValue: "打样订单",
  377. },
  378. {
  379. dictKey: "2",
  380. dictValue: "常规订单",
  381. },
  382. {
  383. dictKey: "1",
  384. dictValue: "出口退税订单",
  385. },
  386. ]);
  387. const selectConfig = computed(() => [
  388. {
  389. label: "业务公司",
  390. prop: "contractCompanyId",
  391. data: proxy.useUserStore().allDict["list_company_data"],
  392. },
  393. {
  394. label: "工厂",
  395. prop: "companyId",
  396. data: companyData.value,
  397. },
  398. {
  399. label: "生产状态",
  400. prop: "produceStatus",
  401. data: statusData.value,
  402. },
  403. {
  404. label: "是否逾期",
  405. prop: "isOverdue",
  406. data: isOverdueData.value,
  407. },
  408. {
  409. type: "time",
  410. label: "交期",
  411. placeholder: "开始日期",
  412. prop: "staDeliveryPeriod",
  413. placeholderOne: "结束日期",
  414. propOne: "endDeliveryPeriod",
  415. },
  416. {
  417. type: "time",
  418. label: "下单日期",
  419. placeholder: "开始日期",
  420. prop: "beginTime",
  421. placeholderOne: "结束日期",
  422. propOne: "endTime",
  423. },
  424. ]);
  425. const config = ref([
  426. {
  427. type: "selection",
  428. attrs: {
  429. checkAtt: "isCheck",
  430. width: 60,
  431. },
  432. },
  433. {
  434. attrs: {
  435. label: "操作",
  436. width: "160",
  437. align: "left",
  438. // fixed: "right",
  439. },
  440. renderHTML(row) {
  441. return [
  442. {
  443. attrs: {
  444. label: "打印任务单",
  445. type: "primary",
  446. text: true,
  447. },
  448. el: "button",
  449. click() {
  450. printQrCode(row);
  451. },
  452. },
  453. {
  454. attrs: {
  455. label: "备注",
  456. type: "primary",
  457. text: true,
  458. },
  459. el: "button",
  460. click() {
  461. openRemark(row);
  462. },
  463. },
  464. ];
  465. },
  466. },
  467. {
  468. attrs: {
  469. label: "业务公司",
  470. prop: "contractCompanyName",
  471. width: 110,
  472. },
  473. },
  474. {
  475. attrs: {
  476. label: "是否逾期",
  477. slot: "isOverdue",
  478. width: 80,
  479. fixed: "left",
  480. },
  481. },
  482. {
  483. attrs: {
  484. label: "订单类型",
  485. prop: "contractType",
  486. width: 110,
  487. },
  488. render(val) {
  489. return proxy.dictKeyValue(val, contractTypeData.value);
  490. },
  491. },
  492. {
  493. attrs: {
  494. label: "工厂",
  495. prop: "companyName",
  496. width: 100,
  497. // align: "center",
  498. },
  499. },
  500. {
  501. attrs: {
  502. label: "业务员",
  503. prop: "saleUserName",
  504. width: 100,
  505. // align: "center",
  506. },
  507. },
  508. {
  509. attrs: {
  510. label: "订单号",
  511. slot: "orderCode",
  512. width: 130,
  513. },
  514. },
  515. {
  516. attrs: {
  517. label: "产品图片",
  518. slot: "pic",
  519. width: 80,
  520. },
  521. },
  522. {
  523. attrs: {
  524. label: "设计图",
  525. slot: "picOne",
  526. width: 80,
  527. },
  528. },
  529. {
  530. attrs: {
  531. label: "产品编码",
  532. prop: "productCode",
  533. width: 130,
  534. },
  535. },
  536. {
  537. attrs: {
  538. label: "产品名称",
  539. prop: "productName",
  540. "min-width": 200,
  541. },
  542. },
  543. {
  544. attrs: {
  545. label: "产品尺寸 (cm)",
  546. slot: "size",
  547. width: 160,
  548. },
  549. },
  550. {
  551. attrs: {
  552. label: "产品颜色",
  553. prop: "productColor",
  554. width: 80,
  555. },
  556. },
  557. {
  558. attrs: {
  559. label: "生产件数",
  560. prop: "quantity",
  561. width: 100,
  562. },
  563. },
  564. {
  565. attrs: {
  566. label: "完成进度",
  567. slot: "progress",
  568. width: 90,
  569. },
  570. },
  571. {
  572. attrs: {
  573. label: "已完成",
  574. prop: "finishQuantity",
  575. width: 100,
  576. },
  577. },
  578. {
  579. attrs: {
  580. label: "未完成",
  581. prop: "incomplete",
  582. width: 100,
  583. },
  584. },
  585. {
  586. attrs: {
  587. label: "生产状态",
  588. prop: "produceStatus",
  589. width: 100,
  590. },
  591. render(val) {
  592. return proxy.dictValueLabel(val, statusData.value);
  593. },
  594. },
  595. {
  596. attrs: {
  597. label: "生产指示",
  598. slot: "prodTag",
  599. "min-width": 220,
  600. },
  601. },
  602. {
  603. attrs: {
  604. label: "下单时间",
  605. prop: "orderCreateTime",
  606. width: 160,
  607. },
  608. },
  609. {
  610. attrs: {
  611. label: "交期",
  612. prop: "deliveryPeriod",
  613. width: 100,
  614. },
  615. render(val) {
  616. if (val) {
  617. return val.slice(0, 10);
  618. }
  619. return "";
  620. },
  621. },
  622. // {
  623. // attrs: {
  624. // label: "投产时间",
  625. // prop: "produceTime",
  626. // width: 160,
  627. // },
  628. // },
  629. {
  630. attrs: {
  631. label: "完成时间",
  632. prop: "finishTime",
  633. width: 160,
  634. },
  635. },
  636. {
  637. attrs: {
  638. label: "生产用时",
  639. prop: "usageTime",
  640. width: 100,
  641. },
  642. },
  643. {
  644. attrs: {
  645. label: "备注",
  646. prop: "remark",
  647. "min-width": 200,
  648. },
  649. },
  650. ]);
  651. const formData = reactive({
  652. data: {},
  653. recordData: {},
  654. });
  655. const formOption = reactive({
  656. inline: true,
  657. labelWidth: 100,
  658. itemWidth: 100,
  659. });
  660. const formDom = ref(null);
  661. const formConfig = computed(() => {
  662. return [
  663. {
  664. type: "input",
  665. prop: "remark",
  666. itemType: "textarea",
  667. label: "备注",
  668. itemWidth: 100,
  669. disabled: false,
  670. },
  671. ];
  672. });
  673. const rules = ref({
  674. remark: [{ required: true, message: "请输入备注", trigger: "blur" }],
  675. });
  676. const getList = async (req) => {
  677. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  678. loading.value = true;
  679. proxy
  680. .post("/produceOrderDetail/page", sourceList.value.pagination)
  681. .then((res) => {
  682. res.rows.forEach((x) => {
  683. if (x.prodTag) {
  684. x.prodTags = x.prodTag.split(",");
  685. } else {
  686. x.prodTags = [];
  687. }
  688. x.incomplete = x.quantity - x.finishQuantity;
  689. });
  690. sourceList.value.data = res.rows.map((x) => ({ ...x, isCheck: true }));
  691. sourceList.value.pagination.total = res.total;
  692. setTimeout(() => {
  693. loading.value = false;
  694. }, 200);
  695. const productIdList = res.rows.map((x) => x.productId);
  696. // 请求文件数据并回显
  697. if (productIdList.length > 0) {
  698. // proxy.getFile(productIdList, sourceList.value.data, "productId");
  699. proxy
  700. .post("/fileInfo/getList", { businessIdList: productIdList })
  701. .then((fileObj) => {
  702. for (let i = 0; i < sourceList.value.data.length; i++) {
  703. const ele = sourceList.value.data[i];
  704. for (const key in fileObj) {
  705. if (
  706. ele.productId == key &&
  707. fileObj[ele.productId] &&
  708. fileObj[ele.productId].length > 0
  709. ) {
  710. ele.fileList = fileObj[ele.productId].filter(
  711. (x) => x.businessType == "0"
  712. );
  713. }
  714. }
  715. }
  716. });
  717. }
  718. const productIdListOne = res.rows.map((x) => x.contractDetailId);
  719. // 请求文件数据并回显
  720. if (productIdListOne.length > 0) {
  721. proxy
  722. .post("/fileInfo/getList", { businessIdList: productIdListOne })
  723. .then((fileObj) => {
  724. for (let i = 0; i < sourceList.value.data.length; i++) {
  725. const ele = sourceList.value.data[i];
  726. for (const key in fileObj) {
  727. if (
  728. ele.contractDetailId == key &&
  729. fileObj[ele.contractDetailId] &&
  730. fileObj[ele.contractDetailId].length > 0
  731. ) {
  732. ele.fileListOne = fileObj[ele.contractDetailId].filter(
  733. (x) => x.businessType == "0"
  734. );
  735. }
  736. }
  737. }
  738. });
  739. // proxy.getFile(
  740. // productIdListOne,
  741. // sourceList.value.data,
  742. // "contractDetailId",
  743. // "fileListOne"
  744. // );
  745. }
  746. });
  747. };
  748. const printList = ref([]);
  749. const selectIds = ref([]);
  750. const selectRow = (data) => {
  751. selectIds.value = data.map((x) => x.id);
  752. };
  753. const printTime = ref("");
  754. const openModal = () => {
  755. proxy.msgTip("请稍后", 2);
  756. proxy
  757. .post("/produceOrderDetail/detailByIds", { taskIds: selectIds.value })
  758. .then((res) => {
  759. printList.value = res;
  760. for (let i = 0; i < printList.value.length; i++) {
  761. const iele = printList.value[i];
  762. for (let j = 0; j < sourceList.value.data.length; j++) {
  763. const jele = sourceList.value.data[j];
  764. if (iele.id == jele.id) {
  765. iele.fileList = jele.fileList;
  766. iele.fileListOne = jele.fileListOne;
  767. break;
  768. }
  769. }
  770. }
  771. printTime.value = moment().format("yyyy-MM-DD HH:mm:ss");
  772. dialogVisible.value = true;
  773. nextTick(() => {
  774. for (let i = 0; i < printList.value.length; i++) {
  775. const row = printList.value[i];
  776. proxy.$refs[row.id][0].innerHTML = ""; //清除二维码方法一
  777. new QRCode(proxy.$refs[row.id][0], {
  778. text: row.id,
  779. width: 200,
  780. height: 200,
  781. colorDark: "#000000",
  782. colorLight: "#ffffff",
  783. correctLevel: QRCode.CorrectLevel.H,
  784. });
  785. }
  786. });
  787. });
  788. };
  789. const submitForm = () => {
  790. formDom.value.handleSubmit((valid) => {
  791. submitLoading.value = true;
  792. proxy.post("/produceOrderDetail/editRemark", formData.data).then(
  793. (res) => {
  794. proxy.msgTip("操作成功", 1);
  795. remarkDialog.value = false;
  796. submitLoading.value = false;
  797. getList();
  798. },
  799. (err) => {
  800. submitLoading.value = false;
  801. }
  802. );
  803. });
  804. };
  805. const getDtl = (row) => {
  806. modalType.value = "edit";
  807. proxy.post("/shopInfo/detail", { id: row.id }).then((res) => {
  808. formData.data = res;
  809. dialogVisible.value = true;
  810. });
  811. };
  812. const processesData = ref([]);
  813. const getProcesses = () => {
  814. proxy
  815. .post("/productionProcesses/page", { pageNum: 1, pageSize: 9999 })
  816. .then((res) => {
  817. for (let i = 0; i < res.rows.length; i++) {
  818. const ele = res.rows[i];
  819. let attrs = {
  820. label: `[ ${ele.name} ]`,
  821. slot: ele.id,
  822. isNeedHeaderSlot: false,
  823. width: 70,
  824. align: "center",
  825. fixed: "right",
  826. };
  827. config.value.push({
  828. attrs,
  829. });
  830. }
  831. // config.value.push({
  832. // attrs: {
  833. // label: "操作",
  834. // width: "160",
  835. // align: "center",
  836. // fixed: "right",
  837. // },
  838. // renderHTML(row) {
  839. // return [
  840. // {
  841. // attrs: {
  842. // label: "打印任务单",
  843. // type: "primary",
  844. // text: true,
  845. // },
  846. // el: "button",
  847. // click() {
  848. // printQrCode(row);
  849. // },
  850. // },
  851. // {
  852. // attrs: {
  853. // label: "备注",
  854. // type: "primary",
  855. // text: true,
  856. // },
  857. // el: "button",
  858. // click() {
  859. // openRemark(row);
  860. // },
  861. // },
  862. // ];
  863. // },
  864. // });
  865. processesData.value = res.rows;
  866. });
  867. };
  868. getProcesses();
  869. getList();
  870. const printType = ref(false);
  871. const printQrCode = (row) => {
  872. printType.value = true;
  873. selectIds.value = [row.id];
  874. openModal();
  875. };
  876. const beforeClose = () => {
  877. if (printType.value) {
  878. selectIds.value = [];
  879. }
  880. dialogVisible.value = false;
  881. };
  882. const printObj = ref({
  883. id: "pdfDom",
  884. popTitle: "",
  885. extraCss:
  886. "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css",
  887. extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
  888. });
  889. const handleClickFile = (file) => {
  890. window.open(file.fileUrl, "_blank");
  891. };
  892. const isShowCotent = (slot, item) => {
  893. if (item && item.productionTaskProgressList) {
  894. return item.productionTaskProgressList.some(
  895. (x) => x.processesId == slot.id
  896. );
  897. } else {
  898. return false;
  899. }
  900. };
  901. const showCotent = (slot, item) => {
  902. if (item && item.productionTaskProgressList) {
  903. const current = item.productionTaskProgressList.find(
  904. (x) => x.processesId == slot.id
  905. );
  906. if (current) {
  907. return current.finishQuantity;
  908. }
  909. } else {
  910. return false;
  911. }
  912. };
  913. const showCotentQuantity = (slot, item) => {
  914. if (item && item.productionTaskProgressList) {
  915. const current = item.productionTaskProgressList.find(
  916. (x) => x.processesId == slot.id
  917. );
  918. if (current && Number(current.finishQuantity) > 0) {
  919. if (Number(current.finishQuantity) >= item.quantity) {
  920. return "tag-active";
  921. } else if (Number(current.finishQuantity) < item.quantity) {
  922. return "tag-active-1";
  923. }
  924. }
  925. }
  926. };
  927. const getDict = () => {
  928. proxy
  929. .get("/tenantDept/list", {
  930. pageNum: 1,
  931. pageSize: 9999,
  932. keyword: "",
  933. tenantId: proxy.useUserStore().user.tenantId,
  934. type: 0,
  935. })
  936. .then((res) => {
  937. companyData.value = res.data.map((x) => ({
  938. ...x,
  939. label: x.deptName,
  940. value: x.deptId,
  941. }));
  942. // treeData.value = proxy.handleTree(res.data, "deptId");
  943. });
  944. };
  945. getDict();
  946. const openRemark = (row) => {
  947. formData.data = {
  948. id: row.id,
  949. remark: row.remark,
  950. };
  951. remarkDialog.value = true;
  952. };
  953. const recordDialog = ref(false);
  954. const recordFormOption = reactive({
  955. inline: true,
  956. labelWidth: 40,
  957. itemWidth: 100,
  958. });
  959. const recordFormConfig = computed(() => {
  960. return [
  961. {
  962. type: "title1",
  963. title: "采购记录",
  964. },
  965. {
  966. type: "slot",
  967. slotName: "detail1",
  968. label: " ",
  969. },
  970. {
  971. type: "title1",
  972. title: "出入库流水记录",
  973. },
  974. {
  975. type: "slot",
  976. slotName: "detail2",
  977. label: " ",
  978. },
  979. ];
  980. });
  981. const lookDetails = (item) => {
  982. recordDialog.value = true;
  983. proxy
  984. .post("/produceOrder/detail", {
  985. id: item.produceOrderId,
  986. })
  987. .then((res) => {
  988. console.log(res, "aaa");
  989. formData.recordData = res;
  990. if (
  991. formData.recordData.purchaseProductList &&
  992. formData.recordData.purchaseProductList.length > 0
  993. ) {
  994. let productIds = formData.recordData.purchaseProductList.map(
  995. (x) => x.productId
  996. );
  997. proxy.getFileData({
  998. businessIdList: productIds,
  999. data: formData.recordData.purchaseProductList,
  1000. att: "productId",
  1001. businessType: "0",
  1002. fileAtt: "fileList",
  1003. filePathAtt: "fileUrl",
  1004. });
  1005. }
  1006. if (
  1007. formData.recordData.stockJournalDetailsList &&
  1008. formData.recordData.stockJournalDetailsList.length > 0
  1009. ) {
  1010. let productIds = formData.recordData.stockJournalDetailsList.map(
  1011. (x) => x.productId
  1012. );
  1013. proxy.getFileData({
  1014. businessIdList: productIds,
  1015. data: formData.recordData.stockJournalDetailsList,
  1016. att: "productId",
  1017. businessType: "0",
  1018. fileAtt: "fileList",
  1019. filePathAtt: "fileUrl",
  1020. });
  1021. }
  1022. });
  1023. };
  1024. </script>
  1025. <style lang="scss" scoped>
  1026. ::v-deep(.el-progress__text) {
  1027. font-size: 14px !important;
  1028. }
  1029. .content {
  1030. padding: 20px;
  1031. }
  1032. .pic {
  1033. object-fit: contain;
  1034. width: 50px;
  1035. height: 50px;
  1036. cursor: pointer;
  1037. vertical-align: middle;
  1038. }
  1039. .table {
  1040. border-collapse: collapse;
  1041. border-spacing: 0;
  1042. width: 100%;
  1043. td {
  1044. text-align: left;
  1045. padding: 10px;
  1046. font-size: 13px;
  1047. // padding: 5px 10px;
  1048. .top-title {
  1049. font-weight: 700;
  1050. margin-bottom: 5px;
  1051. }
  1052. .bigImg {
  1053. object-fit: contain;
  1054. width: 160px;
  1055. height: 320px;
  1056. cursor: pointer;
  1057. margin-top: 10px;
  1058. vertical-align: middle;
  1059. }
  1060. }
  1061. }
  1062. .son {
  1063. td {
  1064. text-align: left;
  1065. padding: 5px !important;
  1066. }
  1067. }
  1068. .no-bk {
  1069. // background: #f3f3f3;
  1070. // height: 50px;
  1071. }
  1072. .red {
  1073. background: red;
  1074. border-radius: 2px;
  1075. padding: 4px;
  1076. color: #fff;
  1077. }
  1078. </style>