From aafd5e3762bc3bce661439020f251bcacc444e63 Mon Sep 17 00:00:00 2001 From: 郭娟 <2715201989@qq.com> Date: Fri, 7 Jun 2024 09:51:09 +0800 Subject: [PATCH] fix:优化代码 --- pages/charge/visitsAndFees/createaVisit.vue | 1 + pages/charge/visitsAndFees/index.vue | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 178 insertions(+), 12 deletions(-) diff --git a/pages/charge/visitsAndFees/createaVisit.vue b/pages/charge/visitsAndFees/createaVisit.vue index 017dcc4..3191dc2 100644 --- a/pages/charge/visitsAndFees/createaVisit.vue +++ b/pages/charge/visitsAndFees/createaVisit.vue @@ -913,6 +913,7 @@ }, // 选择时间弹出层 handleDateTime(item) { + console.log('打印item',item); if (this.operationStatus === 'YD') { return } diff --git a/pages/charge/visitsAndFees/index.vue b/pages/charge/visitsAndFees/index.vue index 32b23a9..15a87dd 100644 --- a/pages/charge/visitsAndFees/index.vue +++ b/pages/charge/visitsAndFees/index.vue @@ -20,18 +20,40 @@ + + + + + + {{searchForm[item.name]}} + + 财年 + + + {{ item.title}} + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + @@ -143,6 +171,7 @@ submitAuditTwo, submitModificationOne, submitModificationTwo, + getCompanyCascader, cancelMcVisit } from '@/api/charge.js' import popUpComponent from '@/components/popUpComponent/popUpComponent.vue' @@ -155,6 +184,57 @@ }, data() { return { + currentName:'', + columns: [], + gsColumns:[], + companyOption: [], + regionName:[], + groupName:[], + companyName: [], + gsShow:false, + pickerShow: false, + datetimeShow: false, + searchForm:{ + year:'', + companyCode:'', + status:'', + type:'' + }, + model: { + companyCode: "", + company: "", + status:'', + type:'', + year:'' + }, + searchList:[ + { + title:'财年', + name:'year', + key:'year', + type:'time' + }, + { + title:'项目公司', + name:'companyCode', + type:'select', + key:'company', + }, + { + title:'状态', + name:'status', + type:'select', + key:'status', + dict:'sys_mc_visit_status' + }, + { + title:'类型', + name:'type', + type:'select', + key:'type', + dict:'sys_mc_visit_type' + } + ], params: { pageNum: 1, pageSize: 10, @@ -214,12 +294,93 @@ }, 500); }, onLoad() { - // this.initData(); + this.getCompanyCascader(); }, onShow(){ this.initData(); }, methods: { + selectConfirm(e){ + console.log('打印selectConfirm',e); + let data = e.value[0].value; + let dataLabel = e.value[0].label; + console.log('打印data',data); + if(this.currentName === 'status'){ + this.searchForm.status = dataLabel; + this.model.status = data; + }else if(this.currentName == 'type'){ + this.searchForm.type = dataLabel; + this.model.type = data; + } + this.pickerShow = false; + this.currentName =''; + }, + selectCancel(){ + this.pickerShow = false; + this.currentName =''; + }, + gsConfirm(e){ + console.log("公司", e); + if (this.currentName === 'company') { + this.model[this.currentName] = `${e.value[2].label}`; + this.model.regionName = e.value[0]?.value; + this.model.groupName = e.value[1]?.value; + this.model.companyName = e.value[2]?.label; + this.model.companyCode = e.value[2]?.value; + } + this.gsShow = false; + this.currentName =''; + }, + gsCancel(){ + this.gsShow = false; + this.currentName =''; + }, + changeHandler(){}, + dateConfirm(e){ + let time = this.$u.timeFormat(e.value, 'yyyy'); + console.log("选择时间", time); + this.model[this.currentName] = time; + this.searchForm.year = time; + this.datetimeShow = false; + this.currentName =''; + }, + timeCancel(){ + this.datetimeShow = false; + this.currentName =''; + }, + async getCompanyCascader() { + this.companyOption = (await getCompanyCascader()).data; + this.companyOption.forEach(item1 => { + this.regionName.push(item1); + item1.children.forEach(item2 => { + this.groupName.push(item2); + item2.children.forEach(item3 => { + this.companyName.push(item3); + }); + }); + }); + console.log("当前公司类", this.companyOption); + }, + async openPicker(data) { + this.currentName = data.key; + console.log('打印data-===', data); + if (data.type === 'select') { + if(data.key=='company'){ + this.gsColumns = [this.regionName, this.groupName, this.companyName]; + this.gsShow = true; + }else{ + let dict = data.dict; + let dictArr = this.getDictDatas(dict); + this.columns = [dictArr]; + this.pickerShow = true; + } + + }else{ + console.log('打印data===',data); + this.datetimeShow = true; + // this.showTimeParams.showStartDailog = true; + } + }, // 修改按钮权限 editPermission(item) { const { statusCode } = item @@ -437,6 +598,10 @@