AiCard #custom #menu

This commit is contained in:
花有清香月有阴
2021-12-16 17:13:18 +08:00
parent 81c6e9ce04
commit c61082f72c
4 changed files with 187 additions and 154 deletions

View File

@@ -9,13 +9,13 @@
<u-form-item label="公开类型" prop="status" required style="position: relative">
<u-input v-model="forms.status" disabled placeholder="请选择公开类型" @click="showStstus = true" />
<u-select v-model="showStstus" :list="$dict.getDict('realityStatus')" value-name="dictValue" label-name="dictName" @confirm="realityStstus"></u-select>
<u-select v-model="showStstus" :list="$dict.getDict('realityStatus')" value-name="dictValue" label-name="dictName" @confirm="selectStatus"></u-select>
<u-icon name="arrow-right" color="#CCCCCC" style="position: absolute; top: 25px; right: 30px"></u-icon>
</u-form-item>
<u-form-item label="发布地区" prop="areaId" required style="position: relative">
<AiAreaPicker v-model="areaId" :areaId="areaIdProps" @select="areaSelect"></AiAreaPicker>
<AiAreaPicker v-model="forms.areaId" :areaId="areaIdProps" @select="areaSelect"></AiAreaPicker>
<u-icon name="arrow-right" color="#CCCCCC" style="position: absolute; top: 25px; right: 30px"></u-icon>
</u-form-item>
@@ -45,10 +45,11 @@ export default {
props: {},
data() {
return {
show: false,
id: '',
forms: {
title: '',
status: '',
statusValue: '',
content: '',
fileIds: [],
areaId: '',
@@ -59,43 +60,45 @@ export default {
}
},
computed: { ...mapState(['user']) },
created() {
onLoad(o) {
console.log(o)
this.id = o.id
this.areaIdProps = this.user.areaId
this.$dict.load('realityStatus').then(() => {
this.getDetail()
})
},
mounted() {},
methods: {
getDetail() {
this.$http.post(`/app/appvisitvondolence/queryDetailById?id=${this.params.id}`).then((res) => {
if (res?.data) {
this.forms = res.data
this.forms.realityValue = res.data.reality
this.forms.reality = this.$dict.getLabel('realityStatus', res.data.reality)
if (res.data.images) {
this.forms.images = JSON.parse(res.data.images || '[]')
}
}
})
},
// getDetail() {
// this.$http.post(`/app/appvisitvondolence/queryDetailById?id=${this.id}`).then((res) => {
// if (res?.data) {
// this.forms = res.data
// this.forms.statusValue = res.data.status
// this.forms.status = this.$dict.getLabel('realityStatus', res.data.status)
// if (res.data.images) {
// this.forms.images = JSON.parse(res.data.images || '[]')
// }
// }
// })
// },
submit() {
if (this.flag) return
this.$refs.uForm.validate((valid) => {
if (valid) {
if (!this.forms.create_user_name) {
return this.$u.toast('请选择走访慰问对象')
}
if (!this.forms.title) {
return this.$u.toast('请输入入户走访事项')
return this.$u.toast('请输入标题')
}
if (!this.forms.content) {
return this.$u.toast('请输入正文')
}
const imgs = []
if (this.forms.images) {
this.forms.images.map((e) => {
console.log(e)
if (this.forms.fileIds) {
this.forms.fileIds.map((e) => {
imgs.push({ url: e.url, id: e.id })
})
}
@@ -103,26 +106,19 @@ export default {
this.flag = true
this.$http
.post(`/app/appvisitvondolence/addOrUpdate`, {
areaId: this.forms.areaId,
applicationId: this.forms.applicationId,
name: this.forms.create_user_name,
optionId: this.forms.applicationId,
reality: this.forms.realityValue ? this.forms.realityValue : this.forms.reality,
title: this.forms.title,
description: this.forms.description,
createUserId: this.user.id,
createUserName: this.user.name,
images: JSON.stringify(imgs) || [],
status: this.forms.statusValue ? this.forms.statusValue : this.forms.status,
areaId: this.forms.areaId,
content: this.forms.content,
// images: JSON.stringify(imgs) || [],
images: imgs || [],
id: this.id,
})
.then((res) => {
console.log(4)
if (res.code == 0) {
console.log(5)
this.$u.toast('发布成功')
this.flag = false
uni.navigateTo({ url: `./AppWalkask` })
console.log(6)
uni.navigateTo({ url: `./AppServicePublic` })
}
})
} else {
@@ -132,24 +128,12 @@ export default {
},
areaSelect(e) {
if (e.type == 5) {
this.forms.areaId = e.id
} else {
return this.$u.toast('请选择到村')
}
this.forms.areaId = e.id
},
backlist(e) {
console.log(e.item)
this.forms.create_user_name = e.item.create_user_name
this.forms.applicationId = e.appId
this.forms.optionId = e.item.id
// this.addList = true
},
realityStstus(e) {
this.forms.reality = e[0].label
this.forms.realityValue = e[0].value
selectStatus(e) {
this.forms.status = e[0].label
this.forms.statusValue = e[0].value
},
},
}