| | |
| | | height: calc(100% - 60px - 80px - 10px - 40px); |
| | | padding: 20px; |
| | | } |
| | | |
| | | >>> .el-upload { |
| | | width: 100% !important; |
| | | } |
| | | |
| | | >>> .el-upload-dragger { |
| | | width: 100% !important; |
| | | } |
| | | </style> |
| | | |
| | | <template> |
| | | <div class="capacity-scope"> |
| | | <div> |
| | | <el-row class="title"> |
| | | <el-col :span="12"> |
| | | <el-col :span="12" style="text-align: left"> |
| | | <el-radio-group v-model="radio" @input="selectorSwitch" size="medium" fill="#3A7BFA" v-if="select==3"> |
| | | <el-radio-button label="0">检验项目参数</el-radio-button> |
| | | <el-radio-button label="1">检验对象</el-radio-button> |
| | |
| | | <el-button size="medium" type="primary" v-else-if="select==2">检验对象</el-button> |
| | | </el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-button size="medium" @click="$refs.itemParameterTable.openUpload()" v-if="inPower"> |
| | | <i class="el-icon-upload2" style="color: #3A7BFA;"></i> |
| | | <span style="color: #3A7BFA;">导入</span></el-button> |
| | | <el-button size="medium" type="primary" v-if="radio == 1 && importExcel" @click="uploadDia = true">导入</el-button> |
| | | <el-button size="medium" type="primary" @click="openAdd" v-if="addPower">新增</el-button> |
| | | <!-- <el-button size="medium" icon="el-icon-delete">删除</el-button> --> |
| | | <el-button size="medium" icon="el-icon-delete">删除</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | |
| | | <div class="table"> |
| | | <ValueTable ref="itemParameterTable" :url="$api.capacityScope.selectItemParameterList" |
| | | :upUrl="$api.capacityScope.upItemParameter" :delUrl="$api.capacityScope.delItemParameter" |
| | | :componentData="itemParameterData" :key="upIndex" /> |
| | | :inputUrl="$api.capacityScope.importData" :componentData="itemParameterData" :key="upIndex" /> |
| | | </div> |
| | | </div> |
| | | <div class="bodys"> |
| | |
| | | <div class="body" v-if="diaProduct" style="height: 350px;overflow-y: auto;padding: 5px 0;"> |
| | | <ValueTable ref="productData" :url="$api.capacityScope.selectProductListByObjectId" |
| | | :upUrl="$api.capacityScope.upProduct" :delUrl="$api.capacityScope.delProduct" |
| | | :componentData="productData" :key="upIndex" /> |
| | | :componentData="productData" :key="upIndex"/> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="diaProduct = false">取 消</el-button> |
| | | <el-button type="primary" @click="openAdd2" :loading="productLoad">新 增</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="数据导入" :visible.sync="uploadDia" width="500px"> |
| | | <div style="margin: 0 auto;"> |
| | | <el-upload ref="upload" drag :action="javaApi + $api.capacityScope.importExcel" :headers="token" :file-list="fileList" name="file" |
| | | :auto-upload="false" accept=".xlsx" :limit="1" :on-change="beforeUpload" :on-success="onSuccess" |
| | | :on-error="onError"> |
| | | <i class="el-icon-upload"></i> |
| | | <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
| | | </el-upload> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="uploadDia = false">取 消</el-button> |
| | | <el-button type="primary" @click="submitUpload()" :loading="uploading">上 传</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | logining:false, |
| | | radio: '-1', |
| | | showItemParameter: true, |
| | | showTestObject: false, |
| | |
| | | ], |
| | | requiredUp: ['sonLaboratory', 'inspectionItem', 'inspectionItemType', 'inspectionValueType', |
| | | 'unit', 'method', 'manDay', 'templateId' |
| | | ] |
| | | ], |
| | | accept: '.xlsx', |
| | | inputType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
| | | }, |
| | | testObjectData: { |
| | | entity: { |
| | |
| | | tagField: {}, |
| | | selectField: {}, |
| | | requiredAdd: ['name','nameEn'], |
| | | requiredUp: ['name','nameEn'] |
| | | } |
| | | requiredUp: ['name','nameEn'], |
| | | }, |
| | | inPower: true, |
| | | importExcel: false, |
| | | uploadDia: false, |
| | | fileList: [], |
| | | token: null, |
| | | uploading: false, |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.token = { |
| | | 'token': sessionStorage.getItem('token') |
| | | }, |
| | | this.itemParameterEntityCopy = this.HaveJson(this.itemParameterData.entity) |
| | | this.testObjectDataEntityCopy = this.HaveJson(this.testObjectData.entity) |
| | | this.selectEnumByCategory() |
| | |
| | | this.getPower('0') |
| | | }, |
| | | methods: { |
| | | submitUpload() { |
| | | if (this.$refs.upload.uploadFiles.length == 0) { |
| | | this.$message.error('未选择文件') |
| | | return |
| | | } |
| | | this.uploading = true |
| | | this.$refs.upload.submit(); |
| | | }, |
| | | onSuccess(response, file, fileList) { |
| | | this.$refs.upload.clearFiles() |
| | | this.uploadDia = false |
| | | this.uploading = false |
| | | if (response.code == 201) { |
| | | this.$message.error(response.message) |
| | | return |
| | | } |
| | | this.$message.success('上传成功') |
| | | this.standardList = [] |
| | | this.productList = [] |
| | | this.refreshTable() |
| | | }, |
| | | onError(err, file, fileList) { |
| | | this.$message.error('上传失败') |
| | | this.$refs.upload.clearFiles() |
| | | this.uploading = false |
| | | }, |
| | | beforeUpload(file, fileList) { |
| | | if (file.raw.type != 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { |
| | | this.$message.error('上传文件格式不正确'); |
| | | this.$refs.upload.clearFiles() |
| | | return false; |
| | | } |
| | | }, |
| | | selectorSwitch(radio) { |
| | | if (this.radio === '0') { |
| | | this.showItemParameter = true; |
| | |
| | | refreshTable() { |
| | | if (this.radio === '0') { |
| | | this.$refs['itemParameterTable'].selectList() |
| | | |
| | | } else { |
| | | this.$refs['testObjectTable'].selectList() |
| | | |
| | | } |
| | | }, |
| | | refresh() { |
| | |
| | | obtainItemParameterList() { |
| | | this.$axios.get(this.$api.laboratoryScope.obtainItemParameterList).then(res => { |
| | | let data = [] |
| | | let data0 = [] |
| | | res.data.forEach(a => { |
| | | data.push({ |
| | | label: a.laboratoryName, |
| | | value: a.id |
| | | }) |
| | | data0.push({ |
| | | label: a.laboratoryName, |
| | | value: a.laboratoryName |
| | | }) |
| | | }) |
| | | this.itemParameterData.selectField.laboratory.select = data |
| | | this.itemParameterData.tagField.laboratory.select = data |
| | | this.itemParameterData.selectField.laboratory.select = data0 |
| | | this.itemParameterData.tagField.laboratory.select = data0 |
| | | this.testObjectData.selectField.laboratoryId.select = data |
| | | this.testObjectData.tagField.laboratoryId.select = data |
| | | this.laboratory = data |
| | |
| | | let del = false |
| | | let product = false |
| | | let select = 0 |
| | | let inPower=false |
| | | let importExcel = false |
| | | for (var i = 0; i < power.length; i++) { |
| | | if (power[i].menuMethod == 'selectItemParameterList') { |
| | | select += 1 |
| | |
| | | if (power[i].menuMethod == 'selectTestObjectList') { |
| | | select += 2 |
| | | } |
| | | if (this.radio === '0') { |
| | | if (radio === '0') { |
| | | if (power[i].menuMethod == 'upItemParameter') { |
| | | up = true |
| | | } |
| | |
| | | } |
| | | if (power[i].menuMethod == 'addItemParameter') { |
| | | add = true |
| | | } |
| | | if (power[i].menuMethod == 'importData') { |
| | | inPower = true |
| | | } |
| | | } else { |
| | | if (power[i].menuMethod == 'upTestObject') { |
| | |
| | | if (power[i].menuMethod == 'selectProductListByObjectId') { |
| | | product = true |
| | | } |
| | | if (power[i].menuMethod == 'importExcel') { |
| | | importExcel = true |
| | | } |
| | | } |
| | | } |
| | | if (this.radio === '0') { |
| | | if (radio === '0') { |
| | | if (!del) { |
| | | this.itemParameterData.do.splice(1, 1) |
| | | } |
| | |
| | | } |
| | | } |
| | | this.addPower = add |
| | | this.inPower=inPower |
| | | this.select = select |
| | | this.importExcel = importExcel |
| | | if (select == 1 || select == 3) this.radio = radio |
| | | else if (select == 2) this.radio = '1' |
| | | else this.radio = '-1' |