index.vue 17 KB

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