index.vue 30 KB

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