证件领用申请

This commit is contained in:
zzyuan 2025-11-26 15:52:18 +08:00
parent 116daf6993
commit b4f8232a14
3 changed files with 387 additions and 290 deletions

View File

@ -291,7 +291,7 @@ export function getCertificateExamListPageApi(data) {
params:data
})
}
// 证件领用申请删除
// 证件领用审核-审核
export function checkCertificateApplyApi(data) {
return request({
url: '/certificate/certificate_check/certificateCheck/check',

View File

@ -43,14 +43,6 @@
size="mini"
@click="handleAdd"
>新增申请</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
size="mini"
@click="handleDelete"
>删除</el-button>
</el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -75,23 +67,33 @@
<el-table-column label="详细说明" align="center" width="120" prop="applyDetail" :show-overflow-tooltip="true"/>
<el-table-column label="计划出国时间" align="center" prop="startTime" :show-overflow-tooltip="true"/>
<el-table-column label="计划返回时间" align="center" prop="endTime" :show-overflow-tooltip="true"/>
<el-table-column label="附件" align="center" prop="" :show-overflow-tooltip="true"/>
<el-table-column label="申请状态" align="center" prop="" :show-overflow-tooltip="true">
<!-- <template slot-scope="scope">
<span v-if="scope.row.state==0" style="color: #FF7322;font-size: 15px;">{{scope.row.stateName}}</span>
<span v-if="scope.row.state==1" style="color: #FEE838;font-size: 15px;">{{scope.row.stateName}}</span>
<span v-if="scope.row.state==2" style="color: #03DF6D;font-size: 15px;">{{scope.row.stateName}}</span>
<span v-if="scope.row.state==3" style="color: #FEE838;font-size: 15px;">{{scope.row.stateName}}</span>
<span v-if="scope.row.state==4" style="color: #FF7322;font-size: 15px;">{{scope.row.stateName}}</span>
</template> -->
<el-table-column label="附件" align="center" prop="" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>查看</span>
</template>
</el-table-column>
<el-table-column label="申请状态" align="center" prop="applyState" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.applyState==-1" style="color: #FF7322;font-size: 15px;">待提交</span>
<span v-if="scope.row.applyState==0" style="color: #FF7322;font-size: 15px;">待审核</span>
<span v-if="scope.row.applyState==1" style="color: #FEE838;font-size: 15px;">审核中</span>
<span v-if="scope.row.applyState==2" style="color: #03DF6D;font-size: 15px;">已审核</span>
<span v-if="scope.row.applyState==3" style="color: #FEE838;font-size: 15px;">已退回</span>
<span v-if="scope.row.applyState==4" style="color: #FF7322;font-size: 15px;">已执行</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button v-if="scope.row.state==0||scope.row.state==4"
size="mini"
<el-button
size="mini" v-if="scope.row.applyState==0||scope.row.applyState==1"
type="text"
@click="handleUpdate(scope.row)"
>审批</el-button>
>审核</el-button>
<el-button
size="mini"
type="text"
@click="handleView(scope.row)"
>查看</el-button>
</template>
</el-table-column>
</el-table>
@ -105,22 +107,28 @@
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title+''" :visible.sync="open" width="800px" append-to-body>
<el-form ref="baseForm" :model="baseForm" :rules="baseFormRules" label-width="120px">
<el-dialog :title="title+''" :visible.sync="open" width="900px" append-to-body>
<el-form ref="baseForm" :model="baseForm" :rules="baseFormRules" label-width="120px" style="height: 650px;overflow-y: auto;">
<el-row>
<el-col :span="12">
<el-form-item label="姓名" prop="name">
<el-input v-model="baseForm.name" placeholder="请输入" maxlength="30" clearable/>
<el-form-item label="申请人" prop="name">
<el-input v-model="baseForm.name" placeholder="点击选择申请人" maxlength="30" readonly/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="baseForm.deptId !== 0">
<el-form-item label="单位" prop="deptId" style="width: 100%;">
<treeselect
v-model="baseForm.deptId"
:options="deptOptions"
:normalizer="normalizer"
placeholder="选择单位"
/>
<el-col :span="12">
<el-form-item label="岗位" prop="postId">
<el-select
v-model="baseForm.postId"
style="width: 100%;"
placeholder="请选择岗位"
>
<el-option
v-for="item in postOptions"
:key="item.postId+''"
:label="item.postName"
:value="item.postId+''"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
@ -128,16 +136,6 @@
<el-input v-model="baseForm.phone" placeholder="请输入" maxlength="30" clearable/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="身份证号" prop="idNumber">
<el-input v-model="baseForm.idNumber" placeholder="请输入" maxlength="30" clearable/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="证件编号" prop="certificateNo">
<el-input v-model="baseForm.certificateNo" :readonly="isReadOnly" placeholder="请输入" maxlength="30" clearable/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="证件类型" prop="certificateType">
<el-select v-model="baseForm.certificateType" placeholder="证件类型" clearable style="width: 100%;">
@ -151,8 +149,8 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="领用原因" prop="requestReason">
<el-select v-model="baseForm.requestReason" placeholder="请选择领用原因" clearable style="width: 100%;">
<el-form-item label="领用原因" prop="applyReason">
<el-select v-model="baseForm.applyReason" placeholder="请选择领用原因" clearable style="width: 100%;">
<el-option
v-for="dict in dict.type.issue_type"
:key="dict.value"
@ -163,20 +161,21 @@
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="详细说明" prop="remark">
<el-input v-model="baseForm.remark" type="textarea" placeholder="请输入内容"></el-input>
<el-form-item label="详细说明" prop="applyDetail">
<el-input v-model="baseForm.applyDetail" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="预计使用时间">
<el-form-item label="预计使用时间" prop="dateRange">
<el-date-picker
v-model="dateRange"
v-model="baseForm.dateRange"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd" style="width: 100%">
</el-date-picker>
</el-form-item>
@ -191,8 +190,11 @@
:action="upload.url"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:file-list="fileList"
:on-success="handleFileSuccess"
:auto-upload="false"
:on-remove="handleRemove"
:on-preview="handlePreviewDownloadFile"
:auto-upload="true"
drag
>
<i class="el-icon-upload"></i>
@ -200,10 +202,18 @@
</el-upload>
</el-form-item>
</el-col>
<el-col :span="24">
<div style="font-size: 18px;font-weight: 600;margin-bottom: 4px;">注意事项</div>
<div style="font-size: 16px;margin-bottom: 4px;">1.因公出国需提供单位出具的出差证明</div>
<div style="font-size: 16px;margin-bottom: 4px;">2.因私出国需提供相关证明材料如邀请函等</div>
<div style="font-size: 16px;margin-bottom: 4px;">3.证件领取后请妥善保管如有遗失需立即报告</div>
<div style="font-size: 16px;margin-bottom: 4px;">4.使用完毕后请及时归还证件</div>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button type="success" @click="submitForm(1)" v-if="!isView"> </el-button>
<el-button type="danger" @click="submitForm(2)" v-if="!isView"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -211,10 +221,8 @@
</template>
<script>
import {
listDept
} from '@/api/system/dept'
import { getCertificateExamListPageApi,addCertificateInfoApi,updateCertificateInfoApi,checkCertificateApplyApi } from "@/api/certificateManage/index";
import { getUser } from '@/api/system/user'
import { getCertificateExamListPageApi,checkCertificateApplyApi,getSysUserListApi,addCertificateCheckApi } from "@/api/certificateManage/index";
import base64 from 'base-64';
import { getToken } from '@/utils/auth'
import { downloadFileByUrl } from '@/utils/download'
@ -261,71 +269,54 @@
pageSize: 10,
idNumber:null,//
name:null,//
certificateNo:null,//
},
activeName:"baseSetting",
deviceData:{},
//
postOptions: [],
//
baseForm: {
deptId:null,
name:"",
idNumber:"",
birthday:"",
birthAddr:"",
certificateType:"",
certificateTypeName:"",
certificateNo:"",
issueAddr:"",
issueDay:"",
createTime:"",
userId:"",
postId:"",
phone:"",
userId:"",
isEle:""
},
baseForm2: {
userId:"",
phone:""
certificateType:"",
applyReason:"",
applyDetail:"",
startTime:"",
startTime:"",
endTime:"",
dateRange:[]
},
isView:false,
//
baseFormRules: {
deptId: [
{ required: true, message: "单位不能为空", trigger: "blur" }
],
phone: [
{ required: true, message: "手机号码不能为空", trigger: "blur" },
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
],
name: [
{ required: true, message: "姓名不能为空", trigger: "blur" }
{ required: true, message: "申请人不能为空", trigger: "change" }
],
idNumber: [
{ required: true, message: "身份证不能为空", trigger: "blur" },
{ validator: this.validateIDCard, trigger: 'blur' }
userId: [
{ required: true, message: "申请人不能为空", trigger: "change" }
],
phone: [
{ required: true, message: "手机号码不能为空", trigger: "blur" },
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
{ required: true, message: "手机号码不能为空", trigger: "change" },
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号', trigger: 'change' }
],
postId: [
{ required: true, message: "岗位不能为空", trigger: "change" },
],
certificateType: [
{ required: true, message: "证件类型不能为空", trigger: "blur" }
{ required: true, message: "证件类型不能为空", trigger: "change" }
],
requestReason: [
applyReason: [
{ required: true, message: "领用原因不能为空", trigger: "change" }
],
certificateNo: [
{ required: true, message: "证件编号不能为空", trigger: "blur" }
applyDetail: [
{ required: true, message: "详细说明不能为空", trigger: "blur" }
],
issueDay: [
{ required: true, message: "签发日期不能为空", trigger: "blur" }
dateRange: [
{ required: true, message: "预计使用时间不能为空", trigger: "change" }
],
},
dateRange:[],
logTableData:[],//
//
dialogTotal: 0,
//
openMenu:false,
//
upload: {
//
@ -333,42 +324,24 @@
//
headers: { Authorization: 'Bearer ' + getToken() },
//
url: process.env.VUE_APP_BASE_API + '/certificate/certificate_manage/certificateInfo/import',
},
//
openTask: false,
//
taskForm: {
processDate:""
},
//
taskRules: {
processDate: [
{
required: true,
message: '核验截止日期不能为空',
trigger: 'blur',
},
]
url: process.env.VUE_APP_BASE_API + '/file/upload?type=face',
},
fileList:[],
fileUrls:[],
fileNames:[]
};
},
mounted(){
this.getPostList();
this.getList();
},
methods: {
validateIDCard(rule, value, callback) {
// 15
const reg15 = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$/;
// 18
const reg18 = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}(\d|X|x)$/;
if (reg15.test(value) || reg18.test(value)) {
callback(); //
} else {
callback(new Error('请输入有效的身份证号')); //
}
getPostList(){
getUser().then((response) => {
this.postOptions = response.posts
})
},
/** 搜索按钮操作 */
handleQuery() {
@ -391,7 +364,6 @@
"certificateType":this.queryParams.certificateType,
// "certificateNo":this.queryParams.certificateNo
}
console.log("param",param)
getCertificateExamListPageApi(param).then(response => {
this.tableListData = response.rows;
this.total = Number(response.total);
@ -400,18 +372,20 @@
},
//
reset() {
this.fileList=[]
this.fileUrls=[]
this.fileNames = []
this.baseForm = {
deptId:null,
name:"",
idNumber:"",
birthday:"",
birthAddr:"",
userId:"",
postId:"",
phone:"",
certificateType:"",
certificateTypeName:"",
certificateNo:"",
issueAddr:"",
issueDay:"",
isEle:"0",isCreate:"0"
applyReason:"",
applyDetail:"",
startTime:"",
startTime:"",
endTime:"",
dateRange:[]
};
this.resetForm("baseForm");
},
@ -421,116 +395,149 @@
this.open = true;
this.isReadOnly=false;
this.title = "新增";
listDept().then((response) => {
this.deptOptions = this.handleTree(response.data, 'deptId')
})
console.log("this.baseForm",this.baseForm);
},
/** 电子标签*/
handleCheckedOne(value, type) {
console.log(type,value)
},
handleCheckedTwo(value, type) {
console.log(type,value)
},
/** 转换部门数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.deptId,
label: node.deptName,
children: node.children,
}
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.open = true;
this.isReadOnly=true;
this.isReadOnly=false;
this.baseForm = Object.assign({}, row)
listDept().then((response) => {
this.deptOptions = this.handleTree(response.data, 'deptId')
this.baseForm.dateRange = [row.startTime,row.endTime]
if(row.fileUrl&&row.fileUrl!=''){
let arr = row.fileUrl.split(",");
let arr2 = row.fileName.split(",");
arr.forEach((item,index)=>{
this.fileList.push({url:item,name:arr2[index]})
this.fileUrls.push(item)
this.fileNames.push(arr2[index])
})
}else{
this.fileList=[]
this.fileUrls=[]
this.fileNames = []
}
this.upload.isUploading = true
this.isView = false
this.title = "修改";
},
handleTabClick(tab, event) {
console.log(tab, event);
handleView(row) {
this.reset();
this.open = true;
this.isReadOnly=true;
this.baseForm = Object.assign({}, row)
getUser().then((response) => {
this.postOptions = response.posts
})
this.baseForm.dateRange = [row.startTime,row.endTime]
if(row.fileUrl&&row.fileUrl!=''){
let arr = row.fileUrl.split(",");
let arr2 = row.fileName.split(",");
arr.forEach((item,index)=>{
this.fileList.push({url:item,name:arr2[index]})
this.fileUrls.push(item)
this.fileNames.push(arr2[index])
})
}else{
this.fileList=[]
this.fileUrls=[]
this.fileNames = []
}
this.upload.isUploading = true
this.isView = true
this.title = "查看";
},
/** 提交按钮 */
submitForm: function() {
submitForm: function(type) {
//checkState 1 2 checkId
console.log("this.baseForm",this.baseForm);
this.$refs["baseForm"].validate(valid => {
if (valid) {
let param = {
checkId:this.baseForm.checkId,
checkState:type
}
checkCertificateApplyApi(this.baseForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
}
});
},
//
cancel() {
this.open = false;
this.reset();
},
handleSelect(){
},
/** 删除按钮操作 */
handleDelete(row) {
// var certificateNoRow="";
// if(row!=undefined &&row.certificateNo!=null&&row.certificateNo!=undefined){
// certificateNoRow=row.certificateNo.split(" ");
// }
// const certificateNos = certificateNoRow || this.certificateNos;
// console.log("certificateNos",certificateNos);
// this.$modal.confirm('').then(() => {
// deleteCertificateInfoApi({certificateNos:certificateNos}).then(response => {
// console.log("deleteCertificateInfoApi",response);
// this.getList();
// this.$modal.msgSuccess("");
// return;
// });
// }).catch(() => {});
},
formatDate(date) {
// YYYY-MM-DD
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 0
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true
},
//
handleFileSuccess(response, file, fileList) {
console.log(response)
this.upload.isUploading = false
this.$refs.upload.clearFiles()
this.upload.isUploading = false;
if(response.code==200){
this.fileUrls.push(response.data.url)
this.fileNames.push(response.data.name)
this.$modal.msgSuccess(response.msg);
this.getList();
}else{
this.$modal.msgError(response.msg);
}
},
handleRemove(file, fileList) {
let sum = 0
this.fileNames.forEach((item, index) => {
if (item == file.name) {
sum = index
}
})
this.fileUrls.splice(sum, 1)
this.fileNames.splice(sum, 1)
},
async handlePreviewDownloadFile(file) {
if (file.url != null && file.url !== '') {
let downloadUrl = file.url;
try {
const response = await fetch(downloadUrl); //
if (!response.ok) {
throw new Error('文件下载失败');
}
const blob = await response.blob(); // Blob
const link = document.createElement('a');
link.href = URL.createObjectURL(blob); // URL
link.download = file.name; //
document.body.appendChild(link); // DOM
link.click(); //
document.body.removeChild(link); // <a>
} catch (error) {
message.warning("文件下载失败!");
console.error(error);
}
}
if (file.raw != null && file.raw !== '') {
const blob = file.raw; // Blob
const link = document.createElement('a');
link.href = URL.createObjectURL(blob); // URL
link.download = file.name; //
document.body.appendChild(link); // DOM
link.click(); //
document.body.removeChild(link); // <a>
}
},
/** 批量删除 */
handleBatchDel(){
},
//
handleSelectionChange(selection) {
this.certificateNos = selection.map(item => item.certificateNo)
this.userIds=selection.map(item => item.userId)
//
this.single = selection.length !== 1
this.multiple = !selection.length
// this.certificateNos = selection.map(item => item.certificateNo)
// this.userIds=selection.map(item => item.userId)
// //
// this.single = selection.length !== 1
// this.multiple = !selection.length
},
formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 0
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
},
}
};

View File

@ -44,14 +44,14 @@
@click="handleAdd"
>新增申请</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button
type="danger"
plain
size="mini"
@click="handleDelete"
>删除</el-button>
</el-col>
</el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableListData" @selection-change="handleSelectionChange" height="800">
@ -75,26 +75,36 @@
<el-table-column label="详细说明" align="center" width="120" prop="applyDetail" :show-overflow-tooltip="true"/>
<el-table-column label="计划出国时间" align="center" prop="startTime" :show-overflow-tooltip="true"/>
<el-table-column label="计划返回时间" align="center" prop="endTime" :show-overflow-tooltip="true"/>
<el-table-column label="附件" align="center" prop="" :show-overflow-tooltip="true"/>
<el-table-column label="申请状态" align="center" prop="" :show-overflow-tooltip="true">
<!-- <template slot-scope="scope">
<span v-if="scope.row.state==0" style="color: #FF7322;font-size: 15px;">{{scope.row.stateName}}</span>
<span v-if="scope.row.state==1" style="color: #FEE838;font-size: 15px;">{{scope.row.stateName}}</span>
<span v-if="scope.row.state==2" style="color: #03DF6D;font-size: 15px;">{{scope.row.stateName}}</span>
<span v-if="scope.row.state==3" style="color: #FEE838;font-size: 15px;">{{scope.row.stateName}}</span>
<span v-if="scope.row.state==4" style="color: #FF7322;font-size: 15px;">{{scope.row.stateName}}</span>
</template> -->
<el-table-column label="附件" align="center" prop="" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>查看</span>
</template>
</el-table-column>
<el-table-column label="申请状态" align="center" prop="applyState" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.applyState==-1" style="color: #FF7322;font-size: 15px;">待提交</span>
<span v-if="scope.row.applyState==0" style="color: #FF7322;font-size: 15px;">待审核</span>
<span v-if="scope.row.applyState==1" style="color: #FEE838;font-size: 15px;">审核中</span>
<span v-if="scope.row.applyState==2" style="color: #03DF6D;font-size: 15px;">已审核</span>
<span v-if="scope.row.applyState==3" style="color: #FEE838;font-size: 15px;">已退回</span>
<span v-if="scope.row.applyState==4" style="color: #FF7322;font-size: 15px;">已执行</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button v-if="scope.row.state==0||scope.row.state==4"
size="mini"
<el-button
size="mini" v-if="scope.row.applyState==-1"
type="text"
@click="handleUpdate(scope.row)"
>编辑</el-button>
<el-button v-if="scope.row.state==0||scope.row.state==4"
<el-button
size="mini"
type="text"
@click="handleView(scope.row)"
>查看</el-button>
<el-button
size="mini" v-if="scope.row.applyState==-1"
type="text"
style="color: red;"
@click="handleDelete(scope.row)"
>删除</el-button>
@ -112,7 +122,7 @@
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title+''" :visible.sync="open" width="900px" append-to-body>
<el-form ref="baseForm" :model="baseForm" :rules="baseFormRules" label-width="120px">
<el-form ref="baseForm" :model="baseForm" :rules="baseFormRules" label-width="120px" style="height: 650px;overflow-y: auto;">
<el-row>
<el-col :span="12">
<el-form-item label="申请人" prop="name">
@ -138,9 +148,9 @@
>
<el-option
v-for="item in postOptions"
:key="item.postId"
:key="item.postId+''"
:label="item.postName"
:value="item.postId"
:value="item.postId+''"
></el-option>
</el-select>
</el-form-item>
@ -196,6 +206,7 @@
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd" style="width: 100%">
</el-date-picker>
</el-form-item>
@ -212,7 +223,8 @@
:on-progress="handleFileUploadProgress"
:file-list="fileList"
:on-success="handleFileSuccess"
:on-change="handleChange"
:on-remove="handleRemove"
:on-preview="handlePreviewDownloadFile"
:auto-upload="true"
drag
>
@ -231,8 +243,8 @@
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="success" @click="submitForm(-1)"> </el-button>
<el-button type="primary" @click="submitForm(0)"> </el-button>
<el-button type="success" @click="submitForm(-1)" v-if="!isView"> </el-button>
<el-button type="primary" @click="submitForm(0)" v-if="!isView"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -344,6 +356,7 @@
endTime:"",
dateRange:[]
},
isView:false,
baseForm2: {
userId:"",
phone:""
@ -387,15 +400,21 @@
url: process.env.VUE_APP_BASE_API + '/file/upload?type=face',
},
fileList:[],
fileUrls:[]
fileUrls:[],
fileNames:[]
};
},
mounted(){
this.getPostList();
this.getList();
},
methods: {
getPostList(){
getUser().then((response) => {
this.postOptions = response.posts
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -425,6 +444,9 @@
},
//
reset() {
this.fileList=[]
this.fileUrls=[]
this.fileNames = []
this.baseForm = {
userId:"",
postId:"",
@ -442,16 +464,35 @@
/** 新增按钮操作 */
handleAdd() {
this.reset();
getUser().then((response) => {
this.postOptions = response.posts
this.open = true;
this.isReadOnly=false;
this.title = "新增";
})
console.log("this.baseForm",this.baseForm);
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.open = true;
this.isReadOnly=true;
this.baseForm = Object.assign({}, row)
this.baseForm.dateRange = [row.startTime,row.endTime]
if(row.fileUrl&&row.fileUrl!=''){
let arr = row.fileUrl.split(",");
let arr2 = row.fileName.split(",");
arr.forEach((item,index)=>{
this.fileList.push({url:item,name:arr2[index]})
this.fileUrls.push(item)
this.fileNames.push(arr2[index])
})
}else{
this.fileList=[]
this.fileUrls=[]
this.fileNames = []
}
his.isView = false
this.title = "修改";
},
handleView(row) {
this.reset();
this.open = true;
this.isReadOnly=true;
@ -459,37 +500,56 @@
getUser().then((response) => {
this.postOptions = response.posts
})
this.title = "修改";
this.baseForm.dateRange = [row.startTime,row.endTime]
if(row.fileUrl&&row.fileUrl!=''){
let arr = row.fileUrl.split(",");
let arr2 = row.fileName.split(",");
arr.forEach((item,index)=>{
this.fileList.push({url:item,name:arr2[index]})
this.fileUrls.push(item)
this.fileNames.push(arr2[index])
})
}else{
this.fileList=[]
this.fileUrls=[]
this.fileNames = []
}
this.upload.isUploading = true
this.isView = true
this.title = "查看";
},
/** 提交按钮 */
submitForm: function(type) {
console.log(this.baseForm.dateRange)
if(this.baseForm.dateRange&&this.baseForm.dateRange.length>0){
this.baseForm.startTime = this.formatDate(this.baseForm.dateRange[0])
this.baseForm.endTime = this.formatDate(this.baseForm.dateRange[1])
// this.baseForm.startTime = this.formatDate(this.baseForm.dateRange[0])
// this.baseForm.endTime = this.formatDate(this.baseForm.dateRange[1])
this.baseForm.startTime = this.baseForm.dateRange[0]
this.baseForm.endTime = this.baseForm.dateRange[1]
}else{
this.baseForm.startTime = ""
this.baseForm.endTime = ""
}
//applyState -1 0
this.baseForm.applyState = type;
//fileUrls
console.log(this.fileUrls)
this.baseForm.fileUrls = this.fileUrls
this.baseForm.fileNames = this.fileNames
console.log("this.baseForm",this.baseForm);
this.$refs["baseForm"].validate(valid => {
if (valid) {
if (this.baseForm.createTime != undefined) {
// editCertificateApplyApi(this.baseForm).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
if (this.baseForm.checkId != undefined) {
editCertificateApplyApi(this.baseForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
// addCertificateApplyApi(this.baseForm).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
addCertificateApplyApi(this.baseForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
@ -536,14 +596,8 @@
},
/** 删除按钮操作 */
handleDelete(row) {
var certificateNoRow="";
if(row!=undefined &&row.certificateNo!=null&&row.certificateNo!=undefined){
certificateNoRow=row.certificateNo.split(" ");
}
const certificateNos = certificateNoRow || this.certificateNos;
console.log("certificateNos",certificateNos);
this.$modal.confirm('是否确认删除数据项?').then(() => {
delCertificateApplyApi({certificateNos:certificateNos}).then(response => {
delCertificateApplyApi({checkId:row.checkId}).then(response => {
console.log("delCertificateApplyApi",response);
this.getList();
this.$modal.msgSuccess("删除成功");
@ -559,15 +613,52 @@
handleFileSuccess(response, file, fileList) {
this.upload.isUploading = false;
if(response.code==200){
this.fileUrls.push(response.data.url)
this.fileNames.push(response.data.name)
this.$modal.msgSuccess(response.msg);
}else{
this.$modal.msgError(response.msg);
}
},
handleChange(file, fileList) {
console.log(fileList)
// this.fileUrls = fileList.map(item => item.response.data.url)
handleRemove(file, fileList) {
let sum = 0
this.fileNames.forEach((item, index) => {
if (item == file.name) {
sum = index
}
})
this.fileUrls.splice(sum, 1)
this.fileNames.splice(sum, 1)
},
async handlePreviewDownloadFile(file) {
if (file.url != null && file.url !== '') {
let downloadUrl = file.url;
try {
const response = await fetch(downloadUrl); //
if (!response.ok) {
throw new Error('文件下载失败');
}
const blob = await response.blob(); // Blob
const link = document.createElement('a');
link.href = URL.createObjectURL(blob); // URL
link.download = file.name; //
document.body.appendChild(link); // DOM
link.click(); //
document.body.removeChild(link); // <a>
} catch (error) {
message.warning("文件下载失败!");
console.error(error);
}
}
if (file.raw != null && file.raw !== '') {
const blob = file.raw; // Blob
const link = document.createElement('a');
link.href = URL.createObjectURL(blob); // URL
link.download = file.name; //
document.body.appendChild(link); // DOM
link.click(); //
document.body.removeChild(link); // <a>
}
},
/** 批量删除 */
handleBatchDel(){
@ -582,7 +673,6 @@
// this.multiple = !selection.length
},
formatDate(date) {
// YYYY-MM-DD
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 0
const day = String(date.getDate()).padStart(2, '0');