zhouwx
9 天以前 2be66e2a590bc719c6ecdb0bbd0aaa4c9b91fd98
src/views/build/conpanyFunctionConsult/companyInfo/basicInfo/components/basicInfoDialog.vue
@@ -9,6 +9,27 @@
        :close-on-click-modal="false"
    >
      <el-form :model="state.form" size="default" ref="busRef" :rules="state.formRules" label-position="top" 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="1.企业的基本情况,主要包括:法人证书编号,所属部门、法人代表姓名、身份证号、职务、人员总数、技术人员数、不良情况记录、保密等资质。" prop="basic" >
          <el-input v-model="state.form.basic" :rows="4" type="textarea" :disabled="title === '查看'"/>
        </el-form-item>
@@ -49,7 +70,7 @@
import {ElMessage} 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 {addBasic, editBasic} from "@/api/companyInfo/basicInfo";
import Cookies from "js-cookie";
@@ -74,6 +95,7 @@
    resource: '',
  },
  formRules:{
    companyName: [{ required: true, message: '请选择企业', trigger: 'blur' }],
    basic: [{ required: true, message: '请输入', trigger: 'blur' }],
    introduce:[{ required: true, message: '请输入', trigger: 'blur' }],
    target: [{ required: true, message: '请输入', trigger: 'blur' }],
@@ -83,21 +105,31 @@
    epiboly: [{ required: true, message: '请输入', trigger: 'blur' }],
    resource: [{ 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;
  title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看' ;
  if(type === 'edit' || type === 'review') {
    state.form = JSON.parse(JSON.stringify(value));
    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))
@@ -143,8 +175,40 @@
const reset = () => {
  state.form = {
    id: '',
    companyId: null,
    companyName: '',
    basic: '',
    introduce: '',
    target: '',
    quality: '',
    activity: '',
    audit: '',
    epiboly: '',
    resource: '',
  }
  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