2022-01-13 11:13:06 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="AddGird">
|
2022-06-13 09:57:52 +08:00
|
|
|
|
<AiGroup>
|
|
|
|
|
|
<AiItem label="网格名称" required>
|
|
|
|
|
|
<u-input type="text" placeholder="请输入" input-align="right" placeholder-style="color:#999;font-size:16px;" height="48" v-model="form.girdName"
|
|
|
|
|
|
maxlength="50"/>
|
|
|
|
|
|
</AiItem>
|
|
|
|
|
|
</AiGroup>
|
|
|
|
|
|
<AiGroup>
|
|
|
|
|
|
<AiItem label="网格长" topLabel>
|
|
|
|
|
|
<AiPagePicker type="sysUser" :selected.sync="form.girdMemberManageList" action="/app/wxcp/wxuser/list?status=1" nodeKey="id">
|
|
|
|
|
|
<AiMore :value="getArrayLabel(form.girdMemberManageList)"/>
|
|
|
|
|
|
</AiPagePicker>
|
|
|
|
|
|
</AiItem>
|
|
|
|
|
|
</AiGroup>
|
|
|
|
|
|
<AiGroup>
|
|
|
|
|
|
<AiItem label="网格员" topLabel>
|
|
|
|
|
|
<AiPagePicker type="sysUser" :selected.sync="form.girdMemberList" action="/app/wxcp/wxuser/list?status=1" nodeKey="id">
|
|
|
|
|
|
<AiMore :value="getArrayLabel(form.girdMemberList)"/>
|
|
|
|
|
|
</AiPagePicker>
|
|
|
|
|
|
</AiItem>
|
|
|
|
|
|
</AiGroup>
|
|
|
|
|
|
<div class="footer" @click="$u.debounce(confirm)">{{ fromType == 'add' ? '确认添加' : '确认修改' }}</div>
|
2022-01-13 11:13:06 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-06-13 09:57:52 +08:00
|
|
|
|
|
2022-01-13 11:13:06 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2022-01-14 10:56:52 +08:00
|
|
|
|
id: '',
|
2022-01-14 11:43:17 +08:00
|
|
|
|
form: {
|
|
|
|
|
|
girdMemberManageList: [],
|
|
|
|
|
|
girdMemberList: []
|
|
|
|
|
|
},
|
2022-01-14 10:56:52 +08:00
|
|
|
|
fromType: 'add', //add新增 edit编辑,
|
2022-01-13 11:13:06 +08:00
|
|
|
|
}
|
2022-01-14 10:56:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
onLoad(option) {
|
|
|
|
|
|
this.id = option.id
|
2022-01-14 11:43:17 +08:00
|
|
|
|
this.fromType = option.fromType
|
2022-01-14 10:56:52 +08:00
|
|
|
|
this.getDetail()
|
2022-01-13 11:13:06 +08:00
|
|
|
|
},
|
|
|
|
|
|
onShow() {
|
2022-06-13 09:57:52 +08:00
|
|
|
|
if (this.fromType == 'add') {
|
|
|
|
|
|
document.title = '添加网格'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
document.title = '编辑网格'
|
|
|
|
|
|
}
|
2022-01-13 11:13:06 +08:00
|
|
|
|
},
|
2022-01-14 10:56:52 +08:00
|
|
|
|
methods: {
|
|
|
|
|
|
getDetail() {
|
|
|
|
|
|
this.$http.post(`/app/appgirdinfo/queryDetailById?id=${this.id}`).then((res) => {
|
2022-06-13 09:57:52 +08:00
|
|
|
|
if (res?.data) {
|
|
|
|
|
|
if (this.fromType == 'edit') {
|
2022-01-14 10:56:52 +08:00
|
|
|
|
this.form = res.data
|
2022-06-13 09:57:52 +08:00
|
|
|
|
this.form.girdMemberList?.map(e => e.id = e.wxUserId)
|
|
|
|
|
|
this.form.girdMemberManageList?.map(e => e.id = e.wxUserId)
|
2022-01-14 10:56:52 +08:00
|
|
|
|
}
|
2022-06-13 09:57:52 +08:00
|
|
|
|
if (this.fromType == 'add') {
|
|
|
|
|
|
this.form.parentGirdId = res.data.id
|
|
|
|
|
|
this.form.parentGirdName = res.data.girdName
|
2022-01-17 13:52:33 +08:00
|
|
|
|
this.$forceUpdate()
|
2022-01-14 15:40:10 +08:00
|
|
|
|
}
|
2022-01-14 10:56:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
confirm() {
|
2022-06-13 09:57:52 +08:00
|
|
|
|
if (!this.form.girdName) {
|
2022-01-14 10:56:52 +08:00
|
|
|
|
return this.$u.toast('请输入网格名称')
|
|
|
|
|
|
}
|
2022-06-13 09:57:52 +08:00
|
|
|
|
let girdMemberManageList = this.form.girdMemberManageList?.map((item) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
wxUserId: item.id,
|
|
|
|
|
|
phone: item.mobile,
|
|
|
|
|
|
photo: item.avatar,
|
|
|
|
|
|
name: item.name
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
let girdMemberList = this.form.girdMemberList?.map((item) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
wxUserId: item.id,
|
|
|
|
|
|
phone: item.mobile,
|
|
|
|
|
|
photo: item.avatar,
|
|
|
|
|
|
name: item.name
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-01-22 10:47:14 +08:00
|
|
|
|
this.$http.post(`/app/appgirdinfo/addOrUpdateByEw`, {...this.form, girdMemberManageList, girdMemberList}).then((res) => {
|
2022-06-13 09:57:52 +08:00
|
|
|
|
if (res?.code == 0) {
|
2022-01-14 13:46:06 +08:00
|
|
|
|
this.$u.toast('提交成功')
|
|
|
|
|
|
uni.$emit('update')
|
|
|
|
|
|
setTimeout(() => {
|
2022-06-13 09:57:52 +08:00
|
|
|
|
uni.navigateBack({})
|
2022-01-14 13:46:06 +08:00
|
|
|
|
}, 600)
|
2022-01-14 10:56:52 +08:00
|
|
|
|
}
|
2022-01-17 13:52:33 +08:00
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
this.$u.toast(err)
|
2022-01-14 10:56:52 +08:00
|
|
|
|
})
|
2022-06-13 09:57:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
getArrayLabel(arr, key = 'name', separation = ',') {
|
|
|
|
|
|
return arr?.map(e => e[key])?.join(separation)
|
2022-01-14 10:56:52 +08:00
|
|
|
|
}
|
2022-01-13 11:13:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.AddGird {
|
2022-06-13 09:57:52 +08:00
|
|
|
|
.item-flex {
|
2022-01-13 11:13:06 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
padding: 34px 32px;
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
|
|
|
|
margin-bottom: 16px;
|
2022-06-13 09:57:52 +08:00
|
|
|
|
|
|
|
|
|
|
.label {
|
2022-01-13 11:13:06 +08:00
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
color: #333333;
|
|
|
|
|
|
line-height: 22px;
|
|
|
|
|
|
width: 150px;
|
2022-06-13 09:57:52 +08:00
|
|
|
|
|
|
|
|
|
|
.tips {
|
2022-01-13 11:13:06 +08:00
|
|
|
|
display: inline-block;
|
|
|
|
|
|
width: 16px;
|
|
|
|
|
|
color: #F46;
|
|
|
|
|
|
line-height: 44px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-06-13 09:57:52 +08:00
|
|
|
|
|
|
|
|
|
|
.value {
|
2022-01-13 11:13:06 +08:00
|
|
|
|
width: calc(100% - 150px);
|
|
|
|
|
|
line-height: 44px;
|
|
|
|
|
|
text-align: right;
|
|
|
|
|
|
color: #666;
|
2022-06-13 09:57:52 +08:00
|
|
|
|
|
|
|
|
|
|
img {
|
|
|
|
|
|
width: 44px;
|
|
|
|
|
|
height: 44px;
|
2022-01-13 11:13:06 +08:00
|
|
|
|
vertical-align: middle;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-06-13 09:57:52 +08:00
|
|
|
|
|
|
|
|
|
|
.color-999 {
|
2022-01-13 11:13:06 +08:00
|
|
|
|
color: #999;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-06-13 09:57:52 +08:00
|
|
|
|
|
|
|
|
|
|
.footer {
|
2022-01-13 11:13:06 +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>
|