点位上传、下载

This commit is contained in:
白菜
2025-12-04 17:46:11 +08:00
parent 11d44de513
commit cd8871d45a
2 changed files with 201 additions and 161 deletions

View File

@ -1,7 +1,10 @@
<template> <template>
<el-dialog :visible.sync="show" class="ems-dialog" title="点位上传" width="400px" append-to-body :close-on-click-modal="false" :close-on-press-escape="false"> <el-dialog :visible.sync="show" class="ems-dialog" title="点位上传" width="400px" append-to-body
:close-on-click-modal="false" :close-on-press-escape="false">
<!-- <file-upload :fileType='["xls", "xlsx"]' value="String" :limit="1" :drag="false" @input="updateFile"/>--> <!-- <file-upload :fileType='["xls", "xlsx"]' value="String" :limit="1" :drag="false" @input="updateFile"/>-->
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url" :data="upload.data" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag> <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url"
:data="upload.data" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess" :auto-upload="false" drag>
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div> <div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip"> <div class="el-upload__tip text-center" slot="tip">
@ -21,6 +24,7 @@
</style> </style>
<script> <script>
import {getToken} from "@/utils/auth" import {getToken} from "@/utils/auth"
export default { export default {
data() { data() {
return { return {
@ -38,8 +42,8 @@ export default {
} }
}, },
methods: { methods: {
showDialog({siteId,deviceId,deviceCategory}){ showDialog({siteId, code}) {
this.upload.data={siteId,deviceId,deviceCategory} this.upload.data = {siteId, deviceCategory: code}
this.show = true; this.show = true;
}, },
//关闭弹窗 重置数据 //关闭弹窗 重置数据

View File

@ -1,10 +1,11 @@
<template> <template>
<div class="ems-dashboard-editor-container" style="background-color: #ffffff" v-loading="loading"> <div class="ems-dashboard-editor-container" style="background-color: #ffffff" v-loading="loading">
<el-form :inline="true" class="select-container"> <el-form :inline="true" class="select-container">
<el-form-item label="站点选择"> <el-form-item label="站点选择">
<el-select v-model="siteId" placeholder="请选择换电站名称" :loading="searchLoading" loading-text="正在加载数据" @change="onSearch" clearable> <el-select v-model="siteId" placeholder="请选择换电站名称" :loading="searchLoading" loading-text="正在加载数据"
<el-option :label="item.siteName" :value="item.siteId" v-for="(item,index) in siteList" :key="index+'zdxeSelect'"></el-option> @change="onSearch" clearable>
<el-option :label="item.siteName" :value="item.siteId" v-for="(item,index) in siteList"
:key="index+'zdxeSelect'"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -13,6 +14,36 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-button type="primary" @click="addDevice" native-type="button">新增设备</el-button> <el-button type="primary" @click="addDevice" native-type="button">新增设备</el-button>
<el-dropdown @command="downloadPointDetail">
<el-button
style="margin-left:10px;"
type="primary"
plain>
下载点位清单
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(item,index) in deviceCategoryList" :key="index+'deviceCategoryList'"
:command="item">
{{ item.name }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown @command="uploadPointDetail">
<el-button
style="margin-left:10px;"
type="success"
plain>
上传点位清单
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(item,index) in deviceCategoryList" :key="index+'deviceCategoryList'"
:command="item">
{{ item.name }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-table <el-table
class="common-table" class="common-table"
:data="tableData" :data="tableData"
@ -65,23 +96,6 @@
报警点位清单 报警点位清单
</el-button> </el-button>
<br> <br>
<el-button
@click="downloadPointDetail(scope.row)"
style="margin-top:10px;"
type="primary"
plain
size="mini">
下载点位清单
</el-button>
<el-button
@click="uploadPointDetail(scope.row)"
style="margin-top:10px;"
type="success"
plain
size="mini">
上传点位清单
</el-button>
<br>
<el-button <el-button
@click="editDevice(scope.row)" @click="editDevice(scope.row)"
style="margin-top:10px;" style="margin-top:10px;"
@ -112,10 +126,14 @@
style="margin-top:15px;text-align: center" style="margin-top:15px;text-align: center"
> >
</el-pagination> </el-pagination>
<el-dialog :visible.sync="dialogTableVisible" class="ems-dialog" title=" 详细信息" :close-on-click-modal="false" :before-close="handleClosed"> <el-dialog :visible.sync="dialogTableVisible" class="ems-dialog" title=" 详细信息" :close-on-click-modal="false"
:before-close="handleClosed">
<div class="descriptions-main" style="padding: 0"> <div class="descriptions-main" style="padding: 0">
<el-descriptions direction="vertical" :column="2" :colon="false" border> <el-descriptions direction="vertical" :column="2" :colon="false" border>
<el-descriptions-item v-for="(item,index) in detailData" :key="index+'descriptions'" labelClassName="descriptions-label" contentClassName="descriptions-direction" :span="1" :label="item.label">{{item.value}}</el-descriptions-item> <el-descriptions-item v-for="(item,index) in detailData" :key="index+'descriptions'"
labelClassName="descriptions-label" contentClassName="descriptions-direction" :span="1"
:label="item.label">{{ item.value }}
</el-descriptions-item>
</el-descriptions> </el-descriptions>
</div> </div>
</el-dialog> </el-dialog>
@ -126,12 +144,14 @@
</template> </template>
<script> <script>
import {getDeviceInfoList,getDeviceDetailInfo,deleteService} from'@/api/ems/site' import {deleteService, getDeviceDetailInfo, getDeviceInfoList} from '@/api/ems/site'
import {getAllSites} from '@/api/ems/zddt' import {getAllSites} from '@/api/ems/zddt'
import {formatNumber} from "@/filters/ems"; import {formatNumber} from "@/filters/ems";
import {getAllDeviceCategory} from '@/api/ems/search'
import PointTable from './PointTable.vue' import PointTable from './PointTable.vue'
import AddDevice from "./AddDevice.vue"; import AddDevice from "./AddDevice.vue";
import PointUpload from "./PointUpload.vue"; import PointUpload from "./PointUpload.vue";
export default { export default {
name: "Sblb", name: "Sblb",
components: {AddDevice, PointTable, PointUpload}, components: {AddDevice, PointTable, PointUpload},
@ -144,6 +164,7 @@ export default {
siteId: '', siteId: '',
siteList: [], siteList: [],
tableData: [], tableData: [],
deviceCategoryList: [],//设备类别
pageSize: 10,//分页栏当前每个数据总数 pageSize: 10,//分页栏当前每个数据总数
pageNum: 1,//分页栏当前页数 pageNum: 1,//分页栏当前页数
totalSize: 0,//table表格数据总数 totalSize: 0,//table表格数据总数
@ -172,20 +193,26 @@ export default {
} }
}, },
methods: { methods: {
// 获取设备类别
getDeviceCategoryList() {
getAllDeviceCategory().then(response => {
this.deviceCategoryList = response?.data || []
})
},
// 查看设备电位表格 // 查看设备电位表格
pointDetail(row, dataType) { pointDetail(row, dataType) {
this.$refs.pointTable.showTable(row, dataType) this.$refs.pointTable.showTable(row, dataType)
}, },
// 下载点位清单 // 下载点位清单
downloadPointDetail({siteId,deviceCategory,deviceName}){ downloadPointDetail(command) {
this.download('ems/pointMatch/export', { this.download('ems/pointMatch/export', {
siteId, siteId: this.siteId,
deviceCategory deviceCategory: command.code
}, `点位清单_${deviceName}_${new Date().getTime()}.xlsx`) }, `点位清单_${command.name}_${new Date().getTime()}.xlsx`)
}, },
// 上传点位清单 // 上传点位清单
uploadPointDetail(row){ uploadPointDetail(command) {
this.$refs.pointUpload.showDialog(row) this.$refs.pointUpload.showDialog({...command, siteId: this.siteId})
}, },
clearEditDeviceData() { clearEditDeviceData() {
this.mode = ''; this.mode = '';
@ -235,7 +262,9 @@ export default {
}); });
}, },
handleClosed(done) { handleClosed(done) {
this.detailData.forEach((item)=>{item.value = ''}) this.detailData.forEach((item) => {
item.value = ''
})
done() done()
}, },
toDetail(id) { toDetail(id) {
@ -251,7 +280,9 @@ export default {
}) })
this.dialogTableVisible = true this.dialogTableVisible = true
}).finally(() => {this.loading = false}) }).finally(() => {
this.loading = false
})
}, },
// 分页 // 分页
@ -285,7 +316,9 @@ export default {
getDeviceInfoList({siteId, pageNum, pageSize}).then(response => { getDeviceInfoList({siteId, pageNum, pageSize}).then(response => {
this.tableData = response?.rows || []; this.tableData = response?.rows || [];
this.totalSize = response?.total || 0 this.totalSize = response?.total || 0
}).finally(() => {this.loading=false}) }).finally(() => {
this.loading = false
})
}, },
//获取站点列表 //获取站点列表
getZdList() { getZdList() {
@ -293,13 +326,16 @@ export default {
return getAllSites().then(response => { return getAllSites().then(response => {
this.siteList = response?.data || [] this.siteList = response?.data || []
if (this.siteList.length > 0) this.siteId = this.siteList[0].siteId if (this.siteList.length > 0) this.siteId = this.siteList[0].siteId
}).finally(() => {this.searchLoading=false}) }).finally(() => {
this.searchLoading = false
})
} }
}, },
mounted() { mounted() {
this.loading = true this.loading = true
this.siteId = '' this.siteId = ''
this.pageNum = 1//每次搜索从1开始搜索 this.pageNum = 1//每次搜索从1开始搜索
this.getDeviceCategoryList()
this.getZdList().then(() => { this.getZdList().then(() => {
this.getData() this.getData()
}) })