节点信息管理
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 获取节点列表
|
// 获取节点列表
|
||||||
export function list (params) {
|
export function nodeList (params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/node/list',
|
url: '/system/node/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@ -27,7 +27,7 @@ export function addNode (data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除节点
|
// 删除节点
|
||||||
export function del (ids) {
|
export function delNode (ids) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/node/' + ids,
|
url: '/system/node/' + ids,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
|
@ -45,14 +45,17 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="status" align="center" label="状态">
|
<el-table-column prop="status" align="center" label="状态">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="text" icon="el-icon-plus" @click="handleAddnode(scope.row)"
|
<el-button size="mini" type="text" icon="el-icon-plus" @click="handleAddnode(scope.row)"
|
||||||
v-hasPermi="['system:product:addNode']">新增
|
v-hasPermi="['system:product:addNode']">新增节点
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:product:edit']">
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:product:edit']">
|
||||||
修改
|
修改
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-view" @click="handleview(scope.row)" v-hasPermi="['system:node:nodeList']">
|
||||||
|
查看节点
|
||||||
|
</el-button>
|
||||||
<el-button class="text-danger" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
<el-button class="text-danger" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['system:product:remove']">删除</el-button>
|
v-hasPermi="['system:product:remove']">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -87,10 +90,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!-- 添加节点参数配置对话框 -->
|
<!-- 添加节点参数配置对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open1" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="nodeOpen" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
<el-form-item label="产品ID" :prop="productId">
|
<el-form-item label="产品ID" prop="productId">
|
||||||
<el-input v-model="form.productId" placeholder="请输入产品ID" />
|
<el-input v-model="form.productId" disabled placeholder="请输入产品ID" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="节点ID" prop="nodeId">
|
<el-form-item label="节点ID" prop="nodeId">
|
||||||
<el-input v-model="form.nodeId" placeholder="请输入节点ID" />
|
<el-input v-model="form.nodeId" placeholder="请输入节点ID" />
|
||||||
@ -110,22 +113,45 @@
|
|||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<!-- 节点列表弹框 -->
|
||||||
|
<el-dialog title="节点列表" :visible.sync="nodeDialog">
|
||||||
|
<el-button type="danger" icon="el-icon-delete" size="mini" :disabled="nodeMultiple" @click="batchHandleDeletenode"
|
||||||
|
v-hasPermi="['monitor:node:remove']">批量删除</el-button>
|
||||||
|
<el-table :data="nodeData" @selection-change="nodeHandleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="nodeId" label="节点ID"></el-table-column>
|
||||||
|
<el-table-column prop="nodeName" label="节点名称"></el-table-column>
|
||||||
|
<el-table-column prop="status" label="状态"></el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdatenode(scope.row)" v-hasPermi="['system:node:edit']">
|
||||||
|
修改
|
||||||
|
</el-button>
|
||||||
|
<el-button class="text-danger" size="mini" type="text" icon="el-icon-delete" @click="handleDeletenode(scope.row)"
|
||||||
|
v-hasPermi="['system:node:remove']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-dialog>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { list, get, add, update, del } from "@/api/hardware/product";
|
import { list, get, add, update, del } from "@/api/hardware/product";
|
||||||
import { addNode } from "@/api/hardware/node";
|
import { nodeList, addNode, Info, delNode, select } from "@/api/hardware/node";
|
||||||
export default {
|
export default {
|
||||||
name: "ProductList",
|
name: "ProductList",
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
nodeData: null,
|
||||||
|
nodeDialog: false,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
// 非单个禁用
|
nodeIds: [],
|
||||||
single: true,
|
|
||||||
// 非多个禁用
|
// 非多个禁用
|
||||||
multiple: true,
|
multiple: true,
|
||||||
|
nodeMultiple: true,
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
// 总条数
|
// 总条数
|
||||||
@ -134,7 +160,7 @@ export default {
|
|||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
open1: false,
|
nodeOpen: false,
|
||||||
labelPosition: "right",
|
labelPosition: "right",
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
@ -145,18 +171,17 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: { productId: "" },
|
form: {},
|
||||||
// 总条数
|
// 总条数
|
||||||
total: 0,
|
total: 0,
|
||||||
value: "",
|
value: "",
|
||||||
// 表格数据
|
// 表格数据
|
||||||
tableData: null,
|
tableData: null,
|
||||||
productId: undefined,
|
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
// productId:productId
|
productId: ''
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
productId: [
|
productId: [
|
||||||
@ -200,11 +225,25 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 获取节点数据列表
|
||||||
|
getListnode ({ productId }) {
|
||||||
|
nodeList({ productId }).then((response) => {
|
||||||
|
this.nodeData = response.rows;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 查看按钮操作 */
|
||||||
|
handleview (row) {
|
||||||
|
this.nodeDialog = true;
|
||||||
|
this.getListnode(row)
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel () {
|
cancel () {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.open1 = false;
|
this.nodeOpen = false;
|
||||||
// this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 表单重置
|
// 表单重置
|
||||||
@ -221,9 +260,13 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange (selection) {
|
handleSelectionChange (selection) {
|
||||||
this.ids = selection.map((item) => item.id);
|
this.ids = selection.map((item) => item.id);
|
||||||
this.single = selection.length != 1;
|
|
||||||
this.multiple = !selection.length;
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
nodeHandleSelectionChange (selection) {
|
||||||
|
this.nodeIds = selection.map((item) => item.id);
|
||||||
|
this.nodeMultiple = !selection.length;
|
||||||
|
},
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd () {
|
handleAdd () {
|
||||||
@ -233,7 +276,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleAddnode (row) {
|
handleAddnode (row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.open1 = true;
|
this.nodeOpen = true;
|
||||||
this.title = "添加产品节点";
|
this.title = "添加产品节点";
|
||||||
this.form.productId = row.productId;
|
this.form.productId = row.productId;
|
||||||
},
|
},
|
||||||
@ -245,11 +288,18 @@ export default {
|
|||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改产品";
|
this.title = "修改产品";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 修改节点操作 */
|
||||||
|
handleUpdatenode (row) {
|
||||||
|
this.reset();
|
||||||
|
this.nodeOpen = true;
|
||||||
|
this.form = row;
|
||||||
|
this.title = "修改产品节点";
|
||||||
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function () {
|
submitForm: function () {
|
||||||
this.$refs["form"].validate((valid) => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// debugger
|
|
||||||
if (this.form.id != undefined) {
|
if (this.form.id != undefined) {
|
||||||
update(this.form).then((res) => {
|
update(this.form).then((res) => {
|
||||||
if (200 == res.code) {
|
if (200 == res.code) {
|
||||||
@ -279,14 +329,13 @@ export default {
|
|||||||
addNode(this.form).then((res) => {
|
addNode(this.form).then((res) => {
|
||||||
if (200 == res.code) {
|
if (200 == res.code) {
|
||||||
this.msgSuccess(this.title + "成功");
|
this.msgSuccess(this.title + "成功");
|
||||||
this.open1 = false;
|
this.nodeOpen = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
} else {
|
} else {
|
||||||
this.msgSuccess(res.msg);
|
this.msgSuccess(res.msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete (row) {
|
handleDelete (row) {
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids;
|
||||||
@ -298,7 +347,6 @@ export default {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
return del(ids);
|
return del(ids);
|
||||||
})
|
})
|
||||||
.catch(() => { })
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (200 == res.code) {
|
if (200 == res.code) {
|
||||||
this.getList();
|
this.getList();
|
||||||
@ -310,6 +358,49 @@ export default {
|
|||||||
.catch((res) => { });
|
.catch((res) => { });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 删除节点按钮操作 */
|
||||||
|
handleDeletenode (row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$confirm("是否确认删除?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
return delNode(ids);
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (200 == res.code) {
|
||||||
|
this.getListnode(row);
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
} else {
|
||||||
|
this.msgSuccess(res.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((res) => { });
|
||||||
|
},
|
||||||
|
|
||||||
|
// 批量删除节点
|
||||||
|
batchHandleDeletenode () {
|
||||||
|
this.$confirm("是否确认删除?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
return delNode(this.nodeIds);
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (200 == res.code) {
|
||||||
|
this.getListnode(...this.nodeData);
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
} else {
|
||||||
|
this.msgSuccess(res.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((res) => { });
|
||||||
|
},
|
||||||
|
|
||||||
// 页码尺寸改变
|
// 页码尺寸改变
|
||||||
handleSizeChange (val) {
|
handleSizeChange (val) {
|
||||||
this.queryForm.pagesize = val;
|
this.queryForm.pagesize = val;
|
||||||
|
Reference in New Issue
Block a user