index.vue 16 KB

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