设备登记-接入添加loading

This commit is contained in:
zhujiyan
2024-09-24 14:20:12 +08:00
parent c2c0306a95
commit f4c268101d

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="default-main"> <div class="default-main" v-loading="loading">
<TableHeader> <TableHeader>
<template v-slot:select> <template v-slot:select>
<el-form-item label="设备类型"> <el-form-item label="设备类型">
@@ -170,7 +170,7 @@ const rules = reactive({
}) })
const dialogFormVisible = ref(false) const dialogFormVisible = ref(false)
const dialogTitle = ref('新增设备') const dialogTitle = ref('新增设备')
const loading = ref<boolean>(false)
const devModelOptions: any = ref([]) const devModelOptions: any = ref([])
queryByCode('Device_Type').then(res => { queryByCode('Device_Type').then(res => {
queryCsDictTree(res.data.id).then(res => { queryCsDictTree(res.data.id).then(res => {
@@ -410,6 +410,7 @@ const tableStore = new TableStore({
click: row => { click: row => {
// 便携式设备接入 // 便携式设备接入
// portableDeviceAccess // portableDeviceAccess
loading.value = true
ElMessageBox.confirm('确定接入该设备吗?', '提示', { ElMessageBox.confirm('确定接入该设备吗?', '提示', {
confirmButtonText: '确认', confirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
@@ -418,12 +419,19 @@ const tableStore = new TableStore({
.then(() => { .then(() => {
portableDeviceRegister({ portableDeviceRegister({
nDid: row.ndid nDid: row.ndid
}).then(res => { })
.then(res => {
loading.value = false
ElMessage.success(res.message) ElMessage.success(res.message)
tableStore.index() tableStore.index()
}) })
.catch(e => {
loading.value = false
})
})
.catch(e => {
loading.value = false
}) })
.catch(e => {})
} }
}, },
{ {