|
@@ -1,5 +1,10 @@
|
|
|
<template>
|
|
|
<view class="container">
|
|
|
+ <uni-card v-if="formData && formData.status == 1">
|
|
|
+ <uni-section title="驳回原因" type="line">
|
|
|
+ <text class="msg">{{ formData.rejectReason }}</text>
|
|
|
+ </uni-section>
|
|
|
+ </uni-card>
|
|
|
<uni-forms ref="baseForm" :modelValue="formData" :rules="rules" :label-width="80">
|
|
|
<uni-forms-item v-for="item in fileds" :label="item.title" :name="item.name" :key="item.name" required>
|
|
|
<uni-easyinput v-if="!item.formatter && !item.type" type="text" v-model="formData[item.name]" :placeholder="`请输入${item.title}`" />
|
|
@@ -8,10 +13,12 @@
|
|
|
<view class="upVideo" v-if="item.type == 'video' && !formData[item.name]" @click="upVideo">
|
|
|
<uni-icons color="#cacaca" class="videoIcon" type="videocam" size="30"></uni-icons>
|
|
|
</view>
|
|
|
+ <uni-data-select v-model="formData[item.name]" v-if="item.type == 'picker'" :localdata="item.dict" placeholder="请选择社区"></uni-data-select>
|
|
|
+
|
|
|
<video controls v-if="item.type == 'video' && formData[item.name]" class="uploadVideo" :src="filesUrl + formData[item.name]"></video>
|
|
|
</uni-forms-item>
|
|
|
</uni-forms>
|
|
|
- <button :disabled="btnText == '已报到'" class="btn" type="primary" @click="submitForm">{{ btnText }}</button>
|
|
|
+ <button :disabled="formData.status == 0 || formData.status == 2" class="btn" type="primary" @click="submitForm">{{ btnText }}</button>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -21,6 +28,11 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ pickerList: [],
|
|
|
+ pickerValue: '',
|
|
|
+ pickerName: '',
|
|
|
+ indicatorStyle: `height: 50px`,
|
|
|
+ visible: false,
|
|
|
btnText: '提交',
|
|
|
baseUrl: BASE_URL.url,
|
|
|
filesUrl: BASE_URL.fileUrl,
|
|
@@ -30,11 +42,11 @@
|
|
|
{ name: 'sex', title: '性别', formatter: 'dict:user_sex_type', type: 'checkbox' },
|
|
|
{ name: 'phone', title: '联系电话' },
|
|
|
{ name: 'workUnit', title: '工作单位' },
|
|
|
+ { name: 'deptId', title: '报到社区', type: 'picker' },
|
|
|
{ name: 'reportLocation', title: '报到位置' },
|
|
|
{ name: 'reportType', title: '报到类别', formatter: 'dict:baodao_type', type: 'select' },
|
|
|
{ name: 'residence', title: '居住地' },
|
|
|
{ name: 'content', title: '报到内容' },
|
|
|
- // { name: 'videoPath', title: '影片', type: 'video' },
|
|
|
],
|
|
|
rules: {
|
|
|
name: {
|
|
@@ -61,6 +73,9 @@
|
|
|
content: {
|
|
|
rules:[{ required: true, errorMessage: '请填写报到内容' }]
|
|
|
},
|
|
|
+ deptId: {
|
|
|
+ rules:[{ required: true, errorMessage: '请选择报到社区' }]
|
|
|
+ },
|
|
|
// videoPath: {
|
|
|
// rules:[{ required: true, errorMessage: '请上传影片' }]
|
|
|
// }
|
|
@@ -68,17 +83,31 @@
|
|
|
}
|
|
|
},
|
|
|
async mounted() {
|
|
|
+ const getCommunity = await request.getCommunity();
|
|
|
+ this.pickerList = getCommunity.rows;
|
|
|
const res = await request.getDyStatus();
|
|
|
if (res.data) {
|
|
|
this.formData = { ...res.data, sex: String(res.data.sex), reportType: String(res.data.reportType) };;
|
|
|
- this.btnText = '已报到';
|
|
|
+ if (res.data.status == 0) this.btnText = '审核中';
|
|
|
+ // if (res.data.status == 1) this.btnText = '已驳回';
|
|
|
+ if (res.data.status == 2) this.btnText = '已报到';
|
|
|
}
|
|
|
await this.setDict();
|
|
|
},
|
|
|
onShow() {},
|
|
|
methods: {
|
|
|
+ // 社区选择改变
|
|
|
+ bindChange(e) {
|
|
|
+ console.log(e, '社区选择改变')
|
|
|
+ },
|
|
|
+ // 选择社区
|
|
|
+ pickerClick() {
|
|
|
+ console.log('选择社区')
|
|
|
+ this.visible = true;
|
|
|
+ },
|
|
|
async setDict() {
|
|
|
this.fileds = await Promise.all(this.fileds.map(async e => {
|
|
|
+ if (e.name == 'deptId') e.dict = this.pickerList.map(e => ({ ...e, text: e.deptName, value: e.deptId }));
|
|
|
if (e.formatter && e.formatter.includes('dict')) {
|
|
|
const dictType = e.formatter.split(':')[1];
|
|
|
const res = await request.getDict(dictType);
|
|
@@ -125,7 +154,12 @@
|
|
|
},
|
|
|
submitForm() {
|
|
|
this.$refs.baseForm.validate().then(async valid=>{
|
|
|
- const res = await request.submitdy(this.formData);
|
|
|
+ let res;
|
|
|
+ if (this.formData.dangyuanId) {
|
|
|
+ res = await request.updatedy(this.formData);
|
|
|
+ } else {
|
|
|
+ res = await request.submitdy(this.formData);
|
|
|
+ }
|
|
|
if (res.code == 200) {
|
|
|
uni.showToast({
|
|
|
title: '提交成功',
|
|
@@ -170,4 +204,13 @@
|
|
|
width: 100px;
|
|
|
height: 100px;
|
|
|
}
|
|
|
+ .pickerItem {
|
|
|
+ text-indent: 0.5em;
|
|
|
+ border: 1px solid #e8e8e8;
|
|
|
+ line-height: 2.5em;
|
|
|
+ }
|
|
|
+ .msg {
|
|
|
+ color: red;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
</style>
|