feige
2023-09-10 8319f67b9bec1d19c06eaa4216f0f34c67e3afb1
ruoyi-ui/src/views/self/show.vue
@@ -626,10 +626,12 @@
          </el-input>
        </el-form-item>
        <el-form-item label="证件类型" prop="type">
          <el-select v-model="formDat.type" placeholder="请选择类型" clearable :style="{width: '100%'}"  >
          <el-select v-model="formDat.type" placeholder="请选择证件类型" clearable :style="{width: '100%'}"  >
            <el-option v-for="(item, index) in typeOption" :key="index" :label="item.label" :value="item.value"
            ></el-option>
          </el-select>
          <el-input v-model="newOption" v-if="showInput" placeholder="若未在上述选项中找到对应类型,请在此输入新的证件类型" @change="addNewOption"></el-input>
        </el-form-item>
        <el-form-item label="持有情况" prop="ownStatus">
          <el-input v-model="formDat.ownStatus" placeholder="请输入持有情况" clearable :style="{width: '100%'}" >
@@ -734,12 +736,11 @@
import axios from 'axios';
//在system/note/index.js中导入接口函数  --接好了
import {
  getIndividualList, addIndividual, updateIndividual, delIndividual,
import {getIndividualList, addIndividual, updateIndividual, delIndividual,
  listExperience, addExperience, updateExperience, delExperience,
  getIndividualRelation, addRelation, updateRelation, delRelation,
  getCertificateList, addCertificate, updateCertificate, delCertificate,
  getAbroadList, addAbroad, updateAbroad, delAbroad,
  getAbroadList, addAbroad, updateAbroad, delAbroad,listType,
  getAutobiographyList, getAutobiographyTermList, addAutobiography,updateAutobiography,
  getCategory,
} from "@/api/self/index";
@@ -791,6 +792,7 @@
      relationList:[],
      //出入境证件情况
      certificateList:[],
      typeList:[],
      //出国情况
      AbroadList:[],
@@ -1016,16 +1018,9 @@
      },
      selectedOption:'',
      typeOptions:[],
      typeOption: [{
        value:'护照',
        label:'护照'
      },{
        value:'通行证',
        label:'通行证'
      },{
        value:'身份证',
        label:'身份证'
      }],
      typeOption:[],
      newOption: undefined,
      showInput: true
    };
  },
  created() {
@@ -1101,7 +1096,14 @@
        return '——————'
      }
    },
//类别
    addNewOption() {
      const newOption = this.newOption.trim();
      if (newOption && !this.typeOption.includes(newOption)) {
        this.typeOption.push(newOption);
        this.$set(this.formDat, 'type', newOption); // 更新formDat.type的值为新的选项
      }
    },
    /** 查询角色列表 */
    getList() {
      this.loading = true;
@@ -1169,6 +1171,32 @@
      //   this.total = response.data.total;
      //   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;
        }
      );
    },
    getTypeOptions() {
      const filteredOptions = this.typeList.filter(item => typeof item === 'string' && item !== '');
      // 创建一个空对象用于存储唯一的字符串选项
      const uniqueOptions = {};
      // 构建下拉选项列表
      this.typeOption = filteredOptions.reduce((options, option) => {
        if (!uniqueOptions[option]) {
          uniqueOptions[option] = true;
          options.push({
            label: option,
            value: option
          });
        }
        return options;
      }, []);
    },
    //图片的上传及上传按钮隐藏