203 lines
5.6 KiB
Vue
203 lines
5.6 KiB
Vue
|
|
<template>
|
||
|
|
<div class="add">
|
||
|
|
<div class="header-description">
|
||
|
|
<u-form :model="forms" ref="uForm" label-width="auto">
|
||
|
|
<u-form-item label="标题" prop="title" required label-position="top">
|
||
|
|
<u-input v-model="forms.title" placeholder="请输入标题(30字以内)" type="textarea" auto-height height="60" maxlength="30" />
|
||
|
|
</u-form-item>
|
||
|
|
|
||
|
|
<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-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>
|
||
|
|
|
||
|
|
<u-icon name="arrow-right" color="#CCCCCC" style="position: absolute; top: 25px; right: 30px"></u-icon>
|
||
|
|
</u-form-item>
|
||
|
|
|
||
|
|
<u-form-item label="正文" prop="content" required label-position="top">
|
||
|
|
<u-input v-model="forms.content" placeholder="请输入活动详情(30字以内)" type="textarea" auto-height height="60" maxlength="500" />
|
||
|
|
</u-form-item>
|
||
|
|
|
||
|
|
<u-form-item label="图片(最多9张)" prop="fileIds" class="avatars" label-position="top">
|
||
|
|
<AiUploader :def.sync="forms.fileIds" multiple placeholder="上传图片" :limit="9"></AiUploader>
|
||
|
|
</u-form-item>
|
||
|
|
</u-form>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="btn" @click="submit">保存</div>
|
||
|
|
|
||
|
|
<AiBack></AiBack>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import { mapState } from 'vuex'
|
||
|
|
|
||
|
|
export default {
|
||
|
|
name: 'Add',
|
||
|
|
components: {},
|
||
|
|
props: {},
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
show: false,
|
||
|
|
forms: {
|
||
|
|
title: '',
|
||
|
|
status: '',
|
||
|
|
content: '',
|
||
|
|
fileIds: [],
|
||
|
|
areaId: '',
|
||
|
|
},
|
||
|
|
showStstus: false,
|
||
|
|
flag: false,
|
||
|
|
areaIdProps: '',
|
||
|
|
}
|
||
|
|
},
|
||
|
|
computed: { ...mapState(['user']) },
|
||
|
|
created() {
|
||
|
|
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 || '[]')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
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('请输入入户走访事项')
|
||
|
|
}
|
||
|
|
|
||
|
|
const imgs = []
|
||
|
|
if (this.forms.images) {
|
||
|
|
this.forms.images.map((e) => {
|
||
|
|
console.log(e)
|
||
|
|
imgs.push({ url: e.url, id: e.id })
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
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) || [],
|
||
|
|
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)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
} else {
|
||
|
|
this.$u.toast('失败')
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
areaSelect(e) {
|
||
|
|
if (e.type == 5) {
|
||
|
|
this.forms.areaId = e.id
|
||
|
|
} else {
|
||
|
|
return this.$u.toast('请选择到村')
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
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
|
||
|
|
},
|
||
|
|
},
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style lang="scss" scoped>
|
||
|
|
.add {
|
||
|
|
height: 100%;
|
||
|
|
padding-bottom: 112px;
|
||
|
|
|
||
|
|
.header-description {
|
||
|
|
::v-deep .u-form {
|
||
|
|
.u-form-item {
|
||
|
|
.u-form-item__body {
|
||
|
|
.u-form-item--right__content__slot {
|
||
|
|
padding-bottom: 0;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
.u-form-item:last-child {
|
||
|
|
margin-bottom: 0;
|
||
|
|
padding-bottom: 20px !important;
|
||
|
|
}
|
||
|
|
|
||
|
|
.avatars {
|
||
|
|
.u-form-item__body {
|
||
|
|
.default {
|
||
|
|
width: 160px;
|
||
|
|
height: 160px;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
.btn {
|
||
|
|
position: fixed;
|
||
|
|
bottom: 0;
|
||
|
|
width: 100%;
|
||
|
|
height: 112px;
|
||
|
|
line-height: 112px;
|
||
|
|
background: #1365dd;
|
||
|
|
text-align: center;
|
||
|
|
font-size: 32px;
|
||
|
|
font-weight: 500;
|
||
|
|
color: #ffffff;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</style>
|