Merge branch 'master' of gitee.com:willamet/rn-bms-vue

This commit is contained in:
hh
2020-11-11 13:55:29 +08:00

View File

@ -3,57 +3,23 @@
<el-row> <el-row>
<el-col :span="2">todo 地区</el-col> <el-col :span="2">todo 地区</el-col>
<el-col :span="22"> <el-col :span="22">
<el-form <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="名称" prop="productName"> <el-form-item label="名称" prop="productName">
<el-input <el-input v-model="queryParams.productName" placeholder="请输入名称" clearable size="small" style="width: 240px"
v-model="queryParams.productName" @keyup.enter.native="handleQuery" />
placeholder="请输入名称"
clearable
size="small"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
type="cyan" <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button size="mini" type="primary" icon="el-icon-plus" @click="handleAdd" v-hasPermi="['system:product:add']">增加</el-button>
size="mini"
type="primary"
icon="el-icon-plus"
@click="handleAdd"
v-hasPermi="['system:product:add']"
>增加</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
type="danger" v-hasPermi="['monitor:product:remove']">批量删除</el-button>
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['monitor:product:remove']"
>批量删除</el-button
>
</el-col> </el-col>
<!-- <el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleClean" v-hasPermi="['monitor:job:remove']">清空 <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleClean" v-hasPermi="['monitor:job:remove']">清空
@ -63,17 +29,10 @@
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['monitor:job:export']">导出 <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['monitor:job:export']">导出
</el-button> </el-button>
</el-col> --> </el-col> -->
<right-toolbar <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table <el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange">
:data="tableData"
style="width: 100%"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center"> <el-table-column type="selection" width="55" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="productId" align="center" label="产品ID"> <el-table-column prop="productId" align="center" label="产品ID">
@ -86,47 +45,21 @@
</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 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button size="mini" type="text" icon="el-icon-plus" @click="handleAddnode(scope.row)"
size="mini" v-hasPermi="['system:product:addNode']">新增
type="text"
icon="el-icon-edit"
@click="handleAddnode(scope.row)"
v-hasPermi="['system:product:addNode']"
>新增
</el-button> </el-button>
<el-button <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:product:edit']">
size="mini" 修改
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:product:edit']"
>修改
</el-button> </el-button>
<el-button <el-button class="text-danger" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
class="text-danger" v-hasPermi="['system:product:remove']">删除</el-button>
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:product:remove']"
>删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
v-show="total > 0" @pagination="getList" />
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col> </el-col>
</el-row> </el-row>
<!-- 添加或修改参数配置对话框 --> <!-- 添加或修改参数配置对话框 -->
@ -154,22 +87,17 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 添加节点参数配置对话框 --> <!-- 添加节点参数配置对话框 -->
<el-dialog <el-dialog :title="title" :visible.sync="open1" width="500px" append-to-body>
:title="title"
:visible.sync="open1"
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-input v-model="form.productId" placeholder="请输入产品ID" />
</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" />
</el-form-item> </el-form-item>
<el-form-item label="节点名称" prop="nodeName"> <el-form-item label="节点名称" prop="nodeName">
<el-input v-model="form.nodeName" placeholder="请输入节点名称" /> <el-input v-model="form.nodeName" placeholder="请输入节点名称" />
</el-form-item> </el-form-item>
<el-form-item label="产品ID" prop="productId">
<el-input v-model="form.productId" placeholder="请输入产品ID" />
</el-form-item>
<el-form-item label="状态"> <el-form-item label="状态">
<el-input v-model="form.status" /> <el-input v-model="form.status" />
</el-form-item> </el-form-item>
@ -190,7 +118,7 @@ import { list, get, add, update, del } from "@/api/hardware/product";
import { addNode } from "@/api/hardware/node"; import { addNode } from "@/api/hardware/node";
export default { export default {
name: "ProductList", name: "ProductList",
data() { data () {
return { return {
// 选中数组 // 选中数组
ids: [], ids: [],
@ -223,10 +151,12 @@ export default {
value: "", value: "",
// 表格数据 // 表格数据
tableData: null, tableData: null,
productId: undefined,
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
// productId:productId
}, },
rules: { rules: {
productId: [ productId: [
@ -247,23 +177,23 @@ export default {
}, },
}; };
}, },
created() { created () {
this.getList(); this.getList();
}, },
methods: { methods: {
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery () {
this.dateRange = []; this.dateRange = [];
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
// 获取产品数据列表 // 获取产品数据列表
getList() { getList () {
list(this.queryParams).then((response) => { list(this.queryParams).then((response) => {
this.tableData = response.rows; this.tableData = response.rows;
this.total = response.total; this.total = response.total;
@ -271,14 +201,14 @@ export default {
}, },
// 取消按钮 // 取消按钮
cancel() { cancel () {
this.open = false; this.open = false;
this.open1 = false; this.open1 = false;
// this.reset(); // this.reset();
}, },
// 表单重置 // 表单重置
reset() { reset () {
this.form = { this.form = {
productId: "", productId: "",
productType: "", productType: "",
@ -289,26 +219,27 @@ 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.single = selection.length != 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd () {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加产品"; this.title = "添加产品";
}, },
handleAddnode() { handleAddnode (row) {
this.reset(); this.reset();
this.open1 = true; this.open1 = true;
this.title = "添加产品节点"; this.title = "添加产品节点";
this.form.productId = row.productId;
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate (row) {
this.reset(); this.reset();
this.form = row; this.form = row;
this.open = true; this.open = true;
@ -357,7 +288,7 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete (row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$confirm("是否确认删除?", "警告", { this.$confirm("是否确认删除?", "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
@ -367,7 +298,7 @@ export default {
.then(() => { .then(() => {
return del(ids); return del(ids);
}) })
.catch(() => {}) .catch(() => { })
.then((res) => { .then((res) => {
if (200 == res.code) { if (200 == res.code) {
this.getList(); this.getList();
@ -376,35 +307,35 @@ export default {
this.msgSuccess(res.msg); this.msgSuccess(res.msg);
} }
}) })
.catch((res) => {}); .catch((res) => { });
}, },
// 页码尺寸改变 // 页码尺寸改变
handleSizeChange(val) { handleSizeChange (val) {
this.queryForm.pagesize = val; this.queryForm.pagesize = val;
this.getList(); this.getList();
}, },
// 页码改变 // 页码改变
handleCurrentChange(val) { handleCurrentChange (val) {
this.queryForm.page = val; this.queryForm.page = val;
this.getList(); this.getList();
}, },
// handleSelectionChange(val) { // handleSelectionChange(val) {
// this.multipleSelection = val; // this.multipleSelection = val;
// }, // },
handleSizeChange(val) { handleSizeChange (val) {
console.log(`每页 ${val}`); console.log(`每页 ${val}`);
}, },
handleCurrentChange(val) { handleCurrentChange (val) {
console.log(`当前页: ${val}`); console.log(`当前页: ${val}`);
}, },
// 对话框的关闭 // 对话框的关闭
handleClose(done) { handleClose (done) {
this.$confirm("确认关闭?") this.$confirm("确认关闭?")
.then((_) => { .then((_) => {
done(); done();
}) })
.catch((_) => {}); .catch((_) => { });
}, },
}, },
}; };