配置跳转

This commit is contained in:
花有清香月有阴
2021-12-13 10:28:46 +08:00
parent 629ee68fc9
commit 93ce6a3415
4 changed files with 36 additions and 168 deletions

265
src/apps/AppWalkask/add.vue Normal file
View File

@@ -0,0 +1,265 @@
<template>
<div class="add">
<div v-if="addList">
<u-navbar title="新建走访" back-icon-color="#fff" title-color="#fff" title-width="300" title-size="36" :background="backgroundNavbar"> </u-navbar>
<div class="header-description">
<u-form :model="forms" ref="uForm" label-width="auto">
<u-form-item label="区域选择" prop="areaId" style="position: relative">
<ai-area-picker v-model="forms.areaId" ref="areaIds" :areaId="areaIdProps" @select="areaSelect" style="color: #333"> </ai-area-picker>
</u-form-item>
<u-form-item label="走访对象" prop="application" required style="position: relative">
<u-input v-model="forms.application" disabled placeholder="请选择走访对象" @click="handerSelecUser" />
<!-- @click="showObject = true" @click="toWalkObject" -->
<u-select v-model="showObject" :list="Objectlist" @confirm="applicaStatus"></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="reality" style="position: relative">
<u-input v-model="forms.reality" disabled placeholder="请选择走访对象" @click="showStstus = true" />
<!-- :disabled="!forms.object" -->
<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="title" required label-position="top">
<u-input v-model="forms.title" placeholder="请输入入户走访事项(30字以内)" type="textarea" auto-height height="60" maxlength="30" />
<div>{{ forms.title.length }}/30</div>
</u-form-item>
<u-form-item label="入户走访内容" prop="description" label-position="top">
<u-input v-model="forms.description" placeholder="请输入入户走访事项(500字以内)" type="textarea" auto-height height="60" maxlength="500" />
<div>{{ forms.description.length }}/500</div>
</u-form-item>
<u-form-item label="图片(最多9张)" prop="images" class="avatars" required label-position="top">
<ai-uploader :def.sync="forms.images" multiple @list="change" placeholder="上传图片" :limit="9"></ai-uploader>
</u-form-item>
</u-form>
</div>
<div class="btn" @click="submit">保存</div>
<AiBack></AiBack>
</div>
<component v-else :is="comp" :params="params"></component>
</div>
</template>
<script>
import { mapState } from 'vuex'
import { mapActions } from 'vuex'
import AiUploader from '../../components/AiUploader.vue'
import AiBack from '../../components/AiBack.vue'
import AiAreaPicker from '../../components/AiAreaPicker'
export default {
name: 'add',
components: { AiUploader, AiBack, walkObject, AiAreaPicker },
props: {},
data() {
return {
backgroundNavbar: {
backgroundColor: '#3975C6',
},
forms: {
areaId: '',
application: '',
reality: '',
realityValue: '',
title: '',
description: '',
images: [],
},
showAreaId: false,
Objectlist: [
{
value: '0',
label: '武汉',
},
],
showObject: false,
showStstus: false,
flag: false,
addList: true,
areaIdProps: '',
clickedUserSelect: false,
}
},
computed: { ...mapState(['user']) },
created() {
this.areaIdProps = this.user.areaId
this.$dict.load('realityStatus').then(() => {})
},
mounted() {},
methods: {
...mapActions(['selectEnterpriseContact']),
handerSelecUser() {
console.log(this.clickedUserSelect)
if (this.clickedUserSelect) return this.$u.toast('正在打开人员选择器')
this.clickedUserSelect = true
this.selectEnterpriseContact({
fromDepartmentId: 0,
type: ['user'],
optionId: this.forms.application?.map((e) => e.id),
})
.then((res) => {
// this.change(res?.userList || [])
this.clickedUserSelect = false
})
.catch(() => {
this.clickedUserSelect = false
})
},
submit() {
console.log(1)
if (this.flag) return
this.$refs.uForm.validate((valid) => {
if (valid) {
if (!this.forms.application) {
return this.$u.toast('请选择走访对象')
}
if (!this.forms.title) {
return this.$u.toast('请输入入户走访事项')
}
console.log(2)
const imgs = []
if (this.forms.images) {
this.forms.images.map((e) => {
console.log(e)
imgs.push({ url: e.url, id: e.id })
})
}
console.log(3)
this.flag = true
this.$instance
.post(`/appjobresume/addOrUpdate`, {
areaId: this.forms.areaId,
applicationId: '',
// object: this.forms.object,
reality: this.forms.reality == Number ? this.forms.reality : this.forms.realitylabel,
title: this.forms.title,
description: this.forms.description,
images: imgs || [],
// education: this.form.education == Number ? this.form.education : this.forms.educationValue,
id: '',
})
.then((res) => {
console.log(4)
if (res.code == 0) {
console.log(5)
this.$u.toast('保存成功')
this.flag = false
uni.navigateBack({})
console.log(6)
}
})
} else {
this.$u.toast('保存失败')
}
})
},
areaSelect(e) {
if (e.type == 5) {
this.forms.areaId = e.id
} else {
return this.$u.toast('请选择到村')
}
},
applicaStatus(e) {
console.log(e)
this.forms.object = e[0].value
this.forms.objectlabel = e[0].label
},
realityStstus(e) {
console.log(e)
this.forms.reality = e[0].label
this.forms.realityValue = e[0].value
},
toWalkObject() {
this.addList = false
this.comp = 'walkObject'
this.params = 111
},
change(e) {
console.log(e)
},
},
}
</script>
<style lang="scss" scoped>
.add {
height: 100%;
padding-bottom: 112px;
.header-description {
::v-deep .u-form {
.u-form-item {
margin-bottom: 16px;
// padding-bottom: 10px !important;
.u-form-item__body {
// .u-form-item--right {
// .u-form-item--right__content {
.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 {
// .u-form-item--right {
// .u-form-item--right__content {
// .u-form-item--right__content__slot {
// .ai-uploader {
// .fileList {
.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>