吴羡
13 小时以前 c6e96cdb8b1cfb51e9a45bf86c38d1353e983127
src/views/CNAS/resourceDemand/device/component/management.vue
@@ -27,7 +27,7 @@
        </el-form>
      </div>
      <div>
        <el-button size="small" type="primary" @click="dialogVisible2 = true">新增</el-button>
        <el-button size="small" type="primary" @click="openAddDialog">新增</el-button>
        <el-button size="small" type="primary" @click="handleDownOne">导出</el-button>
      </div>
    </div>
@@ -132,7 +132,7 @@
                     :props="props" placeholder="请选择" size="small" style="width:100%;" :collapse-tags="!isUp" separator=","
                     filterable clearable></el-cascader>
               </el-form-item>
               <el-form-item label="设备类型:">
               <el-form-item label="设备/计量器具:">
                  <el-select :disabled="isUp" v-model="formData.largeCategory" placeholder="请选择" size="small"
                     style="width:100%">
                     <el-option v-for="item in equipmentList" :key="item.value" :label="item.label" :value="item.value">
@@ -336,7 +336,7 @@
                     placeholder="请选择" size="small" style="width:100%" collapse-tags separator="," filterable
                     clearable></el-cascader>
               </el-form-item>
               <el-form-item label="设备类型:">
               <el-form-item label="设备/计量器具:">
                  <el-select v-model="formData2.largeCategory" placeholder="请选择" size="small" style="width:100%">
                     <el-option v-for="item in equipmentList" :key="item.value" :label="item.label" :value="item.value">
                     </el-option>
@@ -425,7 +425,9 @@
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
import dayjs from 'dayjs'
import { formatListDate } from './dateFormat'
import { selectQualifiedSupplierManagementPage } from '@/api/cnas/externalService/supplierManage/supplierManage'
import { saveBlobOrShowError } from '@/utils/saveBlob'
export default {
   props: {
      clickNodeVal: {
@@ -473,8 +475,11 @@
         showData: false, // 数采配置页面
         tableList: [],
         addDia: true,
         //设备类型列表
         equipmentList: [],
         //设备类型列表:与左侧树“设备/计量器具”分类保持一致
         equipmentList: [
            { label: '设备', value: '设备' },
            { label: '计量器具', value: '计量器具' }
         ],
         // 负责人列表
         responsiblePersonList: [],
         // 授权人列表
@@ -498,18 +503,18 @@
            { label: "出厂编号", prop: "factoryNo" },
            { label: "管理编号", prop: "managementNumber" },
            { label: "技术指标", prop: "technicalIndicators" },
            { label: "购置日期", prop: "acquisitionDate" },
            { label: "校准有效期", prop: "activationDate" },
            { label: "购置日期", prop: "acquisitionDate", formatData: (params) => formatListDate(params) },
            { label: "校准有效期", prop: "activationDate", formatData: (params) => formatListDate(params) },
            { label: "管理人", prop: "equipmentManagerUser" },
            { label: "存放点", prop: "storagePoint" },
            { label: "检验项目", prop: "insProductItem" },
            { label: "校准服务机构", prop: "calibrationServices" },
            { label: "最近校准日期", prop: "lastCalibrationDateTwo" },
            { label: "最近核查日期", prop: "lastExamineDate" },
            { label: "下次校准日期", prop: "nextCalibrationDateTwo" },
            { label: "下次核查日期", prop: "nextExamineDate" },
            { label: "最近保养日期", prop: "lastMaintenanceDate" },
            { label: "下次保养日期", prop: "nextMaintenanceDate" },
            { label: "最近校准日期", prop: "lastCalibrationDateTwo", formatData: (params) => formatListDate(params) },
            { label: "最近核查日期", prop: "lastExamineDate", formatData: (params) => formatListDate(params) },
            { label: "下次校准日期", prop: "nextCalibrationDateTwo", formatData: (params) => formatListDate(params) },
            { label: "下次核查日期", prop: "nextExamineDate", formatData: (params) => formatListDate(params) },
            { label: "最近保养日期", prop: "lastMaintenanceDate", formatData: (params) => formatListDate(params) },
            { label: "下次保养日期", prop: "nextMaintenanceDate", formatData: (params) => formatListDate(params) },
            {
               label: "设备分类", prop: "largeCategory", dataType: "tag",
               formatData: (params) => {
@@ -698,8 +703,9 @@
         this.outLoading = true
         exportEquipmentDetails({ ...this.queryParams }).then(res => {
            this.outLoading = false
            const blob = new Blob([res], { type: 'application/octet-stream' });
            this.$download.saveAs(blob, '设备仪器一览表.doc')
            saveBlobOrShowError(res, '设备仪器一览表.doc', 'application/msword')
         }).catch(() => {
            this.outLoading = false
         })
      },
      // 获取字典
@@ -707,10 +713,6 @@
         // 设备状态
         this.getDicts("device_status").then((response) => {
            this.deviceStatusList = this.dictToValue(response.data);
         });
         // 设备分类
         this.getDicts("device_type").then((response) => {
            this.equipmentList = this.dictToValue(response.data);
         });
      },
      // 获取负责人列表
@@ -812,6 +814,11 @@
         //复制给formData
         this.formData = this.HaveJson(row);
         this.formData.authorizedPerson = this.normalizeAuthorizedPerson(row.authorizedPerson);
         // 设备类型为空时,默认取左侧树当前所在分类
         const treeCategory = this.clickNodeVal && this.clickNodeVal.label
         if (!this.formData.largeCategory && (treeCategory === '设备' || treeCategory === '计量器具')) {
            this.formData.largeCategory = treeCategory
         }
         if (typeof (row.insProductIds) === 'number') {
            row.insProductIds = row.insProductIds + ''
         }
@@ -918,6 +925,8 @@
            this.$message.success('修改成功')
            this.upLoad = false
            this.refreshTable('page')
            // 类型可能变更,刷新左侧树让设备归到新的分类下
            this.$emit('refresh-tree')
            this.dialogVisible = false
         }).catch(e => {
            this.$message.error('修改失败')
@@ -937,6 +946,10 @@
         }
         if (!this.formData2.managementNumber) {
            this.$message.error('未输入管理编号')
            return
         }
         if (!this.formData2.largeCategory) {
            this.$message.error('请选择设备/计量器具')
            return
         }
         if (!this.formData2.activationDate) {
@@ -961,6 +974,7 @@
            this.$message.success('提交成功')
            this.upLoad2 = false
            this.refreshTable('page')
            this.$emit('refresh-tree')
            this.dialogVisible2 = false
            this.formData2 = {
               imageUpload: '',
@@ -1006,6 +1020,14 @@
            this.refreshTable('page')
         }
      },
      // 新增设备:默认取左侧树当前所在分类
      openAddDialog() {
         const treeCategory = this.clickNodeVal && this.clickNodeVal.label
         if (!this.formData2.largeCategory && (treeCategory === '设备' || treeCategory === '计量器具')) {
            this.formData2.largeCategory = treeCategory
         }
         this.dialogVisible2 = true
      },
      handleDelete(row) {
         this.$confirm("是否删除该条数据?", "提示", {
            confirmButtonText: "确定",
@@ -1015,7 +1037,9 @@
            .then(() => {
               delDeviceParameter({ id: row.id }).then((res) => {
                  this.$message.success("删除成功");
                  this.refresh();
                  this.refreshTable()
                  // 已删除的设备要从左侧树同步移除
                  this.$emit('refresh-tree')
               });
            })
            .catch(() => { });