zhuo
2025-04-17 06ca842a5219511302497d0a87be4293ae7cb7a0
Merge remote-tracking branch 'origin/dev' into dev
已修改6个文件
已删除1个文件
已添加2个文件
1145 ■■■■■ 文件已修改
src/api/cnas/resourceDemand/device.js 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/addVerificationYearPlanDia.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue 289 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/maintenance.vue 287 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue 376 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/index.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/cnas/resourceDemand/device.js
@@ -874,42 +874,6 @@
  });
}
//设备保养单条导出
export function exportMaintenanceRecord(query) {
  return request({
    url: "/deviceMaintain/exportMaintenanceRecord",
    method: "get",
    responseType: "blob",
    params: query,
  });
}
//设备维护删除
export function deleteDeviceMaintenance(query) {
  return request({
    url: "/deviceMaintain/deleteDeviceMaintenance",
    method: "delete",
    params: query,
  });
}
// æ–°å¢žè®¾å¤‡ç»´æŠ¤ä¿å…»
export function addDeviceMaintenance(data) {
  return request({
    url: "/deviceMaintain/addDeviceMaintenance",
    method: "post",
    data: data,
  });
}
//设备维护表 æŸ¥è¯¢
export function getDeviceMaintenancePage(query) {
  return request({
    url: "/deviceMaintain/getDeviceMaintenancePage",
    method: "get",
    params: query,
  });
}
// å€Ÿç”¨-保存
export function saveDeviceBorrow(data) {
  return request({
@@ -1275,3 +1239,84 @@
    params: query,
  });
}
//设备维护保养 æŸ¥è¯¢
export function selectDeviceMaintenancePage(query) {
  return request({
    url: "/deviceMaintain/selectDeviceMaintenancePage",
    method: "get",
    params: query,
  });
}
//设备维护保养 åˆ é™¤
export function deleteDeviceMaintenance(query) {
  return request({
    url: "/deviceMaintain/deleteDeviceMaintenance",
    method: "delete",
    params: query,
  });
}
//设备维护保养 æ–°å¢ž
export function addDeviceMaintenance(query) {
  return request({
    url: "/deviceMaintain/addDeviceMaintenance",
    method: "post",
    data: query,
  });
}
//设备使用授权 åˆ†é¡µæŸ¥è¯¢
export function selectDeviceImpowerByPage(query) {
  return request({
    url: "/deviceImpower/selectDeviceImpowerByPage",
    method: "get",
    params: query,
  });
}
//设备使用授权 æŸ¥è¯¢è¯¦æƒ…
export function getImpowerDetail(query) {
  return request({
    url: "/deviceImpower/getImpowerDetail",
    method: "get",
    params: query,
  });
}
//设备使用授权 åˆ é™¤
export function deleteImpower(query) {
  return request({
    url: "/deviceImpower/deleteImpower",
    method: "delete",
    params: query,
  });
}
//设备使用授权 å¯¼å‡º
export function exportDeviceImpower(query) {
  return request({
    url: "/deviceImpower/exportDeviceImpower",
    method: "get",
    responseType: "blob",
    params: query,
  });
}
//设备使用授权 æ–°å¢ž
export function addImpower(query) {
  return request({
    url: "/deviceImpower/addImpower",
    method: "post",
    data: query,
  });
}
//设备使用授权 ä¿®æ”¹
export function updateImpower(query) {
  return request({
    url: "/deviceImpower/updateImpower",
    method: "post",
    data: query,
  });
}
//设备使用授权 æ‰¹å‡†æŽˆæƒ
export function reviewImpowerStatus(query) {
  return request({
    url: "/deviceImpower/reviewImpowerStatus",
    method: "post",
    data: query,
  });
}
src/views/CNAS/resourceDemand/device/component/addVerificationYearPlanDia.vue
@@ -14,7 +14,7 @@
      <div style="margin: 10px 0">
        <el-table ref="yearTable" :data="examinePlanDetailsList" id="templateParamTable" row-key="deviceId"
                  v-loading="yearTableLoading"
                  :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border height="500px">
                  :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border height="560px">
          <el-table-column label="设备名称" min-width="190" prop="deviceName">
            <template slot-scope="scope">
              <el-input v-model="scope.row.deviceName" clearable size="small"></el-input>
src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue
@@ -12,7 +12,7 @@
        </el-date-picker>
      </div>
      <div style="margin: 10px 0">
        <el-table id="templateParamTable" ref="yearTable" :data="calibrationPlanDetailList" height="300px"
        <el-table id="templateParamTable" ref="yearTable" :data="calibrationPlanDetailList" height="560px"
                  v-loading="yearTableLoading"
                  :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
          row-key="deviceId" style="width: 100% ;">
src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,289 @@
<template>
  <div>
    <div class="search">
      <el-button size="small" type="primary" @click="refreshTableList">刷新</el-button>
      <el-button size="small" type="primary" @click="openDia('add')">新 å»º</el-button>
      <el-button :loading="outLoading" size="small" type="primary" @click="openHandleOut">导 å‡º</el-button>
    </div>
    <div>
      <lims-table :tableData="tableData" :column="column"
                  height="calc(100vh - 20em)" @pagination="pagination"
                  :page="page" :tableLoading="tableLoading"></lims-table>
    </div>
    <el-dialog :visible.sync="dialogVisible" title="仪器设备使用维护保养表" width="55%">
      <el-form ref="form" :model="form" label-width="130px" :rules="rules">
        <el-row>
          <el-col :span="12">
            <el-form-item label="维护日期:" prop="maintenanceDate">
              <el-date-picker v-model="form.maintenanceDate" :disabled="operationType === 'view'"
                              format="yyyy-MM-dd" size="small" placeholder="选择日期" style="width:100%"
                              type="date" value-format="yyyy-MM-dd">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="维护内容:" prop="maintenanceContentArr">
              <el-checkbox-group v-model="form.maintenanceContentArr" :disabled="operationType === 'view'">
                <el-checkbox v-for="city in qualificationList" :key="city.label" :label="city.label"
                             :value="city.label"></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="维护人:" prop="maintenanceUserId">
              <el-select v-model="form.maintenanceUserId"
                         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="remark">
              <el-input v-model="form.remark" :disabled="operationType === 'view'" size="small"
                        style="width: 100%;"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeDia">取 æ¶ˆ</el-button>
        <el-button v-if="operationType !== 'view'" type="primary" @click="saveRecord" :loading="buttonLoading">ç¡® å®š</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import {
  addDeviceMaintenance,
  deleteDeviceMaintenance,
  selectDeviceMaintenancePage
} from "@/api/cnas/resourceDemand/device";
import limsTable from "@/components/Table/lims-table.vue";
import {selectUserCondition} from "@/api/system/user";
export default {
  name: '',
  // import å¼•入的组件需要注入到对象中才能使用
  components: {limsTable},
  props: {
    clickNodeVal: {
      type: Object,
      default: () => {
        return {};
      }
    },
  },
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      search: {
        maintenanceDate: '',
      },
      outLoading: false,
      tableData: [],
      tableLoading: false,
      page: {
        total: 0,
        size: 20,
        current: 1
      },
      column: [
        { label: '维护日期', prop: 'maintenanceDate' },
        { label: '维护内容', prop: 'maintenanceContent' },
        { label: '维护人', prop: 'maintenanceUserName' },
        { label: '备注', prop: 'remark' },
        {
          dataType: 'action',
          label: '操作',
          operation: [
            {
              name: '编辑',
              type: 'text',
              clickFun: (row) => {
                this.openDia('edit', row);
              },
            },
            {
              name: '删除',
              type: 'text',
              clickFun: (row) => {
                this.handleDeleteClick(row);
              },
            },
          ]
        }
      ],
      dialogVisible: false,
      form: {
        id: '',
        deviceId: '',
        maintenanceDate: '',
        maintenanceContentArr: [],
        maintenanceContent: '',
        maintenanceUserId: '',
        remark: '',
      },
      operationType: '',
      buttonLoading: false,
      qualificationList: [],
      rules: {
        maintenanceDate: [{ required: true, message: '请选择维护日期', trigger: 'change' }],
        maintenanceContentArr: [{ required: true, message: '请选择维护内容', trigger: 'change' }],
        maintenanceUserId: [{ required: true, message: '请选择维护人', trigger: 'change' }],
      },
      responsibleOptions: [],
    };
  },
  mounted() {
    this.refreshTableList()
  },
  // æ–¹æ³•集合
  methods: {
    // ç‚¹å‡»åˆ·æ–°
    refreshTableList () {
      this.page.current = 1;
      this.getTableList()
    },
    // åˆ†é¡µåˆ‡æ¢
    pagination(page) {
      this.page.size = page.limit
      this.getTableList()
    },
    getTableList () {
      this.tableLoading = true
      selectDeviceMaintenancePage({
        deviceId: this.clickNodeVal.value,
        ...this.page
      }).then(res => {
        this.tableLoading = false
        this.tableData = res.data.records
        this.page.total = res.data.total
      }).catch(err => {
        this.tableLoading = false
      })
    },
    // æ‰“开操作弹框
    openDia (type, row) {
      this.operationType = type
      this.dialogVisible = true
      this.$nextTick(() => {
        this.$refs['form'].resetFields()
        this.form.id = ''
        if (this.operationType === 'edit') {
          this.form = {...row}
          this.$set(this.form, 'maintenanceContentArr', this.form.maintenanceContent.split(','))
        }
      })
      this.getDictS()
      this.getUserList()
    },
    // æŸ¥è¯¢ç»´æŠ¤å†…容选择框内容
    getDictS () {
      // å®šä¹‰å®žéªŒå®¤åç§°ä¸Žç»´æŠ¤å†…容类型的映射关系
      const labTypeMapping = {
        '老化室': 'aging_maintenance_content',
        '老化实验室': 'aging_maintenance_content',
        '电性能实验室': 'electrical_maintenance_content',
        '环境实验室': 'environmental_maintenance_content',
        '燃烧实验室': 'burn_maintenance_content',
        '混炼实验室': 'mixing_maintenance_content',
        '检测中心电性能实验室': 'center_electrical_maintenance_content',
        '恒温二': 'temperature2_maintenance_content',
        '恒温一': 'temperature1_maintenance_content',
        '化学实验室': 'chemistry_maintenance_content',
        '制样室': 'sample_maintenance_content',
        '低温实验室': 'hypothermia_maintenance_content',
      };
      // èŽ·å–å½“å‰èŠ‚ç‚¹çš„å®žéªŒå®¤åç§°
      const name = this.clickNodeVal.parent.label;
      // æ ¹æ®æ˜ å°„关系获取对应的类型
      const type = labTypeMapping[name];
      this.getDicts(type).then((response) => {
        this.qualificationList = response.data.map((m) => {
          return {
            label: m.dictLabel,
            value: m.dictValue,
          };
        });
      });
    },
    openHandleOut () {
    },
    handleDeleteClick(row) {
      this.$confirm('此操作将永久删除该文件, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteDeviceMaintenance({ id: row.id }).then(res => {
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
          this.refreshTableList()
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // æäº¤æ–°å¢žå’Œä¿å­˜
    saveRecord () {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.buttonLoading = true;
          this.form.maintenanceContent = this.form.maintenanceContentArr.join(',')
          this.form.deviceId = this.clickNodeVal.value
          addDeviceMaintenance(this.form).then(res => {
            this.buttonLoading = false;
            this.$message.success('新增成功')
            this.closeDia()
            this.getTableList()
          }).catch(err => {
            this.buttonLoading = false;
          })
        }
      })
    },
    closeDia () {
      this.$refs['form'].resetFields();
      this.dialogVisible = false
      this.refreshTableList()
    },
    // èŽ·å–è´Ÿè´£äººä¿¡æ¯æŽ¥å£
    getUserList() {
      selectUserCondition({type: 2}).then(res => {
        if (res.code == 200) {
          this.responsibleOptions = res.data
        }
      })
    },
  },
  watch: {
    // ç›‘听点击el-tree的数据,进行数据刷新
    clickNodeVal(newVal) {
      if (newVal.value) {
        this.refreshTableList();
      }
    },
  }
};
</script>
<style scoped>
.search {
  height: 46px;
  text-align: right;
  margin-top: 10px;
}
</style>
src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
@@ -28,6 +28,7 @@
            <template slot-scope="scope">
              <el-button :disabled="scope.row.status === 1" size="small" type="text"
                @click="handleForm('edit', scope.row)">编辑</el-button>
              <el-button size="small" type="text" @click="handleForm('view', scope.row)">查看</el-button>
              <el-button :disabled="scope.row.status === 1" size="small" type="text"
                @click="tellApprove(scope.row.maintenancePlanId)">审核通知</el-button>
              <el-button :disabled="scope.row.status === 1 || userId != scope.row.auditId" size="small" type="text"
@@ -47,54 +48,54 @@
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="applicationForm"
      title="设备保养计划表" width="80%" @close="closeDialog">
      <div style="display: flex;align-items: center;">
        <el-button v-if="operationType !== 'check'" size="small" type="primary" @click="addTableRow">添加</el-button>
        <el-button v-if="operationType === 'edit'" size="small" type="primary" @click="addTableRow">添加</el-button>
        <span style="width: 60px;margin-left: 10px">年份:</span>
        <el-date-picker v-model="form.planYear" type="year" value-format="yyyy" clearable size="small" format="yyyy"
          placeholder="选择年">
          placeholder="选择年" :disabled="operationType !== 'edit'">
        </el-date-picker>
      </div>
      <div style="margin: 10px 0">
        <el-table ref="yearTable" :data="deviceMaintenancePlanDetails" id="templateParamTable" row-key="deviceId"
                  :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
          height="300px" style="width: 100% ;">
          height="560px" style="width: 100% ;">
          <el-table-column align="center" header-align="center" label="序号" type="index" width="60"></el-table-column>
          <el-table-column label="设备名称" min-width="170" prop="deviceName">
            <template slot-scope="scope">
              <el-input v-model="scope.row.deviceName" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.deviceName" :disabled="operationType !== 'edit'" clearable
                size="small"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="设备编号" min-width="140" prop="deviceNumber">
            <template slot-scope="scope">
              <el-input v-model="scope.row.deviceNumber" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.deviceNumber" :disabled="operationType !== 'edit'" clearable
                size="small"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="归属实验室" min-width="120" prop="storagePoint">
            <template slot-scope="scope">
              <el-input v-model="scope.row.storagePoint" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.storagePoint" :disabled="operationType !== 'edit'" clearable
                size="small"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="保养关键部位" min-width="120" prop="maintenanceSite">
            <template slot-scope="scope">
              <el-input v-model="scope.row.maintenanceSite" :disabled="operationType === 'check'" clearable size="small"
              <el-input v-model="scope.row.maintenanceSite" :disabled="operationType !== 'edit'" clearable size="small"
                type="textarea"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="保养内容" min-width="120" prop="maintenanceContent">
            <template slot-scope="scope">
              <el-input v-model="scope.row.maintenanceContent" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.maintenanceContent" :disabled="operationType !== 'edit'" clearable
                size="small" type="textarea"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="保养周期" min-width="90" prop="maintenanceIntervals">
            <template slot-scope="scope">
              <el-input v-model="scope.row.maintenanceIntervals" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.maintenanceIntervals" :disabled="operationType !== 'edit'" clearable
                size="small"></el-input>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="80" align="center" v-if="operationType !== 'check'">
          <el-table-column fixed="right" label="操作" width="80" align="center" v-if="operationType === 'edit'">
            <template slot-scope="scope">
              <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">删除</el-button>
            </template>
@@ -103,7 +104,7 @@
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeDialog">取 æ¶ˆ</el-button>
        <el-button v-if="operationType !== 'check'" :loading="submitFormLoading" type="primary" @click="submitForm">ç¡®
        <el-button v-if="operationType === 'edit'" :loading="submitFormLoading" type="primary" @click="submitForm">ç¡®
          è®¤</el-button>
        <el-button v-if="operationType === 'check'" :loading="submitFormLoading" type="primary"
          @click="checkStatus(0)">不通过</el-button>
@@ -124,7 +125,7 @@
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addEquipDia = false">取 æ¶ˆ</el-button>
        <el-button v-if="operationType !== 'check'" :loading="submitFormLoading" type="primary"
        <el-button v-if="operationType === 'edit'" :loading="submitFormLoading" type="primary"
          @click="changeMachineName">ç¡®
          è®¤</el-button>
      </span>
src/views/CNAS/resourceDemand/device/component/maintenance.vue
ÎļþÒÑɾ³ý
src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue
@@ -25,10 +25,11 @@
          </el-table-column>
          <el-table-column label="批准时间" min-width="180" prop="auditDate"></el-table-column>
          <!-- æ“ä½œæŒ‰é’® -->
          <el-table-column align="center" fixed="right" label="操作" min-width="240">
          <el-table-column align="center" fixed="right" label="操作" min-width="270">
            <template slot-scope="scope">
              <el-button :disabled="scope.row.status === 1" size="small" type="text"
                @click="handleForm('edit', scope.row)">编辑</el-button>
              <el-button size="small" type="text" @click="handleForm('view', scope.row)">查看</el-button>
              <el-button :disabled="scope.row.status === 1" size="small" type="text"
                @click="tellApprove(scope.row.traceabilityManagementId)">批准通知</el-button>
              <el-button :disabled="scope.row.status === 1 || userId != scope.row.auditId" size="small" type="text"
@@ -49,66 +50,66 @@
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="applicationForm"
      title="仪器设备量值溯源管理总体计划" width="80%" @close="closeDialog">
      <div style="display: flex;align-items: center;">
        <el-button v-if="operationType !== 'check'" size="small" type="primary" @click="addTableRow">添加</el-button>
        <el-button v-if="operationType === 'edit'" size="small" type="primary" @click="addTableRow">添加</el-button>
        <span style="width: 60px;margin-left: 10px">年份:</span>
        <el-date-picker v-model="form.planYear" type="year" value-format="yyyy" clearable size="small" format="yyyy"
          placeholder="选择年">
          placeholder="选择年" :disabled="operationType !== 'edit'">
        </el-date-picker>
      </div>
      <div style="margin: 10px 0">
        <el-table ref="yearTable" :data="deviceTraceabilityManagementDetails" height="300px" id="templateParamTable"
        <el-table ref="yearTable" :data="deviceTraceabilityManagementDetails" height="560px" id="templateParamTable"
                  :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
                  row-key="deviceId" v-loading="yearTableLoading">
          <el-table-column align="center" header-align="center" label="序号" type="index" width="60"></el-table-column>
          <el-table-column label="设备名称" min-width="170" prop="deviceId">
            <template slot-scope="scope">
              <el-input v-model="scope.row.deviceName" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.deviceName" :disabled="operationType !== 'edit'" clearable
                size="small"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="型号" min-width="140" prop="specificationModel">
            <template slot-scope="scope">
              <el-input v-model="scope.row.specificationModel" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.specificationModel" :disabled="operationType !== 'edit'" clearable
                size="small"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="设备编号" min-width="140" prop="managementNumber">
            <template slot-scope="scope">
              <el-input v-model="scope.row.managementNumber" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.managementNumber" :disabled="operationType !== 'edit'" clearable
                size="small"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="技术指标参数" min-width="150" prop="technicalIndexParameters">
            <template slot-scope="scope">
              <el-input v-model="scope.row.technicalIndexParameters" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.technicalIndexParameters" :disabled="operationType !== 'edit'" clearable
                size="small" type="textarea"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="技术指标要求" min-width="150" prop="technicalRequirements">
            <template slot-scope="scope">
              <el-input v-model="scope.row.technicalRequirements" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.technicalRequirements" :disabled="operationType !== 'edit'" clearable
                size="small" type="textarea"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="检定周期" min-width="120" prop="verificationCycle">
            <template slot-scope="scope">
              <el-input v-model="scope.row.verificationCycle" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.verificationCycle" :disabled="operationType !== 'edit'" clearable
                size="small" type="textarea"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="检定单位" min-width="90" prop="verificationUnit">
            <template slot-scope="scope">
              <el-input v-model="scope.row.verificationUnit" :disabled="operationType === 'check'" clearable
              <el-input v-model="scope.row.verificationUnit" :disabled="operationType !== 'edit'" clearable
                size="small" type="textarea"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="备注" min-width="90" prop="remark">
            <template slot-scope="scope">
              <el-input v-model="scope.row.remark" :disabled="operationType === 'check'" clearable size="small"
              <el-input v-model="scope.row.remark" :disabled="operationType !== 'edit'" clearable size="small"
                type="textarea"></el-input>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="80" align="center" v-if="operationType !== 'check'">
          <el-table-column fixed="right" label="操作" width="80" align="center" v-if="operationType === 'edit'">
            <template slot-scope="scope">
              <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">删除</el-button>
            </template>
@@ -117,7 +118,7 @@
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeDialog">取 æ¶ˆ</el-button>
        <el-button v-if="operationType !== 'check'" :loading="submitFormLoading" type="primary" @click="submitForm">ç¡®
        <el-button v-if="operationType === 'edit'" :loading="submitFormLoading" type="primary" @click="submitForm">ç¡®
          è®¤</el-button>
        <el-button v-if="operationType === 'check'" :loading="submitFormLoading" type="primary"
          @click="checkStatus(0)">不通过</el-button>
@@ -137,7 +138,7 @@
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addEquipDia = false">取 æ¶ˆ</el-button>
        <el-button v-if="operationType !== 'check'" :loading="submitFormLoading" type="primary"
        <el-button v-if="operationType === 'edit'" :loading="submitFormLoading" type="primary"
          @click="changeMachineName">ç¡®
          è®¤</el-button>
      </span>
src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,376 @@
<template>
  <div>
    <div class="search">
      <el-button size="small" type="primary" @click="refreshTableList">刷 æ–°</el-button>
      <el-button size="small" type="primary" @click="openDia('add')">新 å¢ž</el-button>
      <el-button :loading="outLoading" size="small" type="primary" @click="openHandleOut">导 å‡º</el-button>
    </div>
    <div>
      <lims-table :tableData="tableData" :column="column"
                  height="calc(100vh - 20em)" @pagination="pagination"
                  :page="page" :tableLoading="tableLoading"></lims-table>
    </div>
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="usageTableDia"
               title="设备保养计划表" width="80%" @close="closeDialog">
      <div style="display: flex;align-items: center;">
        <el-button size="small" type="primary" @click="addTableRow">添加</el-button>
        <span style="width: 60px;margin-left: 10px">年份:</span>
        <el-date-picker v-model="form.impowerYear" type="year" value-format="yyyy" clearable size="small" format="yyyy"
                        placeholder="选择年">
        </el-date-picker>
      </div>
      <div style="margin: 10px 0">
        <el-table ref="usageTableData" :data="usageTableData" id="templateParamTable" row-key="deviceId"
                  :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
                  height="560px" style="width: 100% ;">
          <el-table-column align="center" header-align="center" label="序号" type="index" width="60"></el-table-column>
          <el-table-column label="设备名称" min-width="170" prop="deviceName">
            <template slot-scope="scope">
              <el-input v-model="scope.row.deviceName" clearable
                        size="small" :disabled="operationType === 'check'"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="设备编号" min-width="140" prop="deviceNumber">
            <template slot-scope="scope">
              <el-input v-model="scope.row.deviceNumber" clearable
                        size="small" :disabled="operationType === 'check'"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="规格型号" min-width="120" prop="model">
            <template slot-scope="scope">
              <el-input v-model="scope.row.model" clearable
                        size="small" :disabled="operationType === 'check'"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="检测项目" min-width="120" prop="inspectionItem<">
            <template slot-scope="scope">
              <el-input v-model="scope.row.inspectionItem" clearable size="small"
                       :disabled="operationType === 'check'"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="被授权人" min-width="120" prop="delegatee">
            <template slot-scope="scope">
              <el-select v-model="scope.row.delegatedUserArr"
                         clearable filterable multiple
                         :disabled="operationType === 'check'"
                         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>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="80" align="center">
            <template slot-scope="scope">
              <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeDialog">取 æ¶ˆ</el-button>
        <el-button v-if="operationType !== 'check'" :loading="submitFormLoading" type="primary" @click="submitForm">确认</el-button>
        <el-button v-if="operationType === 'check'" :loading="submitFormLoading" type="primary"
                   @click="checkStatus(0)">不通过</el-button>
        <el-button v-if="operationType === 'check'" :loading="submitFormLoading" type="primary"
                   @click="checkStatus(1)">通过</el-button>
      </span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="addEquipDia" title="添加设备"
               width="50%">
      <div style="display: flex;align-items: center;">
        <span style="width: 90px;margin-left: 10px">被授权人:</span>
        <el-select v-model="delegatedUser" clearable filterable multiple
                   placeholder="请选择" size="small" style="width: 100%;">
          <el-option v-for="item in responsibleOptions" :key="item.name" :label="item.name" :value="item.name">
          </el-option>
        </el-select>
      </div>
      <el-table ref="multipleTable" :data="equipOptions" tooltip-effect="dark" height="500" style="width: 100%"
                :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
                @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column label="设备名称" prop="label" width="190"></el-table-column>
        <el-table-column prop="value" label="设备编号" width="130"></el-table-column>
        <el-table-column prop="managementNumber" label="归属实验室"></el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addEquipDia = false">取 æ¶ˆ</el-button>
        <el-button :loading="submitFormLoading" type="primary" @click="changeMachineName">确认</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import limsTable from "@/components/Table/lims-table.vue";
import {
  addImpower,
  deleteImpower, deviceScopeSearch, getImpowerDetail, reviewImpowerStatus,
  selectDeviceImpowerByPage, updateImpower
} from "@/api/cnas/resourceDemand/device";
import {exportQualityMonitorDetail} from "@/api/cnas/process/ensureResults/qualityMonitor";
import {selectUserCondition} from "@/api/system/user";
export default {
  name: '',
  // import å¼•入的组件需要注入到对象中才能使用
  components: {limsTable},
  props: {
    clickNodeVal: {
      type: Object,
      default: () => {
      }
    }
  },
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      outLoading: false,
      tableData: [],
      tableLoading: false,
      page: {
        total: 0,
        size: 20,
        current: 1
      },
      column: [
        { label: '计划年份', prop: 'impowerYear' },
        { label: '编制人', prop: 'compiler' },
        { label: '编制时间', prop: 'datePreparation' },
        { label: '授权人', prop: 'audit' },
        { label: '授权日期', prop: 'auditDate' },
        {
          dataType: 'action',
          label: '操作',
          operation: [
            {
              name: '编辑',
              type: 'text',
              clickFun: (row) => {
                this.openDia('edit', row);
              },
            },
            {
              name: '授权',
              type: 'text',
              clickFun: (row) => {
                this.openDia('check', row);
              },
            },
            {
              name: '删除',
              type: 'text',
              clickFun: (row) => {
                this.handleDeleteClick(row);
              },
            },
          ]
        }
      ],
      responsibleOptions: [],
      operationType: '',
      usageTableDia: false,
      usageTableData: [],
      submitFormLoading: false,
      addEquipDia: false,
      equipOptions: [],
      selectionRows: [],
      form: {
        impowerYear: ''
      },
      delegatedUser: [],
      impowerId: ''
    };
  },
  mounted() {
    this.refreshTableList()
  },
  // æ–¹æ³•集合
  methods: {
    // ç‚¹å‡»åˆ·æ–°
    refreshTableList () {
      this.page.current = 1;
      this.getTableList()
    },
    // åˆ†é¡µåˆ‡æ¢
    pagination(page) {
      this.page.size = page.limit
      this.getTableList()
    },
    getTableList () {
      this.tableLoading = true
      selectDeviceImpowerByPage({
        ...this.page
      }).then(res => {
        this.tableLoading = false
        this.tableData = res.data.records
        this.page.total = res.data.total
      }).catch(err => {
        this.tableLoading = false
      })
    },
    // æ‰“开操作弹框
    openDia (type, row) {
      this.operationType = type
      this.usageTableDia = true
      this.form = {
        impowerYear: '',
        usageTableData: [],
      }
      this.usageTableData = []
      if (row) {
        this.impowerId = row.impowerId
        getImpowerDetail({ impowerId: this.impowerId }).then(res => {
          if (res.code === 200) {
            this.form = res.data
            this.usageTableData = this.form.usageTableData
          }
        }).catch(error => {
          console.error(error)
        })
      }
      this.getEquipOptions()
      this.getUserList()
    },
    closeDialog () {
      this.usageTableDia = false
      this.getTableList()
    },
    // æ·»åŠ è®¾å¤‡
    addTableRow() {
      this.addEquipDia = true
      this.delegatedUser = this.responsibleOptions.map((item) => item.name);
      this.getEquipOptions()
    },
    // åˆ é™¤è¡¨æ ¼è¡Œ
    deleteRow(index) {
      this.usageTableData.splice(index, 1)
    },
    // æäº¤æ–°å¢žå’Œä¿®æ”¹
    submitForm() {
      this.form.usageTableData = this.HaveJson(this.usageTableData)
      this.form.usageTableData.forEach((item) => {
        item.delegatedUser = item.delegatedUserArr.join(',')
      })
      this.submitFormLoading = true
      if (this.operationType === 'add') {
        addImpower(this.form).then(res => {
          if (res.code == 200) {
            this.$message.success('新增成功')
            this.usageTableDia = false
            this.refreshTableList()
          }
          this.submitFormLoading = false
        }).catch(err => {
          this.submitFormLoading = false
        })
      } else {
        updateImpower(this.form).then(res => {
          if (res.code == 200) {
            this.$message.success('修改成功')
            this.usageTableDia = false
            this.refreshTableList()
          }
          this.submitFormLoading = false
        }).catch(err => {
          this.submitFormLoading = false
        })
      }
    },
    // æäº¤å®¡æ ¸
    checkStatus(status) {
      const params = {
        status: status,
        impowerId: this.impowerId
      }
      reviewImpowerStatus(params).then(res => {
        if (res.code == 200) {
          this.$message.success('审核成功')
          this.usageTableDia = false
          this.refreshTableList()
        }
        this.submitFormLoading = false
      }).catch(err => {
        this.submitFormLoading = false
      })
    },
    handleSelectionChange(selection) {
      this.selectionRows = selection
    },
    // èµ‹å€¼ä»ªå™¨ç¼–号
    changeMachineName() {
      this.deviceMaintenancePlanDetails = []
      this.selectionRows.map(val => {
        this.usageTableData.push({ deviceId: val.id, deviceName: val.label, deviceNumber: val.value, model: val.specificationModel, delegatedUserArr: this.delegatedUser })
      })
      this.addEquipDia = false
    },
    // èŽ·å–æ‰€æœ‰è®¾å¤‡
    getEquipOptions() {
      this.equipOptions = []
      deviceScopeSearch({ status: 0 }).then(res => {
        if (res.code === 200 && res.data) {
          this.equipOptions = res.data.map(m => {
            m.value = m.managementNumber
            m.label = m.deviceName
            return m
          })
        }
      }).catch(error => {
        console.error(error)
      })
    },
    openHandleOut (row) {
      exportQualityMonitorDetail({ impowerId: row.impowerId }).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/msword' });
        this.$download.saveAs(blob, row.monitorName + '.docx')
      })
    },
    handleDeleteClick(row) {
      this.$confirm('此操作将永久删除该文件, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteImpower({ id: row.impowerId }).then(res => {
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
          this.refreshTableList()
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // èŽ·å–è´Ÿè´£äººä¿¡æ¯æŽ¥å£
    getUserList() {
      selectUserCondition({type: 2}).then(res => {
        if (res.code == 200) {
          this.responsibleOptions = res.data
        }
      })
    },
  },
  watch: {
    // ç›‘听点击el-tree的数据,进行数据刷新
    clickNodeVal(newVal) {
      if (newVal.value) {
        this.refreshTableList();
      }
    },
  },
};
</script>
<style scoped>
.search {
  height: 46px;
  text-align: right;
  margin-top: 10px;
}
</style>
src/views/CNAS/resourceDemand/device/index.vue
@@ -55,6 +55,10 @@
            <quantity-value-traceability-plan v-if="menuListActiveName == '量值溯源计划'"
              :clickNodeVal="clickNodeVal"></quantity-value-traceability-plan>
          </el-tab-pane>
          <el-tab-pane label="设备使用授权" name="设备使用授权">
            <usage-authorization v-if="menuListActiveName == '设备使用授权'"
              :clickNodeVal="clickNodeVal"></usage-authorization>
          </el-tab-pane>
          <el-tab-pane label="利用外部仪器设备" name="利用外部仪器设备">
            <using-external-instruments v-if="menuListActiveName == '利用外部仪器设备'" :clickNodeVal="clickNodeVal"></using-external-instruments>
          </el-tab-pane>
@@ -74,8 +78,8 @@
          <el-tab-pane label="设备校准" name="设备校准">
            <calibration v-if="tabListActiveName == '设备校准'" :clickNodeVal="clickNodeVal" />
          </el-tab-pane>
          <el-tab-pane label="设备维护" name="设备维护">
            <maintenance v-if="tabListActiveName == '设备维护'" :clickNodeVal="clickNodeVal" />
          <el-tab-pane label="设备维护保养" name="设备维护保养">
            <equipmentMaintenance v-if="tabListActiveName == '设备维护保养'" :clickNodeVal="clickNodeVal" />
          </el-tab-pane>
          <el-tab-pane label="设备借用" name="设备借用">
            <borrow v-if="tabListActiveName == '设备借用'" :clickNodeVal="clickNodeVal" />
@@ -112,7 +116,6 @@
import files from "./component/files.vue";
import calibration from "./component/calibration.vue";
import check from "./component/check.vue";
import maintenance from "./component/maintenance.vue";
import borrow from "./component/borrow.vue";
import fault from "./component/fault.vue";
import record from "./component/record.vue";
@@ -131,6 +134,8 @@
import EquipmentMaintenancePlan from "./component/equipmentMaintenancePlan.vue";
import EquipmentAcceptance from "./component/equipmentAcceptance.vue";
import QuantityValueTraceabilityPlan from "./component/quantityValueTraceabilityPlan.vue";
import equipmentMaintenance from "./component/equipmentMaintenance.vue";
import usageAuthorization from "./component/usageAuthorization.vue";
import {
  treeDevice,
} from '@/api/cnas/resourceDemand/device.js'
@@ -151,7 +156,6 @@
    files,
    calibration,
    check,
    maintenance,
    borrow,
    fault,
    record,
@@ -159,7 +163,9 @@
    management,
    overview,
    resourceReservation,
    operationInstruction
    operationInstruction,
    equipmentMaintenance,
    usageAuthorization,
  },
  data() {
    return {