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.

1079 lines
34 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 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
11 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
10 months 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
11 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
1 year ago
1 year ago
1 year 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 {getSiteAndBuByUserName} from "../../../api/eam/eam";
  14. import CustomerTable from "../../../components/selector/table/customerTable.vue";
  15. import BuSelect from "../../../components/selector/select/BuSelect.vue";
  16. import ProjectTable from "../../../components/selector/table/projectTable.vue";
  17. import {queryCustomerList} from "../../../api/customer/customer";
  18. import {queryProjectList} from "../../../api/project/project";
  19. import QuoteDetail from "./detail/quoteDetail.vue";
  20. import ChooseListEam from "../common/Chooselist_eam.vue";
  21. import Quotes from "./quotes.vue";
  22. import QuoteGroupDetail from "./detail/quoteGroupDetail.vue";
  23. import {getTableDefaultListLanguage, getTableUserListLanguage, updateColumnSize} from "../../../api/table";
  24. export default {
  25. name: "quote",
  26. components: {
  27. QuoteGroupDetail,
  28. Quotes, ChooseListEam,QuoteDetail, ProjectTable, BuSelect, CustomerTable, QuoteTable, QuoteSearch},
  29. menuId:5011,
  30. data(){
  31. return{
  32. total: 0,
  33. no:1,
  34. size: 20,
  35. quote:{
  36. id: null,
  37. site:"",
  38. quoteNo: "",
  39. customerInquiryNo: "",
  40. insideInquiryNo: "",
  41. buNo: "",
  42. buId: null,
  43. versionNo: "",
  44. status:'',
  45. quoteVersionNo: "",
  46. customerNo: "",
  47. customerDesc: "",
  48. projectNo: "",
  49. projectDesc: "",
  50. currency: "",
  51. quoteDate: "",
  52. quoter: "",
  53. purchase: "",
  54. remark: "",
  55. createBy: "",
  56. createDate: "",
  57. updateBy: "",
  58. updateDate: "",
  59. application: "",
  60. annualDemand: "",
  61. costModel: "UFIDA",
  62. markup:0,
  63. chipPrice:'',
  64. },
  65. quoteForm:{
  66. },
  67. saveQuote:{
  68. },
  69. dataList:[],
  70. columns: [
  71. {
  72. userId: this.$store.state.user.name,
  73. functionId: 5011,
  74. serialNumber: '5011Table1BuDesc',
  75. tableId: '5011Table1',
  76. tableName: '报价信息表',
  77. columnProp: 'buDesc',
  78. headerAlign: 'center',
  79. align: 'center',
  80. columnLabel: 'BU',
  81. columnHidden: false,
  82. columnImage: false,
  83. columnSortable: false,
  84. sortLv: 0,
  85. status: true,
  86. fixed: '',
  87. columnWidth: 120
  88. },
  89. {
  90. userId: this.$store.state.user.name,
  91. functionId: 5011,
  92. serialNumber: '5011Table1QuoteVersionNo',
  93. tableId: '5011Table1',
  94. tableName: '报价信息表',
  95. columnProp: 'quoteVersionNo',
  96. headerAlign: 'center',
  97. align: 'center',
  98. columnLabel: '报价单号',
  99. columnHidden: false,
  100. columnImage: false,
  101. columnSortable: false,
  102. sortLv: 0,
  103. status: true,
  104. fixed: '',
  105. columnWidth: 180
  106. },
  107. {
  108. userId: this.$store.state.user.name,
  109. functionId: 5011,
  110. serialNumber: '5011Table1QuoteDate',
  111. tableId: '5011Table1',
  112. tableName: '报价信息表',
  113. columnProp: 'quoteDate',
  114. headerAlign: 'center',
  115. align: 'center',
  116. columnLabel: '报价日期',
  117. columnHidden: false,
  118. columnImage: false,
  119. columnSortable: false,
  120. sortLv: 0,
  121. status: true,
  122. fixed: '',
  123. columnWidth: 100
  124. },
  125. {
  126. userId: this.$store.state.user.name,
  127. functionId: 5011,
  128. serialNumber: '5011Table1CustomerNo',
  129. tableId: '5011Table1',
  130. tableName: '报价信息表',
  131. columnProp: 'customerNo',
  132. headerAlign: 'center',
  133. align: 'center',
  134. columnLabel: '客户编码',
  135. columnHidden: false,
  136. columnImage: false,
  137. columnSortable: false,
  138. sortLv: 0,
  139. status: true,
  140. fixed: '',
  141. columnWidth: 120
  142. },
  143. {
  144. userId: this.$store.state.user.name,
  145. functionId: 5011,
  146. serialNumber: '5011Table1CustomerDesc',
  147. tableId: '5011Table1',
  148. tableName: '报价信息表',
  149. columnProp: 'customerDesc',
  150. headerAlign: 'center',
  151. align: 'center',
  152. columnLabel: '客户名称',
  153. columnHidden: false,
  154. columnImage: false,
  155. columnSortable: false,
  156. sortLv: 0,
  157. status: true,
  158. fixed: '',
  159. columnWidth: 120
  160. },
  161. {
  162. userId: this.$store.state.user.name,
  163. functionId: 5011,
  164. serialNumber: '5011Table1QuoterName',
  165. tableId: '5011Table1',
  166. tableName: '报价信息表',
  167. columnProp: 'quoterName',
  168. headerAlign: 'center',
  169. align: 'center',
  170. columnLabel: '报价专员',
  171. columnHidden: false,
  172. columnImage: false,
  173. columnSortable: false,
  174. sortLv: 0,
  175. status: true,
  176. fixed: '',
  177. columnWidth: 120
  178. },
  179. {
  180. userId: this.$store.state.user.name,
  181. functionId: 5011,
  182. serialNumber: '5011Table1PurchaseName',
  183. tableId: '5011Table1',
  184. tableName: '报价信息表',
  185. columnProp: 'purchaseName',
  186. headerAlign: 'center',
  187. align: 'center',
  188. columnLabel: '采购专员',
  189. columnHidden: false,
  190. columnImage: false,
  191. columnSortable: false,
  192. sortLv: 0,
  193. status: true,
  194. fixed: '',
  195. columnWidth: 120
  196. },
  197. {
  198. userId: this.$store.state.user.name,
  199. functionId: 5011,
  200. serialNumber: '5011Table1Currency',
  201. tableId: '5011Table1',
  202. tableName: '报价信息表',
  203. columnProp: 'currency',
  204. headerAlign: 'center',
  205. align: 'center',
  206. columnLabel: '货币',
  207. columnHidden: false,
  208. columnImage: false,
  209. columnSortable: false,
  210. sortLv: 0,
  211. status: true,
  212. fixed: '',
  213. columnWidth: 120
  214. },
  215. {
  216. userId: this.$store.state.user.name,
  217. functionId: 5011,
  218. serialNumber: '5011Table1Status',
  219. tableId: '5011Table1',
  220. tableName: '报价信息表',
  221. columnProp: 'status',
  222. headerAlign: 'center',
  223. align: 'center',
  224. columnLabel: '状态',
  225. columnHidden: false,
  226. columnImage: false,
  227. columnSortable: false,
  228. sortLv: 0,
  229. status: true,
  230. fixed: '',
  231. columnWidth: 120
  232. },
  233. {
  234. userId: this.$store.state.user.name,
  235. functionId: 5011,
  236. serialNumber: '5011Table1CustomerInquiryNo',
  237. tableId: '5011Table1',
  238. tableName: '报价信息表',
  239. columnProp: 'customerInquiryNo',
  240. headerAlign: 'center',
  241. align: 'center',
  242. columnLabel: '客户报价单号',
  243. columnHidden: false,
  244. columnImage: false,
  245. columnSortable: false,
  246. sortLv: 0,
  247. status: true,
  248. fixed: '',
  249. columnWidth: 120
  250. },
  251. {
  252. userId: this.$store.state.user.name,
  253. functionId: 5011,
  254. serialNumber: '5011Table1InsideInquiryNo',
  255. tableId: '5011Table1',
  256. tableName: '报价信息表',
  257. columnProp: 'insideInquiryNo',
  258. headerAlign: 'center',
  259. align: 'center',
  260. columnLabel: '内部询价单号',
  261. columnHidden: false,
  262. columnImage: false,
  263. columnSortable: false,
  264. sortLv: 0,
  265. status: true,
  266. fixed: '',
  267. columnWidth: 120
  268. },
  269. {
  270. userId: this.$store.state.user.name,
  271. functionId: 5011,
  272. serialNumber: '5011Table1CreateBy',
  273. tableId: '5011Table1',
  274. tableName: '报价信息表',
  275. columnProp: 'createBy',
  276. headerAlign: 'center',
  277. align: 'center',
  278. columnLabel: '创建人',
  279. columnHidden: false,
  280. columnImage: false,
  281. columnSortable: false,
  282. sortLv: 0,
  283. status: true,
  284. fixed: '',
  285. columnWidth: 120
  286. },
  287. {
  288. userId: this.$store.state.user.name,
  289. functionId: 5011,
  290. serialNumber: '5011Table1CreateDate',
  291. tableId: '5011Table1',
  292. tableName: '报价信息表',
  293. columnProp: 'createDate',
  294. headerAlign: 'center',
  295. align: 'center',
  296. columnLabel: '创建时间',
  297. columnHidden: false,
  298. columnImage: false,
  299. columnSortable: false,
  300. sortLv: 0,
  301. status: true,
  302. fixed: '',
  303. columnWidth: 130
  304. },
  305. {
  306. userId: this.$store.state.user.name,
  307. functionId: 5011,
  308. serialNumber: '5011Table1UpdateBy',
  309. tableId: '5011Table1',
  310. tableName: '报价信息表',
  311. columnProp: 'updateBy',
  312. headerAlign: 'center',
  313. align: 'center',
  314. columnLabel: '更新人',
  315. columnHidden: false,
  316. columnImage: false,
  317. columnSortable: false,
  318. sortLv: 0,
  319. status: true,
  320. fixed: '',
  321. columnWidth: 120
  322. },
  323. {
  324. userId: this.$store.state.user.name,
  325. functionId: 5011,
  326. serialNumber: '5011Table1UpdateDate',
  327. tableId: '5011Table1',
  328. tableName: '报价信息表',
  329. columnProp: 'updateDate',
  330. headerAlign: 'center',
  331. align: 'center',
  332. columnLabel: '更新时间',
  333. columnHidden: false,
  334. columnImage: false,
  335. columnSortable: false,
  336. sortLv: 0,
  337. status: true,
  338. fixed: '',
  339. columnWidth: 130
  340. },
  341. ],
  342. searchLoading: false,
  343. saveVisible: false,
  344. saveLoading: false,
  345. activeName:'group_detail',
  346. userBuList: [],
  347. saveRules: {
  348. buId:[{required: true, message: '请选择BU', trigger: ['blur','change']}],
  349. customerNo:[{required: true, message: '请输入客户编码', trigger: ['blur','change']}],
  350. customerDesc:[{required: true, message: '请输入客户名称', trigger: ['blur','change']}],
  351. projectNo:[{required: true, message: '请输入项目编码', trigger: ['blur','change']}],
  352. projectDesc:[{required: true, message: '请输入项目名称', trigger: ['blur','change']}],
  353. currency:[{required: true, message: '请输入币种', trigger: ['blur','change']}],
  354. quoteDate:[{required: true, message: '请选择报价日期', trigger: ['blur','change']}],
  355. quoter:[{required: true, message: '请输入报价专员', trigger: ['blur','change']}],
  356. purchase:[{required: true, message: '请输入询价专员', trigger: ['blur','change']}],
  357. },
  358. customerVisible:false,
  359. projectVisible:false,
  360. quoterVisible:false,
  361. purchaseVisible:false,
  362. currentQuote:{
  363. },
  364. userVisible:false,
  365. userTitle:'人员信息',
  366. user:{
  367. username:'',
  368. userDisplay:'',
  369. active:'',
  370. buId:null,
  371. roleNo:'',
  372. },
  373. userDataList:[],
  374. tagNo:undefined,
  375. insideInquiryVisible:false,
  376. detailFlag:false,
  377. }
  378. },
  379. methods:{
  380. // 动态列开始 获取 用户保存的 格式列
  381. async getTableUserColumn(tableId, columnId) {
  382. let queryTableUser = {
  383. userId: this.$store.state.user.name,
  384. functionId: this.$route.meta.menuId,
  385. tableId: tableId,
  386. status: true,
  387. languageCode: this.$i18n.locale
  388. }
  389. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  390. if (data.rows.length > 0) {
  391. switch (columnId) {
  392. case 1:
  393. this.columns = data.rows
  394. break;
  395. }
  396. } else {
  397. this.getColumnList(tableId, columnId)
  398. }
  399. })
  400. },
  401. // 获取 tableDefault 列
  402. async getColumnList (tableId, columnId) {
  403. let queryTable= {
  404. functionId: this.$route.meta.menuId,
  405. tableId: tableId,
  406. languageCode: this.$i18n.locale
  407. }
  408. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  409. if (!data.rows.length === 0) {
  410. switch (columnId) {
  411. case 1:
  412. this.columns = data.rows
  413. break;
  414. }
  415. }
  416. })
  417. },
  418. handleColumnResize(newWidth, oldWidth, column, event){
  419. let inData= this.columnList.filter(item => item.columnProp === column.property)[0]
  420. inData.columnWidth=newWidth
  421. updateColumnSize(inData).then(({data}) => {
  422. if (data.code === 0) {
  423. console.log("栏位宽度保存成功!")
  424. }
  425. })
  426. },
  427. handleSearch(index){
  428. let params = {
  429. ...this.quoteForm,
  430. no: this.no,
  431. size: this.size,
  432. }
  433. this.searchLoading = true
  434. queryQuotePage(params).then(({data})=>{
  435. if (data && data.code === 0){
  436. this.dataList = data.rows
  437. this.total = data.total
  438. if (index !== undefined){
  439. this.handleSelect(this.dataList[index])
  440. }
  441. }else {
  442. this.$message.error(data.msg)
  443. }
  444. this.searchLoading = false
  445. }).catch(error=>{
  446. this.$message.error(error)
  447. this.searchLoading = false
  448. })
  449. },
  450. handleSelect(row){
  451. if (row){
  452. this.currentQuote = {...row}
  453. }else {
  454. this.currentQuote = {}
  455. }
  456. },
  457. handleSave(row){
  458. this.$nextTick(()=>{
  459. if (this.$refs.saveForm){
  460. this.$refs.saveForm.clearValidate();
  461. }
  462. })
  463. if (row){
  464. this.saveQuote = {
  465. ...row
  466. }
  467. }else {
  468. this.saveQuote = {
  469. ...this.quote,
  470. }
  471. this.$nextTick(()=>{
  472. this.saveQuote.buId = this.userBuList.length > 0? this.userBuList[0].id:null;
  473. })
  474. }
  475. this.saveVisible = true
  476. },
  477. handleSizeChange(size){
  478. this.size = size
  479. this.handleSearch();
  480. },
  481. handlePageChange(no) {
  482. this.no = no
  483. this.handleSearch();
  484. },
  485. handleQueryBu(){
  486. let params = {
  487. username: this.$store.state.user.name,
  488. }
  489. getSiteAndBuByUserName(params).then(({data}) => {
  490. if (data && data.code === 0) {
  491. this.userBuList = data.rows
  492. }else {
  493. this.$message.warning(data.msg)
  494. }
  495. }).catch((error)=>{
  496. this.$message.error(error)
  497. })
  498. },
  499. handleSaveOrUpdateQuote(){
  500. this.$refs.saveForm.validate((valid,obj) => {
  501. if (valid){
  502. if (this.saveQuote.id){
  503. this.handleUpdateQuote();
  504. }else {
  505. this.handleSaveQuote();
  506. }
  507. }else {
  508. let i = 1;
  509. for (let key in obj){
  510. this.$message.warning(obj[key][0].message)
  511. if (i === 1){
  512. return
  513. }
  514. i++;
  515. }
  516. }
  517. })
  518. },
  519. handleSaveQuote(){
  520. let params = {
  521. ...this.saveQuote,
  522. status: '草稿',
  523. action: 'Y',
  524. createBy: this.$store.state.user.name,
  525. }
  526. this.saveLoading = true
  527. saveQuote(params).then(({data})=>{
  528. if (data && data.code === 0){
  529. this.saveVisible = false
  530. this.$message.success(data.msg)
  531. }else {
  532. this.$message.warning(data.msg)
  533. }
  534. this.handleSearch(0);
  535. this.saveLoading = false
  536. }).catch((error)=>{
  537. this.$message.error(error)
  538. this.saveLoading = false
  539. })
  540. },
  541. handleUpdateQuote(){
  542. let params = {
  543. ...this.saveQuote,
  544. updateBy: this.$store.state.user.name,
  545. }
  546. this.saveLoading = true
  547. updateQuote(params).then(({data})=>{
  548. if (data && data.code === 0){
  549. this.saveVisible = false
  550. this.currentQuote = {
  551. ...this.currentQuote
  552. }
  553. this.$message.success(data.msg)
  554. }else {
  555. this.$message.warning(data.msg)
  556. }
  557. this.handleSearch();
  558. this.saveLoading = false
  559. }).catch((error)=>{
  560. this.$message.error(error)
  561. this.saveLoading = false
  562. })
  563. },
  564. customerDblClick(row){
  565. this.saveQuote.customerNo = row.customerNo
  566. this.saveQuote.customerDesc = row.customerDesc
  567. this.customerVisible = false
  568. },
  569. projectDblClick(row){
  570. this.saveQuote.projectNo = row.projectNo
  571. this.saveQuote.projectDesc = row.projectDesc
  572. this.projectVisible = false
  573. },
  574. handleRemove(row){
  575. this.$confirm('确认删除该报价信息吗?', '提示', {
  576. confirmButtonText: '确定',
  577. cancelButtonText: '取消',
  578. type: 'warning'
  579. }).then(() => {
  580. this.handleRemoveQuote(row)
  581. }).catch(() => {
  582. })
  583. },
  584. handleUpdateStatus(row){
  585. this.$confirm(`确定要${row.enStatus}该报价单吗?`, '提示', {
  586. confirmButtonText: '确定',
  587. cancelButtonText: '取消',
  588. type: 'warning'
  589. }).then(()=>{
  590. let params = {
  591. ...row,
  592. }
  593. updateQuoteStatus(params).then(({data})=>{
  594. if (data && data.code === 0){
  595. this.$message.success(data.msg)
  596. this.handleSearch();
  597. this.currentQuote = {
  598. ...row,
  599. status:row.enStatus
  600. }
  601. }else {
  602. this.$message.warning(data.msg)
  603. }
  604. }).catch((error)=>{
  605. this.$message.error(error)
  606. })
  607. })
  608. },
  609. handleQueryById(row){
  610. this.saveQuote = {
  611. ...row
  612. }
  613. this.detailFlag = true;
  614. this.saveVisible = true;
  615. },
  616. handleRemoveQuote(row){
  617. let params = {
  618. id: row.id,
  619. }
  620. removeQuote(params).then(({data})=>{
  621. if (data && data.code === 0){
  622. this.$message.success(data.msg)
  623. if (row.id === this.currentQuote.id){
  624. this.handleSearch(0);
  625. }else {
  626. this.handleSearch();
  627. }
  628. }else {
  629. this.$message.warning(data.msg)
  630. }
  631. }).catch((error)=>{
  632. this.$message.error(error)
  633. })
  634. },
  635. customerNoBlur(){
  636. let params = {
  637. customerNo: this.saveQuote.customerNo,
  638. createBy: this.$store.state.user.name,
  639. }
  640. queryCustomerList(params).then(({data}) => {
  641. if (data && data.code === 0) {
  642. if (data.rows.length === 1){
  643. this.saveQuote.customerDesc = data.rows[0].customerDesc
  644. }else {
  645. this.saveQuote.projectNo = ''
  646. this.saveQuote.projectDesc = ''
  647. this.saveQuote.customerDesc = ''
  648. }
  649. }else {
  650. this.$message.warning(data.message)
  651. }
  652. }).catch((error) => {
  653. this.$message.error(error)
  654. })
  655. },
  656. projectNoBlur(){
  657. let params = {
  658. projectNo: this.saveQuote.projectNo,
  659. customerNo: this.saveQuote.customerNo,
  660. createBy: this.$store.state.user.name,
  661. buId: this.saveQuote.buId,
  662. }
  663. queryProjectList(params).then(({data})=>{
  664. if (data && data.code === 0) {
  665. if (data.rows.length === 1) {
  666. this.saveQuote.projectDesc = data.rows[0].projectDesc
  667. }else {
  668. this.saveQuote.projectDesc = ''
  669. }
  670. }else {
  671. this.$message.warning(data.msg)
  672. }
  673. }).catch((error)=>{
  674. this.$message.error(error)
  675. })
  676. },
  677. handleRowClick(row){
  678. this.currentQuote = {...row}
  679. },
  680. userDblClick(row){
  681. if (this.quoterVisible){
  682. this.saveQuote.quoter = row.username
  683. this.quoterVisible = false
  684. }else if (this.purchaseVisible){
  685. this.saveQuote.purchase = row.username
  686. this.purchaseVisible = false
  687. }
  688. this.userVisible = false
  689. },
  690. handleQuoterClick(){
  691. this.userTitle = '报价专员'
  692. this.user.username = this.saveQuote.quoter
  693. this.user.userDisplay = ''
  694. this.user.active = ''
  695. this.user.buId = this.saveQuote.buId
  696. this.user.roleNo = 'QUOTER'
  697. this.quoterVisible = true
  698. this.handleQueryQuoteRoleUser();
  699. this.userVisible = true
  700. },
  701. handlePurchaseClick(){
  702. this.userTitle = '采购专员'
  703. this.user.username = this.saveQuote.purchase
  704. this.user.userDisplay = ''
  705. this.user.active = ''
  706. this.user.buId = this.saveQuote.buId
  707. this.user.roleNo = 'PURCHASE'
  708. this.purchaseVisible = true
  709. this.handleQueryQuoteRoleUser();
  710. this.userVisible = true
  711. },
  712. handleQueryQuoteRoleUser(){
  713. let params = {
  714. ...this.user,
  715. }
  716. this.userDataList = []
  717. queryQuoteRoleUser(params).then(({data})=>{
  718. if (data && data.code === 0){
  719. this.userDataList = data.rows
  720. }else {
  721. this.$message.warning(data.msg)
  722. }
  723. }).catch((error)=>{
  724. this.$message.error(error)
  725. })
  726. },
  727. getBaseList(val){
  728. this.tagNo = val
  729. this.$nextTick(()=>{
  730. let strVal = ''
  731. if (val === 512){
  732. strVal = this.saveQuote.currency;
  733. this.$refs.baseList.init(val,strVal)
  734. }
  735. })
  736. },
  737. getBaseData(val){
  738. if (this.tagNo === 512){
  739. this.saveQuote.currency = val.Currency
  740. }
  741. },
  742. handleQueryByIds(){
  743. let params = {
  744. ids:this.$route.params.ids,
  745. no:this.no,
  746. size:this.size,
  747. createBy:this.$store.state.user.name,
  748. }
  749. queryQuotePage(params).then(({data})=>{
  750. if (data && data.code === 0){
  751. this.dataList = data.rows
  752. this.total = data.total
  753. if (this.total > 0){
  754. this.currentQuote = {...this.dataList[0]}
  755. }else {
  756. this.currentQuote = {}
  757. }
  758. }else {
  759. this.$message.error(data.msg)
  760. }
  761. this.searchLoading = false
  762. }).catch(error=>{
  763. this.$message.error(error)
  764. this.searchLoading = false
  765. })
  766. },
  767. handleInquiryDblClick(row){
  768. this.saveQuote.insideInquiryNo = row.quotationNo
  769. this.saveQuote.customerNo = row.customerNo
  770. this.saveQuote.customerDesc = row.customerDesc
  771. this.saveQuote.projectNo = row.projectNo
  772. this.saveQuote.projectDesc = row.projectDesc
  773. this.saveQuote.quoter = row.quoter
  774. this.saveQuote.customerInquiryNo = row.customerQuoteNo
  775. this.insideInquiryVisible = false
  776. },
  777. handleInquiryBlur(){
  778. },
  779. handleAgainQuote(row){
  780. let params = {
  781. id: row.id,
  782. createBy: this.$store.state.user.name,
  783. }
  784. this.queryLoading = true
  785. againQuote(params).then(({data}) => {
  786. if (data && data.code === 0) {
  787. this.$message.success(data.msg)
  788. this.handleSearch();
  789. } else {
  790. this.$message.warning(data.msg)
  791. this.queryLoading = false
  792. }
  793. }).catch((error) => {
  794. this.$message.error(error)
  795. this.queryLoading = false
  796. })
  797. },
  798. clearModalData(field){
  799. this.saveQuote[field] = ''
  800. },
  801. },
  802. created() {
  803. this.quoteForm = {
  804. ...this.quote,
  805. createBy: this.$store.state.user.name,
  806. }
  807. this.handleQueryBu();// 查询 BU
  808. this.handleSearch(0);// 查询报价信息
  809. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  810. },
  811. watch:{
  812. 'quoteForm.customerNo'(newVal, oldVal){
  813. this.quoteForm.customerNo = newVal.toUpperCase()
  814. },
  815. 'quoteForm.projectNo'(newVal, oldVal){
  816. this.quoteForm.projectNo = newVal.toUpperCase()
  817. },
  818. 'quoteForm.quoteNo'(newVal, oldVal){
  819. this.quoteForm.quoteNo = newVal.toUpperCase()
  820. },
  821. 'saveQuote.customerNo'(newVal, oldVal){
  822. this.saveQuote.customerNo = newVal.toUpperCase()
  823. },
  824. 'saveQuote.projectNo'(newVal, oldVal){
  825. this.saveQuote.projectNo = newVal.toUpperCase()
  826. },
  827. saveVisible(newVal, oldVal){
  828. if (newVal === false){
  829. this.detailFlag = false;
  830. }
  831. },
  832. 'saveQuote.currency'(newVal, oldVal){
  833. this.saveQuote.currency = newVal.toUpperCase()
  834. }
  835. },
  836. activated() {
  837. if (this.$route.params.ids){
  838. this.handleQueryByIds();
  839. }
  840. }
  841. }
  842. </script>
  843. <template>
  844. <div>
  845. <quote-search v-model:quote="quoteForm" @search="handleSearch" @save="handleSave"></quote-search>
  846. <quote-table v-loading="searchLoading"
  847. :current-row="currentQuote"
  848. :columns="columns"
  849. style="margin-top: 5px"
  850. @save="handleSave"
  851. @remove="handleRemove"
  852. @rowClick="handleRowClick"
  853. @updateStatus="handleUpdateStatus"
  854. @queryById="handleQueryById"
  855. @againQuote="handleAgainQuote"
  856. :data-list="dataList"
  857. :height="'35vh'">
  858. </quote-table>
  859. <el-pagination @size-change="handleSizeChange"
  860. @current-change="handlePageChange"
  861. :current-page="no"
  862. :page-sizes="[20, 50, 100, 200, 500]"
  863. :page-size="size"
  864. :total="total"
  865. layout="total,sizes, prev, pager, next, jumper">
  866. </el-pagination>
  867. <el-tabs v-model="activeName" >
  868. <el-tab-pane label="报价明细" name="group_detail">
  869. <quote-group-detail :quote="currentQuote" :auth-flag="false" :height="'33vh'"></quote-group-detail>
  870. </el-tab-pane>
  871. <el-tab-pane label="条目明细" name="detail">
  872. <quote-detail v-if="activeName === 'detail'" :save-auth="false" :quote="currentQuote" :auth-flag="false" :height="'33vh'"></quote-detail>
  873. </el-tab-pane>
  874. </el-tabs>
  875. <el-dialog :title="saveQuote.id? '报价信息:'+ saveQuote.quoteVersionNo : '报价信息'" v-drag :close-on-click-modal="false" :visible.sync="saveVisible" width="500px" >
  876. <el-form ref="saveForm" :model="saveQuote" :rules="saveRules" label-position="top" label-width="100px">
  877. <el-row :gutter="10">
  878. <el-col :span="8">
  879. <el-form-item label="BU" prop="buId" :show-message="false">
  880. <bu-select v-model="saveQuote.buId" :disabled="saveQuote.id > 0"></bu-select>
  881. </el-form-item>
  882. </el-col>
  883. </el-row>
  884. <el-row :gutter="10">
  885. <el-col :span="8">
  886. <el-form-item label="客户询价单号" prop="customerInquiryNo" :show-message="false">
  887. <el-input v-model="saveQuote.customerInquiryNo" :disabled="detailFlag"></el-input>
  888. </el-form-item>
  889. </el-col>
  890. <el-col :span="8">
  891. <el-form-item label="内部询价单号" prop="insideInquiryNo" :show-message="false">
  892. <span slot="label" v-if="saveQuote.id <= 0">
  893. <a @click="insideInquiryVisible = true">内部询价单号</a>
  894. </span>
  895. <el-input v-model="saveQuote.insideInquiryNo" @blur="handleInquiryBlur" :disabled="saveQuote.id > 0"></el-input>
  896. </el-form-item>
  897. </el-col>
  898. </el-row>
  899. <el-row :gutter="10">
  900. <el-col :span="8">
  901. <el-form-item label="客户编码" prop="customerNo" :show-message="false">
  902. <span slot="label" v-if="saveQuote.id <= 0">
  903. <a @click="customerVisible = true">客户编码</a>
  904. </span>
  905. <el-input v-model="saveQuote.customerNo" :disabled="saveQuote.id > 0" @blur="customerNoBlur"></el-input>
  906. </el-form-item>
  907. </el-col>
  908. <el-col :span="16">
  909. <el-form-item label="客户描述" prop="customerDesc" :show-message="false">
  910. <el-input v-model="saveQuote.customerDesc" disabled></el-input>
  911. </el-form-item>
  912. </el-col>
  913. <el-col :span="8">
  914. <el-form-item label="Application" prop="application" :show-message="false">
  915. <el-input v-model="saveQuote.application" :disabled="detailFlag"></el-input>
  916. </el-form-item>
  917. </el-col>
  918. <el-col :span="8">
  919. <el-form-item label="年需求量" prop="annualDemand" :show-message="false">
  920. <el-input v-model="saveQuote.annualDemand" :disabled="detailFlag"></el-input>
  921. </el-form-item>
  922. </el-col>
  923. <el-col :span="8">
  924. <el-form-item label="Cost Model" prop="costModel" :show-message="false">
  925. <el-select v-model="saveQuote.costModel" :disabled="detailFlag">
  926. <el-option label="2020" value="2020"></el-option>
  927. <el-option label="UFIDA" value="UFIDA"></el-option>
  928. </el-select>
  929. </el-form-item>
  930. </el-col>
  931. <el-col :span="8">
  932. <el-form-item label="Markup" prop="markup" :show-message="false">
  933. <el-input-number style="width: 100%" :controls="false" :step="0" v-model="saveQuote.markup" :disabled="detailFlag"></el-input-number>
  934. </el-form-item>
  935. </el-col>
  936. <el-col :span="8">
  937. <el-form-item label="芯片价格" prop="chipPrice" :show-message="false">
  938. <el-input v-model="saveQuote.chipPrice" :disabled="detailFlag"></el-input>
  939. </el-form-item>
  940. </el-col>
  941. </el-row>
  942. <el-row :gutter="10">
  943. <el-col :span="8">
  944. <el-form-item label="币种" :show-message="false">
  945. <span slot="label" v-if="!detailFlag">
  946. <a @click="getBaseList(512)">币种</a>
  947. </span>
  948. <el-input v-model="saveQuote.currency" readonly :disabled="detailFlag">
  949. <span slot="suffix" v-show="saveQuote.currency && !detailFlag" @click="clearModalData('currency')"><i class="el-icon-circle-close" style="margin-left: 5px;cursor: pointer;"></i></span>
  950. </el-input>
  951. </el-form-item>
  952. </el-col>
  953. <el-col :span="8">
  954. <el-form-item label="报价日期" prop="quoteDate" :show-message="false">
  955. <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>
  956. </el-form-item>
  957. </el-col>
  958. </el-row>
  959. <el-row :gutter="10">
  960. <el-col :span="8">
  961. <el-form-item label="报价专员" prop="quoter" :show-message="false">
  962. <span slot="label" v-if="!detailFlag">
  963. <a @click="handleQuoterClick" >报价专员</a>
  964. </span>
  965. <el-input v-model="saveQuote.quoter" :disabled="detailFlag"></el-input>
  966. </el-form-item>
  967. </el-col>
  968. <el-col :span="8">
  969. <el-form-item label="采购专员" :show-message="false">
  970. <span slot="label" v-if="!detailFlag">
  971. <a @click="handlePurchaseClick" >采购专员</a>
  972. </span>
  973. <el-input v-model="saveQuote.purchase" :disabled="detailFlag"></el-input>
  974. </el-form-item>
  975. </el-col>
  976. <el-col :span="24">
  977. <el-form-item label="备注" prop="remark" class="auto" :show-message="false">
  978. <el-input v-model="saveQuote.remark" :disabled="detailFlag" :rows="3" type="textarea"></el-input>
  979. </el-form-item>
  980. </el-col>
  981. </el-row>
  982. </el-form>
  983. <div slot="footer" class="dialog-footer">
  984. <el-button type="primary" v-if="!detailFlag" @click="handleSaveOrUpdateQuote"> </el-button>
  985. <el-button @click="saveVisible = false"> </el-button>
  986. </div>
  987. </el-dialog>
  988. <el-dialog :title="userTitle" v-drag :visible.sync="userVisible" width="500px" modal-append-to-body :close-on-click-modal="false">
  989. <el-form :model="user" label-position="top">
  990. <el-row :gutter="10">
  991. <el-col :span="6">
  992. <el-form-item label="用户账号" prop="name">
  993. <el-input v-model="user.username"></el-input>
  994. </el-form-item>
  995. </el-col>
  996. <el-col :span="6">
  997. <el-form-item label="用户名" prop="name">
  998. <el-input v-model="user.userDisplay"></el-input>
  999. </el-form-item>
  1000. </el-col>
  1001. <el-col :span="6">
  1002. <el-form-item label="是否在用">
  1003. <el-select filterable v-model="user.active" style="width: 100%">
  1004. <el-option label="全部" value=""></el-option>
  1005. <el-option label="是" value="1"></el-option>
  1006. <el-option label="否" value="0"></el-option>
  1007. </el-select>
  1008. </el-form-item>
  1009. </el-col>
  1010. <el-col :span="6">
  1011. <el-form-item label=" " >
  1012. <el-button type="primary" @click="handleQueryQuoteRoleUser">查询</el-button>
  1013. </el-form-item>
  1014. </el-col>
  1015. </el-row>
  1016. </el-form>
  1017. <el-table
  1018. @header-dragend="handleColumnResize"
  1019. :height="300"
  1020. :data="userDataList"
  1021. border
  1022. @row-dblclick="userDblClick"
  1023. style="width: 100%;">
  1024. <el-table-column
  1025. prop="username"
  1026. header-align="center"
  1027. align="center"
  1028. label="用户账号">
  1029. </el-table-column>
  1030. <el-table-column
  1031. prop="userDisplay"
  1032. header-align="center"
  1033. align="center"
  1034. label="用户名">
  1035. </el-table-column>
  1036. <el-table-column
  1037. prop="status"
  1038. header-align="center"
  1039. align="center"
  1040. label="是否在用">
  1041. <template slot-scope="scope">
  1042. <span v-if="scope.row.status === 1"></span>
  1043. <span v-if="scope.row.status === 0"></span>
  1044. </template>
  1045. </el-table-column>
  1046. </el-table>
  1047. </el-dialog>
  1048. <el-dialog title="询价申请" v-drag :visible.sync="insideInquiryVisible" width="1000px" modal-append-to-body :close-on-click-modal="false">
  1049. <quotes v-if="insideInquiryVisible" :is-component="true" :height="400" @dblclick="handleInquiryDblClick"></quotes>
  1050. </el-dialog>
  1051. <customer-table ref="customerTable" v-if="saveVisible" v-model="customerVisible" :height="300" @dblclick="customerDblClick" :customer-no="saveQuote.customerNo"></customer-table>
  1052. <project-table ref="projectTable" v-if="saveVisible" v-model="projectVisible" :height="300" @dblclick="projectDblClick" :customer-no="saveQuote.customerNo" :project-no="saveQuote.projectNo" :bu-id="saveQuote.buId"></project-table>
  1053. <choose-list-eam ref="baseList" @getBaseData="getBaseData"></choose-list-eam>
  1054. </div>
  1055. </template>
  1056. <style scoped>
  1057. .auto /deep/ .el-form-item__content{
  1058. height: auto;
  1059. line-height: 1.5;
  1060. }
  1061. .el-table /deep/ .cell{
  1062. height: auto;
  1063. line-height: 1.5;
  1064. }
  1065. </style>