更换人员选择器
This commit is contained in:
@@ -18,7 +18,8 @@
|
||||
<span class="tips">*</span>网格名称
|
||||
</div>
|
||||
<div class="value">
|
||||
<u-input type="text" placeholder="请输入" input-align="right" placeholder-style="color:#999;font-size:16px;" height="48" v-model="form.girdName" maxlength="50" />
|
||||
<u-input type="text" placeholder="请输入" input-align="right" placeholder-style="color:#999;font-size:16px;"
|
||||
height="48" v-model="form.girdName" maxlength="50"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-flex">
|
||||
@@ -38,7 +39,7 @@
|
||||
<div class="label">
|
||||
<span class="tips"></span>网格员
|
||||
</div>
|
||||
<div class="value" @click="toAddUser('Member')">
|
||||
<div class="value" @click="toAddUser('member')">
|
||||
<span v-if="form.girdMemberList && form.girdMemberList.length">
|
||||
已选择<span style="color:#3F8DF5;margin:0 4px;">{{ form.girdMemberList.length }}</span>人
|
||||
<!-- <span v-for="(item, index) in form.girdMemberList" :key="index"><span v-if="index>0">,</span>{{item.name}}</span> -->
|
||||
@@ -52,6 +53,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapActions} from "vuex";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -62,30 +65,20 @@ export default {
|
||||
},
|
||||
detailInfo: {},
|
||||
fromType: 'add', //add新增 edit编辑,
|
||||
addUserType: 'manage', //manage网格长 Member管理员
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
onLoad(option) {
|
||||
this.$dict.load('girdType', 'girdLevel').then(() => {
|
||||
this.id = option.id
|
||||
this.fromType = option.fromType
|
||||
this.getDetail()
|
||||
uni.$on('selectUser', res => {
|
||||
if(this.addUserType == 'manage') {
|
||||
this.form.girdMemberManageList = res
|
||||
}else {
|
||||
this.form.girdMemberList = res
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
document.title = '添加网格'
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['selectPrivilegedContact']),
|
||||
getDetail() {
|
||||
this.$http.post(`/app/appgirdinfo/queryDetailById?id=${this.id}`).then((res) => {
|
||||
if (res.code == 0) {
|
||||
@@ -105,51 +98,31 @@ export default {
|
||||
})
|
||||
},
|
||||
toAddUser(type) {
|
||||
this.addUserType = type
|
||||
var selectUserList = []
|
||||
if(type == 'manage') {
|
||||
selectUserList = this.form.girdMemberManageList
|
||||
}else {
|
||||
selectUserList = this.form.girdMemberList
|
||||
}
|
||||
uni.setStorageSync('selectUserList', selectUserList)
|
||||
uni.navigateTo({url: `./SelectUser`})
|
||||
let obj = type == 'manage' ? "girdMemberManageList" : "girdMemberList",
|
||||
selectedOpenUserIds = this.form?.[obj]?.map(e => e.wxUserId) || []
|
||||
selectedOpenUserIds = selectedOpenUserIds || []
|
||||
this.$loading()
|
||||
this.selectPrivilegedContact({
|
||||
fromDepartmentId: 0, selectedOpenUserIds,
|
||||
selectedTickets: this.form?.[type + "Ticket"] || [],
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
this.form[obj] = res.userList?.map(e => ({id: e.openUserId})) || []
|
||||
this.form[type + "Ticket"] = res.selectedTicket
|
||||
}).catch(() => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
},
|
||||
confirm() {
|
||||
if (!this.form.girdName) {
|
||||
return this.$u.toast('请输入网格名称')
|
||||
}
|
||||
|
||||
var girdMemberManageList = []
|
||||
if(this.form.girdMemberManageList && this.form.girdMemberManageList.length) {
|
||||
girdMemberManageList = this.form.girdMemberManageList.map((item) => {
|
||||
return {
|
||||
wxUserId: item.id,
|
||||
phone: item.mobile,
|
||||
photo: item.avatar,
|
||||
name: item.name
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var girdMemberList = []
|
||||
if(this.form.girdMemberList && this.form.girdMemberList.length) {
|
||||
girdMemberList = this.form.girdMemberList.map((item) => {
|
||||
return {
|
||||
wxUserId: item.id,
|
||||
phone: item.mobile,
|
||||
photo: item.avatar,
|
||||
name: item.name
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.$http.post(`/app/appgirdinfo/addOrUpdateByEw`, {...this.form, girdMemberManageList, girdMemberList}).then((res) => {
|
||||
this.$http.post(`/app/appgirdinfo/addOrUpdateByEw`, {...this.form}).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.$u.toast('提交成功')
|
||||
uni.$emit('update')
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
uni.navigateBack({})
|
||||
}, 600)
|
||||
}
|
||||
}).catch((err) => {
|
||||
@@ -170,11 +143,13 @@ export default {
|
||||
font-size: 32px;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
margin-bottom: 16px;
|
||||
|
||||
.label {
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
line-height: 22px;
|
||||
width: 150px;
|
||||
|
||||
.tips {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
@@ -182,11 +157,13 @@ export default {
|
||||
line-height: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
.value {
|
||||
width: calc(100% - 150px);
|
||||
line-height: 44px;
|
||||
text-align: right;
|
||||
color: #666;
|
||||
|
||||
img {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
@@ -194,10 +171,12 @@ export default {
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.color-999 {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100%;
|
||||
height: 112px;
|
||||
|
||||
Reference in New Issue
Block a user