index.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <div class="switch">
  5. <div class="switch_left">
  6. <ul>
  7. <li
  8. v-for="item in tabOptions"
  9. :key="item.key"
  10. :class="{ active: activeComp == item.key }"
  11. @click="activeComp = item.key"
  12. style="height: 42px; line-height: 38px"
  13. >
  14. <el-badge :value="toDoReminder[item.reminder] || 0" class="item">
  15. {{ item.name }}
  16. </el-badge>
  17. </li>
  18. </ul>
  19. </div>
  20. </div>
  21. <div class="main" style="padding: 0 10px">
  22. <div v-if="activeComp == 'saleorder'">
  23. <div class="ele-border-lighter form-content" v-loading="loading">
  24. <search-table ref="searchTableRef" @search="reload"></search-table>
  25. <div class="table-container">
  26. <!-- 数据表格 -->
  27. <ele-pro-table
  28. ref="table"
  29. :columns="columns"
  30. :datasource="datasource"
  31. height="calc(100vh - 365px)"
  32. style="margin-bottom: 10px"
  33. full-height="calc(100vh - 116px)"
  34. tool-class="ele-toolbar-form"
  35. :selection.sync="selection"
  36. :page-size="20"
  37. @columns-change="handleColumnChange"
  38. :cache-key="cacheKeyUrl"
  39. show-summary
  40. :summary-method="getSummaries"
  41. @header-dragend="handleHeaderDragend"
  42. >
  43. <!-- 表头工具栏 -->
  44. <template v-slot:toolbar>
  45. <el-button
  46. size="small"
  47. type="primary"
  48. icon="el-icon-plus"
  49. class="ele-btn-icon"
  50. @click="openEditNew('add', {})"
  51. >
  52. 新建
  53. </el-button>
  54. <el-button
  55. size="small"
  56. type="danger"
  57. el-icon-delete
  58. class="ele-btn-icon"
  59. @click="allDelBtn"
  60. :disabled="selection?.length === 0"
  61. >
  62. 批量删除
  63. </el-button>
  64. <el-button
  65. type="primary"
  66. size="small"
  67. icon="el-icon-upload2"
  68. @click="uploadFile"
  69. >导入</el-button
  70. >
  71. <exportButton
  72. fileName="采购订单"
  73. apiUrl="/eom/purchaseorder/export"
  74. :params="params"
  75. ></exportButton>
  76. <el-dropdown
  77. trigger="click"
  78. :disabled="selection?.length === 0"
  79. >
  80. <el-button
  81. type="primary"
  82. class="el-icon-printer"
  83. size="small"
  84. >
  85. 打印<i class="el-icon-arrow-down el-icon--right"></i>
  86. </el-button>
  87. <el-dropdown-menu slot="dropdown">
  88. <el-dropdown-item
  89. @click.native="handlePrint('printPurchaseOrderRef')"
  90. >采购订单</el-dropdown-item
  91. >
  92. </el-dropdown-menu>
  93. </el-dropdown>
  94. </template>
  95. <!-- 查看详情列 -->
  96. <template v-slot:relationName="{ row }">
  97. <el-link
  98. type="primary"
  99. :underline="false"
  100. @click="opencontractDetail(row)"
  101. >
  102. {{ row.relationName }}
  103. </el-link>
  104. </template>
  105. <template v-slot:orderNo="{ row }">
  106. <el-link
  107. type="primary"
  108. :underline="false"
  109. @click="openorderDetail(row)"
  110. >
  111. {{ row.orderNo }}
  112. </el-link>
  113. </template>
  114. <!-- 操作列 -->
  115. <template v-slot:action="{ row }">
  116. <el-tooltip
  117. content="已关联来源单据,不能复制"
  118. :disabled="!isCannotCopy(row)"
  119. >
  120. <el-link
  121. type="primary"
  122. :underline="false"
  123. icon="el-icon-document-copy"
  124. :disabled="isCannotCopy(row)"
  125. @click="openEditNew('copy', row)"
  126. >
  127. 复制
  128. </el-link>
  129. </el-tooltip>
  130. <el-link
  131. type="primary"
  132. :underline="false"
  133. icon="el-icon-edit"
  134. v-if="
  135. (isNeed_process_is_close &&
  136. [0, 3].includes(row.orderStatus)) ||
  137. !isNeed_process_is_close
  138. "
  139. @click="openEditNew('edit', row)"
  140. >
  141. 修改
  142. </el-link>
  143. <el-link
  144. type="primary"
  145. :underline="false"
  146. icon="el-icon-plus"
  147. @click="saleOrderSubmit(row)"
  148. v-if="
  149. isNeed_process_is_close &&
  150. [0, 3].includes(row.orderStatus)
  151. "
  152. >
  153. 提交
  154. </el-link>
  155. <el-popconfirm
  156. class="ele-action"
  157. title="确定要删除此信息吗?"
  158. v-if="
  159. (isNeed_process_is_close &&
  160. [0, 3].includes(row.orderStatus)) ||
  161. !isNeed_process_is_close
  162. "
  163. @confirm="remove([row.id])"
  164. >
  165. <template v-slot:reference>
  166. <el-link
  167. type="danger"
  168. :underline="false"
  169. icon="el-icon-delete"
  170. >
  171. 删除
  172. </el-link>
  173. </template>
  174. </el-popconfirm>
  175. <el-link
  176. type="primary"
  177. :underline="false"
  178. icon="el-icon-plus"
  179. @click="handleCommand('outsourceSend', row)"
  180. v-if="
  181. ['3', '4', '5', '6', '8', '9', '10'].includes(
  182. row.sourceType
  183. ) &&
  184. [2].includes(row.orderStatus) &&
  185. row.progress < 200
  186. "
  187. >
  188. 委外发货单
  189. </el-link>
  190. <el-link
  191. type="primary"
  192. :underline="false"
  193. icon="el-icon-plus"
  194. @click="handleCommand('invoice', row)"
  195. v-if="
  196. !['3', '4', '5', '6', '8', '9', '10'].includes(
  197. row.sourceType
  198. ) &&
  199. [2].includes(row.orderStatus) &&
  200. row.progress < 200 &&
  201. row.isShowReceiptButton == 1
  202. "
  203. >
  204. 收货单
  205. </el-link>
  206. <el-link
  207. type="primary"
  208. :underline="false"
  209. icon="el-icon-plus"
  210. v-if="
  211. row.allowDifference == 1 &&
  212. $hasPermission('eom:purchaseorder:adjustment')
  213. "
  214. @click="handleCommand('adjustment', row)"
  215. >
  216. 冲差
  217. </el-link>
  218. <!-- <el-link
  219. type="primary"
  220. :underline="false"
  221. icon="el-icon-plus"
  222. @click="handleCommand('invoiceManage', row)"
  223. v-if="!row.hasInvoiceApply && [2].includes(row.orderStatus)"
  224. >
  225. 新增发票
  226. </el-link> -->
  227. <el-link
  228. v-if="$hasPermission('eom:purchaseorder:rowExport')"
  229. type="primary"
  230. :underline="false"
  231. icon="el-icon-download"
  232. @click="exportRowInfo(row)"
  233. >
  234. 导出
  235. </el-link>
  236. <el-link
  237. type="primary"
  238. :underline="false"
  239. @click="finish('single', row)"
  240. v-if="[2].includes(row.orderStatus) && row.progress != 1000"
  241. >
  242. 完结
  243. </el-link>
  244. </template>
  245. </ele-pro-table>
  246. </div>
  247. </div>
  248. </div>
  249. <div v-if="activeComp == 'outsourceSend'">
  250. <outSourceSend @getToDoReminder="getToDoReminder"></outSourceSend>
  251. </div>
  252. <div v-if="activeComp == 'invoice'">
  253. <invoice
  254. @getToDoReminder="getToDoReminder"
  255. ref="invoiceRef"
  256. ></invoice>
  257. </div>
  258. <div v-if="activeComp == 'invoiceConfirm'">
  259. <invoiceConfirm @getToDoReminder="getToDoReminder"></invoiceConfirm>
  260. </div>
  261. <div v-if="activeComp == 'returnorder'" class="returnorder">
  262. <return-goods @getToDoReminder="getToDoReminder"></return-goods>
  263. </div>
  264. <div v-if="activeComp == 'exceptionList'">
  265. <exceptionList :relationType="'2,5'" @getToDoReminder="getToDoReminder">
  266. </exceptionList>
  267. </div>
  268. <div v-if="activeComp == 'accountstatement'">
  269. <accountstatement
  270. ref="accountStatementRef"
  271. @getToDoReminder="getToDoReminder"
  272. ></accountstatement>
  273. </div>
  274. <!-- 对账池:与销售订单模块复用同一组件,靠 sourceType 区分采购/销售 -->
  275. <div v-if="activeComp == 'accountPool'">
  276. <account-pool
  277. :sourceType="2"
  278. @getToDoReminder="getToDoReminder"
  279. @goto-statement-edit="handleGotoStatementEdit"
  280. ></account-pool>
  281. </div>
  282. <div v-if="activeComp == 'adjustmentNote'">
  283. <adjustmentNote
  284. :sourceType="2"
  285. @getToDoReminder="getToDoReminder"
  286. ></adjustmentNote>
  287. </div>
  288. </div>
  289. </el-card>
  290. <add-dialog
  291. ref="addDialogRef"
  292. @done="reload"
  293. :isRequired="isRequired"
  294. ></add-dialog>
  295. <addDialogNew
  296. ref="addDialogNewRef"
  297. @done="reload"
  298. :isRequired="isRequired"
  299. ></addDialogNew>
  300. <add-invoice-dialog
  301. ref="invoiceDialogRef"
  302. @done="reload"
  303. ></add-invoice-dialog>
  304. <add-return-goods-dialog
  305. ref="addReturnGoodsRef"
  306. @done="reload"
  307. ></add-return-goods-dialog>
  308. <contractr-detail ref="contractDetailRef"></contractr-detail>
  309. <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
  310. <purchasingDetail ref="purchasingDetailRef"></purchasingDetail>
  311. <purchasePlanDetail ref="purchasePlanDetailRef"></purchasePlanDetail>
  312. <inquiryDetail ref="inquiryDetailRef"></inquiryDetail>
  313. <addOutSourceSend
  314. ref="addOrEditDialogRef"
  315. :add-or-edit-dialog-flag.sync="addOrEditDialogFlag"
  316. v-if="addOrEditDialogFlag"
  317. @done="reload"
  318. ></addOutSourceSend>
  319. <!-- 多选删除弹窗 -->
  320. <pop-modal
  321. :visible.sync="delVisible"
  322. content="是否确定删除?"
  323. @done="commitBtn"
  324. />
  325. <process-submit-dialog
  326. :isNotNeedProcess="true"
  327. api-fun-name="purchaseorderStatusAPI"
  328. :isCloseRefresh="false"
  329. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  330. v-if="processSubmitDialogFlag"
  331. ref="processSubmitDialogRef"
  332. @reload="reload"
  333. ></process-submit-dialog>
  334. <addInvoiceManage
  335. :add-or-edit-dialog-flag.sync="addOrEditDialogFlag1"
  336. ref="addOrEditDialogRef"
  337. v-if="addOrEditDialogFlag1"
  338. @reload="reload"
  339. ></addInvoiceManage>
  340. <importDialog
  341. ref="importDialogRef"
  342. @success="reload"
  343. :fileUrl="'/eom/purchaseorder/importTemplate'"
  344. :isWeb="false"
  345. fileName="采购订单导入模板"
  346. apiUrl="/eom/purchaseorder/importFile"
  347. />
  348. <printPurchaseOrder
  349. ref="printPurchaseOrderRef"
  350. :groupName="groupName"
  351. ></printPurchaseOrder>
  352. <add-adjust-dialog
  353. v-if="addAdjustDialogFlag"
  354. :sourceType="2"
  355. :addAdjustDialogFlag.sync="addAdjustDialogFlag"
  356. ref="addAdjustDialogRef"
  357. @done="reload"
  358. ></add-adjust-dialog>
  359. </div>
  360. </template>
  361. <script>
  362. import searchTable from './components/searchTable.vue';
  363. import addDialog from './components/addDialog.vue';
  364. import addDialogNew from './components/addDialogNew.vue';
  365. import invoice from './invoice/index.vue';
  366. import invoiceConfirm from './invoiceConfirm/index.vue';
  367. import detailDialog from './components/detailDialog.vue';
  368. import contractrDetail from '@/views/contractManage/contractBook/components/detailDialog.vue';
  369. import purchasingDetail from '@/views/purchasingManage/purchaseNeedManage/components/detailDialog.vue';
  370. import purchasePlanDetail from '@/views/purchasingManage/purchasePlanManage/components/detailDialog.vue';
  371. import inquiryDetail from '@/views/purchasingManage/inquiryManage/components/detailDialog.vue';
  372. import addInvoiceDialog from '@/views/purchasingManage/purchaseOrder/invoice/components/addInvoiceDialog';
  373. import addReturnGoodsDialog from '@/views/purchasingManage/purchaseOrder/returnGoods/components/addReturnGoodsDialog';
  374. import addOutSourceSend from '@/views/purchasingManage/purchaseOrder/outSourceSend/components/addOrEditDialog';
  375. import popModal from '@/components/pop-modal';
  376. import accountstatement from './accountstatement/index.vue';
  377. import accountPool from '@/views/saleManage/saleOrder/accountPool/index.vue';
  378. import returnGoods from './returnGoods/index.vue';
  379. import addInvoiceManage from '@/views/financialManage/invoiceManage/components/addOrEditDialog.vue';
  380. import outSourceSend from './outSourceSend/index';
  381. import {
  382. getTableList,
  383. deleteInformation,
  384. getExport,
  385. batchCompleted,
  386. getpurchaseorderDetail
  387. } from '@/api/purchasingManage/purchaseOrder';
  388. import dictMixins from '@/mixins/dictMixins';
  389. import { purchaseOrderProgressStatusEnum, reviewStatus } from '@/enum/dict';
  390. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  391. import tabMixins from '@/mixins/tableColumnsMixin';
  392. import importDialog from '@/components/upload/import-dialog.vue';
  393. import exportButton from '@/components/upload/exportButton.vue';
  394. import { parameterGetByCode } from '@/api/main/index.js';
  395. import exceptionList from '@/views/saleManage/saleOrder/exceptionManagement/exceptionList/index.vue';
  396. import { getToDoReminder } from '@/api/common/index';
  397. import { exportTable } from '@/api/system/file/index.js';
  398. import printPurchaseOrder from '@/views/purchasingManage/purchaseOrder/invoice/components/print-PurchaseOrder.vue';
  399. import { enterprisePage } from '@/api/contractManage/contractBook';
  400. import { getSummaries } from '@/utils/util.js';
  401. // import addAdjustDialog from './adjustmentNote‌/components/addAdjustDialog.vue'
  402. import addAdjustDialog from '@/views/saleManage/saleOrder/adjustmentNote‌/components/addAdjustDialog.vue';
  403. import adjustmentNote from '@/views/saleManage/saleOrder/adjustmentNote‌/index.vue';
  404. export default {
  405. mixins: [dictMixins, tabMixins],
  406. components: {
  407. processSubmitDialog,
  408. exportButton,
  409. searchTable,
  410. returnGoods,
  411. accountstatement,
  412. accountPool,
  413. popModal,
  414. contractrDetail,
  415. addReturnGoodsDialog,
  416. addInvoiceDialog,
  417. invoice,
  418. addDialog,
  419. detailDialog,
  420. outSourceSend,
  421. addOutSourceSend,
  422. addInvoiceManage,
  423. importDialog,
  424. invoiceConfirm,
  425. exceptionList,
  426. purchasingDetail,
  427. purchasePlanDetail,
  428. inquiryDetail,
  429. printPurchaseOrder,
  430. addDialogNew,
  431. addAdjustDialog,
  432. adjustmentNote
  433. },
  434. data() {
  435. return {
  436. activeComp: 'saleorder',
  437. tabOptions: [
  438. { key: 'saleorder', name: '采购订单', reminder: 'purchaseOrderNum' },
  439. {
  440. key: 'outsourceSend',
  441. name: '委外发货单',
  442. reminder: 'outsourcingDeliveryNoteNum'
  443. },
  444. { key: 'invoice', name: '收货单', reminder: 'receiptNum' },
  445. {
  446. key: 'invoiceConfirm',
  447. name: '收货确认单',
  448. reminder: 'receiptConfirmationFormNum'
  449. },
  450. {
  451. key: 'exceptionList',
  452. name: '异常列表',
  453. reminder: 'purchaseExceptionListNum'
  454. },
  455. {
  456. key: 'returnorder',
  457. name: '退货单',
  458. reminder: 'purchaseReturnOrderNum'
  459. },
  460. {
  461. key: 'accountPool',
  462. name: '对账池',
  463. reminder: 'purchaseAccountStatementPoolNum'
  464. },
  465. {
  466. key: 'accountstatement',
  467. name: '对账单',
  468. reminder: 'purchaseStatementAccountNum'
  469. },
  470. {
  471. key: 'adjustmentNote',
  472. name: '冲差单',
  473. reminder: 'punchSlipForPurchaseOrderNum'
  474. }
  475. ],
  476. selection: [], //单选中集合
  477. delVisible: false, //批量删除弹框状态
  478. loading: false, // 加载状态
  479. processSubmitDialogFlag: false,
  480. addOrEditDialogFlag: false,
  481. addOrEditDialogFlag1: false,
  482. params: {},
  483. addAdjustDialogFlag: false, //冲差状态
  484. groupName: '',
  485. columns: [
  486. {
  487. width: 45,
  488. type: 'selection',
  489. columnKey: 'selection',
  490. align: 'center'
  491. },
  492. {
  493. columnKey: 'index',
  494. label: '序号',
  495. type: 'index',
  496. width: 55,
  497. align: 'center',
  498. showOverflowTooltip: true,
  499. fixed: 'left'
  500. },
  501. {
  502. prop: 'orderNo',
  503. label: '订单编码',
  504. align: 'center',
  505. sortable: true,
  506. slot: 'orderNo',
  507. showOverflowTooltip: true,
  508. minWidth: 200,
  509. fixed: 'left'
  510. },
  511. {
  512. prop: 'sourceTypeName',
  513. label: '订单类型',
  514. align: 'center',
  515. sortable: true,
  516. showOverflowTooltip: true,
  517. minWidth: 200,
  518. fixed: 'left'
  519. },
  520. {
  521. prop: 'progress',
  522. label: '订单进度',
  523. align: 'center',
  524. showOverflowTooltip: true,
  525. formatter: (_row, _column, cellValue) => {
  526. return purchaseOrderProgressStatusEnum.find(
  527. (val) => val.value == _row.progress
  528. )?.label;
  529. },
  530. minWidth: 120
  531. },
  532. {
  533. prop: 'relationType',
  534. label: '来源单据类型',
  535. align: 'center',
  536. showOverflowTooltip: true,
  537. minWidth: 150,
  538. formatter: (_row, _column, cellValue) => {
  539. return _row.relationType == 1
  540. ? '采购需求单'
  541. : _row.relationType == 2
  542. ? '采购计划单'
  543. : _row.relationType == 3
  544. ? '采购核价单'
  545. : _row.relationType == 4
  546. ? '采购合同'
  547. : '';
  548. }
  549. },
  550. {
  551. prop: 'relationName',
  552. label: '来源单据',
  553. align: 'center',
  554. slot: 'relationName',
  555. showOverflowTooltip: true,
  556. minWidth: 250
  557. },
  558. // {
  559. // prop: 'deliveryDate',
  560. // label: '交货日期',
  561. // align: 'center',
  562. // showOverflowTooltip: true,
  563. // minWidth: 200
  564. // },
  565. // {
  566. // prop: 'purchaseTypeName',
  567. // label: '采购订单类型',
  568. // align: 'center',
  569. // showOverflowTooltip: true,
  570. // minWidth: 140
  571. // },
  572. {
  573. prop: 'partaName',
  574. label: '采购方名称',
  575. align: 'center',
  576. showOverflowTooltip: true,
  577. minWidth: 200
  578. },
  579. {
  580. prop: 'partaLinkName',
  581. label: '采购方联系人',
  582. align: 'center',
  583. showOverflowTooltip: true,
  584. minWidth: 130
  585. },
  586. {
  587. prop: 'partaTel',
  588. label: '采购方联系电话',
  589. align: 'center',
  590. showOverflowTooltip: true,
  591. minWidth: 130
  592. },
  593. {
  594. prop: 'productNames',
  595. label: '名称',
  596. align: 'center',
  597. showOverflowTooltip: true,
  598. minWidth: 200
  599. },
  600. {
  601. prop: 'productCodes',
  602. label: '编码',
  603. align: 'center',
  604. showOverflowTooltip: true,
  605. minWidth: 140
  606. },
  607. {
  608. prop: 'batchNos',
  609. label: '批次号',
  610. align: 'center',
  611. showOverflowTooltip: true,
  612. minWidth: 140
  613. },
  614. {
  615. prop: 'productCount',
  616. label: '数量',
  617. align: 'center',
  618. showOverflowTooltip: true,
  619. minWidth: 140
  620. },
  621. {
  622. prop: 'inboundCount',
  623. label: '收货数量',
  624. align: 'center',
  625. showOverflowTooltip: true,
  626. minWidth: 140
  627. },
  628. {
  629. prop: 'partbName',
  630. label: '供应商名称',
  631. align: 'center',
  632. showOverflowTooltip: true,
  633. minWidth: 250
  634. },
  635. {
  636. prop: 'partbLinkName',
  637. label: '供应商联系人',
  638. align: 'center',
  639. showOverflowTooltip: true,
  640. minWidth: 120
  641. },
  642. {
  643. prop: 'partbTel',
  644. label: '供应商联系电话',
  645. align: 'center',
  646. showOverflowTooltip: true,
  647. minWidth: 130
  648. },
  649. {
  650. prop: 'isInspection',
  651. label: '是否来料检',
  652. align: 'center',
  653. showOverflowTooltip: true,
  654. minWidth: 130,
  655. formatter: (_row, _column, cellValue) => {
  656. return cellValue == 1 ? '是' : '否';
  657. }
  658. },
  659. {
  660. prop: 'payAmount',
  661. label: '金额(元)',
  662. align: 'center',
  663. showOverflowTooltip: true,
  664. minWidth: 140
  665. },
  666. {
  667. prop: 'createUserName',
  668. label: '创建人',
  669. align: 'center',
  670. showOverflowTooltip: true,
  671. minWidth: 170
  672. },
  673. {
  674. prop: 'createTime',
  675. label: '创建时间',
  676. align: 'center',
  677. showOverflowTooltip: true,
  678. minWidth: 170
  679. },
  680. {
  681. prop: 'orderStatus',
  682. label: '审核状态',
  683. align: 'center',
  684. showOverflowTooltip: true,
  685. minWidth: 100,
  686. formatter: (_row, _column, cellValue) => {
  687. return reviewStatus[_row.orderStatus];
  688. }
  689. },
  690. {
  691. columnKey: 'action',
  692. label: '操作',
  693. width: 340,
  694. align: 'center',
  695. resizable: false,
  696. slot: 'action',
  697. showOverflowTooltip: true,
  698. fixed: 'right'
  699. }
  700. ],
  701. cacheKeyUrl: 'eos-5f2ac512-purchaseOrder-saleorder',
  702. isRequired: true,
  703. timeR: null,
  704. toDoReminder: {},
  705. // 首页看板下钻预置的筛选条件(drillStart/drillEnd/drillStatus 落成本页接口入参)
  706. drillParams: {}
  707. };
  708. },
  709. computed: {},
  710. created() {
  711. // 先快照下钻参数:下方 isView 分支会清理地址栏,之后仍要用原始值
  712. const drillQuery = { ...this.$route.query };
  713. this.requestDict('客户状态');
  714. parameterGetByCode({
  715. code: 'order_person_info'
  716. }).then((res) => {
  717. if (res.value) {
  718. this.isRequired = res.value === '1';
  719. }
  720. });
  721. this.getToDoReminder();
  722. this.timeR = setInterval(() => {
  723. this.getToDoReminder();
  724. }, 60000);
  725. if (this.$route.query.isView) {
  726. this.activeComp = this.$route.query.activeComp;
  727. this.$nextTick(() => {
  728. if (this.activeComp == 'invoice') {
  729. this.$refs.invoiceRef.openorderDetail(
  730. {
  731. id: this.$route.query.id
  732. },
  733. 'receiveNo'
  734. );
  735. }
  736. const url = new URL(window.location.href);
  737. url.search = ''; // 清空查询参数
  738. window.history.pushState({}, '', url.href);
  739. });
  740. }
  741. this.applyDrillQuery(drillQuery);
  742. },
  743. mounted() {
  744. // 首页看板下钻:把日期/审核状态回填到搜索表单控件(只写值不查询,首屏查询仍由 datasource 里的 drillParams 完成一次)
  745. const query = this.$route.query;
  746. if (query.drill !== '1' || !this.$refs.searchTableRef) {
  747. return;
  748. }
  749. const start = query.drillStart ? `${query.drillStart} 00:00:00` : '';
  750. const end = query.drillEnd ? `${query.drillEnd} 23:59:59` : '';
  751. if (start && end) {
  752. this.$refs.searchTableRef.setDrillDate([start, end]);
  753. }
  754. if (query.drillStatus === 'APPROVED') {
  755. this.$refs.searchTableRef.setDrillStatus(2);
  756. }
  757. },
  758. beforeDestroy() {
  759. clearInterval(this.timeR);
  760. },
  761. methods: {
  762. /**
  763. * 对账池发起对账成功后跳转【对账单-修改】:
  764. * 先切到「对账单」页签,再让对账单列表打开该单的修改弹窗。
  765. * 对账单这里用的是 v-if(没有 keep-alive),切页签会重建组件,必须等 DOM 更新后再取 ref 调用
  766. */
  767. handleGotoStatementEdit(row) {
  768. this.activeComp = 'accountstatement';
  769. this.$nextTick(() => {
  770. this.$refs.accountStatementRef &&
  771. this.$refs.accountStatementRef.openEditById(row.id);
  772. });
  773. },
  774. getSummaries(param) {
  775. return getSummaries(
  776. param,
  777. ['productCount', 'inboundCount', 'payAmount'],
  778. ' '
  779. );
  780. },
  781. getToDoReminder() {
  782. getToDoReminder().then((res) => {
  783. this.toDoReminder = res;
  784. });
  785. },
  786. //更多菜单
  787. handleCommand(command, row) {
  788. console.log(command, row);
  789. if (command === 'invoice') {
  790. this.$refs.invoiceDialogRef.open('add', {}, row.id);
  791. }
  792. if (command === 'returnOrder') {
  793. this.$refs.addReturnGoodsRef.open('add', {});
  794. }
  795. if (command === 'outsourceSend') {
  796. this.addOrEditDialogFlag = true;
  797. this.$nextTick(() => {
  798. this.$refs.addOrEditDialogRef.open('add', {}, row.id);
  799. });
  800. }
  801. if (command === 'invoiceManage') {
  802. this.addOrEditDialogFlag1 = true;
  803. this.$nextTick(() => {
  804. this.$refs.addOrEditDialogRef.createInvoice1(row, 2, 3);
  805. });
  806. }
  807. // 冲差
  808. if (command === 'adjustment') {
  809. console.log(row);
  810. this.addAdjustDialogFlag = true;
  811. this.$nextTick(() => {
  812. this.$refs.addAdjustDialogRef.open('add', row);
  813. });
  814. }
  815. },
  816. //点击左边分类
  817. handleNodeClick(data, node) {
  818. // this.curNodeData = data;
  819. this.reload({ categoryId: data.id });
  820. },
  821. /**
  822. * 首页看板下钻:drill=1 时按看板档位预置筛选并查询一次,随后清掉 drill* 参数,避免刷新重复应用。
  823. * 日期落到后端 PurchaseOrderPagePO.createTimeStart/createTimeEnd,状态落到 orderStatus;
  824. * 无 drill 参数时本方法直接返回,页面原有默认查询不受影响。
  825. */
  826. applyDrillQuery(query) {
  827. if (!query || query.drill !== '1') {
  828. return;
  829. }
  830. const drillParams = {};
  831. if (query.drillStart && query.drillEnd) {
  832. // 与页内「创建时间」筛选一致:yyyy-MM-dd HH:mm:ss,区间含首尾当天
  833. drillParams.createTimeStart = `${query.drillStart} 00:00:00`;
  834. drillParams.createTimeEnd = `${query.drillEnd} 23:59:59`;
  835. }
  836. // APPROVED(审核通过/已审核) → orderStatus=2(见 @/enum/dict reviewStatus);
  837. // 其他看板状态(如 INVOICED 已开票)本列表没有对应筛选字段,忽略状态只应用日期区间
  838. if (query.drillStatus === 'APPROVED') {
  839. drillParams.orderStatus = 2;
  840. }
  841. this.drillParams = drillParams;
  842. if (query.drillTip) {
  843. this.$message.info(query.drillTip);
  844. }
  845. // 与上面 isView 分支一致的清理方式:只改地址栏,不触发路由跳转
  846. const url = new URL(window.location.href);
  847. url.search = '';
  848. window.history.pushState({}, '', url.href);
  849. },
  850. /* 表格数据源 */
  851. datasource({ page, limit, where, order }) {
  852. // 首页看板下钻的预置筛选:页内手动筛选优先,其余用下钻值兜底
  853. const drillWhere = {};
  854. Object.keys(this.drillParams).forEach((key) => {
  855. if (
  856. !where ||
  857. where[key] === undefined ||
  858. where[key] === null ||
  859. where[key] === ''
  860. ) {
  861. drillWhere[key] = this.drillParams[key];
  862. }
  863. });
  864. this.params = {
  865. pageNum: page,
  866. size: limit,
  867. ...where,
  868. ...drillWhere
  869. };
  870. return getTableList(this.params);
  871. },
  872. /* 刷新表格 */
  873. reload(where) {
  874. this.$refs.table.reload({ page: 1, where });
  875. },
  876. //新增编辑
  877. openEdit(type, row) {
  878. this.$refs.addDialogRef.open(type, row, row.id);
  879. this.$refs.addDialogRef.$refs.form &&
  880. this.$refs.addDialogRef.$refs.form.clearValidate();
  881. },
  882. //新增编辑新
  883. openEditNew(type, row) {
  884. this.$refs.addDialogNewRef.open(type, row, row.id);
  885. this.$refs.addDialogNewRef.$refs.form &&
  886. this.$refs.addDialogNewRef.$refs.form.clearValidate();
  887. },
  888. //是否不可复制(来源单据类型/来源单据有值,或已关联采购计划/合同)
  889. isCannotCopy(row) {
  890. return (
  891. !!row.purchasePlanId ||
  892. !!row.contractId ||
  893. !!row.relationType ||
  894. !!row.relationId ||
  895. !!row.relationCode ||
  896. !!row.relationName
  897. );
  898. },
  899. uploadFile() {
  900. this.$refs.importDialogRef.open();
  901. },
  902. //打印采购订单
  903. handlePrint(ref) {
  904. if (this.selection.length > 1)
  905. return this.$message.warning('暂不支持批量打印,请选择一条');
  906. // let flag = this.selection.some((item) => [2].includes(item.reviewStatus));
  907. // if (!flag)
  908. // return this.$message.warning('抱歉需要已审核的发货单才能打印,请检查');
  909. enterprisePage({
  910. pageNum: 1,
  911. size: 200
  912. }).then((res) => {
  913. console.log(res.list);
  914. if (res.list?.length > 0) {
  915. this.groupName = res.list[0].name;
  916. }
  917. });
  918. this.$refs[ref].open(this.selection[0].id);
  919. },
  920. //批量删除
  921. allDelBtn() {
  922. if (this.selection.length === 0) return;
  923. let flag = this.selection.some((item) =>
  924. [1, 2].includes(item.orderStatus)
  925. );
  926. if (flag)
  927. return this.$message.warning(
  928. '抱歉已审核、审核中的数据不能删除,请检查'
  929. );
  930. this.delVisible = true;
  931. },
  932. //删除接口
  933. remove(delData) {
  934. deleteInformation(delData).then((res) => {
  935. this.$message.success('删除成功!');
  936. this.reload();
  937. });
  938. },
  939. //删除弹框确定
  940. commitBtn() {
  941. const dataId = this.selection.map((v) => v.id);
  942. this.remove(dataId);
  943. },
  944. finish(type, row) {
  945. if (type == 'single') {
  946. batchCompleted([row.id])
  947. .then((res) => {
  948. this.$message.success(res.message);
  949. this.reload();
  950. })
  951. .catch((err) => {});
  952. }
  953. },
  954. //查看详情
  955. openorderDetail(row) {
  956. this.$refs.contactDetailDialogRef.open(row);
  957. },
  958. /**
  959. * 提交前必填校验:与修改弹窗(addDialogNew)基本信息里的必填项保持一致。
  960. * 委外销售订单自动生成的采购订单里这些信息常常是空的,直接提交会带着空值进审批,
  961. * 所以先在列表侧拦一道。
  962. * 列表列已带出这些字段,能取到值就不再请求接口;只有当字段在列表返回里不存在
  963. * (undefined,例如接口未返回)时,才请求详情接口兜底校验。
  964. */
  965. async validateRequiredFieldsBeforeSubmit(row) {
  966. const requiredFields = [
  967. { prop: 'partaName', label: '采购方名称' },
  968. { prop: 'partaLinkName', label: '采购方联系人' },
  969. { prop: 'partaTel', label: '采购方电话' },
  970. { prop: 'partbName', label: '供应商名称' },
  971. { prop: 'partbLinkName', label: '供应商联系人' },
  972. { prop: 'partbTel', label: '供应商联系电话' }
  973. ];
  974. const isEmpty = (val) =>
  975. val === undefined || val === null || String(val).trim() === '';
  976. // 列表未返回的字段视为“未知”,需要请求详情确认(空字符串属于已知的空值,直接判定缺失)
  977. const needDetail = requiredFields.some(
  978. (item) => row[item.prop] === undefined
  979. );
  980. let target = row;
  981. if (needDetail) {
  982. try {
  983. target = (await getpurchaseorderDetail(row.id)) || {};
  984. } catch (e) {
  985. this.$message.error('获取采购订单详情失败,无法校验必填信息');
  986. return false;
  987. }
  988. }
  989. const missing = requiredFields
  990. .filter((item) => isEmpty(target[item.prop]))
  991. .map((item) => item.label);
  992. if (missing.length) {
  993. this.$message.warning(
  994. `提交前请先完善必填信息:${missing.join('、')}`
  995. );
  996. return false;
  997. }
  998. return true;
  999. },
  1000. async saleOrderSubmit(res) {
  1001. const valid = await this.validateRequiredFieldsBeforeSubmit(res);
  1002. if (!valid) {
  1003. return;
  1004. }
  1005. this.processSubmitDialogFlag = true;
  1006. this.$nextTick(() => {
  1007. let params = {
  1008. businessId: res.id,
  1009. businessKey: 'purchase_order_approve',
  1010. formCreateUserId: res.createUserId,
  1011. variables: {
  1012. businessCode: res.orderNo,
  1013. businessName: res.partaName,
  1014. businessType: res.sourceTypeName
  1015. }
  1016. };
  1017. this.$refs.processSubmitDialogRef.init(params);
  1018. });
  1019. },
  1020. //查看合同详情
  1021. opencontractDetail(row) {
  1022. let data = {
  1023. id: row.relationId
  1024. };
  1025. if (row.relationType == 1) {
  1026. this.$refs.purchasingDetailRef.open(data);
  1027. }
  1028. if (row.relationType == 2) {
  1029. this.$refs.purchasePlanDetailRef.open(data);
  1030. }
  1031. if (row.relationType == 3) {
  1032. this.$refs.inquiryDetailRef.open(data);
  1033. }
  1034. if (row.relationType == 4) {
  1035. this.$refs.contractDetailRef.open(data);
  1036. }
  1037. },
  1038. // 导出
  1039. exportRowInfo(row) {
  1040. console.log(row);
  1041. getExport(row.id);
  1042. }
  1043. }
  1044. };
  1045. </script>
  1046. <style lang="scss" scoped>
  1047. :deep .el-card__body {
  1048. padding: 0;
  1049. }
  1050. :deep(.el-link--inner) {
  1051. margin-left: 0px !important;
  1052. }
  1053. .sys-organization-list {
  1054. height: calc(100vh - 264px);
  1055. box-sizing: border-box;
  1056. border-width: 1px;
  1057. border-style: solid;
  1058. overflow: auto;
  1059. }
  1060. .sys-organization-list :deep(.el-tree-node__content) {
  1061. height: 40px;
  1062. & > .el-tree-node__expand-icon {
  1063. margin-left: 10px;
  1064. }
  1065. }
  1066. .switch_left ul .active {
  1067. border-top: 4px solid var(--color-primary);
  1068. color: var(--color-primary-5);
  1069. }
  1070. .switch {
  1071. padding-bottom: 20px;
  1072. }
  1073. .el-dropdown-link {
  1074. cursor: pointer;
  1075. color: var(--color-primary-5);
  1076. }
  1077. .el-icon-arrow-down {
  1078. font-size: 12px;
  1079. }
  1080. :deep(.el-badge__content.is-fixed) {
  1081. top: 4px;
  1082. }
  1083. </style>