index.vue 37 KB

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