From fd1845889744a82334799291674709de0971657a Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期一, 04 十一月 2024 08:28:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/data/channel/opcda/tag/index.vue | 61 ++++++++++++++++++++++++++---- 1 files changed, 52 insertions(+), 9 deletions(-) diff --git a/src/views/data/channel/opcda/tag/index.vue b/src/views/data/channel/opcda/tag/index.vue index 98f57da..cfd1c01 100644 --- a/src/views/data/channel/opcda/tag/index.vue +++ b/src/views/data/channel/opcda/tag/index.vue @@ -2,7 +2,7 @@ <el-drawer v-model="drawer" size="50%" - title="ModBus Tag" + title="OpcDA Tag" :direction="direction" :before-close="handleClose" > @@ -37,10 +37,25 @@ type="primary" plain @click="openForm('create')" - v-hasPermi="['data:channel-modbus:create']" + v-hasPermi="['data:channel-opcda:create']" > <Icon icon="ep:plus" class="mr-5px" /> 新增 + </el-button> + <el-button + type="warning" + plain + @click="handleImport" + v-hasPermi="['data:channel-opcda-tag:import']"> + <Icon icon="ep:upload" /> 导入 + </el-button> + <el-button + type="success" + plain + @click="handleExport" + :loading="exportLoading" + v-hasPermi="['data:channel-opcda-tag:export']"> + <Icon icon="ep:download" />导出 </el-button> </el-form-item> </el-form> @@ -68,7 +83,7 @@ align="center" > <template #default="scope"> - <el-tag v-if="scope.row.enabled === true" size="small">是</el-tag> + <el-tag v-if="scope.row.enabled === 1" size="small">是</el-tag> <el-tag v-else size="small" type="danger">否</el-tag> </template> </el-table-column> @@ -103,12 +118,16 @@ </ContentWrap> <!-- 表单弹窗:添加/修改 --> <TagForm ref="formRef" @success="getList" /> + <TagImportForm ref="importFormRef" @success="getList" /> </el-drawer> </template> <script lang="ts" setup> import type { DrawerProps } from 'element-plus' - import * as OpcdaTagApi from "@/api/data/channel/opcda/tag"; + import * as OpcDaTagApi from "@/api/data/channel/opcda/tag"; import TagForm from './TagForm.vue' + import download from "@/utils/download"; + import {ref,reactive} from "vue"; + import TagImportForm from '../../common/tag/TagImportForm.vue' defineOptions({name: 'ModBusTag'}) @@ -124,16 +143,16 @@ pageNo: 1, pageSize: 10, serverId: undefined, - tagName: undefined + tagName: undefined, + serverName: undefined }) const queryFormRef = ref() // 搜索的表单 const exportLoading = ref(false) // 导出的加载中 - /** 查询列表 */ const getList = async () => { loading.value = true try { - const page = await OpcdaTagApi.getOpcdaTagPage(queryParams) + const page = await OpcDaTagApi.getOpcdaTagPage(queryParams) list.value = page.list total.value = page.total } finally { @@ -165,7 +184,7 @@ // 删除的二次确认 await message.delConfirm() // 发起删除 - await OpcdaTagApi.deleteOpcdaTag(id) + await OpcDaTagApi.deleteOpcdaTag(id) message.success(t('common.delSuccess')) // 刷新列表 await getList() @@ -174,10 +193,11 @@ } /** 打开弹窗 */ - const open = async (serverId?: string) => { + const open = async (serverId?: string, serverName?: string) => { resetForm() drawer.value = true queryParams.serverId = serverId + queryParams.serverName = serverName if (serverId) { getList() } @@ -195,4 +215,27 @@ const handleClose = (done: () => void) => { drawer.value = false } + + /** tag导入 */ + const importFormRef = ref() + const handleImport = () => { + if(queryParams.serverId){ + importFormRef.value.open(queryParams.serverName, '/data/channel/opcda/tag/import',OpcDaTagApi.importOpcDaTagTemplate(), 'OpcDa', queryParams.serverId) + } + } + + /** 导出按钮操作 */ + const handleExport = async () => { + try { + // 导出的二次确认 + await message.exportConfirm() + // 发起导出 + exportLoading.value = true + const data = await OpcDaTagApi.exportOpcDaTag(queryParams) + download.excel(data, 'OpcDa_' + queryParams.serverName + '_Tag列表.xlsx') + } catch { + } finally { + exportLoading.value = false + } + } </script> -- Gitblit v1.9.3