feige
2023-11-10 bcac500a760877dc9140f1f381739793706c1af6
ruoyi-ui/src/views/healthy/index.vue
@@ -1,11 +1,15 @@
<template>
  <div class="app-container" style="opacity: 1;">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
      <el-form-item label="体检时间"  prop="checkTime">
      <el-form-item label="看病时间"  prop="checkTime">
        <el-date-picker
          v-model="dateRange"
          style="width: 240px;"
          style="width: 200px;
                   height: 35px;
                   border-radius: 16px 16px 16px 16px;
                   opacity: 0.5;"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
@@ -18,29 +22,40 @@
          v-model="queryParams.hospital"
          placeholder="请输入就病医院"
          clearable
          style="width: 240px"
          style="width: 200px;
                   height: 35px;
                   border-radius: 16px 16px 16px 16px;
                   opacity: 0.5;"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="类别" prop="type">
        <el-input
          v-model="queryParams.type"
          placeholder="请输入类别"
          clearable
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="题名" prop="title">
        <el-input
          v-model="queryParams.title"
          placeholder="请输入题名"
          clearable
          style="width: 240px"
          style="width: 200px;
                   height: 35px;
                   border-radius: 16px 16px 16px 16px;
                   opacity: 0.5;"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
        <el-button size="mini" type="text" @click="toYearhealthy" v-hasPermi="['person:healthy:healthYear']">
          <div class="form1" ><el-icon  style="padding-right:100px;"></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" @click="toExamination" v-hasPermi="['person:healthy:healthYear']">
        <div class="form2" ><el-icon  style="padding-right:50px;"></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-form-item>
        <el-button  size="mini" @click="handleQuery" style=" width: 65px; height: 32px;background: #FFDDE3;border-radius:6px 6px 6px 6px;opacity:1;">搜索</el-button>
        <el-button  size="mini" @click="resetQuery" style=" width: 65px;height: 32px; background: #FFDDE3; border-radius:6px 6px 6px 6px;opacity: 1;">重置</el-button>
@@ -86,7 +101,7 @@
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          @click="handleExportTemplate"
          v-hasPermi="['family:note:export']"
        >导入模板下载</el-button>
      </el-col>
@@ -99,7 +114,7 @@
        >
          <el-button size="mini"   type="primary"
                     plain
                     icon="el-icon-plus" >导入</el-button>
                 icon="el-icon-top">导入</el-button>
        </el-upload>
      </el-col>
@@ -110,16 +125,16 @@
      <el-table-column type="selection" width="55"  align="center" />
      <el-table-column  label="序号" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="120"/>
      <el-table-column label="体检时间" prop="checkTime" sortable width="150" align="center">
      <el-table-column label="看病时间" prop="checkTime" sortable width="200" align="center">
        <template slot-scope="scope">{{scope.row.checkTime? scope.row.checkTime: '————'}}</template>
      </el-table-column>
      <el-table-column label="类别" prop="type" sortable width="120" />
      <el-table-column label="就病医院" prop="hospital" sortable width="120" >
      </el-table-column>
      <el-table-column label="题名" prop="title" sortable width="150" />
      <el-table-column label="注意事项" prop="notice" sortable width="150" />
      <el-table-column label="体检报告(电子文件)" prop="url" align="center" sortable  width="200" >
      <el-table-column label="电子文件" prop="url" align="center" sortable  width="150" >
        <template slot-scope="scope" >
          <div  @click="handleCheck(scope.row)">
            <img
@@ -146,8 +161,9 @@
      <el-table-column label="备注" prop="remark" sortable width="120" >
        <template slot-scope="scope">{{scope.row.remark? scope.row.remark: '————'}}</template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
      <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width">
        <template slot-scope="scope" v-if="scope.row.roleId !== 1">
          <div class="button-container">
          <el-button
            size="mini"
            type="text"
@@ -162,10 +178,11 @@
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:role:remove']"
          >删除</el-button>
          <!-- <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['familymodel:economy:info']">
          <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['familymodel:bignote:list']">
            <el-button size="mini" type="text" icon="el-icon-d-arrow-right"  @click="handleCheck(scope.row)">查看详情</el-button>
          </el-dropdown> -->
          </el-dropdown>
          </div>
        </template>
      </el-table-column>
    </el-table>
@@ -183,18 +200,13 @@
      <el-form ref="elForm" :model="formDat" :rules="rules" size="medium" label-width="100px">
        <el-form-item label="体检时间" prop="checkTime">
          <el-input
            v-model='formDat.checkTime'
            type='date'
            placeholder='选择日期'
          ></el-input>
        <el-form-item label="发生时间" prop="checkTime">
          <el-date-picker v-model="formDat.checkTime" type="date" placeholder="请选择日期"
                          :editable="false" :clearable="false" :style="{width: '100%'}"  value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="类别" prop="type">
          <el-input v-model="formDat.type" placeholder="请输入类别" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="就病医院" prop="hospital">
          <el-input v-model="formDat.hospital" placeholder="请输入就病医院" clearable :style="{width: '100%'}" >
          </el-input>
@@ -221,12 +233,12 @@
          :http-request="requestUpload"
          :file-list="fileList"
        >
          <div v-if="uploading" class="upload-status">正在上传...</div>
          <i v-if="!uploading" slot="default" class="el-icon-plus"></i>
          <i slot="default" class="el-icon-plus"></i>
          <div slot="file" slot-scope="{file}">
            <img
              class="el-upload-list__item-thumbnail"
              :src="file.url"
              alt=""
              style="width: 126px; height: 126px"
              fit="cover"
@@ -294,7 +306,8 @@
//在system/note/index.js中导入接口函数  --接好了
import {listHealth,enload,delHealth,getHealthInfo, addHealth, uploadPic} from "@/api/healthy/index";
import {listHealth,enload,delHealth,uploadPic, addHealth} from "@/api/healthy/index";
import {Message} from "element-ui";
export default {
  name: "Role",
@@ -333,12 +346,9 @@
      fot:[".jpg",".jif"],
      fileList:[
      ],
      fileListOther:[
      ],
      fileListOther:[ ],
      dsb:true,
      btn:false,
      uploading: false,
      formDat: {
        type: undefined,
        createTime: undefined,
@@ -362,6 +372,15 @@
        checkTime:undefined,
      },
      healthList:{
        checkTime:undefined,
        type:undefined,
        hospital:undefined,
        title:undefined,
        notice:undefined,
        remark:undefined,
        url:undefined
      },
      // 表单参数
      form: {},
      defaultProps: {
@@ -370,40 +389,31 @@
      },
      // 表单校验
      rules: {
        usePeople: [{
        title: [{
          required: true,
          message: '请输入使用人',
          message: '请输入标题',
          trigger: 'blur'
        }],
        useFor: [{
        hospital: [{
          required: true,
          message: '请输入用途',
          message: '请输入就病医院',
          trigger: 'blur'
        }],
        type: [{
          required: true,
          message: '请输入台账内容',
          message: '请输入类别',
          trigger: 'blur'
        }],
        balance: [{
        checkTime: [{
          required: true,
          message: '请输入金额',
          message: '选择体检时间',
          trigger: 'blur'
        }],
        kind: [{
          // required: true,
          message: '请输入支付方式',
          trigger: 'blur'
        }],
        createTime: [{
        notice: [{
          required: true,
          message: '请选择日期选择',
          trigger: 'change'
        }],
        price: [{
          required: true,
          message: '请选择事项内容',
          message: '请输入注意事项',
          trigger: 'blur'
        }],
      },
@@ -425,7 +435,7 @@
    },
    //隔行变色
    tableRowClassName({ row, rowIndex }) {
    tableRowClassName({row, rowIndex}) {
      if (rowIndex % 2 == 0) {
        return "statistics-warning-row1";
      } else {
@@ -455,17 +465,15 @@
      );
    },
    handleRemove(file) {
      for(let i = 0; i < this.fileList.length; i++)
      {
        if(this.fileList[i].url==file.url)
          this.$delete(this.fileList,i);
      for (let i = 0; i < this.fileList.length; i++) {
        if (this.fileList[i].url == file.url)
          this.$delete(this.fileList, i);
      }
    },
    handleRemoveFile(file) {
      for(let i = 0; i < this.fileListOther.length; i++)
      {
        if(this.fileListOther[i].url==file.url)
          this.$delete(this.fileListOther,i);
      for (let i = 0; i < this.fileListOther.length; i++) {
        if (this.fileListOther[i].url == file.url)
          this.$delete(this.fileListOther, i);
      }
    },
@@ -517,7 +525,7 @@
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      console.log(this.ids)
      this.single = selection.length!=1
      this.single = selection.length != 1
      this.multiple = !selection.length
    },
@@ -530,7 +538,7 @@
    /** 查看详细信息 */
    handleCheck(row){
    handleCheck(row) {
      const id = row.id;
      this.$router.push("/self/healthy/healthyInfo/" + id);
    },
@@ -540,70 +548,65 @@
      let jd = true
      this.$router.push({
        path:"/self/healthy/healthyInfo/" + id,
        query:{
          detail:jd
        path: "/self/healthy/healthyInfo/" + id,
        query: {
          detail: jd
        }
      });
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    /** 提交按钮(数据权限) */
    submitDataScope: function() {
    submitDataScope: function () {
      let ul = this.fileList.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      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,"")
      let uls = this.fileListOther.map(function (elem) {
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API, "")
      }).join(",")
      this.formDat.url = ul+","+uls
      this.formDat.url = ul + "," + uls
      this.$refs["elForm"].validate(valid => {
        if (valid) {
          addHealth(this.formDat).then(response => {
            this.$modal.msgSuccess("新增成功");
            this.open = false;
            this.getList();
            // 清空formDat对象的数据
            Object.keys(this.formDat).forEach(key => {
              this.formDat[key] = '';
            });
            for (let i = 0; i <= this.fileList.length; i++) {
              this.handleRemove(this.fileList[0]);
            }
            for (let i = 0; i < this.fileListOther.length; i++) {
              this.handleRemoveFile(this.fileListOther[0]);
            }
          });
        }
      });
      // 清空formDat对象的数据
      Object.keys(this.formDat).forEach(key => {
        this.formDat[key] = '';
      });
      for(let i = 0; i <= this.fileList.length; i++)
      {
        this.handleRemove(this.fileList[0]);
      }
      for(let i = 0; i < this.fileListOther.length; i++){
        this.handleRemoveFile(this.fileListOther[0]);
      }
    },
    requestUpload(params)
    {
    requestUpload(params) {
      var file = params.file;
      var formData = new FormData();
      formData.append('uploadFile', file);
      let _this = this
      this.uploading = true;
      uploadPic(formData).then(response => {
        let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length)
        this.uploading = false;
        this.$modal.msgSuccess("上传成功");
        if(_this.fot.includes(pth) === true)
        {
          _this.fileList.push({name:response.data.fileName, "url":response.data.url})
        let pth = response.data.originalFilename.substr(response.data.originalFilename.length - 4, response.data.originalFilename.length)
        }
        if (_this.fot.includes(pth) === true) {
          _this.fileList.push({name: response.data.fileName, "url": response.data.url})
        else{
          _this.fileListOther.push({name:response.data.fileName, url:response.data.url})
        } else {
          _this.fileListOther.push({name: response.data.fileName, url: response.data.url})
        }
      })
@@ -612,36 +615,60 @@
    /** 删除按钮操作 */
    handleDelete(row) {
      const Ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除所选数据项?').then(function() {
      this.$modal.confirm('是否确认删除所选数据项?').then(function () {
        return delHealth(Ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
      }).catch(() => {
      });
    },
    //年度健康报告
    toYearhealthy(){
      this.$router.push("/self/healthy/healthYear" );
    },
    //体检表
    toExamination(){
      this.$router.push("/self/healthy/Examination" );
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('/zfEconomy/export', {
        ...this.queryParams
      }, `zfEconomy_${new Date().getTime()}.xlsx`)
    }
  },
  /** 导入操作*/
  handleEnport(params){
    var file = params.file;
    var formData = new FormData();
    formData.append('excelImport', file);
    let _this = this
    alert(file)
    enload(formData).then(response => {
      _this.getList();
      Message({ message: "导入成功", type: 'warning' })
      const Ids = this.ids;
    }).catch(err)
      if (Ids.length == 0) {
        this.download('/zYearInfo/export', {
          ...this.queryParams
        }, `zYearInfo${new Date().getTime()}.xlsx`)
      } else {
        this.download('/zYearInfo/export1/' + Ids, {}, `zYearInfo${new Date().getTime()}.xlsx`)
      }
    },
    /** 导入模板下载操作*/
    handleExportTemplate()
    {
      Message({ message: "导入失败", type: 'error' })
    }
      this.download('/zYearInfo/model', {
      }, `zYearInfo${new Date().getTime()}.xlsx`)
    },
    /** 导入操作*/
    handleEnport(params){
      var file = params.file;
      var formData = new FormData();
      formData.append('excelImport', file);
      let _this = this
      enload(formData).then(response => {
        _this.getList();
        Message({ message: "导入成功", type: 'warning' })
      }).catch(err)
      {
        Message({ message: "导入失败", type: 'error' })
      }
    }
  }
};
@@ -656,4 +683,22 @@
  background: #FFEFF2;
}
.form1 {
  position: absolute;
  right: 60px;
  top:20px;
  background:center/11% no-repeat url('../../assets/icons/form.png') ;
}
.form2 {
  position: absolute;
  right: 200px;
  top:20px;
}
.el-table__cell {
  font-size: 14px; /* 设置字体大小 */
}
.button-container {
  display: inline-flex; /* 设置按钮容器为行内元素 */
}
</style>