对比新文件 |
| | |
| | | <template> |
| | | <Dialog v-model="dialogVisible" title="Tag导入" width="400"> |
| | | <el-upload |
| | | ref="uploadRef" |
| | | v-model:file-list="fileList" |
| | | :action="importUrl + '?updateSupport=' + updateSupport + '&device=' + parameter" |
| | | :auto-upload="false" |
| | | :disabled="formLoading" |
| | | :headers="uploadHeaders" |
| | | :limit="1" |
| | | :on-error="submitFormError" |
| | | :on-exceed="handleExceed" |
| | | :on-success="submitFormSuccess" |
| | | accept=".xlsx, .xls" |
| | | drag |
| | | > |
| | | <Icon icon="ep:upload" /> |
| | | <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
| | | <template #tip> |
| | | <div class="el-upload__tip text-center"> |
| | | <div class="el-upload__tip"> |
| | | <el-checkbox v-model="updateSupport" /> |
| | | 是否更新已经存在的Tag数据 |
| | | </div> |
| | | <span>仅允许导入 xls、xlsx 格式文件。</span> |
| | | <el-link |
| | | :underline="false" |
| | | style="font-size: 12px; vertical-align: baseline" |
| | | type="primary" |
| | | @click="importTemplate" |
| | | > |
| | | 下载模板 |
| | | </el-link> |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | | <template #footer> |
| | | <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | </template> |
| | | </Dialog> |
| | | </template> |
| | | <script lang="ts" setup> |
| | | |
| | | import { getAccessToken, getTenantId } from '@/utils/auth' |
| | | import download from '@/utils/download' |
| | | import * as ModBusTagApi from "@/api/data/channel/modbus/tag" |
| | | |
| | | defineOptions({ name: 'PointImportForm' }) |
| | | |
| | | const message = useMessage() // 消息弹窗 |
| | | |
| | | const dialogVisible = ref(false) // 弹窗的是否展示 |
| | | const formLoading = ref(false) // 表单的加载中 |
| | | const uploadRef = ref() |
| | | const importUrl = ref() |
| | | const uploadHeaders = ref() // 上传 Header 头 |
| | | const fileList = ref([]) // 文件列表 |
| | | const updateSupport = ref(0) // 是否更新已经存在的测点数据 |
| | | const decName = ref() |
| | | const typeName = ref() |
| | | const parameter = ref() |
| | | let importTemplateApi = reactive() |
| | | /** 打开弹窗 */ |
| | | const open = (name?: string, url?:string, tagApi?:Object, type?:string, params?:string) => { |
| | | importTemplateApi = tagApi |
| | | dialogVisible.value = true |
| | | updateSupport.value = 0 |
| | | fileList.value = [] |
| | | decName.value = name |
| | | typeName.value = type |
| | | parameter.value = params |
| | | importUrl.value = import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + url |
| | | resetForm() |
| | | } |
| | | defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
| | | |
| | | /** 提交表单 */ |
| | | const submitForm = async () => { |
| | | if (fileList.value.length == 0) { |
| | | message.error('请上传文件') |
| | | return |
| | | } |
| | | // 提交请求 |
| | | uploadHeaders.value = { |
| | | Authorization: 'Bearer ' + getAccessToken(), |
| | | 'tenant-id': getTenantId() |
| | | } |
| | | formLoading.value = true |
| | | uploadRef.value!.submit() |
| | | } |
| | | |
| | | /** 文件上传成功 */ |
| | | const emits = defineEmits(['success']) |
| | | const submitFormSuccess = (response: any) => { |
| | | if (response.code !== 0) { |
| | | message.error(response.msg) |
| | | formLoading.value = false |
| | | return |
| | | } |
| | | // 拼接提示语 |
| | | const data = response.data |
| | | let text = '上传成功数量:' + data.createTagNames.length + ';' |
| | | for (let tagName of data.createTagNames) { |
| | | text += '< ' + tagName + ' >' |
| | | } |
| | | text += '更新成功数量:' + data.updateTagNames.length + ';' |
| | | for (const tagName of data.updateTagNames) { |
| | | text += '< ' + tagName + ' >' |
| | | } |
| | | text += '更新失败数量:' + Object.keys(data.failureTagNames).length + ';' |
| | | for (const tagName in data.failureTagNames) { |
| | | text += '< ' + tagName + ': ' + data.failureTagNames[tagName] + ' >' |
| | | } |
| | | message.alert(text) |
| | | formLoading.value = false |
| | | dialogVisible.value = false |
| | | // 发送操作成功的事件 |
| | | emits('success') |
| | | } |
| | | |
| | | /** 上传错误提示 */ |
| | | const submitFormError = (): void => { |
| | | message.error('上传失败,请您重新上传!') |
| | | formLoading.value = false |
| | | } |
| | | |
| | | /** 重置表单 */ |
| | | const resetForm = async (): Promise<void> => { |
| | | // 重置上传状态和文件 |
| | | formLoading.value = false |
| | | await nextTick() |
| | | uploadRef.value?.clearFiles() |
| | | } |
| | | |
| | | /** 文件数超出提示 */ |
| | | const handleExceed = (): void => { |
| | | message.error('最多只能上传一个文件!') |
| | | } |
| | | |
| | | /** 下载模板操作 */ |
| | | const importTemplate = async () => { |
| | | const res = await importTemplateApi |
| | | const excelName = typeName.value + '_' + decName.value + '_' + 'Tag导入模板.xlsx' |
| | | download.excel(res, excelName) |
| | | } |
| | | </script> |
| | |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | @click="openTagList(scope.row.id)" |
| | | @click="openTagList(scope.row.id, scope.row.name)" |
| | | v-hasPermi="['data:channel-http:update']" |
| | | > |
| | | TAG |
| | |
| | | |
| | | /** TAG操作 */ |
| | | const tagRef = ref() |
| | | const openTagList = (id?: string) => { |
| | | tagRef.value.open(id) |
| | | const openTagList = (id?: string, name?:string) => { |
| | | tagRef.value.open(id,name) |
| | | } |
| | | |
| | | /** 删除按钮操作 */ |
| | |
| | | <el-form-item label="是否启用" prop="enabled"> |
| | | <el-select v-model="formData.enabled" placeholder="请选择"> |
| | | <el-option |
| | | v-for="dict in getBoolDictOptions(DICT_TYPE.IS_ENABLED)" |
| | | v-for="dict in getIntDictOptions(DICT_TYPE.COM_IS_INT)" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import * as HttpTagApi from '@/api/data/channel/http/tag' |
| | | import { CommonEnabledBool } from '@/utils/constants' |
| | | import { DICT_TYPE, getStrDictOptions, getBoolDictOptions } from '@/utils/dict' |
| | | import {CommonEnabled} from '@/utils/constants' |
| | | import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict' |
| | | |
| | | defineOptions({name: 'HttpTagForm'}) |
| | | |
| | |
| | | tagName: undefined, |
| | | dataType: undefined, |
| | | tagDesc: '', |
| | | enabled: CommonEnabledBool.ENABLE, |
| | | enabled: CommonEnabled.ENABLE, |
| | | }) |
| | | const formRules = reactive({ |
| | | tagName: [{required: true, message: 'Tag名称不能为空', trigger: 'blur'}], |
| | |
| | | tagName: undefined, |
| | | dataType: undefined, |
| | | tagDesc: '', |
| | | enabled: CommonEnabledBool.ENABLE, |
| | | enabled: CommonEnabled.ENABLE, |
| | | } |
| | | formRef.value?.resetFields() |
| | | } |
| | |
| | | <el-drawer |
| | | v-model="drawer" |
| | | size="50%" |
| | | title="Kio Tag" |
| | | title="Http Tag" |
| | | :direction="direction" |
| | | :before-close="handleClose" |
| | | > |
| | |
| | | type="primary" |
| | | plain |
| | | @click="openForm('create')" |
| | | v-hasPermi="['data:channel-kio:create']" |
| | | v-hasPermi="['data:channel-http:create']" |
| | | > |
| | | <Icon icon="ep:plus" class="mr-5px" /> |
| | | 新增 |
| | | </el-button> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | @click="handleImport" |
| | | v-hasPermi="['data:channel-http-tag:import']"> |
| | | <Icon icon="ep:upload" /> 导入 |
| | | </el-button> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | @click="handleExport" |
| | | :loading="exportLoading" |
| | | v-hasPermi="['data:channel-http-tag:export']"> |
| | | <Icon icon="ep:download" />导出 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | 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> |
| | |
| | | link |
| | | type="primary" |
| | | @click="openForm('update', scope.row.id)" |
| | | v-hasPermi="['data:channel-kio:update']" |
| | | v-hasPermi="['data:channel-http:update']" |
| | | > |
| | | 编辑 |
| | | </el-button> |
| | |
| | | link |
| | | type="danger" |
| | | @click="handleDelete(scope.row.id)" |
| | | v-hasPermi="['data:channel-kio:delete']" |
| | | v-hasPermi="['data:channel-http:delete']" |
| | | > |
| | | 删除 |
| | | </el-button> |
| | |
| | | </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 HttpTagApi from "@/api/data/channel/http/tag"; |
| | | import TagForm from './TagForm.vue' |
| | | import download from "@/utils/download"; |
| | | import {ref} from "vue"; |
| | | import TagImportForm from '../../../common/tag/TagImportForm.vue' |
| | | |
| | | defineOptions({name: 'HttpTag'}) |
| | | |
| | |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | apiId: undefined, |
| | | tagName: undefined |
| | | tagName: undefined, |
| | | httpName: undefined |
| | | }) |
| | | const queryFormRef = ref() // 搜索的表单 |
| | | const exportLoading = ref(false) // 导出的加载中 |
| | |
| | | } |
| | | |
| | | /** 打开弹窗 */ |
| | | const open = async (apiId?: string) => { |
| | | const open = async (apiId?: string, name?:string) => { |
| | | resetForm() |
| | | drawer.value = true |
| | | queryParams.apiId = apiId |
| | | queryParams.httpName = name |
| | | if (apiId) { |
| | | getList() |
| | | } |
| | |
| | | const handleClose = (done: () => void) => { |
| | | drawer.value = false |
| | | } |
| | | |
| | | /** tag导入 */ |
| | | const importFormRef = ref() |
| | | const handleImport = () => { |
| | | if(queryParams.apiId){ |
| | | importFormRef.value.open(queryParams.httpName, '/data/channel/http/tag/import',HttpTagApi.importHttpTagTemplate(), 'Http', queryParams.apiId) |
| | | } |
| | | } |
| | | |
| | | /** 导出按钮操作 */ |
| | | const handleExport = async () => { |
| | | try { |
| | | // 导出的二次确认 |
| | | await message.exportConfirm() |
| | | // 发起导出 |
| | | exportLoading.value = true |
| | | const data = await HttpTagApi.exportHttpTag(queryParams) |
| | | download.excel(data, 'Http_' + queryParams.httpName + '_Tag列表.xlsx') |
| | | } catch { |
| | | } finally { |
| | | exportLoading.value = false |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <el-form-item label="是否启用" prop="enabled"> |
| | | <el-select v-model="formData.enabled" placeholder="请选择"> |
| | | <el-option |
| | | v-for="dict in getBoolDictOptions(DICT_TYPE.IS_ENABLED)" |
| | | v-for="dict in getIntDictOptions(DICT_TYPE.COM_IS_INT)" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import * as KioTagApi from '@/api/data/channel/kio/tag' |
| | | import { CommonEnabledBool } from '@/utils/constants' |
| | | import {CommonEnabled} from '@/utils/constants' |
| | | import {isPositiveInteger} from '@/utils/validate' |
| | | import { DICT_TYPE, getStrDictOptions, getBoolDictOptions } from '@/utils/dict' |
| | | import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict' |
| | | |
| | | defineOptions({name: 'KioTagForm'}) |
| | | |
| | |
| | | dataType: undefined, |
| | | tagId: undefined, |
| | | tagDesc: '', |
| | | enabled: CommonEnabledBool.ENABLE, |
| | | enabled: CommonEnabled.ENABLE, |
| | | device: undefined, |
| | | samplingRate: undefined |
| | | |
| | |
| | | dataType: undefined, |
| | | tagId: undefined, |
| | | tagDesc: '', |
| | | enabled: CommonEnabledBool.ENABLE, |
| | | enabled: CommonEnabled.ENABLE, |
| | | device: undefined, |
| | | samplingRate: undefined |
| | | } |
| | |
| | | <Icon icon="ep:plus" class="mr-5px" /> |
| | | 新增 |
| | | </el-button> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | @click="handleImport" |
| | | v-hasPermi="['data:channel-kio-tag:import']"> |
| | | <Icon icon="ep:upload" /> 导入 |
| | | </el-button> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | @click="handleExport" |
| | | :loading="exportLoading" |
| | | v-hasPermi="['data:channel-kio-tag:export']"> |
| | | <Icon icon="ep:download" />导出 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </ContentWrap> |
| | |
| | | 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> |
| | |
| | | </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 KioTagApi from "@/api/data/channel/kio/tag"; |
| | | import TagForm from './TagForm.vue' |
| | | import download from "@/utils/download"; |
| | | import {ref} from "vue"; |
| | | import TagImportForm from '../../common/tag/TagImportForm.vue' |
| | | |
| | | defineOptions({name: 'KioTag'}) |
| | | |
| | |
| | | const handleClose = (done: () => void) => { |
| | | drawer.value = false |
| | | } |
| | | |
| | | /** tag导入 */ |
| | | const importFormRef = ref() |
| | | const handleImport = () => { |
| | | if(queryParams.device){ |
| | | importFormRef.value.open(queryParams.device, '/data/channel/kio/tag/import',KioTagApi.importKioTagTemplate(), 'Kio', queryParams.device) |
| | | } |
| | | } |
| | | |
| | | /** 导出按钮操作 */ |
| | | const handleExport = async () => { |
| | | try { |
| | | // 导出的二次确认 |
| | | await message.exportConfirm() |
| | | // 发起导出 |
| | | exportLoading.value = true |
| | | const data = await KioTagApi.exportKioTag(queryParams) |
| | | download.excel(data, 'Kio_' + queryParams.device + '_Tag列表.xlsx') |
| | | } catch { |
| | | } finally { |
| | | exportLoading.value = false |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <el-form-item label="是否启用" prop="enabled"> |
| | | <el-select v-model="formData.enabled" placeholder="请选择"> |
| | | <el-option |
| | | v-for="dict in getBoolDictOptions(DICT_TYPE.IS_ENABLED)" |
| | | v-for="dict in getIntDictOptions(DICT_TYPE.COM_IS_INT)" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | |
| | | import * as ModBusTagApi from '@/api/data/channel/modbus/tag' |
| | | import { CommonEnabled } from '@/utils/constants' |
| | | import {isPositiveInteger} from '@/utils/validate' |
| | | import { DICT_TYPE, getStrDictOptions, getBoolDictOptions } from '@/utils/dict' |
| | | import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict' |
| | | |
| | | defineOptions({name: 'ModBusTagForm'}) |
| | | |
| | |
| | | dataType: undefined, |
| | | enabled: CommonEnabled.ENABLE, |
| | | format: undefined, |
| | | device: '1', |
| | | device: '', |
| | | address: '', |
| | | samplingRate: undefined, |
| | | tagDesc: '', |
| | |
| | | type="primary" |
| | | plain |
| | | @click="openForm('create')" |
| | | v-hasPermi="['data:channel-modbus:create']" |
| | | > |
| | | v-hasPermi="['data:channel-modbus:create']"> |
| | | <Icon icon="ep:plus" class="mr-5px" /> |
| | | 新增 |
| | | </el-button> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | @click="handleImport" |
| | | v-hasPermi="['data:channel-modbus-tag:import']"> |
| | | <Icon icon="ep:upload" /> 导入 |
| | | </el-button> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | @click="handleExport" |
| | | :loading="exportLoading" |
| | | v-hasPermi="['data:channel-modbus-tag:export']"> |
| | | <Icon icon="ep:download" />导出 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | 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> |
| | |
| | | </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 ModBusTagApi from "@/api/data/channel/modbus/tag"; |
| | | import TagForm from './TagForm.vue' |
| | | import download from "@/utils/download"; |
| | | import {ref} from "vue"; |
| | | import TagImportForm from '../../common/tag/TagImportForm.vue' |
| | | |
| | | defineOptions({name: 'ModBusTag'}) |
| | | |
| | |
| | | const handleClose = (done: () => void) => { |
| | | drawer.value = false |
| | | } |
| | | |
| | | /** tag导入 */ |
| | | const importFormRef = ref() |
| | | const handleImport = () => { |
| | | if(queryParams.device){ |
| | | importFormRef.value.open(queryParams.device, '/data/channel/modbus/tag/import',ModBusTagApi.importModBusTagTemplate(), 'ModBus', queryParams.device) |
| | | } |
| | | } |
| | | |
| | | /** 导出按钮操作 */ |
| | | const handleExport = async () => { |
| | | try { |
| | | // 导出的二次确认 |
| | | await message.exportConfirm() |
| | | // 发起导出 |
| | | exportLoading.value = true |
| | | const data = await ModBusTagApi.exportModBusTag(queryParams) |
| | | download.excel(data, 'ModBus_' + queryParams.device + '_Tag列表.xlsx') |
| | | } catch { |
| | | } finally { |
| | | exportLoading.value = false |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | @click="openTagList(scope.row.id)" |
| | | @click="openTagList(scope.row.id,scope.row.serverName)" |
| | | v-hasPermi="['data:channel-opcda:update']" |
| | | > |
| | | TAG |
| | |
| | | |
| | | /** TAG操作 */ |
| | | const tagRef = ref() |
| | | const openTagList = (id?: string) => { |
| | | tagRef.value.open(id) |
| | | const openTagList = (id?: string,serverName?:string) => { |
| | | tagRef.value.open(id,serverName) |
| | | } |
| | | |
| | | /** 删除按钮操作 */ |
| | |
| | | <el-form-item label="是否启用" prop="enabled"> |
| | | <el-select v-model="formData.enabled" placeholder="请选择"> |
| | | <el-option |
| | | v-for="dict in getBoolDictOptions(DICT_TYPE.IS_ENABLED)" |
| | | v-for="dict in getIntDictOptions(DICT_TYPE.COM_IS_INT)" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import * as OpcdaTagApi from '@/api/data/channel/opcda/tag' |
| | | import { CommonEnabledBool } from '@/utils/constants' |
| | | import { DICT_TYPE, getStrDictOptions, getBoolDictOptions } from '@/utils/dict' |
| | | import {CommonEnabled} from '@/utils/constants' |
| | | import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict' |
| | | |
| | | defineOptions({name: 'OpcdaTagForm'}) |
| | | |
| | |
| | | serverId: undefined, |
| | | tagName: undefined, |
| | | dataType: undefined, |
| | | enabled: CommonEnabledBool.ENABLE, |
| | | enabled: CommonEnabled.ENABLE, |
| | | itemId: undefined |
| | | }) |
| | | const formRules = reactive({ |
| | |
| | | serverId: undefined, |
| | | tagName: undefined, |
| | | dataType: undefined, |
| | | enabled: CommonEnabledBool.ENABLE, |
| | | enabled: CommonEnabled.ENABLE, |
| | | itemId: undefined |
| | | } |
| | | formRef.value?.resetFields() |
| | |
| | | <el-drawer |
| | | v-model="drawer" |
| | | size="50%" |
| | | title="ModBus Tag" |
| | | title="OpcDA Tag" |
| | | :direction="direction" |
| | | :before-close="handleClose" |
| | | > |
| | |
| | | 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> |
| | |
| | | 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> |
| | |
| | | </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'}) |
| | | |
| | |
| | | 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 { |
| | |
| | | // 删除的二次确认 |
| | | await message.delConfirm() |
| | | // 发起删除 |
| | | await OpcdaTagApi.deleteOpcdaTag(id) |
| | | await OpcDaTagApi.deleteOpcdaTag(id) |
| | | message.success(t('common.delSuccess')) |
| | | // 刷新列表 |
| | | await getList() |
| | |
| | | } |
| | | |
| | | /** 打开弹窗 */ |
| | | 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() |
| | | } |
| | |
| | | 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> |
| | |
| | | <el-form-item label="是否启用" prop="enabled"> |
| | | <el-select v-model="formData.enabled" placeholder="请选择"> |
| | | <el-option |
| | | v-for="dict in getBoolDictOptions(DICT_TYPE.IS_ENABLED)" |
| | | v-for="dict in getIntDictOptions(DICT_TYPE.COM_IS_INT)" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import * as OpcuaTagApi from '@/api/data/channel/opcua/tag' |
| | | import { CommonEnabledBool } from '@/utils/constants' |
| | | import { DICT_TYPE, getStrDictOptions, getBoolDictOptions } from '@/utils/dict' |
| | | import {CommonEnabled} from '@/utils/constants' |
| | | import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict' |
| | | |
| | | defineOptions({name: 'OpcuaTagForm'}) |
| | | |
| | |
| | | device: undefined, |
| | | tagName: undefined, |
| | | dataType: undefined, |
| | | enabled: CommonEnabledBool.ENABLE, |
| | | enabled: CommonEnabled.ENABLE, |
| | | address: undefined, |
| | | samplingRate: undefined |
| | | }) |
| | |
| | | device: undefined, |
| | | tagName: undefined, |
| | | dataType: undefined, |
| | | enabled: CommonEnabledBool.ENABLE, |
| | | enabled: CommonEnabled.ENABLE, |
| | | address: undefined, |
| | | samplingRate: undefined |
| | | } |
| | |
| | | <Icon icon="ep:plus" class="mr-5px" /> |
| | | 新增 |
| | | </el-button> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | @click="handleImport" |
| | | v-hasPermi="['data:channel-opcua-tag:import']"> |
| | | <Icon icon="ep:upload" /> 导入 |
| | | </el-button> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | @click="handleExport" |
| | | :loading="exportLoading" |
| | | v-hasPermi="['data:channel-opcua-tag:export']"> |
| | | <Icon icon="ep:download" />导出 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </ContentWrap> |
| | |
| | | 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> |
| | |
| | | </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 OpcuaTagApi from "@/api/data/channel/opcua/tag"; |
| | | import * as OpcUaTagApi from "@/api/data/channel/opcua/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: 'OpcuaTag'}) |
| | | |
| | |
| | | const getList = async () => { |
| | | loading.value = true |
| | | try { |
| | | const page = await OpcuaTagApi.getOpcuaTagPage(queryParams) |
| | | const page = await OpcUaTagApi.getOpcuaTagPage(queryParams) |
| | | list.value = page.list |
| | | total.value = page.total |
| | | } finally { |
| | |
| | | // 删除的二次确认 |
| | | await message.delConfirm() |
| | | // 发起删除 |
| | | await OpcuaTagApi.deleteOpcuaTag(id) |
| | | await OpcUaTagApi.deleteOpcuaTag(id) |
| | | message.success(t('common.delSuccess')) |
| | | // 刷新列表 |
| | | await getList() |
| | |
| | | const handleClose = (done: () => void) => { |
| | | drawer.value = false |
| | | } |
| | | |
| | | /** tag导入 */ |
| | | const importFormRef = ref() |
| | | const handleImport = () => { |
| | | if(queryParams.device){ |
| | | importFormRef.value.open(queryParams.device, '/data/channel/opcua/tag/import',OpcUaTagApi.importOpcUaTagTemplate(), 'OpcUa', queryParams.device) |
| | | } |
| | | } |
| | | |
| | | /** 导出按钮操作 */ |
| | | const handleExport = async () => { |
| | | try { |
| | | // 导出的二次确认 |
| | | await message.exportConfirm() |
| | | // 发起导出 |
| | | exportLoading.value = true |
| | | const data = await OpcUaTagApi.exportOpcUaTag(queryParams) |
| | | download.excel(data, 'OpcUa_' + queryParams.device + '_Tag列表.xlsx') |
| | | } catch { |
| | | } finally { |
| | | exportLoading.value = false |
| | | } |
| | | } |
| | | </script> |