标签问题

This commit is contained in:
shijingjing
2023-03-02 17:10:18 +08:00
parent d4edd7d0aa
commit 06db47cb0f
4 changed files with 53 additions and 45 deletions

View File

@@ -61,7 +61,6 @@
<div @click="getDeptUser">
<span v-if="!form.examines.length" class="color_gray">请选择<u-icon name="arrow-right" color="#CCD0D3"></u-icon></span>
<span v-else>已选择{{ form.examines.length }}名人员</span>
<!-- <AiOpenData type="departmentName" :openid="departmentId"/> -->
</div>
</div>
<div class="examineChange">
@@ -176,8 +175,10 @@ export default {
sendType: '0', // 0立即发送、1定时发送
gender: '', // 性别0-女、1-男、2-全部
filterCriteria: '',
filterTags: [], //过滤标签id集合
excludeFilterTags: [], // 剔除标签集合
filterTags: '', //过滤标签id集合
filterTagsName: '', //过滤标签名称
excludeFilterTags: '', // 剔除标签id集合
excludeFilterTagsName: '', // 剔除标签名称
addFromTime: '',
addEndTime: '',
taskEndTime: '', // 任务结束时间
@@ -425,17 +426,13 @@ export default {
if(this.type=='Residents' || this.type=='CircleOfFriends') {
this.forms.contents = this.form.contents
this.forms.taskTitle = this.form.taskTitle
}
if(!this.form.taskTitle) {
return this.$u.toast('请输入任务名称')
}
if(this.type=='Residents' || this.type=='CircleOfFriends') {
this.forms.taskTitle = this.form.taskTitle
}
if(!this.form.sendScope) {
return this.$u.toast('请选择发送范围')
}
@@ -485,9 +482,6 @@ export default {
let url = ''
if(this.type=='CircleOfFriends' || this.type=='Residents') { //群发朋友圈、居民
url = `/app/whchatmomentstask/addOrUpdate`
this.forms.filterCriteria = this.girdListIds.toString() || this.deptListIds.toString() || ''
this.forms.filterTags = this.ResidentTags.toString() || this.circleTags.toString() || ''
this.forms.excludeFilterTags = this.ResidentTagsRemove.toString() || this.circleTagsRemove.toString() || ''
this.forms.gender = this.sex
this.forms.addFromTime = this.startTime
this.forms.addEndTime = this.endTime
@@ -520,10 +514,10 @@ export default {
uni.removeStorageSync('girdSelect')
uni.removeStorageSync('deptList')
uni.removeStorageSync('sendScope')
uni.removeStorageSync('ResidentTags')
uni.removeStorageSync('ResidentTagsRemove')
uni.removeStorageSync('circleTags')
uni.removeStorageSync('circleTagsRemove')
uni.removeStorageSync('ResidentTags') // 居民包含
uni.removeStorageSync('ResidentTagsRemove') // 居民剔除
uni.removeStorageSync('circleTags') // 朋友圈包含
uni.removeStorageSync('circleTagsRemove') // 朋友圈剔除
uni.removeStorageSync('startTime')
uni.removeStorageSync('endTime')
},
@@ -597,12 +591,26 @@ export default {
// 性别
this.sex = uni.getStorageSync('gender')
// 标签
if(this.sendType == 'Residents') {
if(this.type == 'Residents') {
this.ResidentTags = uni.getStorageSync('ResidentTags') // 居民包含
this.ResidentTagsRemove = uni.getStorageSync('ResidentTagsRemove') // 居民剔除
} else if(this.sendType == 'CircleOfFriends') {
if(this.ResidentTags.length) {
this.forms.filterTags = this.ResidentTags.map(e=> e.id).toString()
this.forms.filterTagsName = this.ResidentTags.map(e=> e.name).toString()
} else if(this.ResidentTagsRemove) {
this.forms.excludeFilterTags = this.ResidentTagsRemove.map(e=> e.id).toString()
this.forms.excludeFilterTagsName = this.ResidentTagsRemove.map(e=> e.name).toString()
}
} else if(this.type == 'CircleOfFriends') {
this.circleTags = uni.getStorageSync('circleTags') // 朋友圈包含
this.circleTagsRemove = uni.getStorageSync('circleTagsRemove') // 朋友圈剔除
if(this.circleTags.length) {
this.forms.filterTags = this.circleTags.map(e=> e.id).toString()
this.forms.filterTagsName = this.circleTags.map(e=> e.name).toString()
} else if(this.circleTagsRemove.length) {
this.forms.excludeFilterTags = this.circleTagsRemove.map(e=> e.id).toString()
this.forms.excludeFilterTagsName = this.circleTagsRemove.map(e=> e.name).toString()
}
}
// 时间
this.startTime = uni.getStorageSync('startTime')

View File

@@ -58,7 +58,6 @@
</div>
</div>
</template>
<script>
import { mapActions } from "vuex";
export default {
@@ -117,7 +116,6 @@ export default {
this.endTime = e.endDate
},
submit() {
console.log(this.deptListArr, 'deptListArr')
uni.setStorageSync('gender',this.sex)
uni.setStorageSync('startTime', this.startTime)
uni.setStorageSync('endTime', this.endTime)

View File

@@ -40,10 +40,10 @@ export default {
deptListIds: [],
wxGroups: [], // 居民群,居民,朋友圈
sex: '',
circleTags: '',
ResidentTags: '',
ResidentTagsRemove: '',
circleTagsRemove: '',
ResidentTags: [],
ResidentTagsRemove: [],
circleTags: [],
circleTagsRemove: [],
startTime: '',
endTime: '',
}
@@ -95,11 +95,22 @@ export default {
taskType: this.sendType == 'Residents'? 1:0,
}
} else if(this.sendScope == 1 || this.sendScope == 2) {
let resTags='', cirTags='', resRemove='', cirRemove=''
if(this.ResidentTags.length) {
resTags = this.ResidentTags?.map(e=> e.id).toString()
} else if(this.circleTags.length) {
cirTags = this.circleTags?.map(e=> e.id).toString()
} else if(this.ResidentTagsRemove.length) {
resRemove = this.ResidentTagsRemove?.map(e=> e.id).toString() || ''
} else if(this.circleTagsRemove.length) {
cirRemove = this.circleTagsRemove?.map(e=> e.id).toString() || ''
}
formData = {
filterCriteria: this.girdListIds.toString() || this.deptListIds.toString() || '',
sendScope: this.sendScope,
tags: this.ResidentTags || this.circleTags || '',
excludeTags: this.ResidentTagsRemov || this.circleTagsRemove || '',
tags: resTags || cirTags,
excludeTags: resRemove || cirRemove,
addFromTime: this.startTime,
addEndTime: this.endTime,
gender: this.sex,
@@ -142,11 +153,11 @@ export default {
this.sex = uni.getStorageSync('gender')
// 标签
if(this.sendType == 'Residents') {
this.ResidentTags = uni.getStorageSync('ResidentTags').toString() // 居民包含
this.ResidentTagsRemove = uni.getStorageSync('ResidentTagsRemove').toString() // 居民剔除
this.ResidentTags = uni.getStorageSync('ResidentTags') // 居民包含
this.ResidentTagsRemove = uni.getStorageSync('ResidentTagsRemove') // 居民剔除
} else if(this.sendType == 'CircleOfFriends') {
this.circleTags = uni.getStorageSync('circleTags').toString() // 朋友圈包含
this.circleTagsRemove = uni.getStorageSync('circleTagsRemove').toString() // 朋友圈剔除
this.circleTags = uni.getStorageSync('circleTags') // 朋友圈包含
this.circleTagsRemove = uni.getStorageSync('circleTagsRemove') // 朋友圈剔除
}
// 时间
this.startTime = uni.getStorageSync('startTime')

View File

@@ -4,10 +4,10 @@
<div class="tags-list" v-for="items in subTags" :key="items.id">
<div class="tag_title">{{ items.name }}</div>
<div class="item"
v-for="(item, index) in items.tagList"
:class="[checked.includes(item.id) ? 'active' : '']"
:key="index"
@click="onClick(item.id)">
v-for="item in items.tagList"
:class="checked.map(e=>e.id).includes(item.id)? 'active' : ''"
:key="item.id"
@click="onClick(item)">
{{ item.name }}
</div>
</div>
@@ -37,24 +37,15 @@ export default {
}
})
},
onClick(id) {
const index = this.checked.indexOf(id)
onClick(item) {
const index = this.checked.map(i=>i.id).indexOf(item.id)
if (index === -1) {
this.checked.push(id)
this.checked.push(item)
} else {
this.checked.splice(index, 1)
}
},
submit() {
// if (!this.checked.length) {
// return this.$u.toast('请选择标签')
// }
// const list = this.subTags.filter(v => {
// return this.checked.includes(v.id)
// })
if(this.sendType == 'Residents') {
if(this.type == '0') { // 居民包含
uni.setStorageSync('ResidentTags', this.checked)