index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <el-tabs v-model="activeName" type="card" @tab-change="changeActiveName">
  5. <el-tab-pane label="待采购列表" name="first">
  6. <byTable
  7. :source="sourceList.data"
  8. :pagination="sourceList.pagination"
  9. :config="config"
  10. :loading="loading"
  11. :searchConfig="searchConfig"
  12. highlight-current-row
  13. @get-list="getList"
  14. @clickReset="clickReset">
  15. <template #code="{ item }">
  16. <div>
  17. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
  18. </div>
  19. </template>
  20. </byTable>
  21. </el-tab-pane>
  22. <el-tab-pane label="采购合同" name="second">
  23. <byTable
  24. :source="sourceListTwo.data"
  25. :pagination="sourceListTwo.pagination"
  26. :config="configTwo"
  27. :loading="loading"
  28. :searchConfig="searchConfigTwo"
  29. highlight-current-row
  30. :action-list="[
  31. {
  32. text: '导入E10合同',
  33. action: () => clickImportContract(),
  34. },
  35. ]"
  36. @get-list="getListTwo"
  37. @clickReset="clickResetTwo">
  38. <template #typeExpand="{ item }">
  39. <div style="padding: 0 20px">
  40. <el-table :data="item.purchaseBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader" border>
  41. <el-table-column label="品号" prop="bomSpecCode" width="120" />
  42. <el-table-column label="品名" prop="bomSpecName" min-width="240" />
  43. <el-table-column label="颜色" prop="bomSpecColour" width="180" />
  44. <el-table-column label="尺寸(长宽高,cm)" width="160">
  45. <template #default="{ row }">
  46. <div>{{ row.bomSpecLength }} * {{ row.bomSpecWidth }} * {{ row.bomSpecHeight }}</div>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="含税单价" prop="unitPrice" width="140" />
  50. <el-table-column label="税率" prop="taxRate" width="120" />
  51. <el-table-column label="不含税单价" width="100">
  52. <template #default="{ row }">
  53. <div>{{ moneyFormat(Number(Math.round(((row.unitPrice * 100) / (100 + row.taxRate)) * 100) / 100)) }}</div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="采购数量" prop="purchaseQuantity" width="120" />
  57. <el-table-column label="含税小计" align="right" width="140">
  58. <template #default="{ row }">
  59. <div>{{ moneyFormat(Number(Math.round(row.unitPrice * row.purchaseQuantity * 100) / 100)) }}</div>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="不含税小计" align="right" width="140">
  63. <template #default="{ row }">
  64. <div>
  65. {{
  66. moneyFormat(
  67. Number(Math.round((Math.round(((row.unitPrice * 100) / (100 + row.taxRate)) * 100) / 100) * row.purchaseQuantity * 100) / 100)
  68. )
  69. }}
  70. </div>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. </div>
  75. </template>
  76. <template #code="{ item }">
  77. <div>
  78. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickPurchaseCode(item)">{{ item.code }}</a>
  79. </div>
  80. </template>
  81. <template #erpCode="{ item }">
  82. <div>
  83. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickPurchaseCode(item)">{{ item.erpCode }}</a>
  84. </div>
  85. </template>
  86. <template #advancePayment="{ item }">
  87. <div>{{ item.advancePayment }}%</div>
  88. </template>
  89. <template #finalPayment="{ item }">
  90. <div>{{ 100 - item.advancePayment }}%</div>
  91. </template>
  92. </byTable>
  93. </el-tab-pane>
  94. <el-tab-pane label="采购明细" name="third">
  95. <byTable
  96. :source="sourceListThree.data"
  97. :pagination="sourceListThree.pagination"
  98. :config="configThree"
  99. :loading="loading"
  100. :searchConfig="searchConfigThree"
  101. highlight-current-row
  102. @get-list="getListThree"
  103. @clickReset="clickResetThree">
  104. <template #size="{ item }">
  105. <span>{{ `${item.length} * ${item.width} * ${item.height}` }}</span>
  106. </template>
  107. </byTable>
  108. </el-tab-pane>
  109. </el-tabs>
  110. </el-card>
  111. <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="800px" v-loading="loadingPrint">
  112. <div style="height: calc(100vh - 174px); overflow-y: auto; overflow-x: hidden">
  113. <div id="printMe">
  114. <div class="con">
  115. <div style="font-size: 24px; font-weight: 700; padding: 16px; text-align: center">福清市胜德体育用品有限公司</div>
  116. <div style="font-size: 24px; padding: 8px 0 4px 0; text-align: center; border-bottom: 2px solid black">采购合同</div>
  117. <div style="height: 8px"></div>
  118. <table cellspacing="0" cellpadding="0" border="0" style="width: 100%; line-height: 24px">
  119. <tr>
  120. <td style="width: 50%">
  121. <span>需方:福清市胜德体育用品有限公司</span>
  122. </td>
  123. <td>
  124. <span>订单号:{{ pdfDetail.purchaseContract.code }}</span>
  125. </td>
  126. </tr>
  127. <tr>
  128. <td style="width: 50%">
  129. <span>供方:{{ pdfDetail.supplier.name }}</span>
  130. </td>
  131. <td>
  132. <span>日期:{{ pdfDetail.purchaseContract.createTime }}</span>
  133. </td>
  134. </tr>
  135. </table>
  136. <div style="height: 8px"></div>
  137. <table cellspacing="0" cellpadding="0" border="0" class="tableOne">
  138. <tr>
  139. <th style="width: 30px">序号</th>
  140. <th style="width: 100px">品号</th>
  141. <th style="width: 280px">产品名称</th>
  142. <th style="width: 45px">数量</th>
  143. <th style="width: 45px">单价</th>
  144. <th style="width: 60px">金额</th>
  145. <th style="width: 110px">交货期</th>
  146. </tr>
  147. <template v-if="pdfDetail.purchaseContract.purchaseBomList && pdfDetail.purchaseContract.purchaseBomList.length > 0">
  148. <tr v-for="(item, index) in pdfDetail.purchaseContract.purchaseBomList" :key="index">
  149. <td>
  150. {{ index + 1 }}
  151. </td>
  152. <td style="text-align: left; word-break: break-all">
  153. <span>{{ item.bomSpecCode }}</span>
  154. </td>
  155. <td style="text-align: left; word-break: break-all; padding: 0 4px">
  156. <span>{{ item.bomSpecName }}</span>
  157. </td>
  158. <td>
  159. <span>{{ item.purchaseQuantity }}</span>
  160. </td>
  161. <td>
  162. <span>{{ item.unitPrice }}</span>
  163. </td>
  164. <td>
  165. <span>{{ moneyFormat(Number(Math.round(item.purchaseQuantity * item.unitPrice)), 2) }}</span>
  166. </td>
  167. <td style="text-align: left; word-break: break-all">
  168. <span>{{ pdfDetail.purchaseContract.deliveryDate }}</span>
  169. </td>
  170. </tr>
  171. </template>
  172. <tr>
  173. <td>合计:</td>
  174. <td colspan="2"></td>
  175. <td>{{ computeQuantity() }}</td>
  176. <td></td>
  177. <td>
  178. <span>{{ moneyFormat(pdfDetail.purchaseContract.totalAmountIncludingTax, 2) }}</span>
  179. </td>
  180. <td style="border-right: 0"></td>
  181. </tr>
  182. </table>
  183. <div style="height: 8px"></div>
  184. <table cellspacing="0" cellpadding="0" border="0" class="tableTwo">
  185. <tr>
  186. <td>
  187. <div crossOrigin="anonymous" class="ql-snow" v-html="limitImg(pdfDetail.purchaseContract.contract)"></div>
  188. </td>
  189. </tr>
  190. </table>
  191. <div style="height: 32px"></div>
  192. <table cellspacing="0" cellpadding="0" border="0" class="tableThree">
  193. <tr>
  194. <td style="width: 50%; position: relative; padding-right: 4px">
  195. <div>
  196. <span>需方(签章):福清市胜德体育用品有限公司</span>
  197. </div>
  198. <div style="position: absolute; top: -50px; left: 20px">
  199. <img
  200. style="width: 160px; height: 160px"
  201. :src="'http://www.printmat.cn:8181/file/upload/2023/02/24/20230224180954A0974981a85a2400425eb03c2c3f588a9711.png'"
  202. alt=""
  203. srcset="" />
  204. </div>
  205. </td>
  206. <td style="padding-left: 4px">
  207. <span>供方(签章):{{ pdfDetail.supplier.name }}</span>
  208. </td>
  209. </tr>
  210. <tr>
  211. <td style="width: 50%; padding-right: 4px">
  212. <span>税 号:91350181MA8TYY2T6D</span>
  213. </td>
  214. <td style="padding-left: 4px">
  215. <span>税 号:{{ pdfDetail.supplier.dutyNumber }}</span>
  216. </td>
  217. </tr>
  218. <tr>
  219. <td style="width: 50%; padding-right: 4px">
  220. <span>开 户:中国工商银行股份有限公司福清高山侨乡支行</span>
  221. </td>
  222. <td style="padding-left: 4px">
  223. <span>开 户:{{ pdfDetail.supplier.bank }}</span>
  224. </td>
  225. </tr>
  226. <tr>
  227. <td style="width: 50%; padding-right: 4px">
  228. <span>账 号:1402073809100001586</span>
  229. </td>
  230. <td style="padding-left: 4px">
  231. <span>账 号:{{ pdfDetail.supplier.bankAccountNumber }}</span>
  232. </td>
  233. </tr>
  234. <tr>
  235. <td style="width: 50%; padding-right: 4px">
  236. <span>地 址:福建省福州市福清市三山镇横坑村金园路18号3号楼4层</span>
  237. </td>
  238. <td style="padding-left: 4px">
  239. <span>地 址:{{ pdfDetail.supplier.province }} {{ pdfDetail.supplier.city }} {{ pdfDetail.supplier.detailedAddress }}</span>
  240. </td>
  241. </tr>
  242. <tr>
  243. <td style="width: 50%; padding-right: 4px">
  244. <span>电 话:0591-22852156</span>
  245. </td>
  246. <td style="padding-left: 4px">
  247. <span>电 话:{{ pdfDetail.supplier.companyTelephone }}</span>
  248. </td>
  249. </tr>
  250. </table>
  251. </div>
  252. </div>
  253. </div>
  254. <div style="text-align: center; margin: 10px">
  255. <el-button @click="openPrint = false" size="large">取消</el-button>
  256. <el-button type="primary" v-print="printObj" size="large">打印</el-button>
  257. </div>
  258. </el-dialog>
  259. <el-dialog title="导入E10合同" v-if="openUpload" v-model="openUpload" width="600">
  260. <div v-loading="loadingUpload">
  261. <el-upload :show-file-list="false" action="##" :http-request="uploadServerLog" :before-upload="handleBeforeUpload">
  262. <el-button style="background: #20b2aa; color: #fff; border: 1px solid #20b2aa">上传</el-button>
  263. </el-upload>
  264. <div style="text-align: center; margin: 10px">
  265. <el-button @click="openUpload = false" size="large">关 闭</el-button>
  266. </div>
  267. </div>
  268. </el-dialog>
  269. </div>
  270. </template>
  271. <script setup>
  272. import byTable from "/src/components/byTable/index";
  273. import { ElMessage, ElMessageBox } from "element-plus";
  274. import { flowStatus } from "/src/utils/flowStatus";
  275. const { proxy } = getCurrentInstance();
  276. const activeName = ref("first");
  277. const sourceList = ref({
  278. data: [],
  279. pagination: {
  280. total: 0,
  281. pageNum: 1,
  282. pageSize: 10,
  283. code: "",
  284. beginTime: "",
  285. endTime: "",
  286. flowStatus: "2",
  287. },
  288. });
  289. const sourceListTwo = ref({
  290. data: [],
  291. pagination: {
  292. total: 0,
  293. pageNum: 1,
  294. pageSize: 10,
  295. code: "",
  296. flowStatus: "",
  297. status: "",
  298. supplierName: "",
  299. },
  300. });
  301. const sourceListThree = ref({
  302. data: [],
  303. pagination: {
  304. total: 0,
  305. pageNum: 1,
  306. pageSize: 10,
  307. purchaseCode: "",
  308. bomSpecCode: "",
  309. bomSpecName: "",
  310. },
  311. });
  312. const loading = ref(false);
  313. const searchConfig = computed(() => {
  314. return [
  315. {
  316. type: "input",
  317. prop: "code",
  318. label: "申购单号",
  319. },
  320. {
  321. type: "date",
  322. propList: ["beginTime", "endTime"],
  323. label: "申购日期",
  324. },
  325. ];
  326. });
  327. const searchConfigTwo = computed(() => {
  328. return [
  329. {
  330. type: "input",
  331. prop: "code",
  332. label: "采购单号",
  333. },
  334. {
  335. type: "select",
  336. prop: "flowStatus",
  337. data: flowStatus(),
  338. label: "流程状态",
  339. },
  340. {
  341. type: "select",
  342. prop: "status",
  343. data: proxy.useUserStore().allDict["purchase_status"],
  344. label: "采购状态",
  345. },
  346. {
  347. type: "input",
  348. prop: "supplierName",
  349. label: "供应商",
  350. },
  351. ];
  352. });
  353. const searchConfigThree = computed(() => {
  354. return [
  355. {
  356. type: "input",
  357. prop: "purchaseCode",
  358. label: "采购单号",
  359. },
  360. {
  361. type: "input",
  362. prop: "bomSpecCode",
  363. label: "BOM品号",
  364. },
  365. {
  366. type: "input",
  367. prop: "bomSpecName",
  368. label: "BOM品名",
  369. },
  370. ];
  371. });
  372. const config = computed(() => {
  373. return [
  374. {
  375. attrs: {
  376. label: "申购单号",
  377. slot: "code",
  378. width: 220,
  379. },
  380. },
  381. {
  382. attrs: {
  383. label: "申购时间",
  384. prop: "applyTime",
  385. align: "center",
  386. width: 160,
  387. },
  388. },
  389. {
  390. attrs: {
  391. label: "申购人",
  392. prop: "applyName",
  393. width: 160,
  394. },
  395. },
  396. {
  397. attrs: {
  398. label: "申购说明",
  399. prop: "remark",
  400. },
  401. },
  402. {
  403. attrs: {
  404. label: "操作",
  405. width: 80,
  406. align: "center",
  407. fixed: "right",
  408. },
  409. renderHTML(row) {
  410. return [
  411. {
  412. attrs: {
  413. label: "采购",
  414. type: "primary",
  415. text: true,
  416. },
  417. el: "button",
  418. click() {
  419. clickPurchase(row);
  420. },
  421. },
  422. ];
  423. },
  424. },
  425. ];
  426. });
  427. const configTwo = computed(() => {
  428. return [
  429. {
  430. type: "expand",
  431. attrs: {
  432. label: " ",
  433. slot: "typeExpand",
  434. width: 50,
  435. },
  436. },
  437. {
  438. attrs: {
  439. label: "采购单号",
  440. slot: "code",
  441. width: 160,
  442. },
  443. },
  444. {
  445. attrs: {
  446. label: "申购单号",
  447. prop: "applyBuyCode",
  448. width: 160,
  449. },
  450. },
  451. {
  452. attrs: {
  453. label: "E10单号",
  454. slot: "erpCode",
  455. width: 160,
  456. },
  457. },
  458. {
  459. attrs: {
  460. label: "状态",
  461. prop: "flowStatus",
  462. width: 100,
  463. },
  464. render(val) {
  465. return proxy.dictKeyValue(val, flowStatus());
  466. },
  467. },
  468. {
  469. attrs: {
  470. label: "采购状态",
  471. prop: "status",
  472. width: 100,
  473. },
  474. render(val) {
  475. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["purchase_status"]);
  476. },
  477. },
  478. {
  479. attrs: {
  480. label: "币种",
  481. prop: "currency",
  482. width: 100,
  483. },
  484. render(val) {
  485. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["currency"]);
  486. },
  487. },
  488. {
  489. attrs: {
  490. label: "预付款",
  491. slot: "advancePayment",
  492. width: 80,
  493. },
  494. },
  495. {
  496. attrs: {
  497. label: "尾款",
  498. slot: "finalPayment",
  499. width: 80,
  500. },
  501. },
  502. {
  503. attrs: {
  504. label: "含税总金额",
  505. prop: "totalAmountIncludingTax",
  506. width: 120,
  507. align: "right",
  508. },
  509. },
  510. {
  511. attrs: {
  512. label: "不含税总金额",
  513. prop: "totalAmountExcludingTax",
  514. width: 120,
  515. align: "right",
  516. },
  517. },
  518. {
  519. attrs: {
  520. label: "结算方式",
  521. prop: "settlementMethod",
  522. width: 120,
  523. },
  524. render(val) {
  525. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["settlement_method"]);
  526. },
  527. },
  528. {
  529. attrs: {
  530. label: "发票类型",
  531. prop: "invoiceType",
  532. width: 140,
  533. },
  534. render(val) {
  535. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["invoice_type"]);
  536. },
  537. },
  538. {
  539. attrs: {
  540. label: "交期",
  541. prop: "deliveryDate",
  542. width: 160,
  543. },
  544. },
  545. {
  546. attrs: {
  547. label: "供应商",
  548. prop: "supplierName",
  549. "min-width": 160,
  550. },
  551. },
  552. {
  553. attrs: {
  554. label: "创建时间",
  555. prop: "createTime",
  556. width: 160,
  557. },
  558. },
  559. {
  560. attrs: {
  561. label: "操作",
  562. width: 140,
  563. align: "center",
  564. fixed: "right",
  565. },
  566. renderHTML(row) {
  567. return [
  568. row.flowStatus == 2
  569. ? {
  570. attrs: {
  571. label: "打印",
  572. type: "primary",
  573. text: true,
  574. },
  575. el: "button",
  576. click() {
  577. clickPrint(row);
  578. },
  579. }
  580. : {},
  581. row.flowStatus == 0 || row.flowStatus == 3
  582. ? {
  583. attrs: {
  584. label: "编辑",
  585. type: "primary",
  586. text: true,
  587. },
  588. el: "button",
  589. click() {
  590. clickUpdate(row);
  591. },
  592. }
  593. : {},
  594. row.flowStatus == 0 || row.flowStatus == 3
  595. ? {
  596. attrs: {
  597. label: "删除",
  598. type: "danger",
  599. text: true,
  600. },
  601. el: "button",
  602. click() {
  603. clickDelete(row);
  604. },
  605. }
  606. : {},
  607. row.status == 20
  608. ? {
  609. attrs: {
  610. label: "终止合同",
  611. type: "danger",
  612. text: true,
  613. },
  614. el: "button",
  615. click() {
  616. clickRemove(row);
  617. },
  618. }
  619. : {},
  620. ];
  621. },
  622. },
  623. ];
  624. });
  625. const configThree = computed(() => {
  626. return [
  627. {
  628. attrs: {
  629. label: "采购单号",
  630. prop: "purchaseCode",
  631. width: 160,
  632. },
  633. },
  634. {
  635. attrs: {
  636. label: "BOM品号",
  637. prop: "bomSpecCode",
  638. width: 180,
  639. },
  640. },
  641. {
  642. attrs: {
  643. label: "BOM品名",
  644. prop: "bomSpecName",
  645. "min-width": 240,
  646. },
  647. },
  648. {
  649. attrs: {
  650. label: "尺寸(长宽高,cm)",
  651. slot: "size",
  652. width: 160,
  653. },
  654. },
  655. {
  656. attrs: {
  657. label: "含税单价",
  658. prop: "unitPrice",
  659. width: 120,
  660. },
  661. },
  662. {
  663. attrs: {
  664. label: "采购数量",
  665. prop: "purchaseQuantity",
  666. width: 120,
  667. },
  668. },
  669. {
  670. attrs: {
  671. label: "已到货数量",
  672. prop: "arrivalQuantity",
  673. width: 120,
  674. },
  675. },
  676. {
  677. attrs: {
  678. label: "在途数量",
  679. prop: "inTransitQuantity",
  680. width: 120,
  681. },
  682. },
  683. {
  684. attrs: {
  685. label: "已退货数量",
  686. prop: "returnQuantity",
  687. width: 120,
  688. },
  689. },
  690. ];
  691. });
  692. const getList = (req) => {
  693. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  694. loading.value = true;
  695. proxy.post("/applyBuy/page", sourceList.value.pagination).then((res) => {
  696. sourceList.value.data = res.rows;
  697. setTimeout(() => {
  698. loading.value = false;
  699. }, 200);
  700. });
  701. };
  702. getList();
  703. const clickReset = () => {
  704. getList("");
  705. };
  706. const getListTwo = (req, status) => {
  707. if (status) {
  708. sourceListTwo.value.pagination = {
  709. pageNum: sourceListTwo.value.pagination.pageNum,
  710. pageSize: sourceListTwo.value.pagination.pageSize,
  711. };
  712. } else {
  713. sourceListTwo.value.pagination = { ...sourceListTwo.value.pagination, ...req };
  714. }
  715. loading.value = true;
  716. proxy.post("/purchase/page", sourceListTwo.value.pagination).then((res) => {
  717. sourceListTwo.value.data = res.rows;
  718. sourceListTwo.value.pagination.total = res.total;
  719. setTimeout(() => {
  720. loading.value = false;
  721. }, 200);
  722. });
  723. };
  724. const clickResetTwo = () => {
  725. getListTwo("", true);
  726. };
  727. const getListThree = (req, status) => {
  728. if (status) {
  729. sourceListThree.value.pagination = {
  730. pageNum: sourceListThree.value.pagination.pageNum,
  731. pageSize: sourceListThree.value.pagination.pageSize,
  732. };
  733. } else {
  734. sourceListThree.value.pagination = { ...sourceListThree.value.pagination, ...req };
  735. }
  736. loading.value = true;
  737. proxy.post("/purchaseBom/purchaseDetailsPage", sourceListThree.value.pagination).then((res) => {
  738. sourceListThree.value.data = res.rows;
  739. sourceListThree.value.pagination.total = res.total;
  740. setTimeout(() => {
  741. loading.value = false;
  742. }, 200);
  743. });
  744. };
  745. const clickResetThree = () => {
  746. getListThree("", true);
  747. };
  748. const changeActiveName = (val) => {
  749. if (val === "first") {
  750. getList();
  751. } else if (val === "second") {
  752. getListTwo();
  753. } else {
  754. getListThree();
  755. }
  756. };
  757. const clickCode = (item) => {
  758. proxy.$router.replace({
  759. path: "/platform_manage/process/processApproval",
  760. query: {
  761. flowKey: "apply_buy",
  762. flowName: "申购流程",
  763. processType: "20",
  764. id: item.id,
  765. flowId: item.flowId,
  766. random: proxy.random(),
  767. },
  768. });
  769. };
  770. const clickPurchaseCode = (item) => {
  771. proxy.$router.replace({
  772. path: "/platform_manage/process/processApproval",
  773. query: {
  774. flowKey: "purchase",
  775. flowName: "采购流程",
  776. processType: "20",
  777. id: item.id,
  778. flowId: item.flowId,
  779. random: proxy.random(),
  780. },
  781. });
  782. };
  783. const clickPurchase = (item) => {
  784. proxy.$router.replace({
  785. path: "/platform_manage/process/processApproval",
  786. query: {
  787. flowKey: "purchase",
  788. flowName: "采购流程",
  789. random: proxy.random(),
  790. subscribeId: item.id,
  791. },
  792. });
  793. };
  794. const clickUpdate = (item) => {
  795. proxy.$router.replace({
  796. path: "/platform_manage/process/processApproval",
  797. query: {
  798. flowKey: "purchase",
  799. flowName: "采购流程",
  800. processType: "40",
  801. id: item.id,
  802. random: proxy.random(),
  803. },
  804. });
  805. };
  806. const clickDelete = (row) => {
  807. ElMessageBox.confirm("你是否确认此操作", "提示", {
  808. confirmButtonText: "确定",
  809. cancelButtonText: "取消",
  810. type: "warning",
  811. })
  812. .then(() => {
  813. proxy.post("/purchase/delete", { id: row.id }).then(() => {
  814. ElMessage({ message: "删除成功", type: "success" });
  815. getListTwo();
  816. });
  817. })
  818. .catch(() => {});
  819. };
  820. const clickRemove = (row) => {
  821. ElMessageBox.confirm("你是否确认此操作", "提示", {
  822. confirmButtonText: "确定",
  823. cancelButtonText: "取消",
  824. type: "warning",
  825. })
  826. .then(() => {
  827. proxy.post("/purchase/purchaseTermination", { id: row.id }).then(() => {
  828. ElMessage({ message: "终止成功", type: "success" });
  829. getListTwo();
  830. });
  831. })
  832. .catch(() => {});
  833. };
  834. const openPrint = ref(false);
  835. const printObj = ref({
  836. id: "printMe",
  837. popTitle: "",
  838. extraCss: "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",
  839. extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
  840. });
  841. const pdfDetail = ref({
  842. purchaseContract: {},
  843. supplier: {},
  844. });
  845. const loadingPrint = ref(false);
  846. const clickPrint = async (row) => {
  847. pdfDetail.value = {
  848. purchaseContract: {},
  849. supplier: {},
  850. };
  851. openPrint.value = true;
  852. loadingPrint.value = true;
  853. let supplier = await proxy.post("/supplier/detail", { id: row.supplierId }).then((res) => {
  854. pdfDetail.value.supplier = res;
  855. });
  856. let purchase = await proxy.post("/purchase/detail", { id: row.id }).then((res) => {
  857. pdfDetail.value.purchaseContract = res;
  858. });
  859. loadingPrint.value = false;
  860. };
  861. const limitImg = (text) => {
  862. if (text) {
  863. return text.replace(/<img/g, '<img style="max-width: 98%;"');
  864. } else {
  865. return text;
  866. }
  867. };
  868. const computeQuantity = () => {
  869. let num = 0;
  870. if (pdfDetail.value.purchaseContract.purchaseBomList && pdfDetail.value.purchaseContract.purchaseBomList.length > 0) {
  871. for (let i = 0; i < pdfDetail.value.purchaseContract.purchaseBomList.length; i++) {
  872. if (pdfDetail.value.purchaseContract.purchaseBomList[i].purchaseQuantity) {
  873. num = Number(Math.round(num + pdfDetail.value.purchaseContract.purchaseBomList[i].purchaseQuantity));
  874. }
  875. }
  876. }
  877. return num;
  878. };
  879. const openUpload = ref(false);
  880. const loadingUpload = ref(false);
  881. const clickImportContract = () => {
  882. loadingUpload.value = false;
  883. openUpload.value = true;
  884. };
  885. const handleBeforeUpload = () => {
  886. loadingUpload.value = true;
  887. };
  888. const uploadServerLog = (params) => {
  889. let file = params.file;
  890. let formData = new FormData();
  891. formData.append("file", file);
  892. proxy.postUploadFile("/purchase/purchaseImport", formData).then(
  893. () => {
  894. ElMessage({ message: "导入成功", type: "success" });
  895. openUpload.value = false;
  896. getListTwo();
  897. },
  898. (err) => {
  899. console.log(err);
  900. loadingUpload.value = false;
  901. }
  902. );
  903. };
  904. </script>
  905. <style lang="scss" scoped>
  906. ::v-deep(.el-input-number .el-input__inner) {
  907. text-align: left;
  908. }
  909. ::v-deep(.el-table__expand-icon) {
  910. display: grid;
  911. place-items: center;
  912. }
  913. :deep(.el-dialog) {
  914. margin-top: 10px !important;
  915. margin-bottom: 10px !important;
  916. }
  917. .con {
  918. font-family: "Times New Roman", "SimSun" !important;
  919. color: black !important;
  920. font-size: 12px !important;
  921. text-align: left;
  922. background-color: white;
  923. padding: 16px;
  924. }
  925. .tableOne {
  926. border: 1px solid black;
  927. line-height: 18px;
  928. overflow: auto;
  929. width: 100%;
  930. }
  931. .tableOne th {
  932. font-weight: 700;
  933. border-right: 1px solid black;
  934. text-align: center;
  935. }
  936. .tableOne td {
  937. border-right: 1px solid black;
  938. border-top: 1px solid black;
  939. text-align: center;
  940. }
  941. .tableTwo {
  942. width: 100%;
  943. line-height: 18px;
  944. word-break: break-all;
  945. }
  946. .tableTwo td {
  947. vertical-align: top;
  948. }
  949. .tableThree {
  950. width: 100%;
  951. line-height: 24px;
  952. word-break: break-all;
  953. }
  954. .tableThree td {
  955. vertical-align: top;
  956. }
  957. </style>