| | |
| | | height: calc(100% - 60px - 80px - 10px - 40px); |
| | | padding: 20px; |
| | | } |
| | | |
| | | >>> .el-upload { |
| | | width: 100% !important; |
| | | } |
| | | |
| | | >>> .el-upload-dragger { |
| | | width: 100% !important; |
| | | } |
| | | </style> |
| | | |
| | | <template> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | 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; |
| | |
| | | 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 == 'selectProductListByObjectId') { |
| | | product = true |
| | | } |
| | | if (power[i].menuMethod == 'importExcel') { |
| | | importExcel = true |
| | | } |
| | | } |
| | | } |
| | | if (radio === '0') { |
| | |
| | | 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' |