Tcsm
2023-08-08 1737343f1ac89c5980a268775a201304c47151ca
ruoyi-ui/src/views/honor/honorInfo.vue
@@ -24,30 +24,29 @@
<!--                  </el-form-item>-->
<!--                </el-cow>-->
                <el-cow :span="8">
                  <el-form-item label="类别" prop="type" label-width="50px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
                    <el-select v-model="formData.type" placeholder="请选择类别" clearable style="width: 300px">
                      <el-option v-for="dict in typeOption" :key="dict.value"
                        :label="dict.label" :value="dict.value"/>
                  <el-form-item label="类别" prop="type" label-width="50px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;" :disabled="dsb">
                    <template v-if="!isEditing" >
                      <el-input v-if="formData.type===0" placeholder="证件"></el-input>
                      <el-input v-if="formData.type===1" placeholder="荣誉"></el-input>
                      <el-input v-if="formData.type===2" placeholder="资质"></el-input>
                    </template>
                    <template v-else>
                    <el-select v-model="types" placeholder="请选择类别" clearable :style="{width: '100%'}" >
                      <el-option label="证件" value='0'></el-option>
                      <el-option label="荣誉" value='1'></el-option>
                      <el-option label="资质" value='2'></el-option>
                    </el-select>
                    </template>
                  </el-form-item>
                </el-cow>
                <el-cow :span="8">
                  <el-form-item label="名称" prop="name" label-width="50px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
                    <el-select v-model="formData.name" placeholder="请选择类别" clearable style="width: 300px">
                      <el-option v-for="dict in typeOptions" :key="dict.value"
                                 :label="dict.label" :value="dict.value"/>
                    <el-select v-model="formData.name" placeholder="请选择名称" clearable :style="{width: '100%'}"   :disabled="dsb">
                      <el-option v-for="(item, index) in typeOptions" :key="index" :label="item.label" :value="item.value"
                      ></el-option>
                    </el-select>
<!--                    <template v-if="dsb" >-->
<!--                      <el-input v-if="formData.name==0" placeholder="未婚"></el-input>-->
<!--                      <el-input v-if="formData.name==1" placeholder="已婚"></el-input>-->
<!--                      <el-input v-if="formData.name==2" placeholder="学生证"></el-input>-->
<!--                    </template>-->
<!--                    <template v-else>-->
<!--                      <el-select v-model="formData.name" placeholder="请选择类别" clearable style="width: 300px" :disabled="dsb">-->
<!--                        <el-option v-for="dict in typeOptions" :key="dict.value"-->
<!--                                   :label="dict.label" :value="dict.value"/>-->
<!--                      </el-select>-->
<!--                    </template>-->
                    <el-input v-model="newOption" v-if="showInput" placeholder="若未在上述选项中找到对应名称,请在此输入新的名称" @change="addNewOption"></el-input>
                  </el-form-item>
                </el-cow>
                <el-cow :span="8">
@@ -115,14 +114,14 @@
            >
            <span class="el-upload-list__item-actions">
        <span
          v-if="isShow"
          class="el-upload-list__item-preview"
          @click="handlePictureCardPreview(file)"
        >
          <i class="el-icon-zoom-in"></i>
        </span>
        <span
          v-if="isShow"
          class="el-upload-list__item-delete"
          @click="handleDownload(file.url)"
        >
@@ -165,14 +164,14 @@
            >
            <span class="el-upload-list__item-actions">
                <span
                  v-if="isShow"
                  class="el-upload-list__item-preview"
                  @click="handleFileCardPreview(file)"
                >
                  <i class="el-icon-zoom-in"></i>
                </span>
                <span
                  v-if="isShow"
                  class="el-upload-list__item-delete"
                  @click="handleDownload(file.url)"
                >
@@ -210,7 +209,7 @@
import errorCode from "@/utils/errorCode";
import {Message} from "element-ui";
import { download,uploadPic} from "@/api/doctor/index";
import {updateHonor,getHonor,getCategory} from "@/api/honor/index";
import {updateHonor,getHonor,getCategory, listType} from "@/api/honor/index";
export default {
  components: {},
@@ -219,18 +218,17 @@
    return {
      cdi:"荣誉证书详细信息",
      udi:"荣誉证书信息详情",
      fot:[".jpg",".jif","png"],
      fileList:[
      ],
      fileListOther:[
      ],
      fot:['.bmp','.jpg','.jpeg','.png','.tif','.gif','.pcx','.tga','.exif','.fpx',
        '.svg','.psd','.cdr','.pcd','.dxf','.ufo','.eps','.ai','.aw','.WMF','.webp','.apng'],
      fileList:[],
      fileListOther:[],
      dsb:true,
      btn:false,
      isShow:true,
      isEditing: false,
      // 荣誉表格数据
      honorList: [],
      typeList:[],
      formData: {
        //荣誉证书记录
        id:undefined,
@@ -296,10 +294,13 @@
        }],
      },
      typeOptions: [],
      newOption: undefined,
      showInput: false,
      typeOption:[
        {value:'1',label:'荣誉'},
        {value:'0',label:'证件'},
        {value:'2',label:'资质'},]
        {value:'1',label:'荣誉'},
        {value:'2',label:'资质'},],
      types:undefined
    }
  },
  computed: {},
@@ -307,12 +308,20 @@
  created() {
    const id = this.$route.params && this.$route.params.id;
    let jd;
    if(this.formData.type == 0)
      this.types = '证件'
    else if(this.formData.type== 1)
      this.types = '荣誉'
    else
      this.types = '资质'
    if(this.$route.query.detail!=undefined)
    {
      jd =  this.$route.query.detail
      this.btn= jd
      this.dsb = !jd
      this.isShow=true
      this.showInput=true
      this.isEditing=true
      document.title = "修改荣誉证书详细信息";
      this.$route.meta.title = "修改荣誉证书详细信息";//列表的名称
    }
@@ -346,9 +355,17 @@
        }
        this.loading = false;
      });
      listType(this.queryParams).then(response => {
          this.typeList = response.data;
          this.total = response.data.total;
          // console.log( this.typeList )
          // 在回调函数中调用 getTypeOptions()
          this.getTypeOptions();
          this.loading = false;
        }
      );
      this.fetchData()
      this.getCateInfor()
      // this.getCateInfor()
    }
@@ -367,28 +384,39 @@
          console.error('Error:', error); // 处理错误
        });
    },
    //类别
    addNewOption() {
      const newOption = this.newOption.trim();
      if (newOption && !this.typeOptions.includes(newOption)) {
        this.typeOptions.push(newOption);
        this.$set(this.formData, 'type', newOption); // 更新formDat.type的值为新的选项
      }
    },
    getTypeOptions() {
      const filteredOptions = this.typeList.filter(item => typeof item === 'string' && item !== '');
      // 创建一个空对象用于存储唯一的字符串选项
      const uniqueOptions = {};
      // 构建下拉选项列表
      this.typeOptions = filteredOptions.reduce((options, option) => {
        if (!uniqueOptions[option]) {
          uniqueOptions[option] = true;
          options.push({
            label: option,
            value: option
          });
        }
        return options;
      }, []);
    },
    //类别选择
    getSrc(type) {
      if (type === 1){
        return '出生证'
    getSrc1(type){
      if(type===0){
        return '证件'
      }else if(type===1){
        return '荣誉'
      }else if(type === 2){
        return '学生证'
      }else if(type === 3){
        return '毕业证'
      }else if(type === 4){
        return '结婚证'
      }else if(type === 5){
        return '户口簿'
      }else if(type === 6){
        return '独生子女证'
      }else if(type === 7){
        return '高级职称'
      }else if(type === 8){
        return '护照'
      }else if(type === 9){
        return '通行证'
      }else {
        return '其它'
        return '资质'
      }
    },
    /** 查询类别信息 */
@@ -408,6 +436,13 @@
      })
    },
    submitForm() {
      if(this.types=='0')
        this.formData.type = 0
      else if(this.types == '1')
        this.formData.type = 1
      else if(this.types == '2')
        this.formData.type = 2
      let ul = this.fileList.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      }).join(",")