建平需求变更调整完毕

This commit is contained in:
aixianling
2022-08-15 18:39:33 +08:00
parent 25e45267c1
commit 3544a290ab
13 changed files with 599 additions and 389 deletions

View File

@@ -1,35 +1,55 @@
<template>
<div class="addLog">
<div class="help" v-if="type == 1">
<div><span style="color: #FF4466;">*</span>帮扶类型</div>
<AiSelect dict="fpAssistanceMeasures" v-model="operationDesc"></AiSelect>
</div>
<div class="form-item form-item__textarea">
<div class="form-item__title">
<em v-if="type==0">*</em>
<h2>{{type == 1 ? '帮扶内容' : '走访内容'}}</h2>
</div>
<textarea maxlength="500" v-model="detail" :placeholder="type == 1 ? '请输入帮扶内容' : '请输入走访内容'"></textarea>
<div class="hint">{{ detail.length }}/500</div>
</div>
<div class="form-item form-item__imgs">
<div class="form-item__title">
<h2>图片</h2>
<i>最多9张</i>
</div>
<div>
<AiUploader :def.sync="files" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
</div>
</div>
<AiGroup v-if="isBangFu">
<AiItem label="帮扶类型" required>
<AiSelect dict="fpAssistanceMeasures" v-model="form.operationDesc"/>
</AiItem>
</AiGroup>
<AiGroup v-else-if="isNormalFarmer">
<AiItem label="走访对象" required>
<input v-model="form.name"/>
</AiItem>
<AiItem label="现住址" required>
<AiAreaPicker v-model="form.areaId" :name.sync="areaName">
<AiMore v-model="form.areaName"/>
</AiAreaPicker>
</AiItem>
<AiItem label="走访日期" required>
<AiDate v-model="form.visitDate"/>
</AiItem>
</AiGroup>
<!--走访日志-->
<AiGroup v-else>
<AiItem label="走访日期" required>
<AiDate v-model="form.visitDate"/>
</AiItem>
</AiGroup>
<AiGroup>
<AiItem :label="isBangFu ? '帮扶内容' : '走访内容'" required topLabel>
<textarea maxlength="500" v-model="form.detail" :placeholder="isBangFu ? '请输入帮扶内容' : '请输入走访内容'"></textarea>
<div class="hint">{{ form.detail.length || 0 }}/500</div>
</AiItem>
</AiGroup>
<AiGroup>
<AiItem label="图片" topLabel>
<span slot="sub" class="color-999" v-text="`最多9张`"/>
<AiUploader :def.sync="form.files" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
</AiItem>
</AiGroup>
<div class="btn" @click="submit">提交</div>
</div>
</template>
<script>
import AiMore from "../../components/AiMore";
export default {
components: {AiMore},
data() {
return {
name: null,
areaId: null,
areaName: null,
detail: '',
pid: '',
files: [],
@@ -37,57 +57,59 @@ export default {
type: '',
operationDesc: '',
flag: false,
form: {detail: ""}
}
},
computed: {
isBangFu: v => v.type == 1,
isNormalFarmer: v => v.type == 2
},
onLoad(query) {
this.$dict.load('fpAssistanceMeasures')
this.pid = query.pid
this.type = query.type
if(query.id) {
this.visitDate = this.$dateFormat(this.$dayjs())
if (query.id) {
this.id = query.id
this.getInfo()
}
},
onShow() {
if(this.type == 1) {
document.title = this.id ? '编辑帮扶措施' : '添加帮扶措施'
}else {
document.title = this.id ? '编辑走访日志' : '添加走访日志'
}
this.pageTitle()
},
methods: {
pageTitle() {
const action = this.id ? '编辑' : '添加', app = this.type == 1 ? '帮扶措施' : this.type == 2 ? '一般农户走访日志' : '走访日志'
document.title = action + app
},
getInfo() {
this.$http.post(`/app/apppreventionreturntopovertylog/queryDetailById?id=${this.id}`).then(res => {
if (res.code == 0) {
this.operationDesc = res.data.operationDesc
this.detail = res.data.detail
this.files = res.data.files || []
if (res?.data) {
this.form = res.data
}
})
},
submit() {
if(this.flag) return
if(this.type == 1) {
if (!this.operationDesc) {
if (this.flag) return
if (this.type == 1) {
if (!this.form.operationDesc) {
return this.$u.toast('请选择帮扶类型')
}
} else if (this.type == 2) {
if (!this.form.areaId) {
return this.$u.toast('请选择现住址')
}
if (!this.form.name) {
return this.$u.toast('请输入走访对象')
}
} else {
if (!this.detail) {
if (!this.form.detail) {
return this.$u.toast('请输入走访内容')
}
}
this.flag = true
this.$http.post('/app/apppreventionreturntopovertylog/addOrUpdate', {
detail: this.detail,
files: this.files,
pid: this.pid,
id: this.id,
type: this.type,
operationDesc: this.operationDesc
}).then(res => {
if (res.code === 0) {
this.$http.post('/app/apppreventionreturntopovertylog/addOrUpdate', this.form).then(res => {
if (res.code == 0) {
this.$u.toast('提交成功')
uni.$emit('reload')
setTimeout(() => {
@@ -95,7 +117,6 @@ export default {
delta: 1
})
}, 300)
}
})
}
@@ -184,7 +205,7 @@ export default {
background: #3192F4;
}
.hint{
.hint {
text-align: right;
color: #999;
}