优化配置管理
This commit is contained in:
1
package-lock.json
generated
1
package-lock.json
generated
@@ -8,6 +8,7 @@
|
|||||||
"name": "peko-admin-web",
|
"name": "peko-admin-web",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@element-plus/icons-vue": "^2.1.0",
|
||||||
"admin-lte": "^2.3.2",
|
"admin-lte": "^2.3.2",
|
||||||
"axios": "^1.5.0",
|
"axios": "^1.5.0",
|
||||||
"bootstrap": "^3.3.5",
|
"bootstrap": "^3.3.5",
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
"lint": "vue-cli-service lint"
|
"lint": "vue-cli-service lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@element-plus/icons-vue": "^2.1.0",
|
||||||
"admin-lte": "^2.3.2",
|
"admin-lte": "^2.3.2",
|
||||||
"axios": "^1.5.0",
|
"axios": "^1.5.0",
|
||||||
"bootstrap": "^3.3.5",
|
"bootstrap": "^3.3.5",
|
||||||
|
28
src/api/sysconfAdminView/sysconfAdminView.js
Normal file
28
src/api/sysconfAdminView/sysconfAdminView.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import qs from 'qs';
|
||||||
|
|
||||||
|
// 获取列表
|
||||||
|
export const getList = query => {
|
||||||
|
return request({
|
||||||
|
url: '/admin/sysConf/getList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// 保存新增
|
||||||
|
export const sysConfSave = query => {
|
||||||
|
return request({
|
||||||
|
url: '/admin/sysConf/save',
|
||||||
|
method: 'post',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// 删除
|
||||||
|
export const sysConfDel = query => {
|
||||||
|
return request({
|
||||||
|
url: '/admin/sysConf/del',
|
||||||
|
headers:{"Content-Type": 'application/x-www-form-urlencoded'},
|
||||||
|
method: 'post',
|
||||||
|
data: query
|
||||||
|
});
|
||||||
|
};
|
@@ -1,350 +1,350 @@
|
|||||||
|
<!-- eslint-disable vue/no-unused-components -->
|
||||||
|
<!-- eslint-disable vue/valid-v-slot -->
|
||||||
<template>
|
<template>
|
||||||
<section class="content">
|
<div class="box">
|
||||||
<div class="box box-primary">
|
<!-- 按钮 -->
|
||||||
<div class="box-body">
|
<div class="but">
|
||||||
<!-- Content Header (Page header) -->
|
<el-button @click="addConfig()" type="primary" class="primary butIn"
|
||||||
<section class="content-header">
|
>添加</el-button
|
||||||
<h1 id="itemTitle"></h1>
|
>
|
||||||
</section>
|
<el-button @click="multipleDel()" type="danger" class="danger butIn"
|
||||||
<!-- .content -->
|
>批量删除</el-button
|
||||||
<section class="content">
|
>
|
||||||
<div id="table"></div>
|
<el-input
|
||||||
<div id="toolbar">
|
@input="handlerChange"
|
||||||
<button id="sysConf-add" class="btn btn-default">
|
v-model="valsen"
|
||||||
<i class="glyphicon glyphicon-plus"></i>增加
|
type="text"
|
||||||
</button>
|
placeholder="请输入关键字进行搜索配置"
|
||||||
|
class="inputs"
|
||||||
<button id="sysConf-multiDel" class="btn btn-default">
|
/>
|
||||||
<i class="glyphicon glyphicon-wrench"></i>批量删除
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</section><!-- .content -->
|
<!-- 表格 -->
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
ref="multipleTable"
|
||||||
|
:data="tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)"
|
||||||
|
tooltip-effect="dark"
|
||||||
|
style="margin-top: 25px; width: 100%"
|
||||||
|
border
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column align="center" type="selection"> </el-table-column>
|
||||||
|
<el-table-column align="center" prop="configId" label="ID"> </el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
show-overflow-tooltip="true"
|
||||||
|
align="center"
|
||||||
|
prop="configName"
|
||||||
|
label="名称"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
show-overflow-tooltip="true"
|
||||||
|
align="center"
|
||||||
|
prop="configValue"
|
||||||
|
label="值"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
show-overflow-tooltip="true"
|
||||||
|
align="center"
|
||||||
|
prop="nameSpace"
|
||||||
|
label="命名空间"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column align="center" label="状态">
|
||||||
|
<template v-slot="scope">{{
|
||||||
|
scope.row.configStatus == 1 ? "有效" : "无效"
|
||||||
|
}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="操作">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-button @click="modifyTible(scope.row)" type="primary" class="primary"
|
||||||
|
>编辑</el-button
|
||||||
|
>
|
||||||
|
<el-button @click="delTible(scope.row)" type="danger" class="danger"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<el-pagination
|
||||||
|
class="paginationClass"
|
||||||
|
v-model:current-page="currentPage"
|
||||||
|
v-model:page-size="pageSize"
|
||||||
|
:page-sizes="[10, 20, 30, 40, 50, 100, 200, 300, 400, 500]"
|
||||||
|
:small="small"
|
||||||
|
:disabled="disabled"
|
||||||
|
:background="background"
|
||||||
|
layout="sizes, prev, pager, next"
|
||||||
|
:total="tableData.length"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
style="margin-top: 25px"
|
||||||
|
/>
|
||||||
|
<!-- 弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="dialogTableVisible"
|
||||||
|
:title="dialogTableVisibleTitle"
|
||||||
|
width="500px"
|
||||||
|
>
|
||||||
|
<div class="userId">
|
||||||
|
<span>id</span>
|
||||||
|
<el-input
|
||||||
|
v-model="configId"
|
||||||
|
style="width: 75%"
|
||||||
|
class="input"
|
||||||
|
:disabled="disabledPub"
|
||||||
|
></el-input>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="userId">
|
||||||
|
<span>名称</span>
|
||||||
|
<el-input v-model="configName" style="width: 75%" class="input"></el-input>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
<div class="userId">
|
||||||
<div class="modal fade" id="sysConfModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
|
<span>状态</span>
|
||||||
<div class="modal-dialog" role="document">
|
<el-radio-group v-model="radio" class="ml-4">
|
||||||
<div class="modal-content">
|
<el-radio :label="1" size="large">有效</el-radio>
|
||||||
<div class="modal-header">
|
<el-radio :label="2" size="large">无效</el-radio>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
</el-radio-group>
|
||||||
aria-hidden="true">×</span></button>
|
|
||||||
<h4 class="modal-title" id="modalLabel">字典信息</h4>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="userId">
|
||||||
<form class="form-horizontal" id="sysConfForm">
|
<span>值</span>
|
||||||
<div class="form-group">
|
<el-input v-model="configValue" style="width: 75%" class="input"></el-input>
|
||||||
<label for="configId" class="col-sm-2 control-label">id</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<input type="text" class="form-control validate[required]" name="configId" id="configId">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="configName" class="col-sm-2 control-label">名称</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<input type="text" class="form-control validate[required]" name="configName"
|
|
||||||
id="configName">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-2 control-label">状态</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<label class="radio-inline"><input type="radio" name="configStatus" value="1"
|
|
||||||
checked>有效</label>
|
|
||||||
<label class="radio-inline"><input type="radio" name="configStatus" value="2">无效</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="configValue" class="col-sm-2 control-label">值</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<input type="text" class="form-control" name="configValue" id="configValue">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="nameSpace" class="col-sm-2 control-label">命名空间</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<input type="text" class="form-control validate[required]" name="nameSpace" id="nameSpace">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
|
||||||
<button type="button" class="btn btn-primary" id="save">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal fade" id="tipModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h4 class="modal-title">提示信息</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body" id="tipMsg"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="userId">
|
||||||
|
<span>命名空间</span>
|
||||||
|
<el-input v-model="nameSpace" style="width: 75%" class="input"></el-input>
|
||||||
</div>
|
</div>
|
||||||
|
<el-button
|
||||||
|
class="dialogTableVisibleBut"
|
||||||
|
type="info"
|
||||||
|
@click="dialogTableVisible = false"
|
||||||
|
>
|
||||||
|
关闭
|
||||||
|
</el-button>
|
||||||
|
<el-button class="dialogTableVisibleBut" type="primary" @click="saveBut()">
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
</el-dialog>
|
||||||
|
<!-- 二次确认解除风险弹窗 -->
|
||||||
|
<el-dialog v-model="centerDialogVisible" title="提示" width="30%" center>
|
||||||
|
<span> 你确定删除该记录吗? 删除后再也不能找回,请谨慎操作! ! ! </span>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="centerDialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="dialogClick()"> 确认 </el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TableHelper from '@/utils/bootstrap-table-helper';
|
import {
|
||||||
import { getSysConfList } from '@/api/system/sysconf';
|
getList,
|
||||||
|
sysConfSave,
|
||||||
|
sysConfDel,
|
||||||
|
} from "@/api/sysconfAdminView/sysconfAdminView";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
import qs from "qs";
|
||||||
export default {
|
export default {
|
||||||
name: "SysconfAdminView",
|
name: "SysconfAdminView",
|
||||||
setup() {
|
data() {
|
||||||
function showText(obj) {
|
|
||||||
let text = unescape($(obj).prop('title'));
|
|
||||||
$("#tipMsg").text(text);
|
|
||||||
$("#tipModal").modal('show');
|
|
||||||
}
|
|
||||||
window.showText = showText;
|
|
||||||
return {
|
return {
|
||||||
showText
|
valsen: "",
|
||||||
|
loading: false,
|
||||||
|
multipleSelection: null, //选中表格存储
|
||||||
|
tableData: [], //表格数据
|
||||||
|
tableData2: [], //表格数据
|
||||||
|
tableData3: [], //表格数据
|
||||||
|
//分页
|
||||||
|
totals: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
dialogTableVisibleTitle: "字典信息", //弹窗标题
|
||||||
|
dialogTableVisible: false, //弹窗控制
|
||||||
|
configId: "", //弹窗id
|
||||||
|
configName: "", //弹窗名称
|
||||||
|
radio: 1, //弹窗参单选
|
||||||
|
configValue: "", //弹窗值
|
||||||
|
nameSpace: "", //弹窗命名空间
|
||||||
|
disabledPub: true, //控制弹窗id是否禁用
|
||||||
|
type: null, // 控制是新增或者编辑 type 1:新增2:保存
|
||||||
|
delArr: [], //删除暂存
|
||||||
|
centerDialogVisible: false, //二次删除确认
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.$nextTick(function () {
|
this.getData();
|
||||||
this.initData();
|
|
||||||
this.getSysConf();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getSysConf() {
|
// 获取列表
|
||||||
getSysConfList().then(res => {
|
getData() {
|
||||||
$('#table').bootstrapTable('load', res.rows);
|
this.loading = true;
|
||||||
|
getList().then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
this.totals = res.total;
|
||||||
|
this.tableData = res.rows;
|
||||||
|
this.tableData3 = res.rows;
|
||||||
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
initData() {
|
// 添加按钮
|
||||||
$(function () {
|
addConfig() {
|
||||||
$('#table').bootstrapTable('destroy');
|
this.type = 1;
|
||||||
$('#table').bootstrapTable({
|
this.disabledPub = false;
|
||||||
columns: [
|
this.configId = "";
|
||||||
{field: 'tmp', title: 'ID', align: 'center', width: '5%', checkbox: true},
|
this.configName = "";
|
||||||
{
|
this.radio = 1;
|
||||||
field: 'configId',
|
this.configValue = "";
|
||||||
title: 'id',
|
this.nameSpace = "";
|
||||||
align: 'center',
|
this.dialogTableVisible = true;
|
||||||
width: '5%',
|
|
||||||
},
|
},
|
||||||
{
|
// 表格编辑按钮
|
||||||
field: 'configName',
|
modifyTible(row) {
|
||||||
title: '名称',
|
this.type = 2;
|
||||||
align: 'center',
|
this.disabledPub = true;
|
||||||
width: '5%',
|
this.configId = row.configId;
|
||||||
formatter: function (val, row, index) {
|
this.configName = row.configName;
|
||||||
return '<div style="text-align: center; width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" title="' + escape(val) + '" onclick="showText(this);">' + val + '</div>';
|
this.radio = row.configStatus;
|
||||||
}
|
this.configValue = row.configValue;
|
||||||
|
this.nameSpace = row.nameSpace;
|
||||||
|
this.dialogTableVisible = true;
|
||||||
},
|
},
|
||||||
{
|
// 保存按钮
|
||||||
field: 'configValue',
|
saveBut() {
|
||||||
title: '值',
|
if (this.type == 1) {
|
||||||
align: 'center',
|
if (this.configId == "") {
|
||||||
width: '5%',
|
ElMessage({
|
||||||
formatter: function (val, row, index) {
|
showClose: true,
|
||||||
return '<div style="text-align: center; width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" title="' + escape(val) + '" onclick="showText(this);">' + val + '</div>';
|
message: "请输入id",
|
||||||
}
|
type: "error",
|
||||||
},
|
});
|
||||||
{
|
return;
|
||||||
field: 'configStatus',
|
} else if (this.configName == "") {
|
||||||
title: '状态',
|
ElMessage({
|
||||||
align: 'center',
|
showClose: true,
|
||||||
width: '5%',
|
message: "请输入名称",
|
||||||
formatter: function (val, row, index) {
|
type: "error",
|
||||||
if (val == 1) {
|
});
|
||||||
return '有效';
|
return;
|
||||||
}
|
} else if (this.configValue == "") {
|
||||||
else if (val == 2) {
|
ElMessage({
|
||||||
return '无效';
|
showClose: true,
|
||||||
}
|
message: "请输入值",
|
||||||
}
|
type: "error",
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'nameSpace',
|
|
||||||
title: '命名空间',
|
|
||||||
align: 'center',
|
|
||||||
width: '5%',
|
|
||||||
formatter: function (val, row, index) {
|
|
||||||
return '<div style="text-align: center; width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" title="' + escape(val) + '" onclick="showText(this);">' + val + '</div>';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'configId',
|
|
||||||
title: '操作',
|
|
||||||
align: 'center',
|
|
||||||
width: '5%',
|
|
||||||
formatter: function (val, row, index) {
|
|
||||||
return '<button class="btn btn-sm btn-success opt-edit" data-id=' + val + '>' +
|
|
||||||
'<i class="glyphicon glyphicon-edit"></i>编辑</button>' +
|
|
||||||
' <button class="btn btn-sm btn-danger opt-remove" data-id=' + val +
|
|
||||||
'><i class="glyphicon glyphicon-remove"></i>删除</button>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
cache: false,
|
|
||||||
striped: true,
|
|
||||||
showRefresh: true,
|
|
||||||
pageNumber: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
pagination: true,
|
|
||||||
pageList: [10, 25, 50, 100],
|
|
||||||
search: true,
|
|
||||||
sidePagination: "client",
|
|
||||||
toolbar: '#toolbar'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#table").on("click", '.opt-remove', function () {
|
|
||||||
var id = $(this).attr("data-id");
|
|
||||||
if (id == 'undefined') {
|
|
||||||
$("#tipMsg").text("id参数有误");
|
|
||||||
$("#tipModal").modal('show');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (confirm("你确认删除该记录吗?" +
|
this.sysConfSaveFun();
|
||||||
"\r\n删除后再也不能找回,请谨慎操作!")) {
|
|
||||||
$.ajax({
|
|
||||||
type: 'post',
|
|
||||||
url: "/admin/sysConf/del.action",
|
|
||||||
data: { 'ids': JSON.stringify([id]) },
|
|
||||||
dataType: "json",
|
|
||||||
success: function (json) {
|
|
||||||
if (json.success == 'true') {
|
|
||||||
$("#tipMsg").text("删除成功");
|
|
||||||
$("#tipModal").modal('show');
|
|
||||||
getSysConfList().then(res => {
|
|
||||||
$('#table').bootstrapTable('load', res.rows);
|
|
||||||
});
|
|
||||||
TableHelper.doRefresh("#table");
|
|
||||||
} else {
|
} else {
|
||||||
$("#tipMsg").text("删除失败");
|
this.sysConfSaveFun();
|
||||||
$("#tipModal").modal('show');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
this.dialogTableVisible = false;
|
||||||
|
},
|
||||||
|
// 保存接口函数
|
||||||
|
sysConfSaveFun() {
|
||||||
|
this.loading = true;
|
||||||
|
sysConfSave({
|
||||||
|
configId: this.configId,
|
||||||
|
configName: this.configName,
|
||||||
|
configStatus: this.radio,
|
||||||
|
configValue: this.configValue,
|
||||||
|
nameSpace: this.nameSpace,
|
||||||
|
}).then((res) => {
|
||||||
|
this.getData();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
// 表格选中处理
|
||||||
|
toggleSelection(rows) {
|
||||||
|
if (rows) {
|
||||||
|
rows.forEach((row) => {
|
||||||
|
this.$refs.multipleTable.toggleRowSelection(row);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#sysConf-add").click(function () {
|
|
||||||
// 打开编辑弹窗
|
|
||||||
$("#sysConfModal").modal('show');
|
|
||||||
$("#sysConfForm")[0].reset();
|
|
||||||
$("#configId").val('');
|
|
||||||
$("#configId").attr('readonly', false);
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#sysConf-multiDel").click(function () {
|
|
||||||
var rows = $("#table").bootstrapTable("getSelections");
|
|
||||||
if (rows.length == 0) {
|
|
||||||
alert("请先选择要删除的记录");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log("rows: " + rows.length);
|
|
||||||
var idArr = [];
|
|
||||||
for (var i = 0; i < rows.length; i++) {
|
|
||||||
idArr.push(rows[i]['configId']);
|
|
||||||
}
|
|
||||||
console.log(idArr);
|
|
||||||
if (confirm("你确认批量删除该记录吗?" +
|
|
||||||
"\r\n删除后再也不能找回,请谨慎操作!")) {
|
|
||||||
$.ajax({
|
|
||||||
type: 'post',
|
|
||||||
url: "/admin/sysConf/del.action",
|
|
||||||
data: { 'ids': JSON.stringify(idArr) },
|
|
||||||
dataType: "json",
|
|
||||||
success: function (json) {
|
|
||||||
if (json.success == 'true') {
|
|
||||||
$("#tipMsg").text("删除成功");
|
|
||||||
$("#tipModal").modal('show');
|
|
||||||
getSysConfList().then(res => {
|
|
||||||
$('#table').bootstrapTable('load', res.rows);
|
|
||||||
});
|
|
||||||
TableHelper.doRefresh("#table");
|
|
||||||
} else {
|
} else {
|
||||||
$("#tipMsg").text("删除失败");
|
this.$refs.multipleTable.clearSelection();
|
||||||
$("#tipModal").modal('show');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#cancel").click(function () {
|
|
||||||
TableHelper.unCheckAll("#table");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#table").on("click", '.opt-edit', function () {
|
|
||||||
$("#configId").attr('readonly', true);
|
|
||||||
var id = $(this).attr("data-id");
|
|
||||||
$.ajax({
|
|
||||||
type: "get",
|
|
||||||
url: "/admin/sysConf/get.action",
|
|
||||||
data: { id: id },
|
|
||||||
dataType: "json",
|
|
||||||
success: function (json) {
|
|
||||||
if (json.entity) {
|
|
||||||
$("#configId").val(json.entity.configId);
|
|
||||||
$("#configName").val(json.entity.configName);
|
|
||||||
$("#configValue").val(json.entity.configValue);
|
|
||||||
$("#nameSpace").val(json.entity.nameSpace);
|
|
||||||
var status = json.entity.configStatus - 1;
|
|
||||||
$("input:radio[name='configStatus']")[status].checked = true;
|
|
||||||
// 打开编辑弹窗
|
|
||||||
$("#sysConfModal").modal('show');
|
|
||||||
} else {
|
|
||||||
$("#tipMsg").text("获取菜单信息出错");
|
|
||||||
$("#tipModal").modal('show');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#save").click(function () {
|
|
||||||
if ($("#sysConfForm").validationEngine('validate')) {
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: "/admin/sysConf/save.action",
|
|
||||||
data: $('#sysConfForm').serialize(),
|
|
||||||
dataType: "json",
|
|
||||||
success: function (json) {
|
|
||||||
if (json.success == 'true') {
|
|
||||||
$("#sysConfModal").modal('hide');
|
|
||||||
$("#tipMsg").text("保存成功");
|
|
||||||
$("#tipModal").modal('show');
|
|
||||||
getSysConfList().then(res => {
|
|
||||||
$('#table').bootstrapTable('load', res.rows);
|
|
||||||
});
|
|
||||||
TableHelper.doRefresh("#table");
|
|
||||||
} else {
|
|
||||||
$("#tipMsg").text("保存失败");
|
|
||||||
$("#tipModal").modal('show');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unmounted() {
|
// 表格选中处理
|
||||||
$('#table').bootstrapTable('destroy');
|
handleSelectionChange(val) {
|
||||||
}
|
val.forEach((res, i) => {
|
||||||
|
this.delArr[i] = res.configId;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 单个删除按钮
|
||||||
|
delTible(row) {
|
||||||
|
this.delArr = [row.configId];
|
||||||
|
this.centerDialogVisible = true;
|
||||||
|
},
|
||||||
|
// 多个删除按钮
|
||||||
|
multipleDel(row) {
|
||||||
|
console.log(this.delArr);
|
||||||
|
this.centerDialogVisible = true;
|
||||||
|
},
|
||||||
|
// 删除函数
|
||||||
|
delFun() {
|
||||||
|
this.loading = true;
|
||||||
|
sysConfDel({ ids: JSON.stringify(this.delArr) }).then((res) => {
|
||||||
|
this.getData();
|
||||||
|
});
|
||||||
|
this.centerDialogVisible = false;
|
||||||
|
},
|
||||||
|
// 二次确认删除按钮
|
||||||
|
dialogClick() {
|
||||||
|
this.delFun();
|
||||||
|
},
|
||||||
|
// 分页导航
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.pageSize = val;
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.currentPage = val;
|
||||||
|
},
|
||||||
|
handlerChange() {
|
||||||
|
// console.log(this.fillist());
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
valsen: {
|
||||||
|
immediate: true, //在框的值还没变化时执行如下函数显示出所有的情况
|
||||||
|
handler(val) {
|
||||||
|
this.tableData = this.tableData3.filter((p) => {
|
||||||
|
return (
|
||||||
|
p.configId.indexOf(val) !== -1 ||
|
||||||
|
p.configName.indexOf(val) !== -1 ||
|
||||||
|
p.configValue.indexOf(val) !== -1 ||
|
||||||
|
p.nameSpace.indexOf(val) !== -1
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="less" scoped>
|
||||||
.table_line {
|
.box {
|
||||||
word-break: break-all;
|
padding-top: 20px;
|
||||||
}
|
background: #ecf0f5;
|
||||||
|
.userId {
|
||||||
.td_center {
|
margin-bottom: 20px;
|
||||||
vertical-align: middle !important;
|
span {
|
||||||
}
|
width: 60px;
|
||||||
|
margin-right: 30px;
|
||||||
.table_line {
|
display: inline-block;
|
||||||
word-break: break-all;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.td_center {
|
.but {
|
||||||
vertical-align: middle !important;
|
width: 100%;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
height: 30px;
|
||||||
|
.butIn {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.inputs {
|
||||||
|
float: right;
|
||||||
|
width: 15%;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Reference in New Issue
Block a user