plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1180 lines
38 KiB

1 year ago
1 year ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
1 year ago
10 months ago
1 year ago
11 months ago
1 year ago
1 year ago
9 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
9 months ago
1 year ago
1 year ago
1 year ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <script>
  2. import {
  3. updateQuoteDetail
  4. } from "../../../../api/quote/quoteDetail";
  5. import {getProjectPartList} from "../../../../api/project/project";
  6. import QuoteDetailCost from "./primary/quoteDetailCost.vue";
  7. import QuoteDetailTool from "./primary/quoteDetailTool.vue";
  8. import QuoteDetailBom from "./primary/quoteDetailBom.vue";
  9. import QuoteDetailRouting from "./primary/quoteDetailRouting.vue";
  10. import QuoteDetailOtherCost from "./primary/quoteDetailOtherCost.vue";
  11. import DictDataSelect from "../../sys/dict-data-select.vue";
  12. import QuoteDetailTest from "./primary/quoteDetailTest.vue";
  13. import QuoteDetailOther from "./primary/quoteDetailOther.vue";
  14. import {
  15. queryQuoteGroupDetail,
  16. removeQuoteGroupDetail,
  17. saveQuoteGroupDetail, updateCurrentQuoteGroupDetailItemNo
  18. } from "../../../../api/quote/quoteGroupDetail";
  19. import QuoteDetail from "./quoteDetail.vue";
  20. export default {
  21. name: "quoteGroupDetail",
  22. components: {
  23. QuoteDetail,
  24. QuoteDetailOther,
  25. QuoteDetailTest,
  26. DictDataSelect,
  27. QuoteDetailOtherCost,
  28. QuoteDetailRouting,
  29. QuoteDetailBom,
  30. QuoteDetailTool,
  31. QuoteDetailCost,
  32. },
  33. props:{
  34. quote:{
  35. type:Object,
  36. required:true
  37. },
  38. height:{
  39. type:[Number,String],
  40. default:300
  41. },
  42. authFlag:{
  43. type:Boolean,
  44. default:false
  45. }
  46. },
  47. data(){
  48. return{
  49. quoteDetail:{
  50. id:null,
  51. partNo:'',
  52. partDesc:'',
  53. projectNo:'',
  54. projectDesc:'',
  55. buNo: '*',
  56. qty:null,
  57. quoteCount:1,
  58. partCost:0,
  59. adjustPartCost:0,
  60. labourCost:0,
  61. adjustLabourCost:0,
  62. fabricateCost:0,
  63. adjustFabricateCost:0,
  64. toolCost:0,
  65. adjustToolCost:0,
  66. machineCost:0,
  67. adjustMachineCost:0,
  68. otherCost:0,
  69. manageCost:0,
  70. totalCost:0,
  71. profitRate:0,
  72. profitAmount:0,
  73. totalPrice:0,
  74. unitPrice:0,
  75. taxRate:13,
  76. taxTotalPrice:0,
  77. taxUnitPrice:0,
  78. quoteTotalCost:0,
  79. quoteProfitRate:0,
  80. quoteProfitAmount:0,
  81. quoteTotalPrice:0,
  82. quoteUnitPrice:0,
  83. quoteTaxRate:0,
  84. quoteTaxTotalPrice:0,
  85. quoteTaxUnitPrice:0,
  86. currency1:undefined,
  87. currency2:undefined,
  88. exchangeRate1:undefined,
  89. exchangeRate2:undefined,
  90. currencyTotalCost1:0,
  91. currencyTotalCost2:0,
  92. quoteCurrencyTotalCost1:0,
  93. quoteCurrencyTotalCost2:0,
  94. // moq:'Standard 250K',
  95. moq:'',
  96. calculatedItems:'工具,测试,其他,包装,运输',
  97. testCost:0,
  98. adjustTestCost:0,
  99. elseCost:0,
  100. adjustElseCost:0,
  101. remark:'',
  102. },
  103. saveQuoteDetail:{
  104. },
  105. dataList:[],
  106. saveLoading:false,
  107. queryLoading:false,
  108. saveVisible:false,
  109. saveQuoteDetailRules:{
  110. partNo: [{required: true, message: '请输入物料编码', trigger: ['blur','change']}],
  111. partDesc: [{required: true, message: '请输入物料名称', trigger: ['blur','change']}],
  112. qty: [{required: true, message: '请输入数量', trigger: ['blur','change']}],
  113. currency1: [{required: true, message: '请选择币种', trigger: ['blur','change']}],
  114. },
  115. columns: [
  116. {
  117. userId: this.$store.state.user.name,
  118. functionId: 5011,
  119. serialNumber: '5011Table2PLMPartNo',
  120. tableId: '5011Table2',
  121. tableName: '报价详情信息表',
  122. columnProp: 'plmPartNo',
  123. headerAlign: 'center',
  124. align: 'left',
  125. columnLabel: 'PLM物料编码',
  126. columnHidden: false,
  127. columnImage: false,
  128. columnSortable: false,
  129. sortLv: 0,
  130. status: true,
  131. fixed: '',
  132. columnWidth: 120
  133. },
  134. {
  135. userId: this.$store.state.user.name,
  136. functionId: 5011,
  137. serialNumber: '5011Table2PartNo',
  138. tableId: '5011Table2',
  139. tableName: '报价详情信息表',
  140. columnProp: 'ifsPartNo',
  141. headerAlign: 'center',
  142. align: 'left',
  143. columnLabel: 'IFS物料编码',
  144. columnHidden: false,
  145. columnImage: false,
  146. columnSortable: false,
  147. sortLv: 0,
  148. status: true,
  149. fixed: '',
  150. columnWidth: 120
  151. },
  152. {
  153. userId: this.$store.state.user.name,
  154. functionId: 5011,
  155. serialNumber: '5011Table2PartDesc',
  156. tableId: '5011Table2',
  157. tableName: '报价详情信息表',
  158. columnProp: 'partDesc',
  159. headerAlign: 'center',
  160. align: 'left',
  161. columnLabel: '物料名称',
  162. columnHidden: false,
  163. columnImage: false,
  164. columnSortable: false,
  165. sortLv: 0,
  166. status: true,
  167. fixed: '',
  168. columnWidth: 240
  169. },
  170. {
  171. userId: this.$store.state.user.name,
  172. functionId: 5011,
  173. serialNumber: '5011Table2Qty',
  174. tableId: '5011Table2',
  175. tableName: '报价详情信息表',
  176. columnProp: 'qty',
  177. headerAlign: 'center',
  178. align: 'right',
  179. columnLabel: 'MOQ',
  180. columnHidden: false,
  181. columnImage: false,
  182. columnSortable: false,
  183. sortLv: 0,
  184. status: true,
  185. fixed: '',
  186. columnWidth: 100
  187. },
  188. {
  189. userId: this.$store.state.user.name,
  190. functionId: 5011,
  191. serialNumber: '5011Table2AdjustPartCost',
  192. tableId: '5011Table2',
  193. tableName: '报价详情信息表',
  194. columnProp: 'adjustPartCost',
  195. headerAlign: 'center',
  196. align: 'right',
  197. columnLabel: '材料成本',
  198. columnHidden: false,
  199. columnImage: false,
  200. columnSortable: false,
  201. sortLv: 0,
  202. status: true,
  203. fixed: '',
  204. columnWidth: 130
  205. },
  206. {
  207. userId: this.$store.state.user.name,
  208. functionId: 5011,
  209. serialNumber: '5011Table2AdjustLabourCost',
  210. tableId: '5011Table2',
  211. tableName: '报价详情信息表',
  212. columnProp: 'adjustLabourCost',
  213. headerAlign: 'center',
  214. align: 'right',
  215. columnLabel: '人工成本',
  216. columnHidden: false,
  217. columnImage: false,
  218. columnSortable: false,
  219. sortLv: 0,
  220. status: true,
  221. fixed: '',
  222. columnWidth: 120
  223. },
  224. {
  225. userId: this.$store.state.user.name,
  226. functionId: 5011,
  227. serialNumber: '5011Table2AdjustMachineCost',
  228. tableId: '5011Table2',
  229. tableName: '报价详情信息表',
  230. columnProp: 'adjustMachineCost',
  231. headerAlign: 'center',
  232. align: 'right',
  233. columnLabel: '机器成本',
  234. columnHidden: false,
  235. columnImage: false,
  236. columnSortable: false,
  237. sortLv: 0,
  238. status: true,
  239. fixed: '',
  240. columnWidth: 120
  241. },
  242. {
  243. userId: this.$store.state.user.name,
  244. functionId: 5011,
  245. serialNumber: '5011Table2AdjustToolCost',
  246. tableId: '5011Table2',
  247. tableName: '报价详情信息表',
  248. columnProp: 'adjustToolCost',
  249. headerAlign: 'center',
  250. align: 'right',
  251. columnLabel: '工具成本',
  252. columnHidden: false,
  253. columnImage: false,
  254. columnSortable: false,
  255. sortLv: 0,
  256. status: true,
  257. fixed: '',
  258. columnWidth: 120
  259. },
  260. {
  261. userId: this.$store.state.user.name,
  262. functionId: 5011,
  263. serialNumber: '5011Table2AdjustTestCost',
  264. tableId: '5011Table2',
  265. tableName: '报价详情信息表',
  266. columnProp: 'adjustTestCost',
  267. headerAlign: 'center',
  268. align: 'right',
  269. columnLabel: '测试成本',
  270. columnHidden: false,
  271. columnImage: false,
  272. columnSortable: false,
  273. sortLv: 0,
  274. status: true,
  275. fixed: '',
  276. columnWidth: 120
  277. },
  278. {
  279. userId: this.$store.state.user.name,
  280. functionId: 5011,
  281. serialNumber: '5011Table2AdjustElseCost',
  282. tableId: '5011Table2',
  283. tableName: '报价详情信息表',
  284. columnProp: 'adjustElseCost',
  285. headerAlign: 'center',
  286. align: 'right',
  287. columnLabel: '其他成本',
  288. columnHidden: false,
  289. columnImage: false,
  290. columnSortable: false,
  291. sortLv: 0,
  292. status: true,
  293. fixed: '',
  294. columnWidth: 120
  295. },
  296. {
  297. userId: this.$store.state.user.name,
  298. functionId: 5011,
  299. serialNumber: '5011Table2TotalCost',
  300. tableId: '5011Table2',
  301. tableName: '报价详情信息表',
  302. columnProp: 'totalCost',
  303. headerAlign: 'center',
  304. align: 'right',
  305. columnLabel: '总成本',
  306. columnHidden: false,
  307. columnImage: false,
  308. columnSortable: false,
  309. sortLv: 0,
  310. status: true,
  311. fixed: '',
  312. columnWidth: 80
  313. },
  314. {
  315. userId: this.$store.state.user.name,
  316. functionId: 5011,
  317. serialNumber: '5011Table2QuoteProfitRate',
  318. tableId: '5011Table2',
  319. tableName: '报价详情信息表',
  320. columnProp: 'quoteProfitRate',
  321. headerAlign: 'center',
  322. align: 'right',
  323. columnLabel: 'VA%',
  324. columnHidden: false,
  325. columnImage: false,
  326. columnSortable: false,
  327. sortLv: 0,
  328. status: true,
  329. fixed: '',
  330. columnWidth: 80
  331. },
  332. {
  333. userId: this.$store.state.user.name,
  334. functionId: 5011,
  335. serialNumber: '5011Table2QuoteProfitAmount',
  336. tableId: '5011Table2',
  337. tableName: '报价详情信息表',
  338. columnProp: 'quoteProfitAmount',
  339. headerAlign: 'center',
  340. align: 'right',
  341. columnLabel: 'Contribution%',
  342. columnHidden: false,
  343. columnImage: false,
  344. columnSortable: false,
  345. sortLv: 0,
  346. status: true,
  347. fixed: '',
  348. columnWidth: 100
  349. },
  350. {
  351. userId: this.$store.state.user.name,
  352. functionId: 5011,
  353. serialNumber: '5011Table2QuoteTaxRate',
  354. tableId: '5011Table2',
  355. tableName: '报价详情信息表',
  356. columnProp: 'quoteTaxRate',
  357. headerAlign: 'center',
  358. align: 'right',
  359. columnLabel: 'Margin%',
  360. columnHidden: false,
  361. columnImage: false,
  362. columnSortable: false,
  363. sortLv: 0,
  364. status: true,
  365. fixed: '',
  366. columnWidth: 80
  367. },
  368. {
  369. userId: this.$store.state.user.name,
  370. functionId: 5011,
  371. serialNumber: '5011Table2QuoteTaxTotalPrice',
  372. tableId: '5011Table2',
  373. tableName: '报价详情信息表',
  374. columnProp: 'quoteTaxTotalPrice',
  375. headerAlign: 'center',
  376. align: 'right',
  377. columnLabel: 'Price ¥(ex VAT)',
  378. columnHidden: false,
  379. columnImage: false,
  380. columnSortable: false,
  381. sortLv: 0,
  382. status: true,
  383. fixed: '',
  384. columnWidth: 100
  385. },
  386. {
  387. userId: this.$store.state.user.name,
  388. functionId: 5011,
  389. serialNumber: '5011Table2Qty',
  390. tableId: '5011Table2',
  391. tableName: '报价详情信息表',
  392. columnProp: 'unitPrice',
  393. headerAlign: 'center',
  394. align: 'right',
  395. columnLabel: '未税单价',
  396. columnHidden: false,
  397. columnImage: false,
  398. columnSortable: false,
  399. sortLv: 0,
  400. status: true,
  401. fixed: '',
  402. columnWidth: 100
  403. },
  404. {
  405. userId: this.$store.state.user.name,
  406. functionId: 5011,
  407. serialNumber: '5011Table2Qty',
  408. tableId: '5011Table2',
  409. tableName: '报价详情信息表',
  410. columnProp: 'taxRate',
  411. headerAlign: 'center',
  412. align: 'right',
  413. columnLabel: '税率',
  414. columnHidden: false,
  415. columnImage: false,
  416. columnSortable: false,
  417. sortLv: 0,
  418. status: true,
  419. fixed: '',
  420. columnWidth: 100
  421. },
  422. {
  423. userId: this.$store.state.user.name,
  424. functionId: 5011,
  425. serialNumber: '5011Table2Qty',
  426. tableId: '5011Table2',
  427. tableName: '报价详情信息表',
  428. columnProp: 'exchangeRate1',
  429. headerAlign: 'center',
  430. align: 'right',
  431. columnLabel: '其他税率',
  432. columnHidden: false,
  433. columnImage: false,
  434. columnSortable: false,
  435. sortLv: 0,
  436. status: true,
  437. fixed: '',
  438. columnWidth: 100
  439. },
  440. {
  441. userId: this.$store.state.user.name,
  442. functionId: 5011,
  443. serialNumber: '5011Table2Qty',
  444. tableId: '5011Table2',
  445. tableName: '报价详情信息表',
  446. columnProp: 'taxUnitPrice',
  447. headerAlign: 'center',
  448. align: 'right',
  449. columnLabel: '含税单价(CNY)',
  450. columnHidden: false,
  451. columnImage: false,
  452. columnSortable: false,
  453. sortLv: 0,
  454. status: true,
  455. fixed: '',
  456. columnWidth: 100
  457. },
  458. {
  459. userId: this.$store.state.user.name,
  460. functionId: 5011,
  461. serialNumber: '5011Table2Qty',
  462. tableId: '5011Table2',
  463. tableName: '报价详情信息表',
  464. columnProp: 'currencyDesc2',
  465. headerAlign: 'center',
  466. align: 'right',
  467. columnLabel: '币种',
  468. columnHidden: false,
  469. columnImage: false,
  470. columnSortable: false,
  471. sortLv: 0,
  472. status: true,
  473. fixed: '',
  474. columnWidth: 100
  475. },
  476. {
  477. userId: this.$store.state.user.name,
  478. functionId: 5011,
  479. serialNumber: '5011Table2Qty',
  480. tableId: '5011Table2',
  481. tableName: '报价详情信息表',
  482. columnProp: 'exchangeRate2',
  483. headerAlign: 'center',
  484. align: 'right',
  485. columnLabel: '汇率',
  486. columnHidden: false,
  487. columnImage: false,
  488. columnSortable: false,
  489. sortLv: 0,
  490. status: true,
  491. fixed: '',
  492. columnWidth: 100
  493. },
  494. {
  495. userId: this.$store.state.user.name,
  496. functionId: 5011,
  497. serialNumber: '5011Table2Qty',
  498. tableId: '5011Table2',
  499. tableName: '报价详情信息表',
  500. columnProp: 'currencyTotalCost2',
  501. headerAlign: 'center',
  502. align: 'right',
  503. columnLabel: '含税单价',
  504. columnHidden: false,
  505. columnImage: false,
  506. columnSortable: false,
  507. sortLv: 0,
  508. status: true,
  509. fixed: '',
  510. columnWidth: 100
  511. },
  512. {
  513. userId: this.$store.state.user.name,
  514. functionId: 5011,
  515. serialNumber: '5011Table2Remark',
  516. tableId: '5011Table2',
  517. tableName: '报价详情信息表',
  518. columnProp: 'remark',
  519. headerAlign: 'center',
  520. align: 'left',
  521. columnLabel: '备注',
  522. columnHidden: false,
  523. columnImage: false,
  524. columnSortable: false,
  525. sortLv: 0,
  526. status: true,
  527. fixed: '',
  528. columnWidth: 120
  529. },
  530. ],
  531. partVisible:false,
  532. activeName:'bom',
  533. projectPart:{
  534. },
  535. projectPartList:[],
  536. pageNo:1,
  537. pageSize:20,
  538. pageTotal:0,
  539. partQueryLoading:false,
  540. projectPartColumns:[
  541. {
  542. userId: this.$store.state.user.name,
  543. functionId: 5011,
  544. serialNumber: '5011Table3TestPartNo',
  545. tableId: '5011Table3',
  546. tableName: '项目物料表',
  547. columnProp: 'testPartNo',
  548. headerAlign: 'center',
  549. align: 'left',
  550. columnLabel: '物料编码',
  551. columnHidden: false,
  552. columnImage: false,
  553. columnSortable: false,
  554. sortLv: 0,
  555. status: true,
  556. fixed: '',
  557. columnWidth: 150
  558. },
  559. {
  560. userId: this.$store.state.user.name,
  561. functionId: 5011,
  562. serialNumber: '5011Table3PartDesc',
  563. tableId: '5011Table3',
  564. tableName: '项目物料表',
  565. columnProp: 'partDesc',
  566. headerAlign: 'center',
  567. align: 'left',
  568. columnLabel: '物料名称',
  569. columnHidden: false,
  570. columnImage: false,
  571. columnSortable: false,
  572. sortLv: 0,
  573. status: true,
  574. fixed: '',
  575. columnWidth: 120
  576. },
  577. {
  578. userId: this.$store.state.user.name,
  579. functionId: 5011,
  580. serialNumber: '5011Table3FinalPartNo',
  581. tableId: '5011Table3',
  582. tableName: '项目物料表',
  583. columnProp: 'finalPartNo',
  584. headerAlign: 'center',
  585. align: 'left',
  586. columnLabel: 'IFS物料编码',
  587. columnHidden: false,
  588. columnImage: false,
  589. columnSortable: false,
  590. sortLv: 0,
  591. status: true,
  592. fixed: '',
  593. columnWidth: 150
  594. },
  595. {
  596. userId: this.$store.state.user.name,
  597. functionId: 5011,
  598. serialNumber: '5011Table3CustomerPartNo',
  599. tableId: '5011Table3',
  600. tableName: '项目物料表',
  601. columnProp: 'customerPartNo',
  602. headerAlign: 'center',
  603. align: 'left',
  604. columnLabel: '客户物料编码',
  605. columnHidden: false,
  606. columnImage: false,
  607. columnSortable: false,
  608. sortLv: 0,
  609. status: true,
  610. fixed: '',
  611. columnWidth: 150
  612. },
  613. {
  614. userId: this.$store.state.user.name,
  615. functionId: 5011,
  616. serialNumber: '5011Table3Type',
  617. tableId: '5011Table3',
  618. tableName: '项目物料表',
  619. columnProp: 'type',
  620. headerAlign: 'center',
  621. align: 'left',
  622. columnLabel: '制造类型',
  623. columnHidden: false,
  624. columnImage: false,
  625. columnSortable: false,
  626. sortLv: 0,
  627. status: true,
  628. fixed: '',
  629. columnWidth: 120
  630. },
  631. {
  632. userId: this.$store.state.user.name,
  633. functionId: 5011,
  634. serialNumber: '5011Table3UmId',
  635. tableId: '5011Table3',
  636. tableName: '项目物料表',
  637. columnProp: 'umId',
  638. headerAlign: 'center',
  639. align: 'left',
  640. columnLabel: '单位',
  641. columnHidden: false,
  642. columnImage: false,
  643. columnSortable: false,
  644. sortLv: 0,
  645. status: true,
  646. fixed: '',
  647. columnWidth: 100
  648. },
  649. ],
  650. drawerVisible: false,
  651. quoteGroupDetail:{
  652. id:-1,
  653. },
  654. }
  655. },
  656. methods:{
  657. handleSaveQuoteDetail(row){
  658. this.$nextTick(()=>{
  659. if (this.$refs.handleSaveQuoteDetailClick){
  660. this.$refs.saveQuoteDetailForm.clearValidate();
  661. }
  662. })
  663. if (row){
  664. this.saveQuoteDetail = {
  665. ...row
  666. }
  667. }else {
  668. this.saveQuoteDetail = {
  669. ...this.quoteDetail,
  670. createBy:this.$store.state.user.name,
  671. status:'草稿',
  672. active:'Y',
  673. qty:1,
  674. isDetail:false,
  675. }
  676. this.$nextTick(()=>{
  677. this.saveQuoteDetail.projectNo = this.quote.projectNo
  678. })
  679. }
  680. this.activeName = 'bom';
  681. this.saveVisible = true;
  682. },
  683. handleDeleteQuoteDetail(row){
  684. this.$alert('确认删除该条报价明细吗?', '提示', {
  685. confirmButtonText: '确定',
  686. cancelButtonText: '取消',
  687. type: 'warning'
  688. }).then(() => {
  689. let params = {
  690. id: row.id,
  691. }
  692. removeQuoteGroupDetail(params).then(({data}) => {
  693. if (data && data.code === 0) {
  694. this.$message.success(data.msg);
  695. this.handleQueryQuoteDetail();
  696. } else {
  697. this.$message.warning(data.msg);
  698. }
  699. }).catch((error) => {
  700. this.$message.error(error);
  701. })
  702. }).catch(() => {
  703. })
  704. },
  705. handlePartNoBlur(){
  706. let params = {
  707. site:this.$store.state.user.site,
  708. testPartNo:this.saveQuoteDetail.partNo,
  709. projectId: this.quote.projectNo,
  710. no:1,
  711. size:20,
  712. }
  713. getProjectPartList(params).then(({data})=>{
  714. if (data && data.code === 0){
  715. if (data.rows && data.rows.length === 1){
  716. this.dblClickProjectPartTable(data.rows[0])
  717. }else {
  718. this.saveQuoteDetail.partDesc = ''
  719. }
  720. }
  721. })
  722. },
  723. handleQueryQuoteDetail(val){
  724. let params = {
  725. quoteId: this.quote.id,
  726. }
  727. if (!val){
  728. this.queryLoading = true;
  729. }
  730. queryQuoteGroupDetail(params).then(({data})=>{
  731. if (data && data.code === 0){
  732. this.dataList = data.rows
  733. }else {
  734. this.$message.warning(data.msg);
  735. }
  736. this.queryLoading = false;
  737. }).catch((error)=>{
  738. this.$message.error(error);
  739. this.queryLoading = false;
  740. })
  741. },
  742. handleSaveQuoteDetailClick(){
  743. this.$refs.saveQuoteDetailForm.validate((valid,obj) => {
  744. if (valid){
  745. if (this.saveQuoteDetail.id){
  746. this.handleUpdate();
  747. }else {
  748. this.handleSave();
  749. }
  750. }else {
  751. let i = 1;
  752. for (let key in obj) {
  753. this.$message.error(obj[key][0].message);
  754. if (i === 1){
  755. return
  756. }
  757. i++;
  758. }
  759. }
  760. })
  761. },
  762. handleSave(){
  763. let params = {
  764. ...this.saveQuoteDetail,
  765. quoteId: this.quote.id,
  766. quoteNo:this.quote.quoteNo,
  767. site:this.quote.site,
  768. buNo:this.quote.buNo,
  769. versionNo:this.quote.versionNo,
  770. createBy:this.saveQuoteDetail.createBy,
  771. active:'Y',
  772. status:'草稿',
  773. internalInquiryNo:this.quote.insideInquiryNo,
  774. }
  775. this.saveLoading = true;
  776. saveQuoteGroupDetail(params).then(({data})=>{
  777. if (data && data.code === 0){
  778. this.$message.success(data.msg);
  779. this.handleQueryQuoteDetail();
  780. if (this.saveQuoteDetail.isDetail){
  781. this.saveQuoteDetail = {
  782. ...data.row,
  783. }
  784. }else {
  785. this.saveVisible = false;
  786. }
  787. }else {
  788. this.$message.warning(data.msg);
  789. }
  790. this.saveLoading = false
  791. }).catch((error)=>{
  792. this.$message.error(error);
  793. this.saveLoading = false
  794. })
  795. },
  796. handleUpdate(){
  797. let params = {
  798. ...this.saveQuoteDetail,
  799. updateBy:this.$store.state.user.name,
  800. }
  801. updateQuoteDetail(params).then(({data})=>{
  802. if (data && data.code === 0){
  803. this.$message.success(data.msg);
  804. this.handleQueryQuoteDetail();
  805. this.saveVisible = false;
  806. }else {
  807. this.$message.warning(data.msg);
  808. }
  809. }).catch((error)=>{
  810. this.$message.error(error);
  811. })
  812. },
  813. handleClickTab(tab){
  814. if (this.activeName === 'routing'){
  815. this.$refs.routing.handleQueryQuoteDetailBomTree()
  816. }else if (this.activeName === 'tool'){
  817. this.$refs.tool.handleQueryQuoteDetailTool();
  818. }
  819. },
  820. handleQueryPartList(){
  821. this.projectPart = {
  822. testPartNo:this.saveQuoteDetail.partNo,
  823. partDesc:'',
  824. finalPartNo:'',
  825. customerPartNo:'',
  826. site:this.$store.state.user.site,
  827. }
  828. this.partVisible = true;
  829. this.getProjectPartList();
  830. },
  831. getProjectPartList(){
  832. let params = {
  833. ...this.projectPart,
  834. partType:'Manufactured',
  835. no:this.pageNo,
  836. size:this.pageSize,
  837. }
  838. params.projectId = this.quote.projectNo
  839. this.partQueryLoading = true;
  840. getProjectPartList(params).then(({data})=>{
  841. if (data && data.code === 0){
  842. this.projectPartList = data.rows;
  843. this.pageTotal = data.total;
  844. }
  845. this.partQueryLoading = false;
  846. }).catch((error)=>{
  847. this.partQueryLoading = false;
  848. })
  849. },
  850. handleSizeChange(val){
  851. this.pageSize = val;
  852. this.getProjectPartList();
  853. },
  854. handleCurrentChange(val){
  855. this.pageNo = val;
  856. this.getProjectPartList();
  857. },
  858. dblClickProjectPartTable(row){
  859. this.saveQuoteDetail.partNo = row.testPartNo;
  860. this.saveQuoteDetail.partDesc = row.partDesc;
  861. this.partVisible = false;
  862. },
  863. handleQueryQuoteDetailByDetailId(row){
  864. this.quoteGroupDetail = {
  865. ...row
  866. }
  867. this.drawerVisible = true;
  868. },
  869. rowStyle({row}){
  870. if (row.id === this.quoteGroupDetail.id){
  871. return {background:'#E8F7F6'}
  872. }
  873. },
  874. quoteGroupDetailRowClick(row){
  875. this.quoteGroupDetail = {
  876. ...row
  877. }
  878. },
  879. handleCurrentQuoteDetailItemNo(val){
  880. updateCurrentQuoteGroupDetailItemNo(this.quoteGroupDetail).then(({data})=>{
  881. if (data && data.code === 0){
  882. // this.$message.success(data.msg);
  883. this.handleQueryQuoteDetail(true);
  884. }else {
  885. this.$message.warning(data.msg);
  886. this.quoteGroupDetail.currentQuoteDetailItemNo = val;
  887. }
  888. }).catch((error)=>{
  889. this.$message.error(error);
  890. this.quoteGroupDetail.currentQuoteDetailItemNo = val;
  891. })
  892. },
  893. handleClose(){
  894. this.drawerVisible = false;
  895. this.saveVisible = false;
  896. },
  897. toPartMenu (partNo) {
  898. if (this.$router.resolve(`/part-partInformation`).resolved.name === '404') {
  899. this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',})
  900. } else {
  901. this.$router.push({name:`part-partInformation`,params:{partNo:partNo},})
  902. }
  903. },
  904. },
  905. watch:{
  906. quote(newVal,oldVal){
  907. if (newVal.id){
  908. this.quoteDetail.profitRate = this.quote.markup
  909. this.quoteDetail.quoteProfitRate = this.quote.markup
  910. this.handleQueryQuoteDetail();
  911. }else {
  912. this.dataList = [];
  913. }
  914. },
  915. "saveQuoteDetail.partNo"(newVal,oldVal){
  916. if (newVal){
  917. this.saveQuoteDetail.partNo = newVal.toUpperCase();
  918. }
  919. },
  920. partVisible(newVal,oldVal){
  921. if (newVal === false){
  922. this.partQueryLoading = false
  923. this.pageNo = 1;
  924. this.projectPartList = [];
  925. }
  926. }
  927. }
  928. }
  929. </script>
  930. <template>
  931. <div>
  932. <template v-if="isAuth('5011:group:save')">
  933. <el-button type="primary" v-if="!authFlag" :disabled="quote.status === '下达' || !quote.status" @click="handleSaveQuoteDetail(null)">新增</el-button>
  934. </template>
  935. <el-table v-loading="queryLoading" border :data="dataList" style="width: 100%;margin-top: 5px" :height="height">
  936. <el-table-column type="index" width="55" align="center" label="序号"></el-table-column>
  937. <el-table-column
  938. v-for="(item,index) in columns" :key="index"
  939. :sortable="item.columnSortable"
  940. :prop="item.columnProp"
  941. :header-align="item.headerAlign"
  942. :show-overflow-tooltip="item.showOverflowTooltip"
  943. :align="item.align"
  944. :fixed="item.fixed === ''?false:item.fixed"
  945. :min-width="item.columnWidth"
  946. :label="item.columnLabel">
  947. <template slot-scope="scope">
  948. <template v-if="item.columnProp === 'partNo'">
  949. <el-link style="cursor:pointer;" v-if="!item.columnHidden" @click="toPartMenu(scope.row.partNo)"> {{ scope.row[item.columnProp] }}</el-link>
  950. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  951. </template>
  952. <template v-else>
  953. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  954. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  955. style="width: 100px; height: 80px"/></span>
  956. </template>
  957. </template>
  958. </el-table-column>
  959. <el-table-column label="操作" v-if="!authFlag" fixed="right" align="center" width="120">
  960. <template slot-scope="{row,$index}">
  961. <template v-if="isAuth('5011:group:remove')">
  962. <a type="text" v-if="row.status === '草稿'" @click="handleDeleteQuoteDetail(row)">删除</a>
  963. </template>
  964. <template v-if="isAuth('5011:group:list')">
  965. <a @click="handleQueryQuoteDetailByDetailId(row)">条目明细</a>
  966. </template>
  967. </template>
  968. </el-table-column>
  969. </el-table>
  970. <el-dialog :title="`报价明细`" top="10vh" v-drag :visible.sync="saveVisible" append-to-body :width="`${saveQuoteDetail.id?1200:600}px`" :close-on-click-modal="false">
  971. <el-form :model="saveQuoteDetail" ref="saveQuoteDetailForm" :rules="saveQuoteDetailRules" label-position="top" v-if="!saveQuoteDetail.id">
  972. <el-row :gutter="20">
  973. <el-col :span="8">
  974. <el-form-item label="物料编码" prop="partNo" :show-message="false">
  975. <span slot="label">
  976. <a @click="handleQueryPartList">物料编码</a>
  977. </span>
  978. <el-input v-model="saveQuoteDetail.partNo" @change="handlePartNoBlur"></el-input>
  979. </el-form-item>
  980. </el-col>
  981. <el-col :span="16">
  982. <el-form-item label="物料描述" prop="partDesc" :show-message="false">
  983. <el-input v-model="saveQuoteDetail.partDesc" disabled></el-input>
  984. </el-form-item>
  985. </el-col>
  986. <el-col :span="8">
  987. <el-form-item label="MOQ" prop="qty" :show-message="false">
  988. <el-input-number style="width: 100%;" v-model="saveQuoteDetail.qty" :min="1" :step="0" :precision="0" :controls="false"></el-input-number>
  989. </el-form-item>
  990. </el-col>
  991. <el-col :span="8">
  992. <el-form-item label="币种" prop="currency1" :show-message="false">
  993. <dict-data-select style="width: 100%" v-if="saveVisible" dict-type="plm_customer_information_customer_customer_currency" v-model="saveQuoteDetail.currency1"></dict-data-select>
  994. </el-form-item>
  995. </el-col>
  996. </el-row>
  997. <el-row :gutter="20">
  998. <el-col :span="8">
  999. <el-form-item label="" :show-message="false">
  1000. <el-checkbox v-model="saveQuoteDetail.isDetail">保存进入报价页面</el-checkbox>
  1001. </el-form-item>
  1002. </el-col>
  1003. <el-col :span="24">
  1004. <el-form-item label="备注" class="auto" :show-message="false">
  1005. <el-input type="textarea" v-model="saveQuoteDetail.remark" :autosize="{minRows: 3, maxRows: 3}"></el-input>
  1006. </el-form-item>
  1007. </el-col>
  1008. </el-row>
  1009. </el-form>
  1010. <el-form v-else :model="saveQuoteDetail" ref="saveQuoteDetailForm" :rules="saveQuoteDetailRules" label-position="top">
  1011. <el-row :gutter="20">
  1012. <el-col :span="4">
  1013. <el-form-item label="物料编码" prop="partNo" :show-message="false">
  1014. <el-input v-model="saveQuoteDetail.partNo" disabled></el-input>
  1015. </el-form-item>
  1016. </el-col>
  1017. <el-col :span="6">
  1018. <el-form-item label="物料描述" prop="partDesc" :show-message="false">
  1019. <el-input v-model="saveQuoteDetail.partDesc" disabled></el-input>
  1020. </el-form-item>
  1021. </el-col>
  1022. <el-col :span="3">
  1023. <el-form-item label="MOQ" prop="qty" :show-message="false">
  1024. <el-input-number v-model="saveQuoteDetail.qty" style="width: 100%;" :controls="false" :disabled="saveQuoteDetail.status === '下达'"></el-input-number>
  1025. </el-form-item>
  1026. </el-col>
  1027. <el-col :span="3">
  1028. <el-form-item label="币种" prop="currency1" :show-message="false">
  1029. <dict-data-select :disabled="saveQuoteDetail.status === '下达'" style="width: 100%" dict-type="plm_customer_information_customer_customer_currency" v-model="saveQuoteDetail.currency1"></dict-data-select>
  1030. </el-form-item>
  1031. </el-col>
  1032. </el-row>
  1033. <el-row :gutter="20">
  1034. <el-col :span="16">
  1035. <el-form-item label="备注" class="auto" :show-message="false">
  1036. <el-input type="textarea" resize="none" :autosize="{minRows: 3, maxRows: 3}" v-model="saveQuoteDetail.remark" :disabled="saveQuoteDetail.status === '下达'"></el-input>
  1037. </el-form-item>
  1038. </el-col>
  1039. </el-row>
  1040. </el-form>
  1041. <el-tabs v-model="activeName" v-if="saveQuoteDetail.id" @tab-click="handleClickTab">
  1042. <el-tab-pane label="材料" name="bom">
  1043. <quote-detail-bom v-if="saveVisible" @close="handleClose" v-model:quoteDetail="saveQuoteDetail"></quote-detail-bom>
  1044. </el-tab-pane>
  1045. <el-tab-pane label="工艺" name="routing">
  1046. <quote-detail-routing ref="routing" v-if="saveVisible" @close="handleClose" v-model:quoteDetail="saveQuoteDetail"></quote-detail-routing>
  1047. </el-tab-pane>
  1048. <el-tab-pane label="工具" name="tool">
  1049. <quote-detail-tool ref="tool" v-if="saveVisible" v-model:quoteDetail="saveQuoteDetail"></quote-detail-tool>
  1050. </el-tab-pane>
  1051. <el-tab-pane label="测试" name="test">
  1052. <quote-detail-test v-if="saveVisible" v-model:quoteDetail="saveQuoteDetail"></quote-detail-test>
  1053. </el-tab-pane>
  1054. <el-tab-pane label="包装&运输" name="otherCost">
  1055. <quote-detail-other-cost v-if="saveVisible" v-model:quoteDetail="saveQuoteDetail"></quote-detail-other-cost>
  1056. </el-tab-pane>
  1057. <el-tab-pane label="其他" name="other">
  1058. <quote-detail-other v-if="saveVisible" v-model:quoteDetail="saveQuoteDetail"></quote-detail-other>
  1059. </el-tab-pane>
  1060. <el-tab-pane label="成本&价格" name="cost">
  1061. <quote-detail-cost v-if="saveVisible" ref="cost" v-model:quoteDetail="saveQuoteDetail"></quote-detail-cost>
  1062. </el-tab-pane>
  1063. </el-tabs>
  1064. <div slot="footer" class="dialog-footer">
  1065. <el-button type="primary" v-if="saveQuoteDetail.status === '草稿'" :loading="saveLoading" @click="handleSaveQuoteDetailClick"> </el-button>
  1066. <el-button @click="saveVisible = false"> </el-button>
  1067. </div>
  1068. </el-dialog>
  1069. <el-dialog v-drag title="物料信息" append-to-body :close-on-click-modal="false" :visible.sync="partVisible">
  1070. <!--搜索条件-->
  1071. <el-form :model="projectPart" ref="projectPartDataForm" :inline="true" label-position="top">
  1072. <el-form-item label="物料编码" prop="testPartNo">
  1073. <el-input v-model="projectPart.testPartNo" clearable/>
  1074. </el-form-item>
  1075. <el-form-item label="物料名称" prop="partDesc">
  1076. <el-input v-model="projectPart.partDesc" clearable/>
  1077. </el-form-item>
  1078. <el-form-item label="IFS物料编码" prop="finalPartNo">
  1079. <el-input v-model="projectPart.finalPartNo" clearable/>
  1080. </el-form-item>
  1081. <el-form-item label="客户物料编码" prop="customerPartNo">
  1082. <el-input v-model="projectPart.customerPartNo" clearable/>
  1083. </el-form-item>
  1084. <el-form-item label=" ">
  1085. <el-button @click="getProjectPartList" type="primary"> </el-button>
  1086. </el-form-item>
  1087. </el-form>
  1088. <el-table height="300px" v-loading="partQueryLoading" stripe border @row-dblclick="dblClickProjectPartTable" :data="projectPartList" ref="projectPartDataTable" :style="{marginTop:'10px'}">
  1089. <el-table-column
  1090. v-for="(item,index) in projectPartColumns" :key="index"
  1091. :sortable="item.columnSortable"
  1092. :prop="item.columnProp"
  1093. :header-align="item.headerAlign"
  1094. :show-overflow-tooltip="item.showOverflowTooltip"
  1095. :align="item.align"
  1096. :fixed="item.fixed===''?false:item.fixed"
  1097. :min-width="item.columnWidth"
  1098. :label="item.columnLabel">
  1099. <template slot-scope="scope">
  1100. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  1101. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  1102. </template>
  1103. </el-table-column>
  1104. </el-table>
  1105. <el-pagination style="margin-top: 0"
  1106. @size-change="handleSizeChange"
  1107. @current-change="handleCurrentChange"
  1108. :current-page="pageNo"
  1109. :page-sizes="[20, 50, 100, 200, 500]"
  1110. :page-size="pageSize"
  1111. :total="pageTotal"
  1112. layout="total,sizes, prev, pager, next, jumper">
  1113. </el-pagination>
  1114. </el-dialog>
  1115. <el-dialog title="报价明细" v-drag :visible.sync="drawerVisible" top="10vh" width="1200px" append-to-body :close-on-click-modal="false">
  1116. <el-table v-loading="queryLoading"
  1117. @row-click="quoteGroupDetailRowClick" :row-style="rowStyle" border :data="dataList" style="width: 100%;margin-top: 5px;" :height="'30vh'">
  1118. <el-table-column type="index" width="55" align="center" label="序号"></el-table-column>
  1119. <el-table-column
  1120. v-for="(item,index) in columns" :key="index"
  1121. :sortable="item.columnSortable"
  1122. :prop="item.columnProp"
  1123. :header-align="item.headerAlign"
  1124. :show-overflow-tooltip="item.showOverflowTooltip"
  1125. :align="item.align"
  1126. :fixed="item.fixed === ''?false:item.fixed"
  1127. :min-width="item.columnWidth"
  1128. :label="item.columnLabel">
  1129. <template slot-scope="scope">
  1130. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  1131. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  1132. style="width: 100px; height: 80px"/></span>
  1133. </template>
  1134. </el-table-column>
  1135. </el-table>
  1136. <quote-detail
  1137. v-if="drawerVisible"
  1138. style="margin-top: 20px"
  1139. :save-auth="isAuth('5011:detail:save')"
  1140. @close="handleClose"
  1141. :quote="quote"
  1142. :quote-group-detail="quoteGroupDetail"
  1143. :auth-flag="false"
  1144. :height="'33vh'"
  1145. @currentQuoteDetailItemNo="handleCurrentQuoteDetailItemNo">
  1146. </quote-detail>
  1147. <div slot="footer" class="dialog-footer">
  1148. <el-button @click="drawerVisible = false"> </el-button>
  1149. </div>
  1150. </el-dialog>
  1151. <!-- <part-table v-if="saveVisible" v-model="partVisible" :is-page="true" :part-no="saveQuoteDetail.partNo" @dblclick="handleDblClick"></part-table>-->
  1152. <!-- <project-part-table v-if="saveVisible" v-model="partVisible" :project-no="saveQuoteDetail.projectNo" :part-no="saveQuoteDetail.partNo" @dblclick="handleDblClick"></project-part-table>-->
  1153. </div>
  1154. </template>
  1155. <style scoped>
  1156. .el-table /deep/ .cell{
  1157. height: auto;
  1158. line-height: 1.5;
  1159. }
  1160. .auto /deep/ .el-form-item__content{
  1161. height: auto;
  1162. line-height: 1.5;
  1163. }
  1164. </style>