| | |
| | | import {getTmsCustomsServiceProvider, listTmsCustomsServiceProvider} from "@/api/tms/tmsCustomsServiceProvider"; |
| | | import {getTmsLoadingServiceProvider, listTmsLoadingServiceProvider} from "@/api/tms/tmsLoadingServiceProvider"; |
| | | import {randomId} from "@smallwei/avue"; |
| | | import {getDicts} from "@/api/system/dict/data"; |
| | | const {proxy} = useCurrentInstance(); |
| | | const crudRef = ref(); |
| | | const {sys_quotation_items,sys_unit,sys_currency} = |
| | |
| | | selectionList2: <any>[], |
| | | |
| | | activeProviderType:<any> undefined, |
| | | quotationItems: [] |
| | | }) |
| | | const {queryParams, form, page, selectionList,activeProviderType,selectionList2} = toRefs(data); |
| | | const {queryParams, form, page, selectionList,activeProviderType,selectionList2,quotationItems} = toRefs(data); |
| | | const getQuotationItems = async () => { |
| | | let res = await getDicts("sys_quotation_items"); |
| | | quotationItems.value = res.data || []; |
| | | } |
| | | getQuotationItems(); |
| | | |
| | | const option = ref({ |
| | | pageKey: 'TmsQuotePlan', |
| | | rowKey: 'id',labelWidth:100, |
| | |
| | | providerId: '', |
| | | providerName: '', |
| | | }); |
| | | let filter = quotationItems.value.filter((item:any)=>{ |
| | | return item.remark == val.value; |
| | | }); |
| | | if (filter.length > 0){ |
| | | form.value.items = filter.map((item:any)=>{ |
| | | return { rowKey: randomId() ,freeName: item.dictLabel,free: item.dictValue,unit: '次'} |
| | | }) |
| | | }else{ |
| | | form.value.items = [] |
| | | } |
| | | } |
| | | activeProviderType.value = val.value; |
| | | |
| | |
| | | handleSelectionChangeFunc: (selection: any) => { |
| | | selectionList.value = selection; |
| | | }, |
| | | getBeginListFunc:()=>{ |
| | | getBeginListFunc:(params = {})=>{ |
| | | queryParams.value.planType = '1' |
| | | return params |
| | | }, |
| | | handleBeforeOpenFunc:(type:string)=>{ |
| | | form.value.items = []; |
| | | if (type === 'add'){ |
| | | form.value.items = sys_quotation_items.value.map((item:any)=>{ |
| | | return { rowKey: randomId() ,freeName: item.label,unit: '次'} |
| | | }) |
| | | } |
| | | }, |
| | | rowSaveBegin:(row:any,loading:any)=>{ |
| | | if (selectionList2.value.length == 0){ |
| | | proxy.$modal.msgError("请至少选择一条应收费用报价项"); |
| | | loading(); |
| | | throw new Error("请至少选择一条应收费用报价项"); |
| | | if (selectionList2.value.length > 0){ |
| | | let filter = selectionList2.value.filter((item:any)=>{ |
| | | return !item.price || !item.currency |
| | | }); |
| | | if (filter.length > 0){ |
| | | proxy.$modal.msgError("请填写所有必填项"); |
| | | loading(); |
| | | throw new Error("请填写所有必填项") |
| | | } |
| | | row.quoteItems = selectionList2.value; |
| | | |
| | | } |
| | | let filter = selectionList2.value.filter((item:any)=>{ |
| | | return !item.price || !item.currency |
| | | }); |
| | | if (filter.length > 0){ |
| | | proxy.$modal.msgError("请填写所有必填项"); |
| | | loading(); |
| | | throw new Error("请填写所有必填项") |
| | | } |
| | | row.quoteItems = selectionList2.value; |
| | | |
| | | |
| | | }, |
| | | rowUpdateBegin(row:any,loading:any){ |
| | | if (selectionList2.value.length == 0){ |
| | | proxy.$modal.msgError("请至少选择一条应收费用报价项"); |
| | | loading(); |
| | | throw new Error("请至少选择一条应收费用报价项"); |
| | | if (selectionList2.value.length > 0){ |
| | | let filter = selectionList2.value.filter((item:any)=>{ |
| | | return !item.price || !item.currency |
| | | }); |
| | | if (filter.length > 0){ |
| | | proxy.$modal.msgError("请填写所有必填项"); |
| | | loading(); |
| | | throw new Error("请填写所有必填项") |
| | | } |
| | | row.quoteItems = selectionList2.value; |
| | | |
| | | } |
| | | let filter = selectionList2.value.filter((item:any)=>{ |
| | | return !item.price || !item.currency |
| | | }); |
| | | if (filter.length > 0){ |
| | | proxy.$modal.msgError("请填写所有必填项"); |
| | | loading(); |
| | | throw new Error("请填写所有必填项") |
| | | } |
| | | row.quoteItems = selectionList2.value; |
| | | |
| | | }, |
| | | handleEndOpenFunc:(type:string,res:any)=>{ |
| | | activeProviderType.value = form.value.providerType; |
| | |
| | | item.rowKey =randomId() |
| | | return item; |
| | | }); |
| | | form.value.items = sys_quotation_items.value.map((item:any)=>{ |
| | | let find = selectionList2.value.find((ele:any)=> |
| | | ele.freeName === item.label |
| | | ); |
| | | if ( find){ |
| | | return find; |
| | | }else{ |
| | | return { rowKey: randomId() ,freeName: item.label,unit: '次'} |
| | | } |
| | | }) |
| | | let filter = quotationItems.value.filter((item:any)=>{ |
| | | return item.remark == res.data.providerType; |
| | | }); |
| | | if (filter.length > 0){ |
| | | form.value.items = filter.map((item:any)=>{ |
| | | let find = selectionList2.value.find((ele:any)=> |
| | | ele.free == item.dictValue |
| | | ); |
| | | if ( find){ |
| | | return find; |
| | | }else{ |
| | | return { rowKey: randomId() ,freeName: item.dictLabel,free: item.dictValue,unit: '次'} |
| | | } |
| | | }) |
| | | }else{ |
| | | form.value.items = [] |
| | | } |
| | | nextTick( ()=>{ |
| | | selectionList2.value.map((find:any)=>{ |
| | | itemsCrudRef.value.toggleRowSelection(find,true) |