| | |
| | | :title="state.title" |
| | | width="600px" |
| | | :before-close="handleClose" |
| | | :modal="false" |
| | | draggable |
| | | :close-on-press-escape="false" |
| | | :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="itemId"> |
| | | <el-select v-model="state.form.itemId" |
| | | filterable |
| | | placeholder="请选择" |
| | | clearable style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="item in state.projectList" |
| | | :key="item.id" |
| | | :label="item.itemName" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | |
| | | </el-form-item> |
| | | <el-form-item label="文件编号:" prop="number"> |
| | | <el-input v-model.trim="state.form.number" :disabled="state.title =='查看'" placeholder="文件编号"></el-input> |
| | | </el-form-item> |
| | |
| | | <!-- <el-form-item label="编写指南:" prop="erdact">--> |
| | | <!-- <el-input v-model.trim="state.form.erdact" :disabled="state.title =='查看'" placeholder="编写指南"></el-input>--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item label="目录选择:" prop="catalogueId"> |
| | | <el-cascader |
| | | style="width: 100%" |
| | | ref="classifyRef" |
| | | v-model="state.form.catalogueId" |
| | | :options="state.catalogueList" |
| | | :props="state.props" |
| | | clearable |
| | | :show-all-levels="false" |
| | | @change="handleChange" |
| | | /> |
| | | </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-upload accept=".doc,.docx,.pdf,.png,.jpg,.jpeg" :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、.pdf、图片格式文档,尺寸小于5M,最多可上传1份</div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | |
| | | import {getToken} from "@/utils/auth"; |
| | | import {delPic} from "@/api/onlineEducation/banner"; |
| | | import {addFile, editFile} from "@/api/qualityManage/range"; |
| | | import {addProductFile, editProductFile} from "@/api/selfProblems/productFile"; |
| | | import {addProductFile, editProductFile, getProductSet} from "@/api/selfProblems/productFile"; |
| | | import Cookies from "js-cookie"; |
| | | |
| | | const emit = defineEmits(["getList"]); |
| | | const dialogVisible = ref(false) |
| | |
| | | title: '', |
| | | form: { |
| | | id: null, |
| | | type: 2, |
| | | name: '', |
| | | filePath: '', |
| | | fileName: '', |
| | | companyId: null, |
| | | catalogueId: null, |
| | | erdact: '', |
| | | number: '' |
| | | number: '', |
| | | itemId: null |
| | | }, |
| | | formRules:{ |
| | | number: [{ required: true, message: '请输入材料编号', trigger: 'blur' }], |
| | | fileName: [{ required: true, message: '请输入材料名称', trigger: 'blur' }], |
| | | filePath: [{ required: true, message: '请上传文件', trigger: 'blur' }], |
| | | number: [{ required: true, message: '请输入文件编号', trigger: 'blur' }], |
| | | // fileName: [{ required: true, message: '请输入文件名称', trigger: 'blur' }], |
| | | // filePath: [{ required: true, message: '请上传文件', trigger: 'blur' }], |
| | | itemId: [{ required: true, message: '请选择项目', trigger: 'blur' }], |
| | | catalogueId: [{ required: true, message: '请选择目录', trigger: 'blur' }] |
| | | }, |
| | | isAdmin: false, |
| | | props: { |
| | | value: 'id', |
| | | label: 'mess', |
| | | checkStrictly: true, |
| | | emitPath: false |
| | | }, |
| | | companyList: [], |
| | | industryList: [], |
| | | uploadUrl: import.meta.env.VITE_APP_BASE_API + '/system/common/uploadFile', |
| | |
| | | Authorization: getToken() |
| | | }, |
| | | fileLimit: 1, |
| | | fileList: [] |
| | | fileList: [], |
| | | projectList: [], |
| | | userId: null, |
| | | }) |
| | | onMounted(() => { |
| | | |
| | | }); |
| | | |
| | | const openDialog = async (type, value,companyId,catalogueId) => { |
| | | const openDialog = async (type, value,companyId,catalogueList,userId) => { |
| | | const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | | state.isAdmin = userInfo.userType === 0; |
| | | state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看' |
| | | state.form.companyId = companyId |
| | | state.form.catalogueId = catalogueId |
| | | state.form.type = 2 |
| | | state.catalogueList = catalogueList |
| | | // state.form.catalogueId = findDefaultNode(state.catalogueList,'8.5') |
| | | |
| | | state.userId = userId |
| | | if(state.title == '编辑'||state.title == '查看'){ |
| | | Object.keys(state.form).forEach(key => { |
| | | if (key in value) { |
| | |
| | | } |
| | | state.fileList = [obj] |
| | | } |
| | | state.form.itemId = state.form.itemId == 0 ? null : state.form.itemId |
| | | } |
| | | await getProjectList() |
| | | dialogVisible.value = true |
| | | } |
| | | |
| | | const handleChange = ()=> { |
| | | console.log(state.form.catalogueId,'id') |
| | | } |
| | | |
| | | const getProjectList = async () => { |
| | | const param = { |
| | | companyId: state.form.companyId, |
| | | userId: state.isAdmin ? null : state.userId |
| | | } |
| | | const res = await getProductSet(param); |
| | | if(res.code === 200){ |
| | | state.projectList = res.data |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | |
| | | } |
| | | |
| | | const findDefaultNode = (list,num)=>{ |
| | | for (let node of list){ |
| | | if(node.number == num) return node.id |
| | | if(node.children){ |
| | | const res = findDefaultNode(node.children,num) |
| | | if(res) return res |
| | | } |
| | | } |
| | | return null |
| | | } |
| | | |
| | | const onSubmit = async () => { |
| | |
| | | const handleClose = () => { |
| | | state.form = { |
| | | id: null, |
| | | type: 2, |
| | | name: '', |
| | | filePath: '', |
| | | fileName: '', |
| | | companyId: null, |
| | | catalogueId: null, |
| | | erdact: '', |
| | | number: '' |
| | | number: '', |
| | | itemId: null |
| | | } |
| | | state.fileList = [] |
| | | superRef.value.clearValidate(); |