授权文件校验
This commit is contained in:
parent
e00afb3606
commit
f7ec877efa
|
|
@ -175,6 +175,7 @@
|
|||
:on-error="handleError"
|
||||
:on-remove="handleFileRemove"
|
||||
accept=".docx"
|
||||
:before-upload="beforeUploadDocx"
|
||||
:disabled="isEditMode"
|
||||
style="margin-right: 10px"
|
||||
>
|
||||
|
|
@ -272,50 +273,6 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <el-table-column label="身份证照片" prop="idPhotos" align="center" width="200">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <div class="id-photo-upload">-->
|
||||
<!-- <div class="upload-item">-->
|
||||
<!-- <el-upload-->
|
||||
<!-- :action="uploadUrl"-->
|
||||
<!-- :headers="uploadHeaders"-->
|
||||
<!-- :data="{ type: 1 }"-->
|
||||
<!-- :on-success="(response, file) => handleIdPhotoSuccess(response, file, scope.$index, 'front')"-->
|
||||
<!-- :on-error="handleUploadError"-->
|
||||
<!-- :before-upload="beforeIdPhotoUpload"-->
|
||||
<!-- :show-file-list="false"-->
|
||||
<!-- accept="image/*"-->
|
||||
<!-- >-->
|
||||
<!-- <el-button size="mini" :loading="scope.row.frontUploading">-->
|
||||
<!-- {{ scope.row.frontUploading ? '识别中...' : '头像面' }}-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-upload>-->
|
||||
<!-- <span v-if="scope.row.idFrontPhoto" class="upload-status">✓</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="upload-item">-->
|
||||
<!-- <el-upload-->
|
||||
<!-- :action="uploadUrl"-->
|
||||
<!-- :headers="uploadHeaders"-->
|
||||
<!-- :data="{ type: 2 }"-->
|
||||
<!-- :on-success="(response, file) => handleIdPhotoSuccess(response, file, scope.$index, 'back')"-->
|
||||
<!-- :on-error="handleUploadError"-->
|
||||
<!-- :before-upload="beforeIdPhotoUpload"-->
|
||||
<!-- :show-file-list="false"-->
|
||||
<!-- accept=".doc,.docx"-->
|
||||
<!-- >-->
|
||||
<!-- <el-button size="mini" :loading="scope.row.backUploading">-->
|
||||
<!-- {{ scope.row.backUploading ? '识别中...' : '国徽面' }}-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-upload>-->
|
||||
<!-- <span v-if="scope.row.idBackPhoto" class="upload-status">✓</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column label="操作" width="80" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="danger" @click="removeReceiver(scope.$index)">删除</el-button>
|
||||
|
|
@ -327,8 +284,6 @@
|
|||
<el-button type="primary" @click="addReceiver">新增领料人</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- </div>-->
|
||||
<!-- </template>-->
|
||||
|
||||
<!-- 批量授权时才显示的已选申请单 -->
|
||||
<el-form-item v-if="isBatchMode" label="已选申请单:">
|
||||
|
|
@ -772,6 +727,26 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
beforeUploadDocx(file) {
|
||||
const isDocx = file.name.toLowerCase().endsWith('.docx')
|
||||
const isWordMime =
|
||||
file.type ===
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
||||
|
||||
if (!isDocx || !isWordMime) {
|
||||
this.$message.error('只能上传.docx格式的文件!')
|
||||
return false // 阻止上传
|
||||
}
|
||||
|
||||
// 限制大小,例如 10MB
|
||||
const isLt10M = file.size / 1024 / 1024 < 10
|
||||
if (!isLt10M) {
|
||||
this.$message.error('文件大小不能超过 10MB!')
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
},
|
||||
// 判断节点是否可选择(只有第三级或没有层级的数据可选择)
|
||||
isSelectableNode(node) {
|
||||
// 第三级数据:level为"3"
|
||||
|
|
@ -1445,37 +1420,6 @@ export default {
|
|||
} finally {
|
||||
}
|
||||
},
|
||||
// 上传并解析成功
|
||||
// handleParseSuccess(response, file, fileList) {
|
||||
// // 兼容你的 AjaxResult 结构:{ code:200, data: [...] }
|
||||
// const list = (response && response.code === 200) ? response.data : (Array.isArray(response) ? response : null);
|
||||
//
|
||||
// if (!list || list.length === 0) {
|
||||
// this.$message.warning('未识别到委托人信息,请手动填写');
|
||||
// // 设置 fileList 显示上传的文件名
|
||||
// this.fileList = [{ name: file.name, url: '' }];
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // 直接把识别到的结果赋值给 materialReceivers(并保证字段名一致)
|
||||
// this.materialReceivers = list.map(item => ({
|
||||
// name: item.name || '',
|
||||
// idNumber: item.idNumber || '',
|
||||
// phone: item.phone || '',
|
||||
// idFrontPhoto: item.frontUrl || item.idFrontPhoto || item.fronturl || null,
|
||||
// idBackPhoto: item.backUrl || item.idBackPhoto || item.backurl || null,
|
||||
// frontUploading: false,
|
||||
// backUploading: false
|
||||
// }));
|
||||
//
|
||||
// // 同步到 authForm
|
||||
// this.authForm.materialReceivers = [...this.materialReceivers];
|
||||
//
|
||||
// // 更新 fileList 显示
|
||||
// this.fileList = [{ name: file.name, url: '' }];
|
||||
//
|
||||
// this.$message.success(`识别成功,共提取 ${this.materialReceivers.length} 个委托人`);
|
||||
// },
|
||||
handleParseSuccess(response, file, fileList) {
|
||||
// 后端返回结构:{ code:200, data: { receivers: [...], filePath: "xxx" } }
|
||||
const data = (response && response.code === 200) ? response.data : null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue