| | |
| | | </el-radio-group> |
| | | </el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-upload v-if="radio === 0" ref='upload1' |
| | | style="display: inline;margin-right: 8px" |
| | | :action="uploadAction1" |
| | | :before-upload="beforeUpload1" :headers="token" :on-error="onError1" |
| | | :on-success="handleSuccessUp1" :show-file-list="false" accept='.doc,.docx,.xls,.xlsx'> |
| | | <el-button size="small" type="primary">导入</el-button> |
| | | </el-upload> |
| | | <el-button size="small" type="primary" v-if="radio === 1" @click="uploadDia = true">导入</el-button> |
| | | <el-button v-if="radio === 0" size="small" type="primary" style="margin-right: 8px" |
| | | @click="$refs.importDialog0.open()">导入</el-button> |
| | | <el-button size="small" type="primary" v-if="radio === 1" @click="$refs.importDialog1.open()">导入</el-button> |
| | | <el-button size="small" type="primary" @click="openAdd()">新增</el-button> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-button :loading="uploading" type="primary" @click="submitProduct">确 认</el-button> |
| | | </span></template> |
| | | </el-dialog> |
| | | <el-dialog v-model="uploadDia" title="数据导入" width="500px"> |
| | | <div style="margin: 0 auto;"> |
| | | <el-upload ref="upload" :action="uploadAction" |
| | | :auto-upload="false" :file-list="fileList" |
| | | :headers="token" :limit="1" |
| | | :on-change="beforeUpload" :on-error="onError" :on-success="onSuccess" accept=".xlsx" drag |
| | | name="file"> |
| | | <lims-icon name="el-icon-upload"></lims-icon> |
| | | <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
| | | </el-upload> |
| | | </div> |
| | | <template #footer><span class="dialog-footer"> |
| | | <el-button @click="uploadDia = false">取 消</el-button> |
| | | <el-button :loading="uploading" type="primary" @click="submitUpload()">上 传</el-button> |
| | | </span></template> |
| | | </el-dialog> |
| | | <import-dialog |
| | | ref="importDialog0" |
| | | title="导入检验项目参数" |
| | | :action="uploadAction1" |
| | | accept=".xls,.xlsx" |
| | | template-url="/import-templates/检验项目参数导入模板.xlsx" |
| | | template-name="检验项目参数导入模板.xlsx" |
| | | :tips="[ |
| | | '每个数据行都必须填写:检验对象、检验项、检验项类型、检验值类型、特殊标识', |
| | | '检验项类型只能填写“非采集类型”或“采集类型”', |
| | | '检验值类型只能填写“数值”或“文本”', |
| | | '特殊标识只能填写“是”或“否”', |
| | | '多个产品/方法/条件/设备编号请用中文分号“;”分隔', |
| | | '请删除多余的空白行,空白行会导致导入失败' |
| | | ]" |
| | | @success="refreshTable" |
| | | /> |
| | | <import-dialog |
| | | ref="importDialog1" |
| | | title="导入检验对象" |
| | | :action="uploadAction" |
| | | accept=".xls,.xlsx" |
| | | template-url="/import-templates/检验对象导入模板.xlsx" |
| | | template-name="检验对象导入模板.xlsx" |
| | | :tips="[ |
| | | '“场所”必须与系统中已有的场所名称完全一致,否则导入失败', |
| | | '检测对象、产品名称必填', |
| | | '同一检测对象有多个产品时,请填写多行' |
| | | ]" |
| | | @success="refreshTable" |
| | | /> |
| | | <!--检验项目参数-编辑弹框--> |
| | | <EditForm ref="editForm" @refreshList="refreshList1"></EditForm> |
| | | <testObjectEditForm ref="testObjectEditForm" @refreshList="refreshList"></testObjectEditForm> |
| | |
| | | selectTestObjectList, upProduct, |
| | | } from "@/api/structural/capability"; |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import ImportDialog from "@/components/ImportDialog/index.vue"; |
| | | import EditForm from "@/views/structural/capabilityAndLaboratory/capabilityComponents/EditForm.vue"; |
| | | import testObjectEditForm from "@/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue"; |
| | | import {getToken} from "@/utils/auth"; |
| | | import { obtainItemParameterList } from '@/api/structural/laboratoryScope' |
| | | |
| | | export default { |
| | | name: 'Capability', |
| | | components: {limsTable, EditForm, testObjectEditForm, BindPartDialog, BindSupplierDensityDialog}, |
| | | components: {limsTable, ImportDialog, EditForm, testObjectEditForm, BindPartDialog, BindSupplierDensityDialog}, |
| | | data() { |
| | | return { |
| | | uploadAction: import.meta.env.VITE_APP_BASE_API + '/capacityScope/importExcel', |
| | |
| | | productRules: { |
| | | name: [{ required: true, message: '请填写产品名称', trigger: 'blur' }] |
| | | }, |
| | | uploadDia: false, |
| | | fileList: [], |
| | | token: {Authorization: "Bearer " + getToken()}, |
| | | uploading: false, |
| | | currentRow: {}, // 选择零件绑定本条数据的信息 |
| | | currentSupplierDensityRow: {}, // 选择零件绑定本条数据的信息 |
| | |
| | | } |
| | | }, |
| | | 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 !== 200) { |
| | | this.$message.error(response.msg) |
| | | return |
| | | } |
| | | this.$message.success('上传成功') |
| | | this.productList = [] |
| | | this.refreshTable() |
| | | }, |
| | | onError(err, file, fileList) { |
| | | this.$message.error('上传失败') |
| | | this.$refs.upload.clearFiles() |
| | | this.uploading = false |
| | | }, |
| | | beforeUpload(file, fileList) { |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | this.$message.error('上传文件不超过10M'); |
| | | this.$refs.upload.clearFiles() |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | }, |
| | | onError1(err, file, fileList) { |
| | | this.$message.error('上传失败') |
| | | this.$refs.upload1.clearFiles() |
| | | this.uploading = false |
| | | }, |
| | | beforeUpload1(file, fileList) { |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | this.$message.error('上传文件不超过10M'); |
| | | this.$refs.upload1.clearFiles() |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | }, |
| | | handleSuccessUp1 (response, file, fileList) { |
| | | this.$refs.upload1.clearFiles() |
| | | if (response.code !== 200) { |
| | | this.$message.error(response.msg) |
| | | return |
| | | } |
| | | this.$message.success('上传成功') |
| | | this.refreshTable() |
| | | }, |
| | | refreshList () { |
| | | this.refreshTable() |
| | | }, |