spring
2025-04-16 3c510ea35b428feed7f7a1743a595e7dba634518
src/views/CNAS/resourceDemand/device/component/management.vue
@@ -1,37 +1,42 @@
<!-- 设备工具明细 -->
<template>
   <div class="role_manage">
      <div class="search" v-show="!showData">
         <div class="search_thing">
            <div class="search_label">状态:</div>
            <el-select v-model="queryParams.deviceStatus" placeholder="全部" size="small">
               <el-option v-for="item in deviceStatusList" :key="item.value" :label="item.label" :value="item.value">
               </el-option>
            </el-select>
      <div class="search">
         <div>
            <el-form :model="queryParams" ref="queryParams" size="small" :inline="true">
               <el-form-item label="状态" prop="deviceStatus" class="form-item">
                  <el-select v-model="queryParams.deviceStatus" placeholder="全部" size="small">
                     <el-option v-for="item in deviceStatusList" :key="item.value" :label="item.label" :value="item.value">
                     </el-option>
                  </el-select>
               </el-form-item>
               <el-form-item label="设备名称" prop="deviceName">
                  <el-input size="small" style="width: 160px;" placeholder="请输入" clearable v-model="queryParams.deviceName"
                     @keyup.enter.native="refreshTable()">
                  </el-input>
               </el-form-item>
               <el-form-item label="规格型号" prop="specificationModel">
                  <el-input size="small" placeholder="请输入" clearable v-model="queryParams.specificationModel"
                     @keyup.enter.native="refreshTable()" style="width: 160px;"></el-input>
               </el-form-item>
               <el-form-item>
                  <el-button type="primary" size="mini" @click="refreshTable">查询</el-button>
                  <el-button size="mini" @click="refresh">重置</el-button>
               </el-form-item>
            </el-form>
         </div>
         <div class="search_thing">
            <div class="search_label">设备名称:</div>
            <div class="search_input">
               <el-input size="small" placeholder="请输入" clearable v-model="queryParams.deviceName"
                  @keyup.enter.native="refreshTable()">
               </el-input>
            </div>
         </div>
         <div class="search_thing">
            <div class="search_label">规格型号:</div>
            <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                  v-model="queryParams.specificationModel" @keyup.enter.native="refreshTable()"></el-input>
            </div>
         </div>
         <div style="padding-left: 30px;">
            <el-button size="small" @click="refresh()">重 置</el-button>
            <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
            <el-button size="small" type="primary" @click="dialogVisible2 = true">新 增</el-button>
            <el-button size="small" type="primary" @click="handleDownOne">导 出</el-button>
         <div>
            <el-upload ref='upload' style="display: inline;margin-right: 8px" :action="uploadAction"
               :before-upload="beforeUpload" :headers="uploadHeader" :on-error="onError" :on-success="handleSuccessUp"
               :show-file-list="false" accept='.xls,.xlsx'>
               <el-button size="small" type="primary">导入</el-button>
            </el-upload>
            <el-button size="small" type="primary" @click="dialogVisible2 = true">新增</el-button>
            <el-button size="small" type="primary" @click="handleDownOne">导出</el-button>
         </div>
      </div>
      <div class="table" v-show="!showData">
         <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading" :height="'calc(100vh - 320px)'"
         <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading" :height="'calc(100vh - 300px)'"
            :page="page" @pagination="pagination"></lims-table>
      </div>
      <el-dialog :title="isUp ? '设备详情' : '档案修订'" :visible.sync="dialogVisible" width="70%" top="5vh"
@@ -382,7 +387,7 @@
            </el-row>
         </span>
      </el-dialog>
      <dataAcquisitionConfig v-if="showData" :deviceId="deviceId" />
      <dataAcquisitionConfig v-if="showData" :deviceId="deviceId" :deviceName="deviceName" />
   </div>
</template>
@@ -415,8 +420,10 @@
   },
   data() {
      return {
         uploadAction: process.env.VUE_APP_BASE_API + '/deviceScope/importDevice',
         dateFormat: 'yyyy-MM-dd',
         deviceId: '',
         deviceName: '',
         fileTypeOptions: [
            { label: 'csv', value: '.csv' },
            { label: 'db', value: '.db' },
@@ -484,17 +491,25 @@
            { label: "所属部门", prop: "laboratoryName" },
            { label: "检验项目", prop: "insProductItem" },
            { label: "校准服务机构", prop: "calibrationServices" },
            { label: "最近校准日期", prop: "lastCalibrationDateTwo" },
            { label: "最近核查日期", prop: "lastCalibrationDate" },
            { label: "下次校准日期", prop: "nextCalibrationDateTwo" },
            { label: "下次核查日期", prop: "nextCalibrationDate" },
            { label: "最近校准日期", prop: "lastCalibrationDate" },
            { label: "最近核查日期", prop: "lastCalibrationDateTwo" },
            { label: "下次校准日期", prop: "nextCalibrationDate" },
            { label: "下次核查日期", prop: "nextCalibrationDateTwo" },
            {
               label: "设备分类", prop: "largeCategory", dataType: "tag",
               formatData: (params) => {
                  return this.equipmentList.find(m => m.value == params).label
                  if (this.equipmentList.find(m => m.value == params)) {
                     return this.equipmentList.find(m => m.value == params).label
                  } else {
                     return null
                  }
               },
               formatType: (params) => {
                  return this.equipmentList.find(m => m.value == params).type
                  if (this.equipmentList.find(m => m.value == params)) {
                     return this.equipmentList.find(m => m.value == params).type
                  } else {
                     return null
                  }
               }
            },
            { label: "单价", prop: "unitPrice" },
@@ -757,6 +772,15 @@
            })
         }
      },
      handleSuccessUp(response, file, fileList) {
         this.$refs.upload.clearFiles()
         if (response.code !== 200) {
            this.$message.error(response.msg)
            return
         }
         this.$message.success('上传成功')
         this.refreshTable()
      },
      submitForm() {
         if (!this.formData.deviceName) {
            this.$message.error('未输入仪器名称')
@@ -796,7 +820,7 @@
         delete this.formData.updateUser
         const formData = this.HaveJson(this.formData)
         formData.insProductIds = formData.insProductIds ? formData.insProductIds.join() : ''
         if (formData.authorizedPerson.length === 0) {
         if (!formData.authorizedPerson || formData.authorizedPerson.length === 0) {
            formData.authorizedPerson = ''
         } else {
            formData.authorizedPerson = JSON.stringify(formData.authorizedPerson)
@@ -845,7 +869,7 @@
         }
         const formData = this.HaveJson(this.formData2)
         formData.insProductIds = formData.insProductIds ? formData.insProductIds.join() : ''
         if (formData.authorizedPerson.length === 0) {
         if (!formData.authorizedPerson || formData.authorizedPerson.length === 0) {
            formData.authorizedPerson = ''
         } else {
            formData.authorizedPerson = JSON.stringify(formData.authorizedPerson)
@@ -882,6 +906,7 @@
         })
         this.tableList = list2
         this.deviceId = row.id
         this.deviceName = row.deviceName
         this.$nextTick(() => {
            this.showData = true
         })
@@ -982,18 +1007,9 @@
</script>
<style scoped>
.role_manage {
   width: 100%;
   height: 100%;
}
.title {
   line-height: 15px;
}
.search {
   height: 46px;
   display: flex;
   align-items: center;
   justify-content: space-between;
   margin-top: 10px;
}
@@ -1010,18 +1026,9 @@
   text-align: right;
}
.search_input {
   width: calc(100% - 80px);
}
.table {
   margin-top: 12px;
   background-color: #fff;
   height: calc(100vh - 17em);
}
.el-form-item {
   margin-bottom: 16px;
   height: calc(100vh - 16em);
}
.picName {
@@ -1031,4 +1038,8 @@
   word-break: break-all;
   width: 120px;
}
.form-item>>>.el-form-item__content {
   width: 120px;
}
</style>