This commit is contained in:
liuye
2022-01-07 13:58:07 +08:00
parent 519c9139ab
commit 07bf7fd304
4 changed files with 203 additions and 239 deletions

View File

@@ -3,9 +3,7 @@
<div class="contents">
<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" class="first-form" v-if="status == 1">
<u-input v-model="forms.status" placeholder="请选择转交对象" @click="toSelectUser" disabled />
<!-- <AiTreePicker :ops="treeList" v-model="forms.status" @select="handerSelect"> </AiTreePicker> -->
<u-input v-model="forms.name" placeholder="请选择转交对象" @click="toSelectUser" disabled />
</u-form-item>
<u-form-item label="事件分类" prop="groupName" required :border-bottom="false" right-icon="arrow-right" v-if="status != 1">
<u-input v-model="forms.groupName" placeholder="请选择事件分类" @click="show = true" />
@@ -26,15 +24,15 @@
</u-form>
</div>
<div class="btn" v-if="this.status == 1" @click="submit3">
<div class="btn" v-if="this.status == 1" @click="confirm">
<span>转交事件</span>
</div>
<div class="btn" v-if="this.status == 2" @click="submit2">
<div class="btn" v-if="this.status == 2" @click="confirm">
<span>拒绝受理</span>
</div>
<div class="btn" v-if="this.status == 3" @click="submit3">
<div class="btn" v-if="this.status == 3" @click="confirm">
<span>我已办结</span>
</div>
</div>
@@ -52,12 +50,14 @@ export default {
groupId: '',
content: '',
files: [],
name: ''
},
flag: false,
show: false,
status: '', //1转交 2拒绝受理 3我已办结
myList: [],
id: '',
selectUser: {}
}
},
onLoad(option) {
@@ -66,135 +66,85 @@ export default {
this.forms.groupId = option.groupId
this.forms.groupName = option.groupName
this.typeList()
uni.$on('goback', (res) => {
this.selectUser = res
if(res.name) {
this.forms.name = res.name
}else{
this.forms.name = res.girdName
}
})
},
methods: {
// 拒绝 /app/appclapeventinfo/finishByManager
// 同意 /app/appclapeventinfo/finishByGirdMember
// 拒绝
submit2() {
if (this.flag) return
this.$refs.uForm.validate((valid) => {
if (valid) {
if (this.status == 2 || this.status == 3) {
if (!this.forms.groupName) {
return this.$u.toast('请选择事件分类')
}
if (!this.forms.content) {
return this.$u.toast(this.status == 2 ? '请输入拒绝受理意见' : '请输入你的办结意见')
}
}
const imgs = []
if (this.forms.files) {
this.forms.files.map((e) => {
imgs.push({ url: e.url, id: e.id })
})
}
this.flag = true
this.$http
.post('/app/appclapeventinfo/refuse', {
groupName: this.forms.groupName,
groupId: this.forms.groupId,
content: this.forms.content,
files: imgs || [],
id: this.id,
})
.then((res) => {
if (res.code == 0) {
this.$u.toast('受理成功')
this.forms = {}
this.flag = false
uni.$emit('nextList')
setTimeout(() => {
uni.navigateBack()
}, 600)
}
})
} else {
this.$u.toast('失败')
}
})
},
// 同意
submit3() {
if (this.flag) return
this.$refs.uForm.validate((valid) => {
if (valid) {
if (this.status == 2 || this.status == 3) {
if (!this.forms.groupName) {
return this.$u.toast('请选择事件分类')
}
if (!this.forms.content) {
return this.$u.toast(this.status == 2 ? '请输入拒绝受理意见' : '请输入你的办结意见')
}
}
const imgs = []
if (this.forms.files) {
this.forms.files.map((e) => {
imgs.push({ url: e.url, id: e.id })
})
}
this.flag = true
this.$http
.post('/app/appclapeventinfo/finishByGirdMember', {
groupName: this.forms.groupName,
groupId: this.forms.groupId,
content: this.forms.content,
files: imgs || [],
id: this.id,
})
.then((res) => {
if (res.code == 0) {
this.$u.toast('受理成功')
this.flag = false
this.forms = {}
uni.$emit('nextList')
setTimeout(() => {
uni.navigateBack()
}, 600)
}
})
} else {
this.$u.toast('失败')
}
})
},
typeList() {
this.$http
.post(`/app/appclapeventgroup/list`, null, {
params: {
size: 9999,
},
})
.then((res) => {
if (res.code == 0) {
this.myList = res.data.records
this.$forceUpdate()
}
})
this.$http.post(`/app/appclapeventgroup/list`, null, {
params: {
size: 9999,
},
})
.then((res) => {
if (res.code == 0) {
this.myList = res.data.records
this.$forceUpdate()
}
})
},
selectStatus(e) {
console.log(e)
if (this.show) {
this.forms.groupName = e[0].label
this.forms.groupId = e[0].value
} else {
confirm() {
if(this.status == 1 && !this.forms.name) {
return this.$u.toast('请选择转交对象')
}
if(this.status != 1 && !this.forms.groupName) {
return this.$u.toast('请选择分类')
}
if(this.status != 1 && !this.forms.content) {
return this.$u.toast('请输入意见')
}
this.submit()
},
submit() { //status 1转交 2拒绝受理 3我已办结
var url = '', successText= '', params= ''
if(this.status == 1) {
url = `/app/appclapeventinfo/transfer`
successText = '转交成功'
params = {
...this.forms,
girdId: this.selectUser.id,
girdName: this.selectUser.girdName,
}
if(this.selectUser.name) { //选择的网格员
this.params.girdId = this.selectUser.girdId
this.params.girdMemberId = this.selectUser.id
this.params.girdMemberName = this.selectUser.name
}
}
if(this.status == 2) {
url = `/app/appclapeventinfo/refuse`
successText = '拒绝成功'
params = {...this.forms}
}
if(this.status == 3) {
url = `/app/appclapeventinfo/finishByGirdMember`
successText = '办结成功'
params = {...this.forms}
}
params.id = this.id
this.$http.post(url, params).then((res) => {
if (res.code == 0) {
this.$u.toast(successText)
uni.$emit('updateDeatil')
uni.$emit('getListInit')
setTimeout(() => {
uni.navigateBack()
},600)
}
})
},
selectStatus(e) {
this.forms.groupName = e[0].label
this.forms.groupId = e[0].value
},
handerSelect() {},
toSelectUser() {
uni.navigateTo({ url: './SelectUser' })
},