| | |
| | | v-if="list.length > 0 || loading"> |
| | | <ul class="card"> |
| | | <li v-for="(m, i) in list" :key="i"> |
| | | <el-image class="img" :src="javaApi + '/img/' + m.imageUpload"> |
| | | <el-image v-if="m.imageUpload" class="img" :src="javaApi + '/img/' + m.imageUpload"> |
| | | <template #error><div class="image-error" style="width: 88px; |
| | | height: 88px; |
| | | border-radius: 16px; |
| | |
| | | <lims-icon name="el-icon-picture-outline" style="font-size:20px;color:var(--lims-text-2);"></lims-icon> |
| | | </div></template> |
| | | </el-image> |
| | | <div v-else class="image-error" style="width: 88px; |
| | | height: 88px; |
| | | border-radius: 16px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | border: 1px solid var(--lims-divider);margin-right: 10px;"> |
| | | <lims-icon name="el-icon-picture-outline" style="font-size:20px;color:var(--lims-text-2);"></lims-icon> |
| | | </div> |
| | | <div class="list-left"> |
| | | <div class="list-left-info"> |
| | | <span class="label" style="white-space: nowrap;">设备名称:</span> |
| | |
| | | <el-button link type="primary" @click="downloadTemplate">下载导入模板</el-button> |
| | | </div> |
| | | <el-upload ref="deviceUpload" drag name="file" accept=".xlsx" :action="importAction" |
| | | :headers="uploadHeader" :auto-upload="false" :limit="1" :file-list="importFiles" |
| | | :headers="uploadHeader" :auto-upload="false" :limit="1" v-model:file-list="importFiles" |
| | | :before-upload="beforeImport" :on-success="importSuccess" :on-error="importError"> |
| | | <lims-icon name="el-icon-upload"></lims-icon> |
| | | <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
| | |
| | | selectDeviceParameter, |
| | | downloadDeviceImportTemplate, |
| | | } from '@/api/cnas/resourceDemand/device.js' |
| | | import { saveBlobOrShowError } from '@/utils/saveBlob' |
| | | export default { |
| | | props: { |
| | | clickNodeVal: { |
| | |
| | | methods: { |
| | | downloadTemplate() { |
| | | downloadDeviceImportTemplate().then(res => { |
| | | this.$download.saveAs(new Blob([res]), '设备导入模板.xlsx') |
| | | }) |
| | | saveBlobOrShowError(res, '设备导入模板.xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') |
| | | }).catch(() => { }) |
| | | }, |
| | | submitImport() { |
| | | if (!this.$refs.deviceUpload.uploadFiles.length) { |
| | | if (!this.importFiles || this.importFiles.length === 0) { |
| | | this.$message.warning('请选择需要导入的Excel文件') |
| | | return |
| | | } |
| | |
| | | } |
| | | } |
| | | this.loading = false |
| | | }).catch(() => { |
| | | // 清掉本页占位,失败后可用查询/重置重新加载 |
| | | delete this.keyMap[key] |
| | | this.loading = false |
| | | this.finishLoding = true |
| | | }) |
| | | }, |
| | | refresh() { |