spring
2025-02-25 a1fddf659da7d3ad8b5280cb76071eae50a86d46
Merge branch 'dev' of http://114.132.189.42:9002/r/lims-ruoyi-before into dev
已修改1个文件
已添加14个文件
3654 ■■■■■ 文件已修改
src/api/business/productSamplingInfo.js 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/cnas/resourceDemand/facilitiesEnvironment/internalWastes.js 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/Personnel-management-dia.vue 211 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/Personnel-management.vue 261 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions.vue 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue 414 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue 288 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/power-supply-stability.vue 403 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/temperature-humidity-record.vue 483 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/three-wastes-dialog.vue 189 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/three-wastes-treatment.vue 202 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/facilitiesEnvironment/index.vue 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/standardMaterial/index.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/productSamplingInfo/components/addQuarterItem.vue 290 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/productSamplingInfo/index.vue 647 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/business/productSamplingInfo.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,101 @@
// æŠ½æ ·ä¿¡æ¯è¯¦æƒ…页面相关接口
import request from '@/utils/request'
// æŠ½æ ·ä¿¡æ¯-季度查询
export function getQuarterPage(query) {
  return request({
    url: '/finishProductSpotCheck/getQuarterPage',
    method: 'get',
    params: query
  })
}
// æŠ½æ ·ä¿¡æ¯-年度查询
export function getSpotCheckYearPage(query) {
  return request({
    url: '/finishProductSpotCheck/getSpotCheckYearPage',
    method: 'get',
    params: query
  })
}
// åˆ é™¤å­£åº¦æŠ½æ£€
export function deleteQuarter(query) {
  return request({
    url: '/finishProductSpotCheck/deleteQuarter',
    method: 'delete',
    params: query
  })
}
// ç”Ÿæˆå­£åº¦æŠ¥å‘Š
export function finalReportQuarter(query) {
  return request({
    url: '/finishProductSpotCheck/finalReportQuarter',
    method: 'get',
    params: query,
    responseType: "blob"
  })
}
// ç”Ÿæˆå¹´åº¦æŠ¥å‘Š
export function finalReportSpotCheckYear(query) {
  return request({
    url: '/finishProductSpotCheck/finalReportSpotCheckYear',
    method: 'get',
    params: query,
    responseType: "blob"
  })
}
// åˆ é™¤å¹´åº¦æŠ½æ£€
export function deleteSpotCheckYear(query) {
  return request({
    url: '/finishProductSpotCheck/deleteSpotCheckYear',
    method: 'delete',
    params: query,
  })
}
// å¹´åº¦æŠ½æ£€æŸ¥çœ‹è¯¦æƒ…
export function getSpotCheckYear(query) {
  return request({
    url: '/finishProductSpotCheck/getSpotCheckYear',
    method: 'get',
    params: query,
  })
}
// æäº¤å¹´åº¦æŠ½æ ·
export function addSpotCheckYear(query) {
  return request({
    url: '/finishProductSpotCheck/addSpotCheckYear',
    method: 'post',
    data: query,
  })
}
// ç¼–辑年度抽样
export function updateSpotCheckYear(query) {
  return request({
    url: '/finishProductSpotCheck/updateSpotCheckYear',
    method: 'post',
    data: query,
  })
}
// å­£åº¦æŠ½æ£€æŸ¥çœ‹è¯¦æƒ…
export function getQuarter(query) {
  return request({
    url: '/finishProductSpotCheck/getQuarter',
    method: 'get',
    params: query,
  })
}
// æäº¤å­£åº¦æŠ½æ ·
export function addQuarter(query) {
  return request({
    url: '/finishProductSpotCheck/addQuarter',
    method: 'post',
    data : query,
  })
}
// ç¼–辑季度检验
export function updateQuarterOnOrder(query) {
  return request({
    url: '/finishProductSpotCheck/updateQuarterOnOrder',
    method: 'post',
    data : query,
  })
}
src/api/cnas/resourceDemand/facilitiesEnvironment/internalWastes.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,56 @@
import request from '@/utils/request'
// å®‰å…¨å†…务三废处理分页查询
export function pageInternalWastes(query) {
  return request({
    url: '/internalWastes/pageInternalWastes',
    method: 'get',
    params: query
  })
}
// å®‰å…¨å†…务三废处理查看详情
export function getInternalWastesOne(query) {
  return request({
    url: '/internalWastes/getInternalWastesOne',
    method: 'get',
    params: query
  })
}
// å®‰å…¨å†…务三废处理新增
export function addInternalWastes(query) {
  return request({
    url: '/internalWastes/addInternalWastes',
    method: 'post',
    data: query
  })
}
// å®‰å…¨å†…务三废处理分页修改
export function updateInternalWastes(query) {
  return request({
    url: '/internalWastes/updateInternalWastes',
    method: 'post',
    data: query
  })
}
// å¯¼å‡ºä¸‰åºŸå¤„理
export function exportInternalWastes(query) {
  return request({
    url: "/internalWastes/exportInternalWastes",
    method: "get",
    responseType: "blob",
    params: query,
  });
}
//安全内务三废处理删除
export function removeStandardSubstance(query) {
  return request({
    url: '/internalWastes/delInternalWastes',
    method: 'delete',
    params: query
  })
}
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/Personnel-management-dia.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,211 @@
<template>
  <div>
    <el-dialog v-loading="diaLoading" :close-on-click-modal="false"
               :close-on-press-escape="false"
               :visible.sync="formDia"
               title="外来人员管理信息"
               width="80%" @close="closeThreeWastesDia">
      <el-form ref="form" :model="form" :rules="rules" label-width="auto">
        <el-col :span="12">
          <el-form-item label="日期" prop="registerDate">
            <el-date-picker v-model="form.registerDate"
                            clearable
                            format="yyyy-MM-dd"
                            placeholder="选择日期"
                            size="small"
                            type="date"
                            value-format="yyyy-MM-dd">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="进入区域" prop="area">
            <el-input v-model="form.area" clearable size="small"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="进入人员" prop="personnel">
            <el-input v-model="form.personnel" clearable size="small"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="进入原因" prop="reason">
            <el-input v-model="form.reason" clearable size="small"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="陪同人员" prop="accompanyingId">
            <el-select v-model="form.accompanyingId" clearable filterable
                       placeholder="请选择陪同人员" size="small">
              <el-option v-for="(item,i) in personList" :key="i" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="批准人签名" prop="approveId">
            <el-select v-model="form.approveId" clearable filterable
                       placeholder="请选择批准人" size="small">
              <el-option v-for="(item,i) in personList" :key="i" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="保密及其它情况" prop="confidentiality">
            <el-input v-model="form.confidentiality" clearable size="small"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="备注" prop="remark">
            <el-input v-model="form.remark" clearable size="small"></el-input>
          </el-form-item>
        </el-col>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeThreeWastesDia">取 æ¶ˆ</el-button>
        <el-button :loading="loading" type="primary" @click="handleEdit">提 äº¤</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: 'Personnel-management-dia',
  // import å¼•入的组件需要注入到对象中才能使用
  components: {},
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      formDia: false,
      diaLoading: false,
      loading: false,
      form: {
        registerDate: '',
        area: '',
        personnel: '',
        reason: '',
        accompanyingId: '',
        accompanyingName: '',
        approveId: '',
        approveName: '',
        confidentiality: '',
        remark: '',
      },
      rules: {
        registerDate: [{required: true, message: '请选择日期',trigger: 'change'}],
        area: [{required: true, message: '请填写进入区域',trigger: 'blur'}],
        personnel: [{required: true, message: '请填写进入人员',trigger: 'blur'}],
        reason: [{required: true, message: '请填写进入原因',trigger: 'blur'}],
        accompanyingId: [{required: true, message: '请选择陪同人员',trigger: 'change'}],
        approveId: [{required: true, message: '请选择批准人',trigger: 'change'}],
        confidentiality: [{required: true, message: '请填写保密及其他情况',trigger: 'blur'}],
        remark: [{required: false, message: '请填写备注',trigger: 'blur'}],
      },
      operationType: '',
      personList: []
    };
  },
  mounted() {
  },
  // æ–¹æ³•集合
  methods: {
    // æ‰“开弹框
    openDia (type, row) {
      this.getAuthorizedPerson()
      this.formDia = true
      this.operationType = type
      if (type !== 'add') {
        this.searchInfo(row)
      } else {
        this.form.accompanyingId = JSON.parse(localStorage.getItem("user")).userId
      }
    },
    // æŸ¥è¯¢è¯¦æƒ…
    searchInfo (row) {
      this.diaLoading = true
      this.$axios(this.$api.foreignRegister.getForeignRegisterOne + '?registerId=' + row.registerId).then(res => {
        this.diaLoading = false
        if (res.code === 201) return
        this.form = res.data
      }).catch(err => {
        console.log(err)
        this.diaLoading = false
      })
    },
    // æäº¤å¼¹æ¡†æ•°æ®
    handleEdit () {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          this.loading = true
          const internalImplementDto = this.HaveJson(this.form)
          const index = this.personList.findIndex(item => item.value === internalImplementDto.accompanyingId)
          if (index > -1) {
            internalImplementDto.accompanyingName = this.personList[index].label
          }
          const index1 = this.personList.findIndex(item => item.value === internalImplementDto.approveId)
          if (index1 > -1) {
            internalImplementDto.approveName = this.personList[index].label
          }
          if (this.operationType === 'add') {
            this.$axios.post(this.$api.foreignRegister.addForeignRegister, internalImplementDto, {
              headers: {
                "Content-Type": "application/json"
              },
              noQs: true
            }).then(res => {
              this.loading = false
              if (res.code === 201) return
              this.$message.success('操作成功')
              this.closeThreeWastesDia()
            }).catch(err => {
              console.log('err---', err);
              this.loading = false
            })
          } else if (this.operationType === 'edit') {
            this.$axios.post(this.$api.foreignRegister.updateForeignRegister, internalImplementDto, {
              headers: {
                "Content-Type": "application/json"
              },
              noQs: true
            }).then(res => {
              this.loading = false
              if (res.code === 201) return
              this.$message.success('操作成功')
              this.closeThreeWastesDia()
            }).catch(err => {
              console.log('err---', err);
              this.loading = false
            })
          }
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    closeThreeWastesDia () {
      this.$refs.form.resetFields();
      this.formDia = false
      this.$emit('closeThreeWastesDia')
    },
    getAuthorizedPerson() {
      this.$axios.get(this.$api.user.getUserMenu).then(res => {
        let data = []
        res.data.forEach(a => {
          data.push({
            label: a.name,
            value: a.id
          })
        })
        this.personList = data
      })
    },
  }
};
</script>
<style scoped>
</style>
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/Personnel-management.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,261 @@
<template>
  <div>
    <div class="search-background">
      <span class="search-group">
        <span style="width: 160px">日期:</span>
        <el-date-picker v-model="searchForm.registerDate"
                        clearable
                        format="yyyy-MM-dd"
                        placeholder="选择日期"
                        size="small"
                        style="width: 100%"
                        type="date"
                        value-format="yyyy-MM-dd">
            </el-date-picker>
        <el-button size="medium"  style="margin-left: 10px" @click="resetSearchForm">重 ç½®</el-button>
        <el-button size="medium" type="primary" @click="searchList">查 è¯¢</el-button>
      </span>
      <span class="search-group">
        <el-button size="medium" @click="handleDown">导 å‡º</el-button>
        <el-button size="medium" type="primary" @click="openFormDia('add')">新 å¢ž</el-button>
      </span>
    </div>
    <div class="table">
      <ZTTable
        :column="tableColumn"
        :height="'calc(100vh - 20em)'"
        :table-data="tableData"
        :table-loading="tableLoading"
        style="padding: 0 10px;margin-bottom: 16px">
      </ZTTable>
      <el-pagination :current-page="1" :page-size="page.size" :page-sizes="[10, 20, 30, 50, 100]"
                     :total="total" layout="->,total, sizes, prev, pager, next, jumper"
                     @size-change="handleSizeChange"
                     @current-change="handleCurrentChange">
      </el-pagination>
    </div>
    <personnel-management-dia v-if="threeWastesDia" ref="threeWastesDia" @closeThreeWastesDia="closeThreeWastesDia"></personnel-management-dia>
  </div>
</template>
<script>
// import ZTTable from '../../caorui/ZTTable/index.vue';
// import PersonnelManagementDia from './Personnel-management-dia.vue';
import PersonnelManagementDia from '../component/Personnel-management-dia.vue';
export default {
  name: 'Personnel-management',
  // import å¼•入的组件需要注入到对象中才能使用
  components: { PersonnelManagementDia},
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      searchForm: {
        registerDate: '',
      },
      tableColumn: [
        {
          label: '日期',
          prop: 'registerDate',
          minWidth: '100'
        },
        {
          label: '进入区域',
          prop: 'area',
          minWidth: '100'
        },
        {
          label: '进入人员',
          prop: 'personnel',
          minWidth: '100'
        },
        {
          label: '进入原因',
          prop: 'reason',
          minWidth: '100'
        },
        {
          label: '陪同人员',
          prop: 'accompanyingName',
          minWidth: '100'
        },
        {
          label: '批准人签名',
          prop: 'approveName',
          minWidth: '100'
        },
        {
          label: '保密及其他情况',
          prop: 'confidentiality',
          minWidth: '100'
        },
        {
          label: '备注',
          prop: 'remark',
          minWidth: '100'
        },
        {
          dataType: 'action',
          fixed: 'right',
          minWidth: '220',
          label: '操作',
          operation: [
            {
              name: '编辑',
              type: 'text',
              clickFun: (row) => {
                this.openFormDia('edit', row);
              },
            },
            {
              name: '删除',
              type: 'text',
              color: '#f56c6c',
              clickFun: (row) => {
                this.delPlan(row)
              },
            }
          ]
        }
      ],
      tableData: [],
      tableLoading: false,
      page: {
        size: 20,
        current: 1,
      },
      total: 0,
      threeWastesDia: false
    };
  },
  mounted() {
    this.searchList()
  },
  // æ–¹æ³•集合
  methods: {
    // æŸ¥è¯¢åˆ—表
    searchList () {
      const entity = this.searchForm
      const page = this.page
      this.tableLoading = true
      this.$axios.post(this.$api.foreignRegister.pageForeignRegister, {entity, page}, {
        headers: {
          "Content-Type": "application/json"
        },
        noQs: true
      }).then(res => {
        this.tableLoading = false
        if (res.code === 201) return
        this.tableData = res.data.records
        this.total = res.data.total
      }).catch(err => {
        console.log('err---', err);
        this.tableLoading = false
      })
    },
    // åˆ é™¤
    delPlan (row) {
      this.$confirm('此操作将永久删除该数据, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.tableLoading = true
        this.$axios.get(this.$api.foreignRegister.delForeignRegister + '?registerId=' + row.registerId).then(res => {
          this.tableLoading = false
          if (res.code === 201) return
          this.$message.success('删除成功')
          this.searchList()
        }).catch(err => {
          this.tableLoading = false
          console.log('err---', err);
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // æ–°å¢žï¼Œç¼–辑,批准弹框
    openFormDia (type, row) {
      this.threeWastesDia = true
      this.$nextTick(() => {
        this.$refs.threeWastesDia.openDia(type, row)
      })
    },
    // å¯¼å‡º
    handleDown (row) {
      const entity = this.searchForm
      this.$axios.post(this.$api.foreignRegister.exportForeignRegister,{entity},{
        responseType: "blob",
        headers: {
          "Content-Type": "application/json"
        },
        noQs: true}).then(res => {
        this.outLoading = false
        const blob = new Blob([res],{ type: 'application/msword' });
        //将Blob å¯¹è±¡è½¬æ¢æˆå­—符串
        let reader = new FileReader();
        reader.readAsText(blob, 'utf-8');
        reader.onload = () => {
          try {
            let result = JSON.parse(reader.result);
            if (result.message) {
              this.$message.error(result.message);
            } else {
              const url = URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.href = url;
              link.download = '外来人员登记' + '.docx';
              link.click();
              this.$message.success('导出成功')
            }
          } catch (err) {
            console.log(err);
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = '外来人员登记' + '.docx';
            link.click();
            this.$message.success('导出成功')
          }
        }
      })
    },
    closeThreeWastesDia () {
      this.threeWastesDia = false
      this.searchList()
    },
    // é‡ç½®æŸ¥è¯¢æ¡ä»¶
    resetSearchForm () {
      this.searchForm.registerDate = '';
      this.searchList()
    },
    // åˆ†é¡µ
    handleSizeChange(val) {
      this.page.size = val;
      this.searchList();
    },
    handleCurrentChange(val) {
      this.page.current = val;
      this.searchList();
    },
  }
};
</script>
<style scoped>
.search-background {
  width: 100%;
  height: 60px;
  line-height: 60px;
  display: flex;
  justify-content: space-between;
}
.search-group {
  display: flex;
  align-items: center;
  margin: 0 20px;
}
</style>
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
<template>
  <el-row>
    <el-col :span="2">
      <el-menu style="height: 100vh;" @select="clickSelect" :default-active="activeName">
        <el-menu-item index="电源稳定性">
          <span slot="title">电源稳定性</span>
        </el-menu-item>
        <el-menu-item index="防雷检测">
          <span slot="title">防雷检测</span>
        </el-menu-item>
        <el-menu-item index="照度记录">
          <span slot="title">照度记录</span>
        </el-menu-item>
        <el-menu-item index="温湿度记录">
          <span slot="title">温湿度记录</span>
        </el-menu-item>
      </el-menu>
    </el-col>
    <el-col :span="22" style="padding: 10px">
      <power-supply-stability v-if="activeName === '电源稳定性'"/>
      <lightning-protection-detection v-if="activeName === '防雷检测'" />
      <illuminance-recording v-if="activeName === '照度记录'"/>
      <temperature-humidity-record v-if="activeName === '温湿度记录'"/>
    </el-col>
  </el-row>
</template>
<script>
// ç”µæºç¨³å®šæ€§
import PowerSupplyStability from "./facilities-environmental-conditions/power-supply-stability.vue";
// é˜²é›·æ£€æµ‹
import LightningProtectionDetection from "./facilities-environmental-conditions/lightning-protection-detection.vue";
// ç…§åº¦è®°å½•
import IlluminanceRecording from "./facilities-environmental-conditions/illuminance-recording.vue";
// æ¸©æ¹¿åº¦è®°å½•
import TemperatureHumidityRecord from "./facilities-environmental-conditions/temperature-humidity-record.vue";
export default {
  components: {TemperatureHumidityRecord, IlluminanceRecording, LightningProtectionDetection, PowerSupplyStability},
  data() {
    return {
      activeName: "电源稳定性"
    }
  },
  methods: {
    clickSelect(index) {
      this.activeName = index;
    }
  }
}
</script>
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,414 @@
<template>
  <div>
    <div class="header">
      <div>照度记录</div>
      <div>
        <el-button size="small" type="primary" @click="clickAdd">新 å¢ž</el-button>
      </div>
    </div>
    <el-table
      :data="tableData"
      height="calc(100vh - 18em)"
      style="width: 100%">
      <el-table-column label="序号" type="index" width="120">
        <template v-slot="scope">
          <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column label="结论" min-width="180" prop="conclusion"></el-table-column>
      <el-table-column label="测试日期" min-width="180" prop="testDate" width="testDate"></el-table-column>
      <el-table-column label="检测者" min-width="180" prop="testerUser"></el-table-column>
      <el-table-column label="核查人" min-width="180" prop="checkerUser"></el-table-column>
      <el-table-column label="设备名称" min-width="180" prop="deviceName"></el-table-column>
      <el-table-column label="设备编号" min-width="180" prop="managementNumber"></el-table-column>
      <el-table-column label="校准日期" min-width="180" prop="lastCalibrationDate"></el-table-column>
      <el-table-column label="下次校准日期" min-width="180" prop="nextCalibrationDate"></el-table-column>
      <el-table-column label="创建时间" min-width="180" prop="createTime"></el-table-column>
      <el-table-column fixed="right" label="操作" min-width="140">
        <template v-slot="scope">
          <el-button size="small" type="text" @click="downLoadPost(scope.row)">导出</el-button>
          <el-button size="small" type="text" @click="edit(scope.row)">编辑</el-button>
          <el-button size="small" type="text" @click="deleteRowFun(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
                   :total="search.total" layout="->,total, sizes, prev, pager, next, jumper"
                   @size-change="handleSizeChange"
                   @current-change="handleCurrentChange">
    </el-pagination>
    <el-dialog
      :visible.sync="dialogVisible"
      title="新增"
      width="50%"
      @open="openDialog">
      <div style="height: 50vh; overflow-y: auto">
        <el-form ref="form" :model="form" label-width="120px">
          <el-row>
            <el-col :span="12">
              <el-form-item :rules="[{ required: true, message: '请输入测试地点', trigger: 'change' }]" label="测试日期"
                            prop="testDate">
                <el-date-picker
                  v-model="form.testDate"
                  format="yyyy-MM-dd"
                  placeholder="选择日期"
                  size="small"
                  style="width: 100%"
                  type="date"
                  value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item :rules="[{ required: true, message: '请输入设备名称', trigger: 'change' }]" label="设备名称"
                            prop="deviceId">
                <el-select v-model="form.deviceId"
                           class="table_input"
                           clearable
                           filterable
                           placeholder="设备名称"
                           size="small" @change="getCalibrationDateFun">
                  <el-option v-for="item in equipOptions" :key="item.id"  :label="item.deviceName" :value="item.id">
                    {{item.deviceName + item.managementNumber}}
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="设备编号">
                <el-input v-model="form.managementNumber" disabled size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="最近校准日期">
                <el-input v-model="form.lastCalibrationDate" disabled size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="下次校准日期">
                <el-input v-model="form.nextCalibrationDate" disabled size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="检测者" prop="recipientUser">
                <el-select v-model="form.testerId" clearable filterable placeholder="请选择"
                           size="small" style="width: 100%;">
                  <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="核查人" prop="recipientUser">
                <el-select v-model="form.checkerId" clearable filterable placeholder="请选择"
                           size="small" style="width: 100%;" >
                  <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="结论">
                <el-input
                  v-model="form.conclusion"
                  :rows="2"
                  placeholder="请输入内容"
                  type="textarea">
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <div>
            <div style="display: flex; justify-content: flex-end; margin-bottom: 0.5em">
              <el-button size="small" type="primary" @click="feMeasuredQuantityListAdd">新增</el-button>
            </div>
            <div>
              <el-table
                :data="form.illuminationDetectionAreaList"
                height="40vh"
                style="width: 100%; margin: auto">
                <el-table-column label="序号" type="index" width="80"></el-table-column>
                <el-table-column
                  align="center"
                  label="检测区域名称"
                  min-width="180"
                  prop="detectionAreaLabel">
                  <template #default="{ row }">
                    <el-input v-model="row.detectionAreaLabel" :rows="1" type="textarea"></el-input>
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  label="检测值"
                  min-width="300"
                  prop="name">
                  <template>
                    <el-table-column align="center" label="第一次" min-width="100" prop="valueOne">
                      <template #default="{ row }">
                        <el-input v-model="row.valueOne" :rows="1" @blur="getAverage(row)"></el-input>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" label="第二次" min-width="100" prop="valueTwo">
                      <template #default="{ row }">
                        <el-input v-model="row.valueTwo" :rows="1" @blur="getAverage(row)"></el-input>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" label="第三次" min-width="100" prop="valueThree">
                      <template #default="{ row }">
                        <el-input v-model="row.valueThree" :rows="1" @blur="getAverage(row)"></el-input>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" label="平均值" min-width="100" prop="average">
                      <template #default="{ row }">
                        <el-input v-model="row.average" :rows="1"></el-input>
                      </template>
                    </el-table-column>
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  label="备注"
                  min-width="180"
                  prop="detectionAreaLabel">
                  <template #default="{ row }">
                    <el-input v-model="row.remark" :rows="1" type="textarea"></el-input>
                  </template>
                </el-table-column>
                <el-table-column
                  fixed="right"
                  label="操作"
                  width="100">
                  <template slot-scope="scope">
                    <el-button size="small" type="text" @click="feMeasuredQuantityListDelete(scope.row, scope.$index)">
                      åˆ é™¤
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 æ¶ˆ</el-button>
    <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability">ç¡® å®š</el-button>
  </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      search: {
        size: 20,
        current: 1,
        total: 0
      },
      tableData: [],
      dialogVisible: false,
      submitLoading: false,
      form: {
        testDate: '',
        deviceId: '',
        managementNumber: '',
        lastCalibrationDate: '',
        nextCalibrationDate: '',
        testerId: '',
        checkerId: '',
        conclusion: '',
        illuminationDetectionAreaList: []
      },
      cascaderList: [],
      responsibleOptions: [],
      equipOptions: [],
    }
  },
  mounted() {
    this.initData()
  },
  watch: {
    dialogVisible(newVal) {
      if (!newVal) {
        this.form = {
          deviceId: null,
          illuminationDetectionAreaList: []
        }
      }
    }
  },
  methods: {
    getAverage(row) {
      if (row.valueOne && row.valueTwo && row.valueThree) {
        if (!isNaN(row.valueOne) && !isNaN(row.valueTwo) && !isNaN(row.valueThree)) {
          const avg = Number(row.valueOne) + Number(row.valueTwo) + Number(row.valueThree)
          console.log(avg)
          row.average = Math.round(avg/3);
        } else {
          this.$message.warning("必须为数字!")
        }
      }
    },
    edit(row) {
      this.$axios.get(this.$api.facilitiesAndEnvironment.getFeIlluminationDetectionArea + "?intensityIlluminationId=" + row.intensityIlluminationId).then(res => {
        this.form = {...row}
        this.form.illuminationDetectionAreaList = res.data;
        this.dialogVisible = true
      });
    },
    initData() {
      this.$axios.get(this.$api.facilitiesAndEnvironment.getFeLightningProtection + '?size=' + this.search.size + '&current=' + this.search.current).then(res => {
        if (res.code === 201) return;
        this.tableData = res.data.records;
        this.search.total = res.data.total;
      });
    },
    handleSizeChange(val) {
      this.search.size = val;
      this.initData();
    },
    handleCurrentChange(val) {
      this.search.current = val;
      this.initData();
    },
    deleteRowFun(row) {
      this.$confirm('此操作将永久删除该数据, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeLightningProtection + '?intensityIlluminationId=' + row.intensityIlluminationId).then(res => {
          this.$message.success('删除成功!')
          this.initData()
        })
      })
    },
    feMeasuredQuantityListDelete(row, index) {
      if (row.detectionAreaId) {
        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeIlluminationDetectionArea + '?detectionAreaId=' + row.detectionAreaId).then(res => {
          if (res.code === 201) return
          this.form.illuminationDetectionAreaList.splice(index, 1)
          this.$message.success('删除成功!')
        })
      } else {
        this.form.illuminationDetectionAreaList.splice(index, 1)
        this.$message.success('删除成功!')
      }
    },
    openDialog() {
      this.$axios.get(this.$api.deviceScope.treeDevice).then(res => {
        this.cascaderList = res.data;
      });
      this.$nextTick(() => {
        this.$refs['form'].clearValidate()
      })
      this.getUserList()
    },
    clickAdd() {
      this.dialogVisible = true
      this.getEquipOptions()
    },
    // èŽ·å–æ‰€æœ‰è®¾å¤‡
    getEquipOptions() {
      this.equipOptions = []
      this.$axios.get(this.$api.deviceScope.deviceScopeSearch+'?status=0').then(res => {
        if (res.code === 200 && res.data) {
          this.equipOptions = res.data
        }
      }).catch(error => {
        console.error(error)
      })
    },
    feMeasuredQuantityListAdd() {
      const obj = {
        detectionAreaLabel: null,
        valueOne: null,
        valueTwo: null,
        valueThree: null,
        average: null,
        remark: null,
      }
      this.form.illuminationDetectionAreaList.push(obj)
    },
    addPowerSupplyStability() {
      this.submitLoading = true
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.$axios.post(this.$api.facilitiesAndEnvironment.addFeLightningProtection, this.form, {
            headers: {
              'Content-Type': 'application/json'
            }
          }).then(res => {
            this.submitLoading = false
            if (res.code === 200) {
              this.initData()
              this.dialogVisible = false
            }
          }).catch(error => {
            this.submitLoading = false
          })
        }
      });
    },
    // èŽ·å–è´Ÿè´£äººä¿¡æ¯æŽ¥å£
    getUserList() {
      this.$axios.get(this.$api.deviceScope.selectUserList).then(res => {
        if (res.code == 200) {
          this.responsibleOptions = res.data
        }
      })
    },
    getCalibrationDateFun(val) {
      const index = this.equipOptions.findIndex(item => item.id === val)
      if (index > -1) {
        this.form.managementNumber = this.equipOptions[index].managementNumber
        this.form.lastCalibrationDate = this.equipOptions[index].lastCalibrationDate
        this.form.nextCalibrationDate = this.equipOptions[index].nextCalibrationDate
      }
    },
    // å¯¼å‡º
    downLoadPost(row) {
      this.$axios.get(this.$api.facilitiesAndEnvironment.exportFeIllumination + '?intensityIlluminationId=' + row.intensityIlluminationId,{responseType: "blob"}).then(res => {
        this.outLoading = false
        const blob = new Blob([res],{ type: 'application/msword' });
        //将Blob å¯¹è±¡è½¬æ¢æˆå­—符串
        let reader = new FileReader();
        reader.readAsText(blob, 'utf-8');
        reader.onload = () => {
          try {
            let result = JSON.parse(reader.result);
            if (result.message) {
              this.$message.error(result.message);
            } else {
              const url = URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.href = url;
              link.download = '照度记录' + '.docx';
              link.click();
              this.$message.success('导出成功')
            }
          } catch (err) {
            console.log(err);
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = '照度记录' + '.docx';
            link.click();
            this.$message.success('导出成功')
          }
        }
      })
    },
  }
}
</script>
<style scoped>
.header {
  height: 3em;
  width: 100%;
  display: flex;
  justify-content: space-between;
}
</style>
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,288 @@
<template>
  <div>
    <div class="header">
      <div>防雷检测</div>
      <div>
        <el-button size="small" type="primary" @click="clickAdd">导 å…¥</el-button>
        <el-button size="small" type="primary" @click="downLoadPost">导 å‡º</el-button>
      </div>
    </div>
    <el-table
      :data="tableData"
      height="calc(100vh - 18em)"
      style="width: 100%">
      <el-table-column label="序号" type="index" width="120">
        <template v-slot="scope">
          <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="原文件名"
        min-width="180"
        prop="fileName">
      </el-table-column>
      <el-table-column
        label="检测日期"
        min-width="180"
        prop="detectionDate">
      </el-table-column>
      <el-table-column
        label="有效期"
        min-width="180"
        prop="termValidity">
      </el-table-column>
      <el-table-column
        label="检测单位"
        min-width="180"
        prop="detectionUnit">
      </el-table-column>
      <el-table-column fixed="right" label="操作" min-width="100">
        <template v-slot="scope">
          <el-button size="small" type="text" @click="edit(scope.row)">编辑</el-button>
          <el-button size="small" type="text" @click="deleteRowFun(scope.row)">删除</el-button>
          <el-button size="small" type="text" @click="download(scope.row)">下载</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
                   :total="search.total" layout="->,total, sizes, prev, pager, next, jumper"
                   @size-change="handleSizeChange"
                   @current-change="handleCurrentChange">
    </el-pagination>
    <el-dialog
      :visible.sync="dialogVisible"
      title="新 å¢ž"
      width="50%">
      <div style="height: 50vh;">
        <el-form ref="form" :model="form" label-width="80px">
          <el-row>
            <el-col :span="12">
              <el-form-item :rules="[{ required: true, message: '请输入测试地点', trigger: 'blur' }]" label="检测日期"
                            prop="detectionDate">
                <el-date-picker
                  v-model="form.detectionDate"
                  format="yyyy-MM-dd"
                  placeholder="选择日期"
                  size="small"
                  style="width: 100%"
                  type="date"
                  value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item :rules="[{ required: true, message: '请输入测试地点', trigger: 'blur' }]" label="有效期"
                            prop="termValidity">
                <el-date-picker
                  v-model="form.termValidity"
                  format="yyyy-MM-dd"
                  placeholder="选择日期"
                  size="small"
                  style="width: 100%"
                  type="date"
                  value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item :rules="[{ required: true, message: '请输入测试地点', trigger: 'blur' }]" label="检测单位"
                            prop="detectionUnit">
                <el-input v-model="form.detectionUnit" size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="检测单位" >
                <el-upload
                  :file-list="form.fileList"
                  :http-request="httpRequest"
                  :limit="1"
                  :on-exceed="handleExceed"
                  :on-remove="handleRemove"
                  action="#"
                  class="upload-demo"
                  drag
                  multiple>
                  <i class="el-icon-upload"></i>
                  <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 æ¶ˆ</el-button>
    <el-button type="primary" @click="addImport">ç¡® å®š</el-button>
  </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      search: {
        size: 20,
        current: 1,
        total: 0
      },
      tableData: [],
      dialogVisible: false,
      form: {
        fileList: [],
        fileData: []
      },
    }
  },
  mounted() {
    this.initData()
  },
  watch: {
    dialogVisible(newVal) {
      if (!newVal) {
        this.form = {
          fileList: [],
          fileData: []
        }
      }
    }
  },
  methods: {
    // å¯¼å‡º
    downLoadPost() {
      this.$axios.get(this.$api.facilitiesAndEnvironment.exportOfLightningProtectionDetection,{responseType: "blob"}).then(res => {
        this.outLoading = false
        const blob = new Blob([res],{ type: 'application/msword' });
        //将Blob å¯¹è±¡è½¬æ¢æˆå­—符串
        let reader = new FileReader();
        reader.readAsText(blob, 'utf-8');
        reader.onload = () => {
          try {
            let result = JSON.parse(reader.result);
            if (result.message) {
              this.$message.error(result.message);
            } else {
              const url = URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.href = url;
              link.download = '防雷检测导出' + '.xlsx';
              link.click();
              this.$message.success('导出成功')
            }
          } catch (err) {
            console.log(err);
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = '防雷检测导出' + '.xlsx';
            link.click();
            this.$message.success('导出成功')
          }
        }
      })
    },
    initData() {
      this.$axios.get(this.$api.facilitiesAndEnvironment.getLightningProtectionDetection + '?size=' + this.search.size + '&current=' + this.search.current).then(res => {
        if (res.code === 201) return;
        this.tableData = res.data.records;
        this.search.total = res.data.total;
      });
    },
    handleSizeChange(val) {
      this.search.size = val;
      this.initData();
    },
    handleCurrentChange(val) {
      this.search.current = val;
      this.initData();
    },
    clickAdd() {
      this.dialogVisible = true
    },
    // æ–‡ä»¶æ•°é‡è¿‡å¤šæ—¶æé†’
    handleExceed() {
      this.$message({type: 'error', message: '最多支持1个附件上传'})
    },
    // è¦†ç›–默认的上传行为,可以自定义上传的实现,将上传的文件依次添加到fileList数组中,支持多个文件
    httpRequest(option) {
      this.form.fileData.push(option)
    },
    addImport() {
      console.log(this.form)
      this.$refs.form.validate((valid) => {
        if (valid) {
          let params = new FormData()
          if (this.form.lightningProtectionId) {
            params.append("lightningProtectionId", this.form.lightningProtectionId)
          }
          params.append("termValidity", this.form.termValidity)
          params.append("detectionUnit", this.form.detectionUnit)
          params.append("detectionDate", this.form.detectionDate)
          if (this.form.fileData.length > 0) {
            params.append("file", this.form.fileData[0].file)
          }
          this.$axios.post(this.$api.facilitiesAndEnvironment.addLightningProtectionDetection, params, {
            headers: {'Content-Type': 'multipart/form-data;'},
            noQs: true
          }).then(res => {
            if (res.code === 201) return;
            this.dialogVisible = false
            this.initData()
          });
        }
      });
    },
    edit(row) {
      this.dialogVisible = true
      this.form = {...row}
      this.form.fileList = []
      this.form.fileData = []
      this.form.fileList.push({name: row.systemFileName, url: "123434"})
      console.log(this.form)
    },
    deleteRowFun(row) {
      this.$confirm('此操作将永久删除该数据, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteLightningProtectionDetection + '?lightningProtectionId=' + row.lightningProtectionId).then(res => {
          this.$message.success('删除成功!')
          this.initData()
        })
      })
    },
    handleRemove(file) {
      this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + file.name).then(res => {
        if (res.code === 201) return;
        this.$message.success('删除成功!')
        let index = this.form.fileList.indexOf(fileName)
        if (index != -1) {
          this.successFileList.splice(index, 1)
        }
      })
    },
    download(row) {
      let url = '';
      // fileDownload.downloadIamge(url, row.fileName)
      url = this.javaApi + 'img/' + row.systemFileName
      const link = document.createElement('a');
      link.href = url;
      link.download = row.fileName;
      link.click();
    }
  }
}
</script>
<style scoped>
.header {
  height: 3em;
  width: 100%;
  display: flex;
  justify-content: space-between;
}
</style>
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/power-supply-stability.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,403 @@
<template>
  <div>
    <div class="header">
      <div>电源稳定性</div>
      <div>
        <el-button size="small" type="primary" @click="openAddDia">新 å¢ž</el-button>
      </div>
    </div>
    <el-table
      :data="tableData"
      height="calc(100vh - 18em)"
      style="width: 100%">
      <el-table-column label="序号" type="index" width="120">
        <template v-slot="scope">
          <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column label="测试地点" min-width="180" prop="testLocation"></el-table-column>
      <el-table-column label="测试日期" min-width="180" prop="testDate" width="testDate"></el-table-column>
      <el-table-column label="结论" min-width="180" prop="conclusion"></el-table-column>
      <el-table-column label="检测者" min-width="180" prop="testerUser"></el-table-column>
      <el-table-column label="核查人" min-width="180" prop="checkerUser"></el-table-column>
      <el-table-column label="设备名称" min-width="180" prop="deviceName"></el-table-column>
      <el-table-column label="设备编号" min-width="180" prop="managementNumber"></el-table-column>
      <el-table-column label="校准日期" min-width="180" prop="lastCalibrationDate"></el-table-column>
      <el-table-column label="下次校准日期" min-width="180" prop="nextCalibrationDate"></el-table-column>
      <el-table-column label="创建时间" min-width="180" prop="createTime"></el-table-column>
      <el-table-column fixed="right" label="操作" min-width="140">
        <template v-slot="scope">
          <el-button size="small" type="text" @click="downLoadPost(scope.row)">导出</el-button>
          <el-button size="small" type="text" @click="edit(scope.row)">编辑</el-button>
          <el-button size="small" type="text" @click="deleteRowFun(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
                   :total="search.total" layout="->,total, sizes, prev, pager, next, jumper"
                   @size-change="handleSizeChange"
                   @current-change="handleCurrentChange">
    </el-pagination>
    <el-dialog
      :visible.sync="dialogVisible"
      title="新增"
      width="50%"
      @open="openDialog">
      <div style="height: 50vh; overflow-y: auto">
        <el-form ref="form" :model="form" label-width="120px">
          <el-row>
            <el-col :span="12">
              <el-form-item :rules="[{ required: true, message: '请输入测试地点', trigger: 'blur' }]" label="测试地点"
                            prop="testLocation">
                <el-input v-model="form.testLocation" size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item :rules="[{ required: true, message: '请输入测试日期', trigger: 'change' }]" label="测试日期"
                            prop="testDate">
                <el-date-picker
                  v-model="form.testDate"
                  format="yyyy-MM-dd"
                  placeholder="选择日期"
                  size="small"
                  style="width: 100%"
                  type="date"
                  value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item :rules="[{ required: true, message: '请输入设备名称', trigger: 'change' }]" label="设备名称"
                            prop="deviceId">
                <el-select v-model="form.deviceId"
                           class="table_input"
                           clearable
                           filterable
                           placeholder="设备名称"
                           size="small" @change="getCalibrationDateFun">
                  <el-option v-for="item in equipOptions" :key="item.id"  :label="item.deviceName" :value="item.id">
                    {{item.deviceName + item.managementNumber}}
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="设备编号">
                <el-input v-model="form.managementNumber" disabled size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="最近校准日期">
                <el-input v-model="form.lastCalibrationDate" disabled size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="下次校准日期">
                <el-input v-model="form.nextCalibrationDate" disabled size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="检测者" prop="recipientUser">
                <el-select v-model="form.testerId" clearable filterable placeholder="请选择"
                           size="small" style="width: 100%;">
                  <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="核查人" prop="recipientUser">
                <el-select v-model="form.checkerId" clearable filterable placeholder="请选择"
                           size="small" style="width: 100%;" >
                  <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="结论">
                <el-input
                  v-model="form.conclusion"
                  :rows="2"
                  placeholder="请输入内容"
                  type="textarea">
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <div>
            <div style="display: flex; justify-content: flex-end; margin-bottom: 0.5em">
              <el-button size="small" type="primary" @click="feMeasuredQuantityListAdd">新增</el-button>
            </div>
            <div>
              <el-table
                :data="form.feMeasuredQuantityList"
                height="40vh"
                style="width: 100%; margin: auto">
                <el-table-column label="序号" type="index" width="80"></el-table-column>
                <el-table-column
                  align="center"
                  label="测定量名称"
                  min-width="180"
                  prop="measuredQuantityLabel">
                  <template #default="{ row }">
                    <el-input v-model="row.measuredQuantityLabel" :rows="1" type="textarea"></el-input>
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  label="值"
                  min-width="300"
                  prop="name">
                  <template>
                    <el-table-column align="center" label="A" min-width="100" prop="valueA">
                      <template #default="{ row }">
                        <el-input v-model="row.valueA" :rows="1"></el-input>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" label="B" min-width="100" prop="valueB">
                      <template #default="{ row }">
                        <el-input v-model="row.valueB" :rows="1"></el-input>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" label="C" min-width="100" prop="valueC">
                      <template #default="{ row }">
                        <el-input v-model="row.valueC" :rows="1"></el-input>
                      </template>
                    </el-table-column>
                  </template>
                </el-table-column>
                <el-table-column
                  fixed="right"
                  label="操作"
                  width="100">
                  <template slot-scope="scope">
                    <el-button size="small" type="text" @click="feMeasuredQuantityListDelete(scope.row, scope.$index)">
                      åˆ é™¤
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 æ¶ˆ</el-button>
        <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability">ç¡® å®š</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      search: {
        size: 20,
        current: 1,
        total: 0
      },
      tableData: [],
      dialogVisible: false,
      submitLoading: false,
      form: {
        testLocation: '',
        testDate: '',
        deviceId: '',
        managementNumber: '',
        lastCalibrationDate: '',
        nextCalibrationDate: '',
        testerId: '',
        checkerId: '',
        conclusion: '',
        feMeasuredQuantityList: []
      },
      equipOptions: [],
      cascaderList: [],
      responsibleOptions: []
    }
  },
  mounted() {
    this.initData()
  },
  watch: {
    dialogVisible(newVal) {
      if (!newVal) {
        this.form = {
          deviceId: null,
          feMeasuredQuantityList: []
        }
      }
    }
  },
  methods: {
    // åˆå§‹åŒ–调用
    initData() {
      this.$axios.get(this.$api.facilitiesAndEnvironment.getLaboratoryFacilityPowerStablePage + '?size=' + this.search.size + '&current=' + this.search.current).then(res => {
        if (res.code === 201) return;
        this.tableData = res.data.records;
        this.search.total = res.data.total;
      });
    },
    handleSizeChange(val) {
      this.search.size = val;
      this.initData();
    },
    handleCurrentChange(val) {
      this.search.current = val;
      this.initData();
    },
    // ç”µæºç¨³å®šæ€§ è¡¨æ ¼ä¸­çš„行删除按钮
    deleteRowFun(row) {
      this.$confirm('此操作将永久删除该数据, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteLaboratoryFacilityPowerStable + '?powerStableId=' + row.powerStableId).then(res => {
          this.$message.success('删除成功!')
          this.initData()
        })
      })
    },
    openAddDia () {
      this.dialogVisible = true
      this.getEquipOptions()
    },
    // èŽ·å–æ‰€æœ‰è®¾å¤‡
    getEquipOptions() {
      this.equipOptions = []
      this.$axios.get(this.$api.deviceScope.deviceScopeSearch+'?status=0').then(res => {
        if (res.code === 200 && res.data) {
          this.equipOptions = res.data
        }
      }).catch(error => {
        console.error(error)
      })
    },
    // ç”µæºç¨³å®šæ€§-打开弹框调用设备接口,查询使用的设备
    openDialog() {
      this.$axios.get(this.$api.deviceScope.treeDevice).then(res => {
        this.cascaderList = res.data;
      });
      this.$nextTick(() => {
        this.$refs['form'].clearValidate()
      })
      this.getUserList()
    },
    //
    getCalibrationDateFun(val) {
      const index = this.equipOptions.findIndex(item => item.id === val)
      if (index > -1) {
        this.form.managementNumber = this.equipOptions[index].managementNumber
        this.form.lastCalibrationDate = this.equipOptions[index].lastCalibrationDate
        this.form.nextCalibrationDate = this.equipOptions[index].nextCalibrationDate
      }
    },
    // ç”µæºç¨³å®šæ€§-测定量弹框中表格的删除行
    feMeasuredQuantityListDelete(row, index) {
      if (row.measuredQuantityId) {
        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeMeasuredQuantity + '?measuredQuantityId=' + row.measuredQuantityId).then(res => {
          if (res.code === 201) return
          this.form.feMeasuredQuantityList.splice(index, 1)
          this.$message.success('删除成功!')
        })
      } else {
        this.form.feMeasuredQuantityList.splice(index, 1)
        this.$message.success('删除成功!')
      }
    },
    // ç”µæºç¨³å®šæ€§-测定量表格新增行
    feMeasuredQuantityListAdd() {
      const obj = {
        measuredQuantityLabel: null,
        valueA: null,
        valueB: null,
        valueC: null,
      }
      this.form.feMeasuredQuantityList.push(obj)
    },
    // ç”µæºç¨³å®šæ€§ æ–°å¢ž
    addPowerSupplyStability() {
      this.submitLoading = true
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.$axios.post(this.$api.facilitiesAndEnvironment.addLaboratoryFacilityPowerStable, this.form, {
            headers: {
              'Content-Type': 'application/json'
            }
          }).then(res => {
            this.submitLoading = false
            if (res.code === 200) {
              this.initData()
              this.dialogVisible = false
            }
          }).catch(error => {
            this.submitLoading = false
          })
        }
      });
    },
    // å¯¼å‡º
    downLoadPost(row) {
      this.$axios.get(this.$api.facilitiesAndEnvironment.exportFePowerStable + '?powerStableId=' + row.powerStableId,{responseType: "blob"}).then(res => {
        this.outLoading = false
        const blob = new Blob([res],{ type: 'application/msword' });
        //将Blob å¯¹è±¡è½¬æ¢æˆå­—符串
        let reader = new FileReader();
        reader.readAsText(blob, 'utf-8');
        reader.onload = () => {
          try {
            let result = JSON.parse(reader.result);
            if (result.message) {
              this.$message.error(result.message);
            } else {
              const url = URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.href = url;
              link.download = '电源稳定性' + '.docx';
              link.click();
              this.$message.success('导出成功')
            }
          } catch (err) {
            console.log(err);
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = '电源稳定性' + '.docx';
            link.click();
            this.$message.success('导出成功')
          }
        }
      })
    },
    // ç”µæºç¨³å®šæ€§ ç‚¹å‡»è¡Œç¼–辑触发
    edit(row) {
      this.$axios.get(this.$api.facilitiesAndEnvironment.getFeMeasuredQuantityService + "?powerStableId=" + row.powerStableId).then(res => {
        this.form = {...row}
        this.form.feMeasuredQuantityList = res.data;
        this.dialogVisible = true
      });
    },
    // èŽ·å–è´Ÿè´£äººä¿¡æ¯æŽ¥å£
    getUserList() {
      this.$axios.get(this.$api.deviceScope.selectUserList).then(res => {
        if (res.code == 200) {
          this.responsibleOptions = res.data
        }
      })
    },
  }
}
</script>
<style scoped>
.header {
  height: 3em;
  width: 100%;
  display: flex;
  justify-content: space-between;
}
</style>
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/temperature-humidity-record.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,483 @@
<template>
  <div>
    <el-row :gutter="20">
      <el-col :span="12">
        <div class="header">
          <div>试验区域</div>
          <div>
            åç§°ï¼š
            <el-input v-model="search.testAreaName" clearable size="small" style="width: 120px"></el-input>
            <el-button size="small" type="primary" @click="initData">查询</el-button>
            <el-button size="small" type="primary" @click="clickAdd">新 å¢ž</el-button>
          </div>
        </div>
        <el-table
            :data="tableData"
            height="calc(100vh - 18em)"
            highlight-current-row
            style="width: 100%"
            @row-click="clickRow">
          <el-table-column label="序号" type="index" width="60" align="center"></el-table-column>
          <el-table-column label="月度时间" min-width="180" prop="monthDate"></el-table-column>
          <el-table-column label="试验区域名称" min-width="180" prop="testAreaName"></el-table-column>
          <el-table-column label="确认状态" min-width="180" prop="isAffirm">
            <template slot-scope="scope">
              <el-tag type="danger" v-if="scope.row.isAffirm == 0">未确认</el-tag>
              <el-tag type="success" v-if="scope.row.isAffirm == 1">已确认</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="增补信息" min-width="180" prop="subjoin"></el-table-column>
          <el-table-column fixed="right" label="操作" min-width="180" align="center">
            <template v-slot="scope">
              <el-button size="small" type="text" @click="downLoadPost(scope.row)">导出</el-button>
              <el-button size="small" type="text" @click="edit(scope.row)">编辑</el-button>
              <el-button :disabled="scope.row.isAffirm === '1'" size="small" type="text" @click="openApprovalDialog(scope.row)">确认</el-button>
              <el-button size="small" type="text" @click="deleteRowFun(scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
                       :total="search.total" layout="->,total, sizes, prev, pager, next, jumper"
                       @size-change="handleSizeChange"
                       @current-change="handleCurrentChange">
        </el-pagination>
      </el-col>
      <el-col :span="12">
        <div class="header">
          <div>温湿度记录:{{ saveRow.monthDate }}</div>
          <div>
            <el-button v-if="saveRow.monthDate" size="small" type="primary" @click="dialogVisible1 = true">新 å¢ž</el-button>
          </div>
        </div>
        <el-table
            :data="tableData1"
            height="calc(100vh - 18em)"
            style="width: 100%">
          <el-table-column label="序号" type="index" width="60" align="center"></el-table-column>
          <el-table-column label="日期" min-width="100" prop="recordDate"></el-table-column>
          <el-table-column align="center" label="上午" min-width="200">
            <template>
              <el-table-column label="时间" min-width="110" prop="morningTestTime" show-overflow-tooltip></el-table-column>
              <el-table-column label="温度" min-width="80" prop="morningTemp" show-overflow-tooltip></el-table-column>
              <el-table-column label="湿度" min-width="80" prop="morningHum" show-overflow-tooltip></el-table-column>
            </template>
          </el-table-column>
          <el-table-column label="记录员" min-width="100" prop="morningRecorderUser"></el-table-column>
          <el-table-column align="center" label="下午" min-width="200">
            <template>
              <el-table-column label="时间" min-width="110" prop="afternoonTime" show-overflow-tooltip></el-table-column>
              <el-table-column label="温度" min-width="80" prop="afternoonTemp" show-overflow-tooltip></el-table-column>
              <el-table-column label="湿度" min-width="80" prop="afternoonHum" show-overflow-tooltip></el-table-column>
            </template>
          </el-table-column>
          <el-table-column label="记录员" min-width="100" prop="afternoonRecorderUser"></el-table-column>
          <el-table-column label="备注" min-width="100" prop="note" show-overflow-tooltip></el-table-column>
          <el-table-column fixed="right" label="操作" min-width="100">
            <template v-slot="scope">
              <el-button size="small" type="text" @click="edit1(scope.row)">编辑</el-button>
              <el-button size="small" type="text" @click="deleteRowFun1(scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination :current-page="1" :page-size="search1.size" :page-sizes="[10, 20, 30, 50, 100]"
                       :total="search1.total" layout="->,total, sizes, prev, pager, next, jumper"
                       @size-change="handleSizeChange1"
                       @current-change="handleCurrentChange1">
        </el-pagination>
      </el-col>
    </el-row>
    <el-dialog
        :visible.sync="dialogVisible"
        title="提示"
        width="50%">
      <div style="height: 20vh;">
        <el-form ref="form" :model="form" label-width="80px">
          <el-row>
            <el-col :span="24">
              <el-form-item :rules="[{ required: true, message: '请输入月度时间', trigger: 'blur' }]" label="月度时间"
                            prop="monthDate">
                <el-date-picker
                    v-model="form.monthDate"
                    format="yyyy-MM"
                    placeholder="选择月份"
                    size="small"
                    style="width: 100%"
                    type="month"
                    value-format="yyyy-MM">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item :rules="[{ required: true, message: '请输入试验区域', trigger: 'blur' }]" label="试验区域"
                            prop="testAreaName">
                <el-input v-model="form.testAreaName"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 æ¶ˆ</el-button>
    <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability">ç¡® å®š</el-button>
  </span>
    </el-dialog>
    <el-dialog
        :visible.sync="dialogVisible1"
        title="提示"
        width="50%"
        @open="openDialog">
      <div style="height: 40vh;">
        <el-form ref="form1" :model="form1" label-width="120px">
          <el-row>
            <el-col :span="24">
              <el-form-item label="日期">
                <el-date-picker
                  v-model="form1.recordDate"
                  format="yyyy-MM-dd"
                  placeholder="请选择日期"
                  size="small"
                  style="width: 50%"
                  type="date"
                  value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="上午时间">
                <el-time-picker
                  v-model="form1.morningTestTime"
                  size="small"
                  value-format="HH:mm:ss"
                  format="HH:mm:ss"
                  style="width: 100%"
                  placeholder="请选择时间">
                </el-time-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="上午温度">
                <el-input v-model="form1.morningTemp" size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="上午湿度">
                <el-input v-model="form1.morningHum" size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="上午记录员">
                <el-select v-model="form1.morningRecorderId" clearable filterable placeholder="请选择"
                           size="small" style="width: 100%;">
                  <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="下午时间">
                <el-time-picker
                  v-model="form1.afternoonTime"
                  size="small"
                  value-format="HH:mm:ss"
                  format="HH:mm:ss"
                  style="width: 100%"
                  placeholder="请选择时间">
                </el-time-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="下午温度">
                <el-input v-model="form1.afternoonTemp" size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="下午湿度">
                <el-input v-model="form1.afternoonHum" size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="下午记录员">
                <el-select v-model="form1.afternoonRecorderId" clearable filterable placeholder="请选择"
                           size="small" style="width: 100%;">
                  <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="备注">
                <el-input
                    v-model="form1.note"
                    :rows="2"
                    placeholder="请输入内容"
                    type="textarea">
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible1 = false">取 æ¶ˆ</el-button>
    <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability1">ç¡® å®š</el-button>
  </span>
    </el-dialog>
    <el-dialog :visible.sync="approvalDialog" title="确认" width="30%" @close="subjoin = ''">
      <span>
        å¢žè¡¥ä¿¡æ¯ï¼š
        <el-input v-model="subjoin" type="textarea"></el-input>
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button :loading="approvalLoading" @click="subjoin = '', approvalDialog = false">不确认</el-button>
        <el-button :loading="approvalLoading" type="primary" @click="handleApproval">ç¡® è®¤</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      search: {
        size: 20,
        current: 1,
        total: 0,
        testAreaName: ''
      },
      search1: {
        size: 20,
        current: 1,
        total: 0
      },
      tableData: [],
      tableData1: [],
      dialogVisible: false,
      submitLoading: false,
      dialogVisible1: false,
      form: {},
      form1: {},
      saveRow: {},
      responsibleOptions: [],
      approvalDialog: false,
      approvalLoading: false,
      subjoin: '',
      approvalRow: {},
    }
  },
  mounted() {
    this.initData()
  },
  watch: {
    dialogVisible(newVal) {
      if (!newVal) {
        this.form = {
        }
      }
    },
    dialogVisible1(newVal) {
      if (!newVal) {
        this.form1 = {
        }
      }
    }
  },
  methods: {
    openApprovalDialog (row) {
      this.approvalDialog = true
      this.approvalRow = row
    },
    handleApproval () {
      this.approvalLoading = true
      const params = {
        dateId: this.approvalRow.dateId,
        subjoin: this.subjoin,
      }
      this.$axios.post(this.$api.facilitiesAndEnvironment.affirmFeTempHumDate, params, {
        headers: {
          'Content-Type': 'application/json'
        },
        noQs: true
      }).then(res => {
        this.approvalLoading = false
        if (res.code === 200) {
          this.$message.success('确认成功!')
          this.approvalDialog = false
          this.initData()
        }
      }).catch(err => {
        this.approvalDialog = false
      })
    },
    openDialog() {
      this.$axios.get(this.$api.deviceScope.selectUserList).then(res => {
        if (res.code == 200) {
          this.responsibleOptions = res.data
        }
      })
    },
    addPowerSupplyStability() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.submitLoading = true
          this.$axios.post(this.$api.facilitiesAndEnvironment.addFeTempHumDate, this.form, {
            headers: {
              'Content-Type': 'application/json'
            }
          }).then(res => {
            if (res.code === 200) {
              this.$message.success('新增成功!')
              this.submitLoading = false
              this.initData()
              this.dialogVisible = false
            }
          }).catch(err => {
            this.submitLoading = false
          })
        }
      });
    },
    addPowerSupplyStability1() {
      if (!this.saveRow) {
        this.$message.warning("请选择试验区域!")
        return
      }
      this.$refs.form1.validate((valid) => {
        this.submitLoading = true
        if (valid) {
          this.form1.dateId = this.saveRow.dateId
          this.$axios.post(this.$api.facilitiesAndEnvironment.addFeTempHumRecord, this.form1, {
            headers: {
              'Content-Type': 'application/json'
            }
          }).then(res => {
            if (res.code === 200) {
              this.$message.success('新增成功!')
              this.submitLoading = false
              this.initData1(this.saveRow.dateId)
              this.dialogVisible1 = false
            }
          }).catch(err => {
            this.submitLoading = false
          })
        }
      });
    },
    clickRow(row) {
      this.saveRow = row
      this.initData1(row.dateId)
    },
    edit(row) {
      this.form = {...row}
      this.dialogVisible = true
    },
    deleteRowFun(row) {
      this.$confirm('此操作将永久删除该数据, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeTempHumDate + '?dateId=' + row.dateId).then(res => {
          this.$message.success('删除成功!')
          this.initData()
        })
      })
    },
    edit1(row) {
      this.form1 = {...row}
      this.dialogVisible1 = true
    },
    // å¯¼å‡º
    downLoadPost(row) {
      this.$axios.get(this.$api.facilitiesAndEnvironment.exportTemperatureAndHumidityRecords + '?dateId=' + row.dateId,{responseType: "blob"}).then(res => {
        this.outLoading = false
        const blob = new Blob([res],{ type: 'application/msword' });
        //将Blob å¯¹è±¡è½¬æ¢æˆå­—符串
        let reader = new FileReader();
        reader.readAsText(blob, 'utf-8');
        reader.onload = () => {
          try {
            let result = JSON.parse(reader.result);
            if (result.message) {
              this.$message.error(result.message);
            } else {
              const url = URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.href = url;
              link.download = '温湿度记录' + '.docx';
              link.click();
              this.$message.success('导出成功')
            }
          } catch (err) {
            console.log(err);
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = '温湿度记录' + '.docx';
            link.click();
            this.$message.success('导出成功')
          }
        }
      })
    },
    deleteRowFun1(row) {
      this.$confirm('此操作将永久删除该数据, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeTempHumRecord + '?tempHumId=' + row.tempHumId).then(res => {
          this.$message.success('删除成功!')
          this.initData1(this.saveRow.dateId)
        })
      })
    },
    initData() {
      this.$axios.get(this.$api.facilitiesAndEnvironment.getFeTempHumDate + '?size=' + this.search.size + '&current=' + this.search.current + '&testAreaName=' + this.search.testAreaName).then(res => {
        if (res.code === 201) return;
        this.tableData = res.data.records;
        this.search.total = res.data.total;
        if (res.data.records.length === 0) {
          this.tableData1 = []
          this.saveRow.monthDate = ''
        }
      });
    },
    initData1(dateId) {
      this.$axios.get(this.$api.facilitiesAndEnvironment.getFeTempHumRecordPage + '?size=' + this.search1.size + '&current=' + this.search1.current + '&dateId=' + dateId).then(res => {
        if (res.code === 201) return;
        this.tableData1 = res.data.records;
        this.search1.total = res.data.total;
      });
    },
    handleSizeChange(val) {
      this.search.size = val;
      this.initData();
    },
    handleCurrentChange(val) {
      this.search.current = val;
      this.initData();
    },
    handleSizeChange1(val) {
      this.search1.size = val;
      this.initData1();
    },
    handleCurrentChange1(val) {
      this.search1.current = val;
      this.initData1();
    },
    clickAdd() {
      this.dialogVisible = true
    }
  }
}
</script>
<style scoped>
.header {
  height: 3em;
  width: 100%;
  display: flex;
  justify-content: space-between;
}
</style>
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/three-wastes-dialog.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,189 @@
<template>
  <div>
    <el-dialog v-loading="diaLoading" :close-on-click-modal="false"
               :close-on-press-escape="false"
               :visible.sync="formDia"
               title="三废处理信息"
               width="80%" @close="closeThreeWastesDia">
      <el-form ref="form" :model="form" :rules="rules" label-width="auto">
        <el-col :span="24">
          <el-form-item label="备注" prop="purposes">
            <el-input v-model="form.remark" clearable size="small"></el-input>
          </el-form-item>
        </el-col>
      </el-form>
      <div style="text-align: right;margin-bottom: 10px">
        <el-button size="small" type="primary" @click="addRow">添加</el-button>
        <el-button size="small" type="danger" @click="clearTable">清空</el-button>
      </div>
      <el-table :data="wastesDetailList" border height="300" style="width: 100%">
        <el-table-column align="center" label="序号" type="index" width="60" />
        <el-table-column header-align="center" label="接收人" prop="acceptor">
          <template slot-scope="{row}">
            <el-input v-model="row.acceptor" size="small"/>
          </template>
        </el-table-column>
        <el-table-column header-align="center" label="接收单位" prop="receivingUnit">
          <template slot-scope="{row}">
            <el-input v-model="row.receivingUnit" size="small"/>
          </template>
        </el-table-column>
        <el-table-column header-align="center" label="名称" prop="designation">
          <template slot-scope="{row}">
            <el-input v-model="row.designation" size="small"/>
          </template>
        </el-table-column>
        <el-table-column header-align="center" label="移交人" prop="transferPeople" width="180">
          <template slot-scope="{row}">
            <el-input v-model="row.transferPeople" size="small"/>
          </template>
        </el-table-column>
        <el-table-column header-align="center" label="体积" prop="volume" width="180">
          <template slot-scope="{row}">
            <el-input v-model="row.volume" size="small"/>
          </template>
        </el-table-column>
        <el-table-column header-align="center" label="送处理日期" prop="deliveryDate" width="180">
          <template slot-scope="{row}">
            <!-- <el-input v-model="row.deliveryDate" size="small"/> -->
            <el-date-picker
                value-format="yyyy-MM-dd"
                style="width: 100%"
                format="yyyy-MM-dd"
                size="small"
                v-model="row.deliveryDate"
                type="date"
                placeholder="选择日期">
              </el-date-picker>
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeThreeWastesDia">取 æ¶ˆ</el-button>
        <el-button :loading="loading" type="primary" @click="handleEdit">提 äº¤</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import {
  getInternalWastesOne,
  addInternalWastes,
  updateInternalWastes
} from '@/api/cnas/resourceDemand/facilitiesEnvironment/internalWastes'
export default {
  name: 'three-wastes-dialog',
  // import å¼•入的组件需要注入到对象中才能使用
  components: {},
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      formDia: false,
      diaLoading: false,
      loading: false,
      form: {
        remark: '',
        wastesId: '',
      },
      rules: {
        remark: [{required: false, message: '请填写备注',trigger: 'blur'}],
      },
      wastesDetailList: [],
      operationType: '',
    };
  },
  mounted() {
  },
  // æ–¹æ³•集合
  methods: {
    // æ‰“开弹框
    openDia (type, row) {
      this.formDia = true
      this.operationType = type
      if (type !== 'add') {
        this.searchInfo(row)
      }
    },
    // æŸ¥è¯¢è¯¦æƒ…
    searchInfo (row) {
      this.diaLoading = true
      getInternalWastesOne({wastesId: row.wastesId}).then(res => {
        this.diaLoading = false
        if (res.code === 200){
          this.form = res.data
          this.wastesDetailList = this.form.wastesDetailList
        }
      }).catch(err => {
        console.log(err)
        this.diaLoading = false
      })
    },
    // æäº¤å¼¹æ¡†æ•°æ®
    handleEdit () {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          if (this.wastesDetailList.length === 0) {
            this.$message.warning('请添加表格数据')
            return
          }
          this.loading = true
          const internalImplementDto = this.HaveJson(this.form)
          internalImplementDto.wastesDetailList = this.HaveJson(this.wastesDetailList)
          if (this.operationType === 'add') {
            addInternalWastes(internalImplementDto).then(res => {
              this.loading = false
              if (res.code === 200){
                this.$message.success('操作成功')
                this.closeThreeWastesDia()
              }
            }).catch(err => {
              console.log('err---', err);
              this.loading = false
            })
          } else if (this.operationType === 'edit') {
            updateInternalWastes(internalImplementDto).then(res => {
              this.loading = false
              if (res.code === 200){
                this.$message.success('操作成功')
                this.closeThreeWastesDia()
              }
            }).catch(err => {
              console.log('err---', err);
              this.loading = false
            })
          }
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // å¢žåŠ è¡¨æ ¼è¡Œæ•°æ®
    addRow () {
      this.wastesDetailList.push({
        acceptor: '',
        receivingUnit: '',
        designation: '',
        transferPeople: '',
        volume: '',
        deliveryDate: '',
      })
    },
    // æ¸…空表格数据
    clearTable () {
      this.wastesDetailList = []
    },
    closeThreeWastesDia () {
      this.$refs.form.resetFields();
      this.formDia = false
      this.$emit('closeThreeWastesDia')
    },
  }
};
</script>
<style scoped>
</style>
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/three-wastes-treatment.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,202 @@
<template>
  <div class="capacity-scope">
    <div class="search">
      <div>
        <el-form :model="searchForm" ref="searchForm" size="small" :inline="true">
          <el-form-item label="备注" prop="remark">
              <el-input size="small" placeholder="请输入" clearable v-model="searchForm.remark">
              </el-input>
          </el-form-item>
          <el-form-item>
              <el-button type="primary" icon="el-icon-search" size="mini" @click="searchList">查 è¯¢</el-button>
              <el-button icon="el-icon-refresh" size="mini" @click="resetSearchForm">重 ç½®</el-button>
          </el-form-item>
        </el-form>
      </div>
      <div>
        <el-button size="medium" type="primary" @click="openFormDia('add')">新 å¢ž</el-button>
      </div>
    </div>
    <div class="table">
      <lims-table :tableData="tableData" :column="tableColumn" :height="'calc(100vh - 250px)'" @pagination="pagination"
                  :page="page" :tableLoading="tableLoading"></lims-table>
    </div>
    <three-wastes-dialog v-if="threeWastesDia" ref="threeWastesDia" @closeThreeWastesDia="closeThreeWastesDia"></three-wastes-dialog>
  </div>
</template>
<script>
import ThreeWastesDialog from './three-wastes-dialog.vue';
import limsTable from '@/components/Table/lims-table.vue'
import {
  pageInternalWastes,
  removeStandardSubstance,
  exportInternalWastes
} from '@/api/cnas/resourceDemand/facilitiesEnvironment/internalWastes'
export default {
  name: 'a6-three-wastes-treatment',
  // import å¼•入的组件需要注入到对象中才能使用
  components: {
    ThreeWastesDialog,
    limsTable
  },
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      searchForm: {
        remark: '',
      },
      tableColumn: [
        {
          label: '创建时间',
          prop: 'createTime',
          minWidth: '100'
        },
        {
          label: '创建人',
          prop: 'createUserName',
          minWidth: '100'
        },
        {
          label: '备注',
          prop: 'remark',
          minWidth: '100'
        },
        {
          label: '修改时间',
          prop: 'updateTime',
          minWidth: '100'
        },
        {
          label: '修改人',
          prop: 'updateUserName',
          minWidth: '100'
        },
        {
          dataType: 'action',
          fixed: 'right',
          minWidth: '220',
          label: '操作',
          operation: [
            {
              name: '导出',
              type: 'text',
              clickFun: (row) => {
                this.handleDown(row)
              }
            },
            {
              name: '编辑',
              type: 'text',
              clickFun: (row) => {
                this.openFormDia('edit', row);
              },
            },
            {
              name: '删除',
              type: 'text',
              color: '#f56c6c',
              clickFun: (row) => {
                this.delPlan(row)
              },
            }
          ]
        }
      ],
      tableData: [],
      tableLoading: false,
      page: {
        total: 0,
        size: 10,
        current: 1
      },
      total: 0,
      threeWastesDia: false
    };
  },
  mounted() {
    this.searchList()
  },
  // æ–¹æ³•集合
  methods: {
    // æŸ¥è¯¢åˆ—表
    searchList () {
      this.tableLoading = true
      pageInternalWastes({...this.page,...this.searchForm}).then(res => {
        this.tableLoading = false
        if (res.code === 200){
          this.tableData = res.data.records
          this.page.total = res.data.total
        }
      }).catch(err => {
        console.log('err---', err);
        this.tableLoading = false
      })
    },
    // åˆ é™¤
    delPlan (row) {
      this.$confirm('此操作将永久删除该数据, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.tableLoading = true
        removeStandardSubstance({wastesId:row.wastesId}).then(res => {
          this.tableLoading = false
          if (res.code === 200){
            this.$message.success('删除成功')
            this.searchList()
          }
        }).catch(err => {
          this.tableLoading = false
          console.log('err---', err);
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // æ–°å¢žï¼Œç¼–辑,批准弹框
    openFormDia (type, row) {
      this.threeWastesDia = true
      this.$nextTick(() => {
        this.$refs.threeWastesDia.openDia(type, row)
      })
    },
    // å¯¼å‡º
    handleDown (row) {
      exportInternalWastes({wastesId:row.wastesId}).then(res =>{
        this.outLoading = false
        const blob = new Blob([res],{ type: 'application/msword' });
        this.$download.saveAs(blob, '三废处理导出.docx')
        this.$message.success('导出成功')
      })
    },
    closeThreeWastesDia () {
      this.threeWastesDia = false
      this.searchList()
    },
    // é‡ç½®æŸ¥è¯¢æ¡ä»¶
    resetSearchForm () {
      this.searchForm.remark = '';
      this.searchList()
    },
    // åˆ†é¡µåˆ‡æ¢
    pagination(page) {
      this.page.size = page.limit
      this.searchList();
    },
  }
};
</script>
<style scoped>
.search {
  height: 46px;
  display: flex;
  justify-content: space-between;
}
</style>
src/views/CNAS/resourceDemand/facilitiesEnvironment/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,50 @@
<template>
    <div class="main">
      <el-tabs v-model="activeName" :lazy="true" type="border-card">
        <el-tab-pane label="设施和环境条件要求" name="设施和环境条件要求">
          <FacilitiesEnvironmentalConditions v-if="activeName === '设施和环境条件要求'"/>
        </el-tab-pane>
        <el-tab-pane label="三废处理" name="三废处理">
          <a6-three-wastes-treatment v-if="activeName === '三废处理'"></a6-three-wastes-treatment>
        </el-tab-pane>
        <el-tab-pane label="进出人员管理" name="进出人员管理">
          <personnel-management v-if="activeName === '进出人员管理'"></personnel-management>
        </el-tab-pane>
      </el-tabs>
    </div>
  </template>
  <script>
  import FacilitiesEnvironmentalConditions from "../facilitiesEnvironment/component/facilities-environmental-conditions.vue";
//   // å¤–来人员管理
  import ExternalPersonnelManagement from "../facilitiesEnvironment/component/Personnel-management.vue";
  import A6ThreeWastesTreatment from '../facilitiesEnvironment/component/three-wastes-treatment.vue';
//   import PersonnelManagement from '../do/a6-facilities-environment/Personnel-management.vue';
  export default {
    components: {
    //   PersonnelManagement,
      A6ThreeWastesTreatment,
      ExternalPersonnelManagement,
      FacilitiesEnvironmentalConditions
    },
    data() {
      return {
        activeName: '设施和环境条件要求',
      }
    }
  }
  </script>
  <style scoped>
  .main {
    padding: 15px 0;
    width: 100%;
    border-radius: 15px;
  }
  v-deep .el-tabs--border-card>.el-tabs__content {
    height: calc(100vh - 9em);
    padding: 0;
  }
  </style>
src/views/CNAS/resourceDemand/standardMaterial/index.vue
@@ -35,9 +35,6 @@
<script>
// import FormDia from '../do/a6-standard-material-list/formDia.vue';
// import BorrowDia from '../do/a6-standard-material-list/borrowDia.vue';
// import ReturnDia from '../do/a6-standard-material-list/returnDia.vue';
import limsTable from '@/components/Table/lims-table.vue'
import {
  getPageStandardSubstance,
@@ -121,11 +118,6 @@
          prop: 'remark',
          minWidth: '100'
        },
        // {
        //   label: '创建人',
        //   prop: 'createUser',
        //   minWidth: '100'
        // },
        {
          label: '创建时间',
          prop: 'createTime',
src/views/business/productSamplingInfo/components/addQuarterItem.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,290 @@
<template>
  <div>
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="quarterSampleDia" title="季度抽样" width="90%" @close="quarterSampleDia = false">
      <div style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 10px">
        <div style="width: 30%;display: flex;align-items: center;" >
          <span style="width: 50px">编号:</span>
          <el-input v-model="quarterSampleForm.quarterNo" :disabled="operationType !== 'add'" size="small"></el-input>
        </div>
        <div v-if="operationType === 'add'">
          <el-button size="small" type="primary" @click="addQuarter">添加</el-button>
          <el-button size="small" type="danger" @click="clearTable">清空</el-button>
        </div>
      </div>
      <div>
        <el-table v-loading="tableLoading" :data="quarterItems" border height="400" style="width: 100%">
          <el-table-column label="产品类型" prop="productType" width="200">
            <template slot-scope="{row}">
              <template>
                <el-input v-model="row.productType" size="small"/>
              </template>
            </template>
          </el-table-column>
          <el-table-column label="责任人" prop="dutyUser" width="100"></el-table-column>
          <el-table-column label="型号" prop="productModel" width="120">
            <template slot-scope="{row}">
              <template>
                <el-input v-model="row.productModel" size="small" :disabled="operationType === 'view'"/>
              </template>
            </template>
          </el-table-column>
          <el-table-column label="抽样数量" min-width="340" prop="spotCheckNumber">
            <template slot-scope="{row}">
              <template>
                <el-input v-model="row.spotCheckNumber" size="small" :disabled="operationType === 'view'"/>
              </template>
            </template>
          </el-table-column>
          <el-table-column v-if="operationType === 'add'" label="数量" min-width="120" prop="number">
            <template slot-scope="{row}">
              <template>
                <el-input v-model="row.number" size="small" :disabled="operationType === 'view'"/>
              </template>
            </template>
          </el-table-column>
          <el-table-column v-if="operationType !== 'add'" label="抽样时间" prop="spotCheckTime" width="160">
            <template slot-scope="{row}">
              <template>
                <el-date-picker v-model="row.spotCheckTime"
                                format="yyyy-MM-dd"
                                :disabled="operationType === 'view'"
                                placeholder="选择日期"
                                size="small"
                                clearable
                                style="width:100%"
                                type="date"
                                value-format="yyyy-MM-dd">
                </el-date-picker>
              </template>
            </template>
          </el-table-column>
          <el-table-column v-if="operationType !== 'add'" label="试样结论" prop="result" width="130">
            <template v-slot="scope">
              <el-select v-model="scope.row.result" placeholder="请选择" size="small" clearable :disabled="operationType === 'view'">
                <el-option label="合格" value="合格"></el-option>
                <el-option label="不合格" value="不合格"></el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column v-if="operationType !== 'add'" label="取样人员" prop="samplingUser" width="120">
            <template slot-scope="{row}">
              <template>
                <el-input v-model="row.samplingUser" size="small" :disabled="operationType === 'view'"/>
              </template>
            </template>
          </el-table-column>
          <el-table-column label="备注" prop="itemRemark" width="200">
            <template slot-scope="{row}">
              <template>
                <el-input v-model="row.itemRemark" size="small" :disabled="operationType === 'view'"/>
              </template>
            </template>
          </el-table-column>
          <el-table-column v-if="operationType !== 'view'" fixed="right" label="操作" width="100">
            <template slot-scope="scope">
              <el-button size="small" style="color: #f56c6c" type="text" @click="deleteScope(scope.$index)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div style="display: flex;align-items: center;margin: 10px 0">
        <span style="width: 70px">备注:</span>
        <el-input v-model="quarterSampleForm.remark" :disabled="operationType === 'view'" size="small" style="width: 43%" type="textarea"></el-input>
      </div>
      <div v-if="operationType !== 'add'">
        <el-form ref="form" :model="editForm" label-width="70px">
          <el-col :span="12">
            <el-form-item label="编制人:">
              <el-select v-model="editForm.writeUser" :disabled="operationType !=='edit'" placeholder="请选择" size="small" style="width: 100%">
                <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="会签人:">
              <el-select v-model="editForm.countersignUser" :disabled="operationType !=='edit'" multiple placeholder="请选择" size="small" style="width: 100%">
                <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="审核人:">
              <el-select v-model="editForm.examineUser" :disabled="operationType !=='edit'" placeholder="请选择" size="small" style="width: 100%">
                <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="批准人:">
              <el-select v-model="editForm.ratifyUser" :disabled="operationType !=='edit'" placeholder="请选择" size="small" style="width: 100%">
                <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="quarterSampleDia = false">取 æ¶ˆ</el-button>
        <el-button v-if="operationType === 'add'" @click="quarterSampleDia = false">保 å­˜</el-button>
        <el-button v-if="operationType !== 'add' && operationType !== 'view'" type="primary" @click="handleSample">ç¡® å®š</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import {addQuarter, getQuarter, updateQuarterOnOrder} from "@/api/business/productSamplingInfo";
import {selectUserCondition} from "@/api/performance/class";
export default {
  name: "addQuarterItem",
  // import å¼•入的组件需要注入到对象中才能使用
  components: {},
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      tableLoading: false,
      quarterSampleDia: false, // å­£åº¦æŠ½æ ·å¼¹æ¡†
      quarterSampleForm: {
        quarterNo: '', // ç¼–号
      },
      quarterItems: [],
      quarterTemItems: [],
      operationType: '',
      editForm: {
        quarterId: '',
        writeUser: '', // ç¼–制人
        countersignUser: [], // ä¼šç­¾äºº
        examineUser: '', // å®¡æ ¸äºº
        ratifyUser: '', // æ‰¹å‡†äºº
      },
      userList: [],
      quarterRow: {},
    }
  },
  mounted() {
    this.getUserList()
  },
  // æ–¹æ³•集合
  methods: {
    openDia (quarterTemItems, type) {
      this.quarterSampleDia = true
      this.operationType = type
      if (type === 'add') {
        if (quarterTemItems.length > 0) {
          this.quarterItems = quarterTemItems
        }
        this.quarterSampleForm.quarterNo = getCurrentMonthTwoDigits()
      } else {
        this.tableLoading = true
        this.quarterRow = quarterTemItems
        getQuarter({quarterId: quarterTemItems.quarterId}).then(res => {
          this.tableLoading = false
          if (res.code === 200) {
            this.quarterItems = res.data.quarterItems
            this.quarterSampleForm.quarterNo = res.data.quarterNo
            this.quarterSampleForm.remark = res.data.remark
            this.editForm.quarterId = res.data.quarterId
            this.editForm.writeUser = res.data.writeUser
            this.editForm.examineUser = res.data.examineUser
            this.editForm.ratifyUser = res.data.ratifyUser
            if (res.data.countersignUser) {
              this.editForm.countersignUser = res.data.countersignUser.split(",").map(Number)
            }
          }
        })
      }
    },
    // æ‰‹åŠ¨æ·»åŠ 
    addQuarter () {
      this.quarterItems.push({
        productType: '',
        dutyUser: JSON.parse(localStorage.getItem("user")).name,
        productModel: '',
        spotCheckNumber: '',
        number: '',
        spotCheckTime: '',
        result: '',
        samplingUser: '',
        itemRemark: '',
      })
    },
    // æäº¤å­£åº¦æŠ½æ ·
    handleSample () {
      this.$confirm('是否提交该数据', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        if (this.operationType === 'add') {
          this.quarterSampleForm.quarterItems = JSON.parse(JSON.stringify(this.quarterItems))
          this.quarterSampleForm.quarterItems.forEach(item => {
            item.spotCheckNumber = item.spotCheckNumber + ' ' + (item.number == null ? "" : item.number)
          })
          addQuarter(this.quarterSampleForm).then(res => {
            if (res.code == 200) {
              this.$message.success('提交成功')
              this.quarterItems = []
              this.$parent.quarterTemItems = []
              this.closeQuarterSampleDia()
            }
          })
        } else {
          const params = {...this.editForm}
          if (params.countersignUser.length > 0) {
            params.countersignUser = params.countersignUser.join(',')
          } else {
            params.countersignUser = ''
          }
          params.quarterItems = JSON.parse(JSON.stringify(this.quarterItems))
          updateQuarterOnOrder(params).then(res => {
            if (res.code == 200) {
              this.$message.success('提交成功')
              this.quarterItems = []
              this.closeQuarterSampleDia()
            }
          })
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        });
      });
    },
    // æ¸…空抽样计划
    clearTable () {
      this.quarterItems = []
      this.$parent.quarterTemItems = []
    },
    // æ‰‹åŠ¨åˆ é™¤
    deleteScope (index) {
      this.quarterItems.splice(index, 1)
    },
    // å…³é—­å­£åº¦æŠ½æ ·å¼¹æ¡†
    closeQuarterSampleDia () {
      this.quarterSampleDia = false
      if (this.operationType === 'add') {
        this.$parent.handleStockList()
      } else {
        this.$parent.refreshTable()
      }
    },
    getUserList(){
      selectUserCondition({ type: 0 }).then((res) => {
        this.userList = res.data;
      })
    },
  },
}
function getCurrentMonthTwoDigits() {
  const currentDate = new Date();
  const year = currentDate.getFullYear();
  const currentMonth = currentDate.getMonth() + 1;
  return year + currentMonth.toString().padStart(2, '0');
}
</script>
<style scoped>
</style>
src/views/business/productSamplingInfo/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,647 @@
<template>
  <div class="capacity-scope">
    <div style="display: flex;justify-content: space-between">
      <el-form :model="entity" ref="entity" size="small" :inline="true">
        <el-form-item label="编号" prop="quarterNo" v-show="tabIndex === 0">
          <el-input v-model="entity.quarterNo" clearable placeholder="请输入"
                    size="small"
                    @keyup.enter.native="refreshTable">
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="refreshTable">查 è¯¢</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="refresh">重 ç½®</el-button>
        </el-form-item>
      </el-form>
      <div>
        <el-button v-if="tabIndex === 1" size="small" type="primary" @click="yearSample('add')">年度抽样</el-button>
      </div>
    </div>
    <div>
      <div class="table">
        <ul class="tab">
          <li v-for="(m,i) in tabList" :key="i" :class="{active:i===tabIndex}" @click="handleTab(m,i)">{{m.label}}</li>
        </ul>
        <!--季度-->
        <lims-table :tableData="tableData" :column="column" v-if="tabIndex === 0"
                    @pagination="pagination" :height="'calc(100vh - 290px)'"
                    :page="page" :tableLoading="tableLoading"></lims-table>
        <!--年度-->
        <lims-table :tableData="tableData1" :column="column1" v-if="tabIndex === 1"
                    @pagination="pagination1" :height="'calc(100vh - 290px)'"
                    key="tableData1" :page="page1" :tableLoading="tableLoading1"></lims-table>
      </div>
    </div>
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="yearSampleDia" title="年度抽样" width="70%"
               @close="closeYearSampleDia">
      <div style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 10px">
        <div style="width: 30%;display: flex;align-items: center;" >
          <el-input v-if="operationType !=='view'" v-model="currentYear" size="small"/>
          <span v-if="operationType ==='view'" style="width: 160px;font-size: 18px;font-weight: 600">{{currentYear}}</span>
        </div>
        <div  v-if="operationType !== 'view'">
          <el-button size="small" type="primary" @click="addQuarter">添加</el-button>
          <el-button size="small" type="danger" @click="clearTable">清空</el-button>
        </div>
      </div>
      <div>
        <el-table :data="yearItems" border height="450" style="width: 100%">
          <el-table-column label="类别" prop="yearType" width="240">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.yearType" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.yearType}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="1" prop="january" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.january" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.january}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="2" prop="february" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.february" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.february}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="3" prop="march" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.march" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.march}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="4" prop="april" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.april" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.april}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="5" prop="may" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.may" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.may}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="6" prop="june" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.june" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.june}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="7" prop="july" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.july" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.july}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="8" prop="august" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.august" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.august}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="9" prop="september" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.september" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.september}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="10" prop="october" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.october" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.october}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="11" prop="november" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.november" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.november}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="12" prop="december" width="160">
            <template slot-scope="{row}">
              <template v-if="operationType !== 'view'">
                <el-input v-model="row.december" size="small" type="textarea" :rows="4"/>
              </template>
              <template v-else>
                <span size="small">{{row.december}}</span>
              </template>
            </template>
          </el-table-column>
          <el-table-column v-if="operationType !== 'view'" fixed="right" label="操作"  width="100">
            <template slot-scope="scope">
              <el-button size="small" style="color: #f56c6c" type="text" @click="deleteScope(scope.$index)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div style="display: flex;align-items: center;margin-top: 10px">
        <span style="width: 70px">注意事项:</span>
        <el-input v-model="yearSampleForm.tableRemark" :disabled="operationType === 'view'" size="small" style="width: 50%" type="textarea"></el-input>
      </div>
      <div style="display: flex;align-items: center;margin-top: 10px">
        <span style="width: 70px">备注:</span>
        <el-input v-model="yearSampleForm.remark" :disabled="operationType === 'view'" size="small" style="width: 50%" type="textarea"></el-input>
      </div>
      <div v-if="operationType !== 'add'">
        <el-form ref="form" :model="editYearFormRow" label-width="70px">
          <el-col :span="12">
            <el-form-item label="编制人:">
              <el-select v-model="editYearFormRow.writeUser" :disabled="operationType !=='edit'" placeholder="请选择" size="small" style="width: 100%">
                <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="会签人:">
              <el-select v-model="editYearFormRow.countersignUser" :disabled="operationType !=='edit'" multiple placeholder="请选择" size="small" style="width: 100%">
                <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="审核人:">
              <el-select v-model="editYearFormRow.examineUser" :disabled="operationType !=='edit'" placeholder="请选择" size="small" style="width: 100%">
                <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="批准人:">
              <el-select v-model="editYearFormRow.ratifyUser" :disabled="operationType !=='edit'" placeholder="请选择" size="small" style="width: 100%">
                <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeYearSampleDia">取 æ¶ˆ</el-button>
        <el-button v-if="operationType !== 'view'" type="primary" @click="handleSample">ç¡® å®š</el-button>
      </span>
    </el-dialog>
    <add-quarter-item ref="addQuarterItem"></add-quarter-item>
  </div>
</template>
<script>
import AddQuarterItem from "./components/addQuarterItem.vue";
import limsTable from "@/components/Table/lims-table.vue";
import {
  addSpotCheckYear,
  deleteQuarter, deleteSpotCheckYear,
  finalReportQuarter,
  finalReportSpotCheckYear,
  getQuarterPage, getSpotCheckYear, getSpotCheckYearPage, updateSpotCheckYear
} from "@/api/business/productSamplingInfo";
import {selectUserCondition} from "@/api/performance/class";
export default {
  name: "b1-product-sampling-info",
  // import å¼•入的组件需要注入到对象中才能使用
  components: {limsTable, AddQuarterItem},
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      upIndex: 0,
      tabIndex: 0,
      tabList: [
        {
          label: '季度',
          value: 0
        },
        {
          label: '年度',
          value: 1
        },
      ],
      entity: {
        quarterNo: null,
      },
      tableData: [],
      tableLoading: false,
      column: [
        {label: '编号', prop: 'quarterNo'},
        {label: '备注', prop: 'remark'},
        {label: '创建人', prop: 'createUserName'},
        {label: '创建时间', prop: 'createTime'},
        {
          dataType: 'action',
          label: '操作',
          operation: [
            {
              name: '编辑',
              type: 'text',
              clickFun: (row) => {
                this.editForm(row);
              },
            },
            {
              name: '查看',
              type: 'text',
              clickFun: (row) => {
                this.viewQuarterInfo(row);
              },
            },
            {
              name: '下载',
              type: 'text',
              clickFun: (row) => {
                this.handleDown(row);
              },
            },
            {
              name: '删除',
              type: 'text',
              clickFun: (row) => {
                this.deleteQuarterInfo(row);
              },
            }
          ]
        }
      ],
      page: {
        total:0,
        size:10,
        current:1
      },
      tableData1: [],
      tableLoading1: false,
      column1: [
        { label: '名称', prop: 'yearHead' },
        { label: '创建人', prop: 'createUserName' },
        { label: '创建时间', prop: 'createTime' },
        {
          dataType: 'action',
          label: '操作',
          operation: [
            {
              name: '编辑',
              type: 'text',
              clickFun: (row) => {
                this.editYearForm(row);
              },
            },
            {
              name: '查看',
              type: 'text',
              clickFun: (row) => {
                this.viewYearInfo(row);
              },
            },
            {
              name: '下载',
              type: 'text',
              clickFun: (row) => {
                this.download(row);
              },
            },
            {
              name: '删除',
              type: 'text',
              clickFun: (row) => {
                this.deleteYearInfo(row);
              },
            },
          ]
        }
      ],
      page1: {
        total: 0,
        size: 10,
        current: 1
      },
      yearSampleDia: false, // å¹´åº¦æŠ½æ ·
      yearSampleForm: {
        tableRemark: '',
        remark: ''
      },
      yearItems: [],
      currentYear: '',
      operationType: '',
      userList: [],
      yearRow: {},
      editYearFormRow: {
        yearId: '',
        writeUser: '', // ç¼–制人
        countersignUser: null, // ä¼šç­¾äºº
        examineUser: '', // å®¡æ ¸äºº
        ratifyUser: '', // æ‰¹å‡†äºº
      }
    }
  },
  mounted() {
    this.refreshTable()
  },
  // æ–¹æ³•集合
  methods: {
    // æŸ¥è¯¢å›žè°ƒ
    refreshTable(e) {
      if (this.tabIndex === 0) {
        this.getQuarterPageList()
      } else if (this.tabIndex === 1) {
        this.getSpotCheckYearPageList()
      }
    },
    getQuarterPageList () {
      this.tableLoading = true
      getQuarterPage({
        ...this.page,...this.entity
      }).then(res => {
        this.tableLoading = false
        this.page.total = res.data.total
        this.tableData = res.data.records
      }).catch(err => {
        this.tableLoading = false
      })
    },
    getSpotCheckYearPageList () {
      this.tableLoading1 = true
      getSpotCheckYearPage({
        ...this.page1
      }).then(res => {
        this.tableLoading1 = false
        this.page1.total = res.data.total
        this.tableData1 = res.data.records
      }).catch(err => {
        this.tableLoading1 = false
      })
    },
    // é‡ç½®
    refresh() {
      this.resetForm('entity')
      this.refreshTable()
    },
    pagination (page) {
      this.page.size = page.limit
      this.refreshTable()
    },
    pagination1 (page) {
      this.page1.size = page.limit
      this.refreshTable()
    },
    // ç¼–辑季度抽样
    editForm (row) {
      this.$refs.addQuarterItem.openDia(row, 'edit')
    },
    // æŸ¥çœ‹å­£åº¦æŠ½æ ·
    viewQuarterInfo (row) {
      this.$refs.addQuarterItem.openDia(row, 'view')
    },
    // åˆ é™¤å­£åº¦æŠ½æ ·
    deleteQuarterInfo (row) {
      this.$confirm('是否删除当前数据?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        deleteQuarter({quarterId: row.quarterId}).then(res => {
          if (res.code === 200) {
            this.$message.success('删除成功')
            this.refreshTable()
          }
        })
      }).catch(() => {})
    },
    // å¯¼å‡º
    handleDown (row) {
      let randomNum = Math.random();
      finalReportQuarter({quarterId: row.quarterId, random: randomNum}).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/octet-stream' });
        this.$download.saveAs(blob, '季度抽样信息导出.docx')
        this.$message.success('导出成功')
      })
    },
    // å¹´åº¦ä¸‹è½½
    download(row) {
      finalReportSpotCheckYear({yearId: row.yearId}).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/octet-stream' });
        this.$download.saveAs(blob, row.yearHead + '.docx')
        this.$message.success('导出成功')
      })
    },
    // åˆ é™¤å¹´åº¦æŠ½æ ·
    deleteYearInfo (row) {
      this.$confirm('是否删除当前数据?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        deleteSpotCheckYear({yearId: row.yearId}).then(res => {
          if (res.code === 200) {
            this.$message.success('删除成功')
            this.refreshTable()
          }
        })
      }).catch(() => {})
    },
    // æŸ¥çœ‹å¹´åº¦è¯¦æƒ…
    viewYearInfo (row) {
      this.operationType = 'view'
      this.getUserList()
      this.yearSampleDia = true
      this.yearRow = row
      getSpotCheckYear({yearId: row.yearId}).then(res => {
        if (res.code === 200) {
          this.currentYear = res.data.yearHead
          this.yearItems = res.data.yearItems
          this.yearSampleForm.tableRemark = res.data.tableRemark
          this.yearSampleForm.remark = res.data.remark
          this.editYearFormRow.yearId = res.data.yearId
          this.editYearFormRow.writeUser = res.data.writeUser
          this.editYearFormRow.examineUser = res.data.examineUser
          this.editYearFormRow.ratifyUser = res.data.ratifyUser
          if (res.data.countersignUser) {
            this.editYearFormRow.countersignUser = res.data.countersignUser.split(",").map(Number)
          }
        }
      })
    },
    // ç¼–辑年度抽样
    editYearForm (row) {
      this.operationType = 'edit'
      this.getUserList()
      this.yearSampleDia = true
      getSpotCheckYear({yearId: row.yearId}).then(res => {
        if (res.code === 200) {
          this.currentYear = res.data.yearHead
          this.yearItems = res.data.yearItems
          this.yearSampleForm.tableRemark = res.data.tableRemark
          this.yearSampleForm.remark = res.data.remark
          this.editYearFormRow.yearId = res.data.yearId
          this.editYearFormRow.writeUser = res.data.writeUser
          this.editYearFormRow.examineUser = res.data.examineUser
          this.editYearFormRow.ratifyUser = res.data.ratifyUser
          if (res.data.countersignUser) {
            this.editYearFormRow.countersignUser = res.data.countersignUser.split(",").map(Number)
          }
        }
      })
    },
    // æäº¤å¹´åº¦è®¡åˆ’
    handleSample () {
      if (this.operationType === 'add') {
        this.yearSampleForm.yearItems = JSON.parse(JSON.stringify(this.yearItems))
        this.yearSampleForm.yearHead = this.currentYear
        addSpotCheckYear(this.yearSampleForm).then(res => {
          if (res.code == 200) {
            this.$message.success('提交成功')
            this.yearSampleForm = {}
            this.yearItems = []
            this.closeYearSampleDia()
            this.refreshTable()
          }
        })
      } else {
        const params = {...this.editYearFormRow}
        if (params.countersignUser != null) {
          params.countersignUser = params.countersignUser.join(',')
        }
        params.yearItems = JSON.parse(JSON.stringify(this.yearItems))
        params.tableRemark = this.yearSampleForm.tableRemark
        params.remark = this.yearSampleForm.remark
        updateSpotCheckYear(params).then(res => {
          if (res.code == 200) {
            this.$message.success('修改成功')
            this.yearSampleForm = {}
            this.editYearFormRow = {
              yearId: '',
              writeUser: '', // ç¼–制人
              countersignUser: [], // ä¼šç­¾äºº
              examineUser: '', // å®¡æ ¸äºº
              ratifyUser: '', // æ‰¹å‡†äºº
            }
            this.yearItems = []
            this.closeYearSampleDia()
            this.refreshTable()
          }
        })
      }
    },
    yearSample (type) {
      this.operationType = type
      const currentDate = new Date();
      this.yearSampleDia = true
      this.currentYear = currentDate.getFullYear() + '年年度抽检计划'
    },
    // æ·»åŠ å¹´åº¦è®¡åˆ’
    addQuarter () {
      this.yearItems.push({})
    },
    // æ¸…空抽样计划
    clearTable () {
      this.yearItems = []
    },
    // æ‰‹åŠ¨åˆ é™¤
    deleteScope (index) {
      this.yearItems.splice(index, 1)
    },
    // åˆ‡æ¢ä¸‹å•tab表格
    handleTab(m, i) {
      this.tabIndex = i;
      if (this.tabIndex === 0) {
        this.componentData.entity.quarterNo = this.entity.quarterNo
      }
      this.refreshTable()
    },
    closeYearSampleDia () {
      this.yearSampleForm = {
        tableRemark: '',
        remark: ''
      }
      this.yearItems = []
      this.yearSampleDia = false
    },
    getStyle(){
      return 'height: calc(100% - '+'44'+'px)'
    },
    getUserList(){
      selectUserCondition({ type: 0 }).then((res) => {
        this.userList = res.data;
      })
    },
  },
}
</script>
<style scoped>
.tab {
  list-style-type: none;
  display: flex;
  margin-bottom: 12px;
  margin-top: 0;
  padding-left: 0;
}
.tab li {
  line-height: 24px;
  padding: 6px 14px;
  font-size: 14px;
  color: #333333;
  border: 1px solid #EEEEEE;
  cursor: pointer;
}
.tab li:nth-child(1) {
  border-radius: 8px 0 0 8px;
}
.tab li:nth-child(2) {
  border-radius: 0 8px 8px 0;
}
.tab li.active {
  border-color: #3A7BFA;
  color: #3A7BFA;
}
</style>