index.vue 34 KB

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