index.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  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-if="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. <ele-pro-table
  38. ref="table"
  39. :columns="columns"
  40. :datasource="datasource"
  41. height="calc(100vh - 400px)"
  42. style="margin-bottom: 10px"
  43. full-height="calc(100vh - 116px)"
  44. tool-class="ele-toolbar-form"
  45. :selection.sync="selection"
  46. :page-size="20"
  47. @columns-change="handleColumnChange"
  48. :cache-key="cacheKeyUrl"
  49. >
  50. <!-- 表头工具栏 -->
  51. <template v-slot:toolbar>
  52. <el-button
  53. size="small"
  54. type="primary"
  55. icon="el-icon-plus"
  56. class="ele-btn-icon"
  57. @click="openEdit('add', {})"
  58. v-if="$hasPermission('eom:saleorder:save')"
  59. >
  60. 新建
  61. </el-button>
  62. <el-button
  63. size="small"
  64. type="danger"
  65. el-icon-delete
  66. class="ele-btn-icon"
  67. @click="allDelBtn"
  68. v-if="$hasPermission('eom:saleorder:delete')"
  69. :disabled="selection?.length === 0"
  70. >
  71. 批量删除
  72. </el-button>
  73. <el-button
  74. size="small"
  75. type="primary"
  76. icon="el-icon-plus"
  77. class="ele-btn-icon"
  78. @click="invoiceAll"
  79. v-if="$hasPermission('eom:saleManage:invoiceAll')"
  80. :disabled="selection?.length === 0"
  81. >
  82. 批量发货
  83. </el-button>
  84. <el-button
  85. type="primary"
  86. size="small"
  87. icon="el-icon-upload2"
  88. @click="uploadFile"
  89. v-if="$hasPermission('eom:saleorder:save')"
  90. >导入</el-button
  91. >
  92. <exportButton
  93. fileName="销售订单"
  94. apiUrl="/eom/saleorder/export"
  95. :params="params"
  96. ></exportButton>
  97. <el-button
  98. :disabled="selection?.length === 0"
  99. type="primary"
  100. size="small"
  101. icon="el-icon-printer"
  102. @click="handlePrint()"
  103. v-if="$hasPermission('eom:saleorder:print')"
  104. >打印</el-button
  105. >
  106. </template>
  107. <!-- 查看详情列 -->
  108. <template v-slot:relationCode="{ row }">
  109. <el-link
  110. type="primary"
  111. :underline="false"
  112. @click="openRelationCodeDetail(row)"
  113. >
  114. {{ row.relationCode }}
  115. </el-link>
  116. </template>
  117. <template v-slot:orderNo="{ row }">
  118. <el-link
  119. type="primary"
  120. :underline="false"
  121. @click="openorderDetail(row)"
  122. >
  123. {{ row.orderNo }}
  124. </el-link>
  125. </template>
  126. <!-- 操作列 -->
  127. <template v-slot:action="{ row }">
  128. <el-link
  129. type="primary"
  130. :underline="false"
  131. icon="el-icon-edit"
  132. @click="openEdit('edit', row)"
  133. v-if="
  134. $hasPermission('eom:saleorder:update') &&
  135. [0, 3].includes(row.orderStatus)
  136. "
  137. >
  138. 修改
  139. </el-link>
  140. <el-link
  141. type="primary"
  142. :underline="false"
  143. icon="el-icon-plus"
  144. @click="saleOrderSubmitOrGenerate(row)"
  145. v-if="
  146. [0, 3].includes(row.orderStatus) &&
  147. $hasPermission('eom:saleorder:update')
  148. "
  149. >
  150. 提交
  151. </el-link>
  152. <!-- <el-link
  153. type="primary"
  154. :underline="false"
  155. icon="el-icon-plus"
  156. @click="handleAutoGenerate(row.id)"
  157. v-if="
  158. [2].includes(row.orderStatus) &&
  159. row.needProduce &&
  160. !!!row.purchasePlanNum
  161. "
  162. >
  163. 生成采购计划
  164. </el-link> -->
  165. <el-popconfirm
  166. class="ele-action"
  167. title="确定要删除此信息吗?"
  168. @confirm="remove([row.id])"
  169. v-if="
  170. [0, 3].includes(row.orderStatus) &&
  171. $hasPermission('eom:saleorder:delete')
  172. "
  173. >
  174. <template v-slot:reference>
  175. <el-link
  176. type="danger"
  177. :underline="false"
  178. icon="el-icon-delete"
  179. >
  180. 删除
  181. </el-link>
  182. </template>
  183. </el-popconfirm>
  184. <el-link
  185. type="primary"
  186. :underline="false"
  187. icon="el-icon-plus"
  188. @click="handleCommand('invoice', row)"
  189. v-if="
  190. [2].includes(row.orderStatus) &&
  191. ((row.saleTypeName.includes('受托') &&
  192. row.isEntrustedReceive == 1) ||
  193. !row.saleTypeName.includes('受托')) &&
  194. row.needProduce != 2 &&
  195. $hasPermission('eom:saleordersendrecord:save') &&
  196. ((isTotalCount == '1' &&
  197. ![800, 1000].includes(row.progress)) ||
  198. isTotalCount == 0)
  199. "
  200. >
  201. 创建发货单
  202. </el-link>
  203. <el-link
  204. type="primary"
  205. :underline="false"
  206. icon="el-icon-plus"
  207. @click="handleCommand('entrustedReceive', row)"
  208. v-if="
  209. [2].includes(row.orderStatus) &&
  210. row.saleTypeName.includes('受托') &&
  211. row.isEntrustedReceive != 1
  212. "
  213. >
  214. 受托收货单
  215. </el-link>
  216. <el-link
  217. type="primary"
  218. :underline="false"
  219. icon="el-icon-plus"
  220. @click="handleCommand('saleOrderReminder', row)"
  221. v-if="
  222. [2].includes(row.orderStatus) &&
  223. clientEnvironmentId != 5 &&
  224. row.progress < 800
  225. "
  226. >
  227. 催单
  228. </el-link>
  229. <el-link
  230. type="primary"
  231. :underline="false"
  232. icon="el-icon-plus"
  233. @click="handleCommand('invoiceManage', row)"
  234. v-if="
  235. [2].includes(row.orderStatus) &&
  236. !row.hasInvoiceApply &&
  237. $hasPermission('eom:fininvoiceapply:save')
  238. "
  239. >
  240. 新增发票
  241. </el-link>
  242. </template>
  243. </ele-pro-table>
  244. </div>
  245. </div>
  246. <div v-if="activeComp == 'invoice'">
  247. <invoice @getToDoReminder="getToDoReminder"></invoice>
  248. </div>
  249. <div v-if="activeComp == 'invoiceConfirm'">
  250. <invoice-confirm @getToDoReminder="getToDoReminder"></invoice-confirm>
  251. </div>
  252. <div v-if="activeComp == 'entrustedReceive'">
  253. <entrustedReceive
  254. @getToDoReminder="getToDoReminder"
  255. ></entrustedReceive>
  256. </div>
  257. <div v-if="activeComp == 'returnorder'" class="returnorder">
  258. <return-goods @getToDoReminder="getToDoReminder"></return-goods>
  259. </div>
  260. <div v-if="activeComp == 'accountstatement'">
  261. <accountstatement
  262. @getToDoReminder="getToDoReminder"
  263. ></accountstatement>
  264. </div>
  265. <div v-if="activeComp == 'customerReturnOrder'">
  266. <customerReturnOrder
  267. @getToDoReminder="getToDoReminder"
  268. ></customerReturnOrder>
  269. </div>
  270. <div v-if="activeComp == 'exceptionList'">
  271. <exceptionList @getToDoReminder="getToDoReminder"></exceptionList>
  272. </div>
  273. <div v-if="activeComp == 'trayList'">
  274. <palletManagement
  275. @getToDoReminder="getToDoReminder"
  276. ></palletManagement>
  277. </div>
  278. </div>
  279. </el-card>
  280. <add-dialog
  281. :isRequired="isRequired"
  282. ref="addDialogRef"
  283. @done="reload"
  284. :contactData="contactData"
  285. ></add-dialog>
  286. <add-invoice-dialog
  287. ref="invoiceDialogRef"
  288. @done="reload"
  289. :contactData="contactData"
  290. ></add-invoice-dialog>
  291. <add-return-goods-dialog
  292. ref="addReturnGoodsRef"
  293. :contactData="contactData"
  294. @done="reload"
  295. ></add-return-goods-dialog>
  296. <contractr-detail ref="contractDetailRef"></contractr-detail>
  297. <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
  298. <autogenerate-dialog
  299. ref="autogenerateDialogRef"
  300. @handleSubmit="saleOrderSubmit"
  301. @reload="reload"
  302. ></autogenerate-dialog>
  303. <!-- 多选删除弹窗 -->
  304. <pop-modal
  305. :visible.sync="delVisible"
  306. content="是否确定删除?"
  307. @done="commitBtn"
  308. />
  309. <drawer ref="drawerRef"></drawer>
  310. <process-submit-dialog
  311. :isNotNeedProcess="false"
  312. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  313. v-if="processSubmitDialogFlag"
  314. ref="processSubmitDialogRef"
  315. @reload="reload"
  316. :callBack="callBack"
  317. ></process-submit-dialog>
  318. <addInvoiceManage
  319. :add-or-edit-dialog-flag.sync="addOrEditDialogFlag1"
  320. ref="addOrEditDialogRef"
  321. v-if="addOrEditDialogFlag1"
  322. @reload="reload"
  323. ></addInvoiceManage>
  324. <importDialog
  325. ref="importDialogRef"
  326. @success="reload"
  327. :fileUrl="'/eom/saleorder/importTemplate'"
  328. :isWeb="false"
  329. fileName="销售订单导入模板"
  330. apiUrl="/eom/saleorder/importFile"
  331. />
  332. <bomDialog ref="bomDialogRef" @handleSubmit="bomDialogSuccess"></bomDialog>
  333. <opportunityDetail ref="opportunityDetailRef"></opportunityDetail>
  334. <quotationDetail ref="quotationDetailRef"></quotationDetail>
  335. <addEntrustedReceive
  336. ref="addEntrustedReceiveRef"
  337. @done="reload"
  338. :add-or-edit-dialog-flag.sync="addEntrustedReceiveFlag"
  339. v-if="addEntrustedReceiveFlag"
  340. ></addEntrustedReceive>
  341. <printTemplateSaleOrder :groupName="groupName" ref="printTemplateSaleOrderRef"></printTemplateSaleOrder>
  342. </div>
  343. </template>
  344. <script>
  345. import searchTable from './components/searchTable.vue';
  346. import addDialog from './components/addDialog.vue';
  347. import invoice from './invoice/index.vue';
  348. import invoiceConfirm from './invoiceConfirm/index.vue';
  349. import detailDialog from './components/detailDialog.vue';
  350. import exceptionList from './exceptionManagement/exceptionList';
  351. import bomDialog from './components/bomDialog';
  352. import drawer from './components/drawer.vue';
  353. import contractrDetail from '@/views/contractManage/contractBook/components/detailDialog.vue';
  354. import addInvoiceDialog from '@/views/saleManage/saleOrder/invoice/components/addInvoiceDialog';
  355. import addReturnGoodsDialog from '@/views/saleManage/saleOrder/returnGoods/components/addReturnGoodsDialog';
  356. import popModal from '@/components/pop-modal';
  357. import accountstatement from './accountstatement/index.vue';
  358. import customerReturnOrder from './customerReturnOrder/index.vue';
  359. import returnGoods from './returnGoods/index.vue';
  360. import palletManagement from './palletManagement/index.vue';
  361. import addInvoiceManage from '@/views/financialManage/invoiceManage/components/addOrEditDialog.vue';
  362. import addEntrustedReceive from '@/views/saleManage/saleOrder/entrustedReceive/components/addOrEditDialog';
  363. import {
  364. deleteInformation,
  365. getSaleOrderDetail,
  366. getTableList,
  367. saleOrderReminder,
  368. getByRepeatBomAttribute,
  369. saveOrderBomList
  370. } from '@/api/saleManage/saleorder';
  371. import { getToDoReminder } from '@/api/common/index';
  372. import { exportSaleorder } from '@/api/system/file/index.js';
  373. import dictMixins from '@/mixins/dictMixins';
  374. import { reviewStatus, saleOrderProgressStatusEnum } from '@/enum/dict';
  375. import entrustedReceive from '@/views/saleManage/saleOrder/entrustedReceive/index.vue';
  376. import autogenerateDialog from '@/BIZComponents/autogenerateDialog.vue';
  377. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  378. import tabMixins from '@/mixins/tableColumnsMixin';
  379. import importDialog from '@/components/upload/import-dialog.vue';
  380. import exportButton from '@/components/upload/exportButton.vue';
  381. import { parameterGetByCode } from '@/api/main/index.js';
  382. import opportunityDetail from '@/views/saleManage/businessOpportunity/components/opportunityDetailDialog.vue';
  383. import quotationDetail from '@/views/saleManage/quotation/components/detailDialog.vue';
  384. import printTemplateSaleOrder from './components/printTemplateSaleOrder.vue'
  385. import { enterprisePage } from '@/api/contractManage/contractBook';
  386. export default {
  387. mixins: [dictMixins, tabMixins],
  388. components: {
  389. processSubmitDialog,
  390. autogenerateDialog,
  391. searchTable,
  392. returnGoods,
  393. accountstatement,
  394. popModal,
  395. contractrDetail,
  396. addReturnGoodsDialog,
  397. addInvoiceDialog,
  398. invoice,
  399. addDialog,
  400. detailDialog,
  401. customerReturnOrder,
  402. entrustedReceive,
  403. invoiceConfirm,
  404. drawer,
  405. exceptionList,
  406. addInvoiceManage,
  407. palletManagement,
  408. exportButton,
  409. importDialog,
  410. bomDialog,
  411. opportunityDetail,
  412. quotationDetail,
  413. addEntrustedReceive,
  414. printTemplateSaleOrder
  415. },
  416. //客户管理数据
  417. props: {
  418. contactData: {
  419. type: Object,
  420. default: () => {
  421. return {};
  422. }
  423. }
  424. },
  425. data() {
  426. return {
  427. activeName: 'all',
  428. activeComp: 'saleorder',
  429. tabOptions: [
  430. { key: 'saleorder', name: '销售订单', reminder: 'salesOrderNum' },
  431. {
  432. key: 'entrustedReceive',
  433. name: '受托收货单',
  434. reminder: 'entrustedReceiptNum'
  435. },
  436. { key: 'invoice', name: '发货单', reminder: 'deliveryNoteNum' },
  437. {
  438. key: 'invoiceConfirm',
  439. name: '发货确认单',
  440. reminder: 'deliveryConfirmationFormNum'
  441. },
  442. { key: 'trayList', name: '托盘清单' },
  443. {
  444. key: 'exceptionList',
  445. name: '异常列表',
  446. reminder: 'exceptionListNum'
  447. },
  448. { key: 'returnorder', name: '退货单', reminder: 'returnOrderNum' },
  449. {
  450. key: 'customerReturnOrder',
  451. name: '退货处理单',
  452. reminder: 'returnProcessingFormNum'
  453. },
  454. {
  455. key: 'accountstatement',
  456. name: '对账单',
  457. reminder: 'statementAccountNum'
  458. }
  459. ],
  460. selection: [], //单选中集合
  461. delVisible: false, //批量删除弹框状态
  462. loading: false, // 加载状态
  463. processSubmitDialogFlag: false, // 加载状态
  464. addOrEditDialogFlag1: false,
  465. addEntrustedReceiveFlag: false,
  466. params: {},
  467. tableList: [],
  468. current: null,
  469. cacheKeyUrl: 'eos-c2e9664a-saleManage-saleOrder',
  470. isRequired: true,
  471. isTotalCount: '0',
  472. columnsVersion: 1,
  473. timeR: null,
  474. toDoReminder: {},
  475. groupName: ''
  476. };
  477. },
  478. created() {
  479. enterprisePage({
  480. pageNum: 1,
  481. size: 200
  482. }).then((res) => {
  483. if (res.list?.length > 0) {
  484. this.groupName = res.list[0].name;
  485. }
  486. });
  487. this.requestDict('客户状态');
  488. parameterGetByCode({
  489. code: 'order_person_info'
  490. }).then((res) => {
  491. if (res.value) {
  492. this.isRequired = res.value === '1';
  493. }
  494. });
  495. //销售发货数量是否限制不能大于采购总数//0否 1是
  496. parameterGetByCode({
  497. code: 'saleOrder_invoice_productList_totalCount'
  498. }).then((res) => {
  499. this.isTotalCount = res.value;
  500. });
  501. this.getToDoReminder();
  502. this.timeR = setInterval(() => {
  503. this.getToDoReminder();
  504. }, 60000);
  505. // if (!('Notification' in window)) {
  506. // console.log('此浏览器不支持桌面通知');
  507. // } else if (Notification.permission === 'granted') {
  508. // // 如果用户已经授权,直接创建通知
  509. // var notification = new Notification('标题', {
  510. // body: '这是通知的内容。'
  511. // });
  512. // } else if (Notification.permission !== 'denied') {
  513. // // 请求权限
  514. // Notification.requestPermission().then(function (permission) {
  515. // if (permission === 'granted') {
  516. // var notification = new Notification('标题', {
  517. // body: '消息提醒1'
  518. // });
  519. // }
  520. // });
  521. // }
  522. },
  523. beforeDestroy() {
  524. clearInterval(this.timeR);
  525. },
  526. computed: {
  527. clientEnvironmentId() {
  528. return this.$store.state.user.info.clientEnvironmentId;
  529. },
  530. columns() {
  531. let columnsVersion = this.columnsVersion;
  532. return [
  533. {
  534. width: 45,
  535. type: 'selection',
  536. columnKey: 'selection',
  537. align: 'center'
  538. },
  539. {
  540. columnKey: 'index',
  541. label: '序号',
  542. type: 'index',
  543. width: 55,
  544. align: 'center',
  545. showOverflowTooltip: true,
  546. fixed: 'left'
  547. },
  548. {
  549. prop: 'orderNo',
  550. label: '订单编码',
  551. align: 'center',
  552. slot: 'orderNo',
  553. showOverflowTooltip: true,
  554. sortable: true,
  555. minWidth: 200,
  556. fixed: 'left'
  557. },
  558. {
  559. prop: 'needProduce',
  560. label: '订单类型',
  561. align: 'center',
  562. showOverflowTooltip: true,
  563. minWidth: 150,
  564. formatter: (_row, _column, cellValue) => {
  565. let businessType =
  566. cellValue == 1
  567. ? '有客户生产性订单'
  568. : cellValue == 2
  569. ? '无客户生产性订单'
  570. : cellValue == 4
  571. ? '不定向订单'
  572. : '库存式订单';
  573. return businessType;
  574. }
  575. },
  576. {
  577. prop: 'preOrderNo',
  578. label: '预销售订单编码',
  579. align: 'center',
  580. showOverflowTooltip: true,
  581. sortable: true,
  582. minWidth: 200,
  583. fixed: 'left'
  584. },
  585. {
  586. prop: 'relationType',
  587. label: '来源类型',
  588. align: 'center',
  589. showOverflowTooltip: true,
  590. minWidth: 150,
  591. formatter: (_row, _column, cellValue) => {
  592. let businessType =
  593. cellValue == 1
  594. ? '商机'
  595. : cellValue == 2
  596. ? '报价'
  597. : cellValue == 3
  598. ? '销售合同'
  599. : cellValue == 4
  600. ? '项目'
  601. : '';
  602. return businessType;
  603. }
  604. },
  605. {
  606. prop: 'relationCode',
  607. label: '来源单据',
  608. align: 'center',
  609. slot: 'relationCode',
  610. showOverflowTooltip: true,
  611. minWidth: 200,
  612. formatter: (_row, _column, cellValue) => {
  613. return _row.relationCode;
  614. }
  615. },
  616. {
  617. prop: 'progress',
  618. label: '订单进度',
  619. align: 'center',
  620. showOverflowTooltip: true,
  621. formatter: (_row, _column, cellValue) => {
  622. return saleOrderProgressStatusEnum.find(
  623. (val) => val.value == _row.progress
  624. )?.label;
  625. },
  626. minWidth: 120
  627. },
  628. // {
  629. // prop: 'deliveryDate',
  630. // label: '交货日期',
  631. // align: 'center',
  632. // showOverflowTooltip: true,
  633. // minWidth: 200
  634. // },
  635. {
  636. prop: 'productNames',
  637. label: '产品名称',
  638. align: 'center',
  639. showOverflowTooltip: true,
  640. minWidth: 140
  641. },
  642. {
  643. prop: 'productCodes',
  644. label: '编码',
  645. align: 'center',
  646. showOverflowTooltip: true,
  647. minWidth: 140
  648. },
  649. {
  650. minWidth: 160,
  651. prop: 'productionCodes',
  652. label: '生产编号',
  653. align: 'center'
  654. },
  655. {
  656. prop: 'batchNos',
  657. label: '批次号',
  658. align: 'center',
  659. showOverflowTooltip: true,
  660. minWidth: 140
  661. },
  662. {
  663. prop: 'productCount',
  664. label: '数量',
  665. align: 'center',
  666. showOverflowTooltip: true,
  667. minWidth: 140
  668. },
  669. {
  670. prop: 'inventoryQuantity',
  671. label: '库存数',
  672. align: 'center',
  673. showOverflowTooltip: true,
  674. minWidth: 140
  675. },
  676. {
  677. prop: 'sendTotalCount',
  678. label: '发货数量',
  679. align: 'center',
  680. showOverflowTooltip: true,
  681. minWidth: 140
  682. },
  683. {
  684. prop: 'inventoryQuantity',
  685. label: '库存状态',
  686. align: 'center',
  687. showOverflowTooltip: true,
  688. minWidth: 140,
  689. formatter: (_row, _column, cellValue) => {
  690. return _row.inventoryQuantity > 0 ? '有库存' : '无库存';
  691. }
  692. },
  693. {
  694. prop: 'saleTypeName',
  695. label: '销售类型',
  696. align: 'center',
  697. showOverflowTooltip: true,
  698. minWidth: 140
  699. },
  700. {
  701. prop: 'projectName',
  702. label: '项目名称',
  703. align: 'center',
  704. showOverflowTooltip: true,
  705. minWidth: 180
  706. },
  707. {
  708. prop: 'partaName',
  709. label: '客户名称',
  710. align: 'center',
  711. showOverflowTooltip: true,
  712. minWidth: 180
  713. },
  714. {
  715. prop: 'partaLinkName',
  716. label: '客户联系人',
  717. align: 'center',
  718. showOverflowTooltip: true,
  719. minWidth: 130
  720. },
  721. {
  722. prop: 'partaTel',
  723. label: '客户联系电话',
  724. align: 'center',
  725. showOverflowTooltip: true,
  726. minWidth: 130
  727. },
  728. {
  729. prop: 'partbName',
  730. label: '售出方名称',
  731. align: 'center',
  732. showOverflowTooltip: true,
  733. minWidth: 130
  734. },
  735. {
  736. prop: 'partbLinkName',
  737. label: '售出方联系人',
  738. align: 'center',
  739. showOverflowTooltip: true,
  740. minWidth: 130
  741. },
  742. {
  743. prop: 'partbTel',
  744. label: '售出方联系电话',
  745. align: 'center',
  746. showOverflowTooltip: true,
  747. minWidth: 130
  748. },
  749. {
  750. prop: 'payAmount',
  751. label: '金额(元)',
  752. align: 'center',
  753. showOverflowTooltip: true,
  754. minWidth: 170
  755. },
  756. {
  757. prop: 'arrivalWays',
  758. label: '到货方式',
  759. align: 'center',
  760. showOverflowTooltip: true,
  761. minWidth: 170,
  762. formatter: (_row, _column, cellValue) => {
  763. return _row.arrivalWays
  764. ? _row.arrivalWays
  765. .split(',')
  766. .map((val) => {
  767. return val == 1
  768. ? '一次性到货'
  769. : val == 2
  770. ? '分批到货'
  771. : '';
  772. })
  773. .toString()
  774. : '';
  775. }
  776. },
  777. {
  778. prop: 'orderStatus',
  779. label: '审核状态',
  780. align: 'center',
  781. showOverflowTooltip: true,
  782. minWidth: 100,
  783. formatter: (_row, _column, cellValue) => {
  784. return reviewStatus[_row.orderStatus];
  785. }
  786. },
  787. {
  788. prop: 'createUserName',
  789. label: '创建人',
  790. align: 'center',
  791. showOverflowTooltip: true,
  792. minWidth: 80
  793. },
  794. {
  795. prop: 'createTime',
  796. label: '创建时间',
  797. align: 'center',
  798. showOverflowTooltip: true,
  799. minWidth: 170
  800. },
  801. {
  802. columnKey: 'action',
  803. label: '操作',
  804. width: 280,
  805. align: 'center',
  806. resizable: false,
  807. slot: 'action',
  808. showOverflowTooltip: true,
  809. fixed: 'right'
  810. }
  811. ];
  812. }
  813. },
  814. methods: {
  815. getToDoReminder() {
  816. getToDoReminder().then((res) => {
  817. this.toDoReminder = res;
  818. });
  819. },
  820. //更多菜单
  821. handleCommand(command, row) {
  822. if (command === 'invoice') {
  823. this.$refs.invoiceDialogRef.open('add', {}, [row.id]);
  824. }
  825. if (command === 'entrustedReceive') {
  826. this.addEntrustedReceiveFlag = true;
  827. this.$nextTick(() => {
  828. this.$refs.addEntrustedReceiveRef.open('add', {}, row.id);
  829. });
  830. }
  831. if (command === 'returnOrder') {
  832. this.$refs.addReturnGoodsRef.open('add', {});
  833. }
  834. if (command === 'saleOrderReminder') {
  835. saleOrderReminder(row.id).then((res) => {
  836. this.$message.success('催单成功');
  837. });
  838. }
  839. if (command === 'invoiceManage') {
  840. this.addOrEditDialogFlag1 = true;
  841. this.$nextTick(() => {
  842. this.$refs.addOrEditDialogRef.createInvoice1(row, 1, 3);
  843. });
  844. }
  845. },
  846. invoiceAll() {
  847. let partaIds = this.selection.map((item) => item.partaId);
  848. if (new Set(partaIds).size != 1) {
  849. return this.$message.warning('请选择相同客户的订单!');
  850. }
  851. let saleTypeS = this.selection.map((item) => item.saleType);
  852. if (new Set(saleTypeS).size != 1) {
  853. return this.$message.warning('请选择相同销售类型的订单!');
  854. }
  855. let processObj = this.selection.filter((item) => item.progress == 800);
  856. if (processObj?.length && this.isTotalCount == '1') {
  857. return this.$message.warning(
  858. '订单' +
  859. processObj.map((item) => item.orderNo).toString() +
  860. '已全部发货,不能创建发货单'
  861. );
  862. }
  863. if (
  864. this.selection.filter((item) => item.needProduce == 4)?.length &&
  865. this.selection.filter((item) => item.needProduce == 4)?.length !=
  866. this.selection.length
  867. ) {
  868. return this.$message.warning(
  869. '不定向订单不能与其它类型的订单一起创建发货单!'
  870. );
  871. }
  872. this.$refs.invoiceDialogRef.open(
  873. 'add',
  874. {},
  875. this.selection.map((item) => item.id)
  876. );
  877. },
  878. //点击左边分类
  879. handleNodeClick(data, node) {
  880. // this.curNodeData = data;
  881. this.reload({ categoryId: data.id });
  882. },
  883. /* 表格数据源 */
  884. datasource({ page, limit, where, order }) {
  885. if (this.contactData.id) {
  886. where['contactId'] = this.contactData.id;
  887. }
  888. this.params = {
  889. pageNum: page,
  890. size: limit,
  891. ...where,
  892. progress: this.activeName == 'all' ? '' : this.activeName
  893. };
  894. return getTableList(this.params);
  895. },
  896. /* 刷新表格 */
  897. reload(where) {
  898. this.$refs.table.reload({ page: 1, where });
  899. this.getToDoReminder();
  900. },
  901. handleClick() {
  902. this.activeName;
  903. this.$refs.table.reload({
  904. page: 1,
  905. where: { progress: this.activeName == 'all' ? '' : this.activeName }
  906. });
  907. },
  908. //新增编辑
  909. openEdit(type, row) {
  910. this.$refs.addDialogRef.open(type, row, row.id);
  911. this.$refs.addDialogRef.$refs.form &&
  912. this.$refs.addDialogRef.$refs.form.clearValidate();
  913. },
  914. //批量删除
  915. allDelBtn() {
  916. if (this.selection.length === 0) return;
  917. let flag = this.selection.some((item) =>
  918. [1, 2].includes(item.orderStatus)
  919. );
  920. if (flag)
  921. return this.$message.warning(
  922. '抱歉已审核、审核中的数据不能删除,请检查'
  923. );
  924. this.delVisible = true;
  925. },
  926. //删除接口
  927. remove(delData) {
  928. deleteInformation(delData).then((res) => {
  929. this.$message.success('删除成功!');
  930. this.reload();
  931. });
  932. },
  933. //删除弹框确定
  934. commitBtn() {
  935. const dataId = this.selection.map((v) => v.id);
  936. this.remove(dataId);
  937. },
  938. //查看详情
  939. openorderDetail(row) {
  940. this.$refs.drawerRef.open(row);
  941. },
  942. async saleOrderSubmit(id) {
  943. this.$refs.addDialogRef && this.$refs.addDialogRef.cancel();
  944. // const data = await getSaleOrderDetail(id);
  945. this.processSubmitDialogFlag = true;
  946. let businessType =
  947. this.current.needProduce == 1
  948. ? '有客户生产性订单'
  949. : this.current.needProduce == 2
  950. ? '无客户生产性订单'
  951. : this.current.needProduce == 4
  952. ? '不定向订单'
  953. : '库存式订单';
  954. this.$nextTick(() => {
  955. let params = {
  956. businessId: this.current.id,
  957. businessKey: 'sales_order_approve',
  958. formCreateUserId: this.current.createUserId,
  959. variables: {
  960. businessCode: this.current.orderNo,
  961. businessName: this.current.partaName,
  962. businessType: businessType
  963. }
  964. };
  965. this.$refs.processSubmitDialogRef.init(params);
  966. });
  967. },
  968. async callBack() {
  969. if (!this.current.generatePurchase && !this.current.generateProduce) {
  970. return 0;
  971. }
  972. const code = saveOrderBomList({
  973. categoryDTOList: this.tableList || [],
  974. orderId: this.current.id
  975. });
  976. return code;
  977. },
  978. async saleOrderSubmitOrGenerate(res) {
  979. this.tableList = [];
  980. this.current = await getSaleOrderDetail(res.id);
  981. if (!this.current.generatePurchase && !this.current.generateProduce) {
  982. this.saleOrderSubmit(res.id);
  983. } else {
  984. const data = await getByRepeatBomAttribute(res.id);
  985. if (data && data.length) {
  986. this.$refs.bomDialogRef.open(data);
  987. return;
  988. }
  989. this.saleOrderSubmit(res.id);
  990. }
  991. },
  992. bomDialogSuccess(tableList) {
  993. this.tableList = tableList;
  994. // this.callBack()
  995. this.saleOrderSubmit(this.current.id);
  996. },
  997. //生成
  998. handleAutoGenerate(id, isAuto = false) {
  999. this.$refs.autogenerateDialogRef.init(id, isAuto);
  1000. },
  1001. //查看来源详情
  1002. openRelationCodeDetail(row) {
  1003. let data = {
  1004. id: row.relationId
  1005. };
  1006. if (row.relationType == 1) {
  1007. this.$refs.opportunityDetailRef.open(data);
  1008. }
  1009. if (row.relationType == 2) {
  1010. this.$refs.quotationDetailRef.open(data);
  1011. }
  1012. if (row.relationType == 3) {
  1013. this.$refs.contractDetailRef.open(data);
  1014. }
  1015. },
  1016. uploadFile() {
  1017. this.$refs.importDialogRef.open();
  1018. },
  1019. exportFn() {
  1020. console.log(this.params);
  1021. exportSaleorder(this.params);
  1022. },
  1023. handlePrint() {
  1024. console.log(this.selection[0]);
  1025. if (this.selection.length > 1)
  1026. return this.$message.warning('请选择一条');
  1027. this.$refs.printTemplateSaleOrderRef.open(this.selection[0].id);
  1028. }
  1029. }
  1030. };
  1031. </script>
  1032. <style lang="scss" scoped>
  1033. :deep .el-card__body {
  1034. padding: 0;
  1035. }
  1036. :deep(.el-link--inner) {
  1037. margin-left: 0px !important;
  1038. }
  1039. .sys-organization-list {
  1040. height: calc(100vh - 264px);
  1041. box-sizing: border-box;
  1042. border-width: 1px;
  1043. border-style: solid;
  1044. overflow: auto;
  1045. }
  1046. .sys-organization-list :deep(.el-tree-node__content) {
  1047. height: 40px;
  1048. & > .el-tree-node__expand-icon {
  1049. margin-left: 10px;
  1050. }
  1051. }
  1052. .el-dropdown-link {
  1053. cursor: pointer;
  1054. color: var(--color-primary-5);
  1055. }
  1056. .el-icon-arrow-down {
  1057. font-size: 12px;
  1058. }
  1059. :deep(.el-badge__content.is-fixed) {
  1060. top: 4px;
  1061. }
  1062. </style>