<template>
|
<div class="domainBox">
|
<My-bread :list="[
|
`${$t('dataManage.dataManage')}`,
|
`${$t('dataManage.rangeManage')}`,
|
]"></My-bread>
|
<el-divider />
|
<div class="mainBox">
|
<div
|
class="leftTree subpage_Div"
|
style="border: 1px solid #dcdfe6;"
|
>
|
<el-input
|
size="small"
|
v-model="filterInput"
|
style="width: 200px"
|
:placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueone')"
|
suffix-icon="el-icon-search"
|
></el-input>
|
<div style="width: 450px">
|
<el-tree
|
:data="domainData"
|
:props="defaultProps"
|
@node-click="toggleTabs"
|
:filter-node-method="filterNode"
|
ref="tree"
|
></el-tree>
|
</div>
|
</div>
|
<div class="right subpage_Div">
|
<div class="inquire">
|
<el-form
|
ref="queryForm"
|
:model="queryForm"
|
:inline="true"
|
>
|
<el-form-item
|
:label="$t('dataManage.vmobj.keyword')"
|
prop="name"
|
>
|
<el-input
|
size="small"
|
v-model="queryForm.code"
|
:placeholder="$t('shuJuGuanLi.lable4')"
|
style="width: 200px"
|
><i
|
slot="suffix"
|
class="el-icon-search"
|
@click="queryInfo('queryForm')"
|
style="padding-right: 8px"
|
></i></el-input>
|
</el-form-item>
|
<el-form-item style="float: right">
|
<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-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-form-item>
|
</el-form>
|
</div>
|
<div class="dividing-line"></div>
|
<div
|
class="table_box"
|
style="height: calc(100% - 60px)"
|
>
|
<el-table
|
:data="tableData"
|
@selection-change="handleSelectionChange"
|
border
|
height="calc(100% - 57px)"
|
>
|
<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"
|
sortable
|
:label="$t('dataManage.domainManage.domName')"
|
/>
|
<el-table-column
|
align="center"
|
prop="domDesc"
|
sortable
|
:label="$t('dataManage.domainManage.domDesc')"
|
/>
|
<el-table-column
|
align="center"
|
prop="domCode"
|
sortable
|
:label="$t('dataManage.domainManage.domCode')"
|
/>
|
<el-table-column
|
align="center"
|
prop="codeDesc"
|
sortable
|
:label="$t('dataManage.domainManage.codeDesc')"
|
/>
|
<!-- <el-table-column
|
align="center"
|
prop="bsm"
|
:label="$t('dataManage.domainManage.bsm')"
|
/> -->
|
<el-table-column
|
align="center"
|
prop="level"
|
sortable
|
:label="$t('dataManage.domainManage.level')"
|
/>
|
<el-table-column
|
align="center"
|
prop="orderid"
|
sortable
|
:label="$t('dataManage.domainManage.orderid')"
|
/>
|
<el-table-column
|
align="center"
|
prop="bak"
|
sortable
|
:label="$t('dataManage.domainManage.bak')"
|
/>
|
|
<el-table-column
|
min-width="150"
|
:label="$t('common.operate')"
|
>
|
<template slot-scope="scope">
|
<el-button
|
@click="showDetail(scope.row)"
|
type="primary"
|
size="small"
|
plain
|
>{{ $t("common.details") }}</el-button>
|
<el-button
|
v-if="btnStatus.update"
|
type="warning"
|
@click="handleEdit(scope.$index, scope.row)"
|
size="small"
|
plain
|
>{{ $t("common.update") }}</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<div
|
class="pagination_box"
|
style="margin-top: 15px"
|
>
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:current-page="listData.pageIndex"
|
:page-sizes="[10, 50, 100, 200]"
|
:page-size="listData.pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="count"
|
>
|
</el-pagination>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div
|
class="infoBox_box"
|
v-show="showinfoBox"
|
>
|
<div class="infoBox subpage_Div box_div">
|
<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>
|
<el-divider></el-divider>
|
<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>
|
</div>
|
</div>
|
<el-dialog
|
top="2vh"
|
:title="
|
behavior == '新增用户'
|
? `${$t('common.append')}`
|
: `${$t('common.update')}`
|
"
|
:visible.sync="dialogFormVisible"
|
:before-close="handleClose"
|
>
|
<div style="height: 500px; overflow: auto">
|
<el-form
|
:model="editForm"
|
ref="editForm"
|
label-position="top"
|
>
|
<el-form-item
|
:label="$t('dataManage.domainManage.domName')"
|
:label-width="formLabelWidth"
|
>
|
<el-select
|
:popper-append-to-body="false"
|
style="width:85%"
|
v-model="editForm.domName"
|
:placeholder="$t('shuJuGuanLi.shuJuJianSuo.rangeName')"
|
>
|
<el-option
|
v-for="item in domainOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
<!-- <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"
|
style="width:85%"
|
:placeholder="$t('shuJuGuanLi.shuJuJianSuo.descriptionRange')"
|
></el-input>
|
</el-form-item>
|
|
<el-form-item
|
:label="$t('dataManage.domainManage.domCode')"
|
:label-width="formLabelWidth"
|
>
|
<el-input
|
v-model="editForm.domCode"
|
autocomplete="off"
|
style="width:85%"
|
:placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuecode')"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.codeDesc')"
|
:label-width="formLabelWidth"
|
>
|
<el-input
|
v-model="editForm.codeDesc"
|
autocomplete="off"
|
style="width:85%"
|
:placeholder="$t('shuJuGuanLi.shuJuJianSuo.codeDescription')"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.bsm')"
|
:label-width="formLabelWidth"
|
>
|
<el-input
|
v-model="editForm.bsm"
|
autocomplete="off"
|
style="width:85%"
|
:placeholder="$t('shuJuGuanLi.shuJuJianSuo.identificationcode')"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.level')"
|
:label-width="formLabelWidth"
|
>
|
<el-input
|
v-model="editForm.level"
|
autocomplete="off"
|
style="width:85%"
|
:placeholder="$t('shuJuGuanLi.shuJuJianSuo.hierarchy')"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.orderid')"
|
:label-width="formLabelWidth"
|
>
|
<el-input
|
v-model="editForm.orderid"
|
autocomplete="off"
|
style="width:85%"
|
:placeholder="$t('shuJuGuanLi.shuJuJianSuo.serialnumber')"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label="$t('dataManage.domainManage.bak')"
|
:label-width="formLabelWidth"
|
>
|
<el-input
|
v-model="editForm.bak"
|
autocomplete="off"
|
style="width:85%"
|
:placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueRemarks')"
|
></el-input>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div
|
v-if="behavior == '修改信息'"
|
slot="footer"
|
class="dialog-footer"
|
>
|
<el-button
|
size="small"
|
@click="cancelEdit()"
|
>{{
|
$t("common.reset")
|
}}</el-button>
|
<el-button
|
size="small"
|
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"
|
size="small"
|
@click="cancelAdd('editForm')"
|
>{{
|
$t("common.reset")
|
}}</el-button>
|
<el-button
|
size="small"
|
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,
|
domain_selectDomainNames,
|
} from "../../api/api";
|
import MyBread from "../../components/MyBread.vue";
|
import {
|
getTreeData
|
} from "../../utils/treeData.js"
|
export default {
|
name: "domainManage",
|
components: { MyBread },
|
data() {
|
return {
|
filterInput: "",
|
domainOptions: [],
|
multipleSelection: [],
|
behavior: "",
|
formLabelWidth: "100px",
|
dialogFormVisible: false,
|
showinfoBox: false,
|
fullscreenLoading: false,
|
itemdetail: {},
|
editForm: {
|
domName: "",
|
},
|
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: [
|
|
],
|
defaultProps: {
|
children: "children",
|
label: "label",
|
},
|
};
|
},
|
created() {
|
this.getAllTabelData();
|
this.showPermsBtn();
|
},
|
computed: {
|
pathId() {
|
return this.$store.state.cataNode.id;
|
},
|
},
|
|
methods: {
|
filterNode(value, data) {
|
if (!value) return true;
|
|
return data.val.indexOf(value) !== -1;
|
},
|
async toggleTabs(data) {
|
if (data.children != null) {
|
return
|
}
|
this.fullscreenLoading = true;
|
this.listData.ns = data.ns;
|
this.listData.tab = data.tab;
|
this.listData.pageIndex = 1;
|
this.listData.pageSize = 10;
|
const res = await domain_selectDomainNames(data);
|
if (res.code != 200) {
|
this.$message.error("domain调用失败");
|
}
|
var std = [];
|
for (var i = 0; i < res.result.length; i++) {
|
std.push({
|
value: res.result[i],
|
label: res.result[i],
|
});
|
}
|
this.domainOptions = std;
|
this.editForm.domName = res.result[0];
|
|
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) => {
|
var val = res.result;
|
this.domainData = getTreeData(val)
|
// var std = [];
|
// val.filter((item) => {
|
// if (std.indexOf(item.bak) == -1) {
|
// std.push(item.bak);
|
// this.domainData.push(
|
// {
|
// val: item.bak,
|
// children: [],
|
// }
|
// )
|
// }
|
// });
|
// this.domainData.filter((item) => {
|
// val.filter((res) => {
|
// if (item.val === res.bak) {
|
// res.val = res.tabDesc
|
// item.children.push(res)
|
// }
|
// })
|
// })
|
});
|
},
|
handleSelectionChange(val) {
|
this.multipleSelection = val;
|
},
|
|
queryInfo() {
|
let searchData = {
|
name: 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 {
|
this.$notify.error({
|
title: res.code,
|
message: res.result,
|
});
|
}
|
});
|
},
|
resetInfo() {
|
this.queryForm = {};
|
this.$store.state.verCateNode = {};
|
this.$bus.$emit("clearTressLabel", true);
|
this.listData.pageIndex = 1;
|
this.listData.pageSize = 10;
|
this.queryInfo();
|
},
|
// 删除多条
|
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) => {
|
|
if (res.code == 200) {
|
this.$message({
|
type: "success",
|
message: "删除成功!",
|
});
|
this.multipleSelection = [];
|
this.listData.pageIndex = 1;
|
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;
|
|
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) { },
|
},
|
filterInput(val) {
|
this.$refs.tree.filter(val);
|
},
|
},
|
};
|
</script>
|
<style lang="less" scoped>
|
// @import url(); 引入公共css类
|
.domainBox {
|
height: 98%;
|
width: 98%;
|
padding: 0.5%;
|
.mainBox {
|
padding-top: 10px;
|
width: 100%;
|
height: calc(100% - 75px);
|
display: flex;
|
justify-content: space-around;
|
.leftTree {
|
width: calc(23% - 0px);
|
height: 100%;
|
|
border-radius: 5px;
|
padding: 10px;
|
box-sizing: border-box;
|
overflow-y: auto;
|
}
|
.right {
|
width: 75%;
|
height: 100%;
|
border-radius: 5px;
|
padding: 0 10px;
|
box-sizing: border-box;
|
border: 1px solid #dcdfe6;
|
.inquire {
|
padding: 8px;
|
// margin-top: 10px;
|
border-radius: 5px;
|
//border: 1px solid #dcdfe6;
|
//margin-bottom: 20px;
|
.el-form-item {
|
margin: 5px;
|
}
|
}
|
}
|
}
|
}
|
</style>
|