index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  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. @columns-change="handleColumnChange"
  17. :cache-key="cacheKeyUrl"
  18. :page-size="20"
  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. el-icon-delete
  39. class="ele-btn-icon"
  40. @click="allDelBtn"
  41. :disabled="selection?.length === 0"
  42. >
  43. 批量删除
  44. </el-button>
  45. </template>
  46. <!-- 查看详情列 -->
  47. <template v-slot:code="{ row }">
  48. <el-link
  49. type="primary"
  50. :underline="false"
  51. @click="openorderDetail(row, 'code')"
  52. >
  53. {{ row.code }}
  54. </el-link>
  55. </template>
  56. <template v-slot:orderNo="{ row }">
  57. <el-link
  58. type="primary"
  59. :underline="false"
  60. @click="openorderDetail(row, 'orderNo')"
  61. >
  62. {{ row.orderNo }}
  63. </el-link>
  64. </template>
  65. <!-- 操作列 -->
  66. <template v-slot:action="{ row }">
  67. <el-link
  68. type="primary"
  69. :underline="false"
  70. icon="el-icon-edit"
  71. @click="openEdit('edit', row)"
  72. v-if="
  73. (isNeed_process_is_close &&
  74. [0, 3].includes(row.reviewStatus)) ||
  75. !isNeed_process_is_close
  76. "
  77. >
  78. 修改
  79. </el-link>
  80. <el-link
  81. type="primary"
  82. :underline="false"
  83. icon="el-icon-plus"
  84. @click="sendSubmit(row)"
  85. v-if="
  86. isNeed_process_is_close && [0, 3].includes(row.reviewStatus)
  87. "
  88. >
  89. 提交
  90. </el-link>
  91. <el-popconfirm
  92. class="ele-action"
  93. title="确定要删除此信息吗?"
  94. @confirm="remove([row.id])"
  95. v-if="
  96. (isNeed_process_is_close &&
  97. [0, 3].includes(row.reviewStatus)) ||
  98. !isNeed_process_is_close
  99. "
  100. >
  101. <template v-slot:reference>
  102. <el-link type="danger" :underline="false" icon="el-icon-delete">
  103. 删除
  104. </el-link>
  105. </template>
  106. </el-popconfirm>
  107. <el-link
  108. type="primary"
  109. :underline="false"
  110. icon="el-icon-edit"
  111. @click="creatSendGoods('entrustedReceive', row)"
  112. v-if="[2].includes(row.reviewStatus) && (row.sendTotalCount < row.orderTotalCount)"
  113. >
  114. 创建发货单
  115. </el-link>
  116. <el-link
  117. type="primary"
  118. :underline="false"
  119. icon="el-icon-edit"
  120. @click="creatReturnGoods('entrustedReceive', row)"
  121. v-if="[2].includes(row.reviewStatus)"
  122. >
  123. 创建退货单
  124. </el-link>
  125. </template>
  126. </ele-pro-table>
  127. </div>
  128. </el-card>
  129. <!-- 新增、修改 -->
  130. <add-or-edit-dialog
  131. ref="addOrEditDialogRef"
  132. :add-or-edit-dialog-flag.sync="addOrEditDialogFlag"
  133. v-if="addOrEditDialogFlag"
  134. :saleOrderData="saleOrderData"
  135. :contactData="contactData"
  136. @done="reload"
  137. ></add-or-edit-dialog>
  138. <!-- 详情 -->
  139. <detail-dialog
  140. ref="detailDialogRef"
  141. :detailDialogFlag.sync="detailDialogFlag"
  142. v-if="detailDialogFlag"
  143. ></detail-dialog>
  144. <order-detail-dialog ref="orderDetailDialogRef"></order-detail-dialog>
  145. <add-invoice-dialog
  146. ref="invoiceDialogRef"
  147. @done="reload"
  148. ></add-invoice-dialog>
  149. <!-- 多选删除弹窗 -->
  150. <pop-modal
  151. :visible.sync="delVisible"
  152. content="是否确定删除?"
  153. @done="commitBtn"
  154. />
  155. <addReturnGoodsDialog
  156. ref="addReturnGoodsRef"
  157. :contactData="contactData"
  158. @done="reload"
  159. ></addReturnGoodsDialog>
  160. <process-submit-dialog
  161. :isNotNeedProcess="false"
  162. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  163. v-if="processSubmitDialogFlag"
  164. ref="processSubmitDialogRef"
  165. @reload="reload"
  166. ></process-submit-dialog>
  167. </div>
  168. </template>
  169. <script>
  170. import searchTable from './components/searchTable.vue';
  171. import addOrEditDialog from './components/addOrEditDialog.vue';
  172. import popModal from '@/components/pop-modal';
  173. import { reviewStatus } from '@/enum/dict';
  174. import detailDialog from './components/detailDialog.vue';
  175. import orderDetailDialog from '@/views/saleManage/saleOrder/components/detailDialog.vue';
  176. import dictMixins from '@/mixins/dictMixins';
  177. import {
  178. deleteSaleEntrustedReceiveAPI,
  179. getSaleEntrustedReceivePageAPI,
  180. submit,
  181. getPSaleEntrustedReceiveDetailAPI
  182. } from '@/api/saleManage/entrustedReceive';
  183. // import AddOrEditDialog from '@/views/saleManage/saleOrder/customerReturnOrder/addOrEditDialog.vue';
  184. import addInvoiceDialog from '@/views/saleManage/saleOrder/invoice/components/addInvoiceDialog.vue';
  185. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  186. import tabMixins from '@/mixins/tableColumnsMixin';
  187. import { getWarehouseListByIds } from '@/api/purchasingManage/returnGoods';
  188. import addReturnGoodsDialog from '@/views/saleManage/saleOrder/returnGoods/components/addReturnGoodsDialog';
  189. export default {
  190. mixins: [dictMixins, tabMixins],
  191. components: {
  192. processSubmitDialog,
  193. addInvoiceDialog,
  194. // AddOrEditDialog,
  195. searchTable,
  196. popModal,
  197. orderDetailDialog,
  198. addOrEditDialog,
  199. detailDialog,
  200. addReturnGoodsDialog
  201. },
  202. //客户管理数据
  203. props: {
  204. contactData: {
  205. type: Object,
  206. default: () => {
  207. return {};
  208. }
  209. },
  210. saleOrderData: {
  211. type: Object,
  212. default: () => {
  213. return {};
  214. }
  215. }
  216. },
  217. data() {
  218. return {
  219. activeComp: 'outSourceSend',
  220. addOrEditDialogFlag: false,
  221. detailDialogFlag: false,
  222. processSubmitDialogFlag: false,
  223. selection: [], //单选中集合
  224. delVisible: false, //批量删除弹框状态
  225. loading: false, // 加载状态
  226. columns: [
  227. {
  228. width: 45,
  229. type: 'selection',
  230. columnKey: 'selection',
  231. align: 'center'
  232. },
  233. {
  234. columnKey: 'index',
  235. label: '序号',
  236. type: 'index',
  237. width: 55,
  238. align: 'center',
  239. showOverflowTooltip: true,
  240. fixed: 'left'
  241. },
  242. {
  243. prop: 'code',
  244. label: '收货单编码',
  245. align: 'center',
  246. slot: 'code',
  247. showOverflowTooltip: true,
  248. sortable: true,
  249. minWidth: 200
  250. },
  251. {
  252. prop: 'orderNo',
  253. label: '销售订单编码',
  254. align: 'center',
  255. slot: 'orderNo',
  256. showOverflowTooltip: true,
  257. sortable: true,
  258. minWidth: 200
  259. },
  260. {
  261. prop: 'productNames',
  262. label: '产品名称',
  263. align: 'center',
  264. showOverflowTooltip: true,
  265. minWidth: 140
  266. },
  267. {
  268. prop: 'productCodes',
  269. label: '产品编码',
  270. align: 'center',
  271. showOverflowTooltip: true,
  272. minWidth: 160
  273. },
  274. {
  275. prop: 'batchNos',
  276. label: '批次号',
  277. align: 'center',
  278. showOverflowTooltip: true,
  279. minWidth: 140
  280. },
  281. {
  282. prop: 'productCount',
  283. label: '数量',
  284. align: 'center',
  285. showOverflowTooltip: true,
  286. minWidth: 140
  287. },
  288. {
  289. prop: 'contactName',
  290. label: '客户名称',
  291. align: 'center',
  292. showOverflowTooltip: true,
  293. minWidth: 180
  294. },
  295. {
  296. prop: 'reviewStatus',
  297. label: '状态',
  298. align: 'center',
  299. showOverflowTooltip: true,
  300. minWidth: 120,
  301. formatter: (_row, _column, cellValue) => {
  302. return reviewStatus[_row.reviewStatus];
  303. }
  304. },
  305. {
  306. prop: 'createUserName',
  307. label: '创建人',
  308. align: 'center',
  309. showOverflowTooltip: true,
  310. minWidth: 80
  311. },
  312. {
  313. prop: 'createTime',
  314. label: '创建时间',
  315. align: 'center',
  316. showOverflowTooltip: true,
  317. minWidth: 170
  318. },
  319. {
  320. columnKey: 'action',
  321. label: '操作',
  322. width: 230,
  323. align: 'center',
  324. resizable: false,
  325. slot: 'action',
  326. showOverflowTooltip: true,
  327. fixed: 'right'
  328. }
  329. ],
  330. cacheKeyUrl: 'eos-00bf7292-saleManage-entrustedReceive'
  331. };
  332. },
  333. computed: {},
  334. watch: {
  335. saleOrderData: {
  336. handler(newVal, oldVal) {
  337. if (newVal.id) {
  338. this.reload();
  339. }
  340. },
  341. deep: true
  342. }
  343. },
  344. methods: {
  345. /* 表格数据源 */
  346. datasource({ page, limit, where, order }) {
  347. if (this.saleOrderData.id) {
  348. //订单详情进入
  349. where['orderId'] = this.saleOrderData.id;
  350. }
  351. // 客户详情进入
  352. if (this.contactData.id) {
  353. where['contactId'] = this.contactData.id;
  354. }
  355. return getSaleEntrustedReceivePageAPI({
  356. pageNum: page,
  357. size: limit,
  358. ...where
  359. });
  360. },
  361. //创建退货单
  362. creatReturnGoods(type, row) {
  363. this.$refs.addReturnGoodsRef.open('add', {}, row.id, true);
  364. },
  365. //创建收货单
  366. creatSendGoods(type, row) {
  367. this.$refs.invoiceDialogRef.entrustedReceiveInit(row);
  368. },
  369. /* 刷新表格 */
  370. reload(where) {
  371. this.$refs.table.reload({ page: 1, where });
  372. this.$emit('getToDoReminder');
  373. },
  374. //新增编辑
  375. openEdit(type, row) {
  376. this.addOrEditDialogFlag = true;
  377. this.$nextTick(() => {
  378. this.$refs.addOrEditDialogRef.open(type, row);
  379. });
  380. },
  381. //批量删除
  382. allDelBtn() {
  383. if (this.selection.length === 0) return;
  384. let flag = this.selection.some((item) =>
  385. [1, 2].includes(item.reviewStatus)
  386. );
  387. if (flag)
  388. return this.$message.warning(
  389. '抱歉已审核、审核中的数据不能删除,请检查'
  390. );
  391. this.delVisible = true;
  392. },
  393. //删除接口
  394. remove(delData) {
  395. deleteSaleEntrustedReceiveAPI(delData).then((res) => {
  396. this.$message.success('删除成功!');
  397. this.reload();
  398. });
  399. },
  400. //删除弹框确定
  401. commitBtn() {
  402. const dataId = this.selection.map((v) => v.id);
  403. this.remove(dataId);
  404. },
  405. async sendSubmit(res) {
  406. const data = await getPSaleEntrustedReceiveDetailAPI(res.id);
  407. let storemanIds = '';
  408. let ids = data.productList.map((item) => item.warehouseId);
  409. let warehouseList = await getWarehouseListByIds(ids || []);
  410. storemanIds = warehouseList.map((item) => item.ownerId);
  411. this.processSubmitDialogFlag = true;
  412. this.$nextTick(() => {
  413. let params = {
  414. businessId: res.id,
  415. businessKey: 'sale_entrusted_receive_approve',
  416. formCreateUserId: res.createUserId,
  417. variables: {
  418. businessCode: res.code,
  419. storemanIds: storemanIds.toString(),
  420. businessName: res.productNames,
  421. businessType: '受托收货'
  422. }
  423. };
  424. this.$refs.processSubmitDialogRef.init(params);
  425. });
  426. },
  427. //查看详情
  428. openorderDetail(row, type) {
  429. if (type === 'code') {
  430. this.detailDialogFlag = true;
  431. this.$nextTick(() => {
  432. this.$refs.detailDialogRef.open(row);
  433. });
  434. }
  435. if (type === 'orderNo') {
  436. this.$refs.orderDetailDialogRef.open({ id: row.orderId });
  437. }
  438. }
  439. }
  440. };
  441. </script>
  442. <style lang="scss" scoped>
  443. .ele-body {
  444. padding-top: 0;
  445. padding-bottom: 0;
  446. }
  447. :deep .el-card__body {
  448. padding: 0;
  449. }
  450. :deep(.el-link--inner) {
  451. margin-left: 0px !important;
  452. }
  453. .sys-organization-list {
  454. height: calc(100vh - 264px);
  455. box-sizing: border-box;
  456. border-width: 1px;
  457. border-style: solid;
  458. overflow: auto;
  459. }
  460. .sys-organization-list :deep(.el-tree-node__content) {
  461. height: 40px;
  462. & > .el-tree-node__expand-icon {
  463. margin-left: 10px;
  464. }
  465. }
  466. .switch_left ul .active {
  467. border-top: 4px solid var(--color-primary);
  468. color: var(--color-primary-5);
  469. }
  470. .switch {
  471. padding-bottom: 20px;
  472. }
  473. .el-dropdown-link {
  474. cursor: pointer;
  475. color: var(--color-primary-5);
  476. }
  477. .el-icon-arrow-down {
  478. font-size: 12px;
  479. }
  480. </style>