| | |
| | | >导入模板下载</el-button> |
| | | </el-col> |
| | | |
| | | <el-col :span="1.5"> |
| | | <el-col v-if="sho" :span="1.5"> |
| | | |
| | | <el-upload |
| | | action="" |
| | |
| | | |
| | | <el-table v-loading="loading" :data="materialsList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="操作" align="center" width="160" class-name="small-padding "> |
| | | <el-table-column v-if="sho" label="操作" align="center" width="160" class-name="small-padding "> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | |
| | | |
| | | importDialogVisible: false, |
| | | fileList: [], |
| | | uploadUrl: process.env.VUE_APP_BASE_API +'/system/materials/upload/'+this.recordId, // 替换为实际的上传接口 |
| | | uploadUrl: process.env.VUE_APP_BASE_API +'/system/materials/uploads/'+this.recordId, // 替换为实际的上传接口 |
| | | headers: { |
| | | Authorization: 'Bearer ' + getToken() |
| | | }, |
| | | uploadParams: { |
| | | type: 'material' // 自定义上传类型 |
| | | }, |
| | | // 上传状态跟踪 |
| | | uploadSuccessCount: 0, |
| | | uploadFailCount: 0, |
| | | totalUploadFiles: 0, |
| | | // 添加材料类型选项 |
| | | fileStyleOptions: [ |
| | | { value: '文字材料', label: '文字材料' }, |
| | |
| | | titleSearchTimer: null, // 防抖定时器 |
| | | creatorSuggestions: [], // 匹配的责任人建议列表 |
| | | showCreatorSuggestions: false, // 是否显示责任人建议框 |
| | | creatorSearchTimer: null, // persona查询防抖定时器 |
| | | creatorSearchTimer: null, // 责任人查询防抖定时器 |
| | | // 是否显示弹出层 |
| | | open: false, |
| | | titles: "", |
| | |
| | | { required: true, message: "页号不能为空", trigger: "blur" }, |
| | | { type: 'number', message: '页号必须为数字类型', trigger: ['blur', 'change'] }, |
| | | { pattern: /^[1-9]\d*$/, message: '请输入大于0的正整数', trigger: 'blur' }, |
| | | { validator: (rule, value, callback) => { |
| | | if (this.totalPageCount > 0 && value > this.totalPageCount) { |
| | | callback(new Error(`页号不能超过总页数${this.totalPageCount}`)); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, trigger: ['blur', 'change'] |
| | | }, |
| | | // { max: 85, message: "最大长度为85个字符", trigger: "blur" } |
| | | ], |
| | | stage: [ |
| | |
| | | methods: { |
| | | // 上传失败回调 |
| | | handleError(err, file, fileList) { |
| | | this.$modal.msgError("上传失败: " + err.message) |
| | | // 清除上传列表 |
| | | this.$refs.upload.clearFiles(); |
| | | // 失败计数+1 |
| | | this.uploadFailCount++; |
| | | // 检查是否所有文件都上传完成 |
| | | this.checkUploadComplete(); |
| | | }, |
| | | // 上传成功回调 |
| | | handleSuccess(response, file, fileList) { |
| | | if (response.code === 200) { |
| | | this.$modal.msgSuccess("上传成功") |
| | | // 清除上传列表 |
| | | this.$refs.upload.clearFiles(); |
| | | // 关闭上传对话框 |
| | | this.importDialogVisible = false; |
| | | // 刷新列表数据 |
| | | this.getList(); // 这里可以调用接口关联上传的文件和当前记录 |
| | | //更新档案的状态 |
| | | |
| | | // 成功计数+1 |
| | | this.uploadSuccessCount++; |
| | | } else { |
| | | // alert(234) |
| | | console.log(response) |
| | | this.$modal.msgError(response.msg) |
| | | // 失败计数+1 |
| | | this.uploadFailCount++; |
| | | } |
| | | // 检查是否所有文件都上传完成 |
| | | this.checkUploadComplete(); |
| | | }, |
| | | // 检查所有文件是否上传完成 |
| | | checkUploadComplete() { |
| | | // 当所有文件都上传完成时 |
| | | if (this.uploadSuccessCount + this.uploadFailCount === this.totalUploadFiles) { |
| | | if (this.uploadFailCount === 0) { |
| | | // 所有文件上传成功 |
| | | this.$modal.msgSuccess("所有文件上传成功"); |
| | | } else { |
| | | // 部分文件上传失败 |
| | | this.$modal.msgError(`上传完成,但有 ${this.uploadFailCount} 个文件上传失败`); |
| | | } |
| | | // 清除上传列表 |
| | | this.$refs.upload.clearFiles(); |
| | | // 关闭上传对话框 |
| | | this.importDialogVisible = false; |
| | | // 刷新列表数据 |
| | | this.getList(); |
| | | } |
| | | }, |
| | | // 打开导入对话框 |
| | | // 打开导入对话框 |
| | | handleImport() { |
| | | //生成新的记录 |
| | | insertFile(this.recordId, this.totalPageCount).then(response => { |
| | |
| | | } |
| | | else |
| | | { |
| | | // 初始化上传状态计数 |
| | | this.uploadSuccessCount = 0; |
| | | this.uploadFailCount = 0; |
| | | this.totalUploadFiles = fileCount; |
| | | // 执行上传 |
| | | this.$refs.upload.submit() |
| | | this.getList() |
| | |
| | | background-color: #fff; |
| | | } |
| | | </style> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |