index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. <template>
  2. <div class="ele-body" style="width: 100%">
  3. <el-card shadow="never" v-loading="loading" style="width: 100%">
  4. <div class="ele-border-lighter form-content" v-loading="loading">
  5. <search-table @search="reload"></search-table>
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. height="calc(100vh - 410px)"
  12. style="margin-bottom: 10px"
  13. full-height="calc(100vh - 116px)"
  14. tool-class="ele-toolbar-form"
  15. :selection.sync="selection"
  16. :page-size="20"
  17. @columns-change="handleColumnChange"
  18. :cache-key="cacheKeyUrl"
  19. >
  20. <!-- 表头工具栏 -->
  21. <template v-slot:toolbar>
  22. <el-button
  23. size="small"
  24. type="primary"
  25. icon="el-icon-plus"
  26. class="ele-btn-icon"
  27. @click="openEdit('add', {})"
  28. v-if="
  29. !saleOrderData.id ||
  30. (saleOrderData.id && saleOrderData.orderStatus == 2)
  31. "
  32. >
  33. 新建
  34. </el-button>
  35. <el-button
  36. size="small"
  37. type="danger"
  38. class="el-icon-delete"
  39. @click="allDelBtn"
  40. :disabled="selection?.length === 0"
  41. >
  42. 批量删除
  43. </el-button>
  44. <el-dropdown trigger="click" :disabled="selection?.length === 0">
  45. <el-button type="primary" class="el-icon-printer" size="small">
  46. 打印<i class="el-icon-arrow-down el-icon--right"></i>
  47. </el-button>
  48. <el-dropdown-menu slot="dropdown">
  49. <el-dropdown-item
  50. @click.native="handlePrint('printTemplateByRef')"
  51. v-if="$hasPermission('eom:print-invoice1')"
  52. >发货单</el-dropdown-item
  53. >
  54. <el-dropdown-item
  55. v-if="$hasPermission('eom:print-invoice2')"
  56. @click.native="handlePrint('printTemplateJsRef')"
  57. >器械出库单</el-dropdown-item
  58. >
  59. <el-dropdown-item
  60. v-if="$hasPermission('eom:print-invoice3')"
  61. @click.native="handlePrint('printTemplateJsYpRef')"
  62. >药品出库单</el-dropdown-item
  63. >
  64. <el-dropdown-item
  65. v-if="$hasPermission('eom:print-invoice4')"
  66. @click.native="handlePrint('printTemplateWlRef')"
  67. >送货单模板</el-dropdown-item
  68. >
  69. <el-dropdown-item
  70. v-if="$hasPermission('eom:print-invoice5')"
  71. @click.native="handlePrint('printTemplateBSRef')"
  72. >送货单模板</el-dropdown-item
  73. >
  74. <el-dropdown-item
  75. v-if="$hasPermission('eom:print-invoice6')"
  76. @click.native="handlePrint('printTemplateHtRef')"
  77. >货物签收单</el-dropdown-item
  78. >
  79. <el-dropdown-item
  80. v-if="$hasPermission('eom:print-invoice7')"
  81. @click.native="handlePrint('printTemplateJrRef')"
  82. >发货单</el-dropdown-item
  83. >
  84. </el-dropdown-menu>
  85. </el-dropdown>
  86. <exportButton
  87. btnName="列表导出"
  88. fileName="销售发货单"
  89. apiUrl="/eom/saleordersendrecord/export"
  90. :params="params"
  91. ></exportButton>
  92. </template>
  93. <!-- 查看详情列 -->
  94. <template v-slot:docNo="{ row }">
  95. <el-link
  96. type="primary"
  97. :underline="false"
  98. @click="openorderDetail(row, 'docNo')"
  99. >
  100. {{ row.docNo }}
  101. </el-link>
  102. </template>
  103. <template v-slot:orderNo="{ row }">
  104. <el-link
  105. type="primary"
  106. :underline="false"
  107. v-for="(v, j) in row.orderNo.split(',')"
  108. :key="v"
  109. @click="openorderDetail(row, 'orderNo', j)"
  110. >
  111. {{ v }}
  112. <span v-if="j != row.orderNo.split(',').length - 1">,</span>
  113. </el-link>
  114. </template>
  115. <!-- 操作列 -->
  116. <template v-slot:action="{ row }">
  117. <el-link
  118. type="primary"
  119. :underline="false"
  120. icon="el-icon-edit"
  121. @click="openEdit('edit', row)"
  122. v-if="
  123. ([0, 3].includes(row.reviewStatus) &&
  124. isNeed_process_is_close) ||
  125. !isNeed_process_is_close
  126. "
  127. >
  128. 修改
  129. </el-link>
  130. <el-link
  131. type="primary"
  132. :underline="false"
  133. icon="el-icon-plus"
  134. @click="sendSubmit(row)"
  135. v-if="
  136. isNeed_process_is_close && [0, 3].includes(row.reviewStatus)
  137. "
  138. >
  139. 提交
  140. </el-link>
  141. <el-link
  142. type="primary"
  143. :underline="false"
  144. icon="el-icon-plus"
  145. @click="exportFile(row)"
  146. v-if="[2].includes(row.reviewStatus)"
  147. >
  148. 导出
  149. </el-link>
  150. <el-popconfirm
  151. class="ele-action"
  152. title="确定要删除此信息吗?"
  153. @confirm="remove([row.id])"
  154. v-if="
  155. (isNeed_process_is_close &&
  156. [0, 3].includes(row.reviewStatus)) ||
  157. !isNeed_process_is_close
  158. "
  159. >
  160. <template v-slot:reference>
  161. <el-link type="danger" :underline="false" icon="el-icon-delete">
  162. 删除
  163. </el-link>
  164. </template>
  165. </el-popconfirm>
  166. <el-link
  167. type="primary"
  168. :underline="false"
  169. icon="el-icon-edit"
  170. @click="creatInvoiceConfirm(row)"
  171. v-if="[2].includes(row.reviewStatus)"
  172. >
  173. 创建发货确认单
  174. </el-link>
  175. <el-link
  176. type="primary"
  177. :underline="false"
  178. icon="el-icon-edit"
  179. @click="creatReturnGoods('add', row)"
  180. v-if="[2].includes(row.reviewStatus)"
  181. >
  182. 创建退货单
  183. </el-link>
  184. </template>
  185. </ele-pro-table>
  186. </div>
  187. </el-card>
  188. <order-detail-dialog ref="orderDetailDialogRef"></order-detail-dialog>
  189. <add-invoice-dialog
  190. ref="invoiceDialogRef"
  191. @done="reload"
  192. :contactData="contactData"
  193. :saleOrderData="saleOrderData"
  194. ></add-invoice-dialog>
  195. <detail-dialog ref="DetailDialogRef"></detail-dialog>
  196. <add-return-goods-dialog
  197. ref="addReturnGoodsRef"
  198. @done="reload"
  199. :contactData="contactData"
  200. ></add-return-goods-dialog>
  201. <!-- 多选删除弹窗 -->
  202. <pop-modal
  203. :visible.sync="delVisible"
  204. content="是否确定删除?"
  205. @done="commitBtn"
  206. />
  207. <printTemplateBy
  208. ref="printTemplateByRef"
  209. :groupName="groupName"
  210. ></printTemplateBy>
  211. <printTemplateJs
  212. ref="printTemplateJsRef"
  213. :groupName="groupName"
  214. ></printTemplateJs>
  215. <printTemplateJsYp
  216. ref="printTemplateJsYpRef"
  217. :groupName="groupName"
  218. ></printTemplateJsYp>
  219. <printTemplateWl
  220. ref="printTemplateWlRef"
  221. :groupName="groupName"
  222. ></printTemplateWl>
  223. <printTemplateJr
  224. ref="printTemplateJrRef"
  225. :groupName="groupName"
  226. ></printTemplateJr>
  227. <printTemplateBs
  228. ref="printTemplateBSRef"
  229. :groupName="groupName"
  230. ></printTemplateBs>
  231. <printTemplateHt
  232. ref="printTemplateHtRef"
  233. :groupName="groupName"
  234. ></printTemplateHt>
  235. <process-submit-dialog
  236. :isNotNeedProcess="false"
  237. :isCloseRefresh="false"
  238. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  239. v-if="processSubmitDialogFlag"
  240. ref="processSubmitDialogRef"
  241. @reload="reload"
  242. ></process-submit-dialog>
  243. <addInvoiceConfirm
  244. ref="addInvoiceConfirmRef"
  245. @done="reload"
  246. :contactData="contactData"
  247. :saleOrderData="saleOrderData"
  248. ></addInvoiceConfirm>
  249. </div>
  250. </template>
  251. <script>
  252. import searchTable from './components/searchTable.vue';
  253. import addInvoiceDialog from './components/addInvoiceDialog.vue';
  254. import addInvoiceConfirm from '@/views/saleManage/saleOrder/invoiceConfirm/components/addInvoiceDialog.vue';
  255. import detailDialog from './components/detailDialog.vue';
  256. import popModal from '@/components/pop-modal';
  257. import { reviewStatus } from '@/enum/dict';
  258. import orderDetailDialog from '@/views/saleManage/saleOrder/components/detailDialog.vue';
  259. import addReturnGoodsDialog from '@/views/saleManage/saleOrder/returnGoods/components/addReturnGoodsDialog';
  260. import printTemplateBy from '@/views/saleManage/saleOrder/invoice/components/print-template-by.vue';
  261. import printTemplateJs from '@/views/saleManage/saleOrder/invoice/components/print-template-js.vue';
  262. import printTemplateJsYp from '@/views/saleManage/saleOrder/invoice/components/print-template-jsyp.vue';
  263. import printTemplateWl from '@/views/saleManage/saleOrder/invoice/components/print-template-wl.vue';
  264. import printTemplateBs from '@/views/saleManage/saleOrder/invoice/components/print-template-bs.vue';
  265. import printTemplateJr from '@/views/saleManage/saleOrder/invoice/components/print-template-jr.vue';
  266. import printTemplateHt from '@/views/saleManage/saleOrder/invoice/components/print-template-ht.vue';
  267. import {
  268. deleteSendInformation,
  269. getSendTableList,
  270. submit
  271. } from '@/api/saleManage/saleordersendrecord';
  272. import dictMixins from '@/mixins/dictMixins';
  273. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  274. import tabMixins from '@/mixins/tableColumnsMixin';
  275. import { enterprisePage } from '@/api/contractManage/contractBook';
  276. import { getSendSaleOrderrecordDetailSplit } from '@/api/saleManage/saleordersendrecord';
  277. import { getWarehouseListByIds } from '@/api/purchasingManage/returnGoods';
  278. import exportButton from '@/components/upload/exportButton.vue';
  279. import { downLoadTemplate } from '@/api/system/file/index.js';
  280. export default {
  281. mixins: [dictMixins, tabMixins],
  282. components: {
  283. processSubmitDialog,
  284. printTemplateBy,
  285. searchTable,
  286. popModal,
  287. addReturnGoodsDialog,
  288. orderDetailDialog,
  289. addInvoiceDialog,
  290. detailDialog,
  291. addInvoiceConfirm,
  292. printTemplateJs,
  293. printTemplateJsYp,
  294. printTemplateWl,
  295. printTemplateBs,
  296. printTemplateJr,
  297. exportButton,
  298. printTemplateHt
  299. },
  300. //客户管理数据
  301. props: {
  302. contactData: {
  303. type: Object,
  304. default: () => {
  305. return {};
  306. }
  307. },
  308. saleOrderData: {
  309. type: Object,
  310. default: () => {
  311. return {};
  312. }
  313. }
  314. },
  315. data() {
  316. return {
  317. params: {},
  318. activeComp: 'saleorder',
  319. tabOptions: [
  320. { key: 'saleorder', name: '销售订单' },
  321. { key: 'invoice', name: '发货单' },
  322. { key: 'returnorder', name: '退货单' }
  323. ],
  324. groupName: '',
  325. selection: [], //单选中集合
  326. delVisible: false, //批量删除弹框状态
  327. loading: false, // 加载状态
  328. processSubmitDialogFlag: false,
  329. columns: [
  330. {
  331. width: 45,
  332. type: 'selection',
  333. columnKey: 'selection',
  334. align: 'center'
  335. },
  336. {
  337. columnKey: 'index',
  338. label: '序号',
  339. type: 'index',
  340. width: 55,
  341. align: 'center',
  342. showOverflowTooltip: true,
  343. fixed: 'left'
  344. },
  345. {
  346. prop: 'docNo',
  347. label: '发货单编码',
  348. align: 'center',
  349. sortable: true,
  350. slot: 'docNo',
  351. showOverflowTooltip: true,
  352. minWidth: 200
  353. },
  354. {
  355. prop: 'orderNo',
  356. label: '销售订单编码',
  357. align: 'center',
  358. sortable: true,
  359. slot: 'orderNo',
  360. showOverflowTooltip: true,
  361. minWidth: 200
  362. },
  363. {
  364. prop: 'productNames',
  365. label: '产品名称',
  366. align: 'center',
  367. showOverflowTooltip: true,
  368. minWidth: 140
  369. },
  370. {
  371. prop: 'productCodes',
  372. label: '产品编码',
  373. align: 'center',
  374. showOverflowTooltip: true,
  375. minWidth: 160
  376. },
  377. {
  378. minWidth: 160,
  379. prop: 'productionCodes',
  380. label: '生产编号',
  381. align: 'center'
  382. },
  383. {
  384. prop: 'batchNos',
  385. label: '批次号',
  386. align: 'center',
  387. showOverflowTooltip: true,
  388. minWidth: 140
  389. },
  390. {
  391. prop: 'orderTotalCount',
  392. label: '订单数量',
  393. align: 'center',
  394. showOverflowTooltip: true,
  395. minWidth: 140
  396. },
  397. {
  398. prop: 'sendTotalCount',
  399. label: '发货数量',
  400. align: 'center',
  401. showOverflowTooltip: true,
  402. minWidth: 140
  403. },
  404. {
  405. prop: 'projectName',
  406. label: '项目名称',
  407. align: 'center',
  408. showOverflowTooltip: true,
  409. minWidth: 180
  410. },
  411. {
  412. prop: 'contactName',
  413. label: '客户名称',
  414. align: 'center',
  415. showOverflowTooltip: true,
  416. minWidth: 180
  417. },
  418. {
  419. prop: 'replied',
  420. label: '是否回执',
  421. align: 'center',
  422. showOverflowTooltip: true,
  423. minWidth: 120,
  424. formatter: (_row, _column, cellValue) => {
  425. return _row.replied == 1 ? '是' : '否';
  426. }
  427. },
  428. {
  429. prop: 'reviewStatus',
  430. label: '状态',
  431. align: 'center',
  432. showOverflowTooltip: true,
  433. minWidth: 100,
  434. formatter: (_row, _column, cellValue) => {
  435. return reviewStatus[_row.reviewStatus];
  436. }
  437. },
  438. {
  439. prop: 'createUserName',
  440. label: '创建人',
  441. align: 'center',
  442. showOverflowTooltip: true,
  443. minWidth: 80
  444. },
  445. {
  446. prop: 'createTime',
  447. label: '创建时间',
  448. align: 'center',
  449. showOverflowTooltip: true,
  450. minWidth: 170
  451. },
  452. {
  453. columnKey: 'action',
  454. label: '操作',
  455. width: 280,
  456. align: 'center',
  457. resizable: false,
  458. slot: 'action',
  459. showOverflowTooltip: true,
  460. fixed: 'right'
  461. }
  462. ],
  463. cacheKeyUrl: 'eos-bfe3d5ea-saleManage-invoice'
  464. };
  465. },
  466. computed: {},
  467. created() {
  468. enterprisePage({
  469. pageNum: 1,
  470. size: 200
  471. }).then((res) => {
  472. if (res.list?.length > 0) {
  473. this.groupName = res.list[0].name;
  474. }
  475. });
  476. console.log('this.saleOrderData',this.saleOrderData.id)
  477. },
  478. watch: {
  479. saleOrderData: {
  480. handler(newVal, oldVal) {
  481. if (newVal.id) {
  482. this.reload();
  483. }
  484. },
  485. deep: true
  486. }
  487. },
  488. methods: {
  489. /* 表格数据源 */
  490. datasource({ page, limit, where, order }) {
  491. if (this.saleOrderData.id) {
  492. //订单详情进入
  493. where['orderId'] = this.saleOrderData.id;
  494. }
  495. if (this.contactData.id) {
  496. where['contactId'] = this.contactData.id;
  497. }
  498. this.params = {
  499. pageNum: page,
  500. size: limit,
  501. ...where
  502. };
  503. return getSendTableList({
  504. pageNum: page,
  505. size: limit,
  506. ...where
  507. });
  508. },
  509. exportFile(row) {
  510. downLoadTemplate(
  511. `/eom/saleordersendrecord/export/${row.id}`,
  512. '货物签收单'
  513. );
  514. },
  515. //创建退货单
  516. creatReturnGoods(type, row) {
  517. this.$refs.addReturnGoodsRef.open(type, {}, row.id);
  518. },
  519. /* 刷新表格 */
  520. reload(where) {
  521. this.$refs.table.reload({ page: 1, where });
  522. this.$emit('getToDoReminder');
  523. },
  524. //新增编辑
  525. openEdit(type, row) {
  526. this.$refs.invoiceDialogRef.open(type, row);
  527. this.$refs.invoiceDialogRef.$refs.form &&
  528. this.$refs.invoiceDialogRef.$refs.form.clearValidate();
  529. },
  530. creatInvoiceConfirm(row) {
  531. this.$refs.addInvoiceConfirmRef.open('add', {}, row);
  532. },
  533. //批量删除
  534. allDelBtn() {
  535. if (this.selection.length === 0) return;
  536. let flag = this.selection.some((item) =>
  537. [1, 2].includes(item.reviewStatus)
  538. );
  539. if (flag)
  540. return this.$message.warning(
  541. '抱歉已审核、审核中的数据不能删除,请检查'
  542. );
  543. this.delVisible = true;
  544. },
  545. handlePrint(ref) {
  546. if (this.selection.length > 1)
  547. return this.$message.warning('请选择一条');
  548. let flag = this.selection.some((item) =>
  549. [2].includes(item.reviewStatus)
  550. );
  551. if (!flag)
  552. return this.$message.warning('抱歉需要已审核的发货单才能打印,请检查');
  553. if (ref != 'printTemplateByRef' && ref != 'printTemplateHtRef') {
  554. this.$refs[ref].open(this.selection[0].id);
  555. return;
  556. }
  557. this.$confirm('是否需要打印价格', '提示', {
  558. type: 'warning',
  559. cancelButtonText: '否',
  560. confirmButtonText: '是'
  561. })
  562. .then((res) => {
  563. this.$refs[ref].open(this.selection[0].id, true);
  564. })
  565. .catch((err) => {
  566. this.$refs[ref].open(this.selection[0].id, false);
  567. });
  568. },
  569. //删除接口
  570. remove(delData) {
  571. deleteSendInformation(delData).then((res) => {
  572. this.$message.success('删除成功!');
  573. this.reload();
  574. });
  575. },
  576. //删除弹框确定
  577. commitBtn() {
  578. const dataId = this.selection.map((v) => v.id);
  579. this.remove(dataId);
  580. },
  581. async sendSubmit(res) {
  582. const data = await getSendSaleOrderrecordDetailSplit(res.id);
  583. let storemanIds = '';
  584. let ids = data.productList.map((item) => item.warehouseId);
  585. if (ids?.length) {
  586. let warehouseList = await getWarehouseListByIds(ids || []);
  587. storemanIds = warehouseList.map((item) => item.ownerId);
  588. }
  589. this.processSubmitDialogFlag = true;
  590. this.$nextTick(() => {
  591. let params = {
  592. businessId: res.id,
  593. businessKey:
  594. res.saleTypeName.indexOf('技改') != '-1'
  595. ? 'sele_order_send_correction'
  596. : res.saleTypeName.indexOf('三包') != '-1'
  597. ? 'eom_sh'
  598. : res.saleTypeName.indexOf('补发') != '-1'
  599. ? 'eom_sh'
  600. : res.saleTypeName.indexOf('赠品') != '-1'
  601. ? 'sale_order_send_giftAndOther'
  602. : 'sales_send_approve',
  603. // businessKey:'eom_sh',
  604. formCreateUserId: res.createUserId,
  605. variables: {
  606. businessCode: res.docNo,
  607. businessName: res.contactName,
  608. storemanIds: storemanIds.toString(),
  609. businessType: '销售发货单'
  610. }
  611. };
  612. this.$refs.processSubmitDialogRef.init(params);
  613. });
  614. },
  615. //查看详情
  616. openorderDetail(row, type, index) {
  617. if (type === 'docNo') {
  618. this.$refs.DetailDialogRef.open(row);
  619. }
  620. if (type === 'orderNo') {
  621. let orderId = '';
  622. if (row.orderIds) {
  623. orderId = row.orderIds.split(',')[index];
  624. } else {
  625. orderId = row.orderId;
  626. }
  627. this.$refs.orderDetailDialogRef.open({ id: orderId });
  628. }
  629. }
  630. }
  631. };
  632. </script>
  633. <style lang="scss" scoped>
  634. .ele-body {
  635. padding-top: 0;
  636. padding-bottom: 0;
  637. }
  638. :deep .el-card__body {
  639. padding: 0;
  640. }
  641. :deep(.el-link--inner) {
  642. margin-left: 0px !important;
  643. }
  644. .sys-organization-list {
  645. height: calc(100vh - 264px);
  646. box-sizing: border-box;
  647. border-width: 1px;
  648. border-style: solid;
  649. overflow: auto;
  650. }
  651. .sys-organization-list :deep(.el-tree-node__content) {
  652. height: 40px;
  653. & > .el-tree-node__expand-icon {
  654. margin-left: 10px;
  655. }
  656. }
  657. .switch_left ul .active {
  658. border-top: 4px solid var(--color-primary);
  659. color: var(--color-primary-5);
  660. }
  661. .switch {
  662. padding-bottom: 20px;
  663. }
  664. .el-dropdown-link {
  665. cursor: pointer;
  666. color: var(--color-primary-5);
  667. }
  668. .el-icon-arrow-down {
  669. font-size: 12px;
  670. }
  671. </style>