linwenling
2023-09-25 6f6e804a48c822f339e1974cfe482bc2f60227a3
ruoyi-ui/src/views/healthy/healthYear.vue
@@ -86,7 +86,7 @@
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          @click="handleExportTemplate"
          v-hasPermi="['family:note:export']"
        >导入模板下载</el-button>
      </el-col>
@@ -162,10 +162,10 @@
            @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>
        </template>
      </el-table-column>
    </el-table>
@@ -294,7 +294,7 @@
//在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";
export default {
  name: "Role",
@@ -359,6 +359,15 @@
        checkTime:undefined,
      },
      healthList:{
        checkTime:undefined,
        type:undefined,
        hospital:undefined,
        title:undefined,
        notice:undefined,
        remark:undefined,
        url:undefined
      },
      // 表单参数
      form: {},
      defaultProps: {
@@ -367,40 +376,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: '请输入金额',
          trigger: 'blur'
        }],
        kind: [{
          // required: true,
          message: '请输入支付方式',
          trigger: 'blur'
        }],
        createTime: [{
          required: true,
          message: '请选择日期选择',
          message: '选择体检时间',
          trigger: 'change'
        }],
        price: [{
        notice: [{
          required: true,
          message: '请选择事项内容',
          message: '请输入注意事项',
          trigger: 'blur'
        }],
      },
@@ -422,7 +422,7 @@
    },
    //隔行变色
    tableRowClassName({ row, rowIndex }) {
    tableRowClassName({row, rowIndex}) {
      if (rowIndex % 2 == 0) {
        return "statistics-warning-row1";
      } else {
@@ -452,17 +452,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);
      }
    },
@@ -514,7 +512,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
    },
@@ -527,7 +525,7 @@
    /** 查看详细信息 */
    handleCheck(row){
    handleCheck(row) {
      const id = row.id;
      this.$router.push("/self/healthy/healthyInfo/" + id);
    },
@@ -537,9 +535,9 @@
      let jd = true
      this.$router.push({
        path:"/self/healthy/healthyInfo/" + id,
        query:{
          detail:jd
        path: "/self/healthy/healthyInfo/" + id,
        query: {
          detail: jd
        }
      });
    },
@@ -550,15 +548,15 @@
      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) {
@@ -573,33 +571,28 @@
      Object.keys(this.formDat).forEach(key => {
        this.formDat[key] = '';
      });
      for(let i = 0; i <= this.fileList.length; i++)
      {
      for (let i = 0; i <= this.fileList.length; i++) {
        this.handleRemove(this.fileList[0]);
      }
      for(let i = 0; i < this.fileListOther.length; i++){
      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
      uploadPic(formData).then(response => {
        let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length)
        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})
        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})
        }
      })
@@ -608,36 +601,50 @@
    /** 删除按钮操作 */
    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(() => {
      });
    },
    /** 导出按钮操作 */
    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('/family/zfEvent/export', {
          ...this.queryParams
        }, `zYearInfo${new Date().getTime()}.xlsx`)
      } else {
        this.download('/family/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
      alert(file)
      enload(formData).then(response => {
        _this.getList();
        Message({message: "导入成功", type: 'warning'})
      }).catch(err)
      {
        Message({message: "导入失败", type: 'error'})
      }
    }
  }
};