// import { authModifyMock } from "../managerAuth/morckJson.js";
import addSystem from './addSystem.vue'
import editSystem from './editSystem.vue'
import {
justOne
} from '../../js/common.js'
import InterFaceList from './interFaceList.vue'
import GetInDialog from "./GetInDialog.vue"
import {
tipMsg,
downLoadFile
} from '../../js/common.js'
export default {
components: {
addSystem,
editSystem,
InterFaceList,
GetInDialog
},
data() {
return {
rescBtnListFlag: false,
isFengKong: false, //默认不是风控系统登录。
uploadUrl: '',
nodeId: '', //点击节点的ID,(需展示子节点)
dimList: [], //数据权限容器
jigouId: '', //机构id
jigouKey: '', //机构隔离key
yewuxianId: '', //业务线id
yewuxianKey: '', //业务线隔离key
riskId: '', //风险类型id
riskKey: '', //风险类型隔离key
isolationKey: '', //点击获取隔离key。
pId: '',
sysId: '',
btnId: '',
lesseeId: '',
resId: '',
dataSel: '',
status: 1,
commandget: '生效',
sysable: true,
filterText: '',
dataObj: '',
detail: true, //节点详情页面开关
addmenuteam: false, //新菜单组 右侧信息页面开关
addmenuId: '', //新增菜单的id
addmenu: false, //新增 编辑菜单 右侧信息页面开关
menuData: [],
menuList: [], //菜单类型列表
sysSourceList: [], //来源系统列表
dialogVisible_one: false, //系统新增弹窗
dialogVisible_two: false, //系统编辑弹窗
dialogTableVisible_interFace: false, //接口弹窗
dialogGetIn: false, //导入弹窗
importUrl: '', //提交地址
downloadUrl: '', //下载模板地址
defaultProps: {
children: 'child',
label: 'name'
},
node: '',
//菜单详情
pData: {
'flg': 0,
'openType': 0,
sourceSystem: '',
dataAccess: [], //配置数据权限
display_flag: '0', //展示终端
orderBy: '',
pname: '',
name: '',
'id': '',
'pid': '',
recDesc: '',
url: '',
menuType: '',
sysname: '',
'rescBtnList': [{
code: '', //编码
name: '', // 名称
btDesc: '', //描述
url: '', //账户名称
}],
'rescInterFaceList': [{
resId: '',
lesseeId: '',
type: '',
url: '',
id: '',
description: '',
}, ],
'status': '1',
'sysId': '',
},
//新增菜单分组
menuteam: {
'flg': 0,
'name': '',
'code': '',
'openType': 0,
'orderBy': '',
'pid': '',
menuType: '',
sourceSystem: '',
dataAccess: ['机构'], //配置数据权限
display_flag: '0', //展示终端
'recDesc': '',
'status': '1',
'sysId': '',
'url': ''
},
//
//新增菜单
adData: {
'flg': 0,
'name': '',
'openType': 0,
'orderBy': '',
'pid': '',
id: '',
'recDesc': '',
menuType: '',
sourceSystem: '',
dataAccess: ['机构'], //配置数据权限
display_flag: '0', //展示终端
'rescBtnList': [{
'id': '',
'code': '',
'name': '',
btDesc: '',
'url': ''
}],
'rescInterFaceList': [{
resId: '',
lesseeId: '',
type: '',
url: '',
id: '',
description: '',
}],
'status': '1',
'sysId': '',
'url': ''
},
currentdata: [],
currentifdata: [],
eidt: false,
checkedId: [],
sysList: [],
menuname: '',
// kankan: '',
offBtn: 0,
eddteammenu: '',
// offCode: false,
sysName: '',
lesId: '',
btnListData: ''
}
},
watch: {
filterText(val) {
this.$refs.tree2.filter(val)
}
},
created() {
this.uploadUrl = `${this.$root.loadUrl}`
this.judgeSys();
},
mounted() {
this.sysInt()
this.$Http.post(this.uploadUrl + '/emplRoleDeclare/findOperUsers', {}).then((res) => {
var result = res.data;
if (result.code == '000000') {
this.lesseeId = result.data.lesseeId;
} else {
tipMsg(result.message, "error");
}
})
},
methods: {
judgeSys(){
let str = this.uploadUrl.split("//")[1];
this.isFengKong = str.startsWith('irisk'); //判断是否风控系统登录。
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
sysInt(msg) {
this.$Http.post(this.uploadUrl + '/resources/findSysForSel', {}).then((data) => {
var result = data.body;
if (result.code == '000000') {
this.sysList = result.data;
this.sysId = msg ? msg.sysid : this.sysList[0].id;
this.sysList.forEach(item => {
if (item.id == this.sysId) {
this.sysName = item.name;
}
})
//左边菜单树
this.treeInt();
//
this.initMenu();
this.initSourceSystem();
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
});
}
});
},
//树初始化
treeInt() {
if (this.commandget == '生效') {
this.$Http.post(this.uploadUrl + '/resources/findResc', {
status: this.status,
sysId: this.sysId
}).then((data) => {
var result = data.body
if (result.code == '000000') {
this.menuData = result.data
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
} else {
this.$Http.post(this.uploadUrl + '/resources/findResc', {
status: this.status,
sysId: this.sysId
}).then((data) => {
var result = data.body
console.log('运行全部')
if (result.code == '000000') {
this.menuData = result.data
this.chooseDisabled(result.data)
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
}
},
//菜单类型初始列表获取
initMenu() {
this.$Http.post(this.uploadUrl + '/drawerMore/findByTabCol', {
"tab": "mdm_resources",
"col": "menu_type"
}).then((data) => {
var result = data.body;
if (result.code == '000000') {
this.menuList = result.data;
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
});
}
});
},
//来源系统初始列表获取
initSourceSystem() {
this.$Http.post(this.uploadUrl + '/drawerMore/findByTabCol', {
"tab": "mdm_resources",
"col": "source_system"
}).then((data) => {
var result = data.body;
if (result.code == '000000') {
this.sysSourceList = result.data;
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
});
}
});
},
//编辑
eidIndex() {
this.eidt = true
$('.el-table__header', '.el-table__body').css('width', '100%')
if (this.pId == '') {
this.$message({
type: 'warning',
message: '请先选择节点进行编辑操作'
})
return
}
this.eddteammenu = this.pData.pname
this.adData = this.pData
this.$set(this.adData, 'rescBtnList', this.pData.rescBtnList);
if (this.adData.rescBtnList.length > 0) {
this.rescBtnListFlag = true;
} else {
this.rescBtnListFlag = false;
}
this.adData.id = this.nodeId
this.adData.sysId = this.sysId
this.addmenu = true
this.addmenuteam = false
this.detail = false
},
//表格选择选项
selectItem(val) {
console.log(val)
this.currentdata = val
},
selectAll(val) {
this.currentdata = val
},
//接口权限选择
selectIFItem(val) {
this.currentifdata = val
},
selectIFAll(val) {
this.currentifdata = val
},
//表格复制
copyList() {
if (this.currentdata.length != 1) {
this.$message({
type: 'warning',
message: '请选择单条数据进行复制'
})
return
}
if (!this.rescBtnListFlag) {
this.rescBtnListFlag = true;
}
var obj = this.currentdata[0]
var obj = {
'id': '',
'code': this.currentdata[0].code,
'name': this.currentdata[0].name,
btDesc: this.currentdata[0].btDesc,
'url': this.currentdata[0].url
}
this.adData['rescBtnList'].push(JSON.parse(JSON.stringify(obj)))
},
//表格新增
addList() {
if (!this.rescBtnListFlag) {
this.rescBtnListFlag = true;
}
var Length = this.adData['rescBtnList'].length
var ObjectData = {
'id': '',
'code': '',
'name': '',
btDesc: '',
'url': ''
}
if (Length == 0) {
this.adData['rescBtnList'].push(ObjectData)
} else {
this.adData['rescBtnList'].push(ObjectData)
}
},
//表格删除
deleteList() {
let IdList = []
if (this.currentdata.length == 0) {
this.$message({
type: 'warning',
message: '请选择一条或多条数据进行删除'
})
return
}
if (!this.rescBtnListFlag) {
this.rescBtnListFlag = true;
}
this.currentdata.forEach(item => {
IdList.push(item.id)
})
let lengthAll = this.adData['rescBtnList'].length
let Length = this.currentdata.length
this.$confirm('此操作将删除该选项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
for (var i = lengthAll - 1; i >= 0; i--) {
for (var j = Length - 1; j >= 0; j--) {
if (this.currentdata[j] == this.adData['rescBtnList'][i]) {
this.adData['rescBtnList'].splice(i, 1)
}
}
}
this.$Http.post(this.uploadUrl + '/resources/delBtn', IdList).then((data) => {
var result = data.body
if (result.code == '000000') {
this.$message({
message: '删除成功!',
type: 'success'
})
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
}).catch(() => {
this.IdList = []
})
},
renderContent() {
var createElement = arguments[0]
var level = arguments[1].node.level
if (level == 1) {
return createElement('span', [
createElement('img', {
attrs: {
src: './static/icon_Folder01.png',
style: 'vertical-align: middle'
}
}),
createElement('span', ''),
createElement('span', arguments[1].node.label)
])
} else {
return createElement('span', [
createElement('img', {
attrs: {
src: './static/icon_file01.png',
style: 'vertical-align: middle'
}
}),
createElement('span', ''),
createElement('span', arguments[1].node.label)
])
}
},
//点击菜单
nodeClick(dataObj, Node) {
this.rescBtnListFlag = false;
this.dataObj = dataObj
this.nodeId = dataObj.id
this.pId = dataObj.pid
this.sysId = dataObj.sysid
this.lesseeId = this.dataObj.lesseeid
if (dataObj.id) {
this.detail = true
this.addmenuteam = false
this.addmenu = false
this.nodeDetail()
}
},
//节点点击详情 按钮列表
nodeDetail() {
this.$http.get(this.uploadUrl + '/resources/findButtons', {
params: {
id: this.nodeId
}
})
.then((data) => {
var result = data.body
if (result.code == '000000') {
// debugger
console.log(this.dataObj)
this.pData.rescBtnList = result.data
this.pData.name = this.dataObj.name
this.pData.code = this.dataObj.code
this.pData.menuType = this.dataObj.menutype;
this.pData.display_flag = this.dataObj.display_flag + ''; //传递过去时是数字,要转字符串
this.pData.sourceSystem = this.dataObj.sourcesystem
this.pData.recDesc = this.dataObj.recdesc
this.pData.url = this.dataObj.url
this.pData.pid = this.dataObj.pid
this.pData.sysname = this.dataObj.sysname
this.pData.pname = this.dataObj.pname
this.pData.orderBy = this.dataObj.orderby
this.sysId = this.dataObj.sysid
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
//1.查询菜单与数维的关系
this.$http.get(this.uploadUrl + '/auth/queryRescDim', {
params: {
rescId: this.nodeId
}
})
.then((data) => {
var result = data.body
if (result.code == '000000') {
let dataAccess = []
result.data.forEach(element => {
if (element.dimCode == 'company') {
this.jigouId = element.id;
this.jigouKey = element.isolationKey;
element.chooseStatus == '已选中' ? dataAccess.push("机构") : ''
}
if (element.dimCode == 'busiLine') {
this.yewuxianId = element.id;
this.yewuxianKey = element.isolationKey;
element.chooseStatus == '已选中' ? dataAccess.push("业务线") : ''
}
if (element.dimCode == 'riskType') {
this.riskId = element.id;
this.riskKey = element.isolationKey;
element.chooseStatus == '已选中' ? dataAccess.push("风险类型") : ''
}
});
this.pData.dataAccess = dataAccess;
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
},
//启用菜单
CreatMenu() {
if (this.$refs.tree2.getCheckedNodes()[0] == undefined) {
this.$message({
type: 'warning',
message: '请选择节点进行启用'
})
return
} else {
for (var i = 0; i < this.$refs.tree2.getCheckedNodes().length; i++) {
if (this.$refs.tree2.getCheckedNodes()[i].status == 1) {
this.$message({
type: 'warning',
message: '只能选择无效的节点进行禁用'
})
return
}
}
this.checkedId = []
this.$refs.tree2.getCheckedNodes().forEach(item => {
this.checkedId.push(item.id)
})
}
this.$confirm('此操作将启用该节点, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.post(this.uploadUrl + '/resources/enableResc', this.checkedId)
.then((data) => {
var result = data.body
if (result.code == '000000') {
this.$message({
type: 'success',
message: '启用成功'
})
this.treeInt()
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
}).catch(() => {
})
},
//禁用菜单
deleteMenu() {
if (this.$refs.tree2.getCheckedNodes()[0] == undefined) {
this.$message({
type: 'warning',
message: '请选择节点进行禁用'
})
return
} else {
for (var i = 0; i < this.$refs.tree2.getCheckedNodes().length; i++) {
if (this.$refs.tree2.getCheckedNodes()[i].status == 0) {
this.$message({
type: 'warning',
message: '只能选择有效的节点进行禁用'
})
return
}
}
this.checkedId = []
this.$refs.tree2.getCheckedNodes().forEach(item => {
this.checkedId.push(item.id)
})
}
this.$confirm('禁用本菜单,若其存在子节点也会被禁用,请确认是否禁用?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.post(this.uploadUrl + '/resources/disableResc', this.checkedId)
.then((data) => {
var result = data.body
if (result.code == '000000') {
this.treeInt()
this.$message({
type: 'success',
message: '禁用成功'
})
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
}).catch(() => {
})
},
//切换新增菜单分组
addMenuTeam() {
this.menuteam = {
'flg': 0,
'name': '',
'code': '',
'openType': 0,
'orderBy': '',
'pid': '',
menuType: 1,
sourceSystem: '',
dataAccess: ['机构'], //配置数据权限
display_flag: '0', //展示终端
'recDesc': '',
'status': '1',
'sysId': '',
'url': ''
},
this.menuname = this.pData.pname
this.menuteam.pid = this.nodeId
this.menuteam.sysId = this.sysId
this.$Http.post(this.uploadUrl + '/resources/findSysForSel', {}).then((data) => {
var result = data.body
if (result.code == '000000') {
this.sysList = result.data
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
this.addmenu = false
this.detail = false
this.addmenuteam = true
},
//关闭新建分组菜单
closeaddmenuteam() {
this.addmenuteam = false
this.detail = true
},
//清理分组菜单
clearmenuteam() {
this.menuteam.pid = ''
this.menuteam.recdesc = ''
this.menuteam.sysId = ''
this.menuteam.url = ''
},
//保存新建分组菜单
saveaddmenuteam(_, enable) {
if (this.nodeId == '') {
this.menuteam.pid = -1
}
if (this.menuteam.name == '') {
this.$message({
type: 'warning',
message: '菜单名称不能为空'
})
return enable();
}
this.$Http.post(this.uploadUrl + '/resources/newParentResc', this.menuteam).then((data) => {
var result = data.body
enable();
if (result.code == '000000') {
this.addmenuId = result.data.id
this.saveDataAcessTeam()
this.closeaddmenuteam()
this.treeInt()
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
}).catch(data => {
enable()
})
},
//切换新增菜单
addMenu() {
this.eidt = false
this.eddteammenu = this.pData.name
this.adData = {
'flg': 0,
'name': '',
'openType': 0,
'orderBy': '',
'pid': '',
'recDesc': '',
dataAccess: ['机构'],
display_flag: '0',
'rescBtnList': [],
'rescInterFaceList': [{
resId: '',
lesseeId: '',
type: '',
url: '',
id: '',
description: '',
}],
'menuType': 1,
sourceSystem: '',
'status': '1',
'sysId': '',
'url': ''
}
if (this.pId == '') {
this.$message({
type: 'warning',
message: '请选择节点进行新增'
})
return
}
this.adData.sysId = this.sysId
this.adData.pid = this.nodeId
this.addmenu = true
this.addmenuteam = false
this.detail = false
},
//关闭新建菜单
closeaddMenu() {
let data = this.pData
for (var prop in this.pData) {
if (this.pData[prop] instanceof Array) {
this.pData[prop] = [];
// this.pData[prop].forEach(item => {
// for (var i in item) {
// item[i] = ''
// }
// })
} else {
this.pData[prop] = ''
}
}
this.nodeDetail()
this.addmenu = false
this.detail = true
this.addmenuteam = false
this.rescBtnListFlag = false;
},
//保存新建菜单
saveaddMenu(_, enable) {
let p_url
if (this.adData.name == '') {
this.$message.warning('菜单名称不能为空')
return enable();
}
// if (this.adData.url == '') {
// this.$message.warning('页面URL不能为空')
// return enable();
// }
if (this.eidt) {
p_url = 'editResc'
} else {
p_url = 'newResc'
}
// this.adData.pid = this.nodeId
this.offBtn = 0
for (var key in this.adData.rescBtnList[0]) {
if (this.adData.rescBtnList[0][key] == '') {
this.offBtn++
}
}
// <-- 能否去掉判断
if (this.offBtn == 5) {
this.$message({
type: 'warning',
message: '按钮列表选项不能全为空'
})
return enable();
}
// -->
let params = {
code: this.adData.code,
dataAccess: this.adData.dataAccess,
display_flag: parseInt(this.adData.display_flag),
flg: this.adData.flg,
id: this.adData.id,
menuType: this.adData.menuType,
name: this.adData.name,
openType: this.adData.openType,
pid: this.adData.pid,
pname: this.adData.pname,
recDesc: this.adData.recDesc,
rescBtnList: this.adData.rescBtnList,
rescInterFaceList: this.adData.rescInterFaceList,
sourceSystem: this.adData.sourceSystem,
status: this.adData.status,
sysId: this.adData.sysId,
sysname: this.adData.sysname,
orderBy: this.adData.orderBy == undefined ? '': this.adData.orderBy,
url: this.adData.url
}
this.$Http.post(this.uploadUrl + '/resources/' + p_url, params).then((data) => {
var result = data.body
enable();
if (result.code == '000000') {
this.addmenuteam = false
this.addmenuId = result.data.id
this.addmenu = false
this.detail = true
this.rescBtnListFlag = false;
this.saveDataAcess() //新增要获取新的id所有要异步后调用。
this.saveRelativeResources()
this.treeInt()
this.dataObj.name = this.adData.name,
this.dataObj.code = this.adData.code,
this.dataObj.menutype = this.adData.menuType,
this.dataObj.sourcesystem = this.adData.sourceSystem,
this.dataObj.recdesc = this.adData.recDesc,
this.dataObj.url = this.adData.url
this.dataObj.pid = this.adData.pid,
this.dataObj.sysname = this.adData.sysname,
this.dataObj.pname = this.adData.pname,
this.dataObj.orderby = this.adData.orderby,
this.dataObj.sysid = this.adData.sysId,
this.dataObj.display_flag = parseInt(this.adData.display_flag); //更新一下原来的这个数据。
this.nodeClick(this.dataObj); //刷新预览的详情。
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
}).catch(data => {
enable()
});
},
//请求菜单接口
getRelativeResourcesForSel() {
console.log(this.lesseeId)
this.$Http.get(this.uploadUrl + '/resources/getRelativeResources?resourceId=' + this.nodeId + '&type=1' + '&lesseeId=' + this.lesseeId).then((data) => {
var result = data.body
if (result.code == '000000') {
this.pData.rescInterFaceList = result.data
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
},
saveDataAcess(){
if (this.adData.dataAccess.includes("机构")) {
this.dimList.push({
id: this.eidt ? this.jigouId : null,
dimCode: 'company',
status: '1',
isolationKey: this.jigouKey,
})
} else {
this.dimList.push({
id: this.eidt ? this.jigouId : null,
dimCode: 'company',
status: '0',
isolationKey: this.jigouKey,
})
}
if (this.adData.dataAccess.includes("业务线")) {
this.dimList.push({
id: this.eidt ? this.yewuxianId : null,
dimCode: 'busiLine',
status: '1',
isolationKey: this.yewuxianKey,
})
} else {
this.dimList.push({
id: this.eidt ? this.yewuxianId : null,
dimCode: 'busiLine',
status: '0',
isolationKey: this.yewuxianKey,
})
}
if (this.adData.dataAccess.includes("风险类型")) {
this.dimList.push({
id: this.eidt ? this.riskId : null,
dimCode: 'riskType',
status: '1',
isolationKey: this.riskKey,
})
} else {
this.dimList.push({
id: this.eidt ? this.riskId : null,
dimCode: 'riskType',
status: '0',
isolationKey: this.riskKey,
})
}
let params3 = {
rescId: this.eidt?this.nodeId:this.addmenuId,
dimList: this.dimList
}
this.$Http.post(this.uploadUrl + '/auth/saveRescDim', params3).then((data) => {
var result = data.body
// enable();
if (result.code == '000000') {
this.dimList = [];
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
}).catch(data => {
// enable()
});
},
saveDataAcessTeam(){
if (this.menuteam.dataAccess.includes("机构")) {
this.dimList.push({
id: this.eidt ? this.jigouId : null,
dimCode: 'company',
status: '1',
isolationKey: this.jigouKey,
})
} else {
this.dimList.push({
id: this.eidt ? this.jigouId : null,
dimCode: 'company',
status: '0',
isolationKey: this.jigouKey,
})
}
if (this.menuteam.dataAccess.includes("业务线")) {
this.dimList.push({
id: this.eidt ? this.yewuxianId : null,
dimCode: 'busiLine',
status: '1',
isolationKey: this.yewuxianKey,
})
} else {
this.dimList.push({
id: this.eidt ? this.yewuxianId : null,
dimCode: 'busiLine',
status: '0',
isolationKey: this.yewuxianKey,
})
}
if (this.menuteam.dataAccess.includes("风险类型")) {
this.dimList.push({
id: this.eidt ? this.riskId : null,
dimCode: 'riskType',
status: '1',
isolationKey: this.riskKey,
})
} else {
this.dimList.push({
id: this.eidt ? this.riskId : null,
dimCode: 'riskType',
status: '0',
isolationKey: this.riskKey,
})
}
let params = {
rescId: this.addmenuId, //这里不存在编辑情况。
dimList: this.dimList
}
this.$Http.post(this.uploadUrl + '/auth/saveRescDim', params).then((data) => {
var result = data.body
// enable();
if (result.code == '000000') {
this.dimList = [];
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
}).catch(data => {
// enable()
});
},
//保存菜单的菜单接口
saveRelativeResources() {
//去掉空值
for (var m = 0; m < this.adData.rescInterFaceList.length; m++) {
if (this.adData.rescInterFaceList[m].url == '' || this.adData.rescInterFaceList[m].url == null || typeof (this.adData.rescInterFaceList[m].url) == undefined) {
this.adData.rescInterFaceList.splice(m, 1)
m = m - 1
}
}
this.adData.rescInterFaceList.forEach(item => {
item.resId = this.nodeId
item.lesseeId = this.lesseeId
item.type = 1
})
this.$Http.post(this.uploadUrl + '/resources/addRelativeResources', {
'relativeResources': this.adData.rescInterFaceList
}).then((data) => {
var result = data.body
if (result.code == '000000') {
this.$message({
message: '保存成功!',
type: 'success'
})
//fixed bug IFIN-MDM#1231 新增后修改接口后,出现了修改前后的数据
//this.nodeDetail()
//fixed bug IFIN-MDM#2105 新增菜单组/菜单后,未刷新界面; 现在不直接请求nodeDetail() 而是直接请求下面方法
this.getRelativeResourcesForSel()
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
.catch(() => {})
},
//遍历树置灰节点
childTree(treeArr) {
var _this = this
var arr1 = treeArr
arr1.forEach((item, index) => {
this.checkedId.forEach(otem => {
if (item.id == otem) {
arr1.splice(index)
}
})
if (item.child.length != 0) {
_this.childTree(item.child)
} else {
return
}
})
},
clearClode() {
this.menuteam.pid = -1
this.menuname = ''
this.sysable = false
},
//切换所属系统
changeSys(val) {
console.log(val)
this.sysId = val.id
this.lesseeId = val.lesseeId
this.treeInt()
this.sysList.forEach(item => {
if (item.id == this.sysId) {
this.sysName = item.name
}
})
},
handleCommandGet(command) {
this.commandget = command
if (this.commandget == '生效') {
this.status = 1
} else {
this.status = ''
}
this.treeInt()
},
// childpid(data,fid){
// var _this = this;
// var arr1 = data;
// var findid = fid;
// var orderlist =[];
// arr1.forEach((item,index)=>{
// if(item.id == findid){
// console.log(item)
// for(var i=0;i<item.child.length;i++){
// orderlist.push(item.child[i].id)
// }
// console.log(orderlist)
// }
// if(item.child.length != 0){
// _this.childpid(item.child,fid)
// }else{
// return;
// }
// })
// }
isChecked() {
$('.tree .is-focus').addClass('is-checked')
},
addClassColor() {
$('.tree .el-checkbox__input')
.parent()
.parent()
.removeClass('addColor')
$('.tree .is-disabled')
.parent()
.parent()
.addClass('addColor')
// $('.addColor').css({color: '#999'})
$('.tree .is-disabled')
.children('input')
.removeAttr('disabled')
},
chooseDisabled(arr) {
var _this = this
var arr1 = arr
arr1.forEach(item => {
if (item.status == 0) {
item['disabled'] = true
item.name = item.name + '(失效)'
_this.$nextTick(() => {
_this.addClassColor()
})
}
if (item.child) {
_this.chooseDisabled(item.child)
}
})
return arr
},
//子系统接入(新增/编辑)功能
//新增
addSystem() {
this.dialogVisible_one = true
},
//新增关闭
closed() {
this.dialogVisible_one = false
},
//新增保存
saveadddialog() {
this.closed()
this.$Http.post(this.uploadUrl + '/resources/findSysForSel', {}).then((data) => {
var result = data.body
if (result.code == '000000') {
this.sysList = result.data
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
},
//编辑
changeSystem() {
if (this.sysList) {
this.dialogVisible_two = true
} else {
this.$message({
showClose: true,
message: '登录超时',
type: 'warning',
duration: 5000
})
}
},
// 编辑关闭
closedchange() {
this.dialogVisible_two = false
},
// 编辑保存
saveclosedialog(msg) {
this.closedchange()
this.sysInt(msg)
},
//接口权限限制部分
addIFList() {
var Length2 = this.adData['rescInterFaceList'].length
var InterFaceData = {
resId: '',
lesseeId: '',
type: '',
url: '',
id: '',
description: '',
}
if (Length2 == 0) {
this.adData['rescInterFaceList'].push(InterFaceData)
} else {
this.adData['rescInterFaceList'].push(InterFaceData)
}
},
deleteIFList() {
let IdList = []
if (this.currentifdata.length == 0) {
this.$message({
type: 'warning',
message: '请选择一条或多条数据进行删除'
})
return
}
this.currentifdata.forEach(item => {
IdList.push(item.id)
})
let lengthAll = this.adData['rescInterFaceList'].length
let Length = this.currentifdata.length
this.$confirm('此操作将删除该选项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
for (var i = lengthAll - 1; i >= 0; i--) {
for (var j = Length - 1; j >= 0; j--) {
if (this.currentifdata[j] == this.adData['rescInterFaceList'][i]) {
this.adData['rescInterFaceList'].splice(i, 1)
}
}
}
//去掉空值
for (var m = 0; m < IdList.length; m++) {
if (IdList[m] == '' || IdList[m] == null || typeof (IdList[m]) == undefined) {
IdList.splice(m, 1)
m = m - 1
}
}
if (IdList === 'undefined' || IdList.length == 0) {
return
}
if (IdList) {
this.$Http.get(this.uploadUrl + '/resources/deleteRelativeResources?ids=' + IdList).then((data) => {
var result = data.body
if (result.code == '000000') {
this.$message({
message: '删除成功!',
type: 'success'
})
} else {
this.$message({
showClose: true,
message: result.message,
type: 'error',
duration: 5000
})
}
})
}
}).catch(() => {
this.IdList = []
})
},
handleClick(val) {
this.dialogTableVisible_interFace = true
this.btnId = val.id
this.lesId = this.lesseeId
console.log(this.lesId)
},
closedIF() {
this.dialogTableVisible_interFace = false
},
//菜单的导入
getIn() {
this.dialogGetIn = true;
this.importUrl = '/resources/importResources', //提交地址
this.downloadUrl = '/template/template4ResourcesImport/downloadTemplate' //下载模板地址
},
//导入成功 重新刷新树
closeImportFile() {
this.dialogGetIn = false;
this.treeInt();
},
//取消导入 返回index.vue页面
cancelImportFile() {
this.dialogGetIn = false;
},
//菜单的导出
getOut() {
var option = {
url: this.uploadUrl + '/resources/exportResources',
data: {
resources: {
"sysId": this.sysId,
}
},
method: 'post'
};
downLoadFile(option);
},
proving2() {
this.menuteam.orderBy = this.menuteam.orderBy.replace(/[^\-\.\d]/g, '');
this.menuteam.orderBy = this.menuteam.orderBy.replace('.', '');
let i = this.menuteam.orderBy.length - 1;
if (i != 0 && this.menuteam.orderBy[i] == '-') {
this.menuteam.orderBy = this.menuteam.orderBy.slice(0, i);
}
},
proving3() {
this.adData.orderBy = this.adData.orderBy.replace(/[^\-\.\d]/g, '');
this.adData.orderBy = this.adData.orderBy.replace('.', '');
let i = this.adData.orderBy.length - 1;
if (i != 0 && this.adData.orderBy[i] == '-') {
this.adData.orderBy = this.adData.orderBy.slice(0, i);
}
}
}
}