Changes
parent
d5fb2206da
commit
e5d6814765
|
@ -43,3 +43,5 @@ export function delRule(id) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -247,13 +247,10 @@ export default {
|
||||||
},
|
},
|
||||||
/** 规则维护按钮操作 */
|
/** 规则维护按钮操作 */
|
||||||
handleMaintain(row) {
|
handleMaintain(row) {
|
||||||
this.reset();
|
this.$router.push({
|
||||||
const id = row.id || this.ids
|
path:'version',
|
||||||
getRule(id).then(response => {
|
query:{id:row.id}
|
||||||
this.form = response.data;
|
})
|
||||||
this.open = true;
|
|
||||||
this.title = "规则维护";
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
|
|
|
@ -0,0 +1,340 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="规则名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入规则名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否激活" prop="isActivate">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.isActivate"
|
||||||
|
placeholder="请输入是否激活"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规则代码" prop="ruleCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.ruleCode"
|
||||||
|
placeholder="请输入规则代码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" 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
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['rule:rule:add']"
|
||||||
|
>新增
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['rule:rule:edit']"
|
||||||
|
>修改
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['rule:rule:remove']"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['rule:rule:export']"
|
||||||
|
>导出
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
|
||||||
|
<el-descriptions class="margin-top" title="规则版本" :column="3" border>
|
||||||
|
<template slot="extra">
|
||||||
|
<el-button type="primary" size="small">操作</el-button>
|
||||||
|
</template>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template slot="label">
|
||||||
|
<i class="el-icon-user"></i>
|
||||||
|
主键
|
||||||
|
</template>
|
||||||
|
{{ ruleAndVersion.id }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template slot="label">
|
||||||
|
<i class="el-icon-user"></i>
|
||||||
|
规则名称
|
||||||
|
</template>
|
||||||
|
{{ ruleAndVersion.name }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template slot="label">
|
||||||
|
<i class="el-icon-user"></i>
|
||||||
|
规则类型
|
||||||
|
</template>
|
||||||
|
{{ ruleAndVersion.ruleType }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template slot="label">
|
||||||
|
<i class="el-icon-user"></i>
|
||||||
|
是否激活
|
||||||
|
</template>
|
||||||
|
{{ ruleAndVersion.isActivate }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template slot="label">
|
||||||
|
<i class="el-icon-user"></i>
|
||||||
|
规则描述
|
||||||
|
</template>
|
||||||
|
{{ ruleAndVersion.ruleDesc }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template slot="label">
|
||||||
|
<i class="el-icon-user"></i>
|
||||||
|
规则代码
|
||||||
|
</template>
|
||||||
|
{{ ruleAndVersion.ruleCode }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改规则对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="规则名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入规则名称"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否激活" prop="isActivate">
|
||||||
|
<el-input v-model="form.isActivate" placeholder="请输入是否激活"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规则描述" prop="ruleDesc">
|
||||||
|
<el-input v-model="form.ruleDesc" type="textarea" placeholder="请输入内容"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规则代码" prop="ruleCode">
|
||||||
|
<el-input v-model="form.ruleCode" placeholder="请输入规则代码"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {listRule, getRule, delRule, addRule, updateRule} from "/src/api/rule/rule";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Rule",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 规则表格数据
|
||||||
|
ruleList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null,
|
||||||
|
ruleType: null,
|
||||||
|
isActivate: null,
|
||||||
|
ruleDesc: null,
|
||||||
|
ruleCode: null,
|
||||||
|
},
|
||||||
|
ruleAndVersion: {
|
||||||
|
id: "",
|
||||||
|
name: "",
|
||||||
|
ruleType: "",
|
||||||
|
isActivate: "",
|
||||||
|
ruleDesc: "",
|
||||||
|
ruleCode: ""
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
isActivate: [
|
||||||
|
{required: true, message: "是否激活;是否激活不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.ruleAndVersion.id = this.$route.query.id
|
||||||
|
this.getList();
|
||||||
|
this.findById();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
//根据ID回显
|
||||||
|
findById() {
|
||||||
|
getRule(this.ruleAndVersion.id).then(res => {
|
||||||
|
this.ruleAndVersion = res.data[0]
|
||||||
|
console.log(this.ruleAndVersion)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 查询规则列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listRule(this.queryParams).then(response => {
|
||||||
|
this.ruleList = response.data;
|
||||||
|
this.total = response.data;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
name: null,
|
||||||
|
ruleType: null,
|
||||||
|
isActivate: null,
|
||||||
|
ruleDesc: null,
|
||||||
|
ruleCode: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length !== 1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加规则";
|
||||||
|
},
|
||||||
|
/** 规则维护按钮操作 */
|
||||||
|
handleMaintain(row) {
|
||||||
|
this.$router.push({
|
||||||
|
path: 'version',
|
||||||
|
query: {id: row.id}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getRule(id).then(response => {
|
||||||
|
this.form = response.data[0];
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改规则";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateRule(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addRule(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除规则编号为"' + ids + '"的数据项?').then(function () {
|
||||||
|
return delRule(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('rule/rule/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `rule_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in New Issue