index.vue 17 KB

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