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.

867 lines
29 KiB

1 year ago
1 year ago
1 year 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
1 year 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
1 year ago
1 year 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
1 year ago
1 year ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
9 months ago
1 year ago
9 months ago
1 year ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
9 months ago
1 year ago
9 months 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
9 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
9 months ago
1 year ago
9 months ago
1 year ago
9 months 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
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
1 year ago
9 months ago
1 year ago
9 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 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 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 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
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
1 year ago
10 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year 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
12 months ago
1 year ago
12 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
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 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 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
9 months ago
  1. <script>
  2. import ProjectPartTable from "../../../../components/selector/table/projectPartTable.vue";
  3. import {queryProjectPart} from "../../../../api/project/projectPart";
  4. import {
  5. againQuoteDetail,
  6. deleteQuoteDetail,
  7. queryQuoteDetail, queryQuoteDetailYield,
  8. saveQuoteDetail,
  9. updateQuoteDetail
  10. } from "../../../../api/quote/quoteDetail";
  11. import QuoteDetailCost from "./primary/quoteDetailCost.vue";
  12. import QuoteDetailTool from "./primary/quoteDetailTool.vue";
  13. import QuoteDetailBom from "./primary/quoteDetailBom.vue";
  14. import QuoteDetailRouting from "./primary/quoteDetailRouting.vue";
  15. import QuoteDetailOther from "./primary/quoteDetailOther.vue";
  16. import PartTable from "../../../../components/selector/table/partTable.vue";
  17. import {handleQueryPart} from "../../../../api/part/partInformation";
  18. import {updateColumnSize} from "../../../../api/table";
  19. import QuoteDetailCalculation from "./primary/quoteDetailCalculation.vue";
  20. import {Decimal} from "decimal.js";
  21. export default {
  22. name: "quoteDetail",
  23. components: {
  24. QuoteDetailCalculation,
  25. PartTable,
  26. QuoteDetailOther, QuoteDetailRouting, QuoteDetailBom, QuoteDetailTool, QuoteDetailCost, ProjectPartTable},
  27. props:{
  28. quote:{
  29. type:Object,
  30. required:true
  31. },
  32. authFlag:{
  33. type:Boolean,
  34. default:false
  35. },
  36. quoteGroupDetail:{
  37. type:Object,
  38. },
  39. saveAuth:{
  40. type:Boolean,
  41. default:true
  42. },
  43. height:{
  44. type:[Number,String],
  45. default:300
  46. },
  47. },
  48. data(){
  49. return{
  50. quoteDetail:{
  51. id:null,
  52. partNo:'',
  53. partDesc:'',
  54. projectNo:'',
  55. projectDesc:'',
  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. type:'Standard TP',
  96. costModel:'UFIDA',
  97. remark:'',
  98. },
  99. saveQuoteDetail:{
  100. },
  101. numberProp:['adjustBomUnYield','adjustLabourCost','adjustFabricateCost','adjustMachineCost','adjustToolCost','totalCost','weighted','weighted2'],
  102. dataList:[],
  103. saveLoading:false,
  104. queryLoading:false,
  105. saveVisible:false,
  106. saveQuoteDetailRules:{
  107. partNo: [{required: true, message: '请输入物料编码', trigger: ['blur','change']}],
  108. partDesc: [{required: true, message: '请输入物料名称', trigger: ['blur','change']}],
  109. qty: [{required: true, message: '请输入数量', trigger: ['blur','change']}],
  110. type: [{required: true, message: '请选择TP类型', trigger: ['blur','change']}],
  111. costModel: [{required: true, message: '请选择Cost Model', trigger: ['blur','change']}],
  112. },
  113. columns: [
  114. {
  115. userId: this.$store.state.user.name,
  116. functionId: 5011,
  117. serialNumber: '5011Table2PartNo',
  118. tableId: '5011Table2',
  119. tableName: '报价详情信息表',
  120. columnProp: 'partNo',
  121. headerAlign: 'center',
  122. align: 'left',
  123. columnLabel: 'Quotation Code',
  124. columnHidden: false,
  125. columnImage: false,
  126. columnSortable: false,
  127. sortLv: 0,
  128. status: true,
  129. fixed: '',
  130. columnWidth: 68
  131. },
  132. {
  133. userId: this.$store.state.user.name,
  134. functionId: 5011,
  135. serialNumber: '5011Table2PartDesc',
  136. tableId: '5011Table2',
  137. tableName: '报价详情信息表',
  138. columnProp: 'partDesc',
  139. headerAlign: 'center',
  140. align: 'left',
  141. columnLabel: 'Description',
  142. columnHidden: false,
  143. columnImage: false,
  144. columnSortable: false,
  145. sortLv: 0,
  146. status: true,
  147. fixed: '',
  148. columnWidth: 180
  149. },
  150. {
  151. userId: this.$store.state.user.name,
  152. functionId: 5011,
  153. serialNumber: '5011Table2CostModel',
  154. tableId: '5011Table2',
  155. tableName: '报价详情信息表',
  156. columnProp: 'costModel',
  157. headerAlign: 'center',
  158. align: 'left',
  159. columnLabel: 'Cost Model',
  160. columnHidden: false,
  161. columnImage: false,
  162. columnSortable: false,
  163. sortLv: 0,
  164. status: true,
  165. fixed: '',
  166. columnWidth: 48
  167. },
  168. {
  169. userId: this.$store.state.user.name,
  170. functionId: 5011,
  171. serialNumber: '5011Table2Qty',
  172. tableId: '5011Table2',
  173. tableName: '报价详情信息表',
  174. columnProp: 'qty',
  175. headerAlign: 'center',
  176. align: 'right',
  177. columnLabel: 'MOQ',
  178. columnHidden: false,
  179. columnImage: false,
  180. columnSortable: false,
  181. sortLv: 0,
  182. status: true,
  183. fixed: '',
  184. columnWidth: 70
  185. },
  186. {
  187. userId: this.$store.state.user.name,
  188. functionId: 5011,
  189. serialNumber: '5011Table2AdjustBomUnYield',
  190. tableId: '5011Table2',
  191. tableName: '报价详情信息表',
  192. columnProp: 'adjustBomUnYield',
  193. headerAlign: 'center',
  194. align: 'right',
  195. columnLabel: 'FG BOM Cost',
  196. columnHidden: false,
  197. columnImage: false,
  198. columnSortable: false,
  199. sortLv: 0,
  200. status: true,
  201. fixed: '',
  202. columnWidth: 60
  203. },
  204. {
  205. userId: this.$store.state.user.name,
  206. functionId: 5011,
  207. serialNumber: '5011Table2AdjustLabourCost',
  208. tableId: '5011Table2',
  209. tableName: '报价详情信息表',
  210. columnProp: 'adjustLabourCost',
  211. headerAlign: 'center',
  212. align: 'right',
  213. columnLabel: 'DL',
  214. columnHidden: false,
  215. columnImage: false,
  216. columnSortable: false,
  217. sortLv: 0,
  218. status: true,
  219. fixed: '',
  220. columnWidth: 55
  221. },
  222. {
  223. userId: this.$store.state.user.name,
  224. functionId: 5011,
  225. serialNumber: '5011Table2AdjustFabricateCost',
  226. tableId: '5011Table2',
  227. tableName: '报价详情信息表',
  228. columnProp: 'adjustFabricateCost',
  229. headerAlign: 'center',
  230. align: 'right',
  231. columnLabel: 'VOH',
  232. columnHidden: false,
  233. columnImage: false,
  234. columnSortable: false,
  235. sortLv: 0,
  236. status: true,
  237. fixed: '',
  238. columnWidth: 55
  239. },
  240. {
  241. userId: this.$store.state.user.name,
  242. functionId: 5011,
  243. serialNumber: '5011Table2AdjustMachineCost',
  244. tableId: '5011Table2',
  245. tableName: '报价详情信息表',
  246. columnProp: 'adjustMachineCost',
  247. headerAlign: 'center',
  248. align: 'right',
  249. columnLabel: 'FOH',
  250. columnHidden: false,
  251. columnImage: false,
  252. columnSortable: false,
  253. sortLv: 0,
  254. status: true,
  255. fixed: '',
  256. columnWidth: 55
  257. },
  258. {
  259. userId: this.$store.state.user.name,
  260. functionId: 5011,
  261. serialNumber: '5011Table2AdjustToolCost',
  262. tableId: '5011Table2',
  263. tableName: '报价详情信息表',
  264. columnProp: 'adjustToolCost',
  265. headerAlign: 'center',
  266. align: 'right',
  267. columnLabel: 'Tooling Cost',
  268. columnHidden: false,
  269. columnImage: false,
  270. columnSortable: false,
  271. sortLv: 0,
  272. status: true,
  273. fixed: '',
  274. columnWidth: 55
  275. },
  276. {
  277. userId: this.$store.state.user.name,
  278. functionId: 5011,
  279. serialNumber: '5011Table2TotalCost',
  280. tableId: '5011Table2',
  281. tableName: '报价详情信息表',
  282. columnProp: 'totalCost',
  283. headerAlign: 'center',
  284. align: 'right',
  285. columnLabel: 'Total Cost(RMB/KCT)',
  286. columnHidden: false,
  287. columnImage: false,
  288. columnSortable: false,
  289. sortLv: 0,
  290. status: true,
  291. fixed: '',
  292. columnWidth: 75
  293. },
  294. {
  295. userId: this.$store.state.user.name,
  296. functionId: 5011,
  297. serialNumber: '5011Table2QuoteProfitRate',
  298. tableId: '5011Table2',
  299. tableName: '报价详情信息表',
  300. columnProp: 'quoteProfitRate',
  301. headerAlign: 'center',
  302. align: 'right',
  303. columnLabel: 'markup (%)',
  304. columnHidden: false,
  305. columnImage: false,
  306. columnSortable: false,
  307. sortLv: 0,
  308. status: true,
  309. fixed: '',
  310. columnWidth: 54
  311. },
  312. {
  313. userId: this.$store.state.user.name,
  314. functionId: 5011,
  315. serialNumber: '5011Table2Type',
  316. tableId: '5011Table2',
  317. tableName: '报价详情信息表',
  318. columnProp: 'type',
  319. headerAlign: 'center',
  320. align: 'center',
  321. columnLabel: 'TP',
  322. columnHidden: false,
  323. columnImage: false,
  324. columnSortable: false,
  325. sortLv: 0,
  326. status: true,
  327. fixed: '',
  328. columnWidth: 65
  329. },
  330. {
  331. userId: this.$store.state.user.name,
  332. functionId: 5011,
  333. serialNumber: '5011Table2Weighted',
  334. tableId: '5011Table2',
  335. tableName: '报价详情信息表',
  336. columnProp: 'weighted',
  337. headerAlign: 'center',
  338. align: 'right',
  339. columnLabel: 'MOQ > 250K(USD/KCT)',
  340. columnHidden: false,
  341. columnImage: false,
  342. columnSortable: false,
  343. sortLv: 0,
  344. status: true,
  345. fixed: '',
  346. columnWidth: 83
  347. },
  348. {
  349. userId: this.$store.state.user.name,
  350. functionId: 5011,
  351. serialNumber: '5011Table2Weighted2',
  352. tableId: '5011Table2',
  353. tableName: '报价详情信息表',
  354. columnProp: 'weighted2',
  355. headerAlign: 'center',
  356. align: 'right',
  357. columnLabel: 'MOQ > 5M (USD/KCT)',
  358. columnHidden: false,
  359. columnImage: false,
  360. columnSortable: false,
  361. sortLv: 0,
  362. status: true,
  363. fixed: '',
  364. columnWidth: 75
  365. },
  366. {
  367. userId: this.$store.state.user.name,
  368. functionId: 5011,
  369. serialNumber: '5011Table2Remark',
  370. tableId: '5011Table2',
  371. tableName: '报价详情信息表',
  372. columnProp: 'remark',
  373. headerAlign: 'center',
  374. align: 'left',
  375. columnLabel: 'COMMENT',
  376. columnHidden: false,
  377. columnImage: false,
  378. columnSortable: false,
  379. sortLv: 0,
  380. status: true,
  381. fixed: '',
  382. columnWidth: 290
  383. },
  384. ],
  385. partVisible:false,
  386. activeName:'bom',
  387. }
  388. },
  389. methods:{
  390. handleColumnResize(newWidth, oldWidth, column, event){
  391. let inData= this.columnList.filter(item => item.columnProp === column.property)[0]
  392. inData.columnWidth=newWidth
  393. updateColumnSize(inData).then(({data}) => {
  394. if (data.code === 0) {
  395. console.log("栏位宽度保存成功!")
  396. }
  397. })
  398. },
  399. handleSaveQuoteDetail(row){
  400. this.$nextTick(()=>{
  401. if (this.$refs.handleSaveQuoteDetailClick){
  402. this.$refs.saveQuoteDetailForm.clearValidate();
  403. }
  404. })
  405. if (row){
  406. this.saveQuoteDetail = {
  407. ...row
  408. }
  409. }else {
  410. this.saveQuoteDetail = {
  411. ...this.quoteDetail,
  412. createBy:this.$store.state.user.name,
  413. status:'草稿',
  414. active:'Y',
  415. qty:1,
  416. isDetail:false,
  417. }
  418. if (this.quoteGroupDetail){
  419. this.saveQuoteDetail.partId = this.quoteGroupDetail.partId
  420. this.saveQuoteDetail.partNo = this.quoteGroupDetail.partNo
  421. this.saveQuoteDetail.partDesc = this.quoteGroupDetail.partDesc
  422. }
  423. this.$nextTick(()=>{
  424. this.saveQuoteDetail.projectNo = this.quote.projectNo
  425. })
  426. }
  427. this.activeName = 'bom';
  428. this.saveVisible = true;
  429. },
  430. handleDetail(row){
  431. this.saveQuoteDetail = {
  432. ...row
  433. }
  434. this.activeName = 'bom';
  435. this.saveVisible = true;
  436. },
  437. handleDeleteQuoteDetail(row){
  438. this.$alert('确认删除该条报价明细吗?', '提示', {
  439. confirmButtonText: '确定',
  440. cancelButtonText: '取消',
  441. type: 'warning'
  442. }).then(() => {
  443. let params = {
  444. id: row.id,
  445. }
  446. deleteQuoteDetail(params).then(({data}) => {
  447. if (data && data.code === 0) {
  448. this.$message.success(data.msg);
  449. this.handleQueryQuoteDetail();
  450. } else {
  451. this.$message.warning(data.msg);
  452. }
  453. }).catch((error) => {
  454. this.$message.error(error);
  455. })
  456. }).catch(() => {
  457. })
  458. },
  459. handleDblClick(row){
  460. this.saveQuoteDetail.partId = row.id;
  461. this.saveQuoteDetail.partNo = row.partNo;
  462. this.saveQuoteDetail.partDesc = row.partDesc;
  463. this.partVisible = false;
  464. },
  465. handlePartNoBlur(){
  466. let params = {
  467. userName: this.$store.state.user.name,
  468. partNo: this.saveQuoteDetail.partNo,
  469. }
  470. handleQueryPart(params).then(({data})=>{
  471. if (data && data.code === 0){
  472. if (data.rows.length === 1){
  473. this.saveQuoteDetail.partId = data.rows[0].id;
  474. this.saveQuoteDetail.partNo = data.rows[0].partNo;
  475. this.saveQuoteDetail.partDesc = data.rows[0].partDesc;
  476. }else {
  477. this.saveQuoteDetail.partId = undefined;
  478. this.saveQuoteDetail.partDesc = '';
  479. }
  480. }else {
  481. this.$message.warning(data.msg);
  482. }
  483. }).catch((error)=>{
  484. this.$message.error(error);
  485. })
  486. },
  487. handleQueryQuoteDetail(){
  488. let params = {
  489. quoteId: this.quote.id,
  490. }
  491. if (this.quoteGroupDetail){
  492. params.quoteGroupDetailId=this.quoteGroupDetail.id;
  493. }
  494. this.queryLoading = true;
  495. queryQuoteDetail(params).then(({data})=>{
  496. if (data && data.code === 0){
  497. if (this.authFlag){
  498. this.dataList = data.rows1
  499. } else {
  500. this.dataList = data.rows
  501. }
  502. }else {
  503. this.$message.warning(data.msg);
  504. }
  505. this.queryLoading = false;
  506. }).catch((error)=>{
  507. this.$message.error(error);
  508. this.queryLoading = false;
  509. })
  510. },
  511. handleSaveQuoteDetailClick(){
  512. // this.$refs.cost.handleValidate();
  513. this.$refs.saveQuoteDetailForm.validate((valid,obj) => {
  514. if (valid){
  515. if (this.saveQuoteDetail.id){
  516. this.handleUpdate();
  517. }else {
  518. this.handleSave();
  519. }
  520. }else {
  521. let i = 1;
  522. for (let item in obj){
  523. this.$message.error(obj[item][0].message);
  524. if (i === 1){
  525. return
  526. }
  527. i++;
  528. }
  529. }
  530. })
  531. },
  532. handleSave(){
  533. let params = {
  534. ...this.saveQuoteDetail,
  535. quoteId: this.quote.id,
  536. quoteNo:this.quote.quoteNo,
  537. site:this.quote.site,
  538. buNo:this.quote.buNo,
  539. versionNo:this.quote.versionNo,
  540. createBy:this.saveQuoteDetail.createBy,
  541. active:'Y',
  542. status:'草稿',
  543. internalInquiryNo:this.quote.insideInquiryNo,
  544. }
  545. if (this.quoteGroupDetail){
  546. params.quoteGroupDetailId=this.quoteGroupDetail.id;
  547. }
  548. this.saveLoading = true;
  549. saveQuoteDetail(params).then(({data})=>{
  550. if (data && data.code === 0){
  551. this.$message.success(data.msg);
  552. this.handleQueryQuoteDetail();
  553. if (this.saveQuoteDetail.isDetail){
  554. this.saveQuoteDetail = {
  555. ...data.row,
  556. }
  557. }else {
  558. this.saveVisible = false;
  559. }
  560. }else {
  561. this.$message.warning(data.msg);
  562. }
  563. this.saveLoading = false
  564. }).catch((error)=>{
  565. this.$message.error(error);
  566. this.saveLoading = false
  567. })
  568. },
  569. handleUpdate(){
  570. let params = {
  571. ...this.saveQuoteDetail,
  572. updateBy:this.$store.state.user.name,
  573. }
  574. updateQuoteDetail(params).then(({data})=>{
  575. if (data && data.code === 0){
  576. this.$message.success(data.msg);
  577. this.handleQueryQuoteDetail();
  578. if (this.quoteGroupDetail && this.saveQuoteDetail.quoteGroupDetailId === this.quoteGroupDetail.id){
  579. this.$emit('reload')
  580. }
  581. this.saveVisible = false;
  582. }else {
  583. this.$message.warning(data.msg);
  584. }
  585. }).catch((error)=>{
  586. this.$message.error(error);
  587. })
  588. },
  589. handleComputeYield(row){
  590. let params = {
  591. id: row.id,
  592. }
  593. queryQuoteDetailYield(params).then(({data})=>{
  594. if (data && data.code === 0){
  595. this.$message.success(data.msg);
  596. this.handleQueryQuoteDetail();
  597. }else {
  598. this.$message.warning(data.msg);
  599. }
  600. }).catch((error)=>{
  601. this.$message.error(error);
  602. })
  603. },
  604. handleClickTab(tab){
  605. if (this.activeName === 'routing'){
  606. this.$refs.routing.handleQueryQuoteDetailBomTree()
  607. }
  608. },
  609. againQuoteDetail(row){
  610. let params = {
  611. ...row
  612. }
  613. againQuoteDetail(params).then(({data})=>{
  614. if (data && data.code === 0){
  615. this.handleQueryQuoteDetail();
  616. this.$message.success(data.msg);
  617. }else {
  618. this.$message.warning(data.msg);
  619. }
  620. }).catch((error)=>{
  621. this.$message.error(error);
  622. })
  623. },
  624. handleClose(){
  625. this.$emit('close');
  626. this.saveVisible = false
  627. },
  628. toFixed(val,fixed){
  629. if (!val || isNaN(val) || !fixed){
  630. return val
  631. }
  632. return new Decimal(val).toFixed(fixed)
  633. }
  634. },
  635. watch:{
  636. quote(newVal,oldVal){
  637. if (newVal.id){
  638. this.quoteDetail.profitRate = this.quote.markup
  639. this.quoteDetail.quoteProfitRate = this.quote.markup
  640. this.handleQueryQuoteDetail();
  641. }else {
  642. this.dataList = [];
  643. }
  644. },
  645. "saveQuoteDetail.partNo"(newVal,oldVal){
  646. if (newVal){
  647. this.saveQuoteDetail.partNo = newVal.toUpperCase();
  648. }
  649. },
  650. quoteGroupDetail(newVal,oldVal){
  651. if (newVal){
  652. this.quoteDetail.profitRate = this.quote.markup
  653. this.quoteDetail.quoteProfitRate = this.quote.markup
  654. this.handleQueryQuoteDetail();
  655. }
  656. },
  657. 'quoteGroupDetail.currentQuoteDetailItemNo'(newVal,oldVal){
  658. // console.log(this.quoteGroupDetail)
  659. // emit事件触发修改
  660. if (this.quoteGroupDetail && newVal){
  661. this.$emit('currentQuoteDetailItemNo',oldVal);
  662. }
  663. }
  664. },
  665. created() {
  666. this.quoteDetail.profitRate = this.quote.markup
  667. this.quoteDetail.quoteProfitRate = this.quote.markup
  668. this.handleQueryQuoteDetail();
  669. },
  670. mounted () {
  671. }
  672. }
  673. </script>
  674. <template>
  675. <div class="rq">
  676. <template v-if="saveAuth">
  677. <el-button type="primary" v-if="!authFlag" :disabled="quote.status !== '草稿' || !quote.status" @click="handleSaveQuoteDetail(null)">新增</el-button>
  678. </template>
  679. <el-table key="table" v-loading="queryLoading" border :data="dataList" style="width: 100%;margin-top: 5px" :height="height" @header-dragend="handleColumnResize">
  680. <el-table-column width="50" align="center" label="默认行" v-if="quoteGroupDetail && quoteGroupDetail.status === '草稿'">
  681. <template slot-scope="{row}">
  682. <el-radio
  683. class="radio"
  684. :label="row.itemNo"
  685. v-model="quoteGroupDetail.currentQuoteDetailItemNo"
  686. ></el-radio>
  687. </template>
  688. </el-table-column>·
  689. <el-table-column type="index" v-if="!authFlag" width="30" align="center" label="NO"></el-table-column>
  690. <el-table-column
  691. v-for="(item,index) in columns" :key="index"
  692. :sortable="item.columnSortable"
  693. :prop="item.columnProp"
  694. :header-align="item.headerAlign"
  695. :show-overflow-tooltip="item.showOverflowTooltip"
  696. :align="item.align"
  697. :fixed="item.fixed === ''?false:item.fixed"
  698. :min-width="item.columnWidth"
  699. :label="item.columnLabel">
  700. <template slot-scope="scope">
  701. <template v-if="numberProp.includes(item.columnProp)">
  702. {{ toFixed(scope.row[item.columnProp],scope.row['decimalPlace']) }}
  703. </template>
  704. <template v-else>
  705. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  706. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  707. style="width: 100px; height: 80px"/></span>
  708. </template>
  709. </template>
  710. </el-table-column>
  711. <el-table-column label="操作" v-if="!authFlag" fixed="right" align="center" width="120">
  712. <template slot-scope="{row,$index}">
  713. <a type="text" v-if="row.status === '草稿'" @click="handleSaveQuoteDetail(row)">编辑</a>
  714. <a type="text" v-if="row.status === '草稿'" @click="handleDeleteQuoteDetail(row)">删除</a>
  715. <!-- <a type="text" v-if="row.status !== '下达'" @click="againQuoteDetail(row)">重新报价</a>-->
  716. <a type="text" v-if="row.status !== '草稿'" @click="handleDetail(row)">详情</a>
  717. </template>
  718. </el-table-column>
  719. </el-table>
  720. <el-dialog :title="`报价明细`" top="10vh" v-drag :visible.sync="saveVisible" append-to-body :width="`${saveQuoteDetail.id?1200:600}px`" :close-on-click-modal="false">
  721. <el-form :model="saveQuoteDetail" ref="saveQuoteDetailForm" :rules="saveQuoteDetailRules" label-position="top" v-if="!saveQuoteDetail.id">
  722. <el-row :gutter="20">
  723. <el-col :span="8">
  724. <el-form-item label="物料编码" prop="partNo" :show-message="false">
  725. <span slot="label" v-if="!quoteGroupDetail">
  726. <a @click="partVisible = true">物料编码</a>
  727. </span>
  728. <el-input v-model="saveQuoteDetail.partNo" :disabled="quoteGroupDetail" @blur="handlePartNoBlur"></el-input>
  729. </el-form-item>
  730. </el-col>
  731. <el-col :span="16">
  732. <el-form-item label="物料描述" prop="partDesc" :show-message="false">
  733. <el-input v-model="saveQuoteDetail.partDesc" disabled></el-input>
  734. </el-form-item>
  735. </el-col>
  736. <el-col :span="8">
  737. <el-form-item label="报价数量" prop="qty" :show-message="false">
  738. <el-input-number style="width: 100%;" v-model="saveQuoteDetail.qty" :min="1" :step="0" :precision="0" :controls="false"></el-input-number>
  739. </el-form-item>
  740. </el-col>
  741. <el-col :span="6">
  742. <el-form-item label="TP类型" prop="type" :show-message="false">
  743. <el-select v-model="saveQuoteDetail.type" placeholder="请选择" style="width: 100%;">
  744. <el-option label="Standard TP" value="Standard TP"></el-option>
  745. <el-option label="Weighted TP" value="Weighted TP"></el-option>
  746. </el-select>
  747. </el-form-item>
  748. </el-col>
  749. <el-col :span="6">
  750. <el-form-item label="Cost Model" prop="costModel" :show-message="false">
  751. <el-select v-model="saveQuoteDetail.costModel" style="width: 100%;">
  752. <el-option label="2020" value="2020"></el-option>
  753. <el-option label="UFIDA" value="UFIDA"></el-option>
  754. </el-select>
  755. </el-form-item>
  756. </el-col>
  757. </el-row>
  758. <el-row :gutter="20">
  759. <el-col :span="8">
  760. <el-form-item label="" :show-message="false">
  761. <el-checkbox v-model="saveQuoteDetail.isDetail">保存进入报价页面</el-checkbox>
  762. </el-form-item>
  763. </el-col>
  764. <el-col :span="24">
  765. <el-form-item label="备注" class="auto" :show-message="false">
  766. <el-input type="textarea" v-model="saveQuoteDetail.remark" :autosize="{minRows: 3, maxRows: 3}"></el-input>
  767. </el-form-item>
  768. </el-col>
  769. </el-row>
  770. </el-form>
  771. <el-form v-else :model="saveQuoteDetail" ref="saveQuoteDetailForm" :rules="saveQuoteDetailRules" label-position="top">
  772. <el-row :gutter="20">
  773. <el-col :span="4">
  774. <el-form-item label="物料编码" prop="partNo" :show-message="false">
  775. <el-input v-model="saveQuoteDetail.partNo" disabled></el-input>
  776. </el-form-item>
  777. </el-col>
  778. <el-col :span="6">
  779. <el-form-item label="物料描述" prop="partDesc" :show-message="false">
  780. <el-input v-model="saveQuoteDetail.partDesc" disabled></el-input>
  781. </el-form-item>
  782. </el-col>
  783. <el-col :span="3">
  784. <el-form-item label="报价数量" prop="qty" :show-message="false">
  785. <el-input-number v-model="saveQuoteDetail.qty" style="width: 100%;" :controls="false" :disabled="saveQuoteDetail.status === '下达'"></el-input-number>
  786. </el-form-item>
  787. </el-col>
  788. <el-col :span="3">
  789. <el-form-item label="TP类型" prop="type" :show-message="false">
  790. <el-select v-model="saveQuoteDetail.type" placeholder="请选择" style="width: 100%;">
  791. <el-option label="Standard TP" value="Standard TP"></el-option>
  792. <el-option label="Weighted TP" value="Weighted TP"></el-option>
  793. </el-select>
  794. </el-form-item>
  795. </el-col>
  796. <el-col :span="3">
  797. <el-form-item label="Cost Model" prop="costModel" :show-message="false">
  798. <el-select v-model="saveQuoteDetail.costModel" style="width: 100%;">
  799. <el-option label="2020" value="2020"></el-option>
  800. <el-option label="UFIDA" value="UFIDA"></el-option>
  801. </el-select>
  802. </el-form-item>
  803. </el-col>
  804. </el-row>
  805. <el-row :gutter="20">
  806. <el-col :span="19">
  807. <el-form-item label="备注" class="auto" :show-message="false">
  808. <el-input type="textarea" resize="none" :autosize="{minRows: 3, maxRows: 3}" v-model="saveQuoteDetail.remark" :disabled="saveQuoteDetail.status === '下达'"></el-input>
  809. </el-form-item>
  810. </el-col>
  811. </el-row>
  812. </el-form>
  813. <el-tabs v-model="activeName" v-if="saveQuoteDetail.id" @tab-click="handleClickTab">
  814. <el-tab-pane label="材料" name="bom">
  815. <quote-detail-bom v-if="saveVisible" @close="handleClose" v-model:quoteDetail="saveQuoteDetail"></quote-detail-bom>
  816. </el-tab-pane>
  817. <el-tab-pane label="工艺" name="routing">
  818. <quote-detail-routing ref="routing" v-if="saveVisible" @close="handleClose" v-model:quoteDetail="saveQuoteDetail"></quote-detail-routing>
  819. </el-tab-pane>
  820. <el-tab-pane label="工具" name="tool">
  821. <quote-detail-tool v-if="saveVisible" v-model:quoteDetail="saveQuoteDetail"></quote-detail-tool>
  822. </el-tab-pane>
  823. <el-tab-pane label="其他成本" name="other">
  824. <quote-detail-other v-if="saveVisible" v-model:quoteDetail="saveQuoteDetail"></quote-detail-other>
  825. </el-tab-pane>
  826. <el-tab-pane label="成本&价格" name="cost">
  827. <quote-detail-cost v-if="saveVisible" ref="cost" v-model:quoteDetail="saveQuoteDetail"></quote-detail-cost>
  828. </el-tab-pane>
  829. <el-tab-pane label="2020 Rate" name="rate" v-if="saveQuoteDetail.costModel === '2020'">
  830. <quote-detail-calculation v-if="activeName === 'rate'" v-model:quote-detail="saveQuoteDetail"></quote-detail-calculation>
  831. </el-tab-pane>
  832. </el-tabs>
  833. <div slot="footer" class="dialog-footer">
  834. <el-button type="primary" v-if="saveQuoteDetail.status === '草稿'" :loading="saveLoading" @click="handleSaveQuoteDetailClick"> </el-button>
  835. <el-button @click="saveVisible = false"> </el-button>
  836. </div>
  837. </el-dialog>
  838. <part-table v-if="saveVisible" v-model="partVisible" :is-page="true" :part-no="saveQuoteDetail.partNo" @dblclick="handleDblClick"></part-table>
  839. <!-- <project-part-table v-if="saveVisible" v-model="partVisible" :project-no="saveQuoteDetail.projectNo" :part-no="saveQuoteDetail.partNo" @dblclick="handleDblClick"></project-part-table>-->
  840. </div>
  841. </template>
  842. <style scoped>
  843. .auto /deep/ .el-form-item__content{
  844. height: auto;
  845. line-height: 1.5;
  846. }
  847. .radio /deep/ .el-radio__label{
  848. display: none;
  849. }
  850. .el-table /deep/ .cell{
  851. height: auto;
  852. line-height: 1.5;
  853. }
  854. </style>