整合上架版进入标准流程
This commit is contained in:
193
src/project/saas/AppGridManagement/AddGird.vue
Normal file
193
src/project/saas/AppGridManagement/AddGird.vue
Normal file
@@ -0,0 +1,193 @@
|
||||
<template>
|
||||
<div class="AddGird">
|
||||
<div class="item-flex">
|
||||
<div class="label">
|
||||
<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"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-flex">
|
||||
<div class="label">
|
||||
<span class="tips"></span>网格长
|
||||
</div>
|
||||
<div class="value" @click="toAddUser('manage')">
|
||||
|
||||
<span v-if="form.girdMemberManageList && form.girdMemberManageList.length">
|
||||
<!-- <span v-for="(item, index) in form.girdMemberManageList" :key="index"><span v-if="index>0">,</span>{{item.name}}</span> -->
|
||||
已选择<span style="color:#3F8DF5;margin:0 4px;">{{ form.girdMemberManageList.length }}</span>人
|
||||
</span>
|
||||
<span style="color:#999;" v-else>请选择</span>
|
||||
<img src="./components/img/right-icon.png" alt=""/></div>
|
||||
</div>
|
||||
<div class="item-flex">
|
||||
<div class="label">
|
||||
<span class="tips"></span>网格员
|
||||
</div>
|
||||
<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> -->
|
||||
</span>
|
||||
<span style="color:#999;" v-else>请选择</span>
|
||||
<img src="./components/img/right-icon.png" alt=""/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer" @click="confirm">{{ fromType == 'add' ? '确认添加' : '确认修改' }}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapActions} from "vuex";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
form: {
|
||||
girdMemberManageList: [],
|
||||
girdMemberList: []
|
||||
},
|
||||
detailInfo: {},
|
||||
fromType: 'add', //add新增 edit编辑,
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.id = option.id
|
||||
this.fromType = option.fromType
|
||||
this.getDetail()
|
||||
},
|
||||
onShow() {
|
||||
if (this.fromType == 'add') {
|
||||
document.title = '添加网格'
|
||||
} else {
|
||||
document.title = '编辑网格'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['selectPrivilegedContact']),
|
||||
getDetail() {
|
||||
this.$http.post(`/app/appgirdinfo/queryDetailById?id=${this.id}`).then((res) => {
|
||||
if (res?.data) {
|
||||
this.detailInfo = res.data
|
||||
if (this.fromType == 'edit') {
|
||||
this.form = res.data
|
||||
}
|
||||
if (this.fromType == 'add') {
|
||||
this.form.parentGirdId = this.detailInfo.id
|
||||
this.form.parentGirdName = this.detailInfo.girdName
|
||||
this.$forceUpdate()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
toAddUser(type) {
|
||||
let obj = type == 'manage' ? "girdMemberManageList" : "girdMemberList",
|
||||
selectedOpenUserIds = this.form?.[obj]?.map(e => e.id) || []
|
||||
selectedOpenUserIds = selectedOpenUserIds || []
|
||||
this.$loading()
|
||||
this.selectPrivilegedContact({
|
||||
fromDepartmentId: 0, selectedOpenUserIds,
|
||||
selectedTickets: this.form?.[type + "Ticket"] || [],
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
let isRepeat = false //判断网格长网格员是否选择相同人员
|
||||
this.form[obj] = res.userList?.map(e => ({id: e.openUserId})) || []
|
||||
this.form.girdMemberList?.map((item) => {
|
||||
this.form.girdMemberManageList?.map((items) => {
|
||||
if (item.id == items.id) {
|
||||
isRepeat = false
|
||||
}
|
||||
})
|
||||
})
|
||||
// if (isRepeat) {
|
||||
// this.form[obj] = []
|
||||
// return this.$u.toast('网格长网格员不能选择相同人员')
|
||||
// }
|
||||
this.form[type + "Ticket"] = res.selectedTicket
|
||||
}).catch(() => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
},
|
||||
confirm() {
|
||||
if (!this.form.girdName) {
|
||||
return this.$u.toast('请输入网格名称')
|
||||
}
|
||||
uni.showLoading({mask: true})
|
||||
this.$http.post(`/app/appgirdinfo/addOrUpdateByEw`, {...this.form}).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.$u.toast('提交成功')
|
||||
uni.$emit('update')
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({})
|
||||
}, 600)
|
||||
}
|
||||
}).catch((err) => {
|
||||
this.$u.toast(err)
|
||||
}).finally(() => uni.hideLoading())
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.AddGird {
|
||||
.item-flex {
|
||||
display: flex;
|
||||
padding: 34px 32px;
|
||||
background-color: #fff;
|
||||
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;
|
||||
color: #F46;
|
||||
line-height: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
.value {
|
||||
width: calc(100% - 150px);
|
||||
line-height: 44px;
|
||||
text-align: right;
|
||||
color: #666;
|
||||
|
||||
img {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.color-999 {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
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>
|
||||
Reference in New Issue
Block a user