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