| | |
| | | :close-on-click-modal="false" |
| | | > |
| | | <el-form :model="state.form" size="default" ref="busRef" :rules="state.formRules" label-width="150px" > |
| | | <el-form-item label="企业名称:" prop="companyName" v-if="state.isAdmin"> |
| | | <el-select |
| | | v-model="state.form.companyName" |
| | | filterable |
| | | remote |
| | | :disabled="title == '查看' || !state.isAdmin" |
| | | @change="selectValue" |
| | | reserve-keyword |
| | | placeholder="请输入企业名称" |
| | | remote-show-suffix |
| | | :remote-method="getCompanyList" |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="item in state.companyList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.name" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="取得资质证书名称:" prop="certificateName" > |
| | | <el-input v-model="state.form.certificateName" :disabled="title === '查看'" placeholder="请输入取得资质证书名称"/> |
| | | </el-form-item> |
| | |
| | | import {ElMessage, ElMessageBox} from "element-plus"; |
| | | import {addNotice} from "@/api/backManage/notice"; |
| | | import {addDict, editDict, getDictDetail} from "@/api/backManage/evaluate"; |
| | | import {addCompany, checkName, distributeCompany, editCompany} from "@/api/onlineEducation/company"; |
| | | import {addCompany, checkName, distributeCompany, editCompany, getCompany} from "@/api/onlineEducation/company"; |
| | | import {verifyPhone} from "@/utils/validate"; |
| | | import {getToken} from "@/utils/auth"; |
| | | import {addQualification, editQualification} from "@/api/companyInfo/qualifications"; |
| | |
| | | fileName: '' |
| | | }, |
| | | formRules:{ |
| | | companyName: [{ required: true, message: '请选择企业', trigger: 'blur' }], |
| | | certificateName:[{ required: true, message: '请输入取得资质证书名称', trigger: 'blur' }], |
| | | certificateNum:[{ required: true, message: '请输入证书编号', trigger: 'blur' }], |
| | | effectiveTime:[{ required: true, message: '请选择截止日期', trigger: 'blur' }], |
| | |
| | | Authorization: getToken() |
| | | }, |
| | | fileList: [], |
| | | companyList: [], |
| | | isAdmin: false |
| | | }) |
| | | |
| | | |
| | | const openDialog = async (type, value) => { |
| | | const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | | state.isAdmin = userInfo.userType === 0; |
| | | title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看' ; |
| | | if(type === 'edit' || type === 'review') { |
| | | state.form = JSON.parse(JSON.stringify(value)); |
| | |
| | | name: state.form.fileName |
| | | } |
| | | state.fileList.push(obj) |
| | | if(state.isAdmin){ |
| | | state.form.companyId = value.companyId |
| | | state.form.companyName = value.companyName |
| | | } |
| | | } |
| | | dialogVisible.value = true; |
| | | } |
| | | |
| | | const onSubmit = async () => { |
| | | const valid = await busRef.value.validate(); |
| | | const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | | state.form.companyId = userInfo.companyId |
| | | if(!state.isAdmin){ |
| | | const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | | state.form.companyId = userInfo.companyId |
| | | } |
| | | if(valid){ |
| | | if(title.value === '新增'){ |
| | | const {id, ...data} = JSON.parse(JSON.stringify(state.form)) |
| | |
| | | fileName: '' |
| | | } |
| | | state.fileList = []; |
| | | state.companyList = [] |
| | | } |
| | | const selectValue = (val) => { |
| | | state.companyList.forEach(item => { |
| | | if(item.name === val){ |
| | | state.form.companyId = item.id |
| | | } |
| | | }) |
| | | } |
| | | const getCompanyList = async (val)=>{ |
| | | if(val != ""){ |
| | | const queryParams = { |
| | | name: val |
| | | } |
| | | const res = await getCompany(queryParams) |
| | | if (res.code == 200) { |
| | | state.companyList = res.data.list |
| | | |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | } |
| | | defineExpose({ |
| | | openDialog |