index.vue 29 KB

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