linwenling
2023-09-25 6f6e804a48c822f339e1974cfe482bc2f60227a3
ruoyi-ui/src/views/pet/petInfo.vue
@@ -1,8 +1,23 @@
<template>
  <div class="app-container">
  <div class="app-container"  id="printable-content">
    <div class="form-header mt">
      <h4 class="dt h4">基本信息 </h4>
      <el-button type="primary"  @click="Petnote(pid)" :disabled="btn">魅宠备忘录</el-button>
      <!-- <h4 class="dt h4">基本信息 </h4>
      <el-button type="primary"  @click="Petnote(pid)" :disabled="btn">魅宠备忘录</el-button> -->
      <h1 style="font-size:21px;padding-top:30px;display: flex;justify-content: space-between;align-items: center;">
        <span>基本信息</span>
        <div   style="display: flex; align-items: center;">
          <el-button size="mini" type="text"  @click="Petnote(pid)" v-hasPermi="['person:information:memo']">
            <div class="form" ><el-icon  style="padding-right:110px;"></el-icon>
              <span class="text" style="width: 69px;height: 26px;font-size: 16px;
            font-family: Microsoft YaHei-Regular, Microsoft YaHei; color: #EBA4AA;">魅宠备忘录</span></div>
          </el-button>
          <el-button size="mini" type="text"  v-print="'#printable-content'" v-hasPermi="['person:information:memo']">
            <div class="form" ><el-icon  style="padding-right:110px;"></el-icon>
              <span class="text" style="width: 69px;height: 26px;font-size: 16px;
            font-family: Microsoft YaHei-Regular, Microsoft YaHei; color: #EBA4AA;">打印</span></div>
          </el-button>
        </div>
      </h1>
    </div>
    <h2 style="width: 100px;height: 16px;font-size: 15px;font-family: Microsoft YaHei-Regular, Microsoft YaHei;font-weight: 400;color: #000000;line-height: 15px;">基本信息</h2>
    <el-container >
@@ -124,7 +139,7 @@
              </el-avatar>
            </el-col>
          </div>
          <el-button  v-if="isShow" type="primary" @click="submitForm" :disabled="dsb">修改魅宠信息</el-button>
        </el-col>
      </div>
    </el-container>
@@ -194,12 +209,20 @@
                :src="'http://47.93.189.255:8080/'+ petList.fullPicture"
                :fit="fit" style="width: 100%;height: 100%;border-radius: 0px 0px 0px 0px;opacity: 1;border: 1px solid rgba(0,0,0,0.5);"
              ></el-image>
              <el-upload class="upload-demo" action="/uploadImage" :on-success="handleUploadSuccess">
                <el-button slot="trigger">点击上传新图片</el-button>
              </el-upload>
            </el-avatar>
          </el-col>
        </div>
        <el-button  v-if="isShow" type="primary" @click="submitForm" :disabled="dsb">修改魅宠信息</el-button>
        <el-button>修改</el-button>
      </el-col>
    </div>
    <el-dialog  :visible.sync="dialogVisible">
      <img w-full :src="dialogImageUrl" alt="Preview Image" />
@@ -317,7 +340,7 @@
  </div>
</template>
<script>
import {getPetList, getPetowner, listPetnote,getPetnoteList,uploadPic, download,updatePetowner,updatePet,addPetnote} from "@/api/pet/index";
import {getPetList, listPetnote,uploadPic, download,updatePet} from "@/api/pet/index";
import {addRole, updateRole} from "@/api/system/role";
import {blobValidate} from "@/utils/ruoyi";
import errorCode from "@/utils/errorCode";
@@ -352,8 +375,6 @@
        happenEndTime:undefined
      },
      pid:undefined,
      dsb:true,
      btn:false,
      title: '魅宠备忘录',
      openDataScope: false,
      PetNoteList:{
@@ -374,17 +395,7 @@
        remark: undefined,
        url: undefined,
      },
      petownerList: {
        email: undefined,
        name: undefined,
        certificateType: undefined,
        certificateNo: undefined,
        fixedNo:undefined,
        many:undefined,
        phoneNo:undefined,
        address: undefined,
        property: undefined,
      },
      dialogImageUrl: '',
      dialogVisible: false,
      disabled: false,
@@ -424,7 +435,7 @@
  computed: {},
  watch: {},
  created() {
    const id = this.$route.params && this.$route.params.pid;
    const id = this.$route.params && this.$route.params.id;
    this.pid = id;
    let jd;
    if(this.$route.query.detail!=undefined)
@@ -438,6 +449,7 @@
    else{
      document.title = "查看魅宠详细信息";
      this.$route.meta.title = "查看魅宠详细信息";//列表的名称
      this.btn = false;
    }
    let _this = this
@@ -446,12 +458,13 @@
      this.loading = true;
      getPetList(id).then((response) => {
        this.petList = response.data;
        console.log(this.petList)
        this.loading = false;
      });
      getPetowner(id).then((response) => {
        this.petownerList = response.data;
        this.loading = false;
      });
      // getPetowner(id).then((response) => {
      //   this.petownerList = response.data;
      //   this.loading = false;
      // });
    }
@@ -470,39 +483,68 @@
      listPetnote(this.queryParams).then(response => {
          //  alert(123)
          //   console.log(response.data)
          console.log(response.data)
          this.PetNoteList = response.data.data;
          this.total = response.data.total;
          this.loading = false;
        }
      );
    },
    submitForm() {
      let ul = this.fileList.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      }).join(",")
      let uls = this.fileListOther.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      }).join(",")
      this.petList.url = ul+","+uls
    requestUpload(params)
    {
      var file = params.file;
      var formData = new FormData();
      this.$refs['elForm'].validate(valid => {
      formData.append('uploadFile', file);
      let _this = this
        if (valid) {
          if (this.petList.id != undefined) {
            updatePet(this.petList).then(response => {
              this.$modal.msgSuccess("修改成功");
              // this.open = false;
              this.btn=false
            });
          } else {
            this.$modal.msgSuccess("修改失败");
          }
        }
      uploadPic(formData).then(response => {
        let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length)
        _this.fileList1.push({name:response.data.fileName, url:response.data.url})
        console("ok")
      })
    },
    requestUpload2(params)
    {
      var file = params.file;
      var formData = new FormData();
      formData.append('uploadFile', file);
      let _this = this
      uploadPic(formData).then(response => {
        let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length)
        _this.fileList2.push({name:response.data.fileName, url:response.data.url})
        console("ok")
      })
    },
    submitForm() {
      let ul = this.fileList1.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      }).join(",")
      let uls = this.fileList2.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      }).join(",")
      this.petList.headPicture = ul,
        this.petList.fullPicture = uls,
        this.$refs['elForm'].validate(valid => {
          if (valid) {
            if (this.petList.id != undefined) {
              updatePet(this.petList).then(response => {
                this.$modal.msgSuccess("修改成功");
                // this.open = false;
                this.btn=false
              });
            } else {
              this.$modal.msgSuccess("修改失败");
            }
          }
        })
    },
@@ -545,8 +587,9 @@
    /** 备忘录 */
    Petnote(pid){
      this.openDataScope = true
      this.getList()
      const id = this.$route.params && this.$route.params.id;
      this.$router.push("/familymodel/pet/petnote/" + id );
    },
    handlePictureCardPreview(file) {
      this.dialogFileUrl = file.url;
@@ -615,7 +658,6 @@
  }
}
</script>
<style scoped lang="scss">
.mt
@@ -626,6 +668,12 @@
  display: block;
}
.hide .el-upload--picture-card {
  display: none;
}
.form{
  background:center/11% no-repeat url('../../assets/icons/form.png') ;
}
.pt{
  right: 50px;
  top:-3px;