feige
2025-03-03 f5edbc080d696fbd55de84f6a906aeb2cde3b1b6
ruoyi-ui/src/views/doctor/doctorInfo.vue
@@ -13,11 +13,43 @@
    </div>
    <div>
      <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-position="left" label-width="100px">
      <!--      <el-form-item label="id" prop="id">-->
      <!--        <el-input v-model="formData.id" placeholder="请输入id" :maxlength="11" show-word-limit :disabled="true"-->
      <!--                  clearable prefix-icon='el-icon-mobile' :style="{width: '100%'}"></el-input>-->
      <!--      </el-form-item>-->
      <el-container>
      <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-input v-model="newOption" v-if="showInput" placeholder="若未在上述选项中找到对应类别,请在此输入新的类别" @change="addNewOption"></el-input>
      </el-form-item>
      <el-form-item label="症状" prop="symptom" label-width="50px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
        <el-input v-if="!dsb" v-model="formData.symptom" placeholder="请输入症状" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
        <el-input v-if="dsb" v-model="formData.symptom" placeholder="" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
      </el-form-item>
      <el-form-item label="持续时间" prop="duration" label-width="68px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
        <el-input v-model="formData.duration" placeholder="请输入持续时间" type="number" clearable :style="{width: '100%'}" :disabled="dsb">
        </el-input>
      </el-form-item>
      <el-form-item label="功效" prop="effect" label-width="50px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
        <el-input v-model="formData.effect" placeholder="请输入功效" clearable :style="{width: '100%'}" :disabled="dsb">
        </el-input>
      </el-form-item>
      <el-form-item label="适用人" prop="suitable" label-width="65px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
        <el-input v-model="formData.suitable" placeholder="请输入适用人" clearable :style="{width: '100%'}" :disabled="dsb">
        </el-input>
      </el-form-item>
      <el-form-item label="中医处方" prop="cmedical" label-width="68px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
        <el-input v-model="formData.cmedical" placeholder="请输入中医处方"  clearable :style="{width: '100%'}" :disabled="dsb" type="textarea">
        </el-input>
      </el-form-item>
      <el-form-item label="西医处方" prop="wmedical" label-width="68px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
          <el-input v-if="!dsb" v-model="formData.wmedical" placeholder="请输入西医处方" clearable :style="{width: '100%'}" :disabled="dsb" type="textarea"></el-input>
          <el-input v-if="dsb" v-model="formData.wmedical" placeholder="" clearable :style="{width: '100%'}" :disabled="dsb" type="textarea"></el-input>
      </el-form-item>
      <el-form-item label="备注" prop="remark" label-width="45px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
        <el-input v-if="!dsb" v-model="formData.remark" placeholder="请输入备注" clearable :style="{width: '100%'}" :disabled="dsb" type="textarea"></el-input>
        <el-input v-if="dsb" v-model="formData.remark" placeholder="" clearable :style="{width: '100%'}" :disabled="dsb" type="textarea"></el-input>
      </el-form-item>
      <!-- <el-container>
      <div>
        <el-container>
          <el-row>
@@ -32,13 +64,13 @@
            </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;">
                <el-input v-model="formData.symptom" placeholder="请输入症状" clearable :style="{width: '100%'}" :disabled="dsb">
                </el-input>
                <el-input v-if="!dsb" v-model="formData.symptom" placeholder="请输入症状" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
                <el-input v-if="dsb" v-model="formData.symptom" placeholder="" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
              </el-form-item>
            </el-cow>
            <el-cow :span="8">
              <el-form-item label="持续时间" prop="duration" label-width="68px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
                <el-input v-model="formData.duration" placeholder="请输入持续时间" clearable :style="{width: '100%'}" :disabled="dsb">
                <el-input v-model="formData.duration" placeholder="请输入持续时间" type="number" clearable :style="{width: '100%'}" :disabled="dsb">
                </el-input>
              </el-form-item>
            </el-cow>
@@ -56,7 +88,8 @@
            </el-cow>
            <el-cow :span="8">
              <el-form-item label="备注" prop="remark" label-width="45px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
          <el-input v-model="formData.remark" placeholder="请输入备注" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
          <el-input v-if="!dsb" v-model="formData.remark" placeholder="请输入备注" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
          <el-input v-if="dsb" v-model="formData.remark" placeholder="" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
        </el-form-item>
            </el-cow>
          </el-row>
@@ -73,14 +106,15 @@
            </el-cow>
            <el-cow :span="8">
              <el-form-item label="西医处方" prop="wmedical" label-width="68px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
            <el-input v-model="formData.wmedical" placeholder="请输入西医处方" clearable :style="{width: '100%'}" :disabled="dsb">
            </el-input>
              <el-input v-if="!dsb" v-model="formData.wmedical" placeholder="请输入西医处方" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
              <el-input v-if="dsb" v-model="formData.wmedical" placeholder="" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
          </el-form-item>
            </el-cow>
          </el-row>
        </el-container>
      </div>
      </el-container>
      </el-container> -->
      <h4 class="form-header">相关图片 </h4>
      <el-upload
        action="#"
@@ -94,7 +128,7 @@
        :disabled="!btn"
        :class="{ hide: !btn }"
      >
        <i v-if="!uploading" slot="default" class="el-icon-plus"></i>
        <div slot="file" slot-scope="{file}">
          <img
@@ -150,8 +184,8 @@
            :on-remove="handleRemoveFile"
            :http-request="requestUpload1"
            :show-file-list="true"
         ref="upload1"
         :on-change="handleChange1"
         :auto-upload="false"
@@ -170,7 +204,7 @@
        ></video>
        <img v-else
             class="el-upload-list__item-thumbnail"
             src="../../assets/401_images/401.gif"
             src="../../assets/images/deviceLis.png"
             alt=""
             style="width: 147px; height: 147px"
             fit="cover">
@@ -239,14 +273,15 @@
      // 数据范围选项
      fot:['.bmp','.jpg','.jpeg','.png','.tif','.gif','.pcx','.tga','.exif','.fpx',
        '.svg','.psd','.cdr','.pcd','.dxf','.ufo','.eps','.ai','.aw','.WMF','.webp','.apng'],
      fileList:[],
      fileList1:[],
      uploadFileList:[],
      uploadFileList1:[],
      fileListOther:[
      ],
      fileListOther1:[],
      dsb:true,
      btn:false,
      isShow:true,
@@ -348,20 +383,36 @@
      this.loading = true;
      getDoctor(id).then((response) => {
        this.formData = response.data;
      console.log(response.data.url)
      if(response.data.url!=null){
        let paths = response.data.url.split(",");
        for(let i = 0; i < paths.length; i++)
        {
          if(paths[i]!="") {
              let pth = paths[i].substr(paths[i].length - 4, paths[i].length)
          //   alert(pth)
              if (_this.fot.includes(pth) === true)
             {
                if(paths[i][0]=="/")
                _this.fileList.push({name:paths[i],url: process.env.VUE_APP_BASE_TRUE_API+paths[i].substr(1),res:false})
               else
                  _this.fileList.push({name:paths[i],url: process.env.VUE_APP_BASE_TRUE_API+paths[i],res:false})
               }
             // {
             //    if(paths[i][0]=="/")
           //      _this.fileList.push({name:paths[i],url: process.env.VUE_APP_BASE_TRUE_API+paths[i].substr(1),res:false})
             //   else
             //      _this.fileList.push({name:paths[i],url: process.env.VUE_APP_BASE_TRUE_API+paths[i],res:false})
             //   }
            {
              if(paths[i].includes(process.env.VUE_APP_BASE_TRUE_API)){
                if(paths[i][0]=="/")
                      _this.fileList.push({name:paths[i],url: paths[i].substr(1),res:false})
                else
                   _this.fileList.push({name:paths[i],url: paths[i],res:false})
              }else{
                if(paths[i][0]=="/")
                      _this.fileList.push({name:paths[i],url: process.env.VUE_APP_BASE_TRUE_API+paths[i].substr(1),res:false})
                else
                   _this.fileList.push({name:paths[i],url: process.env.VUE_APP_BASE_TRUE_API+paths[i],res:false})
              }
              }
              else {
                // alert(paths[i])
              // alert()
@@ -371,10 +422,14 @@
                _this.fileListOther.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i].substr(1),res:false})
                else
                _this.fileListOther.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i],res:false})
             }
            }
        }
      }
      else{
         this.formData.url = ""
      }
        this.loading = false;
      });
      listType(this.queryParams).then(response => {
@@ -392,6 +447,52 @@
  },
  mounted() {},
  methods: {
    getData(){
      const id = this.$route.params && this.$route.params.id;
      let _this = this
      if (id) {
        this.loading = true;
        getDoctor(id).then((response) => {
          this.formData = response.data;
        console.log(response.data.url)
        if(response.data.url!=null){
          let paths = response.data.url.split(",");
          for(let i = 0; i < paths.length; i++)
          {
            if(paths[i]!="") {
                let pth = paths[i].substr(paths[i].length - 4, paths[i].length)
            //   alert(pth)
                if (_this.fot.includes(pth) === true)
               {
              console.log()
                 }
                else {
                  let nms = paths[i].split("\/")
                  let nm = nms[nms.length - 1]
                 if(paths[i][0]=="/")
                  _this.fileListOther1.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i].substr(1),res:false})
                  else
                  _this.fileListOther1.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i],res:false})
               }
              }
          }
        }
          _this.fileListOther = _this.fileListOther1
          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;
          }
        );
      }
    },
    //类别
    addNewOption() {
      const newOption = this.newOption.trim();
@@ -418,11 +519,8 @@
    },
    submitForm() {
      this.$refs['elForm'].validate(valid => {
        if (valid) {
          if (this.formData.id != undefined) {
            updateDoctor(this.formData).then(response => {
@@ -467,10 +565,10 @@
               this.$delete(this.uploadFileList1, Math.abs(i - this.uploadFileList1.length-1))
            }
            this.$delete(this.fileListOther,i);
         }
        }
        let ul = ""
        this.fileList.map(function (elem){
              if(elem.res==false)
@@ -487,7 +585,7 @@
           updateDoctor(this.formData).then(response => {
            this.$modal.msgSuccess("删除成功");
            // this.open = false;
           });
        }
    },
@@ -511,7 +609,7 @@
                //     alert(this.uploadFileList.length)
             }
            this.$delete(this.fileList,i);
        }
        }
        let ul = ""
@@ -530,7 +628,7 @@
            this.$modal.msgSuccess("删除成功");
           });
        }
    },
    handleFileCardPreview(file){
      this.dialogFileUrl = file.url;
@@ -565,20 +663,20 @@
      this.btn = true
      this.isShow=false
    },
    //自定义上传方法
        handleChange(file, fileList1) {
           //定义一个全局数组uploadFileList来做存储
         // this.uploadFileList.push(file.raw);
          console.log("=========5555=========")
         this.uploadFileList.push(file.raw);
          this.fileList.push({name:file.name,url:file.url,res:true})
        },
       //自定义上传方法
       handleChange1(file, fileListOther1) {
       handleChange1(file, fileListOther12) {
              //定义一个全局数组uploadFileList来做存储
            // this.uploadFileList.push(file.raw);
           this.uploadFileList1.push(file.raw);
            this.fileListOther.push({name:file.name,url:file.url,res:true})
@@ -589,7 +687,7 @@
       },
       fileUpload(){
       //   var file = params.file;
          var formData = new FormData();
          //this.$refs.upload1.submit();
       //   alert(this.uploadFileList1.length)
@@ -597,42 +695,46 @@
          if(this.uploadFileList1.length==0){
               this.$modal.msgSuccess("文档上传列表不能为空!");
               return}
          this.uploadFileList1.forEach((elem)=>{
             formData.append("files", elem)
          })
          console.log(this.uploadFileList1)
          let _this = this
          this.uploading = true;
          uploadPic(formData).then(response => {
          _this.uploadFileList1 = []
         // alert(response.fileNames)
         // alert(_this.formData.url)
            _this.formData.url = _this.formData.url+","+response.fileNames
              updateDoctor(_this.formData).then(response => {
                this.$modal.msgSuccess("文档上传成功");
                // this.open = false;
              this.getData()
              this.fileListOther1=[]
              });
            })
       },
       picUpload()
       {
          var formData = new FormData();
          //this.$refs.upload.submit();
          //alert(this.uploadFileList.length)
       if(this.uploadFileList.length==0){
            this.$modal.msgSuccess("图像上传列表不能为空!");
            return}
          this.uploadFileList.forEach((elem)=>{
             formData.append("files", elem)
          })
          let _this = this
            uploadPic(formData).then(response => {
             // console.log(response.originalFilenames)
             // console.log(response.urls)
@@ -659,12 +761,12 @@
              updateDoctor(_this.formData).then(response => {
                _this.$modal.msgSuccess("图片上传成功");
                // this.open = false;
              });
            // }
            // else{
            //   _this.fileListOther.push({name:response.data.fileName, url:response.data.url})
            // }
          });
       },
@@ -672,10 +774,10 @@
        {
       //  alert(124)
    //    this.uploadFileList.push(params.file);
         //alert(34)
        },
        requestUpload1(params)
        {
@@ -714,4 +816,7 @@
.form{
  background:center/11% no-repeat url('../../assets/icons/form.png') ;
}
/* /deep/ .el-input__inner{
          height: 72px;
        } */
</style>