|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<!-- 上传 -->
|
|
|
- <el-dialog title="新增" :visible.sync="dialogVisible" width="50%">
|
|
|
+ <el-dialog :title="title" :visible.sync="dialogVisible" width="60%">
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="82px">
|
|
|
<el-row :gutter="15">
|
|
|
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
|
|
@@ -8,12 +8,13 @@
|
|
|
<el-input
|
|
|
placeholder="请输入"
|
|
|
v-model="form.code"
|
|
|
+ disabled
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
|
|
- <el-form-item prop="typeValue" label="证件类型">
|
|
|
- <DictSelection v-model="form.typeValue" dictName="证件类型"></DictSelection>
|
|
|
+ <el-form-item prop="type" label="证件类型">
|
|
|
+ <DictSelection v-model="form.type" dictName="证件类型"></DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
|
|
@@ -22,20 +23,20 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
|
|
- <el-form-item prop="owner" label="持证人">
|
|
|
+ <el-form-item prop="holder" label="持证人">
|
|
|
<el-input
|
|
|
placeholder="请输入"
|
|
|
- v-model="form.owner"
|
|
|
+ v-model="form.holder"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
|
|
- <el-form-item prop="salary" label="颁发时间">
|
|
|
+ <el-form-item label="颁发时间">
|
|
|
<el-date-picker
|
|
|
style="width:100%"
|
|
|
- v-model="form.awardTime"
|
|
|
+ v-model="form.enactorTime"
|
|
|
type="date"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
placeholder="选择日期"
|
|
|
>
|
|
|
</el-date-picker>
|
|
|
@@ -57,11 +58,12 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col v-bind="styleResponsive ? { sm: 24 } : { span: 24 }">
|
|
|
- <el-form-item prop="image" label="证照图片">
|
|
|
+ <el-form-item prop="imageObj" label="证照图片">
|
|
|
<fileUpload
|
|
|
- v-model="form.image"
|
|
|
+ v-model="form.imageObj"
|
|
|
module="main"
|
|
|
:showLib="true"
|
|
|
+ :limit='1'
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -86,9 +88,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- // import { uploadBatch } from '@/api/system/file/index.js';
|
|
|
+ import { saveOrEdit , getPhotoInfo } from '@/api/documentManagement';
|
|
|
import fileUpload from '@/components/upload/fileUpload';
|
|
|
import imgUpload from '@/components/upload/imgUpload';
|
|
|
+ import { getCode } from '@/api/ruleManagement/matter'
|
|
|
export default {
|
|
|
components: {
|
|
|
fileUpload,
|
|
|
@@ -96,17 +99,23 @@
|
|
|
},
|
|
|
//注册组件
|
|
|
data () {
|
|
|
+ const defaultForm = {
|
|
|
+ code:'',
|
|
|
+ date:[],
|
|
|
+ imageObj:[]
|
|
|
+ };
|
|
|
return {
|
|
|
dialogVisible: false,
|
|
|
rules: {
|
|
|
code: [{ required: true, trigger: 'blur', message: '请输入证照编号' }],
|
|
|
- typeValue: [{ required: true, trigger: 'change' , message: '请选择证件类型'}],
|
|
|
+ type: [{ required: true, trigger: 'change' , message: '请选择证件类型'}],
|
|
|
date: [{ required: true, trigger: 'change', message: '请选择有效期' }],
|
|
|
- owner: [{ required: true, trigger: 'blur', message: '请输入持证人' }],
|
|
|
+ holder: [{ required: true, trigger: 'blur', message: '请输入持证人' }],
|
|
|
status: [{ required: true, trigger: 'change', message: '请选择状态' }],
|
|
|
- image: [{ required: true, trigger: 'change' , message: '请选择证照图片'}]
|
|
|
+ imageObj: [{ required: true, trigger: 'change' , message: '请选择证照图片'}]
|
|
|
},
|
|
|
- form: { },
|
|
|
+ form: {...defaultForm },
|
|
|
+ title:"新增"
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -117,27 +126,57 @@
|
|
|
},
|
|
|
created () {},
|
|
|
methods: {
|
|
|
- open () {
|
|
|
+ open (row) {
|
|
|
this.$refs.form && this.$refs.form.clearValidate();
|
|
|
- this.form = { };
|
|
|
this.dialogVisible = true;
|
|
|
+ if(row){
|
|
|
+ this.title = '修改'
|
|
|
+ this.getInfo(row.id)
|
|
|
+ }else{
|
|
|
+ this.title = '新增'
|
|
|
+ this.form = {...this.defaultForm};
|
|
|
+ this.getOrderCode()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getOrderCode () {
|
|
|
+ const data = await getCode('license_code');
|
|
|
+ this.$set(this.form, 'code', data);
|
|
|
+ },
|
|
|
+
|
|
|
+ async getInfo(id){
|
|
|
+ const data = await getPhotoInfo(id)
|
|
|
+ this.form = {
|
|
|
+ ...data,
|
|
|
+ date:[data.validityStartTime,data.validityEndTime]
|
|
|
+ }
|
|
|
+ this.$set(this.form,'imageObj',[data.fileObj])
|
|
|
},
|
|
|
+
|
|
|
submit(){
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (!valid) {
|
|
|
return false;
|
|
|
}
|
|
|
this.loading = true;
|
|
|
+ if(this.form.date?.length){
|
|
|
+ this.form.validityStartTime = this.form.date[0];
|
|
|
+ this.form.validityEndTime = this.form.date[1];
|
|
|
+ }
|
|
|
+ if(this.form.imageObj.length){
|
|
|
+ this.form.fileObj = this.form.imageObj[0]
|
|
|
+ }
|
|
|
const data = {
|
|
|
...this.form,
|
|
|
- parentId: this.form.parentId || 0
|
|
|
+ fileId:this.form.fileObj.id
|
|
|
};
|
|
|
- saveOrUpdate(data)
|
|
|
+ delete data.date
|
|
|
+ delete data.imageObj
|
|
|
+ saveOrEdit(data)
|
|
|
.then((msg) => {
|
|
|
this.loading = false;
|
|
|
this.$message.success(msg);
|
|
|
- this.updateVisible(false);
|
|
|
- this.$emit('done');
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.$emit('success');
|
|
|
})
|
|
|
.catch((e) => {
|
|
|
this.loading = false;
|