<template>
|
<div class="domainBox">
|
<My-bread
|
:list="[
|
`${$t('dataManage.dataManage')}`,
|
`${$t('dataManage.rangeManage')}`,
|
]"
|
></My-bread>
|
<el-divider />
|
<div class="mainBox">
|
<div class="leftTree">
|
<el-tree
|
:data="domainData"
|
:props="defaultProps"
|
:default-expand-all="true"
|
@node-click="toggleTabs"
|
></el-tree>
|
</div>
|
<div class="right">
|
<div class="inquire">
|
<el-form ref="queryForm" :model="queryForm" :inline="true">
|
<el-form-item
|
:label="$t('dataManage.domainManage.domCode')"
|
prop="name"
|
>
|
<el-input
|
v-model="queryForm.code"
|
:placeholder="$t('common.pleaseInput')"
|
/>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
@click="queryInfo('queryForm')"
|
icon="el-icon-search"
|
size="small"
|
class="primary"
|
>{{ $t('common.iquery') }}</el-button
|
>
|
<el-button
|
@click="resetInfo('queryForm')"
|
icon="el-icon-delete"
|
size="small"
|
type="info"
|
>{{ $t('common.empty') }}</el-button
|
>
|
<el-button
|
v-if="btnStatus.insert"
|
@click="showAddDialog"
|
icon="el-icon-plus"
|
size="small"
|
type="success"
|
>{{ $t('common.append') }}</el-button
|
>
|
<el-button
|
v-if="btnStatus.delete"
|
@click="deleteInfo"
|
type="danger"
|
size="small"
|
icon="el-icon-delete"
|
>{{ $t('common.delete') }}</el-button
|
>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div class="table_box">
|
<el-table
|
:data="tableData"
|
@selection-change="handleSelectionChange"
|
height="100%"
|
>
|
<el-table-column type="selection" width="50" />
|
<el-table-column
|
align="center"
|
type="index"
|
:label="$t('dataManage.domainManage.index')"
|
width="70px"
|
/>
|
<el-table-column
|
align="center"
|
prop="domName"
|
:label="$t('dataManage.domainManage.domName')"
|
/>
|
<el-table-column
|
align="center"
|
prop="domDesc"
|
:label="$t('dataManage.domainManage.domDesc')"
|
/>
|
<el-table-column
|
align="center"
|
prop="domCode"
|
:label="$t('dataManage.domainManage.domCode')"
|
/>
|
<el-table-column
|
align="center"
|
prop="codeDesc"
|
:label="$t('dataManage.domainManage.codeDesc')"
|
/>
|
<!-- <el-table-column
|
align="center"
|
prop="bsm"
|
:label="$t('dataManage.domainManage.bsm')"
|
/> -->
|
<el-table-column
|
align="center"
|
prop="level"
|
:label="$t('dataManage.domainManage.level')"
|
/>
|
<el-table-column
|
align="center"
|
prop="orderid"
|
:label="$t('dataManage.domainManage.orderid')"
|
/>
|
<el-table-column
|
align="center"
|
prop="bak"
|
:label="$t('dataManage.domainManage.bak')"
|
/>
|
|
<el-table-column min-width="150" :label="$t('common.operate')">
|
<template slot-scope="scope"
|
><el-button
|
class="primary"
|
@click="showDetail(scope.row)"
|
size="small"
|
>{{ $t('common.details') }}</el-button
|
>
|
<el-button
|
v-if="btnStatus.update"
|
type="warning"
|
@click="handleEdit(scope.$index, scope.row)"
|
size="small"
|
>{{ $t('common.update') }}</el-button
|
>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<div class="pagination_box" style="margin-top: 20px">
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:current-page="listData.pageIndex"
|
:page-sizes="[10, 20, 30, 40]"
|
:page-size="listData.pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="count"
|
>
|
</el-pagination>
|
</div>
|
</div>
|
</div>
|
<div class="infoBox" v-show="showinfoBox">
|
<el-card class="box-card">
|
<div slot="header" class="clearfix">
|
<span>{{ $t('common.details') }}</span>
|
<div style="float: right; cursor: pointer" @click="closeDetial">
|
<i class="el-icon-close"></i>
|
</div>
|
</div>
|
<div class="contentBox">
|
<p>
|
{{ $t('dataManage.domainManage.domName') }}:{{
|
itemdetail.domName
|
}}
|
</p>
|
<el-divider></el-divider>
|
<p>
|
{{ $t('dataManage.domainManage.domDesc') }}:{{
|
itemdetail.domDesc
|
}}
|
</p>
|
<el-divider></el-divider>
|
<p>
|
{{ $t('dataManage.domainManage.domCode') }}:{{
|
itemdetail.domCode
|
}}
|
</p>
|
<el-divider></el-divider>
|
<p>
|
{{ $t('dataManage.domainManage.codeDesc') }}:{{
|
itemdetail.codeDesc
|
}}
|
</p>
|
<el-divider></el-divider>
|
<p>{{ $t('dataManage.domainManage.bsm') }}:{{ itemdetail.bsm }}</p>
|
<el-divider></el-divider>
|
<p>
|
{{ $t('dataManage.domainManage.level') }}:{{ itemdetail.level }}
|
</p>
|
<el-divider></el-divider>
|
<p>
|
{{ $t('dataManage.domainManage.orderid') }}:{{
|
itemdetail.orderid
|
}}
|
</p>
|
<el-divider></el-divider>
|
<p>{{ $t('dataManage.domainManage.bak') }}:{{ itemdetail.bak }}</p>
|
</div>
|
</el-card>
|
</div>
|
<el-dialog
|
width="510px"
|
top="5vh"
|
:title="
|
behavior == '新增用户'
|
? `${$t('common.append')}`
|
: `${$t('common.update')}`
|
"
|
:visible.sync="dialogFormVisible"
|
:before-close="handleClose"
|
>
|
<el-form :model="editForm" ref="editForm">
|
<el-form-item
|
:label="$t('dataManage.domainManage.domName')"
|
:label-width="formLabelWidth"
|
>
|
<el-input v-model="editForm.domName" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.domDesc')"
|
:label-width="formLabelWidth"
|
>
|
<el-input v-model="editForm.domDesc" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.domCode')"
|
:label-width="formLabelWidth"
|
>
|
<el-input v-model="editForm.domCode" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.codeDesc')"
|
:label-width="formLabelWidth"
|
>
|
<el-input v-model="editForm.codeDesc" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.bsm')"
|
:label-width="formLabelWidth"
|
>
|
<el-input v-model="editForm.bsm" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.level')"
|
:label-width="formLabelWidth"
|
>
|
<el-input v-model="editForm.level" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.orderid')"
|
:label-width="formLabelWidth"
|
>
|
<el-input v-model="editForm.orderid" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.bak')"
|
:label-width="formLabelWidth"
|
>
|
<el-input v-model="editForm.bak" autocomplete="off"></el-input>
|
</el-form-item>
|
</el-form>
|
<div v-if="behavior == '修改信息'" slot="footer" class="dialog-footer">
|
<el-button @click="cancelEdit()">{{ $t('common.reset') }}</el-button>
|
<el-button
|
size="medium"
|
class="primary"
|
type="info"
|
@click="sendEdit('editForm')"
|
v-loading.fullscreen.lock="fullscreenLoading"
|
>{{ $t('common.confirm') }}</el-button
|
>
|
</div>
|
<div v-else slot="footer" class="dialog-footer">
|
<el-button type="info" @click="cancelAdd('editForm')">{{
|
$t('common.reset')
|
}}</el-button>
|
<el-button
|
size="medium"
|
class="primary"
|
@click="sendAdd('editForm')"
|
v-loading.fullscreen.lock="fullscreenLoading"
|
>{{ $t('common.confirm') }}</el-button
|
>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import {
|
getDomainTabs,
|
getSingleTab,
|
insertDomain,
|
deleteDomain,
|
updateDomain,
|
} from '../../api/api';
|
import MyBread from '../../components/MyBread.vue';
|
export default {
|
name: 'domainManage',
|
components: { MyBread },
|
data() {
|
return {
|
multipleSelection: [],
|
behavior: '',
|
formLabelWidth: '100px',
|
dialogFormVisible: false,
|
showinfoBox: false,
|
fullscreenLoading: false,
|
itemdetail: {},
|
editForm: {},
|
queryForm: {
|
code: '',
|
},
|
insertform: {},
|
initialForm: '',
|
|
tableData: [],
|
count: 0,
|
rowFlag: null,
|
listData: {
|
ns: '',
|
tab: '',
|
pageIndex: 1,
|
pageSize: 10,
|
},
|
btnStatus: {
|
select: false,
|
delete: false,
|
upload: false,
|
download: false,
|
insert: false,
|
update: false,
|
},
|
domainData: [
|
{
|
val: '基础数据',
|
children: [],
|
},
|
{
|
val: '业务数据',
|
children: [],
|
},
|
],
|
defaultProps: {
|
children: 'children',
|
label: 'val',
|
},
|
};
|
},
|
created() {
|
this.getAllTabelData();
|
this.showPermsBtn();
|
},
|
computed: {
|
pathId() {
|
return this.$store.state.cataNode.id;
|
},
|
},
|
methods: {
|
toggleTabs(data) {
|
this.fullscreenLoading = true;
|
this.listData.ns = data.ns;
|
this.listData.tab = data.tab;
|
debugger;
|
getSingleTab(this.listData).then((res) => {
|
setTimeout(() => {
|
if (res.code == 200) {
|
this.tableData = res.result;
|
this.count = res.count;
|
this.fullscreenLoading = false;
|
} else {
|
this.tableData = [];
|
this.count = 0;
|
this.fullscreenLoading = false;
|
}
|
}, 500);
|
});
|
},
|
showPermsBtn() {
|
let currentPerms = this.$store.state.currentPerms;
|
let permsEntity = this.$store.state.permsEntity;
|
permsEntity
|
.filter((item) => item.perms == currentPerms)
|
.map((item) => (this.btnStatus[item.tag.substr(1)] = true));
|
},
|
getAllTabelData() {
|
getDomainTabs().then((res) => {
|
let bdres = res.result.filter((item) => item.ns == 'bd');
|
let bsres = res.result.filter((item) => item.ns == 'bs');
|
for (var i in bdres) {
|
bdres[i].val = bdres[i].tabDesc + '(' + bdres[i].tab + ')';
|
}
|
for (var i in bsres) {
|
bsres[i].val = bsres[i].tabDesc + '(' + bsres[i].tab + ')';
|
}
|
this.domainData[0].children = bdres;
|
this.domainData[1].children = bsres;
|
});
|
},
|
handleSelectionChange(val) {
|
this.multipleSelection = val;
|
},
|
|
queryInfo() {
|
let searchData = {
|
code: this.queryForm.code,
|
ns: this.listData.ns,
|
tab: this.listData.tab,
|
pageIndex: this.listData.pageIndex,
|
pageSize: this.listData.pageSize,
|
};
|
// console.log(searchData);
|
getSingleTab(searchData).then((res) => {
|
if (res.code == 200) {
|
this.tableData = res.result;
|
this.count = res.count;
|
} else {
|
console.log('查询接口报错');
|
this.$notify.error({
|
title: res.code,
|
message: res.result,
|
});
|
}
|
});
|
},
|
resetInfo() {
|
this.queryForm = {};
|
this.$store.state.verCateNode = {};
|
this.$bus.$emit('clearTressLabel', true);
|
this.getAllTabelData();
|
},
|
// 删除多条
|
deleteInfo() {
|
this.$confirm('确定是否删除所选内容?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
})
|
.then(() => {
|
if (this.multipleSelection.length == 0) {
|
alert('请选择要删除的对象');
|
return;
|
} else {
|
var std = [];
|
for (var i in this.multipleSelection) {
|
std.push(this.multipleSelection[i].id);
|
}
|
deleteDomain({ ids: std.toString() }).then((res) => {
|
console.log(res);
|
if (res.code == 200) {
|
this.$message({
|
type: 'success',
|
message: '删除成功!',
|
});
|
this.multipleSelection = [];
|
getSingleTab(this.listData).then((res) => {
|
setTimeout(() => {
|
this.tableData = res.result;
|
this.count = res.count;
|
this.fullscreenLoading = false;
|
}, 500);
|
});
|
} else {
|
this.$message.error('删除失败');
|
this.multipleSelection = [];
|
}
|
});
|
}
|
})
|
.catch(() => {
|
this.$message('已取消删除');
|
});
|
},
|
showAddDialog() {
|
this.behavior = '新增用户';
|
this.editForm = {};
|
this.dialogFormVisible = true;
|
},
|
cancelAdd(formName) {
|
this.editForm = {};
|
this.$refs[formName].resetFields();
|
},
|
sendAdd(formName) {
|
this.$refs[formName].validate((valid) => {
|
if (valid) {
|
this.fullscreenLoading = true;
|
debugger;
|
insertDomain(this.editForm)
|
.then((res) => {
|
setTimeout(() => {
|
this.fullscreenLoading = false;
|
if (res.code == 200) {
|
this.$message({
|
message: '添加成功',
|
type: 'success',
|
});
|
getSingleTab(this.listData).then((res) => {
|
setTimeout(() => {
|
this.tableData = res.result;
|
this.count = res.count;
|
this.fullscreenLoading = false;
|
}, 500);
|
});
|
this.editForm = {};
|
this.dialogFormVisible = false;
|
}
|
}, 500);
|
})
|
.catch((res) => {
|
alert('添加失败,请重试!');
|
this.fullscreenLoading = false;
|
});
|
} else {
|
console.log('error submit!!');
|
return false;
|
}
|
});
|
},
|
handleClose(done) {
|
this.$confirm('关闭后无法保存,是否关闭?')
|
.then((_) => {
|
this.editForm = {};
|
done();
|
})
|
.catch((_) => {});
|
},
|
// 查看界面
|
showDetail(row) {
|
// console.log(index, row);
|
this.showinfoBox = true;
|
this.itemdetail = row;
|
},
|
// 关闭查看
|
closeDetial() {
|
this.showinfoBox = false;
|
this.itemdetail = {};
|
},
|
handleEdit(index, row) {
|
this.dialogFormVisible = true;
|
this.initialForm = JSON.stringify(row); //备份
|
this.editForm = row;
|
this.behavior = '修改信息';
|
},
|
editFromDataClose() {
|
this.dialogFormVisible = false;
|
this.editForm = {};
|
},
|
|
// 提交修改
|
sendEdit() {
|
this.$confirm('是否确定编辑?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
})
|
.then(() => {
|
this.dialogFormVisible = false;
|
this.fullscreenLoading = true;
|
updateDomain(this.editForm)
|
.then((res) => {
|
if (res.code == 200) {
|
getSingleTab(this.listData).then((res) => {
|
setTimeout(() => {
|
this.tableData = res.result;
|
this.count = res.count;
|
this.fullscreenLoading = false;
|
}, 500);
|
});
|
this.$message({
|
message: '修改成功',
|
type: 'success',
|
});
|
this.editForm = {};
|
} else {
|
alert('修改失败,请重试!');
|
this.fullscreenLoading = false;
|
}
|
})
|
.catch(() => {
|
alert('修改失败,请重试!');
|
this.fullscreenLoading = false;
|
});
|
})
|
.catch(() => {
|
alert('修改失败,请重试!');
|
this.fullscreenLoading = false;
|
});
|
},
|
cancelEdit() {
|
this.$nextTick(() => {
|
this.editForm = JSON.parse(this.initialForm);
|
});
|
},
|
handleSizeChange(val) {
|
this.listData.pageSize = val;
|
// console.log(this.listData);
|
getSingleTab(this.listData).then((res) => {
|
setTimeout(() => {
|
this.tableData = res.result;
|
this.count = res.count;
|
this.fullscreenLoading = false;
|
}, 500);
|
});
|
},
|
handleCurrentChange(val) {
|
this.listData.pageIndex = val;
|
getSingleTab(this.listData).then((res) => {
|
setTimeout(() => {
|
this.tableData = res.result;
|
this.count = res.count;
|
this.fullscreenLoading = false;
|
}, 500);
|
});
|
},
|
},
|
watch: {
|
pathId: {
|
immediate: true,
|
handler(val) {},
|
},
|
},
|
};
|
</script>
|
<style lang="less" scoped>
|
//@import url(); 引入公共css类
|
.domainBox {
|
height: 80%;
|
width: 97%;
|
position: absolute;
|
.mainBox {
|
width: 100%;
|
height: 92%;
|
display: flex;
|
justify-content: space-between;
|
.leftTree {
|
width: 15%;
|
height: 96%;
|
border: 1px solid white;
|
border-radius: 5px;
|
padding: 1%;
|
max-height: 670px;
|
overflow-y: auto;
|
}
|
.right {
|
width: 80%;
|
height: 96%;
|
border: 1px solid white;
|
border-radius: 5px;
|
padding: 1%;
|
max-height: 670px;
|
overflow-y: auto;
|
.inquire {
|
margin-bottom: 10px;
|
|
border-radius: 5px;
|
border: 1px solid rgb(202, 201, 204);
|
.el-form-item {
|
margin: 5px;
|
}
|
}
|
.table_box {
|
width: 100%;
|
height: 80%;
|
margin: 0 auto;
|
overflow: auto;
|
|
.el-table /deep/ th.el-table__cell > .cell {
|
padding: 15px !important;
|
}
|
|
.el-table--border::after,
|
.el-table--group::after {
|
width: 0;
|
}
|
.el-table::before {
|
height: 0;
|
}
|
}
|
}
|
}
|
|
.infoBox {
|
width: 500px;
|
|
position: absolute;
|
z-index: 100;
|
top: 15%;
|
right: 25%;
|
color: white;
|
background-color: #303030;
|
.el-card {
|
background-color: transparent;
|
color: white;
|
span {
|
font-size: 16px;
|
font-weight: 600;
|
color: white;
|
}
|
}
|
.contentBox {
|
margin: 0 aotu 10px;
|
height: 500px;
|
overflow: auto;
|
color: white;
|
overflow-y: auto;
|
p {
|
color: white;
|
font-size: 14px;
|
}
|
}
|
}
|
.pagination_box {
|
margin-top: 20px;
|
/deep/.el-input__inner {
|
background-color: transparent !important;
|
border: 1px solid;
|
color: white;
|
}
|
/deep/.el-pagination__total {
|
color: white;
|
}
|
/deep/.el-pagination__jump {
|
color: white;
|
}
|
/deep/.el-pager li.active {
|
color: #409eff;
|
}
|
/deep/.el-pager li {
|
color: white;
|
background: transparent;
|
}
|
/deep/.el-pager li {
|
color: white;
|
}
|
/deep/.btn-prev {
|
background: transparent;
|
}
|
/deep/.btn-next {
|
background: transparent;
|
}
|
/deep/.btn-next i {
|
color: white;
|
}
|
/deep/.btn-prev i {
|
color: white;
|
}
|
}
|
/deep/.el-form-item__label {
|
color: white;
|
}
|
// 设置输入框的背景色、字体颜色、边框属性设置;
|
/deep/.el-input__inner {
|
background-color: transparent !important ;
|
color: #fff;
|
border: 1px solid;
|
}
|
/*修改table 表体的背景颜色和文字颜色*/
|
/deep/ .el-table {
|
background-color: transparent;
|
|
th,
|
td {
|
background-color: transparent;
|
}
|
.el-table__expanded-cell {
|
background-color: transparent !important;
|
}
|
|
// 表头背景色
|
th.el-table__cell {
|
background-color: #303030;
|
color: #fff;
|
}
|
tr > td {
|
background-color: #303030;
|
color: #fff;
|
}
|
|
// hover效果
|
tr:hover > td {
|
background-color: rgba(255, 255, 255, 0.3) !important;
|
}
|
|
tbody tr:hover {
|
background-color: rgba(255, 255, 255, 0.3) !important;
|
// text-align: center;
|
}
|
|
// 滚动条宽高
|
.el-table__body-wrapper::-webkit-scrollbar {
|
width: 5px;
|
height: 5px;
|
}
|
|
.el-table__body-wrapper::-webkit-scrollbar {
|
width: 5px;
|
/*滚动条宽度*/
|
height: 5px;
|
/*滚动条高度*/
|
}
|
/*定义滚动条轨道 内阴影+圆角*/
|
.el-table__body-wrapper::-webkit-scrollbar-track {
|
box-shadow: 0px 1px 3px #216fe6 inset;
|
/*滚动条的背景区域的内阴影*/
|
border-radius: 10px;
|
}
|
|
/*定义滑块 内阴影+圆角*/
|
.el-table__body-wrapper::-webkit-scrollbar-thumb {
|
box-shadow: 0px 1px 3px #216fe6 inset;
|
border-radius: 6px;
|
background-color: #216fe6;
|
}
|
}
|
/deep/ .el-dialog {
|
width: 620px !important;
|
margin-top: 10vh !important;
|
}
|
/deep/ .el-select .el-input__inner {
|
border-color: #fff !important;
|
}
|
/deep/.el-dialog .el-input__inner {
|
width: 300px;
|
}
|
/deep/ .el-dialog__body {
|
padding: 0px 30px;
|
}
|
/deep/ .el-dialog__footer {
|
padding-top: 0 !important;
|
width: 600px;
|
display: flex;
|
margin: 0 auto;
|
justify-content: center;
|
}
|
.primary {
|
background: #409eff;
|
border: #409eff;
|
color: white;
|
}
|
/deep/ .el-dialog {
|
background: #303030;
|
}
|
/deep/.el-range-editor.is-active,
|
.el-range-editor.is-active:hover,
|
.el-select .el-input.is-focus .el-input__inner {
|
border: 1px solid;
|
}
|
/deep/.el-dialog__title {
|
color: white;
|
}
|
}
|
</style>
|