index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  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. v-if="processSubmitDialogFlag"
  191. ref="processSubmitDialogRef"
  192. @reload="reload"
  193. ></process-submit-dialog>
  194. <orderHomogeneityInspectDialog
  195. ref="orderHomogeneityInspectRef"
  196. @reload="reload"
  197. ></orderHomogeneityInspectDialog>
  198. </div>
  199. </template>
  200. <script>
  201. import searchQuotation from './components/searchQuotation.vue';
  202. import addDialog from './components/addDialog.vue';
  203. import addInquiryDialog from '../../purchasingManage/inquiryManage/components/addDialog.vue';
  204. import detailNeedDialog from '../../purchasingManage/purchaseNeedManage/components/detailDialog.vue';
  205. import detailDialog from './components/detailDialog.vue';
  206. import popModal from '@/components/pop-modal';
  207. import dictMixins from '@/mixins/dictMixins';
  208. import {
  209. getTableList,
  210. deleteInformation,
  211. isPlanPerson,
  212. getplanDetail
  213. } from '@/api/purchasingManage/purchasePlanManage';
  214. import splitDialog from './components/splitDialog.vue';
  215. import { purchasePlanProgressStatusEnum } from '@/enum/dict';
  216. import autogenerateDialog from '@/BIZComponents/autogenerateDialog.vue';
  217. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  218. import orderHomogeneityInspectDialog from '@/BIZComponents/homogeneityInspect/orderHomogeneityInspectDialog.vue';
  219. import { parameterGetByCode } from '@/api/main/index.js';
  220. import { orderSourceType } from '@/enum/dict';
  221. import exportButton from '@/components/upload/exportButton.vue';
  222. import { getWarehouseListByIds } from '@/api/purchasingManage/returnGoods';
  223. import { reviewStatus } from '@/enum/dict';
  224. import tabMixins from '@/mixins/tableColumnsMixin';
  225. export default {
  226. mixins: [dictMixins, tabMixins],
  227. components: {
  228. processSubmitDialog,
  229. searchQuotation,
  230. popModal,
  231. addDialog,
  232. detailDialog,
  233. detailNeedDialog,
  234. addInquiryDialog,
  235. splitDialog,
  236. autogenerateDialog,
  237. exportButton,
  238. orderHomogeneityInspectDialog,
  239. getplanDetail
  240. },
  241. data() {
  242. return {
  243. loading: false, // 加载状态
  244. processSubmitDialogFlag: false,
  245. splitDialogFlag: false, // 加载状态
  246. isAddInquiry: 0,
  247. orderSourceType,
  248. params: {},
  249. cacheKeyUrl: 'eos-c2e9664a-purchasingManage-purchasePlanManage',
  250. columnsVersion: 1,
  251. selection: []
  252. };
  253. },
  254. //客户管理数据
  255. props: {
  256. saleOrderData: {
  257. type: Object,
  258. default: () => {
  259. return {};
  260. }
  261. }
  262. },
  263. computed: {
  264. columns() {
  265. let columnsVersion = this.columnsVersion;
  266. return [
  267. {
  268. width: 45,
  269. type: 'selection',
  270. columnKey: 'selection',
  271. align: 'center'
  272. },
  273. {
  274. columnKey: 'index',
  275. label: '序号',
  276. type: 'index',
  277. width: 55,
  278. align: 'center',
  279. showOverflowTooltip: true,
  280. fixed: 'left',
  281. className: 'backgroundWhite'
  282. },
  283. {
  284. prop: 'planCode',
  285. slot: 'planCode',
  286. label: '采购计划单编码',
  287. align: 'center',
  288. sortable: true,
  289. minWidth: 210
  290. },
  291. {
  292. prop: 'progress',
  293. label: '计划进度',
  294. align: 'center',
  295. showOverflowTooltip: true,
  296. formatter: (_row, _column, cellValue) => {
  297. return purchasePlanProgressStatusEnum.find(
  298. (val) => val.value == _row.progress
  299. )?.label;
  300. },
  301. minWidth: 200
  302. },
  303. {
  304. prop: 'planName',
  305. label: '采购计划单名称',
  306. align: 'center',
  307. showOverflowTooltip: true,
  308. minWidth: 200
  309. },
  310. {
  311. prop: 'requirementName',
  312. slot: 'requirementName',
  313. label: '采购需求单名称',
  314. align: 'center',
  315. showOverflowTooltip: true,
  316. minWidth: 200
  317. },
  318. {
  319. prop: 'productNames',
  320. label: '产品名称',
  321. align: 'center',
  322. showOverflowTooltip: true,
  323. minWidth: 140
  324. },
  325. {
  326. prop: 'batchNo',
  327. label: '批次号',
  328. align: 'center',
  329. showOverflowTooltip: true,
  330. minWidth: 140
  331. },
  332. {
  333. prop: 'sourceTypeName',
  334. label: '需求类型',
  335. align: 'center',
  336. showOverflowTooltip: true,
  337. minWidth: 140
  338. },
  339. {
  340. prop: 'requireDeptName',
  341. label: '需求部门',
  342. align: 'center',
  343. slot: 'requireDeptName',
  344. showOverflowTooltip: true,
  345. minWidth: 200
  346. },
  347. {
  348. prop: 'requireUserName',
  349. label: '需求人',
  350. align: 'center',
  351. showOverflowTooltip: true,
  352. minWidth: 140
  353. },
  354. {
  355. prop: 'responsibleName',
  356. label: '负责人',
  357. align: 'center',
  358. showOverflowTooltip: true,
  359. minWidth: 120
  360. },
  361. {
  362. prop: 'detailCount',
  363. label: '明细条数',
  364. align: 'center',
  365. showOverflowTooltip: true,
  366. minWidth: 140
  367. },
  368. {
  369. prop: 'createTime',
  370. label: '创建时间',
  371. align: 'center',
  372. showOverflowTooltip: true,
  373. minWidth: 180
  374. },
  375. {
  376. prop: 'createUserName',
  377. label: '创建人',
  378. align: 'center',
  379. showOverflowTooltip: true,
  380. minWidth: 180
  381. },
  382. {
  383. prop: 'status',
  384. label: '状态',
  385. align: 'center',
  386. formatter: (_row, _column, cellValue) => {
  387. return reviewStatus[cellValue];
  388. },
  389. showOverflowTooltip: true,
  390. minWidth: 120
  391. },
  392. {
  393. columnKey: 'action',
  394. label: '操作',
  395. width: 230,
  396. align: 'center',
  397. resizable: false,
  398. slot: 'action',
  399. showOverflowTooltip: true,
  400. fixed: 'right',
  401. className: 'backgroundWhite'
  402. }
  403. ];
  404. }
  405. },
  406. created() {
  407. this.requestDict('客户状态');
  408. // this.datasource();
  409. //采购管理采购计划是否可以重复生成核价单
  410. parameterGetByCode({
  411. code: 'purchasingManage_purchasePlanManage_isAddInquiry'
  412. }).then((res) => {
  413. this.isAddInquiry = res.value;
  414. });
  415. },
  416. methods: {
  417. async orderHomogeneityInspectOpen() {
  418. if (this.selection?.length != 1) {
  419. return this.$message.warning('请选择一条单据!');
  420. }
  421. // let data = await getplanDetail(this.selection[0].id);
  422. // data.detailList = data.detailList.map((item) => {
  423. // item['code'] = data.planCode;
  424. // return item;
  425. // });
  426. this.$refs.orderHomogeneityInspectRef.open(this.selection[0]);
  427. },
  428. /* 表格数据源 */
  429. datasource({ page, limit, where, order }) {
  430. if (this.saleOrderData.id) {
  431. where['saleOrderCode'] = this.saleOrderData.orderNo;
  432. }
  433. this.params = {
  434. pageNum: page,
  435. size: limit,
  436. ...where
  437. };
  438. return getTableList({
  439. pageNum: page,
  440. size: limit,
  441. ...where
  442. });
  443. },
  444. /* 刷新表格 */
  445. reload(where) {
  446. this.$refs.table.reload({ page: 1, where });
  447. },
  448. async submitPlan(row) {
  449. this.processSubmitDialogFlag = true;
  450. const data = await getplanDetail(row.id);
  451. let storemanIds = '';
  452. if (['3', '4', '5'].includes(row.sourceType)) {
  453. let ids = data.detailList.map((item) => item.warehouseId);
  454. let warehouseList = await getWarehouseListByIds(ids || []);
  455. storemanIds = warehouseList.map((item) => item.ownerId);
  456. }
  457. this.$nextTick(() => {
  458. let params = {
  459. businessId: row.id,
  460. businessKey: ['3', '4', '5'].includes(row.sourceType)
  461. ? 'outsource_purchasePlan_approve'
  462. : 'purchase_plan_approve',
  463. formCreateUserId: row.createUserId,
  464. variables: {
  465. businessCode: row.planCode,
  466. businessName: row.planName,
  467. businessType: row.sourceTypeName,
  468. storemanIds: storemanIds.toString()
  469. }
  470. };
  471. this.$refs.processSubmitDialogRef.init(params);
  472. });
  473. },
  474. //新增编辑
  475. openEdit(type, row) {
  476. this.$refs.addDialogRef.open(type, row, row.id);
  477. this.$refs.addDialogRef.$refs.form &&
  478. this.$refs.addDialogRef.$refs.form.clearValidate();
  479. },
  480. handleSplit(row) {
  481. this.splitDialogFlag = true;
  482. this.$nextTick(() => {
  483. this.$refs.splitDialogRef.init(row);
  484. });
  485. },
  486. //新增核价
  487. async addInquiry(type, row) {
  488. let code = await isPlanPerson(row.id);
  489. if (code == 1) {
  490. return this.$message.warning(
  491. '您不是该采购计划责任人,无法对该计划进行核价操作!'
  492. );
  493. }
  494. await this.$router.push({
  495. path: '/purchasingManage/inquiryManage/components/addDialog',
  496. query: {
  497. id: row.id ? row.id : null,
  498. type,
  499. t: new Date().getTime()
  500. }
  501. });
  502. },
  503. //删除接口
  504. remove(delData) {
  505. deleteInformation(delData).then((res) => {
  506. this.$message.success('删除成功!');
  507. this.reload();
  508. });
  509. },
  510. //查看详情
  511. openDetail(row) {
  512. this.$refs.contactDetailDialogRef.open(row);
  513. },
  514. //查看详情
  515. openNeedDetail(row) {
  516. this.$refs.DetailNeedDialogRef.open(row);
  517. },
  518. //生成
  519. handleAutoGenerate() {
  520. this.$refs.autogenerateDialogRef.init(this.saleOrderData.id, false);
  521. }
  522. }
  523. };
  524. </script>
  525. <style lang="scss" scoped>
  526. :deep(.el-link--inner) {
  527. margin-left: 0px !important;
  528. }
  529. // :deep(.is-hidden){
  530. // background: #fff;
  531. // }
  532. .sys-organization-list {
  533. height: calc(100vh - 264px);
  534. box-sizing: border-box;
  535. border-width: 1px;
  536. border-style: solid;
  537. overflow: auto;
  538. }
  539. .sys-organization-list :deep(.el-tree-node__content) {
  540. height: 40px;
  541. & > .el-tree-node__expand-icon {
  542. margin-left: 10px;
  543. }
  544. }
  545. ::v-deep .el-pager li.active {
  546. color: #ffffff;
  547. background: #1890ff;
  548. border-radius: 50%;
  549. cursor: default;
  550. }
  551. ::v-deep .el-pager li {
  552. padding: 0 4px;
  553. background: var(--color-white);
  554. vertical-align: top;
  555. display: inline-block;
  556. font-size: 13px;
  557. min-width: 28px;
  558. height: 28px;
  559. line-height: 28px;
  560. cursor: pointer;
  561. box-sizing: border-box;
  562. text-align: center;
  563. margin: 0;
  564. }
  565. ::v-deep .el-table__row--level-1 {
  566. background: #e2f1ff61;
  567. }
  568. ::v-deep .el-table__row--level-0 {
  569. background: rgb(156 249 177);
  570. }
  571. :deep(.backgroundWhite) {
  572. background: white;
  573. }
  574. </style>