版本2.0更新

This commit is contained in:
yunian
2022-06-20 14:03:57 +08:00
parent 50563d3815
commit 64981a609e
253 changed files with 66927 additions and 1 deletions

View File

@@ -0,0 +1,133 @@
export const GetdeepObj = (obj, length = true ,first=false) => {
if (typeof obj == 'object' && !Array.isArray(obj)) {
let arr = []
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
if (Array.isArray(obj[key])) {
let obj2 = {
value: key,
label: key,
}
obj2.children = []
if (length) {
obj2.children.push({
value: 'length()',
label: '长度',
valueType: 1,
})
}
if (first&&obj[key][0]) {
obj2.children.push({
value: '[]',
label: '第一项',
children: GetdeepObj(obj[key][0], length,first)
})
}
arr.push(obj2)
} else if (typeof obj[key] == 'object' && obj[key] != null) {
arr.push({
value: key,
label: key,
children: GetdeepObj(obj[key], length,first)
})
} else {
arr.push({
value: key,
label: key,
valueType: typeof obj[key] == 'string' ? 2 : 1,
})
}
}
}
return arr
} else if (Array.isArray(obj)) {
let obj = []
if (length) {
obj.push({
value: 'length()',
label: '长度',
valueType: 1,
})
}
if (first&&obj[0]) {
obj.push({
value: '[0]',
label: '第一项',
children: GetdeepObj(obj[0], length,first)
})
}
return obj
}
}
export const deepexamine = (is, arr, index = 1) => {
arr.forEach(value => {
if (value.children && value.children.length > 0) {
deepexamine(is, value.children, index + 1)
}
if (value.conditionType == 2) {
if (!value.fieldId) {
is.is = true
is.msg = '请选择 条件 的 入Key'
}
if (!value.operator) {
is.is = true
is.msg = '请选择 条件 的 运算符'
}
if (!value.variableValue || !value.variableValue.trim()) {
is.is = true
is.msg = '请选择 条件 的 值'
}
}
if (value.conditionType == 1 && value.children.length == 0 && index != 1) {
is.is = true
is.msg = '关系符下不允许为空'
}
})
}
export const ruleEnformat = (arr, str) => {
deepformat(arr)
function deepformat(arr) {
arr.forEach(value => {
if (value.children && value.children.length > 0) {
deepformat(value.children)
}
if (value.conditionType == 2) {
value.fieldId = getformat(value.fieldId)
if (value.variableType == 2) {
value.variableValue = getformat(value.variableValue)
}
}
})
}
function getformat(arr) {
if (str == "String") {
// debugger
return arr.join('.')
} else {
return arr.split('.')
}
}
}

View File

@@ -0,0 +1,15 @@
import verification from "../class/index.js"
export default [
// ( Key 显示名称 类型 默认值 是否禁用 枚举 是否折叠 显示fn)
// new verification("autoTradeType", "下单方式", 'Enum',2,false,[{label:'基差',value:0},{label:'收益率',value:1},{label:'年化收益率',value:2}],true,null),
new verification("businessName", "业务类型", String, "", false,null,false,null),
new verification("businessCode", "业务类型编码", String, "", false,null,false,null),
new verification("businessChildName", "业务子类型", String, "", false,null,false,null),
new verification("businessChildCode", "业务子类型编码", String, "", false,null,false,null),
new verification("sendType", "发送方式", 'Enum', "AUTO", false,[{label:'自动',value:'AUTO'},{label:'手动',value:'MANUAL'}],false,null),
new verification("isUnsubscribe", "是否取消订阅", 'Enum', "NO", false,[{label:'是',value:'YES'},{label:'否',value:'NO'}],false,null),
new verification("eventType", "事件类型", 'Enum', "NOTICE", false,[{label:'通知',value:'NOTICE'},{label:'待办',value:'PENDING'},{label:'系统类',value:'SYSTEM'}],false,null),
new verification("backlog", "待办任务", String, "", false,null,false,null),
new verification("isManualIntervention", "是否需要人工干预", 'Enum', "NO", false,[{label:'是',value:'YES'},{label:'否',value:'NO'}],false,null),
]

View File

@@ -0,0 +1,15 @@
export default class verification {
constructor(name, label, type, defaultValue, disable,Enum,fold,showfn) {
this.name = name;
this.label = label;
this.type = type;
this.defaultValue = defaultValue;
this.disable = disable;
this.Enum = Enum;
this.fold = fold;
this.showFn=showfn
}
}

View File

@@ -0,0 +1,20 @@
import bus from '@/components/common/bus.js';
export default {
created(){
bus.$emit('collapseHeader',true)
},
data(){
return {
smallHeader:false
}
},
methods:{
openHeader(){
this.smallHeader = !this.smallHeader
},
mixinClose(){
this.$emit('close')
bus.$emit('collapseHeader',false)
}
}
}

View File

@@ -0,0 +1,385 @@
export default {
data() {
return {
}
},
created() {
},
computed: {
showRight() {
if (this.currid) {
return true
} else {
return false
}
},
listunfold() {
let arr = []
this.deepGetListunfold(this.list, arr)
console.log(arr)
return arr
}
},
mounted() {},
methods: {
deepGetListunfold(list, arr) {
list.forEach(value => {
arr.push(value)
if (value.children.length > 0) {
this.deepGetListunfold(value.children, arr)
}
})
},
mixnewFileZindexVerify(arr,id){
let ZIndex = 1
b(arr)
function b(arr){
console.log(arr)
arr.forEach(value=>{
if(value.id==id){
ZIndex = value.ZIndex
}
if(value.children.length>0){
b(value.children)
}
})
}
return ZIndex
},
mixnewFileSure(params) {
let is = false
let parentId = params.parentId
let tempId = this.currid
if (this.tempNewF.trim() == "") {
this.$message.error('文件夹名不能为空');
this.leftloading = false
return
}
this.tempNewF = this.tempNewF.trim()
this.deepGetCurr(parentId, this.list, (value) => {
value.children.forEach(item => {
if (item.name == params.name || item.name == params.fieldType) {
is = true
}
})
})
// 验证重名
if (is) {
this.$message.error('同一文件夹下不允许同名');
this.leftloading = false
return
}
if (params.parentId == "99999999") {
params.parentId = "0"
}
this.getData.addlist(params).then((res) => {
if (res.status === "1") {
this.$message({
message: '添加成功',
type: 'success'
});
this.leftloading = false
this.deepGetCurr(parentId, this.list, (value) => {
value.children.push({
ZIndex: value.ZIndex + 1,
name: this.tempNewF,
id: res.data.fieldTypeId || res.data.node.id,
open: false,
show: value.open,
Rename: false,
parentId: parentId,
children: []
})
})
}
this.newf = false
this.tempNewF = ""
}).catch(() => {
this.$message.error("请求失败了" + '-_-');
this.leftloading = false
})
},
using(id) {
let arr = this.selection.map((value) => {
return value.id
})
if (arr.length < 1) {
this.$message.error('未选择任何文件');
return
}
let params = {
status: id,
ids: arr.join(','),
nameId: this.currid
}
this.getData.fieldusing(params).then(res => {
if (res.status == "1") {
this.$message({
message: '操作成功',
type: 'success'
});
if (this.getData.type == 1 || this.getData.type == 2) {
this.$store.dispatch('reGetRuleList')
}
this.getlist()
this.selection = []
}
})
},
clickCurrid(id) {
this.currid = id
this.currPage = 1
this.listRedact = false;
this.tempRedactId = 0
this.selection = []
let tempIs = false
this.list.forEach(value => {
if (value.id === id && value.Rename) {
tempIs = true
}
})
if (!tempIs) {
this.RenameFun()
}
this.getlist()
this.deepGetCurr(id, this.list, deepSetCurr)
// 递归寻找文件夹
// 打开关闭文件夹
function deepSetCurr(obj) {
if (obj.open) {
// 关闭文件夹
obj.open = false
deepCloseFile(obj)
} else {
// 打开文件夹
obj.open = true
obj.children.forEach(value => {
value.show = true
})
}
}
function deepCloseFile(obj) {
if (obj.children.length > 0) {
obj.children.forEach(value => {
value.show = false
deepCloseFile(value)
})
}
}
},
deepGetCurr(id, item, fn, fn2) {
item.forEach((value, index) => {
if (value.id == id) {
fn(value, item, index)
} else {
if (fn2) {
fn2(value, item, index)
}
if (value.children.length > 0) {
this.deepGetCurr(id, value.children, fn, fn2)
}
}
})
},
listTreeDeep(item, num) {
let arr = item.map((value) => {
return {
id: value.id,
parentId: value.parentId,
name: value.name || value.fieldType,
ZIndex: num,
open: false,
show: num === 1 ? true : false,
Rename: false,
children: this.listTreeDeep(value.children, num + 1)
}
})
return arr
},
RenameFun(id) {
this.deepGetCurr(id, this.list, (value) => {
value.Rename = true
}, (value) => {
value.Rename = false
})
},
newFile() {
if (!this.currid) {
this.$message({
message: '请先选择左侧文件夹',
type: 'warning'
});
} else {
this.newf = true
}
},
RenameClose() {
this.deepGetCurr(0, this.list, () => {}, (value) => {
value.Rename = false
})
},
updatafilelist(params) {
this.leftloading = true
let tempNum = null
this.deepGetCurr(params.id, this.list, (value) => {
tempNum = value.parentId
})
params.parentId = tempNum == 99999999 ? 0 : tempNum
tempNum = null
this.getData.updatalist(params).then(res => {
if (res.status === "1") {
this.$message({
message: '修改成功',
type: 'success'
});
this.deepGetCurr(params.id, this.list, (value) => {
value.name = params.name
value.Rename = false
})
this.leftloading = false
} else {
this.leftloading = false
}
}).catch(() => {
this.$message.error("请求失败了" + '-_-');
this.leftloading = false
})
},
delectFun(id) {
let name
let parentId
this.deepGetCurr(id, this.list, (value) => {
name = value.name
parentId = value.parentId
})
let params = {
status: "-1",
id: id,
name: name,
"type": "1",
"engineId": "",
"parentId": parentId == 99999999 ? 0 : parentId
}
this.getData.updatalist(params).then(res => {
if (res.status === "1") {
this.$message({
type: 'success',
message: '删除成功!'
});
this.deepGetCurr(id, this.list, (value, item, index) => {
item.splice(index, 1)
})
}
this.leftloading = false
this.currid = 99999999
this.getlist()
}).catch(() => {
this.$message.error("请求失败了" + '-_-');
this.leftloading = false
})
},
dialogShow(id) {
this.tempRedactId = id
this.listRedact = true
},
select(selection) {
this.selection = selection
},
selectAll(selection) {
this.selection = selection
},
fileRight(e, item) {
this.tempHintLeft = e.x
this.tempHintTop = e.y
this.tempId = item.id
},
beforeUpload(file) {
console.log(file, '文件');
this.files = file;
const extension = file.name.split('.')[1] === 'xls'
const extension2 = file.name.split('.')[1] === 'xlsx'
const isLt2M = file.size / 1024 / 1024 < 5
if (!extension && !extension2) {
this.$message.warning('上传模板只能是 xls、xlsx格式!')
return
}
if (!isLt2M) {
this.$message.warning('上传模板大小不能超过 5MB!')
return
}
this.fileName = file.name;
return false // 返回false不会自动上传
},
submitUpload() {
this.Uploadloading = true
console.log('上传' + this.files.name)
if (this.fileName == "") {
this.$message.warning('请选择要上传的文件!')
this.Uploadloading = false
return false
}
let fileFormData = new FormData();
fileFormData.append('file', this.files); //filename是键file是值就是要传的文件test.zip是要传的文件名
this.getData.fieldsubmit(fileFormData).then(res => {
if (res.status === "1") {
this.callbackresult = res.data
this.upCallbackShow = true
this.upShowClose()
this.getlist()
this.$store.dispatch('reGetRuleList')
this.$store.dispatch('reGetfielduser')
}
this.Uploadloading = false
})
},
upShowClose() {
this.upShow = false
}
}
}

View File

@@ -0,0 +1,55 @@
import ElementUI from 'element-ui';
export function endRuleVerification(obj){
let is= {
is:false,
msg:''
}
if(!obj.selectedRule.length){
return false
}
if(obj.output.fieldId===''){
is.is = true
is.msg = '请选择终止结果变量'
}
if(obj.output.fieldValue===''){
is.is = true
is.msg = '请填写终止结果的输出值'
}
obj.conditions.forEach((value,index)=>{
if(value.fieldCode===''){
is.is = true
is.msg ='请查看是否有终止选项未选'
}
if(value.operator===''){
is.is = true
is.msg ='请查看是否有运算符未选'
}
if(value.value===''){
is.is = true
is.msg ='请查看是否有终止值未填写'
}
if(value.relativeOperator===''&&index!=obj.conditions.length-1){
is.is = true
is.msg ='请查看是否连接符未选'
}
})
if(is.is){
ElementUI.Message.error(is.msg)
}
return is.is
}

View File

@@ -0,0 +1 @@
export const iframeurl = window.location.protocol+'//'+window.location.host;

View File

@@ -0,0 +1,43 @@
export default {
e: [{
title: '数据中心',
'http://ex.fibo.cn/': 'http://dx.fibo.cn',
'http://ex.demo.fibo.cn/': 'http://dx.demo.fibo.cn',
'http://47.102.125.25/': 'http://47.102.125.25:81'
},
{
title: '权限系统',
'http://ex.fibo.cn/': 'http://ax.fibo.cn',
'http://ex.demo.fibo.cn/': 'http://ax.demo.fibo.cn',
'http://47.102.125.25/': 'http://47.102.125.25:82'
},
],
d: [{
title: '决策平台',
'http://dx.fibo.cn/': 'http://ex.fibo.cn',
'http://dx.demo.fibo.cn/': 'http://ex.demo.fibo.cn',
'http://47.102.125.25:81/': 'http://47.102.125.25'
},
{
title: '权限系统',
'http://dx.fibo.cn/': 'http://ax.fibo.cn',
'http://dx.demo.fibo.cn/': 'http://ax.demo.fibo.cn',
'http://47.102.125.25:81/': 'http://47.102.125.25:82'
},
],
a: [{
title: '决策平台',
'http://ax.fibo.cn/': 'http://ex.fibo.cn',
'http://ax.demo.fibo.cn/': 'http://ex.demo.fibo.cn',
'http://47.102.125.25:82/': 'http://47.102.125.25'
},{
title: '数据中心',
'http://ax.fibo.cn/': 'http://dx.fibo.cn',
'http://ax.demo.fibo.cn/': 'http://dx.demo.fibo.cn',
'http://47.102.125.25:82/': 'http://47.102.125.25:81'
},
]
}

View File

@@ -0,0 +1,258 @@
export default {
install(Vue) {
Vue.mixin({
data() {
return {
mixinlogical: [{
value: '&&',
label: 'AND'
},{
value: '||',
label: 'OR'
}]
}
},
created() {
},
computed: {
FieldUserObj() {
return this.$store.state.FieldUserObj ? this.$store.state.FieldUserObj.data.fieldList : []
},
FieldUser() {
return this.$store.state.FieldUser ? this.$store.state.FieldUser.data.fieldList : []
},
Sourcelist() {
return this.$store.state.Sourcelist ? this.$store.state.Sourcelist:[]
}
},
mounted() {},
methods: {
randomAdd(item,is) {
if(is||!item){
return
}
if (item.random) {
setTimeout(() => {
item.random++
}, 200)
} else {
// item.random=1
setTimeout(() => {
this.$set(item, 'random', 1)
}, 200)
}
},
verificationCode(str){
let z = /^(?!_)(?!.*?_$)[a-zA-Z0-9_]+$/
if(!z.test(str)){
this.$message.error('Code只允许使用 字母 数字 下划线 且不能以下划线开头')
return true
}
return false
},
verificationName(str){
let z = /^(?!_)(?!.*?_$)[a-zA-Z0-9_\u4e00-\u9fa5]+$/
if(!z.test(str)){
this.$message.error('名称只允许使用 中文 字母 数字 下划线 且不能以下划线开头')
return true
}
return false
},
mixinSaveJSON(data, filename){
if(!data) {
this.$message.error('保存的数据为空');
return;
}
if(!filename)
filename = 'json.json'
if(typeof data === 'object'){
data = JSON.stringify(data, undefined, 4)
}
var blob = new Blob([data], {type: 'text/json'}),
e = document.createEvent('MouseEvents'),
a = document.createElement('a')
a.download = filename
a.href = window.URL.createObjectURL(blob)
a.dataset.downloadurl = ['text/json', a.download, a.href].join(':')
e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)
a.dispatchEvent(e)
},
mixinGetValueTypeByJSONEn(e){
if(!e||e.length==0) return
if(!Array.isArray(e)) e=e.split('.')
let obj =this.FieldUserObj
e.forEach((value,index)=>{
if(index) obj = obj['children']
obj = obj.find(x=>x.value==value)
})
return obj.valueType
},
mixinGetValueByCn(e) {
let num = this.FieldUser.find(x=>x.fieldCn===e)
// this.FieldUser.forEach(value => {
// if (value.fieldCn === e) {
// num = value
// }
// })
return num
},
mixinReGetStorage(){
this.$store.dispatch('reGetfielduser')
this.$store.dispatch('reGetRuleList')
Object.keys(this.$store.state.cacheList).forEach(value=>{
this.$store.dispatch('regetcache', value)
})
},
mixinGetLogical(str){
let num = this.mixinlogical.find(x=>x.value===str)
// this.mixinlogical.forEach(value=>{
// if(str==value.value){
// num = value.label
// }
// })
return num&&num.label
},
mixinGetValueById(e) {
let num =this.FieldUser.find(x=>x.id===e)
// this.FieldUser.forEach(value => {
// if (value.id === e) {
// num = value
// }
// })
return num
},
mixinGetCnByEn(e) {
let num =this.FieldUser.find(x=>x.fieldEn===e)
// this.FieldUser.forEach(value => {
// if (value.fieldEn === e) {
// num = value.fieldCn
// }
// })
return num&&num.fieldCn
},
mixinGetIdByEn(e) {
let num =this.FieldUser.find(x=>x.fieldEn===e)
// this.FieldUser.forEach(value => {
// if (value.fieldEn === e) {
// num = value.id
// }
// })
return num&&num.id
},
mixinGetValueTypeByEn(e) {
let num =this.FieldUser.find(x=>x.fieldEn===e)
// this.FieldUser.forEach(value => {
// if (value.fieldEn === e) {
// num = value.valueType
// }
// })
return num&&num.valueType
},
mixinGetFieldByEn(e) {
let num =this.FieldUser.find(x=>x.fieldEn=== e)
// this.FieldUser.forEach(value => {
// if (value.fieldEn === e) {
// num = value
// }
// })
return num
},
mixinMoveChange(e) {
let arr = this.selection.map((value) => {
return value.id
})
if (arr.length < 1) {
this.$message.error('未选择任何文件');
return
}
let params = {
ids: arr,
folderId: e
}
this.getData.updateParent(params).then(res => {
if (res.status == "1") {
this.clickCurrid(this.currid)
this.$message({
message: '移动成功',
type: 'success'
});
this.selection = []
}
})
this.tempMove = ""
},
mixinDeepCopy() {
let result;
if (typeof target === 'object') {
if (Array.isArray(target)) {
result = [];
for (let i in target) {
result.push(this.mixinDeepCopy(target[i]))
}
} else if (target === null) {
result = null;
} else if (target.constructor === RegExp) {
result = target;
} else {
result = {};
for (let i in target) {
result[i] = this.mixinDeepCopy(target[i]);
}
}
} else {
result = target;
}
return result;
},
mixinGetvalueType(cont) {
let num = this.FieldUser.find(x=>x.id===parseInt(cont))
// this.FieldUser.forEach(value => {
// if (value.id === parseInt(cont)) {
// num = value.valueType
// }
// })
return num&&num.valueType
},
mixinGetvalueEn(cont) {
let num = this.FieldUser.find(x=>x.id===parseInt(cont))
// this.FieldUser.forEach(value => {
// if (value.id === parseInt(cont)) {
// num = value.fieldEn
// }
// })
return num&&num.fieldEn
},
mixinGetvalueCn(cont) {
let num = this.FieldUser.find(x=>x.id===parseInt(cont))
// this.FieldUser.forEach(value => {
// if (value.id === parseInt(cont)) {
// num = value.fieldCn
// }
// })
if(!num&&cont!==""&&cont!==null){
console.log(num,cont)
num="(此字段丢失)"
}
return num&&num.fieldCn
},
mixinGetvalueCode(cont) {
let num = this.FieldUser.find(x=>x.id===parseInt(cont))
return num &&num.fieldCode
}
}
})
}
}

View File

@@ -0,0 +1,270 @@
var Mock = require('mockjs')
// Mock.mock("/Riskmanage/datasource/save", {
// "status": "1",
// data: {
// }
// })
Mock.mock("/Riskmanage/v3/qvshi2", {
"status": "1",
data: {
dycs: [{
dycslabel: '0609',
'dycsvalue|10-100': 1
},{
dycslabel: '0608',
'dycsvalue|10-100': 1
},{
dycslabel: '0607',
'dycsvalue|10-100': 1
},{
dycslabel: '0606',
'dycsvalue|10-100': 1
},{
dycslabel: '0605',
'dycsvalue|10-100': 1
}],
'jcjg':[{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
},{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
},{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
},{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
},{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
},{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
},{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
},{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
},{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
},{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
},{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
},{
'jcjglabel':Mock.mock('@cname()'),
'jcjgvalue|20-39':1
}],
gzmz:{
gzmztime:['0603','0604','0605','0606','0607','0608','0609'],
gzmzdata:[
{
gzmzlabel:'规则1',
gzmzvalue:[parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70)]
},
{
gzmzlabel:Mock.mock('@cname()'),
gzmzvalue:[parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70)]
},
{
gzmzlabel:Mock.mock('@cname()'),
gzmzvalue:[parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70)]
},
{
gzmzlabel:Mock.mock('@cname()'),
gzmzvalue:[parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70)]
},
{
gzmzlabel:Mock.mock('@cname()'),
gzmzvalue:[parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70)]
}
]
}
}
})
Mock.mock("/Riskmanage/v3/qvshi1", {
"status": "1",
data: {
klist: [{ // 每一个模板
engindId: 1, //引擎ID
engName: 'XX引擎', //引擎name
time: { //时间
startTime: '', // 开始时间
endTime: '' // 结束时间
},
dimensions: [ // 统计维度们
{
dimension: 'call', // 调用次数维度
field: [] // 此维度下的指标
},
{
dimension: 'rule',
field: []
},
],
chart: [{
Time: '4.15',
value: {
call: 20,
rule: 80,
}
}, {
Time: '4.15',
value: {
call: 30,
rule: 90,
}
}, {
Time: '4.15',
value: {
call: 40,
rule: 100,
}
}, {
Time: '4.15',
value: {
call: 50,
rule: 200,
}
}, {
Time: '4.15',
value: {
call: 60,
rule: 400,
}
}, {
Time: '4.15',
value: {
call: 70,
rule: 800,
}
}, {
Time: '4.15',
value: {
call: 80,
rule: 1000,
}
}]
}]
}
})
Mock.mock("/Riskmanage/v3/1", {
"status": "1",
data: {
klist: [{
name: '1引擎', //引擎名
id: 1, //id
top: false, // 是否置顶
call: { // 调用次数
'yesterday': 1, // 昨天
'today': 456, // 今天
'todayPredict': 789, // 今天预计
},
result: { // 决策结果
yesterday: 123,
today: 456,
todayPredict: 789,
},
hit: { // 命中规则
yesterday: 123,
today: 456,
todayPredict: 789,
}
}, {
name: '2引擎',
id: 2,
top: false,
call: {
yesterday: 123,
today: 456,
todayPredict: 789,
},
result: {
yesterday: 123,
today: 456,
todayPredict: 789,
},
hit: {
yesterday: 123,
today: 456,
todayPredict: 789,
}
}, {
name: '3引擎',
id: 3,
top: false,
call: {
yesterday: 123,
today: 456,
todayPredict: 789,
},
result: {
yesterday: 123,
today: 456,
todayPredict: 789,
},
hit: {
yesterday: 123,
today: 456,
todayPredict: 789,
}
}, {
name: '4引擎',
id: 4,
top: false,
call: {
yesterday: 123,
today: 456,
todayPredict: 789,
},
result: {
yesterday: 123,
today: 456,
todayPredict: 789,
},
hit: {
yesterday: 123,
today: 456,
todayPredict: 789,
}
}, {
name: '5引擎',
id: 5,
top: false,
call: {
yesterday: 123,
today: 456,
todayPredict: 789,
},
result: {
yesterday: 123,
today: 456,
todayPredict: 789,
},
hit: {
yesterday: 123,
today: 456,
todayPredict: 789,
}
}]
}
})

View File

@@ -0,0 +1,118 @@
export const nodes= [{
node: {
dataId: "0",
text: "开始",
type: 1,
url: "/start.png"
}
}, {
node: {
dataId: "0",
text: "名单库",
type: 5,
url: "/createBlackName.png",
url2: '/heimingdan.png'
}
}, {
node: {
dataId: "2",
text: "分流",
type: 7,
url: "/createRiverRate.png",
haveChildren: true
}
}, {
node: {
dataId: "3",
text: "分组",
type: 3,
url: "/createUserGroup.png",
haveChildren: true
}
}, {
node: {
dataId: "19",
text: "并行",
type: 19,
url: "/parallelNode.png",
haveChildren: true
}
}, {
node: {
dataId: "20",
text: "聚合",
type: 20,
url: "/gettogether.png"
}
}, {
node: {
dataId: "21",
text: "冠军挑战",
type: 21,
url: "/champion.png",
haveChildren: true
}
}, {
node: {
dataId: "4",
text: "规则集",
type: 2,
url: "/ruleGroup.png",
url2: '/guizeji.png'
}
}, {
node: {
dataId: "5",
text: "评分卡",
type: 4,
url: "/createScoreLevel.png",
url2: '/pingfenka.png'
}
}, {
node: {
dataId: "16",
text: "决策表",
type: 16,
url: "/juecebiaonode.png",
url2: '/juecebiao.png'
}
}, {
node: {
dataId: "17",
text: "决策树",
type: 17,
url: "/jueceshuNode.png",
url2: '/jueceshu.png'
}
}, {
node: {
dataId: "12",
text: "模型",
type: 15,
url: "/models.png",
url2: '/moxing.png'
}
}, {
node: {
dataId: "18",
text: "远程调用",
type: 18,
url: "/rpc.png",
url2: '/rpcnode.png'
}
}, {
node: {
dataId: "7",
text: "决策选项",
type: 9,
url: "/createDcisionOption.png"
}
}, {
node: {
dataId: "11",
text: "子引擎",
type: 14,
url: "/childEngine.png",
url2: '/ziyinqing.png'
}
}]

View File

@@ -0,0 +1,232 @@
import axios from 'axios'
import router from '../router';
import ElementUI from 'element-ui';
import bus from '@/components/common/bus.js'
var url = window.location.origin || window.location.protocol + '//' + window.location.hostname + (window.location.port ?
':' + window.location.port : '')
const storeUrl = [{
regetcache: 'decisionTable',
url: [
'/v3/decisionTables/addDecisionTables',
'/v3/decisionTables/updateDecisionTables',
'/v3/decisionTables/updateDecisionTablesStatus',
'/v3/decisionTables/version/addVersion',
'/v3/decisionTables/version/copyVersion',
'/v3/decisionTables/version/updateVersion',
'/v3/decisionTables/version/updateVersionStatus',
]
}, {
regetcache: 'Engine',
url: [
'/v2/engine/update'
]
}, {
regetcache: 'Interface',
url: [
'/v3/interface/addInterface',
'/v3/interface/updateInterface',
'/v3/interface/deleteInterface'
]
},
{
regetcache: 'SCO',
url: [
'/v3/scorecard/updateStatus',
'/v3/scorecard/add',
'/v3/scorecardVersion/addScorecardVersion',
'/v3/scorecardVersion/updateScorecardVersionStatus',
'/v3/scorecardVersion/copyScorecardVersion',
'/v3/scorecardVersion/updateScorecardVersion',
'/v3/scorecard/update'
]
},
{
regetcache: 'decisionTree',
url: [
'/v3/decisionTree/addDecisionTree',
'/v3/decisionTree/updateDecisionTree',
'/v3/decisionTree/updateDecisionTreeStatus',
'/v3/decisionTree/version/addVersion',
'/v3/decisionTree/version/copyVersion',
'/v3/decisionTree/version/updateVersion',
'/v3/decisionTree/version/updateVersionStatus',
]
},
{
regetcache: 'Sourcelist',
url: [
'/datasource/save',
'/datasource/',
'/datasource/update'
]
},{
regetcache: 'BlackWhiteList',
url: [
'/datamanage/listmanage/save',
'/datamanage/listmanage/update',
'/datamanage/listmanage/updateStatus',
'/datamanage/listmanage/upload/'
]
},
// {
// regetcache: 'listOperation',
// url: [
// '/v3/listOperation/addListOperation',
// '/v3/listOperation/updateListOperation',
// '/v3/listOperation/updateListOperationStatus',
// '/v3/listOperation/version/addVersion',
// '/v3/listOperation/version/copyVersion',
// '/v3/listOperation/version/updateVersion',
// '/v3/listOperation/version/updateVersionStatus',
// ]
// },
]
const instance = axios.create({
baseURL: process.env.NODE_ENV.indexOf(['produce', 'release', 'test', 'development', 'jia', 'niu',
'wang']) != -1 ? '/' : url,
timeout: 500000,
})
instance.interceptors.request.use((config) => {
// config.headers['AAA'] = 'AAA';
// console.log(config)
deepTirm(config)
if (config.data) {
if (config.data.getexcel) {
config.headers['responseType'] = 'blob'
}
}
if (localStorage.getItem('token')) {
config.headers['token'] = localStorage.getItem('token');
}
return config
})
instance.interceptors.response.use((response) => {
const {
data,
config
} = response
let result = data
if (response.data.status === "0") {
if (response.data.error === "01000103") {
if (document.getElementsByClassName('el-message').length === 0) {
ElementUI.Message.error(response.data.msg);
router.push({
path: '/login',
})
}
} else {
ElementUI.Message.error(response.data.msg);
}
} else {
storeUrl.forEach(value => {
let is = false
value.url.forEach(item => {
let str = response.request.responseURL
if (item[item.length - 1] == '/') {
let arr = str.split('/')
if (!isNaN(Number(arr[arr.length - 1]))) {
arr.pop()
str = arr.join('/') + '/'
}
}
str = str.substring(str.length - item.length, str.length)
if (item == str) {
bus.$emit('regetcache', value.regetcache)
}
})
})
}
return result
}, (error) => {
// console.log('error', error)
if (error.message.match(/timeout/)) {
ElementUI.Message.error('请求超时,请稍后再试!');
} else if (error.response.status === 500) {
ElementUI.Message.error('连接失败,请稍后再试!');
} else if (error.response.status === 502) {
ElementUI.Message.error('网关超时,请稍后再试!');
} else {
ElementUI.Message.error('连接失败,请稍后再试!');
}
return Promise.reject(error)
});
function deepTirm(e) {
Object.keys(e).forEach(value => {
if (typeof e[value] == 'string' && (e[value][0] === " " || e[value][e[value].length - 1] === " ")) {
e[value] = e[value].trim()
}
if (isJSON(e[value])) {
e[value] = JSON.stringify(deepTirm(JSON.parse(e[value])))
}
if (typeof e[value] === "object" && e[value] !== null) {
if (Array.isArray(e[value])) {
e[value].forEach(item => {
if (typeof item === 'string' && (item[0] === " " || item[item.length - 1] ===
" ")) {
item = item.trim()
}
if (typeof item === 'object') {
item = deepTirm(item)
}
})
} else {
deepTirm(e[value])
}
}
})
return e
}
function isJSON(str) {
if (typeof str == 'string') {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
return false;
}
}
}
export default instance