index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading" style="width: 100%">
  4. <!-- <div class="ele-border-lighter form-content" v-loading="loading"> -->
  5. <search-quotation @search="reload"></search-quotation>
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. height="calc(100vh - 375px)"
  12. full-height="calc(100vh - 116px)"
  13. tool-class="ele-toolbar-form"
  14. default-expand-all
  15. :selection.sync="selection"
  16. row-key="id"
  17. :tree-props="{
  18. children: 'sonPurchasePlanList',
  19. hasChildren: 'hasChildren'
  20. }"
  21. :page-size="20"
  22. @columns-change="handleColumnChange"
  23. :cache-key="cacheKeyUrl"
  24. >
  25. <!-- 表头工具栏 -->
  26. <template v-slot:toolbar>
  27. <el-button
  28. size="small"
  29. type="primary"
  30. icon="el-icon-plus"
  31. v-if="!saleOrderData.id"
  32. class="ele-btn-icon"
  33. @click="openEdit('add', {})"
  34. >
  35. 新建
  36. </el-button>
  37. <el-button
  38. size="small"
  39. type="primary"
  40. icon="el-icon-plus"
  41. v-if="
  42. saleOrderData.id &&
  43. saleOrderData.orderStatus == 2 &&
  44. saleOrderData.needProduce &&
  45. !!!saleOrderData.purchasePlanNum
  46. "
  47. class="ele-btn-icon"
  48. @click="handleAutoGenerate"
  49. >
  50. 生成采购计划
  51. </el-button>
  52. <el-button
  53. size="small"
  54. type="primary"
  55. @click="orderHomogeneityInspectOpen"
  56. >
  57. 齐套性检查
  58. </el-button>
  59. <exportButton
  60. fileName="采购计划"
  61. apiUrl="/eom/purchaseplan/export"
  62. :params="params"
  63. ></exportButton>
  64. </template>
  65. <!-- 查看详情列 -->
  66. <template v-slot:planCode="{ row }">
  67. <el-link type="primary" :underline="false" @click="openDetail(row)">
  68. {{ row.planCode }}
  69. </el-link>
  70. </template>
  71. <template v-slot:requirementName="{ row }">
  72. <el-link
  73. type="primary"
  74. :underline="false"
  75. @click="openNeedDetail(row)"
  76. >
  77. {{ row.requirementName }}
  78. </el-link>
  79. </template>
  80. <template v-slot:action="{ row }">
  81. <el-link
  82. type="primary"
  83. :underline="false"
  84. icon="el-icon-edit"
  85. v-if="
  86. (isNeed_process_is_close &&
  87. [0, 3].includes(row.status) &&
  88. !row.isCut) ||
  89. (!isNeed_process_is_close && !row.isCut)
  90. "
  91. @click="openEdit('edit', row)"
  92. >
  93. 修改
  94. </el-link>
  95. <el-link
  96. type="primary"
  97. :underline="false"
  98. icon="el-icon-edit"
  99. v-if="isNeed_process_is_close && [0, 3].includes(row.status)"
  100. @click="submitPlan(row)"
  101. >
  102. 提交
  103. </el-link>
  104. <el-link
  105. type="primary"
  106. :underline="false"
  107. icon="el-icon-edit"
  108. v-if="
  109. [2].includes(row.status) &&
  110. (!row.parentId || row.parentId == 0) &&
  111. [0].includes(row.progress) &&
  112. !orderSourceType.includes(row.sourceType) &&
  113. row.acceptUnpack == 1 &&
  114. row.isGenerateOrder != 1 &&
  115. row.isGenerateContract != 1
  116. "
  117. @click="handleSplit(row)"
  118. >
  119. 拆分
  120. </el-link>
  121. <el-link
  122. type="primary"
  123. :underline="false"
  124. v-if="
  125. [2].includes(row.status) &&
  126. (!row.isCut || (row.parentId && row.parentId != 0)) &&
  127. isAddInquiry == 0
  128. "
  129. icon="el-icon-plus"
  130. @click="addInquiry('add', row)"
  131. >
  132. 生成核价单
  133. </el-link>
  134. <el-link
  135. type="primary"
  136. :underline="false"
  137. v-if="
  138. [2].includes(row.status) &&
  139. (!row.isCut || (row.parentId && row.parentId != 0)) &&
  140. isAddInquiry != 0 &&
  141. [0, 100, 101, 103].includes(row.progress)
  142. "
  143. icon="el-icon-plus"
  144. @click="addInquiry('add', row)"
  145. >
  146. 生成核价单
  147. </el-link>
  148. <el-popconfirm
  149. class="ele-action"
  150. title="确定要删除此信息吗?"
  151. v-if="
  152. (isNeed_process_is_close &&
  153. [0, 3].includes(row.status) &&
  154. !row.isCut) ||
  155. (!isNeed_process_is_close && !row.isCut)
  156. "
  157. @confirm="remove([row.id])"
  158. >
  159. <template v-slot:reference>
  160. <el-link type="danger" :underline="false" icon="el-icon-delete">
  161. 删除
  162. </el-link>
  163. </template>
  164. </el-popconfirm>
  165. </template>
  166. </ele-pro-table>
  167. </el-card>
  168. <add-dialog
  169. :saleOrderData="saleOrderData"
  170. ref="addDialogRef"
  171. @done="reload"
  172. ></add-dialog>
  173. <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
  174. <!-- 多选删除弹窗 -->
  175. <pop-modal content="是否确定删除?" />
  176. <detailNeedDialog ref="DetailNeedDialogRef"></detailNeedDialog>
  177. <split-dialog
  178. ref="splitDialogRef"
  179. v-if="splitDialogFlag"
  180. :splitDialogFlag.sync="splitDialogFlag"
  181. @done="reload"
  182. ></split-dialog>
  183. <autogenerate-dialog
  184. ref="autogenerateDialogRef"
  185. @reload="reload"
  186. ></autogenerate-dialog>
  187. <process-submit-dialog
  188. api-fun-name="purchaseplanStatusAPI"
  189. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  190. isCloseRefresh="false"
  191. v-if="processSubmitDialogFlag"
  192. ref="processSubmitDialogRef"
  193. @reload="reload"
  194. ></process-submit-dialog>
  195. <orderHomogeneityInspectDialog
  196. ref="orderHomogeneityInspectRef"
  197. @reload="reload"
  198. ></orderHomogeneityInspectDialog>
  199. </div>
  200. </template>
  201. <script>
  202. import searchQuotation from './components/searchQuotation.vue';
  203. import addDialog from './components/addDialog.vue';
  204. import addInquiryDialog from '../../purchasingManage/inquiryManage/components/addDialog.vue';
  205. import detailNeedDialog from '../../purchasingManage/purchaseNeedManage/components/detailDialog.vue';
  206. import detailDialog from './components/detailDialog.vue';
  207. import popModal from '@/components/pop-modal';
  208. import dictMixins from '@/mixins/dictMixins';
  209. import {
  210. getTableList,
  211. deleteInformation,
  212. isPlanPerson,
  213. getplanDetail
  214. } from '@/api/purchasingManage/purchasePlanManage';
  215. import splitDialog from './components/splitDialog.vue';
  216. import { purchasePlanProgressStatusEnum } from '@/enum/dict';
  217. import autogenerateDialog from '@/BIZComponents/autogenerateDialog.vue';
  218. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  219. import orderHomogeneityInspectDialog from '@/BIZComponents/homogeneityInspect/orderHomogeneityInspectDialog.vue';
  220. import { parameterGetByCode } from '@/api/main/index.js';
  221. import { orderSourceType } from '@/enum/dict';
  222. import exportButton from '@/components/upload/exportButton.vue';
  223. import { getWarehouseListByIds } from '@/api/purchasingManage/returnGoods';
  224. import { reviewStatus } from '@/enum/dict';
  225. import tabMixins from '@/mixins/tableColumnsMixin';
  226. export default {
  227. mixins: [dictMixins, tabMixins],
  228. components: {
  229. processSubmitDialog,
  230. searchQuotation,
  231. popModal,
  232. addDialog,
  233. detailDialog,
  234. detailNeedDialog,
  235. addInquiryDialog,
  236. splitDialog,
  237. autogenerateDialog,
  238. exportButton,
  239. orderHomogeneityInspectDialog,
  240. getplanDetail
  241. },
  242. data() {
  243. return {
  244. loading: false, // 加载状态
  245. processSubmitDialogFlag: false,
  246. splitDialogFlag: false, // 加载状态
  247. isAddInquiry: 0,
  248. orderSourceType,
  249. params: {},
  250. cacheKeyUrl: 'eos-c2e9664a-purchasingManage-purchasePlanManage',
  251. columnsVersion: 1,
  252. selection: []
  253. };
  254. },
  255. //客户管理数据
  256. props: {
  257. saleOrderData: {
  258. type: Object,
  259. default: () => {
  260. return {};
  261. }
  262. }
  263. },
  264. computed: {
  265. columns() {
  266. let columnsVersion = this.columnsVersion;
  267. return [
  268. {
  269. width: 45,
  270. type: 'selection',
  271. columnKey: 'selection',
  272. align: 'center'
  273. },
  274. {
  275. columnKey: 'index',
  276. label: '序号',
  277. type: 'index',
  278. width: 55,
  279. align: 'center',
  280. showOverflowTooltip: true,
  281. fixed: 'left',
  282. className: 'backgroundWhite'
  283. },
  284. {
  285. prop: 'planCode',
  286. slot: 'planCode',
  287. label: '采购计划单编码',
  288. align: 'center',
  289. sortable: true,
  290. minWidth: 210
  291. },
  292. {
  293. prop: 'progress',
  294. label: '计划进度',
  295. align: 'center',
  296. showOverflowTooltip: true,
  297. formatter: (_row, _column, cellValue) => {
  298. return purchasePlanProgressStatusEnum.find(
  299. (val) => val.value == _row.progress
  300. )?.label;
  301. },
  302. minWidth: 200
  303. },
  304. {
  305. prop: 'planName',
  306. label: '采购计划单名称',
  307. align: 'center',
  308. showOverflowTooltip: true,
  309. minWidth: 200
  310. },
  311. {
  312. prop: 'requirementName',
  313. slot: 'requirementName',
  314. label: '采购需求单名称',
  315. align: 'center',
  316. showOverflowTooltip: true,
  317. minWidth: 200
  318. },
  319. {
  320. prop: 'productNames',
  321. label: '产品名称',
  322. align: 'center',
  323. showOverflowTooltip: true,
  324. minWidth: 140
  325. },
  326. {
  327. prop: 'batchNo',
  328. label: '批次号',
  329. align: 'center',
  330. showOverflowTooltip: true,
  331. minWidth: 140
  332. },
  333. {
  334. prop: 'sourceTypeName',
  335. label: '需求类型',
  336. align: 'center',
  337. showOverflowTooltip: true,
  338. minWidth: 140
  339. },
  340. {
  341. prop: 'requireDeptName',
  342. label: '需求部门',
  343. align: 'center',
  344. slot: 'requireDeptName',
  345. showOverflowTooltip: true,
  346. minWidth: 200
  347. },
  348. {
  349. prop: 'requireUserName',
  350. label: '需求人',
  351. align: 'center',
  352. showOverflowTooltip: true,
  353. minWidth: 140
  354. },
  355. {
  356. prop: 'responsibleName',
  357. label: '负责人',
  358. align: 'center',
  359. showOverflowTooltip: true,
  360. minWidth: 120
  361. },
  362. {
  363. prop: 'detailCount',
  364. label: '明细条数',
  365. align: 'center',
  366. showOverflowTooltip: true,
  367. minWidth: 140
  368. },
  369. {
  370. prop: 'createTime',
  371. label: '创建时间',
  372. align: 'center',
  373. showOverflowTooltip: true,
  374. minWidth: 180
  375. },
  376. {
  377. prop: 'createUserName',
  378. label: '创建人',
  379. align: 'center',
  380. showOverflowTooltip: true,
  381. minWidth: 180
  382. },
  383. {
  384. prop: 'status',
  385. label: '状态',
  386. align: 'center',
  387. formatter: (_row, _column, cellValue) => {
  388. return reviewStatus[cellValue];
  389. },
  390. showOverflowTooltip: true,
  391. minWidth: 120
  392. },
  393. {
  394. columnKey: 'action',
  395. label: '操作',
  396. width: 230,
  397. align: 'center',
  398. resizable: false,
  399. slot: 'action',
  400. showOverflowTooltip: true,
  401. fixed: 'right',
  402. className: 'backgroundWhite'
  403. }
  404. ];
  405. }
  406. },
  407. created() {
  408. this.requestDict('客户状态');
  409. // this.datasource();
  410. //采购管理采购计划是否可以重复生成核价单
  411. parameterGetByCode({
  412. code: 'purchasingManage_purchasePlanManage_isAddInquiry'
  413. }).then((res) => {
  414. this.isAddInquiry = res.value;
  415. });
  416. },
  417. methods: {
  418. async orderHomogeneityInspectOpen() {
  419. if (this.selection?.length != 1) {
  420. return this.$message.warning('请选择一条单据!');
  421. }
  422. // let data = await getplanDetail(this.selection[0].id);
  423. // data.detailList = data.detailList.map((item) => {
  424. // item['code'] = data.planCode;
  425. // return item;
  426. // });
  427. this.$refs.orderHomogeneityInspectRef.open(this.selection[0]);
  428. },
  429. /* 表格数据源 */
  430. datasource({ page, limit, where, order }) {
  431. if (this.saleOrderData.id) {
  432. where['saleOrderCode'] = this.saleOrderData.orderNo;
  433. }
  434. this.params = {
  435. pageNum: page,
  436. size: limit,
  437. ...where
  438. };
  439. return getTableList({
  440. pageNum: page,
  441. size: limit,
  442. ...where
  443. });
  444. },
  445. /* 刷新表格 */
  446. reload(where) {
  447. this.$refs.table.reload({ page: 1, where });
  448. },
  449. async submitPlan(row) {
  450. this.processSubmitDialogFlag = true;
  451. const data = await getplanDetail(row.id);
  452. let storemanIds = '';
  453. if (['3', '4', '5'].includes(row.sourceType)) {
  454. let ids = data.detailList.map((item) => item.warehouseId);
  455. let warehouseList = await getWarehouseListByIds(ids || []);
  456. storemanIds = warehouseList.map((item) => item.ownerId);
  457. }
  458. this.$nextTick(() => {
  459. let params = {
  460. businessId: row.id,
  461. businessKey: ['3', '4', '5'].includes(row.sourceType)
  462. ? 'outsource_purchasePlan_approve'
  463. : 'purchase_plan_approve',
  464. formCreateUserId: row.createUserId,
  465. variables: {
  466. businessCode: row.planCode,
  467. businessName: row.planName,
  468. businessType: row.sourceTypeName,
  469. storemanIds: storemanIds.toString()
  470. }
  471. };
  472. this.$refs.processSubmitDialogRef.init(params);
  473. });
  474. },
  475. //新增编辑
  476. openEdit(type, row) {
  477. this.$refs.addDialogRef.open(type, row, row.id);
  478. this.$refs.addDialogRef.$refs.form &&
  479. this.$refs.addDialogRef.$refs.form.clearValidate();
  480. },
  481. async handleSplit(row) {
  482. let code = await isPlanPerson(row.id);
  483. if (code == 1) {
  484. return this.$message.warning(
  485. '您不是该采购计划责任人,无法对该计划进行核价操作!'
  486. );
  487. }
  488. this.splitDialogFlag = true;
  489. this.$nextTick(() => {
  490. this.$refs.splitDialogRef.init(row);
  491. });
  492. },
  493. //新增核价
  494. async addInquiry(type, row) {
  495. let code = await isPlanPerson(row.id);
  496. if (code == 1) {
  497. return this.$message.warning(
  498. '您不是该采购计划责任人,无法对该计划进行核价操作!'
  499. );
  500. }
  501. await this.$router.push({
  502. path: '/purchasingManage/inquiryManage/components/addDialog',
  503. query: {
  504. id: row.id ? row.id : null,
  505. type,
  506. t: new Date().getTime()
  507. }
  508. });
  509. },
  510. //删除接口
  511. remove(delData) {
  512. deleteInformation(delData).then((res) => {
  513. this.$message.success('删除成功!');
  514. this.reload();
  515. });
  516. },
  517. //查看详情
  518. openDetail(row) {
  519. this.$refs.contactDetailDialogRef.open(row);
  520. },
  521. //查看详情
  522. openNeedDetail(row) {
  523. this.$refs.DetailNeedDialogRef.open(row);
  524. },
  525. //生成
  526. handleAutoGenerate() {
  527. this.$refs.autogenerateDialogRef.init(this.saleOrderData.id, false);
  528. }
  529. }
  530. };
  531. </script>
  532. <style lang="scss" scoped>
  533. :deep(.el-link--inner) {
  534. margin-left: 0px !important;
  535. }
  536. // :deep(.is-hidden){
  537. // background: #fff;
  538. // }
  539. .sys-organization-list {
  540. height: calc(100vh - 264px);
  541. box-sizing: border-box;
  542. border-width: 1px;
  543. border-style: solid;
  544. overflow: auto;
  545. }
  546. .sys-organization-list :deep(.el-tree-node__content) {
  547. height: 40px;
  548. & > .el-tree-node__expand-icon {
  549. margin-left: 10px;
  550. }
  551. }
  552. ::v-deep .el-pager li.active {
  553. color: #ffffff;
  554. background: #1890ff;
  555. border-radius: 50%;
  556. cursor: default;
  557. }
  558. ::v-deep .el-pager li {
  559. padding: 0 4px;
  560. background: var(--color-white);
  561. vertical-align: top;
  562. display: inline-block;
  563. font-size: 13px;
  564. min-width: 28px;
  565. height: 28px;
  566. line-height: 28px;
  567. cursor: pointer;
  568. box-sizing: border-box;
  569. text-align: center;
  570. margin: 0;
  571. }
  572. ::v-deep .el-table__row--level-1 {
  573. background: #e2f1ff61;
  574. }
  575. ::v-deep .el-table__row--level-0 {
  576. background: rgb(156 249 177);
  577. }
  578. :deep(.backgroundWhite) {
  579. background: white;
  580. }
  581. </style>