|
|
@@ -15,12 +15,12 @@
|
|
|
:prop="prop"
|
|
|
v-model="visitType"
|
|
|
:data-list="typeList"
|
|
|
+ @change="changeType"
|
|
|
required>
|
|
|
</select-cell>
|
|
|
<van-field
|
|
|
- v-if="visitType != 3"
|
|
|
label="介绍信编号"
|
|
|
- required
|
|
|
+ :required="visitType == 2"
|
|
|
v-model="formData.letterNo"
|
|
|
placeholder="请输入"
|
|
|
:maxlength="20"/>
|
|
|
@@ -34,34 +34,38 @@
|
|
|
placeholder="请输入"
|
|
|
:maxlength="200"/>
|
|
|
<date-cell
|
|
|
- v-if="visitType != 3"
|
|
|
- required
|
|
|
- v-model="formData.date"
|
|
|
+ v-if="visitType=='2'"
|
|
|
+ is-row
|
|
|
+ :required="visitType == 2"
|
|
|
+ v-model="formData.startTime"
|
|
|
title="开具日期">
|
|
|
</date-cell>
|
|
|
- <select-cell
|
|
|
- required
|
|
|
- v-if="visitType != 3"
|
|
|
- title="有效天数"
|
|
|
+ <van-cell
|
|
|
+ v-else
|
|
|
is-row
|
|
|
- :label="formData.date"
|
|
|
- is-link
|
|
|
- @click="showCalendar">
|
|
|
- </select-cell>
|
|
|
+ v-model="formData.startTime"
|
|
|
+ title="开具日期">
|
|
|
+ </van-cell>
|
|
|
<van-cell
|
|
|
- required
|
|
|
- v-if="visitType != 2"
|
|
|
- title="出入期限"
|
|
|
- :label="formData.date"
|
|
|
- is-link
|
|
|
- @click="showCalendar">
|
|
|
+ title="有效天数"
|
|
|
+ :required="visitType == 2">
|
|
|
+ <van-stepper :disabled="visitType == 3" integer :min="1" :max="356" v-model="formData.effectiveDays" step="1" />
|
|
|
</van-cell>
|
|
|
- <div class="upload-box" v-if="visitType != 3" >
|
|
|
- <span><i>*</i> 上传介绍信</span>
|
|
|
- <uploader :maxCount="1" v-model="formData.letterFile"/>
|
|
|
+<!-- <select-cell-->
|
|
|
+<!-- :required="visitType == 2"-->
|
|
|
+<!-- title="有效天数"-->
|
|
|
+<!-- is-row-->
|
|
|
+<!-- :label="formData.effectiveDays"-->
|
|
|
+<!-- is-link-->
|
|
|
+<!-- @click="showCalendar">-->
|
|
|
+<!-- </select-cell>-->
|
|
|
+ <div class="upload-box">
|
|
|
+ <span :class="{'required':visitType == 2}">上传介绍信</span>
|
|
|
+ <van-cell>
|
|
|
+ <uploader :maxCount="1" v-model="formData.letterFile"/>
|
|
|
+ </van-cell>
|
|
|
</div>
|
|
|
<van-field
|
|
|
- v-if="visitType != 3"
|
|
|
v-model="formData.description"
|
|
|
rows="1"
|
|
|
autosize
|
|
|
@@ -69,15 +73,15 @@
|
|
|
label="备注信息"
|
|
|
type="textarea"
|
|
|
placeholder="请输入"/>
|
|
|
+ <van-cell required title="添加人员">
|
|
|
+ <template #right-icon>
|
|
|
+ <div class="flex-box">
|
|
|
+ <span style="color: #aaa;"></span>
|
|
|
+ <van-switch size="20px" v-model="checked" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
</div>
|
|
|
- <van-cell required title="添加人员">
|
|
|
- <template #right-icon>
|
|
|
- <div class="flex-box">
|
|
|
- <span style="color: #aaa;"></span>
|
|
|
- <van-switch size="20px" v-model="checked" />
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </van-cell>
|
|
|
</van-panel>
|
|
|
</div>
|
|
|
|
|
|
@@ -89,9 +93,10 @@
|
|
|
<img :src="imgUrl(v.imgFile[0].imgPath)" alt="">
|
|
|
</div>
|
|
|
<div class="card-cell-box">
|
|
|
- <van-cell title="出入人员" :value="v.userName"></van-cell>
|
|
|
- <van-cell title="身份证" :value="v.idCard"></van-cell>
|
|
|
- <van-cell title="单位" :value="v.companyName"></van-cell>
|
|
|
+ <van-cell title="来访单位" :value="v.companyName"></van-cell>
|
|
|
+ <van-cell title="来访人员" :value="v.userName"></van-cell>
|
|
|
+ <van-cell title="证件类型" :value="getDictLabel(v.idType,'letter_id_type')"></van-cell>
|
|
|
+ <van-cell title="证件号码" :value="v.idCard"></van-cell>
|
|
|
</div>
|
|
|
</div>
|
|
|
<template #left>
|
|
|
@@ -107,7 +112,7 @@
|
|
|
<div class="card" v-show="checked">
|
|
|
<van-cell title="人员信息">
|
|
|
<template #right-icon>
|
|
|
- <van-button type="primary" v-if="isAdd" icon="plus" size="mini" @click="onAdd">添加</van-button>
|
|
|
+ <van-button type="info" v-if="isAdd" icon="plus" size="mini" @click="onAdd">添加</van-button>
|
|
|
<van-button type="info" v-else icon="edit" size="mini" @click="onEdit">确认</van-button>
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
@@ -115,27 +120,27 @@
|
|
|
<van-form validate-first @failed="onFailed">
|
|
|
<van-field
|
|
|
required
|
|
|
- v-model="personnel.userName"
|
|
|
+ v-model="personnel.companyName"
|
|
|
rows="1"
|
|
|
autosize
|
|
|
:maxlength="20"
|
|
|
- label="出入人员"
|
|
|
+ label="来访单位"
|
|
|
:rules="[{ pattern:/^(.+)$/, message: '请输入' }]"
|
|
|
placeholder="请输入"/>
|
|
|
<van-field
|
|
|
required
|
|
|
- v-model="personnel.idCard"
|
|
|
+ v-model="personnel.userName"
|
|
|
rows="1"
|
|
|
autosize
|
|
|
:maxlength="20"
|
|
|
- label="证件号码"
|
|
|
+ label="出入人员"
|
|
|
+ :rules="[{ pattern:/^(.+)$/, message: '请输入' }]"
|
|
|
placeholder="请输入"/>
|
|
|
<select-cell
|
|
|
title="证件类型"
|
|
|
- :prop="prop"
|
|
|
is-row
|
|
|
- v-model="visitType"
|
|
|
- :data-list="typeList"
|
|
|
+ v-model="personnel.idType"
|
|
|
+ :data-list="getDictItem('letter_id_type')"
|
|
|
required>
|
|
|
</select-cell>
|
|
|
<van-field
|
|
|
@@ -148,8 +153,10 @@
|
|
|
placeholder="请输入"/>
|
|
|
</van-form>
|
|
|
<div class="upload-box" >
|
|
|
- <span><i>*</i> 上传证件照</span>
|
|
|
- <uploader :maxCount="2" v-model="personnel.imgFile"/>
|
|
|
+ <span class="required">上传证件照</span>
|
|
|
+ <van-cell>
|
|
|
+ <uploader :maxCount="2" v-model="personnel.imgFile"/>
|
|
|
+ </van-cell>
|
|
|
</div>
|
|
|
<p class="tip-text" >注:证件号码将作为唯一识别码</p>
|
|
|
</div>
|
|
|
@@ -186,6 +193,7 @@ import {mapGetters} from "vuex";
|
|
|
import {imgUrl} from "@/utils";
|
|
|
import { ImagePreview } from 'vant'
|
|
|
import {visitAdd} from './api'
|
|
|
+import dayjs from "dayjs";
|
|
|
export default {
|
|
|
components: {SelectCell,Uploader,DateCell,CalendarPicker,OrgPicker},
|
|
|
data(){
|
|
|
@@ -199,13 +207,14 @@ export default {
|
|
|
letterNo:null,
|
|
|
letterFile:null,
|
|
|
description:null,
|
|
|
- range:null,
|
|
|
- date:null,
|
|
|
+ startTime:null,
|
|
|
+ effectiveDays:null,
|
|
|
},
|
|
|
personnel:{
|
|
|
+ companyName:null,
|
|
|
userName:null,
|
|
|
idCard:null,
|
|
|
- companyName:null,
|
|
|
+ idType:null,
|
|
|
imgFile:[],
|
|
|
},
|
|
|
pList:[],
|
|
|
@@ -226,13 +235,18 @@ export default {
|
|
|
value:3
|
|
|
}
|
|
|
],
|
|
|
+ dicts:['letter_id_type']
|
|
|
}
|
|
|
},
|
|
|
computed:{
|
|
|
- ...mapGetters(['orgId','id'])
|
|
|
+ ...mapGetters(['orgId','id','dictionary'])
|
|
|
},
|
|
|
methods:{
|
|
|
imgUrl,formatDate,
|
|
|
+ changeType(){
|
|
|
+ this.formData.startTime = dayjs(new Date()).format('YYYY-MM-DD');
|
|
|
+ this.formData.effectiveDays = 1;
|
|
|
+ },
|
|
|
onSubmit(){
|
|
|
// if(this.visitType == '1'){
|
|
|
// if(!this.formData.receptionOrgIds){
|
|
|
@@ -249,28 +263,45 @@ export default {
|
|
|
// }
|
|
|
// }
|
|
|
try{
|
|
|
- if(this.visitType == '2'){
|
|
|
- if(!this.formData.letterNo){
|
|
|
+ if (!this.visitType) {
|
|
|
+ this.$toast('请选择介绍信类型');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(this.visitType == '2') {
|
|
|
+ if (!this.formData.letterNo) {
|
|
|
this.$toast('请输入介绍信编号');
|
|
|
return;
|
|
|
}
|
|
|
- if(!this.formData.letterFile){
|
|
|
+ if (!this.formData.reasons) {
|
|
|
+ this.$toast('请输入来访事由');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.formData.startTime) {
|
|
|
+ this.$toast('请选择开具日期');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.formData.startTime) {
|
|
|
+ this.$toast('请选择有效天数');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.formData.letterFile) {
|
|
|
this.$toast('请上传介绍信');
|
|
|
return;
|
|
|
}
|
|
|
+ if (this.pList.length == 0) {
|
|
|
+ this.$toast('请添加人员信息');
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- if(!this.formData.reasons){
|
|
|
- this.$toast('请输入出入事由');
|
|
|
- return;
|
|
|
- }
|
|
|
- if(!this.formData.range){
|
|
|
- this.$toast('请选择有效期');
|
|
|
- return;
|
|
|
- }
|
|
|
- if(this.pList.length == 0){
|
|
|
- this.$toast('请添加人员信息');
|
|
|
- return;
|
|
|
+ if(this.visitType == '3') {
|
|
|
+ if (!this.formData.reasons) {
|
|
|
+ this.$toast('请输入来访事由');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.pList.length == 0) {
|
|
|
+ this.$toast('请添加人员信息');
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
this.formData.status = 1;
|
|
|
this.formData.type = this.visitType;
|
|
|
@@ -324,7 +355,7 @@ export default {
|
|
|
this.pList.splice(i,1);
|
|
|
},
|
|
|
onEdit(){
|
|
|
- if(!this.personnel.userName || !this.personnel.idCard || !this.personnel.companyName || !this.personnel.imgFile){
|
|
|
+ if(!this.personnel.companyName || !this.personnel.userName || !this.personnel.idType || !this.personnel.idCard || !this.personnel.imgFile){
|
|
|
this.$toast('请完善人员信息');
|
|
|
return;
|
|
|
}
|
|
|
@@ -332,9 +363,10 @@ export default {
|
|
|
let index = this.pList.findIndex(v=>{return v.uuid === strObj.uuid});
|
|
|
this.pList.splice(index,1,strObj);
|
|
|
this.personnel = {
|
|
|
+ companyName:null,
|
|
|
userName:null,
|
|
|
+ idType:null,
|
|
|
idCard:null,
|
|
|
- companyName:null,
|
|
|
imgFile:[],
|
|
|
};
|
|
|
this.isAdd = true;
|
|
|
@@ -357,7 +389,7 @@ export default {
|
|
|
// this.personnel.idCard = '123456789012345678'
|
|
|
// this.personnel.companyName = '测试单位';
|
|
|
// }
|
|
|
- if(!this.personnel.userName || !this.personnel.idCard || !this.personnel.companyName || !this.personnel.imgFile){
|
|
|
+ if(!this.personnel.companyName || !this.personnel.userName || !this.personnel.idType || !this.personnel.idCard || !this.personnel.imgFile){
|
|
|
this.$toast('请完善人员信息');
|
|
|
return;
|
|
|
}
|
|
|
@@ -371,9 +403,10 @@ export default {
|
|
|
strObj.uuid = `${new Date().getTime()}`;
|
|
|
this.pList.push(strObj);
|
|
|
this.personnel = {
|
|
|
+ companyName:null,
|
|
|
userName:null,
|
|
|
+ idType:null,
|
|
|
idCard:null,
|
|
|
- companyName:null,
|
|
|
imgFile:[],
|
|
|
};
|
|
|
},
|
|
|
@@ -409,7 +442,7 @@ export default {
|
|
|
.card-cell-box{
|
|
|
width: 70%;
|
|
|
.van-cell{
|
|
|
- padding: 10px;
|
|
|
+ padding: 4px;
|
|
|
&::after{
|
|
|
left:10px;
|
|
|
right:10px;
|
|
|
@@ -470,7 +503,7 @@ export default {
|
|
|
align-items: center;
|
|
|
}
|
|
|
.upload-box{
|
|
|
- padding: 20px 30px;
|
|
|
+ padding: 0 30px;
|
|
|
display: flex;
|
|
|
>span{
|
|
|
display: inline-block;
|
|
|
@@ -479,10 +512,7 @@ export default {
|
|
|
line-height: 160px;
|
|
|
font-size: 28px;
|
|
|
color:#999;
|
|
|
- >i{
|
|
|
- font-style: normal;
|
|
|
- color: #ee0a24;
|
|
|
- }
|
|
|
+ position: relative;
|
|
|
}
|
|
|
}
|
|
|
.goods-card{
|