2022-01-22 15:11:07 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="AddGird">
|
2022-02-07 17:42:52 +08:00
|
|
|
<div class="item-flex">
|
|
|
|
|
<div class="label">
|
|
|
|
|
<span class="tips"></span>网格类型
|
|
|
|
|
</div>
|
2022-02-09 15:08:15 +08:00
|
|
|
<div class="value">{{ $dict.getLabel('girdType', form.girdType) }}</div>
|
2022-02-07 17:42:52 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="item-flex">
|
|
|
|
|
<div class="label">
|
|
|
|
|
<span class="tips"></span>网格层级
|
|
|
|
|
</div>
|
2022-02-09 15:08:15 +08:00
|
|
|
<div class="value">{{ $dict.getLabel('girdLevel', form.girdLevel) }}</div>
|
2022-02-07 17:42:52 +08:00
|
|
|
</div>
|
|
|
|
|
|
2022-01-22 15:11:07 +08:00
|
|
|
<div class="item-flex">
|
|
|
|
|
<div class="label">
|
|
|
|
|
<span class="tips">*</span>网格名称
|
|
|
|
|
</div>
|
|
|
|
|
<div class="value">
|
2022-02-09 15:08:15 +08:00
|
|
|
<u-input type="text" placeholder="请输入" input-align="right" placeholder-style="color:#999;font-size:16px;"
|
|
|
|
|
height="48" v-model="form.girdName" maxlength="50"/>
|
2022-01-22 15:11:07 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="item-flex">
|
|
|
|
|
<div class="label">
|
|
|
|
|
<span class="tips"></span>网格长
|
|
|
|
|
</div>
|
|
|
|
|
<div class="value" @click="toAddUser('manage')">
|
2022-02-09 15:08:15 +08:00
|
|
|
|
2022-01-22 15:11:07 +08:00
|
|
|
<span v-if="form.girdMemberManageList && form.girdMemberManageList.length">
|
2022-02-07 17:42:52 +08:00
|
|
|
<!-- <span v-for="(item, index) in form.girdMemberManageList" :key="index"><span v-if="index>0">,</span>{{item.name}}</span> -->
|
2022-02-09 15:08:15 +08:00
|
|
|
已选择<span style="color:#3F8DF5;margin:0 4px;">{{ form.girdMemberManageList.length }}</span>人
|
2022-01-22 15:11:07 +08:00
|
|
|
</span>
|
|
|
|
|
<span style="color:#999;" v-else>请选择</span>
|
2022-02-09 15:08:15 +08:00
|
|
|
<img src="./components/img/right-icon.png" alt=""/></div>
|
2022-01-22 15:11:07 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="item-flex" v-if="form.girdLevel == 2">
|
|
|
|
|
<div class="label">
|
|
|
|
|
<span class="tips"></span>网格员
|
|
|
|
|
</div>
|
2022-02-09 15:08:15 +08:00
|
|
|
<div class="value" @click="toAddUser('member')">
|
2022-01-22 15:11:07 +08:00
|
|
|
<span v-if="form.girdMemberList && form.girdMemberList.length">
|
2022-02-09 15:08:15 +08:00
|
|
|
已选择<span style="color:#3F8DF5;margin:0 4px;">{{ form.girdMemberList.length }}</span>人
|
2022-02-07 17:42:52 +08:00
|
|
|
<!-- <span v-for="(item, index) in form.girdMemberList" :key="index"><span v-if="index>0">,</span>{{item.name}}</span> -->
|
2022-01-22 15:11:07 +08:00
|
|
|
</span>
|
|
|
|
|
<span style="color:#999;" v-else>请选择</span>
|
2022-02-09 15:08:15 +08:00
|
|
|
<img src="./components/img/right-icon.png" alt=""/>
|
2022-01-22 15:11:07 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-02-17 13:53:26 +08:00
|
|
|
<div class="footer" @click="confirm">{{ fromType == 'add' ? '确认添加' : '确认修改' }}</div>
|
2022-01-22 15:11:07 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-02-09 15:08:15 +08:00
|
|
|
import {mapActions} from "vuex";
|
|
|
|
|
|
2022-01-22 15:11:07 +08:00
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
id: '',
|
|
|
|
|
form: {
|
|
|
|
|
girdMemberManageList: [],
|
|
|
|
|
girdMemberList: []
|
|
|
|
|
},
|
|
|
|
|
detailInfo: {},
|
|
|
|
|
fromType: 'add', //add新增 edit编辑,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad(option) {
|
2022-02-07 17:42:52 +08:00
|
|
|
this.$dict.load('girdType', 'girdLevel').then(() => {
|
|
|
|
|
this.id = option.id
|
|
|
|
|
this.fromType = option.fromType
|
|
|
|
|
this.getDetail()
|
2022-01-22 15:11:07 +08:00
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onShow() {
|
2022-02-17 13:53:26 +08:00
|
|
|
if (this.fromType == 'add') {
|
2022-02-16 15:33:13 +08:00
|
|
|
document.title = '添加网格'
|
2022-02-17 13:53:26 +08:00
|
|
|
} else {
|
2022-02-16 15:33:13 +08:00
|
|
|
document.title = '编辑网格'
|
|
|
|
|
}
|
2022-01-22 15:11:07 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
2022-02-09 15:08:15 +08:00
|
|
|
...mapActions(['selectPrivilegedContact']),
|
2022-01-22 15:11:07 +08:00
|
|
|
getDetail() {
|
|
|
|
|
this.$http.post(`/app/appgirdinfo/queryDetailById?id=${this.id}`).then((res) => {
|
2022-03-17 10:27:03 +08:00
|
|
|
if (res?.data) {
|
2022-01-22 15:11:07 +08:00
|
|
|
this.detailInfo = res.data
|
2022-02-09 15:08:15 +08:00
|
|
|
if (this.fromType == 'edit') {
|
2022-01-22 15:11:07 +08:00
|
|
|
this.form = res.data
|
|
|
|
|
}
|
2022-02-09 15:08:15 +08:00
|
|
|
if (this.fromType == 'add') {
|
2022-01-22 15:11:07 +08:00
|
|
|
this.form.parentGirdId = this.detailInfo.id
|
|
|
|
|
this.form.parentGirdName = this.detailInfo.girdName
|
2022-02-09 15:08:15 +08:00
|
|
|
this.form.girdLevel = Number(this.detailInfo.girdLevel) + 1
|
|
|
|
|
this.form.girdType = Number(this.detailInfo.girdType) + 1
|
2022-01-22 15:11:07 +08:00
|
|
|
this.form.isLastLevel = this.form.girdLevel == 2 ? '1' : '0'
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
toAddUser(type) {
|
2022-02-09 15:08:15 +08:00
|
|
|
let obj = type == 'manage' ? "girdMemberManageList" : "girdMemberList",
|
2022-02-17 13:53:26 +08:00
|
|
|
selectedOpenUserIds = this.form?.[obj]?.map(e => e.id) || []
|
2022-02-09 15:08:15 +08:00
|
|
|
selectedOpenUserIds = selectedOpenUserIds || []
|
|
|
|
|
this.$loading()
|
|
|
|
|
this.selectPrivilegedContact({
|
|
|
|
|
fromDepartmentId: 0, selectedOpenUserIds,
|
|
|
|
|
selectedTickets: this.form?.[type + "Ticket"] || [],
|
|
|
|
|
}).then(res => {
|
|
|
|
|
uni.hideLoading()
|
2022-02-17 13:53:26 +08:00
|
|
|
let isRepeat = false //判断网格长网格员是否选择相同人员
|
2022-02-09 15:08:15 +08:00
|
|
|
this.form[obj] = res.userList?.map(e => ({id: e.openUserId})) || []
|
2022-02-14 16:10:06 +08:00
|
|
|
this.form.girdMemberList.map((item) => {
|
2022-02-17 13:53:26 +08:00
|
|
|
this.form.girdMemberManageList.map((items) => {
|
|
|
|
|
if (item.id == items.id) {
|
2022-02-14 16:10:06 +08:00
|
|
|
isRepeat = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
2022-02-17 13:53:26 +08:00
|
|
|
if (isRepeat) {
|
2022-02-14 16:10:06 +08:00
|
|
|
this.form[obj] = []
|
|
|
|
|
return this.$u.toast('网格长网格员不能选择相同人员')
|
|
|
|
|
}
|
2022-02-09 15:08:15 +08:00
|
|
|
this.form[type + "Ticket"] = res.selectedTicket
|
2022-03-17 18:50:08 +08:00
|
|
|
console.log(this.form)
|
2022-02-09 15:08:15 +08:00
|
|
|
}).catch(() => {
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
})
|
2022-01-22 15:11:07 +08:00
|
|
|
},
|
|
|
|
|
confirm() {
|
2022-02-09 15:08:15 +08:00
|
|
|
if (!this.form.girdName) {
|
2022-01-22 15:11:07 +08:00
|
|
|
return this.$u.toast('请输入网格名称')
|
|
|
|
|
}
|
2022-02-09 15:08:15 +08:00
|
|
|
this.$http.post(`/app/appgirdinfo/addOrUpdateByEw`, {...this.form}).then((res) => {
|
2022-01-22 15:11:07 +08:00
|
|
|
if (res.code == 0) {
|
|
|
|
|
this.$u.toast('提交成功')
|
|
|
|
|
uni.$emit('update')
|
|
|
|
|
setTimeout(() => {
|
2022-02-09 15:08:15 +08:00
|
|
|
uni.navigateBack({})
|
2022-01-22 15:11:07 +08:00
|
|
|
}, 600)
|
|
|
|
|
}
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
this.$u.toast(err)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.AddGird {
|
2022-02-09 15:08:15 +08:00
|
|
|
.item-flex {
|
2022-01-22 15:11:07 +08:00
|
|
|
display: flex;
|
|
|
|
|
padding: 34px 32px;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
|
|
|
margin-bottom: 16px;
|
2022-02-09 15:08:15 +08:00
|
|
|
|
|
|
|
|
.label {
|
2022-01-22 15:11:07 +08:00
|
|
|
font-weight: 400;
|
|
|
|
|
color: #333333;
|
|
|
|
|
line-height: 22px;
|
|
|
|
|
width: 150px;
|
2022-02-09 15:08:15 +08:00
|
|
|
|
|
|
|
|
.tips {
|
2022-01-22 15:11:07 +08:00
|
|
|
display: inline-block;
|
|
|
|
|
width: 16px;
|
|
|
|
|
color: #F46;
|
|
|
|
|
line-height: 44px;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-09 15:08:15 +08:00
|
|
|
|
|
|
|
|
.value {
|
2022-01-22 15:11:07 +08:00
|
|
|
width: calc(100% - 150px);
|
|
|
|
|
line-height: 44px;
|
|
|
|
|
text-align: right;
|
|
|
|
|
color: #666;
|
2022-02-09 15:08:15 +08:00
|
|
|
|
|
|
|
|
img {
|
2022-02-11 10:05:02 +08:00
|
|
|
width: 44px;
|
|
|
|
|
height: 44px;
|
2022-01-22 15:11:07 +08:00
|
|
|
vertical-align: middle;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-09 15:08:15 +08:00
|
|
|
|
|
|
|
|
.color-999 {
|
2022-01-22 15:11:07 +08:00
|
|
|
color: #999;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-09 15:08:15 +08:00
|
|
|
|
|
|
|
|
.footer {
|
2022-01-22 15:11:07 +08:00
|
|
|
width: 100%;
|
|
|
|
|
height: 112px;
|
|
|
|
|
line-height: 112px;
|
|
|
|
|
background: #1365DD;
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 36px;
|
|
|
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #FFF;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|