linwenling
2023-08-08 49bf04d7865d999463a024b82a6cd7608bb89507
ruoyi-ui/src/views/doctor/doctorInfo.vue
@@ -18,12 +18,13 @@
        <el-container>
          <el-row>
            <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: '100%'}"  >
              <el-form-item label="类别" prop="type" label-width="55px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
                <el-select v-model="formData.type" 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>
            </el-form-item>
                <el-input v-model="newOption" v-if="showInput" placeholder="若未在上述选项中找到对应类别,请在此输入新的类别" @change="addNewOption"></el-input>
              </el-form-item>
            </el-cow>
            <el-cow :span="8">
              <el-form-item label="症状" prop="symptom" label-width="50px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
@@ -190,7 +191,7 @@
import {blobValidate} from "@/utils/ruoyi";
import errorCode from "@/utils/errorCode";
import {Message} from "element-ui";
import { getDoctor, updateDoctor,download,uploadPic} from "@/api/doctor/index";
import {getDoctor, updateDoctor, download, uploadPic, listType} from "@/api/doctor/index";
export default {
  components: {},
@@ -199,18 +200,16 @@
    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,
      // 就医记录表格数据
      doctorList: [],
      typeList:[],
      formData: {
        //就医记录
        id:undefined,
@@ -230,7 +229,7 @@
      rules: {
        type: [{
          required: true,
          message: '请输入类型',
          message: '请输入类别',
          trigger: 'blur'
        }],
        symptom: [{
@@ -271,16 +270,9 @@
        }],
      },
      typeOptions: [{
        value:'神经科',
        label:'神经科'
      },{
        value:'牙科',
        label:'牙科'
      },{
        value:'内科',
        label:'内科'
      }],
      typeOptions: [],
      newOption: undefined,
      showInput: false
    }
  },
  computed: {},
@@ -294,6 +286,7 @@
      this.btn= jd
      this.dsb = !jd
      this.isShow=true
      this.showInput=true
      document.title = "修改就医记录详细信息";
      this.$route.meta.title = "修改就医记录详细信息";//列表的名称
    }
@@ -327,7 +320,16 @@
        }
        this.loading = false;
      });
      this.getCateInfor()
      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.getCateInfor()
    }
  },
@@ -344,6 +346,31 @@
    //     })
    //   })
    // },
    //类别
    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;
      }, []);
    },
    submitForm() {
      let ul = this.fileList.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")