index.vue 18 KB

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