licp
2024-12-19 65e40330a1d3acf001a3998cdda4dba0b3b5405c
完成7.6测量不确定度的评定
已修改1个文件
已添加1个文件
303 ■■■■■ 文件已修改
src/assets/api/controller.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/a7-uncertainty-evaluation.vue 293 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/api/controller.js
@@ -58,6 +58,7 @@
    processMethodVerify,
    processSample,
    processTotaldeal,
    processEvaluate,
  }
}
@@ -753,3 +754,12 @@
  doProcessDeal:'/processDeal/doProcessDeal',//修改
  getProcessDeal:'/processDeal/getProcessDeal',// æŸ¥çœ‹ ä¼ å‚id
}
// 7.6测量不确定度的评定
const processEvaluate = {
  pageProcessEvaluate:'/processEvaluate/pageProcessEvaluate',//分页
  addProcessEvaluate:'/processEvaluate/addProcessEvaluate',//新增(新增上传一个文件就好了)
  doProcessEvaluate:'/processEvaluate/doProcessEvaluate',//填写 (主要上传id和备注note就好了)
  delProcessEvaluate:'/processEvaluate/delProcessEvaluate',//删除  ä¼ å‚id
  exportProcessEvaluate:'/processEvaluate/exportProcessEvaluate',//导出
}
src/components/view/a7-uncertainty-evaluation.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,293 @@
<template>
  <div class="uncertainty-evaluation">
    <el-row class="title">
      <el-col :span="20" style="padding-left: 20px;text-align: left;">测量不确定度的评定</el-col>
      <el-col :span="4" style="display: flex;align-items: center;justify-content: end;">
        <el-button size="medium" type="primary" @click="handleDown0" :loading="outLoading" style="margin-right: 16px;margin-top: 3px;" v-if="outPower">导出</el-button>
        <el-upload :action="action" :show-file-list="false"
        accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' :headers="headers" :on-change="beforeUpload"
        :on-error="onError" ref='upload' v-if="addPower" :on-success="handleSuccessUp">
        <el-button size="medium" type="primary" :loading="upLoading">导入</el-button></el-upload>
      </el-col>
    </el-row>
    <div class="search">
      <div class="search_thing">
        <div class="search_label">报告名称:</div>
        <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.reportName"
            @keyup.enter.native="refreshTable()"></el-input></div>
      </div>
      <div class="search_thing" style="padding-left: 30px;">
        <el-button size="small" @click="refresh()">重 ç½®</el-button>
        <el-button size="small" type="primary" @click="refreshTable()">查 è¯¢</el-button>
      </div>
    </div>
    <div class="table">
      <ValueTable ref="ValueTable" :url="$api.processEvaluate.pageProcessEvaluate"
        :delUrl="$api.processEvaluate.delProcessEvaluate"
        :componentData="componentData" :key="upIndex"/>
    </div>
    <el-dialog
      title="评价"
      :visible.sync="addDialogVisible"
      width="400px">
      <el-row>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">评价:</div>
            <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.note"></el-input></div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">日期:</div>
            <div class="search_input">
              <el-date-picker
                v-model="addInfo.evaluateTime"
                type="date"
                size="small"
                placeholder="选择日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd" style="width: 100%;">
              </el-date-picker>
            </div>
          </div>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addDialogVisible = false">取 æ¶ˆ</el-button>
        <el-button type="primary" @click="handleAdd" :loading="addLoading">ç¡® å®š</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="查看附件"
      :visible.sync="lookDialogVisible"
      width="800px" top="5vh" fullscreen>
      <filePreview v-if="lookDialogVisible" :fileUrl="javaApi+'/word/'+currentInfo.reportUrl"
      :currentFile="{}" style="max-height: 90vh;overflow-y: auto;"/>
    </el-dialog>
  </div>
</template>
<script>
import ValueTable from '../tool/value-table.vue'
import filePreview from '../tool/file-preview.vue'
export default {
  components: {
    ValueTable,
    filePreview
  },
  data() {
    return {
      addPower:false,
      outPower:false,
      outLoading:false,
      componentData: {
          entity: {
            reportName: null,
            orderBy: {
              field: 'createTime',
              order: 'desc'
            }
          },
          isIndex: true,
          showSelect: false,
          select: false,
          do: [{
            id: 'handleTell',
            font: '评价',
            type: 'text',
            method: 'handleTell',
          }, {
            id: 'delete',
            font: '删除',
            type: 'text',
            method: 'doDiy'
          }, {
            id: 'handleDown',
            font: '下载',
            type: 'text',
            method: 'handleDown'
          }, {
            id: 'handleLook',
            font: '查看附件',
            type: 'text',
            method: 'handleLook'
          }],
          tagField: {},
          selectField: {},
          requiredAdd: [],
          requiredUp: [],
          needSort: [],
          inputType: ''
      },
      entityCopy: {},
      upIndex: 0,
      upLoading:false,
      addDialogVisible:false,
      addInfo:{},
      addLoading:false,
      currentInfo:{},
      lookDialogVisible:false,
    }
  },
  // ç”¨äºŽä¸Šä¼ æ–‡ä»¶çš„信息
  computed: {
    headers() {
      return {
        'token': sessionStorage.getItem('token')
      }
    },
    action() {
      return this.javaApi + this.$api.processEvaluate.addProcessEvaluate
    }
  },
  mounted() {
    this.entityCopy = this.HaveJson(this.componentData.entity);
    this.getPower()
  },
  methods: {
    getPower(){
      let power = JSON.parse(sessionStorage.getItem('power'))
      let up = false
      let del = false
      let add = false
      let out = false
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == 'doProcessEvaluate') {
          up = true
        }
        if (power[i].menuMethod == 'addProcessEvaluate') {
          add = true
        }
        if (power[i].menuMethod == 'delProcessEvaluate') {
          del = true
        }
        if (power[i].menuMethod == 'exportProcessEvaluate') {
          out = true
        }
      }
      if (!del) {
        this.componentData.do.splice(1, 1)
      }
      if (!up) {
        this.componentData.do.splice(0, 1)
      }
      this.outPower = out
      this.addPower = add
    },
    handleDown0(){
      this.outLoading = true
      this.$axios.post(this.$api.processEvaluate.exportProcessEvaluate,{entity:{reportName:this.componentData.entity.reportName}},{responseType: "blob",headers: { 'Content-Type': 'application/json' }}).then(res => {
        this.outLoading = false
        if (res.code === 201) return
        this.$message.success('导出成功')
        const blob = new Blob([res],{ type: 'application/octet-stream' });
        const url = URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.href = url;
        link.download = '测量不确定度的评定.xlsx';
        link.click();
      })
    },
    handleDown(row) {
      let url = this.javaApi+'/word/'+row.reportUrl
      const link = document.createElement('a');
      link.href = url;
      link.download = row.reportName;
      link.click();
    },
    beforeUpload(file) {
      if (file.size > 1024 * 1024 * 10) {
        this.$message.error('上传文件不超过10M');
        this.$refs.upload.clearFiles()
        return false;
      } else {
        // this.upLoading = true;
        return true;
      }
    },
    onError(err, file, fileList) {
      this.$message.error('上传失败')
      this.$refs.upload.clearFiles()
    },
    handleSuccessUp(response) {
      this.upLoading = false;
      if (response.code == 200) {
        this.$message.success('上传成功');
        this.refreshTable()
      }
    },
    handleTell(row){
      this.addInfo = row;
      this.addDialogVisible = true;
    },
    handleAdd(){
      this.addLoading = true;
      this.$axios.post(this.$api.processEvaluate.doProcessEvaluate, {
        id:this.addInfo.id,
        note:this.addInfo.note,
        evaluateTime:this.addInfo.evaluateTime,
        evaluateUser:JSON.parse(localStorage.getItem("user")).userId
      },{headers: { 'Content-Type': 'application/json' }}).then((res) => {
        this.addLoading = false;
        if(res.code==201){
          this.$message.error('评价失败');
          return;
        }
        this.$message.success('评价成功');
        this.addDialogVisible = false;
        this.refreshTable()
    })
    },
    refreshTable() {
      this.$refs['ValueTable'].selectList()
    },
    refresh() {
      this.componentData.entity = this.HaveJson(this.entityCopy)
      this.upIndex++
      this.refreshTable()
    },
    handleLook(row){
      this.currentInfo = row;
      this.lookDialogVisible = true;
    }
  }
}
</script>
<style scoped>
.title {
    height: 60px;
    line-height: 60px;
  }
  .search {
    background-color: #fff;
    height: 80px;
    display: flex;
    align-items: center;
  }
  .search_thing {
    width: 350px;
    display: flex;
    align-items: center;
  }
  .search_label {
    width: 80px;
    font-size: 14px;
    text-align: right;
  }
  .search_input {
    width: calc(100% - 80px);
  }
  .table {
    margin-top: 10px;
    background-color: #fff;
    width: calc(100% - 40px);
    height: calc(100% - 60px - 80px - 10px - 40px);
    padding: 20px;
  }
</style>