修复设备分组bug,设备维修bug
This commit is contained in:
@ -10,7 +10,8 @@
|
||||
</div>
|
||||
|
||||
<div class="treeContent">
|
||||
<el-tree :default-expand-all="true" :data="treeData" :props="defaultProps" accordion @node-click="handleNodeClick" :highlight-current="true">
|
||||
<el-tree :default-expand-all="true" :data="treeData" :props="defaultProps" accordion
|
||||
@node-click="handleNodeClick" :highlight-current="true">
|
||||
<template #default="{ node, data }">
|
||||
<div class="custom-tree-node">
|
||||
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
||||
@ -60,7 +61,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="btnSearch" @click="getDeviceList()">查询</div>
|
||||
<div class="btnSearch" @click="getDeviceList">查询</div>
|
||||
<div class="btnReset" @click="ResetQuery()">重置</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -76,14 +77,8 @@
|
||||
<el-button type="danger" plain @click="groupDelDevice()">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table
|
||||
ref="grid"
|
||||
height="calc(100vh - 320px)"
|
||||
v-loading="Status.loading"
|
||||
border
|
||||
:data="deviceList"
|
||||
@selection-change="RowSelectionChange"
|
||||
>
|
||||
<el-table ref="grid" height="calc(100vh - 320px)" v-loading="Status.loading" border :data="deviceList"
|
||||
@selection-change="RowSelectionChange">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
|
||||
@ -91,11 +86,9 @@
|
||||
<template #default="scope">
|
||||
<el-popover placement="right" trigger="click">
|
||||
<template #reference>
|
||||
<img
|
||||
:src="scope.row.devicePic"
|
||||
<img :src="scope.row.devicePic"
|
||||
style="width: 40px; height: 40px; cursor: pointer; object-fit: contain"
|
||||
class="hover:opacity-80 transition-opacity"
|
||||
/>
|
||||
class="hover:opacity-80 transition-opacity" />
|
||||
</template>
|
||||
<img :src="scope.row.devicePic" style="max-width: 600px; max-height: 600px; object-fit: contain" />
|
||||
</el-popover>
|
||||
@ -120,13 +113,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="pagin.total > 0"
|
||||
v-model:page="GjSearchForm.pageNum"
|
||||
v-model:limit="GjSearchForm.pageSize"
|
||||
:total="pagin.total"
|
||||
@pagination="getDeviceList"
|
||||
/>
|
||||
<pagination v-show="pagin.total > 0" v-model:page="GjSearchForm.pageNum" v-model:limit="GjSearchForm.pageSize"
|
||||
:total="pagin.total" @pagination="getDeviceList" />
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
@ -134,7 +122,8 @@
|
||||
<div class="clear"></div>
|
||||
|
||||
<!-- 提示框 -->
|
||||
<el-dialog :width="300" :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" width="500" center>
|
||||
<el-dialog :width="300" :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" width="500"
|
||||
center>
|
||||
<span>
|
||||
{{ Status.confirm.text }}
|
||||
</span>
|
||||
@ -148,7 +137,7 @@
|
||||
|
||||
<!-- 选择分组的弹窗 -->
|
||||
<el-dialog v-model="Status.dialogGroupVisible" title="选择分组" width="500" :draggable="true">
|
||||
<el-tree :data="treeData" :props="defaultProps" accordion>
|
||||
<el-tree :data="treeData" :props="defaultProps" accordion default-expand-all>
|
||||
<template #default="{ node, data }">
|
||||
<div class="custom-tree-node" @click.stop="CheckGroup(data)">
|
||||
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
||||
@ -156,8 +145,12 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-tree>
|
||||
<el-button type="primary" @click="OkCheckGroup()"> 确定 </el-button>
|
||||
<el-button type="primary" @click="CancelCheckGroup()"> 取消 </el-button>
|
||||
<div style="text-align: right;">
|
||||
|
||||
<el-button @click="CancelCheckGroup()"> 取消 </el-button>
|
||||
<el-button type="primary" @click="OkCheckGroup()"> 确定 </el-button>
|
||||
</div>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
<!-- 选择设备的穿梭框 -->
|
||||
@ -171,13 +164,8 @@
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加节点的弹出框 -->
|
||||
<el-dialog
|
||||
:width="350"
|
||||
:draggable="true"
|
||||
v-model="Status.dialogEditNode"
|
||||
:title="cEdit.id ? '修改分组' : cEdit.pNode ? '新增子节点' : '新增根节点'"
|
||||
center
|
||||
>
|
||||
<el-dialog :width="350" :draggable="true" v-model="Status.dialogEditNode"
|
||||
:title="cEdit.id ? '修改分组' : cEdit.pNode ? '新增子节点' : '新增根节点'" center>
|
||||
<div>
|
||||
<el-form class="demo-form-inline" :inline="true" :model="cEdit" label-width="auto" style="width: 100%">
|
||||
<el-form-item label="分组名称"> <el-input v-model="cEdit.groupName" placeholder="请输入" /> </el-form-item>
|
||||
@ -324,38 +312,40 @@ var hideloading = closeLoading;
|
||||
function ResetQuery() {
|
||||
GjSearchForm.deviceType = '';
|
||||
GjSearchForm.netMode = '';
|
||||
getDeviceList()
|
||||
|
||||
}
|
||||
//查询某个节点的设备
|
||||
var getDeviceList = () => {
|
||||
if (!checkNode.val) {
|
||||
pagin.total = 0;
|
||||
deviceList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
let para = {
|
||||
nodeCode: checkNode.val,
|
||||
pageIndex: GjSearchForm.pageNum,
|
||||
pageSize: GjSearchForm.pageSize,
|
||||
communicationMode: GjSearchForm.netMode,
|
||||
deviceType: GjSearchForm.deviceType,
|
||||
deviceName: GjSearchForm.deviceName
|
||||
};
|
||||
showloading();
|
||||
const getDeviceList = () => {
|
||||
// 无论是否有 checkNode.val,都返回 Promise
|
||||
return new Promise((resolve, reject) => {
|
||||
api
|
||||
.getNodeDevice(para)
|
||||
.then((res) => {
|
||||
deviceList.value = res.rows;
|
||||
pagin.total = res.total;
|
||||
})
|
||||
.catch((ex) => {
|
||||
console.log('出现了异常', ex);
|
||||
})
|
||||
.finally(() => {
|
||||
hideloading();
|
||||
resolve();
|
||||
});
|
||||
if (!checkNode.val && checkNode.val !== '') { // 排除全部设备的空字符串
|
||||
pagin.total = 0;
|
||||
deviceList.value = [];
|
||||
hideloading(); // 确保 loading 关闭
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
showloading();
|
||||
let para = {
|
||||
nodeCode: checkNode.val || '', // 空ID对应全部设备
|
||||
pageIndex: GjSearchForm.pageNum,
|
||||
pageSize: GjSearchForm.pageSize,
|
||||
communicationMode: GjSearchForm.netMode,
|
||||
deviceType: GjSearchForm.deviceType,
|
||||
deviceName: GjSearchForm.deviceName
|
||||
};
|
||||
api.getNodeDevice(para).then((res: any) => {
|
||||
console.log(res, 'ressss');
|
||||
deviceList.value = res.rows;
|
||||
pagin.total = res.total;
|
||||
resolve();
|
||||
}).catch((ex) => {
|
||||
console.log('出现了异常', ex);
|
||||
reject(ex); // 抛出错误
|
||||
}).finally(() => {
|
||||
hideloading();
|
||||
});
|
||||
});
|
||||
};
|
||||
//树控件节点点击事件
|
||||
@ -368,16 +358,26 @@ var handleNodeClick = (node) => {
|
||||
getDeviceList();
|
||||
};
|
||||
|
||||
const ALL_DEVICE_NODE = {
|
||||
id: '',
|
||||
groupName: '全部设备',
|
||||
parentId: null,
|
||||
children: [],
|
||||
isAll: true
|
||||
};
|
||||
//树控件筛选后显示的数据源
|
||||
var treeData = computed(() => {
|
||||
let arr = api.treeNodeSearch(treeDataOrin.value, searchTxt.value, 'groupName', 'children');
|
||||
if (arr.length && !checkNode.val) {
|
||||
checkNode.val = arr[0].id;
|
||||
getDeviceList().finally(() => {
|
||||
checkNode.val = '';
|
||||
let newArr = [JSON.parse(JSON.stringify(ALL_DEVICE_NODE))];
|
||||
if (arr.length) {
|
||||
newArr = newArr.concat(arr);
|
||||
}
|
||||
if (newArr.length && !checkNode.val) {
|
||||
checkNode.val = newArr[0].id; // 空ID
|
||||
Promise.resolve(getDeviceList()).finally(() => {
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
return newArr;
|
||||
});
|
||||
|
||||
//显示/隐藏高级筛选
|
||||
@ -565,6 +565,7 @@ var getSelectionRows = () => {
|
||||
|
||||
var RefreshTree = function () {
|
||||
api.getTreeData(searchTxt.value).then((res) => {
|
||||
console.log(res, 'reddddd');
|
||||
treeDataOrin.value = res;
|
||||
});
|
||||
};
|
||||
@ -636,9 +637,8 @@ var showDevice = () => {
|
||||
let arr = res1.rows.map((item) => ({
|
||||
key: item.deviceId,
|
||||
label: item.deviceName //,
|
||||
// disabled: item.groupId && item.groupId == checkNode.val ? false : item.groupId ? true : false
|
||||
}));
|
||||
|
||||
;
|
||||
transfer.data = arr;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user