| | |
| | | :before-close="handleClose" |
| | | > |
| | | <el-form :model="state.noticeForm" size="default" ref="noticeRef" :rules="title === '新增' || title === '编辑' ? state.formRules : {}" label-width="110px" > |
| | | <el-form-item label="企业名称:" prop="companyName" v-if="state.isAdmin"> |
| | | <el-select |
| | | v-model="state.noticeForm.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="企业概括:" v-if="showEditor" required> |
| | | <t-editor style="width: 800px" ref="myEditor" :value="state.noticeForm.companySummary" ></t-editor> |
| | | </el-form-item> |
| | |
| | | import useSettingsStore from "@/store/modules/settings"; |
| | | import {addCom, editCom} from "@/api/companyInfo/overview"; |
| | | import Cookies from "js-cookie"; |
| | | import {getCompany} from "@/api/onlineEducation/company"; |
| | | |
| | | |
| | | const emit = defineEmits(["getList"]); |
| | |
| | | companyName: '' |
| | | }, |
| | | formRules:{ |
| | | companyName: [{ required: true, message: '请选择企业', trigger: 'blur' }], |
| | | companySummary: [{ required: true, message: '企业概况', trigger: 'blur' }], |
| | | }, |
| | | isAdmin: false, |
| | | companyList: [] |
| | | |
| | | }) |
| | | |
| | |
| | | |
| | | }); |
| | | const openDialog = async (type, value) => { |
| | | |
| | | const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | | state.isAdmin = userInfo.userType === 0; |
| | | isReview.value = false; |
| | | showEditor.value = false |
| | | title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看' ; |
| | | if(type === 'edit' || type === 'review') { |
| | | state.noticeForm.companySummary = value.companySummary |
| | | state.noticeForm.id = value.id |
| | | if(state.isAdmin){ |
| | | state.noticeForm.companyId = value.companyId |
| | | state.noticeForm.companyName = value.companyName |
| | | } |
| | | } |
| | | if(type === 'review') { |
| | | showEditor.value = false |
| | |
| | | }) |
| | | } |
| | | } |
| | | 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) |
| | | } |
| | | } |
| | | } |
| | | |
| | | const onSubmit = async () => { |
| | | state.noticeForm.companySummary = tinyMCE.activeEditor.getContent(); |
| | | const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | | state.noticeForm.companyId = userInfo.companyId |
| | | state.noticeForm.companyName = userInfo.companyName |
| | | if(!state.isAdmin){ |
| | | const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | | state.noticeForm.companyId = userInfo.companyId |
| | | state.noticeForm.companyName = userInfo.companyName |
| | | } |
| | | // // myEditor.value.submit(); |
| | | const valid = await noticeRef.value.validate(); |
| | | if(valid){ |
| | |
| | | } |
| | | } |
| | | |
| | | const selectValue = (val) => { |
| | | state.companyList.forEach(item => { |
| | | if(item.name === val){ |
| | | state.noticeForm.companyId = item.id |
| | | } |
| | | }) |
| | | } |
| | | const handleClose = () => { |
| | | if(title.value ==="新增"|| title.value ==='编辑'){ |
| | | myEditor.value.clear(); |
| | |
| | | } |
| | | |
| | | // reset() |
| | | state.companyList = [] |
| | | noticeRef.value.clearValidate(); |
| | | dialogVisible.value = false; |
| | | } |
| | |
| | | companyId:null, |
| | | companyName: '' |
| | | } |
| | | state.companyList = [] |
| | | } |
| | | |
| | | defineExpose({ |