index.vue 15 KB

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