diff --git a/src/views/modules/volunteer/activityArchive/add.vue b/src/views/modules/volunteer/activityArchive/add.vue index f0e9d4dbd..78b3b2431 100644 --- a/src/views/modules/volunteer/activityArchive/add.vue +++ b/src/views/modules/volunteer/activityArchive/add.vue @@ -758,7 +758,7 @@ export default { } else { console.log("dk.sjfl"); this.orgOptions = []; - this.orgOptions.push(res.data); + this.orgOptions= this.filterTreeDataByLevel([res.data]); console.log(this.orgOptions,"this.orgOptions"); // this.orgOptions = []; // // this.funOrgTreeData(res.data, 'community') @@ -787,20 +787,18 @@ export default { } }) }, - //递归遍历当前组织 - funOrgTreeData(data,level) { - console.log(data,"lksdjflsjl"); - const arr= data.forEach(item => { - console.log(item,"skaclakj"); - - if (item.level === level) { - item.subAgencyList = []; // 清空当前项的 children - } else if (item.subAgencyList) { - clearChildren(item.subAgencyList); // 递归处理子集 - } - }); - console.log("arr",arr); - + filterTreeDataByLevel(data) { + return data.map(node => { + // 如果当前节点的 level 是 "community",则将 children 设置为空 + if (node.level === 'community') { + node.subAgencyList = null; + } else if (node.subAgencyList && node.subAgencyList.length > 0) { + // 递归处理子节点 + node.subAgencyList = this.filterTreeDataByLevel(node.subAgencyList); + } + + return node; + }); }, handleCancle () { console.log( "kdsljk"); diff --git a/src/views/modules/volunteer/activityArchive/select.vue b/src/views/modules/volunteer/activityArchive/select.vue index ab4689555..ba9da1895 100644 --- a/src/views/modules/volunteer/activityArchive/select.vue +++ b/src/views/modules/volunteer/activityArchive/select.vue @@ -2,212 +2,129 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 不限名额 -
-
-
- - -
- -
-
-
- +
+ + + + + + + + + +
+ +
+
+ +
+ + +
+
+ + + + + + + +
+ + 不限名额 +
+
+ + + + + + + + + + + + +
+
+
+ +
- - - - - - - - - - - - - - - - - - - + - - - - - - - - - + + + + - - - + format="yyyy-MM-dd HH:mm:ss" placeholder="开始时间" style="width:150px"> + 至 + format="yyyy-MM-dd HH:mm:ss" placeholder="结束时间" style="width:150px" @change="controlTime "> - - - - - -
- -
-
-
- - - - - - - - -
- - - - -
-
+ + + -
- - - + + - - - - -
- - -
- -
- - - - -
- -
-
-
- - - - - - - - -
-
- +
+ +
+ + + +
-
- - - - +
+ +
+
+
+ + + + + + + +
+
+ +
+ + +
取 消 @@ -234,7 +151,6 @@ var geocoder // 新建一个正逆地址解析类 export default { data () { return { - checked:false, loading: false, searchOptions: [], orgOptionProps: { @@ -252,7 +168,6 @@ export default { btnDisable: false, searchValue:"", formData: { - projectTitle:"", title:"", agencyId:"", projectId:"", @@ -278,26 +193,17 @@ export default { ] }, - ServicetypeListName:[], - //活动级别 - serviceLevelList:[ - { - id:0, - name:"市区级" - }, + + activityImgs:[],//图片 + typeList:[ { - id:1, - name:"街道级" + id:"1", + name:"线上活动" }, { - id:2, - name:"社区级" + id:"2", + name:"线下活动" } - - ], - activityImgs:[],//图片 - typeList:[ - ], uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadvariedfile', tableDate:{}, @@ -329,97 +235,27 @@ export default { } }, watch: { - 'checked'(newValue) { + 'formData.notQuota'(newValue) { console.log(newValue,'newvalue'); // 当 notQuota 变为 '0' 时,清空 quota - //不限为0,限为1 - if (newValue) { - this.formData.quota = 0; - this.formData.notQuota=0 - - }else{ - this.formData.notQuota=1 + if (newValue === '0') { + this.formData.quota = ''; } - console.log( this.formData.quota); } }, components: { fileList,Tinymce,UploadImage}, async mounted () { - this.getTableData1() this.getTableData() // this.startLoading() // await this.loadInfo() // this.endLoading() this.getOrgTreeList() - this.volunteerservicetype() }, methods: { - async getTableData1() { - const url = "/voluntary/project/admin/list"; - let params={ - projectTitle:this.formData.projectTitle, - pageSize:9999, - pageNo:1, - onlineStatus:1 - // ...this.formData - } - const { data, code, msg } = await requestGet(url,params); - if (code === 0) { - console.log("列表请求成功!!!!!!!!!!!!!!"); - this.total = data.total || 0; - this.typeList = data.list - } else { - } - }, - // 获取志愿组织服务类型 - volunteerservicetype() { - console.log("skldfjlsdfjlksjfd"); - const url = "/sys/dict/data/dictlist" - let params = { - dictType: 'voluntary_project_service_class' - } - requestPost(url, params).then(res=>{ - console.log(res,"res"); - this.ServicetypeListName=res.data - }) - // console.log(data,"sdlkfjlsdkf"); - - // if (code === 0) { - // this.ServicetypeListName = data; - - - // } else { - // this.$message.error(msg) - // } - console.log(this.ServicetypeListName," this.ServicetypeListName "); - }, - // 获取志愿组织服务类型 - volunteerservicetype() { - console.log("skldfjlsdfjlksjfd"); - const url = "/sys/dict/data/dictlist" - let params = { - dictType: 'voluntary_project_service_class' - } - requestPost(url, params).then(res=>{ - console.log(res,"res"); - this.ServicetypeListName=res.data - }) - // console.log(data,"sdlkfjlsdkf"); - - // if (code === 0) { - // this.ServicetypeListName = data; - - - // } else { - // this.$message.error(msg) - // } - console.log(this.ServicetypeListName," this.ServicetypeListName "); - }, - //删除动态 removeDomain(item) { if (item.id) { @@ -446,12 +282,8 @@ export default { if (res.code == 0) { this.formData=res.data; this.formData.sponsors=res.data.sponsors, - this.formData.type=res.data.type.toString() this.searchValue=res.data.address this.formData.activityImgs=[{url:res.data.imgs}] - if ( this.formData.notQuota==0) { - this.checked=true - } } else { this.$message.error(res.msg); @@ -550,7 +382,7 @@ export default { await requestPost(url,parms).then((res)=>{ console.log(res,"res"); if (res.code==0) { - this.$message.success('修改成功'); + this.$message.success('添加成功'); this.$emit('updateClose') // this.$router.push({path:'/volunteer/activityArchive'}) }else{ @@ -749,10 +581,7 @@ export default { return this.$message.error(res.msg); } else { this.orgOptions = []; - this.orgOptions.push(res.data); - console.log(this.orgOptions,"this.orgOptions"); - - + this.orgOptions= this.filterTreeDataByLevel([res.data]); } }) .catch(() => { @@ -770,6 +599,19 @@ export default { } }) }, + filterTreeDataByLevel(data) { + return data.map(node => { + // 如果当前节点的 level 是 "community",则将 children 设置为空 + if (node.level === 'community') { + node.subAgencyList = null; + } else if (node.subAgencyList && node.subAgencyList.length > 0) { + // 递归处理子节点 + node.subAgencyList = this.filterTreeDataByLevel(node.subAgencyList); + } + + return node; + }); + }, handleCancle () { console.log( "kdsljk"); diff --git a/src/views/modules/volunteer/pointsRedemption/add.vue b/src/views/modules/volunteer/pointsRedemption/add.vue index da05ea981..6b0154e55 100644 --- a/src/views/modules/volunteer/pointsRedemption/add.vue +++ b/src/views/modules/volunteer/pointsRedemption/add.vue @@ -250,7 +250,7 @@ export default { return this.$message.error(res.msg); } else { this.orgOptions = []; - this.orgOptions.push(res.data); + this.orgOptions= this.filterTreeDataByLevel([res.data]); console.log(this.orgOptions, "this.orgOptions"); } @@ -259,6 +259,19 @@ export default { return this.$message.error("网络错误"); }); }, + filterTreeDataByLevel(data) { + return data.map(node => { + // 如果当前节点的 level 是 "community",则将 children 设置为空 + if (node.level === 'community') { + node.subAgencyList = null; + } else if (node.subAgencyList && node.subAgencyList.length > 0) { + // 递归处理子节点 + node.subAgencyList = this.filterTreeDataByLevel(node.subAgencyList); + } + + return node; + }); + }, handleChangeAgency(val) { console.log(val); this.redeemerOrgId = val diff --git a/src/views/modules/volunteer/pointsRedemption/update.vue b/src/views/modules/volunteer/pointsRedemption/update.vue index 7c0166e5b..25ae2519f 100644 --- a/src/views/modules/volunteer/pointsRedemption/update.vue +++ b/src/views/modules/volunteer/pointsRedemption/update.vue @@ -303,15 +303,26 @@ return this.$message.error(res.msg); } else { this.orgOptions = []; - this.orgOptions.push(res.data); - console.log(this.orgOptions,"this.orgOptions"); - + this.orgOptions= this.filterTreeDataByLevel([res.data]); } }) .catch(() => { return this.$message.error("网络错误"); }); }, + filterTreeDataByLevel(data) { + return data.map(node => { + // 如果当前节点的 level 是 "community",则将 children 设置为空 + if (node.level === 'community') { + node.subAgencyList = null; + } else if (node.subAgencyList && node.subAgencyList.length > 0) { + // 递归处理子节点 + node.subAgencyList = this.filterTreeDataByLevel(node.subAgencyList); + } + + return node; + }); + }, handleChangeAgency(val){ console.log(val); this.redeemerOrgId=val