spring
2025-03-25 604147ab79d5246a6215a7a89bd340dcc393a085
设备导入功能
已修改2个文件
108 ■■■■■ 文件已修改
src/views/CNAS/resourceDemand/device/component/management.vue 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/outsourcedParts/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/management.vue
@@ -1,35 +1,40 @@
<!-- 设备工具明细 -->
<template>
    <div class="role_manage">
    <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" 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()"></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>
        <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="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>
                <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 - 300px)'"
                :page="page" @pagination="pagination"></lims-table>
@@ -415,6 +420,7 @@
    },
    data() {
        return {
            uploadAction: process.env.VUE_APP_BASE_API + '/deviceScope/importDevice',
            dateFormat: 'yyyy-MM-dd',
            deviceId: '',
            fileTypeOptions: [
@@ -491,18 +497,18 @@
                {
                    label: "设备分类", prop: "largeCategory", dataType: "tag",
                    formatData: (params) => {
            if (this.equipmentList.find(m => m.value == params)) {
                          return this.equipmentList.find(m => m.value == params).label
            } else {
              return null
            }
                        if (this.equipmentList.find(m => m.value == params)) {
                            return this.equipmentList.find(m => m.value == params).label
                        } else {
                            return null
                        }
                    },
                    formatType: (params) => {
            if (this.equipmentList.find(m => m.value == params)) {
              return this.equipmentList.find(m => m.value == params).type
            } else {
              return null
            }
                        if (this.equipmentList.find(m => m.value == params)) {
                            return this.equipmentList.find(m => m.value == params).type
                        } else {
                            return null
                        }
                    }
                },
                { label: "单价", prop: "unitPrice" },
@@ -765,6 +771,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('未输入仪器名称')
@@ -991,10 +1006,10 @@
<style scoped>
.search {
  height: 46px;
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
    height: 46px;
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}
.search_thing {
@@ -1013,6 +1028,7 @@
    background-color: #fff;
    height: calc(100vh - 16em);
}
.picName {
    overflow: hidden;
    text-overflow: ellipsis;
@@ -1020,7 +1036,8 @@
    word-break: break-all;
    width: 120px;
}
.form-item >>>.el-form-item__content {
  width: 120px;
.form-item>>>.el-form-item__content {
    width: 120px;
}
</style>
src/views/business/outsourcedParts/index.vue
@@ -188,6 +188,7 @@
    this.getDicts("inspection_task_state").then((response) => {
      this.inspectionTaskState = this.dictToValue(response.data);
    });
    this.getList()
  },
  methods: {
    getList() {