选择标签

This commit is contained in:
liuye
2023-06-16 15:05:03 +08:00
parent 191304fd31
commit 9bd899fc2d
3 changed files with 269 additions and 1 deletions

View File

@@ -64,6 +64,19 @@
</div>
</div>
<div class="send_scope">
<div><span class="color_red"></span><span class="title">标签</span></div>
<div @click="toSelectTag">
<span>
<span>
<span class="color_gray" v-if="tagList==0">请选择</span>
<span v-else>已选择{{ tagList.length }}个标签</span>
</span>
<u-icon name="arrow-right" color="#CCD0D3"></u-icon>
</span>
</div>
</div>
<div class="isExamine">
<div class="examineChange">
<div>宣发需要审批</div>
@@ -215,6 +228,7 @@ export default {
addFromTime: '',
addEndTime: '',
taskEndTime: '', // 任务结束时间
markTag: '', //标签选择
},
enableExamine: false,
isTimedTask: false,
@@ -363,7 +377,8 @@ export default {
'https://cdn.cunwuyun.cn/dvcp/announce/ic-document.png',
'https://cdn.cunwuyun.cn/dvcp/announce/ic-video.png',
'https://cdn.cunwuyun.cn/dvcp/announce/ic-web.png',
]
],
tagList: []
}
},
methods: {
@@ -625,6 +640,7 @@ export default {
this.form.filterCriteria = this.girdListIds.toString() || this.deptListIds.toString() || ''
formData = this.form
}
this.form.markTag = this.tagList.join(',')
this.$http.post(url, { ...formData }).then(res=>{
if(res?.code == 0) {
this.flag = false
@@ -655,6 +671,7 @@ export default {
uni.removeStorageSync('endTime')
uni.removeStorageSync('selectDeptUser')
uni.removeStorageSync('checkedList')
uni.removeStorageSync('tagList')
},
getExamines(list) {
@@ -668,6 +685,10 @@ export default {
uni.setStorageSync('selectDeptUser', list)
},
toSelectTag() {
uni.navigateTo({url: `./selectTag?selected=${this.tagList.join(',')}`})
}
},
watch: {
type: {
@@ -695,8 +716,11 @@ export default {
uni.setStorageSync('wxGroupsUser', [])
uni.setStorageSync('selectDeptUser', [])
uni.setStorageSync('deptList', [])
uni.setStorageSync('tagList', [])
},
onShow() {
this.tagList = uni.getStorageSync('tagList') || []
this.form.wxGroups = uni.getStorageSync('wxGroupsUser') || []
this.form.sendScope = uni.getStorageSync('sendScope')
if(this.type=='Residents') {

View File

@@ -36,6 +36,10 @@
<span>结束时间</span>
<span>{{ data.taskEndTime }}</span>
</div>
<div class="item" v-if="data.markTag">
<span>标签</span>
<span>{{ data.markTag }}</span>
</div>
</div>
<div class="task_results" v-if="data.enableExamine == 1">
<img v-if="data.status == 1" src="./images/refuse.png" alt="">

View File

@@ -0,0 +1,240 @@
<template>
<section class="selectTag">
<div class="header-middle">
<div class="userCards" v-for="(e, index) in tagList" :key="index">
<div class="imges">
<div class="imgselect" :class="{ 'checked': e.isChecked }" @click.stop="itemCheck(index)" />
</div>
<div class="rights fill">
<div class="applicationNames">{{ e.dictName }}</div>
</div>
</div>
<AiEmpty description="暂无数据" v-if="!tagList.length"/>
</div>
<div class="subBtn" @click="submit">
<div>确定选择</div>
</div>
</section>
</template>
<script>
import { mapState } from 'vuex'
export default {
// 选择标签
name: "selectTag",
data() {
return {
selected: {},
tagList: [],
current: 1,
tabIndex: null,
}
},
computed: {
...mapState(['user']),
hasData() {
return this.userList?.length > 0
}
},
onLoad(o) {
this.tabIndex = o.tabIndex
this.selected = o.selected.split(',') || []
this.getTagList()
},
methods: {
isSelected(val) {
var isCheck = false
this.selected.map((item) => {
if(item == val) {
isCheck = true
}
})
return isCheck
},
getTagList() {
this.$dict.load(['mstTag']).then(() => {
var list = this.$dict.getDict('mstTag')
list.map((item) => {
item.isChecked = this.isSelected(item.dictValue)
})
this.tagList = list
})
},
itemCheck(index) {
this.tagList[index].isChecked = !this.tagList[index].isChecked
},
submit() {
this.selected = []
this.tagList.map((item) => {
if(item.isChecked) {
this.selected.push(item.dictValue)
}
})
if(!this.selected.length) {
return this.$u.toast('请选择标签')
}
uni.$emit("tagSelect", this.selected)
uni.setStorageSync('tagList', this.selected)
uni.navigateBack()
},
}
}
</script>
<style lang="scss" scoped>
.selectTag {
height: 100%;
background: #fff;
.header-top {
background: #fff;
padding: 20px 32px;
}
.header-middle {
padding-bottom: 140px;
.hint {
padding: 28px 20px 28px 32px;
line-height: 56px;
box-shadow: 0 1px 0 0 #e4e5e6;
font-size: 30px;
font-weight: 500;
word-break: break-all;
}
.empty-div {
height: 16px;
background: #f5f5f5;
}
.imges {
display: flex;
align-items: center;
.imgselect {
width: 48px;
height: 48px;
vertical-align: middle;
background-image: url("./images/xz.png");
background-position: center;
background-size: 100% 100%;
&.checked {
background-image: url("./images/xzh.png");
}
}
.avatras {
width: 74px;
height: 74px;
border-radius: 8px;
margin-left: 36px;
}
}
.cards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
padding: 0 0 0 32px;
img {
width: 74px;
height: 74px;
border-radius: 8px;
}
.rightes {
width: calc(100% - 160px);
display: flex;
align-items: center;
margin-left: 32px;
border-bottom: 1px solid #e4e5e6;
.applicationNames {
flex: 1;
min-width: 0;
font-size: 36px;
font-weight: 500;
color: #333333;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.imgs {
flex-shrink: 0;
width: 40px;
height: 40px;
margin-right: 20px;
}
}
}
.userCards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
padding: 0 0 0 32px;
.rights {
display: flex;
justify-content: space-between;
align-items: center;
margin-left: 32px;
border-bottom: 1px solid #e4e5e6;
padding-right: 40px;
height: inherit;
.applicationNames {
font-size: 36px;
font-weight: 500;
color: #333333;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.idNumbers {
color: #666;
}
}
}
}
.subBtn {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 118px;
background: #f4f8fb;
div {
width: 192px;
height: 80px;
line-height: 80px;
text-align: center;
background: #1365dd;
border-radius: 4px;
font-size: 32px;
color: #fff;
margin: 20px 34px 0 0;
float: right;
}
}
.color-3F8DF5 {
color: #3F8DF5;
}
.mar-h4 {
margin: 0 4px;
}
}
</style>