节点信息管理
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 获取节点列表
|
||||
export function list (params) {
|
||||
export function nodeList (params) {
|
||||
return request({
|
||||
url: '/system/node/list',
|
||||
method: 'get',
|
||||
@ -27,7 +27,7 @@ export function addNode (data) {
|
||||
}
|
||||
|
||||
// 删除节点
|
||||
export function del (ids) {
|
||||
export function delNode (ids) {
|
||||
return request({
|
||||
url: '/system/node/' + ids,
|
||||
method: 'delete'
|
||||
|
@ -45,14 +45,17 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" align="center" label="状态">
|
||||
</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">
|
||||
<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 size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:product:edit']">
|
||||
修改
|
||||
</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)"
|
||||
v-hasPermi="['system:product:remove']">删除</el-button>
|
||||
</template>
|
||||
@ -87,10 +90,10 @@
|
||||
</div>
|
||||
</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-item label="产品ID" :prop="productId">
|
||||
<el-input v-model="form.productId" placeholder="请输入产品ID" />
|
||||
<el-form-item label="产品ID" prop="productId">
|
||||
<el-input v-model="form.productId" disabled placeholder="请输入产品ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="节点ID" prop="nodeId">
|
||||
<el-input v-model="form.nodeId" placeholder="请输入节点ID" />
|
||||
@ -110,22 +113,45 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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 {
|
||||
name: "ProductList",
|
||||
data () {
|
||||
return {
|
||||
nodeData: null,
|
||||
nodeDialog: false,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
nodeIds: [],
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
nodeMultiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
@ -134,7 +160,7 @@ export default {
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
open1: false,
|
||||
nodeOpen: false,
|
||||
labelPosition: "right",
|
||||
options: [
|
||||
{
|
||||
@ -145,18 +171,17 @@ export default {
|
||||
},
|
||||
],
|
||||
// 表单参数
|
||||
form: { productId: "" },
|
||||
form: {},
|
||||
// 总条数
|
||||
total: 0,
|
||||
value: "",
|
||||
// 表格数据
|
||||
tableData: null,
|
||||
productId: undefined,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
// productId:productId
|
||||
productId: ''
|
||||
},
|
||||
rules: {
|
||||
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 () {
|
||||
this.open = false;
|
||||
this.open1 = false;
|
||||
// this.reset();
|
||||
this.nodeOpen = false;
|
||||
this.reset();
|
||||
},
|
||||
|
||||
// 表单重置
|
||||
@ -221,9 +260,13 @@ export default {
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length != 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
// 多选框选中数据
|
||||
nodeHandleSelectionChange (selection) {
|
||||
this.nodeIds = selection.map((item) => item.id);
|
||||
this.nodeMultiple = !selection.length;
|
||||
},
|
||||
|
||||
/** 新增按钮操作 */
|
||||
handleAdd () {
|
||||
@ -233,7 +276,7 @@ export default {
|
||||
},
|
||||
handleAddnode (row) {
|
||||
this.reset();
|
||||
this.open1 = true;
|
||||
this.nodeOpen = true;
|
||||
this.title = "添加产品节点";
|
||||
this.form.productId = row.productId;
|
||||
},
|
||||
@ -245,11 +288,18 @@ export default {
|
||||
this.open = true;
|
||||
this.title = "修改产品";
|
||||
},
|
||||
|
||||
/** 修改节点操作 */
|
||||
handleUpdatenode (row) {
|
||||
this.reset();
|
||||
this.nodeOpen = true;
|
||||
this.form = row;
|
||||
this.title = "修改产品节点";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
// debugger
|
||||
if (this.form.id != undefined) {
|
||||
update(this.form).then((res) => {
|
||||
if (200 == res.code) {
|
||||
@ -279,14 +329,13 @@ export default {
|
||||
addNode(this.form).then((res) => {
|
||||
if (200 == res.code) {
|
||||
this.msgSuccess(this.title + "成功");
|
||||
this.open1 = false;
|
||||
this.nodeOpen = false;
|
||||
this.getList();
|
||||
} else {
|
||||
this.msgSuccess(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const ids = row.id || this.ids;
|
||||
@ -298,7 +347,6 @@ export default {
|
||||
.then(() => {
|
||||
return del(ids);
|
||||
})
|
||||
.catch(() => { })
|
||||
.then((res) => {
|
||||
if (200 == res.code) {
|
||||
this.getList();
|
||||
@ -310,6 +358,49 @@ export default {
|
||||
.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) {
|
||||
this.queryForm.pagesize = val;
|
||||
|
Reference in New Issue
Block a user