index.vue 42 KB

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