提交 | 用户 | 时间
|
325d3d
|
1 |
<template> |
L |
2 |
<!-- 搜索 --> |
|
3 |
<ContentWrap> |
|
4 |
<el-form |
|
5 |
class="-mb-15px" |
|
6 |
:model="queryParams" |
|
7 |
ref="queryFormRef" |
|
8 |
:inline="true" |
|
9 |
label-width="68px" |
|
10 |
> |
|
11 |
<el-form-item label="服务名" prop="serverName"> |
|
12 |
<el-input |
|
13 |
v-model="queryParams.serverName" |
|
14 |
placeholder="请输入服务名" |
|
15 |
clearable |
|
16 |
@keyup.enter="handleQuery" |
|
17 |
class="!w-240px" |
|
18 |
/> |
|
19 |
</el-form-item> |
|
20 |
<el-form-item> |
|
21 |
<el-button @click="handleQuery"> |
|
22 |
<Icon icon="ep:search" class="mr-5px" /> |
|
23 |
搜索 |
|
24 |
</el-button> |
|
25 |
<el-button @click="resetQuery"> |
|
26 |
<Icon icon="ep:refresh" class="mr-5px" /> |
|
27 |
重置 |
|
28 |
</el-button> |
|
29 |
<el-button |
|
30 |
type="primary" |
|
31 |
plain |
|
32 |
@click="openForm('create')" |
24d32b
|
33 |
v-hasPermi="['data:channel-opcda:create']" |
325d3d
|
34 |
> |
L |
35 |
<Icon icon="ep:plus" class="mr-5px" /> |
|
36 |
新增 |
|
37 |
</el-button> |
|
38 |
</el-form-item> |
|
39 |
</el-form> |
|
40 |
</ContentWrap> |
|
41 |
|
|
42 |
<!-- 列表 --> |
|
43 |
<ContentWrap> |
|
44 |
<el-table v-loading="loading" :data="list"> |
|
45 |
<el-table-column label="服务名" align="center" prop="serverName" /> |
|
46 |
<el-table-column label="IP" align="center" prop="host" /> |
|
47 |
<el-table-column label="用户名" align="center" prop="user" /> |
|
48 |
<el-table-column label="设备名" align="center" prop="progId" /> |
|
49 |
<el-table-column label="设备注册表ID" align="center" prop="clsId" /> |
|
50 |
<el-table-column label="操作" align="center" min-width="110" fixed="right"> |
|
51 |
<template #default="scope"> |
|
52 |
<el-button |
|
53 |
link |
|
54 |
type="primary" |
|
55 |
@click="openForm('update', scope.row.id)" |
24d32b
|
56 |
v-hasPermi="['data:channel-opcda:update']" |
325d3d
|
57 |
> |
L |
58 |
编辑 |
|
59 |
</el-button> |
|
60 |
<el-button |
|
61 |
link |
24d32b
|
62 |
type="primary" |
6c2636
|
63 |
@click="openTagList(scope.row.id,scope.row.serverName)" |
24d32b
|
64 |
v-hasPermi="['data:channel-opcda:update']" |
潘 |
65 |
> |
|
66 |
TAG |
|
67 |
</el-button> |
|
68 |
<el-button |
|
69 |
link |
325d3d
|
70 |
type="danger" |
L |
71 |
@click="handleDelete(scope.row.id)" |
24d32b
|
72 |
v-hasPermi="['data:channel-opcda:delete']" |
325d3d
|
73 |
> |
L |
74 |
删除 |
|
75 |
</el-button> |
|
76 |
</template> |
|
77 |
</el-table-column> |
|
78 |
</el-table> |
|
79 |
<!-- 分页 --> |
|
80 |
<Pagination |
|
81 |
:total="total" |
|
82 |
v-model:page="queryParams.pageNo" |
|
83 |
v-model:limit="queryParams.pageSize" |
|
84 |
@pagination="getList" |
|
85 |
/> |
|
86 |
</ContentWrap> |
|
87 |
|
|
88 |
<!-- 表单弹窗:添加/修改 --> |
|
89 |
<OpcDaDeviceForm ref="formRef" @success="getList" /> |
|
90 |
|
24d32b
|
91 |
<!-- TAG弹窗:添加/修改 --> |
潘 |
92 |
<TagList ref="tagRef" @success="getList" /> |
|
93 |
|
325d3d
|
94 |
</template> |
L |
95 |
<script lang="ts" setup> |
|
96 |
import * as OpcDaApi from '@/api/data/channel/opcda' |
|
97 |
import OpcDaDeviceForm from './OpcDaDeviceForm.vue' |
24d32b
|
98 |
import TagList from './tag/index.vue' |
325d3d
|
99 |
|
L |
100 |
defineOptions({name: 'DataOpcDa'}) |
|
101 |
|
|
102 |
const message = useMessage() // 消息弹窗 |
|
103 |
const {t} = useI18n() // 国际化 |
|
104 |
|
|
105 |
const loading = ref(true) // 列表的加载中 |
|
106 |
const total = ref(0) // 列表的总页数 |
|
107 |
const list = ref([]) // 列表的数据 |
|
108 |
const queryParams = reactive({ |
|
109 |
pageNo: 1, |
|
110 |
pageSize: 10, |
|
111 |
serverName: undefined |
|
112 |
}) |
|
113 |
const queryFormRef = ref() // 搜索的表单 |
|
114 |
const exportLoading = ref(false) // 导出的加载中 |
|
115 |
|
|
116 |
/** 查询列表 */ |
|
117 |
const getList = async () => { |
|
118 |
loading.value = true |
|
119 |
try { |
|
120 |
const page = await OpcDaApi.getOpcDaDevicePage(queryParams) |
|
121 |
list.value = page.list |
|
122 |
total.value = page.total |
|
123 |
} finally { |
|
124 |
loading.value = false |
|
125 |
} |
|
126 |
} |
|
127 |
|
|
128 |
/** 搜索按钮操作 */ |
|
129 |
const handleQuery = () => { |
|
130 |
queryParams.pageNo = 1 |
|
131 |
getList() |
|
132 |
} |
|
133 |
|
|
134 |
/** 重置按钮操作 */ |
|
135 |
const resetQuery = () => { |
|
136 |
queryFormRef.value.resetFields() |
|
137 |
handleQuery() |
|
138 |
} |
|
139 |
|
|
140 |
/** 添加/修改操作 */ |
|
141 |
const formRef = ref() |
|
142 |
const openForm = (type: string, id?: number) => { |
|
143 |
formRef.value.open(type, id) |
|
144 |
} |
|
145 |
|
24d32b
|
146 |
/** TAG操作 */ |
潘 |
147 |
const tagRef = ref() |
6c2636
|
148 |
const openTagList = (id?: string,serverName?:string) => { |
J |
149 |
tagRef.value.open(id,serverName) |
24d32b
|
150 |
} |
潘 |
151 |
|
325d3d
|
152 |
/** 删除按钮操作 */ |
L |
153 |
const handleDelete = async (id: number) => { |
|
154 |
try { |
|
155 |
// 删除的二次确认 |
|
156 |
await message.delConfirm() |
|
157 |
// 发起删除 |
|
158 |
await OpcDaApi.deleteOpcDaDevice(id) |
|
159 |
message.success(t('common.delSuccess')) |
|
160 |
// 刷新列表 |
|
161 |
await getList() |
|
162 |
} catch { |
|
163 |
} |
|
164 |
} |
|
165 |
|
|
166 |
/** 初始化 **/ |
|
167 |
onMounted(async () => { |
|
168 |
await getList() |
|
169 |
}) |
|
170 |
</script> |