From 00bae2110315cf9c9a533afea2c617d950f6768e Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: 星期二, 18 十一月 2025 15:56:42 +0800
Subject: [PATCH] 修改新增
---
src/views/build/conpanyFunctionConsult/standardSysTemp/techStandardModule/components/editDialog.vue | 73 +++++++++++++++++++++++++++++++-----
1 files changed, 63 insertions(+), 10 deletions(-)
diff --git a/src/views/build/conpanyFunctionConsult/standardSysTemp/techStandardModule/components/editDialog.vue b/src/views/build/conpanyFunctionConsult/standardSysTemp/techStandardModule/components/editDialog.vue
index ac0ad98..7c2a79c 100644
--- a/src/views/build/conpanyFunctionConsult/standardSysTemp/techStandardModule/components/editDialog.vue
+++ b/src/views/build/conpanyFunctionConsult/standardSysTemp/techStandardModule/components/editDialog.vue
@@ -9,8 +9,8 @@
:close-on-click-modal="false"
>
<el-form :model="state.form" size="default" ref="superRef" :rules="state.formRules" label-width="150px" >
- <el-form-item v-if="state.isAdmin" label="企业:" prop="companyId">
- <el-select v-model="state.form.companyId" placeholder="请选择" clearable>
+ <el-form-item v-if="state.isAdmin" label="单位:" prop="companyId">
+ <el-select v-model="state.form.companyId" placeholder="请选择" clearable @change="changeCom">
<el-option
v-for="item in state.companyList"
:key="item.id"
@@ -19,14 +19,36 @@
</el-option>
</el-select>
</el-form-item>
+ <el-form-item label="所属部门:" prop="deptId">
+ <el-select v-model="state.form.deptId" placeholder="请选择" style="width: 100%" clearable>
+ <el-option
+ v-for="item in state.deptList"
+ :key="item.deptId"
+ :label="item.deptName"
+ :value="item.deptId">
+ </el-option>
+ </el-select>
+ </el-form-item>
+
<el-form-item label="模板名称:" prop="templateName">
<el-input v-model.trim="state.form.templateName" :disabled="state.title =='查看'" placeholder="模板名称"></el-input>
+ </el-form-item>
+ <el-form-item label="行业类别:" prop="industryTypeId">
+ <el-select v-model="state.form.industryTypeId" filterable placeholder="请选择" clearable>
+ <el-option
+ v-for="item in state.typeList"
+ :key="item.id"
+ style="width: 100%"
+ :label="item.name"
+ :value="item.id">
+ </el-option>
+ </el-select>
</el-form-item>
<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格式文档,尺寸小于30M,最多可上传1份</div>
</template>
</el-upload>
</el-form-item>
@@ -50,6 +72,7 @@
import {getToken} from "@/utils/auth";
import {delPic} from "@/api/onlineEducation/banner";
import {saveStandardTemp, updateStandardTemp} from "@/api/standardSys/standardSys";
+import {getDept} from "@/api/qualityObjectives/object";
const emit = defineEmits(["getList"]);
const dialogVisible = ref(false)
@@ -69,12 +92,17 @@
filePath: '',
format: '',
companyId: null,
+ industryTypeId: null,
+ industryTypeName: '',
+ deptId:null,
templateType: 2
},
formRules:{
companyId: [{ required: true, message: '请选择企业', trigger: 'blur' }],
templateName: [{ required: true, message: '请输入模板名称', trigger: 'blur' }],
- filePath: [{ required: true, validator: checkFiles, trigger: 'blur' }]
+ filePath: [{ required: true, validator: checkFiles, trigger: 'blur' }],
+ deptId: [{ required: true, message: '请选择部门', trigger: 'blur' }],
+ industryTypeId: [{ required: true, message: '请选择行业类别', trigger: 'blur' }]
},
isAdmin: false,
companyList: [],
@@ -83,17 +111,20 @@
Authorization: getToken()
},
fileLimit: 1,
- fileList: []
+ fileList: [],
+ deptList: [],
+ typeList: []
})
onMounted(() => {
});
-const openDialog = async (type, value,companyId, isAdmin, companyList) => {
+const openDialog = async (type, value,companyId, isAdmin, companyList,typeList) => {
state.isAdmin = isAdmin
if(isAdmin){
state.companyList = companyList
}
+ state.typeList = typeList
state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看'
state.form.companyId = companyId
if(state.title == '编辑'||state.title == '查看'){
@@ -105,18 +136,33 @@
if(value.filePath) {
const obj = {
url: value.filePath,
- name: '模板文件'
+ name: value.templateName+value.format
}
state.fileList = [obj]
}
}
+ await getDeptList()
dialogVisible.value = true
}
-
+const getDeptList = async () => {
+ if(state.isAdmin && (state.form.companyId == 0 || state.form.companyId == null)){
+ return
+ }
+ const param = {
+ pageNum: 1,
+ pageSize: 999,
+ companyId: state.form.companyId
+ }
+ const res = await getDept(param)
+ if(res.code === 200){
+ state.deptList = res.data
+ }
+}
const onSubmit = async () => {
const valid = await superRef.value.validate();
if(valid){
+ state.form.industryTypeName = state.typeList.find(i=>i.id == state.form.industryTypeId)?.name || ''
if(state.title == '新增'){
const {id,...data} = state.form
const res = await saveStandardTemp(data)
@@ -162,10 +208,10 @@
});
}
const picSize = async (rawFile) => {
- if(rawFile.size / 1024 / 1024 > 5){
+ if(rawFile.size / 1024 / 1024 > 30){
ElMessage({
type: 'warning',
- message: '文件大小不能超过5M'
+ message: '文件大小不能超过30M'
});
return false
}
@@ -198,6 +244,9 @@
filePath: '',
format: '',
companyId: null,
+ industryTypeId: null,
+ industryTypeName: '',
+ deptId:null,
templateType: 2
}
state.fileList = []
@@ -205,6 +254,10 @@
superRef.value.resetFields()
dialogVisible.value = false;
}
+const changeCom = () => {
+ state.form.deptId = null
+ getDeptList()
+}
defineExpose({
openDialog
--
Gitblit v1.9.2