index.vue 12 KB

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