From e3686634452289d43e750a44f30f72b0e7754866 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期六, 07 十一月 2026 00:26:56 +0800
Subject: [PATCH] 修复人员管理模块各标签页问题并完善设备、文件受控页面
---
src/views/CNAS/personnel/personnelInfo/components/mandateAdd.vue | 97 +++++++++++++++++++++++++++++++++++++-----------
1 files changed, 74 insertions(+), 23 deletions(-)
diff --git a/src/views/CNAS/personnel/personnelInfo/components/mandateAdd.vue b/src/views/CNAS/personnel/personnelInfo/components/mandateAdd.vue
index fa0d0d0..087af91 100644
--- a/src/views/CNAS/personnel/personnelInfo/components/mandateAdd.vue
+++ b/src/views/CNAS/personnel/personnelInfo/components/mandateAdd.vue
@@ -1,7 +1,7 @@
<template>
<div class="add">
<el-dialog
- :title="isEdit ?'缂栬緫闄勪欢璧勬枡':'鏂板闄勪欢璧勬枡'"
+ :title="isEdit ? '缂栬緫浠昏亴鎺堟潈璁板綍' : '鏂板浠昏亴鎺堟潈璁板綍'"
v-model="dialogVisible"
width="50%"
>
@@ -51,6 +51,8 @@
<el-upload ref="upload" style="float: left; margin: 0 12px 0 20px;" :action="action"
:headers="uploadHeader"
:show-file-list="false"
+ accept=".doc,.docx,.pdf,.jpg,.jpeg,.png"
+ :before-upload="beforeUpload"
:on-success="onSuccess">
<template #trigger><el-button class="uploadFile" size="small" type="primary">涓婁紶</el-button></template>
</el-upload>
@@ -93,8 +95,8 @@
rules: {
certificateNumber: [{ required: true, message: '璇疯緭鍏ヨ瘉涔︾紪鍙�', trigger: 'blur' }],
userId: [{ required: true, message: '璇烽�夋嫨琚换鑱屼汉鍛�', trigger: 'change' }],
- post: [{ required: true, message: '浠昏亴宀椾綅', trigger: 'blur' }],
- operationType: [{ required: true, message: '鎿嶄綔绫诲瀷', trigger: 'blur' }],
+ post: [{ required: true, message: '璇疯緭鍏ヤ换鑱屽矖浣�', trigger: 'blur' }],
+ operationType: [{ required: true, message: '璇疯緭鍏ユ搷浣滅被鍨�', trigger: 'blur' }],
},
loading: false,
userList: []
@@ -107,19 +109,61 @@
},
methods: {
onSuccess(response, file, fileList) {
- this.form["systemFileName"] = response.data
+ if (response && response.code === 200 && response.data) {
+ this.form.systemFileName = response.data
+ this.form.fileName = file.name
+ this.$message.success('涓婁紶鎴愬姛')
+ } else {
+ this.$refs.upload && this.$refs.upload.clearFiles()
+ this.$message.error((response && response.msg) || '涓婁紶澶辫触')
+ }
},
deleteFile(fileName) {
- deleteCNASFile({fileName: fileName}).then(res => {
- this.$message.success('鍒犻櫎鎴愬姛锛�')
- this.form["systemFileName"] = null
+ if (!fileName) {
+ this.form.systemFileName = ''
+ return
+ }
+ this.$confirm('鏄惁鍒犻櫎宸蹭笂浼犵殑涓婂矖璇佷功鏂囦欢?', '璀﹀憡', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ deleteCNASFile({fileName: fileName}).then(res => {
+ if (res.code === 200) {
+ this.$message.success('鍒犻櫎鎴愬姛锛�')
+ this.form.systemFileName = ''
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('鍒犻櫎澶辫触')
+ })
+ }).catch(() => {})
+ },
+ resetData() {
+ this.form = {
+ id: undefined,
+ certificateNumber: undefined,
+ userId: undefined,
+ post: undefined,
+ operationType: undefined,
+ fileList: [],
+ fileName: undefined,
+ systemFileName: undefined,
+ remarks: undefined,
+ num2: undefined,
+ num1: undefined
+ }
+ this.$nextTick(() => {
+ if (this.$refs.ruleForm) this.$refs.ruleForm.clearValidate()
+ if (this.$refs.upload) this.$refs.upload.clearFiles()
})
},
async openDialog(row, type) {
await this.getUserList()
- this.dialogVisible = true
- if(type) {
- this.isEdit = true
+ this.isEdit = !!type
+ this.resetData()
+ if (type) {
this.form.id = row.id
this.form.certificateNumber = row.certificateNumber
this.form.userId = Number(row.userId)
@@ -129,12 +173,10 @@
this.form.remarks = row.remarks
this.form.num1 = row.num1
this.form.num2 = row.num2
- } else {
- this.resetForm('ruleForm')
}
+ this.dialogVisible = true
},
closeDialog() {
- this.resetForm('ruleForm')
this.dialogVisible = false
},
/**
@@ -142,7 +184,7 @@
*/
async getUserList() {
try {
- const res = await selectUserCondition()
+ const res = await selectUserCondition({ isCustom: 0 })
if (res.code !== 200) throw new Error('浜哄憳鍒楄〃鎺ュ彛杩斿洖澶辫触')
this.userList = Array.isArray(res.data) ? res.data : []
} catch (error) {
@@ -169,10 +211,16 @@
}
this.loading = true
addOrUpdatePersonPostAuthorizationRecord(params).then(res => {
- this.loading = false
- this.closeDialog()
- this.$emit('refresh')
- }).catch(err => {
+ if (res.code === 200) {
+ this.$message.success(this.isEdit ? '淇敼鎴愬姛' : '鏂板鎴愬姛')
+ this.closeDialog()
+ this.$emit('refresh')
+ } else {
+ this.$message.error(res.msg || '淇濆瓨澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('淇濆瓨澶辫触')
+ }).finally(() => {
this.loading = false
})
}
@@ -184,13 +232,16 @@
beforeUpload(file) {
if (file.size > 1024 * 1024 * 10) {
this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
- this.$refs.upload.clearFiles()
return false;
- } else {
- this.form.fileList = [file]
- this.form.fileName = file.name
- return true;
}
+ const ext = (file.name.split('.').pop() || '').toLowerCase()
+ if (!['doc', 'docx', 'pdf', 'jpg', 'jpeg', 'png'].includes(ext)) {
+ this.$message.error('浠呮敮鎸佷笂浼� doc銆乨ocx銆乸df銆乯pg銆乸ng 鏍煎紡鐨勬枃浠�');
+ return false;
+ }
+ this.form.fileList = [file]
+ this.form.fileName = file.name
+ return true;
},
}
}
--
Gitblit v1.9.3