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.

1324 lines
42 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
  1. <script>
  2. import QuoteSearch from "./primary/quoteSearch.vue";
  3. import QuoteTable from "./primary/quoteTable.vue";
  4. import {
  5. againQuote,
  6. queryQuotePage,
  7. queryQuoteRoleUser,
  8. removeQuote,
  9. saveQuote,
  10. updateQuote,
  11. updateQuoteStatus
  12. } from "../../../api/quote/quote";
  13. import QuoteDetail from "./detail/quoteDetail.vue";
  14. import ChooseList from '@/views/modules/common/Chooselist';
  15. import {queryCustomer} from "../../../api/customer/customerInformation";
  16. import DictDataSelect from "../sys/dict-data-select.vue";
  17. import {queryProjectByCustomer} from "../../../api/project/project";
  18. import quotationCustomerContact from "../quotation/sellForQuotation/quotationCustomerContact.vue";
  19. import CustomerInfo from "../quotation/sellForQuotation/customerInfo.vue";
  20. import OssComponents from "../oss/ossComponents.vue";
  21. import quotationProjectInformation from "../quotation/sellForQuotation/quotationProjectInformation.vue";
  22. import {searchQuotationByQuotationNo} from "../../../api/quotation/quotationInformation";
  23. import PriceCheckProperties from "../quotation/priceCheckProperties.vue";
  24. import ApprovalInformation from "../changeManagement/approvalInformation.vue";
  25. import {getPriceCheckPropertiesList} from "../../../api/quotation/priceCheckProperties";
  26. import {getApprovalList} from "../../../api/changeManagement/changeManagement";
  27. import QuoteGroupDetail from "./detail/quoteGroupDetail.vue";
  28. export default {
  29. name: "quote",
  30. components: {
  31. QuoteGroupDetail,
  32. ApprovalInformation, PriceCheckProperties,
  33. quotationProjectInformation, OssComponents, CustomerInfo, quotationCustomerContact,
  34. DictDataSelect,
  35. QuoteDetail,
  36. ChooseList,
  37. QuoteTable, QuoteSearch
  38. },
  39. props:{
  40. isMenu:{
  41. type:Boolean,
  42. default:true,
  43. },
  44. projectNo:{
  45. type:String,
  46. },
  47. height:{
  48. type:[Number,String],
  49. default:'35vh'
  50. }
  51. },
  52. menuId:5011,
  53. data(){
  54. return{
  55. total: 0,
  56. no:1,
  57. size: 20,
  58. quote:{
  59. id: null,
  60. site:"",
  61. quoteNo: "",
  62. customerInquiryNo: "",
  63. insideInquiryNo: "",
  64. buNo: "",
  65. buId: null,
  66. versionNo: "",
  67. status:'',
  68. quoteVersionNo: "",
  69. customerNo: "",
  70. customerDesc: "",
  71. projectNo: "",
  72. projectDesc: "",
  73. finalCustomerNo: "",
  74. finalCustomerDesc:"",
  75. currency: "",
  76. quoteDate: "",
  77. quoter: "",
  78. quoterName: "",
  79. purchase: "",
  80. purchaseName: "",
  81. remark: "",
  82. createBy: "",
  83. createDate: "",
  84. updateBy: "",
  85. updateDate: "",
  86. application: "",
  87. annualDemand: "",
  88. costModel: "UFIDA",
  89. markup:0,
  90. chipPrice:'',
  91. },
  92. quoteForm:{
  93. },
  94. saveQuote:{
  95. },
  96. dataList:[],
  97. columns: [
  98. {
  99. userId: this.$store.state.user.name,
  100. functionId: 5011,
  101. serialNumber: '5011Table1QuoteVersionNo',
  102. tableId: '5011Table1',
  103. tableName: '报价信息表',
  104. columnProp: 'quoteVersionNo',
  105. headerAlign: 'center',
  106. align: 'center',
  107. columnLabel: '报价单号',
  108. columnHidden: false,
  109. columnImage: false,
  110. columnSortable: false,
  111. sortLv: 0,
  112. status: true,
  113. fixed: '',
  114. columnWidth: 180
  115. },
  116. {
  117. userId: this.$store.state.user.name,
  118. functionId: 5011,
  119. serialNumber: '5011Table1QuoteDate',
  120. tableId: '5011Table1',
  121. tableName: '报价信息表',
  122. columnProp: 'quoteDate',
  123. headerAlign: 'center',
  124. align: 'center',
  125. columnLabel: '报价日期',
  126. columnHidden: false,
  127. columnImage: false,
  128. columnSortable: false,
  129. sortLv: 0,
  130. status: true,
  131. fixed: '',
  132. columnWidth: 100
  133. },
  134. {
  135. userId: this.$store.state.user.name,
  136. functionId: 5011,
  137. serialNumber: '5011Table1CustomerNo',
  138. tableId: '5011Table1',
  139. tableName: '报价信息表',
  140. columnProp: 'customerNo',
  141. headerAlign: 'center',
  142. align: 'center',
  143. columnLabel: '客户编码',
  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: '5011Table1CustomerDesc',
  156. tableId: '5011Table1',
  157. tableName: '报价信息表',
  158. columnProp: 'customerDesc',
  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: 120
  169. },
  170. {
  171. userId: this.$store.state.user.name,
  172. functionId: 5011,
  173. serialNumber: '5011Table1ProjectNo',
  174. tableId: '5011Table1',
  175. tableName: '报价信息表',
  176. columnProp: 'projectNo',
  177. headerAlign: 'center',
  178. align: 'left',
  179. columnLabel: '项目编码',
  180. columnHidden: false,
  181. columnImage: false,
  182. columnSortable: false,
  183. sortLv: 0,
  184. status: true,
  185. fixed: '',
  186. columnWidth: 120
  187. },
  188. {
  189. userId: this.$store.state.user.name,
  190. functionId: 5011,
  191. serialNumber: '5011Table1ProjectDesc',
  192. tableId: '5011Table1',
  193. tableName: '报价信息表',
  194. columnProp: 'projectDesc',
  195. headerAlign: 'center',
  196. align: 'left',
  197. columnLabel: '项目名称',
  198. columnHidden: false,
  199. columnImage: false,
  200. columnSortable: false,
  201. sortLv: 0,
  202. status: true,
  203. fixed: '',
  204. columnWidth: 120
  205. },
  206. {
  207. userId: this.$store.state.user.name,
  208. functionId: 5011,
  209. serialNumber: '5011Table1QuoterName',
  210. tableId: '5011Table1',
  211. tableName: '报价信息表',
  212. columnProp: 'quoterName',
  213. headerAlign: 'center',
  214. align: 'left',
  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: '5011Table1PurchaseName',
  228. tableId: '5011Table1',
  229. tableName: '报价信息表',
  230. columnProp: 'purchaseName',
  231. headerAlign: 'center',
  232. align: 'left',
  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: '5011Table1Status',
  246. tableId: '5011Table1',
  247. tableName: '报价信息表',
  248. columnProp: 'status',
  249. headerAlign: 'center',
  250. align: 'center',
  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: '5011Table1CustomerInquiryNo',
  264. tableId: '5011Table1',
  265. tableName: '报价信息表',
  266. columnProp: 'customerInquiryNo',
  267. headerAlign: 'center',
  268. align: 'center',
  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: '5011Table1InsideInquiryNo',
  282. tableId: '5011Table1',
  283. tableName: '报价信息表',
  284. columnProp: 'insideInquiryNo',
  285. headerAlign: 'center',
  286. align: 'center',
  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: '5011Table1CreateBy',
  300. tableId: '5011Table1',
  301. tableName: '报价信息表',
  302. columnProp: 'createBy',
  303. headerAlign: 'center',
  304. align: 'center',
  305. columnLabel: '创建人',
  306. columnHidden: false,
  307. columnImage: false,
  308. columnSortable: false,
  309. sortLv: 0,
  310. status: true,
  311. fixed: '',
  312. columnWidth: 120
  313. },
  314. {
  315. userId: this.$store.state.user.name,
  316. functionId: 5011,
  317. serialNumber: '5011Table1CreateDate',
  318. tableId: '5011Table1',
  319. tableName: '报价信息表',
  320. columnProp: 'createDate',
  321. headerAlign: 'center',
  322. align: 'center',
  323. columnLabel: '创建时间',
  324. columnHidden: false,
  325. columnImage: false,
  326. columnSortable: false,
  327. sortLv: 0,
  328. status: true,
  329. fixed: '',
  330. columnWidth: 130
  331. },
  332. {
  333. userId: this.$store.state.user.name,
  334. functionId: 5011,
  335. serialNumber: '5011Table1UpdateBy',
  336. tableId: '5011Table1',
  337. tableName: '报价信息表',
  338. columnProp: 'updateBy',
  339. headerAlign: 'center',
  340. align: 'center',
  341. columnLabel: '更新人',
  342. columnHidden: false,
  343. columnImage: false,
  344. columnSortable: false,
  345. sortLv: 0,
  346. status: true,
  347. fixed: '',
  348. columnWidth: 120
  349. },
  350. {
  351. userId: this.$store.state.user.name,
  352. functionId: 5011,
  353. serialNumber: '5011Table1UpdateDate',
  354. tableId: '5011Table1',
  355. tableName: '报价信息表',
  356. columnProp: 'updateDate',
  357. headerAlign: 'center',
  358. align: 'center',
  359. columnLabel: '更新时间',
  360. columnHidden: false,
  361. columnImage: false,
  362. columnSortable: false,
  363. sortLv: 0,
  364. status: true,
  365. fixed: '',
  366. columnWidth: 130
  367. },
  368. ],
  369. searchLoading: false,
  370. saveVisible: false,
  371. saveLoading: false,
  372. activeName:'detail',
  373. userBuList: [],
  374. saveRules: {
  375. buId:[{required: true, message: '请选择BU', trigger: ['blur','change']}],
  376. customerNo:[{required: true, message: '请输入客户编码', trigger: ['blur','change']}],
  377. customerDesc:[{required: true, message: '请输入客户名称', trigger: ['blur','change']}],
  378. projectNo:[{required: true, message: '请输入项目编码', trigger: ['blur','change']}],
  379. projectDesc:[{required: true, message: '请输入项目名称', trigger: ['blur','change']}],
  380. currency:[{required: true, message: '请输入币种', trigger: ['blur','change']}],
  381. quoteDate:[{required: true, message: '请选择报价日期', trigger: ['blur','change']}],
  382. quoter:[{required: true, message: '请输入报价专员', trigger: ['blur','change']}],
  383. purchase:[{required: true, message: '请输入采购专员', trigger: ['blur','change']}],
  384. },
  385. customerVisible:false,
  386. projectVisible:false,
  387. quoterVisible:false,
  388. purchaseVisible:false,
  389. currentQuote:{
  390. },
  391. userVisible:false,
  392. userTitle:'人员信息',
  393. user:{
  394. username:'',
  395. userDisplay:'',
  396. active:'',
  397. buId:null,
  398. roleNo:'',
  399. },
  400. userDataList:[],
  401. tagNo:undefined,
  402. insideInquiryVisible:false,
  403. detailFlag:false,
  404. ossColumns:[
  405. {
  406. userId: this.$store.state.user.name,
  407. functionId: 5011,
  408. serialNumber: '5011Table2FileName',
  409. tableId: '5011Table2',
  410. tableName: '文件信息表',
  411. columnProp: 'fileName',
  412. headerAlign: 'center',
  413. align: 'left',
  414. columnLabel: '文件名称',
  415. columnHidden: false,
  416. columnImage: false,
  417. columnSortable: false,
  418. sortLv: 0,
  419. status: true,
  420. fixed: '',
  421. columnWidth: 140
  422. },
  423. {
  424. userId: this.$store.state.user.name,
  425. functionId: 5011,
  426. serialNumber: '5011Table2FileRemark',
  427. tableId: '5011Table2',
  428. tableName: '文件信息表',
  429. columnProp: 'fileRemark',
  430. headerAlign: 'center',
  431. align: 'left',
  432. columnLabel: '备注',
  433. columnHidden: false,
  434. columnImage: false,
  435. columnSortable: false,
  436. sortLv: 0,
  437. status: true,
  438. fixed: '',
  439. columnWidth: 240
  440. },
  441. {
  442. userId: this.$store.state.user.name,
  443. functionId: 5011,
  444. serialNumber: '5011Table2CreateDate',
  445. tableId: '5011Table2',
  446. tableName: '文件信息表',
  447. columnProp: 'createDate',
  448. headerAlign: 'center',
  449. align: 'center',
  450. columnLabel: '上传时间',
  451. columnHidden: false,
  452. columnImage: false,
  453. columnSortable: false,
  454. sortLv: 0,
  455. status: true,
  456. fixed: '',
  457. columnWidth: 140
  458. },
  459. {
  460. userId: this.$store.state.user.name,
  461. functionId: 5011,
  462. serialNumber: '5011Table2CreatedBy',
  463. tableId: '5011Table2',
  464. tableName: '文件信息表',
  465. columnProp: 'createBy',
  466. headerAlign: 'center',
  467. align: 'center',
  468. columnLabel: '上传人',
  469. columnHidden: false,
  470. columnImage: false,
  471. columnSortable: false,
  472. sortLv: 0,
  473. status: true,
  474. fixed: '',
  475. columnWidth: 140
  476. }
  477. ],
  478. insideInquiry:{
  479. },
  480. insideInquiryList:[],
  481. priceCheckPropertiesList:[],
  482. approvalList:[],
  483. exportData: [],
  484. exportName: '项目报价'+this.dayjs().format('YYYYMMDDHHmmss'),
  485. exportHeader: ["项目报价"],
  486. exportFooter: [],
  487. searchIndex:0,
  488. }
  489. },
  490. methods:{
  491. handleSearch(index){
  492. let params = {
  493. ...this.quoteForm,
  494. no: this.no,
  495. size: this.size,
  496. }
  497. this.searchLoading = true
  498. queryQuotePage(params).then(({data})=>{
  499. if (data && data.code === 0){
  500. this.dataList = data.rows
  501. this.total = data.total
  502. if (index !== undefined){
  503. this.handleSelect(this.dataList[index])
  504. }
  505. }else {
  506. this.$message.error(data.msg)
  507. }
  508. this.searchLoading = false
  509. }).catch(error=>{
  510. this.$message.error(error)
  511. this.searchLoading = false
  512. })
  513. },
  514. handleSelect(row){
  515. if (row){
  516. this.currentQuote = {...row}
  517. }else {
  518. this.currentQuote = {}
  519. }
  520. },
  521. handleSave(row){
  522. this.$nextTick(()=>{
  523. if (this.$refs.saveForm){
  524. this.$refs.saveForm.clearValidate();
  525. }
  526. })
  527. if (row){
  528. this.saveQuote = {
  529. ...row
  530. }
  531. }else {
  532. this.saveQuote = {
  533. ...this.quote,
  534. buNo:'*',
  535. site:this.$store.state.user.site
  536. }
  537. this.$nextTick(()=>{
  538. this.saveQuote.buId = this.userBuList.length > 0? this.userBuList[0].id:null;
  539. })
  540. }
  541. this.saveVisible = true
  542. },
  543. handleSizeChange(size){
  544. this.size = size
  545. this.handleSearch();
  546. },
  547. handlePageChange(no) {
  548. this.no = no
  549. this.handleSearch();
  550. },
  551. handleQueryBu(){
  552. let params = {
  553. username: this.$store.state.user.name,
  554. }
  555. // getSiteAndBuByUserName(params).then(({data}) => {
  556. // if (data && data.code === 0) {
  557. // this.userBuList = data.rows
  558. // }else {
  559. // this.$message.warning(data.msg)
  560. // }
  561. // }).catch((error)=>{
  562. // this.$message.error(error)
  563. // })
  564. },
  565. handleSaveOrUpdateQuote(){
  566. this.$refs.saveForm.validate((valid,obj) => {
  567. if (valid){
  568. if (this.saveQuote.id){
  569. this.handleUpdateQuote();
  570. }else {
  571. this.handleSaveQuote();
  572. }
  573. }else {
  574. let i = 1;
  575. for (let key in obj){
  576. this.$message.warning(obj[key][0].message)
  577. if (i === 1){
  578. return
  579. }
  580. i++;
  581. }
  582. }
  583. })
  584. },
  585. handleSaveQuote(){
  586. let params = {
  587. ...this.saveQuote,
  588. status: '草稿',
  589. action: 'Y',
  590. createBy: this.$store.state.user.name,
  591. }
  592. this.saveLoading = true
  593. saveQuote(params).then(({data})=>{
  594. if (data && data.code === 0){
  595. this.saveVisible = false
  596. this.$message.success(data.msg)
  597. }else {
  598. this.$message.warning(data.msg)
  599. }
  600. this.handleSearch(0);
  601. this.saveLoading = false
  602. }).catch((error)=>{
  603. this.$message.error(error)
  604. this.saveLoading = false
  605. })
  606. },
  607. handleUpdateQuote(){
  608. let params = {
  609. ...this.saveQuote,
  610. updateBy: this.$store.state.user.name,
  611. }
  612. this.saveLoading = true
  613. updateQuote(params).then(({data})=>{
  614. if (data && data.code === 0){
  615. this.saveVisible = false
  616. this.currentQuote = {
  617. ...this.currentQuote
  618. }
  619. this.$message.success(data.msg)
  620. }else {
  621. this.$message.warning(data.msg)
  622. }
  623. this.handleSearch();
  624. this.saveLoading = false
  625. }).catch((error)=>{
  626. this.$message.error(error)
  627. this.saveLoading = false
  628. })
  629. },
  630. handleRemove(row){
  631. this.$confirm('确认删除该报价信息吗?', '提示', {
  632. confirmButtonText: '确定',
  633. cancelButtonText: '取消',
  634. type: 'warning'
  635. }).then(() => {
  636. this.handleRemoveQuote(row)
  637. }).catch(() => {
  638. })
  639. },
  640. handleUpdateStatus(row){
  641. let params = {
  642. ...row
  643. }
  644. updateQuoteStatus(params).then(({data})=>{
  645. if (data && data.code === 0){
  646. this.$message.success(data.msg)
  647. this.handleSearch();
  648. this.currentQuote = {
  649. ...row
  650. }
  651. }else {
  652. this.$message.warning(data.msg)
  653. }
  654. }).catch((error)=>{
  655. this.$message.error(error)
  656. })
  657. },
  658. handleQueryById(row){
  659. this.saveQuote = {
  660. ...row
  661. }
  662. this.detailFlag = true;
  663. this.saveVisible = true;
  664. },
  665. handleRemoveQuote(row){
  666. let params = {
  667. id: row.id,
  668. }
  669. removeQuote(params).then(({data})=>{
  670. if (data && data.code === 0){
  671. this.$message.success(data.msg)
  672. if (row.id === this.currentQuote.id){
  673. this.handleSearch(0);
  674. }else {
  675. this.handleSearch();
  676. }
  677. }else {
  678. this.$message.warning(data.msg)
  679. }
  680. }).catch((error)=>{
  681. this.$message.error(error)
  682. })
  683. },
  684. customerNoBlur(){
  685. let params = {
  686. site:this.$store.state.user.site,
  687. customerNo:this.saveQuote.customerNo
  688. }
  689. queryCustomer(params).then(({data})=>{
  690. if (data && data.code === 0 ) {
  691. if (data.rows && data.rows.length === 1){
  692. this.saveQuote.customerDesc = data.rows[0].customerDesc
  693. }else {
  694. this.saveQuote.customerDesc = ''
  695. }
  696. }else {
  697. this.$message.warning(data.msg)
  698. }
  699. }).catch((error)=>{
  700. this.$message.error(error)
  701. })
  702. },
  703. projectNoBlur(){
  704. let params = {
  705. site:this.$store.state.user.site,
  706. customerId:this.saveQuote.customerNo,
  707. projectId:this.saveQuote.projectNo
  708. }
  709. queryProjectByCustomer(params).then(({data})=>{
  710. if (data && data.code === 0 ){
  711. if (data.rows && data.rows.length === 1){
  712. this.saveQuote.projectDesc = data.rows[0].projectName
  713. this.saveQuote.finalCustomerNo = data.rows[0].finalCustomerId
  714. this.saveQuote.finalCustomerDesc = data.rows[0].finalCustomerName
  715. }else {
  716. this.saveQuote.projectDesc = ''
  717. this.saveQuote.finalCustomerNo = ''
  718. this.saveQuote.finalCustomerDesc = ''
  719. }
  720. }else {
  721. this.$message.warning(data.msg)
  722. }
  723. }).catch((error)=>{
  724. this.$message.error(error)
  725. })
  726. },
  727. handleRowClick(row){
  728. this.currentQuote = {...row}
  729. },
  730. userDblClick(row){
  731. if (this.quoterVisible){
  732. this.saveQuote.quoter = row.username
  733. this.quoterVisible = false
  734. }else if (this.purchaseVisible){
  735. this.saveQuote.purchase = row.username
  736. this.purchaseVisible = false
  737. }
  738. this.userVisible = false
  739. },
  740. handleQuoterClick(){
  741. this.userTitle = '报价专员'
  742. this.user.username = this.saveQuote.quoter
  743. this.user.userDisplay = ''
  744. this.user.active = ''
  745. this.user.buId = this.saveQuote.buId
  746. this.user.roleNo = 'QUOTER'
  747. this.quoterVisible = true
  748. this.handleQueryQuoteRoleUser();
  749. this.userVisible = true
  750. },
  751. handlePurchaseClick(){
  752. this.userTitle = '采购专员'
  753. this.user.username = this.saveQuote.purchase
  754. this.user.userDisplay = ''
  755. this.user.active = ''
  756. this.user.buId = this.saveQuote.buId
  757. this.user.roleNo = 'PURCHASE'
  758. this.purchaseVisible = true
  759. this.handleQueryQuoteRoleUser();
  760. this.userVisible = true
  761. },
  762. handleQueryQuoteRoleUser(){
  763. let params = {
  764. ...this.user,
  765. }
  766. this.userDataList = []
  767. queryQuoteRoleUser(params).then(({data})=>{
  768. if (data && data.code === 0){
  769. this.userDataList = data.rows
  770. }else {
  771. this.$message.warning(data.msg)
  772. }
  773. }).catch((error)=>{
  774. this.$message.error(error)
  775. })
  776. },
  777. getBaseList(val){
  778. this.tagNo = val
  779. this.$nextTick(() => {
  780. let strVal = ''
  781. let conSql = ''
  782. if (val === 102) {
  783. strVal = this.saveQuote.customerNo
  784. }
  785. if (val === 104) {
  786. strVal = this.saveQuote.projectNo
  787. conSql = " and customer_id = '" + this.saveQuote.customerNo + "'"
  788. }
  789. if (val === 2000) {
  790. strVal = this.saveQuote.purchase
  791. conSql = " and b.site = '" + this.$store.state.user.site + "'"
  792. }
  793. if (val === 2002) {
  794. strVal = this.saveQuote.quoter
  795. conSql = " and b.site = '" + this.$store.state.user.site + "'"
  796. }
  797. this.$refs.baseList.init(val, strVal, conSql)
  798. })
  799. },
  800. getBaseData(val){
  801. switch (this.tagNo){
  802. case 102:
  803. if (this.saveQuote.customerNo !== val.Customer_no) {
  804. this.saveQuote.projectNo = '';
  805. this.saveQuote.projectDesc = '';
  806. }
  807. this.saveQuote.customerNo = val.Customer_no
  808. this.saveQuote.customerDesc = val.Customer_desc
  809. break;
  810. case 104:
  811. this.saveQuote.projectNo = val.project_id
  812. this.saveQuote.projectDesc = val.project_name
  813. break;
  814. case 2000:
  815. this.saveQuote.purchase = val.username
  816. this.saveQuote.purchaseName = val.user_display
  817. break
  818. case 2002:
  819. this.saveQuote.quoter = val.username
  820. this.saveQuote.quoterName = val.user_display
  821. break;
  822. }
  823. },
  824. handleQueryByIds(){
  825. let params = {
  826. ids:this.$route.params.ids,
  827. no:this.no,
  828. size:this.size,
  829. createBy:this.$store.state.user.name,
  830. }
  831. queryQuotePage(params).then(({data})=>{
  832. if (data && data.code === 0){
  833. this.dataList = data.rows
  834. this.total = data.total
  835. if (this.total > 0){
  836. this.currentQuote = {...this.dataList[0]}
  837. }else {
  838. this.currentQuote = {}
  839. }
  840. }else {
  841. this.$message.error(data.msg)
  842. }
  843. this.searchLoading = false
  844. }).catch(error=>{
  845. this.$message.error(error)
  846. this.searchLoading = false
  847. })
  848. },
  849. handleInquiryBlur(){
  850. let params = {
  851. site:this.$store.state.user.site,
  852. quotationNo:this.saveQuote.insideInquiryNo,
  853. }
  854. searchQuotationByQuotationNo(params).then(({data}) => {
  855. if (data && data.code === 0){
  856. if (data.data.length === 1){
  857. this.dblclickInsideInquiry(data.data[0])
  858. }
  859. }
  860. })
  861. },
  862. handleAgainQuote(row){
  863. let params = {
  864. id: row.id,
  865. createBy: this.$store.state.user.name,
  866. }
  867. this.queryLoading = true
  868. againQuote(params).then(({data}) => {
  869. if (data && data.code === 0) {
  870. this.$message.success(data.msg)
  871. this.handleSearch();
  872. } else {
  873. this.$message.warning(data.msg)
  874. this.queryLoading = false
  875. }
  876. }).catch((error) => {
  877. this.$message.error(error)
  878. this.queryLoading = false
  879. })
  880. },
  881. clearModalData(field){
  882. this.$set(this.saveQuote,field,'')
  883. },
  884. handleQueryInquiry(){
  885. this.insideInquiry = {
  886. site:this.$store.state.user.site,
  887. quotationNo:this.saveQuote.insideInquiryNo,
  888. quotationBatchNo:'',
  889. quotationItemNo:'',
  890. testPartNo:'',
  891. partName:'',
  892. quotationStatus:'审批中',
  893. }
  894. this.searchInsideInquiry();
  895. this.insideInquiryVisible = true
  896. },
  897. dblclickInsideInquiry(row){
  898. this.saveQuote.insideInquiryNo = row.quotationNo
  899. this.saveQuote.customerNo = row.customerNo
  900. this.saveQuote.customerDesc = row.customerDesc
  901. this.saveQuote.projectNo = row.projectId
  902. this.saveQuote.projectDesc = row.projectName
  903. this.saveQuote.quoter = row.quoter
  904. this.saveQuote.quoterName = row.quoterName
  905. this.saveQuote.finalCustomerNo = row.finalCustomerId
  906. this.saveQuote.finalCustomerDesc = row.finalCustomerName
  907. this.saveQuote.purchase = row.tracker
  908. this.saveQuote.purchaseName = row.trackerName
  909. this.insideInquiryVisible = false
  910. },
  911. searchInsideInquiry(){
  912. searchQuotationByQuotationNo(this.insideInquiry).then(({data}) => {
  913. if (data && data.code === 0){
  914. this.insideInquiryList = data.data;
  915. }
  916. })
  917. },
  918. getPriceCheckProperties() {
  919. if (!this.currentQuote && !this.currentQuote.insideInquiryNo){
  920. this.priceCheckPropertiesList = []
  921. return
  922. }
  923. let params = {
  924. site: this.saveQuote.site,
  925. quotationNo: this.currentQuote.insideInquiryNo
  926. }
  927. getPriceCheckPropertiesList(params).then(({data}) => {
  928. if (data && data.code === 0) {
  929. this.priceCheckPropertiesList = data.rows
  930. } else {
  931. this.$message.warning(data.msg)
  932. }
  933. }).catch((error) => {
  934. this.$message.error(error)
  935. })
  936. },
  937. // 查询审批信息
  938. getApprovalList () {
  939. let tempData = {
  940. site: this.$store.state.user.site,
  941. menuId: this.$route.meta.menuId,
  942. documentNo: this.currentQuote.quoteVersionNo
  943. }
  944. getApprovalList(tempData).then(({data}) => {
  945. if (data && data.code === 0) {
  946. this.approvalList = data.rows
  947. } else {
  948. this.approvalList = []
  949. }
  950. })
  951. },
  952. fields() {
  953. let json = "{"
  954. this.columns.forEach((item, index) => {
  955. if (index === this.columns.length - 1) {
  956. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  957. } else {
  958. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  959. }
  960. })
  961. json += "}"
  962. return eval("(" + json + ")")
  963. },
  964. createExportData() {
  965. return this.dataList;
  966. },
  967. },
  968. created() {
  969. if (this.isMenu && this.searchIndex === 0){
  970. this.quoteForm = {
  971. ...this.quote,
  972. site: this.$store.state.user.site,
  973. createBy: this.$store.state.user.name,
  974. }
  975. this.handleQueryBu();// 查询 BU
  976. this.handleSearch(0);// 查询报价信息
  977. }
  978. this.searchIndex++;
  979. },
  980. watch:{
  981. 'quoteForm.customerNo'(newVal, oldVal){
  982. this.quoteForm.customerNo = newVal.toUpperCase()
  983. },
  984. 'quoteForm.projectNo'(newVal, oldVal){
  985. this.quoteForm.projectNo = newVal.toUpperCase()
  986. },
  987. 'quoteForm.quoteNo'(newVal, oldVal){
  988. this.quoteForm.quoteNo = newVal.toUpperCase()
  989. },
  990. 'saveQuote.customerNo'(newVal, oldVal){
  991. if (newVal){
  992. this.saveQuote.customerNo = newVal.toUpperCase()
  993. }else {
  994. this.saveQuote.customerDesc = ''
  995. this.saveQuote.projectNo = ''
  996. this.saveQuote.projectDesc = ''
  997. }
  998. },
  999. 'saveQuote.projectNo'(newVal, oldVal){
  1000. if (newVal){
  1001. this.saveQuote.projectNo = newVal.toUpperCase()
  1002. this.projectNoBlur();
  1003. }else {
  1004. this.saveQuote.projectDesc = ''
  1005. this.saveQuote.finalCustomerNo = ''
  1006. this.saveQuote.finalCustomerDesc = ''
  1007. }
  1008. },
  1009. 'saveQuote.quoter'(newVal, oldVal){
  1010. if (!newVal){
  1011. this.saveQuote.quoterName = ''
  1012. }
  1013. },
  1014. 'saveQuote.purchase'(newVal, oldVal){
  1015. if (!newVal){
  1016. this.saveQuote.purchaseName = ''
  1017. }
  1018. },
  1019. saveVisible(newVal, oldVal){
  1020. if (newVal === false){
  1021. this.detailFlag = false;
  1022. }
  1023. },
  1024. 'saveQuote.currency'(newVal, oldVal){
  1025. this.saveQuote.currency = newVal.toUpperCase()
  1026. },
  1027. 'currentQuote'(newVal, oldVal){
  1028. if (newVal && this.isMenu){
  1029. this.getPriceCheckProperties();
  1030. this.getApprovalList();
  1031. }
  1032. },
  1033. projectNo(newVal, oldVal){
  1034. if (newVal && !this.isMenu){
  1035. this.quoteForm.projectNo = newVal.toUpperCase()
  1036. this.quoteForm.site = this.$store.state.user.site
  1037. this.handleSearch(0);
  1038. }else {
  1039. this.dataList = []
  1040. this.total = 0
  1041. this.no = 1
  1042. }
  1043. },
  1044. },
  1045. activated() {
  1046. if (!this.isMenu){
  1047. return
  1048. }
  1049. if (this.$route.params.ids){
  1050. this.handleQueryByIds();
  1051. }else if (this.$route.params.type === 'project'){
  1052. this.quoteForm = {
  1053. ...this.quote,
  1054. site: this.$store.state.user.site,
  1055. quoteVersionNo: this.$route.params.quoteVersionNo,
  1056. }
  1057. this.handleSearch(0);
  1058. }
  1059. }
  1060. }
  1061. </script>
  1062. <template>
  1063. <div>
  1064. <download-excel v-if="!isMenu"
  1065. :fields="fields()"
  1066. :data="exportData"
  1067. type="xls"
  1068. :name="exportName"
  1069. :header="exportHeader"
  1070. :footer="exportFooter"
  1071. :fetch="createExportData"
  1072. worksheet="导出信息"
  1073. class="el-button el-button--primary el-button--medium">
  1074. {{ '导出' }}
  1075. </download-excel>
  1076. <quote-search v-if="isMenu" v-model:quote="quoteForm" @search="handleSearch" @save="handleSave"></quote-search>
  1077. <quote-table v-loading="searchLoading"
  1078. :current-row="currentQuote"
  1079. :columns="columns"
  1080. style="margin-top: 5px"
  1081. :is-menu="isMenu"
  1082. @save="handleSave"
  1083. @remove="handleRemove"
  1084. @rowClick="handleRowClick"
  1085. @updateStatus="handleUpdateStatus"
  1086. @queryById="handleQueryById"
  1087. @againQuote="handleAgainQuote"
  1088. :data-list="dataList"
  1089. :height="height">
  1090. </quote-table>
  1091. <el-pagination @size-change="handleSizeChange"
  1092. @current-change="handlePageChange"
  1093. :current-page="no"
  1094. :page-sizes="[20, 50, 100, 200, 500]"
  1095. :page-size="size"
  1096. :total="total"
  1097. layout="total,sizes, prev, pager, next, jumper">
  1098. </el-pagination>
  1099. <el-tabs v-if="isMenu" v-model="activeName" type="border-card" style="margin-top: 0;" class="customer-tab">
  1100. <el-tab-pane label="报价明细" name="detail">
  1101. <quote-group-detail :quote="currentQuote" :auth-flag="false" :height="'28vh'"></quote-group-detail>
  1102. </el-tab-pane>
  1103. <el-tab-pane label="条目明细" name="detail2">
  1104. <quote-detail v-if="activeName === 'detail2'" :save-auth="false" :quote="currentQuote" :auth-flag="false" :height="'30vh'"></quote-detail>
  1105. </el-tab-pane>
  1106. <el-tab-pane label="项目信息" name="quotation_project_information">
  1107. <quotation-project-information height="31vh" :quotation-header="currentQuote"></quotation-project-information>
  1108. </el-tab-pane>
  1109. <el-tab-pane label="客户信息" name="quotation_customer_information">
  1110. <customer-info height="31vh" :project="currentQuote"></customer-info>
  1111. </el-tab-pane>
  1112. <el-tab-pane label="客户联系人" name="quotation_customer_contact">
  1113. <quotation-customer-contact height="28vh" :quotation-header="currentQuote"></quotation-customer-contact>
  1114. </el-tab-pane>
  1115. <el-tab-pane label="报价-附件信息" name="quote_oss">
  1116. <oss-components
  1117. :save-visible="isAuth('5011:tab6:save')"
  1118. :download-visible="isAuth('5011:tab6:download')"
  1119. :remove-visible="isAuth('5011:tab6:remove')"
  1120. :preview-visible="isAuth('5011:tab6:preview')"
  1121. label="报价单号"
  1122. height="28vh"
  1123. :columns="ossColumns"
  1124. :order-ref1="currentQuote.site?currentQuote.site:''"
  1125. :order-ref2="currentQuote.quoteVersionNo?currentQuote.quoteVersionNo:''">
  1126. </oss-components>
  1127. </el-tab-pane>
  1128. <el-tab-pane label="询价-基本信息" name="request">
  1129. <price-check-properties ref="tabProperties"
  1130. v-model:data-list="priceCheckPropertiesList"
  1131. height="31vh"></price-check-properties>
  1132. </el-tab-pane>
  1133. <el-tab-pane label="询价-附件信息" name="oss">
  1134. <oss-components
  1135. :save-visible="isAuth('102001001:tab6:save')"
  1136. :download-visible="isAuth('102001001:tab6:download')"
  1137. :remove-visible="isAuth('102001001:tab6:remove')"
  1138. :preview-visible="isAuth('102001001:tab6:preview')"
  1139. label="询价单号"
  1140. height="28vh"
  1141. :columns="ossColumns"
  1142. :order-ref1="currentQuote.site"
  1143. :order-ref2="currentQuote.insideInquiryNo?currentQuote.insideInquiryNo.split('-')[0]:''">
  1144. </oss-components>
  1145. </el-tab-pane>
  1146. <!-- 审批信息 -->
  1147. <el-tab-pane label="审批信息" name="approvalInformation">
  1148. <approval-information ref="approvalTable" v-model:data-list="approvalList" :height="300"></approval-information>
  1149. </el-tab-pane>
  1150. </el-tabs>
  1151. <el-dialog :title="saveQuote.id? '报价信息:'+ saveQuote.quoteVersionNo : '报价信息'" v-drag :close-on-click-modal="false" :visible.sync="saveVisible" width="500px" >
  1152. <el-form ref="saveForm" :model="saveQuote" :rules="saveRules" label-position="top" label-width="100px">
  1153. <el-row :gutter="10">
  1154. <el-col :span="8">
  1155. <el-form-item label="内部询价单号" prop="insideInquiryNo" :show-message="false">
  1156. <span slot="label" v-if="!detailFlag">
  1157. <a @click="handleQueryInquiry">内部询价单号</a>
  1158. </span>
  1159. <el-input v-model="saveQuote.insideInquiryNo" readonly @change="handleInquiryBlur" :disabled="detailFlag"></el-input>
  1160. </el-form-item>
  1161. </el-col>
  1162. <el-col :span="8">
  1163. <el-form-item label="报价日期" prop="quoteDate" :show-message="false">
  1164. <el-date-picker style="width: 100%" :disabled="detailFlag" v-model="saveQuote.quoteDate" type="date" value-format='yyyy-MM-dd' format='yyyy-MM-dd'></el-date-picker>
  1165. </el-form-item>
  1166. </el-col>
  1167. <el-col :span="8">
  1168. <el-form-item label="客户询价单号" prop="customerInquiryNo" :show-message="false">
  1169. <el-input v-model="saveQuote.customerInquiryNo" :disabled="detailFlag"></el-input>
  1170. </el-form-item>
  1171. </el-col>
  1172. </el-row>
  1173. <el-row :gutter="10">
  1174. <el-col :span="8">
  1175. <el-form-item label="客户编码" prop="customerNo" :show-message="false">
  1176. <span slot="label" v-if="!detailFlag">
  1177. <a @click="getBaseList(102)">客户编码</a>
  1178. </span>
  1179. <el-input v-model="saveQuote.customerNo" :disabled="detailFlag" @change="customerNoBlur"></el-input>
  1180. </el-form-item>
  1181. </el-col>
  1182. <el-col :span="16">
  1183. <el-form-item label="客户描述" prop="customerDesc" :show-message="false">
  1184. <el-input v-model="saveQuote.customerDesc" disabled></el-input>
  1185. </el-form-item>
  1186. </el-col>
  1187. </el-row>
  1188. <el-row :gutter="10">
  1189. <el-col :span="8">
  1190. <el-form-item label="项目编码" prop="projectNo" :show-message="false">
  1191. <span slot="label" v-if="saveQuote.customerNo && !detailFlag">
  1192. <a @click="getBaseList(104)">项目编码</a>
  1193. </span>
  1194. <el-input v-model="saveQuote.projectNo" :disabled="!saveQuote.customerNo || detailFlag"></el-input>
  1195. </el-form-item>
  1196. </el-col>
  1197. <el-col :span="16">
  1198. <el-form-item label="项目描述" prop="projectDesc" :show-message="false">
  1199. <el-input v-model="saveQuote.projectDesc" disabled></el-input>
  1200. </el-form-item>
  1201. </el-col>
  1202. </el-row>
  1203. <el-row :gutter="10">
  1204. <el-col :span="8">
  1205. <el-form-item label="终端客户编码" prop="finalCustomerNo" :show-message="false">
  1206. <el-input v-model="saveQuote.finalCustomerNo" disabled></el-input>
  1207. </el-form-item>
  1208. </el-col>
  1209. <el-col :span="16">
  1210. <el-form-item label="终端客户描述" prop="finalCustomerDesc" :show-message="false">
  1211. <el-input v-model="saveQuote.finalCustomerDesc" disabled></el-input>
  1212. </el-form-item>
  1213. </el-col>
  1214. </el-row>
  1215. <el-row :gutter="10">
  1216. <el-col :span="8">
  1217. <el-form-item label="报价专员" prop="quoter" :show-message="false">
  1218. <a slot="label" v-if="!detailFlag" @click="getBaseList(2002)">报价专员</a>
  1219. <el-input v-model="saveQuote.quoterName" readonly :disabled="detailFlag">
  1220. <span slot="suffix" v-show="saveQuote.quoter && !detailFlag" @click="clearModalData('quoter')"><i class="el-icon-circle-close" style="margin-left: 5px;cursor: pointer;"></i></span>
  1221. </el-input>
  1222. </el-form-item>
  1223. </el-col>
  1224. <el-col :span="8">
  1225. <el-form-item label="采购专员" prop="purchase" :show-message="false">
  1226. <a slot="label" v-if="!detailFlag" @click="getBaseList(2000)">采购专员</a>
  1227. <el-input v-model="saveQuote.purchaseName" readonly :disabled="detailFlag">
  1228. <span slot="suffix" v-show="saveQuote.purchase && !detailFlag" @click="clearModalData('purchase')"><i class="el-icon-circle-close" style="margin-left: 5px;cursor: pointer;"></i></span>
  1229. </el-input>
  1230. </el-form-item>
  1231. </el-col>
  1232. <el-col :span="24">
  1233. <el-form-item label="备注" prop="remark" class="auto" :show-message="false">
  1234. <el-input v-model="saveQuote.remark" :disabled="detailFlag" :rows="3" type="textarea"></el-input>
  1235. </el-form-item>
  1236. </el-col>
  1237. </el-row>
  1238. </el-form>
  1239. <div slot="footer" class="dialog-footer">
  1240. <el-button type="primary" v-if="!detailFlag" @click="handleSaveOrUpdateQuote"> </el-button>
  1241. <el-button @click="saveVisible = false"> </el-button>
  1242. </div>
  1243. </el-dialog>
  1244. <el-dialog title="询价申请" v-drag :visible.sync="insideInquiryVisible" width="1000px" modal-append-to-body :close-on-click-modal="false">
  1245. <el-form label-position="top"
  1246. :model="insideInquiry"
  1247. size="mini">
  1248. <el-row :gutter="10">
  1249. <el-col :span="3">
  1250. <el-form-item label="询价单号">
  1251. <el-input v-model="insideInquiry.quotationNo" clearable/>
  1252. </el-form-item>
  1253. </el-col>
  1254. <el-col :span="3">
  1255. <el-form-item label="申请批次号">
  1256. <el-input v-model="insideInquiry.quotationBatchNo" clearable></el-input>
  1257. </el-form-item>
  1258. </el-col>
  1259. <el-col :span="3">
  1260. <el-form-item label="序号">
  1261. <el-input v-model="insideInquiry.quotationItemNo" clearable></el-input>
  1262. </el-form-item>
  1263. </el-col>
  1264. <el-col :span="3">
  1265. <el-form-item label="状态">
  1266. <el-select v-model="insideInquiry.quotationStatus" style="width:100%">
  1267. <el-option label="全部" value=""></el-option>
  1268. <el-option label="草稿" value="草稿"></el-option>
  1269. <el-option label="审批中" value="审批中"></el-option>
  1270. <el-option label="已完成" value="已完成"></el-option>
  1271. </el-select>
  1272. </el-form-item>
  1273. </el-col>
  1274. <el-col :span="2">
  1275. <el-form-item label=" ">
  1276. <el-button type="primary" style="padding: 3px 12px" @click="searchInsideInquiry">查询</el-button>
  1277. </el-form-item>
  1278. </el-col>
  1279. </el-row>
  1280. </el-form>
  1281. <el-table :data="insideInquiryList" height="300" stripe border @row-dblclick="dblclickInsideInquiry">
  1282. <el-table-column prop="quotationNo" header-align="center" min-width="120" label="询价单号"/>
  1283. <el-table-column prop="quotationBatchNo" header-align="center" label="询价批次号"/>
  1284. <el-table-column width="60" align="center" header-align="center" prop="quotationItemNo" label="询价序号"/>
  1285. <el-table-column prop="projectName" header-align="center" label="项目名称"/>
  1286. <el-table-column prop="quotationStatus" header-align="center" label="状态"/>
  1287. <el-table-column label="终端客户编码" header-align="center" prop="finalCustomerId"/>
  1288. <el-table-column label="终端客户名称" header-align="center" prop="finalCustomerName"/>
  1289. </el-table>
  1290. <el-footer style="height:30px;margin-top: 20px;text-align:center">
  1291. <el-button type="primary" @click="insideInquiryVisible = false">关闭</el-button>
  1292. </el-footer>
  1293. </el-dialog>
  1294. <choose-list ref="baseList" @getBaseData="getBaseData"></choose-list>
  1295. </div>
  1296. </template>
  1297. <style scoped>
  1298. .auto /deep/ .el-form-item__content{
  1299. height: auto;
  1300. line-height: 1.5;
  1301. }
  1302. .el-table /deep/ .cell{
  1303. height: auto;
  1304. line-height: 1.5;
  1305. }
  1306. </style>