BUG 29554

This commit is contained in:
aixianling
2022-05-09 12:11:14 +08:00
parent 18d8a0cb93
commit 4a534bd486
2 changed files with 337 additions and 35 deletions

View File

@@ -2,15 +2,17 @@
<div class="Transfer"> <div class="Transfer">
<div class="contents"> <div class="contents">
<u-form :model="forms" ref="uForm" label-width="auto" :border-bottom="false"> <u-form :model="forms" ref="uForm" label-width="auto" :border-bottom="false">
<u-form-item label="转交给" prop="status" required :border-bottom="false" right-icon="arrow-right" <u-form-item label="转交给" prop="status" required :border-bottom="false" class="first-form" v-if="status == 4">
class="first-form" v-if="status == 4"> <div flex class="flexEnd">
<!-- <u-input v-model="forms.name" placeholder="请选择转交对象" @click="toSelectUser" disabled /> --> <AiPagePicker type="custom" :id="selectObject.id" @select="handleSelectObject"
<div @click="toSelectUser" style="width: 100%; text-align: right;"> :ops="{url:'../AppGridManagement/selectGridMember',label: 'name'}">
<span v-if="!forms.name" style="color:#999;">请选择</span> <template v-if="isSelectGridMember">
<AiOpenData v-else-if="selectUser.name" type="userName" :openid="forms.name" style="display:inline-block;"/> <AiOpenData type="userName" :openid="forms.name"/>
<span v-else v-text="forms.name"/> <u-icon name="arrow-right" color="#ddd"/>
</template>
<AiMore v-else v-model="forms.name"/>
</AiPagePicker>
</div> </div>
</u-form-item> </u-form-item>
<u-form-item label="事件分类" prop="groupName" required :border-bottom="false" right-icon="arrow-right" <u-form-item label="事件分类" prop="groupName" required :border-bottom="false" right-icon="arrow-right"
v-if="status== 2"> v-if="status== 2">
@@ -51,7 +53,6 @@
</template> </template>
<script> <script>
import qs from 'query-string'
export default { export default {
name: 'Content', name: 'Content',
@@ -71,24 +72,21 @@ export default {
status: '', //4转交 2我已办结 status: '', //4转交 2我已办结
myList: [], myList: [],
id: '', id: '',
selectUser: {}, selectObject: {},
titleList: ['', '', '事件处理', '', '事件转交'], titleList: ['', '', '事件处理', '', '事件转交'],
} }
}, },
computed: {
isSelectGridMember() {
return this.selectObject.kind == "user"
}
},
onLoad(option) { onLoad(option) {
this.status = option.status this.status = option.status
this.id = option.id this.id = option.id
this.forms.groupId = option.groupId this.forms.groupId = option.groupId
this.forms.groupName = option.groupName this.forms.groupName = option.groupName
this.typeList() this.typeList()
uni.$on('goback', (res) => {
this.selectUser = res
if (res.name) {
this.forms.name = res.name
} else {
this.forms.name = res.girdName
}
})
}, },
onShow() { onShow() {
document.title = this.titleList[this.status] document.title = this.titleList[this.status]
@@ -126,13 +124,13 @@ export default {
successText = '转交成功' successText = '转交成功'
params = { params = {
...this.forms, ...this.forms,
girdId: this.selectUser.id, girdId: this.selectObject.id,
girdName: this.selectUser.girdName, girdName: this.selectObject.girdName,
} }
if (this.selectUser.name) { //选择的网格员 if (this.isSelectGridMember) { //选择的网格员
params.girdId = this.selectUser.girdId params.girdId = this.selectObject.girdId
params.girdMemberId = this.selectUser.wxUserId params.girdMemberId = this.selectObject.wxUserId
params.girdMemberName = this.selectUser.name params.girdMemberName = this.selectObject.name
} }
} }
if (this.status == 2) { if (this.status == 2) {
@@ -142,17 +140,11 @@ export default {
} }
params.id = this.id params.id = this.id
this.$http.post(url, params).then((res) => { this.$http.post(url, params).then((res) => {
if (res.code == 0) { if (res?.code == 0) {
this.$u.toast(successText) this.$u.toast(successText)
uni.$emit('update') uni.$emit('update')
// uni.$emit('getListInit')
setTimeout(() => { setTimeout(() => {
uni.navigateBack({delta: 2}) uni.navigateBack({delta: 2})
// if (this.status == 4) {
// uni.navigateBack({delta: 2})
// } else {
// uni.navigateBack()
// }
}, 600) }, 600)
} }
}) })
@@ -161,10 +153,10 @@ export default {
this.forms.groupName = e[0].label this.forms.groupName = e[0].label
this.forms.groupId = e[0].value this.forms.groupId = e[0].value
}, },
toSelectUser() { handleSelectObject(obj) {
let {id} = this.selectUser this.selectObject = obj
uni.navigateTo({url: qs.stringifyUrl({url: './SelectUser', query: {id}})}) this.forms.name = obj.name || obj.girdName
}, }
}, },
} }
</script> </script>
@@ -259,5 +251,10 @@ export default {
width: 100%; width: 100%;
text-align: right; text-align: right;
} }
.flexEnd {
width: 100%;
justify-content: flex-end;
}
} }
</style> </style>

View File

@@ -0,0 +1,305 @@
<template>
<section class="selectGridMember">
<div class="header-middle">
<div class="hint">
<span v-for="(item, index) in selectGridPath" :key="index"><span v-if="index" style="margin:0 4px;">/</span><span
style="color:#3F8DF5" @click="girdNameClick(item, index)">{{ item.girdName }}</span></span>
</div>
<div class="cards" v-for="(item, index) in treeList" :key="item.id" @click="itemClick(item)">
<div class="imges">
<img src="./components/img/xzh.png" alt="" class="imgselect" v-if="item.isChecked"
@click.stop="girdClick(item, index)"/>
<img src="./components/img/xz.png" alt="" class="imgselect" v-else
@click.stop="girdClick(item, index)"/>
<img src="./components/img/gird--select-icon.png" alt="" class="avatras"/>
</div>
<div class="rightes">
<div class="applicationNames">{{ item.girdName }}</div>
<img src="./components/img/right-icon.png" alt="" class="imgs"/>
</div>
</div>
<div class="userCards" v-for="(e, index) in userList" :key="e.id">
<div class="imges">
<img src="./components/img/xzh.png" alt="" class="imgselect" v-if="e.isChecked" @click="userClick(e, index)"/>
<img src="./components/img/xz.png" alt="" class="imgselect" v-else @click="userClick(e, index)"/>
<img src="./components/img/tx@2x.png" alt="" class="avatras"/>
</div>
<div class="rights fill">
<div class="applicationNames">
<AiOpenData v-if="e.name" type="userName" :openid="e.name" style="display: block;"/>
</div>
<div class="idNumbers">{{ e.phone }}</div>
</div>
</div>
<AiEmpty description="暂无数据" v-if="!hasData"/>
</div>
<div class="subBtn" @click="submit">
<div>确定选择</div>
</div>
</section>
</template>
<script>
export default {
name: "selectGridMember",
appName: "选择人员(网格成员)",
data() {
return {
selected: {},
allData: null,
treeList: [],
selectGridPath: [],
userList: [],
}
},
computed: {
hasData() {
return this.treeList?.length > 0 || this.userList?.length > 0
}
},
onLoad() {
this.selected.id = this.$route.query.id
this.getAllGrids()
},
onShow() {
document.title = '选择人员'
},
methods: {
getAllGrids() {
this.$http.post('/app/appgirdinfo/listByInfo').then((res) => {
if (res?.data) {
let parents = res.data.map(e => e.parentGirdId)
this.allData = res.data.map(e => ({...e, hasChildren: parents.includes(e.id)}))
this.gridInit()
}
})
},
gridInit() {
this.treeList = this.allData.filter(e => !e.parentGirdId)
this.selectGridPath = [{girdName: "可选范围", id: ''}]
},
itemClick({id, girdName}) {
this.selectGridPath.push({girdName, id})
this.getGridsAndUsersByParent(id)
},
getGridsAndUsersByParent(id) {
this.treeList = this.allData.filter(e => e.parentGirdId == id)
this.userList = []
this.$http.post(`/app/appgirdmemberinfo/listByGirdIdByThree?girdId=${id}`).then((res) => {
if (res?.data) {
this.userList = res.data.map(e => ({...e, isChecked: e.id == this.selected.id}))
}
})
},
girdNameClick(row, index) {
this.userList = []
if (!index) { //第一级别
this.gridInit()
} else {
let length = this.selectGridPath.length - index
this.selectGridPath.splice(index, length)
this.getGridsAndUsersByParent(row.id)
}
},
girdClick(row, index) {
if (this.treeList[index].isChecked) {//取消
this.treeList[index].isChecked = false
this.selected = {}
} else {
this.treeList.map((item, i) => {
item.isChecked = index == i
})
this.selected = {...row, kind: "grid"}
}
this.$forceUpdate()
},
userClick(row, index) {
if (this.userList[index].isChecked) {//取消
this.userList[index].isChecked = false
this.selected = {}
} else {
this.userList.map((item, i) => {
item.isChecked = index == i
})
this.selected = {...row, kind: "user"}
}
this.$forceUpdate()
},
submit() {
if (this.selected.id != null) {
uni.navigateBack({
success: () => {
uni.$emit("pagePicker:custom", this.selected)
}
})
} else {
return this.$u.toast('请选择网格或网格员')
}
},
}
}
</script>
<style lang="scss" scoped>
.selectGridMember {
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;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.empty-div {
height: 16px;
background: #f5f5f5;
}
.cards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
padding: 0 0 0 32px;
.imges {
display: flex;
align-items: center;
.imgselect {
width: 48px;
height: 48px;
vertical-align: middle;
}
.avatras {
width: 74px;
height: 74px;
border-radius: 8px;
margin-left: 36px;
}
}
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 {
width: 40px;
height: 40px;
margin-right: 20px;
}
}
}
.userCards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
padding: 0 0 0 32px;
.imges {
display: flex;
align-items: center;
.imgselect {
width: 48px;
height: 48px;
}
.avatras {
width: 74px;
height: 74px;
border-radius: 8px;
margin-left: 36px;
}
}
.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;
}
}
}
</style>