From a390dbc5239ac26f093c6670c12cfd6a49ca6037 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期四, 20 十一月 2025 15:06:47 +0800
Subject: [PATCH] 修改
---
src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/range/components/recordDialog.vue | 52 ++++++++++++++++++++++++++++------------------------
1 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/range/components/recordDialog.vue b/src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/range/components/recordDialog.vue
index ca300d2..1cbeae9 100644
--- a/src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/range/components/recordDialog.vue
+++ b/src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/range/components/recordDialog.vue
@@ -9,14 +9,14 @@
:close-on-click-modal="false"
>
<el-form :model="state.form" size="default" ref="superRef" :rules="state.formRules" label-width="150px" >
- <el-form-item label="记录名称:" prop="templateName">
- <el-input v-model.trim="state.form.templateName" :disabled="state.title =='查看'" placeholder="材料名称"></el-input>
+ <el-form-item label="记录名称:" prop="name">
+ <el-input v-model.trim="state.form.name" :disabled="state.title =='查看'" placeholder="记录名称"></el-input>
</el-form-item>
- <el-form-item label="模板文件:" prop="filePath">
+ <el-form-item label="记录模板:" prop="filePath">
<el-upload accept=".doc,.docx" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile)" :on-exceed="showTip" :limit='state.fileLimit' v-model:file-list="state.fileList" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles)" >
<el-button type="primary">点击上传</el-button>
<template #tip>
- <div class="el-upload__tip">支持上传.doc、.docx格式文档,尺寸小于5M,最多可上传1张</div>
+ <div class="el-upload__tip">支持上传.doc、.docx格式文档,尺寸小于5M,最多可上传1份</div>
</template>
</el-upload>
</el-form-item>
@@ -39,6 +39,7 @@
import {addIndustryTemp, updateIndustryTemp, updateInfoPlatforms} from "@/api/staffManage/staff";
import {getToken} from "@/utils/auth";
import {delPic} from "@/api/onlineEducation/banner";
+import {addFile, editFile} from "@/api/qualityManage/range";
const emit = defineEmits(["getList"]);
const dialogVisible = ref(false)
@@ -47,13 +48,15 @@
title: '',
form: {
id: null,
- templateName: '',
+ name: '',
filePath: '',
- format: '',
- companyId: null
+ fileName: '',
+ companyId: null,
+ catalogueId: null,
+ type:null
},
formRules:{
- templateName: [{ required: true, message: '请输入材料名称', trigger: 'blur' }],
+ name: [{ required: true, message: '请输入记录名称', trigger: 'blur' }],
},
isAdmin: false,
companyList: [],
@@ -69,13 +72,11 @@
});
-const openDialog = async (type, value,companyId, isAdmin, companyList) => {
- state.isAdmin = isAdmin
- if(isAdmin){
- state.companyList = companyList
- }
+const openDialog = async (type, value,companyId,catalogueId) => {
state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看'
state.form.companyId = companyId
+ state.form.catalogueId = catalogueId
+ state.form.type = 2
if(state.title == '编辑'||state.title == '查看'){
Object.keys(state.form).forEach(key => {
if (key in value) {
@@ -85,7 +86,7 @@
if(value.filePath) {
const obj = {
url: value.filePath,
- name: '模板文件'
+ name: value.fileName
}
state.fileList = [obj]
}
@@ -93,13 +94,12 @@
dialogVisible.value = true
}
-
const onSubmit = async () => {
const valid = await superRef.value.validate();
if(valid){
if(state.title == '新增'){
const {id,...data} = state.form
- const res = await addIndustryTemp(data)
+ const res = await addFile(data)
if(res.code == 200){
ElMessage.success(res.message)
emit('getList')
@@ -109,7 +109,8 @@
ElMessage.warning(res.message)
}
}else{
- const res = await updateIndustryTemp(state.form)
+
+ const res = await editFile(state.form)
if(res.code == 200){
ElMessage.success(res.message)
emit('getList')
@@ -124,8 +125,8 @@
const handleAvatarSuccess = (res, uploadFile) => {
if(res.code == 200){
+ state.form.fileName = res.data.originName
state.form.filePath = res.data.path
- state.form.format = '.' + res.data.filename.split('.')[1]
}else{
state.fileList = []
ElMessage({
@@ -158,8 +159,8 @@
// type: 'success',
// message: '文件已删除'
// })
+ state.form.fileName = ''
state.form.filePath = ''
- state.form.format = ''
}else{
ElMessage({
type: 'warning',
@@ -167,19 +168,22 @@
})
}
}).catch(() => {
- state.form.imgUrl = ''
+ state.form.fileName = ''
+ state.form.filePath = ''
});
}
const handleClose = () => {
state.form = {
id: null,
- templateName: '',
- industryType: '',
+ name: '',
filePath: '',
- format: '',
- companyId: null
+ fileName: '',
+ companyId: null,
+ catalogueId: null,
+ type:null
}
+ state.fileList = []
superRef.value.clearValidate();
superRef.value.resetFields()
dialogVisible.value = false;
--
Gitblit v1.9.2