zhouwx
4 天以前 592c1750b148874737cdfba4b22b6229f9805fe6
src/views/build/conpanyFunctionConsult/industryTemplate/components/editDialog.vue
@@ -23,7 +23,7 @@
          <el-input v-model.trim="state.form.templateName" :disabled="state.title =='查看'" placeholder="模板名称"></el-input>
        </el-form-item>
        <el-form-item label="行业:" prop="industryType">
          <el-select v-model="state.form.industryId" placeholder="请选择" clearable style="width: 100%">
          <el-select v-model="state.form.industryType" placeholder="请选择" clearable style="width: 100%">
            <el-option
                v-for="item in state.industryList"
                :key="item.id"
@@ -59,6 +59,7 @@
import {addIndustryTemp, updateIndustryTemp, updateInfoPlatforms} from "@/api/staffManage/staff";
import {getToken} from "@/utils/auth";
import {delPic} from "@/api/onlineEducation/banner";
import {getIndustry} from "@/api/system/industry";
const emit = defineEmits(["getList"]);
const dialogVisible = ref(false)
@@ -75,15 +76,16 @@
  form: {
    id: null,
    templateName: '',
    industryId: '',
    industryType: '',
    filePath: '',
    fileName: '',
    format: '',
    companyId: null
  },
  formRules:{
    companyId: [{ required: true, message: '请选择企业', trigger: 'blur' }],
    templateName: [{ required: true, message: '请输入模板名称', trigger: 'blur' }],
    industryId: [{ required: true, message: '请选择行业类型', trigger: 'blur' }],
    industryType: [{ required: true, message: '请选择行业类型', trigger: 'blur' }],
    filePath: [{ required: true, validator: checkFiles, trigger: 'blur' }]
  },
  isAdmin: false,
@@ -107,6 +109,7 @@
  }
  state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看'
  state.form.companyId = companyId
  await getIndustryList()
  if(state.title == '编辑'||state.title == '查看'){
    Object.keys(state.form).forEach(key => {
      if (key in value) {
@@ -116,7 +119,7 @@
    if(value.filePath) {
      const obj = {
        url: value.filePath,
        name: '模板文件'
        name: value.fileName
      }
      state.fileList = [obj]
    }
@@ -125,6 +128,14 @@
}
const getIndustryList = async () => {
  const res = await getIndustry()
  if(res.code == 200){
    state.industryList = res.data.data
  }else{
    ElMessage.warning(res.message)
  }
}
const onSubmit = async () => {
  const valid = await superRef.value.validate();
  if(valid){
@@ -155,6 +166,7 @@
const handleAvatarSuccess = (res, uploadFile) => {
  if(res.code == 200){
    state.form.fileName = res.data.originName
    state.form.filePath = res.data.path
    state.form.format = '.' + res.data.filename.split('.')[1]
  }else{
@@ -191,6 +203,7 @@
      // })
      state.form.filePath = ''
      state.form.format = ''
      state.form.fileName = ''
    }else{
      ElMessage({
        type: 'warning',
@@ -208,6 +221,7 @@
    templateName: '',
    industryType: '',
    filePath: '',
    fileName: '',
    format: '',
    companyId: null
  }