index.vue 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <div class="switch" v-if="!contactData?.id">
  5. <div class="switch_left">
  6. <ul>
  7. <li
  8. style="height: 42px; line-height: 38px"
  9. v-for="item in tabOptions"
  10. :key="item.key"
  11. :class="{ active: activeComp == item.key }"
  12. @click="activeComp = item.key"
  13. >
  14. <el-badge
  15. :value="toDoReminder[item.reminder] || 0"
  16. class="item"
  17. v-if="item.reminder"
  18. >
  19. {{ item.name }}
  20. </el-badge>
  21. <span v-else>{{ item.name }}</span>
  22. </li>
  23. </ul>
  24. </div>
  25. </div>
  26. <div class="main" style="padding: 0 10px">
  27. <div v-show="activeComp == 'saleorder'">
  28. <div class="ele-border-lighter form-content" v-loading="loading">
  29. <search-table @search="reload"></search-table>
  30. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  31. <el-tab-pane label="全部" name="all"></el-tab-pane>
  32. <el-tab-pane label="待发货" name="700"></el-tab-pane>
  33. <el-tab-pane label="部分发货" name="701"></el-tab-pane>
  34. <el-tab-pane label="全部发货" name="800"></el-tab-pane>
  35. </el-tabs>
  36. <!-- 数据表格 -->
  37. <div v-table-scroll-sync class="table-container">
  38. <ele-pro-table
  39. ref="table"
  40. :columns="columns"
  41. :datasource="datasource"
  42. height="calc(100vh - 400px)"
  43. style="margin-bottom: 10px"
  44. full-height="calc(100vh - 116px)"
  45. tool-class="ele-toolbar-form"
  46. :selection.sync="selection"
  47. :page-size="20"
  48. @columns-change="handleColumnChange"
  49. :cache-key="cacheKeyUrl"
  50. show-summary
  51. :summary-method="getSummaries"
  52. >
  53. <!-- 表头工具栏 -->
  54. <template v-slot:toolbar>
  55. <el-button
  56. size="small"
  57. type="primary"
  58. icon="el-icon-plus"
  59. class="ele-btn-icon"
  60. @click="openEditNew('add', {})"
  61. v-if="$hasPermission('eom:saleorder:save')"
  62. >
  63. 新建
  64. </el-button>
  65. <el-button
  66. size="small"
  67. type="danger"
  68. icon="el-icon-delete"
  69. class="ele-btn-icon"
  70. @click="allDelBtn"
  71. v-if="$hasPermission('eom:saleorder:delete')"
  72. :disabled="selection?.length === 0"
  73. >
  74. 批量删除
  75. </el-button>
  76. <el-button
  77. size="small"
  78. type="primary"
  79. icon="el-icon-plus"
  80. class="ele-btn-icon"
  81. @click="invoiceAll"
  82. v-if="$hasPermission('eom:saleManage:invoiceAll')"
  83. :disabled="selection?.length === 0"
  84. >
  85. 批量发货
  86. </el-button>
  87. <el-button
  88. type="primary"
  89. size="small"
  90. icon="el-icon-upload2"
  91. @click="uploadFile"
  92. v-if="$hasPermission('eom:saleorder:save')"
  93. >导入</el-button
  94. >
  95. <exportButton
  96. btnName="列表导出"
  97. fileName="销售订单"
  98. apiUrl="/eom/saleorder/export"
  99. :params="exportParams"
  100. ></exportButton>
  101. <el-button
  102. v-if="$hasPermission('eom:saleorder:push')"
  103. size="small"
  104. type="primary"
  105. class="ele-btn-icon"
  106. @click="allPushBtn"
  107. :disabled="selection?.length === 0"
  108. >
  109. 批量推送
  110. </el-button>
  111. <el-dropdown
  112. trigger="click"
  113. :disabled="selection?.length === 0"
  114. >
  115. <el-button
  116. type="primary"
  117. class="el-icon-printer"
  118. size="small"
  119. >
  120. 打印<i class="el-icon-arrow-down el-icon--right"></i>
  121. </el-button>
  122. <el-dropdown-menu slot="dropdown">
  123. <el-dropdown-item
  124. v-if="$hasPermission('eom:saleorder:print')"
  125. @click.native="handlePrint"
  126. >打印</el-dropdown-item
  127. >
  128. <el-dropdown-item
  129. v-if="$hasPermission('eom:saleorder:printRt')"
  130. @click.native="handleRtPrint"
  131. >打印(润天)</el-dropdown-item
  132. >
  133. </el-dropdown-menu>
  134. </el-dropdown>
  135. </template>
  136. <!-- 查看详情列 -->
  137. <template v-slot:relationCode="{ row }">
  138. <el-link
  139. type="primary"
  140. :underline="false"
  141. @click="openRelationCodeDetail(row)"
  142. >
  143. {{ row.relationCode }}
  144. </el-link>
  145. </template>
  146. <template v-slot:orderNo="{ row }">
  147. <el-link
  148. type="primary"
  149. :underline="false"
  150. @click="openorderDetail(row)"
  151. >
  152. {{ row.orderNo }}
  153. </el-link>
  154. </template>
  155. <!-- 预销售订单编码 -->
  156. <template v-slot:preOrderNo="{ row }">
  157. <el-input
  158. v-model="row.preOrderNo"
  159. @keyup.enter.native="handlePreOrderNoBlur(row)"
  160. style="width: 100%; padding: 0 4px"
  161. placeholder="请输入预销售编码"
  162. ></el-input>
  163. </template>
  164. <!-- 操作列 -->
  165. <template v-slot:action="{ row }">
  166. <el-link
  167. type="primary"
  168. :underline="false"
  169. icon="el-icon-edit"
  170. @click="openEditNew('edit', row)"
  171. v-if="
  172. $hasPermission('eom:saleorder:update') &&
  173. [0, 3].includes(row.orderStatus)
  174. "
  175. >
  176. 修改
  177. </el-link>
  178. <el-link
  179. type="primary"
  180. :underline="false"
  181. icon="el-icon-plus"
  182. @click="saleOrderSubmitOrGenerate(row)"
  183. v-if="
  184. [0, 3].includes(row.orderStatus) &&
  185. $hasPermission('eom:saleorder:update')
  186. "
  187. >
  188. 提交
  189. </el-link>
  190. <!-- <el-link
  191. type="primary"
  192. :underline="false"
  193. icon="el-icon-plus"
  194. @click="handleAutoGenerate(row.id)"
  195. v-if="
  196. [2].includes(row.orderStatus) &&
  197. row.needProduce &&
  198. !!!row.purchasePlanNum
  199. "
  200. >
  201. 生成采购计划
  202. </el-link> -->
  203. <el-popconfirm
  204. class="ele-action"
  205. title="确定要删除此信息吗?"
  206. @confirm="remove([row.id])"
  207. v-if="
  208. [0, 3].includes(row.orderStatus) &&
  209. $hasPermission('eom:saleorder:delete')
  210. "
  211. >
  212. <template v-slot:reference>
  213. <el-link
  214. type="danger"
  215. :underline="false"
  216. icon="el-icon-delete"
  217. >
  218. 删除
  219. </el-link>
  220. </template>
  221. </el-popconfirm>
  222. <el-link
  223. type="primary"
  224. :underline="false"
  225. icon="el-icon-plus"
  226. @click="handleCommand('adjustment', row)"
  227. v-if="row.allowDifference == 1 && $hasPermission('eom:saleorder:adjustment')"
  228. >
  229. 冲差
  230. </el-link>
  231. <el-link
  232. type="primary"
  233. :underline="false"
  234. icon="el-icon-plus"
  235. @click="handleCommand('invoice', row)"
  236. v-if="
  237. [2].includes(row.orderStatus) &&
  238. ((row.saleTypeName.includes('受托') &&
  239. row.isEntrustedReceive == 1) ||
  240. !row.saleTypeName.includes('受托')) &&
  241. $hasPermission('eom:saleordersendrecord:save') &&
  242. ((isTotalCount == '1' &&
  243. row.sendTotalCount < row.productCount) ||
  244. isTotalCount == 0)
  245. "
  246. >
  247. 发货单
  248. </el-link>
  249. <el-link
  250. type="primary"
  251. :underline="false"
  252. icon="el-icon-plus"
  253. @click="handleCommand('entrustedReceive', row)"
  254. v-if="
  255. [2].includes(row.orderStatus) &&
  256. row.saleTypeName.includes('受托') &&
  257. row.isEntrustedReceive != 1
  258. "
  259. >
  260. 受托收货单
  261. </el-link>
  262. <el-link
  263. type="primary"
  264. :underline="false"
  265. icon="el-icon-plus"
  266. @click="handleCommand('saleOrderReminder', row)"
  267. v-if="
  268. [2].includes(row.orderStatus) &&
  269. clientEnvironmentId != 5 &&
  270. row.progress < 800
  271. "
  272. >
  273. 催单
  274. </el-link>
  275. <el-link
  276. type="primary"
  277. :underline="false"
  278. @click="finish('single', row)"
  279. v-if="
  280. [2].includes(row.orderStatus) &&
  281. row.progress != 1000
  282. "
  283. >
  284. 完结
  285. </el-link>
  286. <!-- <el-link
  287. type="primary"
  288. :underline="false"
  289. icon="el-icon-plus"
  290. @click="handleCommand('invoiceManage', row)"
  291. v-if="
  292. [2].includes(row.orderStatus) &&
  293. !row.hasInvoiceApply &&
  294. $hasPermission('eom:fininvoiceapply:save')
  295. "
  296. >
  297. 新增发票
  298. </el-link> -->
  299. </template>
  300. </ele-pro-table>
  301. </div>
  302. </div>
  303. </div>
  304. <keep-alive>
  305. <component
  306. v-if="currentTabComponent"
  307. :is="currentTabComponent"
  308. @getToDoReminder="getToDoReminder"
  309. ></component>
  310. </keep-alive>
  311. </div>
  312. </el-card>
  313. <add-dialog
  314. :isRequired="isRequired"
  315. ref="addDialogRef"
  316. @done="reload"
  317. :contactData="contactData"
  318. ></add-dialog>
  319. <add-dialog-new
  320. :isRequired="isRequired"
  321. ref="addDialogNewRef"
  322. @done="reload"
  323. :contactData="contactData"
  324. ></add-dialog-new>
  325. <add-invoice-dialog
  326. ref="invoiceDialogRef"
  327. @done="reload"
  328. :contactData="contactData"
  329. ></add-invoice-dialog>
  330. <add-return-goods-dialog
  331. ref="addReturnGoodsRef"
  332. :contactData="contactData"
  333. @done="reload"
  334. ></add-return-goods-dialog>
  335. <contractr-detail ref="contractDetailRef"></contractr-detail>
  336. <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
  337. <autogenerate-dialog
  338. ref="autogenerateDialogRef"
  339. @handleSubmit="saleOrderSubmit"
  340. @reload="reload"
  341. ></autogenerate-dialog>
  342. <!-- 多选删除弹窗 -->
  343. <pop-modal
  344. :visible.sync="delVisible"
  345. content="是否确定删除?"
  346. @done="commitBtn"
  347. />
  348. <drawer ref="drawerRef"></drawer>
  349. <process-submit-dialog
  350. :isNotNeedProcess="true"
  351. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  352. v-if="processSubmitDialogFlag"
  353. :isCloseRefresh="false"
  354. ref="processSubmitDialogRef"
  355. @reload="reload"
  356. :callBack="callBack"
  357. ></process-submit-dialog>
  358. <addInvoiceManage
  359. :add-or-edit-dialog-flag.sync="addOrEditDialogFlag1"
  360. ref="addOrEditDialogRef"
  361. v-if="addOrEditDialogFlag1"
  362. @reload="reload"
  363. ></addInvoiceManage>
  364. <importDialog
  365. ref="importDialogRef"
  366. @success="reload"
  367. :fileUrl="'/eom/saleorder/importTemplate'"
  368. :isWeb="false"
  369. fileName="销售订单导入模板"
  370. apiUrl="/eom/saleorder/importFile"
  371. />
  372. <bomDialog ref="bomDialogRef" :isCloseRefresh="false" @handleSubmit="bomDialogSuccess" @reload="reload"></bomDialog>
  373. <opportunityDetail ref="opportunityDetailRef"></opportunityDetail>
  374. <quotationDetail ref="quotationDetailRef"></quotationDetail>
  375. <addEntrustedReceive
  376. ref="addEntrustedReceiveRef"
  377. @done="reload"
  378. :add-or-edit-dialog-flag.sync="addEntrustedReceiveFlag"
  379. v-if="addEntrustedReceiveFlag"
  380. ></addEntrustedReceive>
  381. <printTemplateSaleOrder
  382. :groupName="groupName"
  383. ref="printTemplateSaleOrderRef"
  384. ></printTemplateSaleOrder>
  385. <printTemplateHt ref="printTemplateHtRef" :groupName="groupName"></printTemplateHt>
  386. <printTemplateRt ref="printTemplateRtRef" :groupName="groupName"></printTemplateRt>
  387. <add-adjust-dialog
  388. v-if="addAdjustDialogFlag"
  389. :addAdjustDialogFlag.sync="addAdjustDialogFlag"
  390. ref="addAdjustDialogRef"
  391. @done="reload"
  392. ></add-adjust-dialog>
  393. </div>
  394. </template>
  395. <script>
  396. import { getSummaries } from '@/utils/util.js';
  397. import searchTable from './components/searchTable.vue';
  398. import addDialog from './components/addDialog.vue';
  399. import addDialogNew from './components/addDialogNew.vue';
  400. import invoice from './invoice/index.vue';
  401. import invoiceConfirm from './invoiceConfirm/index.vue';
  402. import detailDialog from './components/detailDialog.vue';
  403. import exceptionList from './exceptionManagement/exceptionList';
  404. import bomDialog from './components/bomDialog';
  405. import suspend from './suspend/index.vue';
  406. import drawer from './components/drawer.vue';
  407. import contractrDetail from '@/views/contractManage/contractBook/components/detailDialog.vue';
  408. import addInvoiceDialog from '@/views/saleManage/saleOrder/invoice/components/addInvoiceDialog';
  409. import addReturnGoodsDialog from '@/views/saleManage/saleOrder/returnGoods/components/addReturnGoodsDialog';
  410. import popModal from '@/components/pop-modal';
  411. import accountstatement from './accountstatement/index.vue';
  412. import customerReturnOrder from './customerReturnOrder/index.vue';
  413. import returnGoods from './returnGoods/index.vue';
  414. import palletManagement from './palletManagement/index.vue';
  415. import addInvoiceManage from '@/views/financialManage/invoiceManage/components/addOrEditDialog.vue';
  416. import addEntrustedReceive from '@/views/saleManage/saleOrder/entrustedReceive/components/addOrEditDialog';
  417. import adjustmentNote from './adjustmentNote‌/index.vue';
  418. import addAdjustDialog from '@/views/saleManage/saleOrder/adjustmentNote‌/components/addAdjustDialog.vue';
  419. import {
  420. deleteInformation,
  421. getSaleOrderDetail,
  422. getTableList,
  423. saleOrderReminder,
  424. getByRepeatBomAttribute,
  425. saveOrderBomList,
  426. updateOrderInfo,
  427. saleOrderAdd,
  428. batchCompleted
  429. } from '@/api/saleManage/saleorder';
  430. import { getToDoReminder } from '@/api/common/index';
  431. import { exportSaleorder } from '@/api/system/file/index.js';
  432. import dictMixins from '@/mixins/dictMixins';
  433. import { reviewStatus, saleOrderProgressStatusEnum, saleOrderStatusEnum } from '@/enum/dict';
  434. import entrustedReceive from '@/views/saleManage/saleOrder/entrustedReceive/index.vue';
  435. import autogenerateDialog from '@/BIZComponents/autogenerateDialog.vue';
  436. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  437. import tabMixins from '@/mixins/tableColumnsMixin';
  438. import importDialog from '@/components/upload/import-dialog.vue';
  439. import exportButton from '@/components/upload/exportButton.vue';
  440. import { parameterGetByCode } from '@/api/main/index.js';
  441. import opportunityDetail from '@/views/saleManage/businessOpportunity/components/opportunityDetailDialog.vue';
  442. import quotationDetail from '@/views/saleManage/quotation/components/detailDialog.vue';
  443. import printTemplateSaleOrder from './components/printTemplateSaleOrder.vue';
  444. import { enterprisePage } from '@/api/contractManage/contractBook';
  445. import { listOrganizations } from '@/api/system/organization';
  446. import printTemplateHt from './components/printTemplateHt.vue';
  447. import printTemplateRt from './components/printTemplateRt.vue';
  448. export default {
  449. mixins: [dictMixins, tabMixins],
  450. components: {
  451. processSubmitDialog,
  452. autogenerateDialog,
  453. searchTable,
  454. returnGoods,
  455. accountstatement,
  456. popModal,
  457. contractrDetail,
  458. addReturnGoodsDialog,
  459. addInvoiceDialog,
  460. invoice,
  461. addDialog,
  462. detailDialog,
  463. customerReturnOrder,
  464. entrustedReceive,
  465. invoiceConfirm,
  466. drawer,
  467. exceptionList,
  468. addInvoiceManage,
  469. palletManagement,
  470. exportButton,
  471. importDialog,
  472. bomDialog,
  473. opportunityDetail,
  474. quotationDetail,
  475. addEntrustedReceive,
  476. printTemplateSaleOrder,
  477. adjustmentNote,
  478. addAdjustDialog,
  479. suspend,
  480. addDialogNew,
  481. printTemplateHt,
  482. printTemplateRt
  483. },
  484. //客户管理数据
  485. props: {
  486. contactData: {
  487. type: Object,
  488. default: () => {
  489. return {};
  490. }
  491. }
  492. },
  493. data() {
  494. return {
  495. activeName: 'all',
  496. activeComp: 'saleorder',
  497. tabOptions: [
  498. { key: 'saleorder', name: '销售订单', reminder: 'salesOrderNum' },
  499. {
  500. key: 'entrustedReceive',
  501. name: '受托收货单',
  502. reminder: 'entrustedReceiptNum'
  503. },
  504. { key: 'invoice', name: '发货单', reminder: 'deliveryNoteNum' },
  505. {
  506. key: 'invoiceConfirm',
  507. name: '发货确认单',
  508. reminder: 'deliveryConfirmationFormNum'
  509. },
  510. { key: 'trayList', name: '托盘清单' },
  511. {
  512. key: 'exceptionList',
  513. name: '异常列表',
  514. reminder: 'exceptionListNum'
  515. },
  516. { key: 'returnorder', name: '退货单', reminder: 'returnOrderNum' },
  517. {
  518. key: 'customerReturnOrder',
  519. name: '退货处理单',
  520. reminder: 'returnProcessingFormNum'
  521. },
  522. {
  523. key: 'accountstatement',
  524. name: '对账单',
  525. reminder: 'statementAccountNum'
  526. },
  527. {
  528. key: 'adjustmentNote',
  529. name: '冲差单',
  530. reminder: 'punchSlipOrderNum'
  531. },
  532. {
  533. key: 'suspend',
  534. name: '挂单',
  535. reminder: 'suspendNum'
  536. },
  537. ],
  538. selection: [], //单选中集合
  539. delVisible: false, //批量删除弹框状态
  540. loading: false, // 加载状态
  541. processSubmitDialogFlag: false, // 加载状态
  542. addOrEditDialogFlag1: false,
  543. addEntrustedReceiveFlag: false,
  544. addAdjustDialogFlag: false, //冲差状态
  545. params: {},
  546. tableList: [],
  547. current: null,
  548. cacheKeyUrl: 'eos-c2e9664a-saleManage-saleOrder',
  549. isRequired: true,
  550. isTotalCount: '0',
  551. columnsVersion: 1,
  552. timeR: null,
  553. toDoReminder: {},
  554. groupName: '',
  555. organizations: []
  556. };
  557. },
  558. created() {
  559. enterprisePage({
  560. pageNum: 1,
  561. size: 200
  562. }).then((res) => {
  563. if (res.list?.length > 0) {
  564. this.groupName = res.list[0].name;
  565. }
  566. });
  567. this.requestDict('客户状态');
  568. parameterGetByCode({
  569. code: 'order_person_info'
  570. }).then((res) => {
  571. if (res.value) {
  572. this.isRequired = res.value === '1';
  573. }
  574. });
  575. //销售发货数量是否限制不能大于采购总数//0否 1是
  576. parameterGetByCode({
  577. code: 'saleOrder_invoice_productList_totalCount'
  578. }).then((res) => {
  579. this.isTotalCount = res.value;
  580. });
  581. this.getToDoReminder();
  582. this.getInfo();
  583. this.timeR = setInterval(() => {
  584. this.getToDoReminder();
  585. }, 60000);
  586. if (this.$route.query.isView) {
  587. this.activeComp = this.$route.query.activeComp;
  588. this.$nextTick(() => {
  589. if (this.activeComp == 'entrustedReceive') {
  590. this.$refs.entrustedReceiveRef.openorderDetail(
  591. {
  592. id: this.$route.query.id
  593. },
  594. 'code'
  595. );
  596. }
  597. const url = new URL(window.location.href);
  598. url.search = ''; // 清空查询参数
  599. window.history.pushState({}, '', url.href);
  600. });
  601. }
  602. // if (!('Notification' in window)) {
  603. // console.log('此浏览器不支持桌面通知');
  604. // } else if (Notification.permission === 'granted') {
  605. // // 如果用户已经授权,直接创建通知
  606. // var notification = new Notification('标题', {
  607. // body: '这是通知的内容。'
  608. // });
  609. // } else if (Notification.permission !== 'denied') {
  610. // // 请求权限
  611. // Notification.requestPermission().then(function (permission) {
  612. // if (permission === 'granted') {
  613. // var notification = new Notification('标题', {
  614. // body: '消息提醒1'
  615. // });
  616. // }
  617. // });
  618. // }
  619. },
  620. beforeDestroy() {
  621. clearInterval(this.timeR);
  622. },
  623. computed: {
  624. // 根据当前页签返回对应的子组件(用于 keep-alive + 单一动态组件,避免多 v-if 兄弟节点导致缓存错乱)
  625. currentTabComponent() {
  626. const map = {
  627. invoice: invoice,
  628. invoiceConfirm: invoiceConfirm,
  629. entrustedReceive: entrustedReceive,
  630. returnorder: returnGoods,
  631. accountstatement: accountstatement,
  632. customerReturnOrder: customerReturnOrder,
  633. exceptionList: exceptionList,
  634. trayList: palletManagement,
  635. adjustmentNote: adjustmentNote,
  636. suspend: suspend
  637. };
  638. return map[this.activeComp] || null;
  639. },
  640. exportParams() {
  641. return {
  642. ...this.params,
  643. orderIds: this.selection.map(item => item.id)
  644. }
  645. },
  646. clientEnvironmentId() {
  647. return this.$store.state.user.info.clientEnvironmentId;
  648. },
  649. columns() {
  650. let columnsVersion = this.columnsVersion;
  651. return [
  652. {
  653. width: 45,
  654. type: 'selection',
  655. columnKey: 'selection',
  656. align: 'center'
  657. },
  658. {
  659. columnKey: 'index',
  660. label: '序号',
  661. type: 'index',
  662. width: 55,
  663. align: 'center',
  664. showOverflowTooltip: true,
  665. fixed: 'left'
  666. },
  667. {
  668. prop: 'orderNo',
  669. label: '订单编码',
  670. align: 'center',
  671. slot: 'orderNo',
  672. showOverflowTooltip: true,
  673. sortable: true,
  674. minWidth: 200,
  675. fixed: 'left'
  676. },
  677. {
  678. prop: 'needProduce',
  679. label: '订单类型',
  680. align: 'center',
  681. showOverflowTooltip: true,
  682. minWidth: 150,
  683. formatter: (_row, _column, cellValue) => {
  684. let businessType =
  685. cellValue == 1
  686. ? '有客户生产性订单'
  687. : cellValue == 2
  688. ? '无客户生产性订单'
  689. : cellValue == 4
  690. ? '不定向订单'
  691. : cellValue == 5
  692. ? '委外订单'
  693. : '库存式订单';
  694. return businessType;
  695. }
  696. },
  697. {
  698. prop: 'preOrderNo',
  699. label: '预销售订单编码',
  700. align: 'center',
  701. slot: 'preOrderNo',
  702. showOverflowTooltip: true,
  703. sortable: true,
  704. minWidth: 200,
  705. fixed: 'left'
  706. },
  707. {
  708. prop: 'createDept',
  709. columnKey: 'createDept',
  710. label: '发起人所属部门',
  711. minWidth: 200,
  712. align: 'center',
  713. showOverflowTooltip: true,
  714. formatter: (_row, _column, cellValue) => {
  715. if (!cellValue) return '';
  716. const matchedDept = this.organizations.find(
  717. (dept) => dept.id === cellValue
  718. );
  719. return matchedDept ? matchedDept.name : '';
  720. }
  721. },
  722. {
  723. prop: 'relationType',
  724. label: '来源类型',
  725. align: 'center',
  726. showOverflowTooltip: true,
  727. minWidth: 150,
  728. formatter: (_row, _column, cellValue) => {
  729. let businessType =
  730. cellValue == 1
  731. ? '商机'
  732. : cellValue == 2
  733. ? '报价'
  734. : cellValue == 3
  735. ? '销售合同'
  736. : cellValue == 4
  737. ? '项目'
  738. : '';
  739. return businessType;
  740. }
  741. },
  742. {
  743. prop: 'relationCode',
  744. label: '来源单据',
  745. align: 'center',
  746. slot: 'relationCode',
  747. showOverflowTooltip: true,
  748. minWidth: 200,
  749. formatter: (_row, _column, cellValue) => {
  750. return _row.relationCode;
  751. }
  752. },
  753. {
  754. prop: 'progress',
  755. label: '订单进度',
  756. align: 'center',
  757. showOverflowTooltip: true,
  758. formatter: (_row, _column, cellValue) => {
  759. return saleOrderProgressStatusEnum.find(
  760. (val) => val.value == _row.progress
  761. )?.label;
  762. },
  763. minWidth: 120
  764. },
  765. // {
  766. // prop: 'deliveryDate',
  767. // label: '交货日期',
  768. // align: 'center',
  769. // showOverflowTooltip: true,
  770. // minWidth: 200
  771. // },
  772. {
  773. prop: 'productNames',
  774. label: '产品名称',
  775. align: 'center',
  776. showOverflowTooltip: true,
  777. minWidth: 140
  778. },
  779. {
  780. prop: 'productCodes',
  781. label: '编码',
  782. align: 'center',
  783. showOverflowTooltip: true,
  784. minWidth: 140
  785. },
  786. {
  787. minWidth: 160,
  788. prop: 'productionCodes',
  789. label: '生产编号',
  790. align: 'center'
  791. },
  792. {
  793. prop: 'batchNos',
  794. label: '批次号',
  795. align: 'center',
  796. showOverflowTooltip: true,
  797. minWidth: 140
  798. },
  799. {
  800. prop: 'productCount',
  801. label: '数量',
  802. align: 'center',
  803. showOverflowTooltip: true,
  804. minWidth: 140
  805. },
  806. {
  807. prop: 'inventoryQuantity',
  808. label: '库存数',
  809. align: 'center',
  810. showOverflowTooltip: true,
  811. minWidth: 140
  812. },
  813. {
  814. prop: 'sendTotalCount',
  815. label: '发货数量',
  816. align: 'center',
  817. showOverflowTooltip: true,
  818. minWidth: 120
  819. },
  820. {
  821. prop: 'outboundTotalCount',
  822. label: '出库数量',
  823. align: 'center',
  824. showOverflowTooltip: true,
  825. minWidth: 140
  826. },
  827. {
  828. prop: 'returnTotalCount',
  829. label: '退货数量',
  830. align: 'center',
  831. showOverflowTooltip: true,
  832. minWidth: 120
  833. },
  834. {
  835. prop: 'inventoryQuantity1',
  836. label: '库存状态',
  837. align: 'center',
  838. showOverflowTooltip: true,
  839. minWidth: 140,
  840. formatter: (_row, _column, cellValue) => {
  841. return _row.inventoryQuantity > 0 ? '有库存' : '无库存';
  842. }
  843. },
  844. {
  845. prop: 'saleTypeName',
  846. label: '销售类型',
  847. align: 'center',
  848. showOverflowTooltip: true,
  849. minWidth: 140
  850. },
  851. {
  852. prop: 'projectName',
  853. label: '项目名称',
  854. align: 'center',
  855. showOverflowTooltip: true,
  856. minWidth: 180
  857. },
  858. {
  859. prop: 'partaName',
  860. label: '客户名称',
  861. align: 'center',
  862. showOverflowTooltip: true,
  863. minWidth: 180
  864. },
  865. {
  866. prop: 'partaLinkName',
  867. label: '客户联系人',
  868. align: 'center',
  869. showOverflowTooltip: true,
  870. minWidth: 130
  871. },
  872. {
  873. prop: 'partaTel',
  874. label: '客户联系电话',
  875. align: 'center',
  876. showOverflowTooltip: true,
  877. minWidth: 130
  878. },
  879. {
  880. prop: 'partbName',
  881. label: '售出方名称',
  882. align: 'center',
  883. showOverflowTooltip: true,
  884. minWidth: 130
  885. },
  886. {
  887. prop: 'partbLinkName',
  888. label: '售出方联系人',
  889. align: 'center',
  890. showOverflowTooltip: true,
  891. minWidth: 130
  892. },
  893. {
  894. prop: 'partbTel',
  895. label: '售出方联系电话',
  896. align: 'center',
  897. showOverflowTooltip: true,
  898. minWidth: 130
  899. },
  900. {
  901. prop: 'payAmount',
  902. label: '金额(元)',
  903. align: 'center',
  904. showOverflowTooltip: true,
  905. minWidth: 170
  906. },
  907. {
  908. prop: 'arrivalWays',
  909. label: '到货方式',
  910. align: 'center',
  911. showOverflowTooltip: true,
  912. minWidth: 170,
  913. formatter: (_row, _column, cellValue) => {
  914. return _row.arrivalWays
  915. ? _row.arrivalWays
  916. .split(',')
  917. .map((val) => {
  918. return val == 1 ? '一次性到货' : val == 2 ? '分批到货' : '';
  919. })
  920. .toString()
  921. : '';
  922. }
  923. },
  924. {
  925. prop: 'externalId',
  926. label: '是否推送',
  927. align: 'center',
  928. showOverflowTooltip: true,
  929. minWidth: 120,
  930. formatter: (_row, _column, cellValue) => {
  931. return _row.preOrderNo? '已推送' : '未推送';
  932. }
  933. },
  934. {
  935. prop: 'orderStatus',
  936. label: '审核状态',
  937. align: 'center',
  938. showOverflowTooltip: true,
  939. minWidth: 100,
  940. formatter: (_row, _column, cellValue) => {
  941. return reviewStatus[_row.orderStatus];
  942. }
  943. },
  944. {
  945. prop: 'salesmanName',
  946. label: '业务员',
  947. align: 'center',
  948. showOverflowTooltip: true,
  949. minWidth: 80
  950. },
  951. {
  952. prop: 'createUserName',
  953. label: '创建人',
  954. align: 'center',
  955. showOverflowTooltip: true,
  956. minWidth: 80
  957. },
  958. {
  959. prop: 'createTime',
  960. label: '创建时间',
  961. align: 'center',
  962. showOverflowTooltip: true,
  963. minWidth: 170
  964. },
  965. {
  966. prop: 'reviewTime',
  967. label: '审核时间',
  968. align: 'center',
  969. showOverflowTooltip: true,
  970. minWidth: 170
  971. },
  972. {
  973. columnKey: 'action',
  974. label: '操作',
  975. width: 280,
  976. align: 'center',
  977. resizable: false,
  978. slot: 'action',
  979. showOverflowTooltip: true,
  980. fixed: 'right'
  981. }
  982. ];
  983. }
  984. },
  985. watch: {
  986. // 切回销售订单主列表时,保持搜索条件与页码不变,仅刷新列表数据
  987. activeComp(val) {
  988. if (val === 'saleorder') {
  989. this.$nextTick(() => {
  990. if (this.$refs.table) {
  991. this.$refs.table.reload();
  992. if (this.$refs.table.doLayout) this.$refs.table.doLayout();
  993. }
  994. });
  995. }
  996. }
  997. },
  998. methods: {
  999. getSummaries(param) {
  1000. return getSummaries(
  1001. param,
  1002. ['productCount', 'sendTotalCount', 'outboundTotalCount', 'payAmount'],
  1003. ' '
  1004. );
  1005. },
  1006. async getInfo() {
  1007. try {
  1008. const res = await listOrganizations(); // 假设接口直接返回部门数组(如用户提供的示例数据)
  1009. this.organizations = res; // 存储部门列表到状态中
  1010. console.log('部门列表加载完成:', this.organizations);
  1011. } catch (err) {
  1012. console.error('加载部门列表失败:', err);
  1013. this.organizations = []; // 异常时置空,避免匹配错误
  1014. }
  1015. },
  1016. getToDoReminder() {
  1017. getToDoReminder().then((res) => {
  1018. this.toDoReminder = res;
  1019. });
  1020. },
  1021. // 预销售编码输入框失焦回车事件
  1022. handlePreOrderNoBlur(row) {
  1023. updateOrderInfo({
  1024. preOrderNo: row.preOrderNo
  1025. })
  1026. .then((res) => {
  1027. console.log(res);
  1028. this.$message.success('预销售编码更新成功');
  1029. })
  1030. .catch((err) => {});
  1031. },
  1032. finish(type, row) {
  1033. if (type == 'single') {
  1034. batchCompleted([row.id]).then((res) => {
  1035. this.$message.success(res.message);
  1036. this.reload();
  1037. }).catch((err) => {});
  1038. }
  1039. },
  1040. //更多菜单
  1041. handleCommand(command, row) {
  1042. if (command === 'invoice') {
  1043. this.$refs.invoiceDialogRef.open('add', {}, [row.id]);
  1044. }
  1045. if (command === 'entrustedReceive') {
  1046. this.addEntrustedReceiveFlag = true;
  1047. this.$nextTick(() => {
  1048. this.$refs.addEntrustedReceiveRef.open('add', {}, row.id);
  1049. });
  1050. }
  1051. if (command === 'returnOrder') {
  1052. this.$refs.addReturnGoodsRef.open('add', {});
  1053. }
  1054. if (command === 'saleOrderReminder') {
  1055. saleOrderReminder(row.id).then((res) => {
  1056. this.$message.success('催单成功');
  1057. });
  1058. }
  1059. if (command === 'invoiceManage') {
  1060. this.addOrEditDialogFlag1 = true;
  1061. this.$nextTick(() => {
  1062. this.$refs.addOrEditDialogRef.createInvoice1(row, 1, 3);
  1063. });
  1064. }
  1065. // 冲差
  1066. if (command === 'adjustment') {
  1067. console.log(row);
  1068. this.addAdjustDialogFlag = true;
  1069. this.$nextTick(() => {
  1070. this.$refs.addAdjustDialogRef.open('add', row);
  1071. });
  1072. }
  1073. },
  1074. allPushBtn() {
  1075. const dataId = this.selection.map((v) => v.id);
  1076. saleOrderAdd(dataId).then((res) => {
  1077. this.$message.success('推送成功!');
  1078. this.reload();
  1079. });
  1080. },
  1081. invoiceAll() {
  1082. let partaIds = this.selection.map((item) => item.partaId);
  1083. if (new Set(partaIds).size != 1) {
  1084. return this.$message.warning('请选择相同客户的订单!');
  1085. }
  1086. let saleTypeS = this.selection.map((item) => item.saleType);
  1087. if (new Set(saleTypeS).size != 1) {
  1088. return this.$message.warning('请选择相同销售类型的订单!');
  1089. }
  1090. let processObj = this.selection.filter((item) => item.progress == 800);
  1091. if (processObj?.length && this.isTotalCount == '1') {
  1092. return this.$message.warning(
  1093. '订单' +
  1094. processObj.map((item) => item.orderNo).toString() +
  1095. '已全部发货,不能创建发货单'
  1096. );
  1097. }
  1098. if (
  1099. this.selection.filter((item) => item.needProduce == 4)?.length &&
  1100. this.selection.filter((item) => item.needProduce == 4)?.length !=
  1101. this.selection.length
  1102. ) {
  1103. return this.$message.warning(
  1104. '不定向订单不能与其它类型的订单一起创建发货单!'
  1105. );
  1106. }
  1107. this.$refs.invoiceDialogRef.open(
  1108. 'add',
  1109. {},
  1110. this.selection.map((item) => item.id)
  1111. );
  1112. },
  1113. //点击左边分类
  1114. handleNodeClick(data, node) {
  1115. // this.curNodeData = data;
  1116. this.reload({ categoryId: data.id });
  1117. },
  1118. /* 表格数据源 */
  1119. datasource({ page, limit, where, order }) {
  1120. console.log('where~~~', where);
  1121. if(where?.needProduces?.length){
  1122. where['needProduces'] = where.needProduces.join(',');
  1123. }
  1124. if (this.contactData.id) {
  1125. where['contactId'] = this.contactData.id;
  1126. }
  1127. // 构建进度列表参数
  1128. const progressList = [];
  1129. // 添加标签页进度筛选(如果不是'all'标签)
  1130. if (this.activeName !== 'all') {
  1131. progressList.push(this.activeName);
  1132. }
  1133. // 添加搜索条件中的进度筛选
  1134. if (where?.progress) {
  1135. progressList.push(where.progress);
  1136. }
  1137. // 构建请求参数
  1138. this.params = {
  1139. pageNum: page,
  1140. size: limit,
  1141. ...where
  1142. };
  1143. delete this.params.progress;
  1144. // 仅当进度列表有值时添加到请求参数
  1145. if (progressList.length > 0) {
  1146. this.params.progressList = progressList.join(',');
  1147. }
  1148. return getTableList(this.params);
  1149. },
  1150. /* 刷新表格 */
  1151. reload(where) {
  1152. this.$refs.table.reload({ page: 1, where });
  1153. this.getToDoReminder();
  1154. },
  1155. handleClick() {
  1156. this.$refs.table.reload({
  1157. page: 1,
  1158. // where: { progress: this.activeName == 'all' ? '' : this.activeName }
  1159. });
  1160. },
  1161. //新增编辑
  1162. openEdit(type, row) {
  1163. this.$refs.addDialogRef.open(type, row, row.id);
  1164. this.$refs.addDialogRef.$refs.form &&
  1165. this.$refs.addDialogRef.$refs.form.clearValidate();
  1166. },
  1167. //新增编辑新
  1168. openEditNew(type, row) {
  1169. this.$refs.addDialogNewRef.open(type, row, row.id);
  1170. this.$refs.addDialogNewRef.$refs.form &&
  1171. this.$refs.addDialogNewRef.$refs.form.clearValidate();
  1172. },
  1173. //批量删除
  1174. allDelBtn() {
  1175. if (this.selection.length === 0) return;
  1176. let flag = this.selection.some((item) =>
  1177. [1, 2].includes(item.orderStatus)
  1178. );
  1179. if (flag)
  1180. return this.$message.warning('抱歉已审核、审核中的数据不能删除,请检查');
  1181. this.delVisible = true;
  1182. },
  1183. //删除接口
  1184. remove(delData) {
  1185. deleteInformation(delData).then((res) => {
  1186. this.$message.success('删除成功!');
  1187. this.reload();
  1188. });
  1189. },
  1190. //删除弹框确定
  1191. commitBtn() {
  1192. const dataId = this.selection.map((v) => v.id);
  1193. this.remove(dataId);
  1194. },
  1195. //查看详情
  1196. openorderDetail(row) {
  1197. this.$refs.drawerRef.open(row);
  1198. },
  1199. async saleOrderSubmit(id) {
  1200. this.$refs.addDialogRef && this.$refs.addDialogRef.cancel();
  1201. // const data = await getSaleOrderDetail(id);
  1202. this.processSubmitDialogFlag = true;
  1203. let businessType =
  1204. this.current.needProduce == 1
  1205. ? '有客户生产性订单'
  1206. : this.current.needProduce == 2
  1207. ? '无客户生产性订单'
  1208. : this.current.needProduce == 4
  1209. ? '不定向订单'
  1210. : '库存式订单';
  1211. this.$nextTick(() => {
  1212. let params = {
  1213. businessId: this.current.id,
  1214. businessKey: 'sales_order_approve',
  1215. formCreateUserId: this.current.createUserId,
  1216. variables: {
  1217. businessCode: this.current.orderNo,
  1218. businessName: this.current.partaName,
  1219. businessType: businessType
  1220. }
  1221. };
  1222. this.$refs.processSubmitDialogRef.init(params);
  1223. });
  1224. },
  1225. async callBack() {
  1226. if (!this.current.generatePurchase && !this.current.generateProduce) {
  1227. return 0;
  1228. }
  1229. const code = saveOrderBomList({
  1230. categoryDTOList: this.tableList || [],
  1231. orderId: this.current.id
  1232. });
  1233. return code;
  1234. },
  1235. async saleOrderSubmitOrGenerate(res) {
  1236. this.tableList = [];
  1237. this.current = await getSaleOrderDetail(res.id);
  1238. if (!this.current.generatePurchase && !this.current.generateProduce) {
  1239. this.saleOrderSubmit(res.id);
  1240. } else {
  1241. const data = await getByRepeatBomAttribute(res.id);
  1242. if (data && data.length) {
  1243. this.$refs.bomDialogRef.open(data);
  1244. return;
  1245. }
  1246. this.saleOrderSubmit(res.id);
  1247. }
  1248. },
  1249. bomDialogSuccess(tableList) {
  1250. this.tableList = tableList;
  1251. // this.callBack()
  1252. this.saleOrderSubmit(this.current.id);
  1253. },
  1254. //生成
  1255. handleAutoGenerate(id, isAuto = false) {
  1256. this.$refs.autogenerateDialogRef.init(id, isAuto);
  1257. },
  1258. //查看来源详情
  1259. openRelationCodeDetail(row) {
  1260. let data = {
  1261. id: row.relationId
  1262. };
  1263. if (row.relationType == 1) {
  1264. this.$refs.opportunityDetailRef.open(data);
  1265. }
  1266. if (row.relationType == 2) {
  1267. this.$refs.quotationDetailRef.open(data);
  1268. }
  1269. if (row.relationType == 3) {
  1270. this.$refs.contractDetailRef.open(data);
  1271. }
  1272. },
  1273. uploadFile() {
  1274. this.$refs.importDialogRef.open();
  1275. },
  1276. exportFn() {
  1277. console.log(this.params);
  1278. exportSaleorder(this.params);
  1279. },
  1280. handlePrint() {
  1281. console.log(this.selection[0]);
  1282. // if (this.selection.length > 1) return this.$message.warning('请选择一条');
  1283. this.$refs.printTemplateHtRef.open(this.selection.map((v) => v.id));
  1284. },
  1285. handleRtPrint() {
  1286. this.$refs.printTemplateRtRef.open(this.selection.map((v) => v.id));
  1287. }
  1288. }
  1289. };
  1290. </script>
  1291. <style lang="scss" scoped>
  1292. :deep .el-card__body {
  1293. padding: 0;
  1294. }
  1295. :deep(.el-link--inner) {
  1296. margin-left: 0px !important;
  1297. }
  1298. .sys-organization-list {
  1299. height: calc(100vh - 264px);
  1300. box-sizing: border-box;
  1301. border-width: 1px;
  1302. border-style: solid;
  1303. overflow: auto;
  1304. }
  1305. .sys-organization-list :deep(.el-tree-node__content) {
  1306. height: 40px;
  1307. & > .el-tree-node__expand-icon {
  1308. margin-left: 10px;
  1309. }
  1310. }
  1311. .el-dropdown-link {
  1312. cursor: pointer;
  1313. color: var(--color-primary-5);
  1314. }
  1315. .el-icon-arrow-down {
  1316. font-size: 12px;
  1317. }
  1318. :deep(.el-badge__content.is-fixed) {
  1319. top: 4px;
  1320. }
  1321. /* 优化输入框在表格中的样式 */
  1322. :deep(.el-table .el-input__inner) {
  1323. border-radius: 4px;
  1324. height: 28px;
  1325. line-height: 28px;
  1326. }
  1327. :deep(.el-table .el-input) {
  1328. margin: 0;
  1329. }
  1330. </style>