zhuo
2025-05-20 7eb190f13437b2e67788e9f4bdea725fdb165f01
src/views/CNAS/process/reportResults/index.vue
@@ -1,24 +1,25 @@
<template>
  <div class="report-results">
    <div class="search">
      <div class="search_thing">
        <div class="search_label">检验报告编号:</div>
        <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="queryParams.insReportCode"
            @keyup.enter.native="refreshTable()"></el-input></div>
  <div class="capacity-scope">
    <div style="display: flex;justify-content: space-between">
      <div style="display: flex;">
        <div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
          <span style="width: 128px;font-size: 14px;font-weight: 700;color: #606266;">检验报告编号</span>
          <el-input size="small" placeholder="请输入" clearable v-model="queryParams.insReportCode"
                    @keyup.enter.native="refreshTable()"></el-input>
        </div>
        <div style="line-height: 30px;">
          <el-button type="primary" size="mini" @click="refreshTable">查询</el-button>
          <el-button size="mini" @click="refresh">重置</el-button>
        </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 class="btn">
        <el-button size="medium" type="primary" @click="handleDown" :loading="outLoading" v-if="outPower">导出</el-button>
        <el-button size="medium" type="primary" @click="openAdd" v-if="addPower">新增</el-button>
      <div style="line-height: 30px;">
        <el-button size="small" type="primary" @click="handleDown" :loading="outLoading" v-if="outPower">导出</el-button>
        <el-button size="small" type="primary" @click="openAdd" v-if="addPower">新增</el-button>
      </div>
    </div>
    <div class="table">
      <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading" :height="'calc(100vh - 270px)'"
        :page="page" @pagination="pagination" :isSelection="true"
        :handleSelectionChange="handleSelectionChange"></lims-table>
        :page="page" @pagination="pagination"></lims-table>
    </div>
    <el-dialog :title="title" :visible.sync="addDialogVisible" width="400px" top="6vh">
      <el-row>
@@ -81,12 +82,8 @@
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">签收人:</div>
            <div class="search_input">
              <el-select v-model="addInfo.signatory" placeholder="请选择" size="small" style="width: 100%;" multiple>
                <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </div>
            <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                                                v-model="addInfo.signatory"></el-input></div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
@@ -118,6 +115,7 @@
  selectUserCondition,
} from "@/api/business/inspectionTask.js";
export default {
  name: 'ReportResults',
  components: {
    limsTable
  },
@@ -129,12 +127,11 @@
      personList: [],
      title: '新增',
      addDialogVisible: false,
      addInfo: {
        signatory: []
      },
      addInfo: {},
      addLoading: false,
      mutilSelect: [],
      queryParams: {},
      queryParams: {
        insReportCode: ''
      },
      tableData: [],
      column: [
        { label: "检验报告编号", prop: "insReportCode" },
@@ -147,7 +144,7 @@
        { label: "发送方式", prop: "method" },
        { label: "发送日期", prop: "sendTime" },
        { label: "发送人", prop: "sendUserName" },
        { label: "签收人", prop: "signatoryName" },
        { label: "签收人", prop: "signatory" },
        { label: "备注", prop: "remark" },
        {
          dataType: "action",
@@ -173,7 +170,7 @@
      ],
      page: {
        total: 0,
        size: 10,
        size: 20,
        current: 0,
      },
      tableLoading: false,
@@ -185,51 +182,17 @@
    this.getAuthorizedPerson()
  },
  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 == 'doProcessReport') {
          up = true
        }
        if (power[i].menuMethod == 'addProcessReport') {
          add = true
        }
        if (power[i].menuMethod == 'delProcessReport') {
          del = true
        }
        if (power[i].menuMethod == 'exportProcessReport') {
          out = true
        }
      }
      if (!up) {
        this.componentData.do.splice(1, 1)
      }
      if (!del) {
        this.componentData.do.splice(0, 1)
      }
      this.outPower = out
      this.addPower = add
    },
    handleDown() {
      if (this.mutilSelect.length == 0) {
        this.$message.warning('请选择要导出的数据')
        return
      }
      this.outLoading = true
      exportProcessReport({ ids: this.mutilSelect.map(m => m.id) }).then(res => {
      exportProcessReport(this.queryParams).then(res => {
        this.outLoading = false
        this.$download.downloadFileFromUrl(res.data, "报告结果");
        const blob = new Blob([res], { type: 'application/msword' });
        this.$download.saveAs(blob, '报告结果' + '.docx');
      })
    },
    openAdd() {
      this.title = '新增'
      this.addInfo = {
        signatory: []
      }
      this.addInfo = {}
      this.addDialogVisible = true;
    },
    getList() {
@@ -262,9 +225,6 @@
      this.page.current = 1;
      this.getList();
    },
    handleSelectionChange(val) {
      this.mutilSelect = val
    },
    getAuthorizedPerson() {
      selectUserCondition().then(res => {
        let data = []
@@ -282,17 +242,11 @@
      delete this.addInfo.createTime
      delete this.addInfo.createUser
      delete this.addInfo.updateTime
      delete this.addInfo.signatoryUrl
      delete this.addInfo.updateUserer
      delete this.addInfo.sendUserName
      let addInfo = this.HaveJson(this.addInfo)
      addInfo.signatory = addInfo.signatory.join(',')
      if (this.title == '新增') {
        addProcessReport(addInfo).then(res => {
        addProcessReport(this.addInfo).then(res => {
          this.addLoading = false
          if (res.code == 201) {
            return
          }
          this.addDialogVisible = false
          this.$message({
            type: 'success',
@@ -301,11 +255,8 @@
          this.refreshTable()
        }).catch(err => { })
      } else {
        doProcessReport(addInfo).then(res => {
        doProcessReport(this.addInfo).then(res => {
          this.addLoading = false
          if (res.code == 201) {
            return
          }
          this.addDialogVisible = false
          this.$message({
            type: 'success',
@@ -319,11 +270,7 @@
      this.title = '修改'
      this.addInfo = row
      console.log(this.addInfo)
      this.addInfo.signatory = this.addInfo.signatory ? this.addInfo.signatory.split(',').map(m => Number(m)) : []
      this.addDialogVisible = true;
    },
    handleChangeTask(list) {
      this.mutilSelect = list
    },
    handleDelete(row) {
      this.$confirm("是否删除该条数据?", "提示", {
@@ -333,7 +280,6 @@
      })
        .then(() => {
          delProcessReport({ id: row.id }).then((res) => {
            if (res.code == 201) return;
            this.$message.success("删除成功");
            this.refresh();
          });
@@ -346,11 +292,9 @@
<style scoped>
.search {
  background-color: #fff;
  height: 80px;
  height: 46px;
  display: flex;
  align-items: center;
  position: relative;
  justify-content: space-between;
}
.search_thing {
@@ -367,41 +311,5 @@
.search_input {
  width: calc(100% - 110px);
}
.table {
  background-color: #fff;
  height: calc(100% - 60px - 80px - 10px - 40px);
  padding: 20px;
}
.tables {
  table-layout: fixed;
  width: 100%;
}
.tables td {
  height: 40px;
  width: 100px;
  text-align: center;
  font-size: 14px;
  word-wrap: break-word;
  white-space: normal;
}
.en {
  font-size: 12px;
  word-break: break-word;
  /* 自动断行 */
  overflow-wrap: break-word;
  /* 防止溢出 */
  white-space: normal;
  /* 默认换行 */
}
.btn {
  position: absolute;
  top: 16px;
  right: 20px;
}
</style>