版本2.0更新
This commit is contained in:
401
h5-enginex-manager/src/components/common/GeneralRule.vue
Normal file
401
h5-enginex-manager/src/components/common/GeneralRule.vue
Normal file
@@ -0,0 +1,401 @@
|
||||
<style>
|
||||
.rule {
|
||||
display: flex;
|
||||
/* margin-left: 5px; */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.Rule_cont {
|
||||
width: 30px;
|
||||
border-top: 1px dashed #C7C6C8;
|
||||
/* border-top: 1px dashed rgb(1,1,1); */
|
||||
margin-top: 7px;
|
||||
flex-grow: 0;
|
||||
height: 1px;
|
||||
/* background-color: #C7C6C8; */
|
||||
margin: 12px 0px 0 0;
|
||||
height: 0;
|
||||
|
||||
}
|
||||
|
||||
.RuleIcon {
|
||||
background-color: #EBEBEB;
|
||||
border: #DADADA 1px solid;
|
||||
border-radius: 4px;
|
||||
padding: 4px 6px 4px 2px;
|
||||
}
|
||||
|
||||
.RuleSelcet .el-input__inner {
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.RuleCont_for_out {
|
||||
border-left: 1px dashed #ccc;
|
||||
border-bottom: 1px dashed #ccc;
|
||||
border-right: 1px dashed #ccc;
|
||||
padding-top: 5px;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="rule" :style="{marginLeft:ZIndex==1?'20px':'0px'}" v-if="data">
|
||||
<div :style="{position: 'absolute',top:'0px', left: '-20px',marginTop: top===0?'0':'8px'}" class="RuleIcon">
|
||||
<el-dropdown trigger="click" @command="handleCommand">
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-s-operation" :style="{color: color[ZIndex%5] ,fontSize: '16px'}"></i>
|
||||
</span>
|
||||
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item icon="el-icon-plus" command="addRule" v-if="data.conditionType!=3">添加规则
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-circle-plus-outline" command="addlogical">添加关系</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-close" command="delect" v-if="ZIndex!=1&&data.conditionType!=4">
|
||||
删除此节点</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div v-if="data.conditionType==1" class="RuleSelcet">
|
||||
|
||||
<div :style="{width: '80px',marginTop: top===0?'0':'8px'}">
|
||||
<el-select v-model="data.logical" placeholder="请选择" size="mini">
|
||||
<el-option :key="1" label="AND" value="&&"></el-option>
|
||||
<el-option :key="2" label="OR" value="||"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 10px;height: 0;border-top: 1px dashed #C7C6C8;margin-top: 19px;margin-left: 5px;">
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
:style="{border: '1px dashed '+ color[ZIndex%5],borderRadius: '5px',paddingRight: '5px',paddingBottom: '5px',position:'relative',minWidth:'30px',minHeight:'40px'}">
|
||||
|
||||
<div :style="{border:'',margin:'',padding:'',paddingLeft:'0px'}">
|
||||
|
||||
<div v-for="(item,index) in data.children" style="display: flex;margin-top: 7px;">
|
||||
<div class="Rule_cont"
|
||||
:style="{marginTop:item.conditionType===0?'12px':(index===0?'11px':'20px')}">
|
||||
</div>
|
||||
<!-- conditionType==2 规则部分 -->
|
||||
<div v-if="item.conditionType==2" style="display: flex;">
|
||||
<!-- {{fieldType}} -->
|
||||
<div v-if="fieldType!='for'" style="display: flex;">
|
||||
<!-- 普通规则部分 -->
|
||||
|
||||
<!-- 不为输出节点 则拉选 fielduser-->
|
||||
<div style="display: flex;">
|
||||
|
||||
<el-cascader v-model="item.fieldId" filterable size="mini"
|
||||
:options="fieldUserObj" clearable @change="ruleCascaderChange(item)"
|
||||
:key="keyValue+(item.random?item.random:0)" style="margin-left: 10px;"
|
||||
:props="{ expandTrigger: 'hover' }" @visible-change="randomAdd(item,$event)">
|
||||
</el-cascader>
|
||||
<ruleRelation v-model="item.operator" :value2.sync="item.variableValue"
|
||||
:variableType.sync="item.variableType"
|
||||
:valueType="GetValueTypeByJSONEn(item.fieldId)" size="mini" >
|
||||
</ruleRelation>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<i class="el-icon-circle-close" style="color: #fa4949;margin-left: 5px;"
|
||||
@click="deleteSon(index)"></i>
|
||||
</div>
|
||||
<!-- conditionType==1 关系节点 conditionType==3 for的输出的关系节点 节点部分 -->
|
||||
<div v-if="item.conditionType==1">
|
||||
<!-- {{fieldType}} -->
|
||||
<rule :data="item" :top="index" :ZIndex="ZIndex+1" :index="index"
|
||||
@delectLogical="delectLogical" :customUserObj="customUserObj">
|
||||
</rule>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
import bigElCascader from '@/components/common/bigElCascader.vue'
|
||||
import {
|
||||
GetdeepObj
|
||||
} from '@/utils/GetdeepObj.js'
|
||||
export default {
|
||||
components: {
|
||||
ruleRelation,
|
||||
bigElCascader
|
||||
},
|
||||
name: 'rule',
|
||||
data() {
|
||||
return {
|
||||
color: ['#0D183E', '#409EFF', '#67C23A', '#F56C6C', '#FFCD43'],
|
||||
|
||||
keyValue: 1, //用于给级联选择框重新渲染
|
||||
keyValueReady: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
if (this.data) {
|
||||
if (Array.isArray(this.data.fieldEn)) {
|
||||
if (this.data.fieldEn.length > 0) {
|
||||
this.EnChange(this.data.fieldEn, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
||||
fieldType: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
ZIndex: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
top: {
|
||||
tyep: String,
|
||||
default: '8px'
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
|
||||
customUserObj: { //自定义规则下拉
|
||||
type: Object || null,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
fieldUserObj() {
|
||||
|
||||
if (this.customUserObj) {
|
||||
|
||||
return GetdeepObj(JSON.parse(JSON.stringify(this.customUserObj)))
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
},
|
||||
// fielduserArr() {
|
||||
// let arr = []
|
||||
// // console.log(11,this.fielduser)
|
||||
// if (this.fielduser.length > 1) {
|
||||
// if (this.fieldType != "for") { // 如果元素不为 for 则 用fielduser里的 json 格式指标
|
||||
// arr = this.fielduser.filter((value) => {
|
||||
// return value.valueType == 6
|
||||
// })
|
||||
|
||||
// arr = arr.map((value) => {
|
||||
// let obj = {
|
||||
// value: value.fieldEn,
|
||||
// label: value.fieldCn,
|
||||
// }
|
||||
// obj.children = this.getdeepArr(JSON.parse(value.jsonValue))
|
||||
// return obj
|
||||
// })
|
||||
// }
|
||||
// // console.log(arr)
|
||||
// return arr
|
||||
|
||||
// } else {
|
||||
// return []
|
||||
// }
|
||||
// },
|
||||
// fielduser() {
|
||||
// if (this.$store.state.FieldUser) {
|
||||
// return this.$store.state.FieldUser.data.fieldList
|
||||
// } else {
|
||||
// return []
|
||||
// }
|
||||
|
||||
// },
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
GetValueTypeByJSONEn(en) {
|
||||
if (!en) {
|
||||
return
|
||||
}
|
||||
|
||||
// console.log(en)
|
||||
|
||||
let obj
|
||||
|
||||
en.forEach((value, index) => {
|
||||
if (index == 0) {
|
||||
obj = this.fieldUserObj.find(x => x.value == value)
|
||||
|
||||
// console.log(this.fieldUserObj)
|
||||
// console.log(obj)
|
||||
// debugger
|
||||
|
||||
} else {
|
||||
obj = obj.children.find(x => x.value == value)
|
||||
}
|
||||
})
|
||||
return obj && obj.valueType
|
||||
},
|
||||
|
||||
getvalueTypebyEn(e) { //通过en 获取 valueType
|
||||
if (!Array.isArray(e)) {
|
||||
return
|
||||
}
|
||||
if (e[0][0] !== '%') {
|
||||
return this.mixinGetValueTypeByEn(e[0])
|
||||
}
|
||||
if (e[e.length - 1] == 'length') {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
EnChange(e, clear = true) {
|
||||
|
||||
this.en = e.join('.')
|
||||
if (!clear) return
|
||||
this.deepClearEn(this.data)
|
||||
},
|
||||
deepClearEn(obj) { // 递归清除用到父级的 en
|
||||
obj.children.forEach(value => {
|
||||
if (Array.isArray(value.fieldEn)) {
|
||||
if (value.fieldEn[0][0] == "%") {
|
||||
value.fieldEn = ""
|
||||
}
|
||||
}
|
||||
if (value.children.length > 0) {
|
||||
this.deepClearEn(value)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
// getdeepArr(obj) {
|
||||
// if (Array.isArray(obj)) {
|
||||
// return false
|
||||
// } else if (typeof obj == 'object') {
|
||||
// let arr = []
|
||||
// for (let key in obj) {
|
||||
// if (obj.hasOwnProperty(key)) {
|
||||
// if (Array.isArray(obj[key])) {
|
||||
// arr.push({
|
||||
// value: key,
|
||||
// label: key
|
||||
// })
|
||||
// } else if (typeof obj[key] == 'object') {
|
||||
// arr.push({
|
||||
// value: key,
|
||||
// label: key,
|
||||
// children: this.getdeepArr(obj[key])
|
||||
// })
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// return arr
|
||||
// } else {
|
||||
// return []
|
||||
// }
|
||||
|
||||
|
||||
// },
|
||||
|
||||
delectLogical(index) {
|
||||
this.data.children.splice(index, 1)
|
||||
},
|
||||
handleCommand(str) {
|
||||
if (str == "addRule") { //添加规则
|
||||
// console.log(this.data)
|
||||
this.data.children.push({
|
||||
"logical": null,
|
||||
"fieldId": null,
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"conditionType": 2,
|
||||
"variableType": 1,
|
||||
"children": [],
|
||||
})
|
||||
|
||||
|
||||
} else if (str == "addlogical") { //添加链接符
|
||||
let obj = {
|
||||
"logical": '&&',
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"conditionType": 1,
|
||||
"children": [],
|
||||
}
|
||||
this.data.children.push(obj)
|
||||
|
||||
|
||||
} else if (str == "delect") {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$emit('delectLogical', this.index)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
deleteSon(index) {
|
||||
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.data.children.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
ruleCascaderChange(item) {
|
||||
item.valueType = this.mixinGetValueTypeByJSONEn(item.fieldEn)
|
||||
item.fieldValue = ""
|
||||
item.operator = ""
|
||||
},
|
||||
|
||||
},
|
||||
watch: {
|
||||
|
||||
// fielduserArr() {
|
||||
// if (this.keyValueReady) {
|
||||
// this.keyValue++
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
352
h5-enginex-manager/src/components/common/Header.vue
Normal file
352
h5-enginex-manager/src/components/common/Header.vue
Normal file
@@ -0,0 +1,352 @@
|
||||
<template>
|
||||
<div class="header">
|
||||
<!-- 折叠按钮 -->
|
||||
<div class="collapse-btn" @click="collapseChage">
|
||||
<i v-if="!collapse" class="el-icon-s-fold"></i>
|
||||
<i v-else class="el-icon-s-unfold"></i>
|
||||
</div>
|
||||
<div class="logo">数字决策平台</div>
|
||||
<div class="header-right">
|
||||
<!-- {{fielduser}} -->
|
||||
<!-- {{ruleList}} -->
|
||||
|
||||
<!-- {{fielduser==''}} -->
|
||||
<!-- {{ruleList==null}} -->
|
||||
<div class="header-user-con">
|
||||
|
||||
<div style="display: flex;font-size: 14px;">
|
||||
|
||||
<div v-for="value in link.e" class="header_link" @click="go(value)">
|
||||
{{value.title}}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- -->
|
||||
<div class="btn-fullscreen" @click="ReGetStorage">
|
||||
<!-- {{fielduser}} -->
|
||||
<!-- {{ruleList=='[]'}} -->
|
||||
<el-tooltip effect="dark" content="刷新缓存" placement="bottom">
|
||||
|
||||
<i :class="Loading?'el-icon-loading':'el-icon-refresh'"></i>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
|
||||
<!-- 全屏显示 -->
|
||||
<div class="btn-fullscreen" @click="handleFullScreen">
|
||||
<el-tooltip effect="dark" :content="fullscreen?`取消全屏`:`全屏`" placement="bottom">
|
||||
<i class="el-icon-rank"></i>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
|
||||
<!-- 用户头像 -->
|
||||
<div class="user-avator">
|
||||
<img src="../../assets/img/img.jpg" />
|
||||
</div>
|
||||
<!-- 用户名下拉菜单 -->
|
||||
<el-dropdown class="user-name" trigger="click" @command="handleCommand">
|
||||
<span class="el-dropdown-link">
|
||||
{{username}}
|
||||
<i class="el-icon-caret-bottom"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item divided command="loginout">退出登录</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import bus from '../common/bus';
|
||||
import {
|
||||
getLogout
|
||||
} from '../../api/index';
|
||||
import linkOr from '@/utils/link.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
collapse: false,
|
||||
fullscreen: false,
|
||||
name: '',
|
||||
message: 2,
|
||||
link: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.link = linkOr
|
||||
bus.$on('collapseHeader', res => {
|
||||
this.busCollapseChage(res)
|
||||
})
|
||||
bus.$on('regetcache', res => {
|
||||
|
||||
this.$store.dispatch('regetcache', res)
|
||||
})
|
||||
|
||||
this.$store.dispatch('getfielduser')
|
||||
this.$store.dispatch('getRuleList')
|
||||
|
||||
|
||||
Object.keys(this.$store.state.cacheList).forEach(value => {
|
||||
this.$store.dispatch('getcache', value)
|
||||
})
|
||||
|
||||
|
||||
if (!sessionStorage.getItem('reGet')) {
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
this.$store.dispatch('regetcache', 'Interface')
|
||||
this.$store.dispatch('regetcache', 'Sourcelist')
|
||||
|
||||
sessionStorage.setItem('reGet', 1)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.$store.commit('setbarShrink', this.collapse)
|
||||
},
|
||||
computed: {
|
||||
username() {
|
||||
if (localStorage.getItem('ms_username')) {
|
||||
return localStorage.getItem('ms_username');
|
||||
} else {
|
||||
return "未命名"
|
||||
}
|
||||
},
|
||||
fielduser() {
|
||||
if (this.$store.state.FieldUser) {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
|
||||
return null
|
||||
}
|
||||
},
|
||||
ruleList() {
|
||||
if (this.$store.state.RuleList) {
|
||||
return this.$store.state.RuleList
|
||||
|
||||
} else {
|
||||
|
||||
return null
|
||||
}
|
||||
},
|
||||
Loading() {
|
||||
if (this.$store.state.FieldUser == null) {
|
||||
return true
|
||||
}
|
||||
if (this.$store.state.RuleList == null) {
|
||||
return true
|
||||
}
|
||||
let is = false
|
||||
Object.keys(this.$store.state.cacheList).forEach(value => {
|
||||
if (this.$store.state[value] == null) {
|
||||
is = true
|
||||
}
|
||||
})
|
||||
if (is) return true
|
||||
|
||||
// if (this.$store.state.SCO == null) {
|
||||
// return true
|
||||
// }
|
||||
// if (this.$store.state.Interface == null) {
|
||||
// return true
|
||||
// }
|
||||
// if (this.$store.state.decisionTable == null) {
|
||||
// return true
|
||||
// }
|
||||
// if (this.$store.state.decisionTree == null) {
|
||||
// return true
|
||||
// }
|
||||
// if (this.$store.state.Sourcelist == null) {
|
||||
// return true
|
||||
// }
|
||||
// if (this.$store.state.Engine == null) {
|
||||
// return true
|
||||
// }
|
||||
|
||||
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
go(value) {
|
||||
var url = window.location.href
|
||||
|
||||
if (value[url.split('#')[0]]) {
|
||||
window.open(value[url.split('#')[0]])
|
||||
} else {
|
||||
this.$message.error('请检查跳转配置')
|
||||
}
|
||||
},
|
||||
ReGetStorage() {
|
||||
|
||||
if (this.Loading) {
|
||||
return
|
||||
}
|
||||
|
||||
this.mixinReGetStorage()
|
||||
},
|
||||
// 用户名下拉菜单选择事件
|
||||
handleCommand(command) {
|
||||
if (command == 'loginout') {
|
||||
// 调用退出登录接口
|
||||
getLogout();
|
||||
localStorage.removeItem("engineId");
|
||||
// localStorage.removeItem("token");
|
||||
localStorage.removeItem('ms_username');
|
||||
this.$router.push('/login');
|
||||
}
|
||||
},
|
||||
// Bus侧边栏折叠
|
||||
busCollapseChage(res) {
|
||||
this.collapse = res;
|
||||
this.$store.commit('setbarShrink', this.collapse)
|
||||
bus.$emit('collapse', this.collapse);
|
||||
},
|
||||
// 侧边栏折叠
|
||||
collapseChage() {
|
||||
this.collapse = !this.collapse;
|
||||
this.$store.commit('setbarShrink', this.collapse)
|
||||
bus.$emit('collapse', this.collapse);
|
||||
},
|
||||
// 全屏事件
|
||||
handleFullScreen() {
|
||||
let element = document.documentElement;
|
||||
if (this.fullscreen) {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.webkitCancelFullScreen) {
|
||||
document.webkitCancelFullScreen();
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen();
|
||||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen();
|
||||
}
|
||||
} else {
|
||||
if (element.requestFullscreen) {
|
||||
element.requestFullscreen();
|
||||
} else if (element.webkitRequestFullScreen) {
|
||||
element.webkitRequestFullScreen();
|
||||
} else if (element.mozRequestFullScreen) {
|
||||
element.mozRequestFullScreen();
|
||||
} else if (element.msRequestFullscreen) {
|
||||
// IE11
|
||||
element.msRequestFullscreen();
|
||||
}
|
||||
}
|
||||
this.fullscreen = !this.fullscreen;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (document.body.clientWidth < 1500) {
|
||||
this.collapseChage();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.header {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
font-size: 22px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.header_link {
|
||||
padding: 4px;
|
||||
margin-right: 20px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.header_link:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.collapse-btn {
|
||||
float: left;
|
||||
padding: 0 21px;
|
||||
cursor: pointer;
|
||||
line-height: 70px;
|
||||
}
|
||||
|
||||
.header .logo {
|
||||
float: left;
|
||||
width: 250px;
|
||||
line-height: 70px;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
float: right;
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.header-user-con {
|
||||
display: flex;
|
||||
height: 70px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-fullscreen {
|
||||
transform: rotate(45deg);
|
||||
margin-right: 5px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.btn-bell,
|
||||
.btn-fullscreen {
|
||||
position: relative;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
text-align: center;
|
||||
border-radius: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-bell-badge {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: -2px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 4px;
|
||||
background: #f56c6c;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-bell .el-icon-bell {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.user-avator {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.user-avator img {
|
||||
display: block;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.el-dropdown-link {
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.el-dropdown-menu__item {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
51
h5-enginex-manager/src/components/common/Home.vue
Normal file
51
h5-enginex-manager/src/components/common/Home.vue
Normal file
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<v-head></v-head>
|
||||
<v-sidebar></v-sidebar>
|
||||
<div class="content-box" :class="{'content-collapse':collapse}">
|
||||
<v-tags></v-tags>
|
||||
<div class="content" >
|
||||
<transition name="move" mode="out-in">
|
||||
<keep-alive :include="tagsList">
|
||||
<router-view></router-view>
|
||||
</keep-alive>
|
||||
</transition>
|
||||
<el-backtop target=".content"></el-backtop>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import vHead from './Header.vue';
|
||||
import vSidebar from './Sidebar.vue';
|
||||
import vTags from './Tags.vue';
|
||||
import bus from './bus';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tagsList: [],
|
||||
collapse: false
|
||||
};
|
||||
},
|
||||
components: {
|
||||
vHead,
|
||||
vSidebar,
|
||||
vTags
|
||||
},
|
||||
created() {
|
||||
bus.$on('collapse-content', msg => {
|
||||
this.collapse = msg;
|
||||
});
|
||||
|
||||
// 只有在标签页列表里的页面才使用keep-alive,即关闭标签之后就不保存到内存中了。
|
||||
bus.$on('tags', msg => {
|
||||
let arr = [];
|
||||
for (let i = 0, len = msg.length; i < len; i++) {
|
||||
msg[i].name && arr.push(msg[i].name);
|
||||
}
|
||||
this.tagsList = arr;
|
||||
});
|
||||
},
|
||||
};
|
||||
</script>
|
||||
234
h5-enginex-manager/src/components/common/SCO/SCOCont.vue
Normal file
234
h5-enginex-manager/src/components/common/SCO/SCOCont.vue
Normal file
@@ -0,0 +1,234 @@
|
||||
|
||||
<template>
|
||||
<div class="cont_cont">
|
||||
|
||||
<div class="cont_left" v-loading="leftloading" v-if="!listRedact">
|
||||
<div class="cont_header">
|
||||
<p class="cont_header_title">{{title}}</p>
|
||||
<p class="cont_header_subtitle">{{title}}</p>
|
||||
</div>
|
||||
<contNewFule v-model="tempNewF" :newf.sync="newf" @newFileSure="newFileSure" @newFile="newFile" ></contNewFule>
|
||||
|
||||
<div class="cont_list">
|
||||
<fileHome :data="list" @curr="clickCurrid" :currid="currid" @RenameFun="RenameFun" @RenameClose="RenameClose"
|
||||
@updatafilelist="updatafilelist" @delectFun="delectFun">
|
||||
</fileHome>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cont_right" v-loading="contloading" @click="tempHintLeft=null;tempHintTop=null;">
|
||||
<div v-if="!listRedact">
|
||||
<div v-if="showRight===false" class="cont_right_hint">
|
||||
请先选择左侧文件夹
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="cont_right_top">
|
||||
<div>
|
||||
<el-button type="primary" @click="listRedact=true" :disabled="currid!=99999999?false:'disabled'">新增</el-button>
|
||||
<el-button type="danger" @click="using(-1);$store.dispatch('regetcache','SCO')" :disabled="this.selection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button type="success" @click="using(1)" :disabled="this.selection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button type="warning" @click="using(0)" :disabled="this.selection.length>0?false:'disabled'">停用</el-button>
|
||||
<!-- <el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'" filterable @change="mixinMoveChange"> -->
|
||||
<el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" disabled filterable @change="mixinMoveChange">
|
||||
<el-option v-for="value in listunfold" :key="value.id" :label="value.name" :value="value.id" v-show="value.id!=99999999"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-input placeholder="请输入评分卡名称" v-model="search">
|
||||
<i slot="suffix" class="el-input__icon el-icon-search" @click="getsearch"></i>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right_cont">
|
||||
|
||||
<div v-if="data">
|
||||
<el-table border :data="data.data.scorecardList" @select-all="selectAll" @select="select" style="width: 100%"
|
||||
:cell-style="{padding: '10px'}">
|
||||
<el-table-column type="selection" width="70">
|
||||
</el-table-column>
|
||||
<el-table-column v-for="item in getData.row" :key="item.id" :prop="item.row" :label="item.label" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="item.type==='Blooen'">
|
||||
{{scope.row[item.row]?"是":"否"}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='State'">
|
||||
{{scope.row[item.row]==1?'启用':'未启用'}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='Time'" style="white-space: nowrap;" class="contText">{{
|
||||
new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row[item.row]).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
<span class="contText" v-else>
|
||||
{{scope.row[item.row]}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-button icon="el-icon-setting" circle size="mini" @click="dialogShow(scope.row.id)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="float: right;margin-right: 40px;margin-top: 40px;" :current-page="currPage"
|
||||
@current-change="clickpage" background layout="prev, pager, next" :total="data.data.pageInfo.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else style="height: 100%;">
|
||||
<dataManageRedact @close="listRedact=false;tempRedactId=0" @Ok="tempRedactId=$event"
|
||||
:id='tempRedactId' :nameId="currid" :getData="getData"></dataManageRedact>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import contNewFule from '@/components/common/contNewFile.vue'
|
||||
import '@/assets/css/cont.css'
|
||||
import fileHome from '@/components/common/fileHome.vue'
|
||||
import dataManageRedact from '@/components/common/SCO/SCOManageRedact.vue'
|
||||
import contmixin from '@/utils/contminxin/contmixin.js'
|
||||
export default {
|
||||
mixins: [
|
||||
contmixin
|
||||
],
|
||||
components: {
|
||||
fileHome,
|
||||
dataManageRedact,
|
||||
contNewFule
|
||||
},
|
||||
props: {
|
||||
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
|
||||
getData: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
list() {
|
||||
if (this.list.length > 0) {
|
||||
this.leftloading = false
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list:[],
|
||||
tempMove: '',
|
||||
leftloading: true,
|
||||
search: "",
|
||||
fileName: "",
|
||||
fileList: [],
|
||||
upShow: false,
|
||||
currPage: 1,
|
||||
currid: null,
|
||||
data: null,
|
||||
contloading: false,
|
||||
newf: false,
|
||||
tempNewF: "",
|
||||
listRedact: false, //新增页面开启
|
||||
tempRedactId: 0,
|
||||
selection: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getData.getTree({
|
||||
parentId: 0,
|
||||
treeType:this.getData.treeType,
|
||||
type: 1
|
||||
}).then(res => {
|
||||
this.list = this.listTreeDeep(res.data, 1)
|
||||
this.clickCurrid(99999999)
|
||||
})
|
||||
|
||||
},
|
||||
methods: {
|
||||
getsearch() {
|
||||
this.contloading = true
|
||||
// this.listRedact = false
|
||||
let params = {
|
||||
value: this.search,
|
||||
"search": true,
|
||||
pageSize: 10,
|
||||
status: [0, 1],
|
||||
"parentId": String(this.currid) === "99999999" ? 0 : String(this.currid),
|
||||
"pageNum": 1,
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.selection=[]
|
||||
this.contloading = false
|
||||
})
|
||||
this.currPage = 1
|
||||
},
|
||||
getlist() {
|
||||
this.contloading = true
|
||||
this.listRedact = false
|
||||
let params = {
|
||||
value: this.search,
|
||||
"search": this.search ? true : false,
|
||||
pageSize: 10,
|
||||
status: [0, 1],
|
||||
"parentId": String(this.currid) === "99999999" ? 0 : String(this.currid),
|
||||
"pageNum": 1,
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
|
||||
},
|
||||
clickpage(e) {
|
||||
this.currPage = e
|
||||
this.contloading = true
|
||||
let params = {
|
||||
value: this.search,
|
||||
"search": false,
|
||||
pageSize: 10,
|
||||
status: [0, 1],
|
||||
"parentId": String(this.currid) === "99999999" ? 0 : String(this.currid),
|
||||
"pageNum": e,
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
if(res.status=="1"){
|
||||
this.data = res
|
||||
|
||||
this.contloading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
newFileSure() {
|
||||
this.leftloading = true
|
||||
let params = {
|
||||
parentId: String(this.currid),
|
||||
name: this.tempNewF,
|
||||
"treeType": "1",
|
||||
"type": "1",
|
||||
"engineId": ""
|
||||
}
|
||||
|
||||
|
||||
if(this.mixnewFileZindexVerify(this.list,this.currid)==6){
|
||||
this.$message.error('已达到最深层级')
|
||||
this.leftloading = false
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.mixnewFileSure(params)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
893
h5-enginex-manager/src/components/common/SCO/SCOManageRedact.vue
Normal file
893
h5-enginex-manager/src/components/common/SCO/SCOManageRedact.vue
Normal file
@@ -0,0 +1,893 @@
|
||||
<style>
|
||||
|
||||
.table{
|
||||
/* border-bottom: 1px solid #ddd; */
|
||||
border-left: 1px solid #ddd;
|
||||
min-height: 50px;
|
||||
display: flex;
|
||||
min-width: 300px;
|
||||
}
|
||||
.table div{
|
||||
min-height: 50px;
|
||||
width: 300px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.table p{
|
||||
width: 300px;
|
||||
display: flex;
|
||||
|
||||
}
|
||||
.SCO_scoreHome{
|
||||
width: 75vw;
|
||||
height: 55vh;
|
||||
overflow: scroll;
|
||||
transform-origin: 0 0;
|
||||
user-select:none;
|
||||
}
|
||||
|
||||
.SCO_cont::-webkit-scrollbar{
|
||||
display: none;
|
||||
}
|
||||
.SCO_cont{
|
||||
height: 60vh;
|
||||
overflow: scroll;
|
||||
}
|
||||
.SCO_tableHeader{
|
||||
display: flex;
|
||||
margin-left: 20px;
|
||||
/* margin-top: 20px; */
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
.SCO_tableHeader>div{
|
||||
height: 40px;
|
||||
width: 300px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-left: 1px solid #ddd;
|
||||
font-size: 14px;
|
||||
}
|
||||
.sco_cont_home{
|
||||
overflow: scroll;
|
||||
flex: 1;
|
||||
}
|
||||
.sco_version{
|
||||
margin-top: 20px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
.sco_version_buttom{
|
||||
/* width: 100px; */
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="mixinClose"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增评分卡 :</span>
|
||||
<span v-else>编辑评分卡 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button :icon="smallHeader?'el-icon-bottom':'el-icon-top'" circle @click="openHeader">
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit" :disabled="addVersionStatus"></el-button>
|
||||
<!-- <el-button type="danger" icon="el-icon-close" circle @click="$emit('close')"></el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>评分卡代码: </p>
|
||||
<el-input placeholder="请输入评分卡代码" maxlength="30" v-model="code" :disabled="addVersionStatus" clearable></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p> 评分卡名称: </p>
|
||||
<el-input placeholder="请输入评分卡名称" maxlength="20" v-model="name" :disabled="addVersionStatus" clearable></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_scope MR_scopeSmall':'MR_scope'">
|
||||
<div>
|
||||
<p>评分卡描述: </p>
|
||||
<el-input placeholder="请输入评分卡描述" maxlength="300" v-model="description" :disabled="addVersionStatus" clearable></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<version style="margin:5px;" :id="id" :ruleVersionList="versionList" :version="version"
|
||||
:addVersionStatus="addVersionStatus" :addVersionDialog="addVersionDialog" :addVersionLoading="addVersionLoading"
|
||||
@addVersion="addVersion" @addVersionClose="addVersionClose" @copyVersion="copyVersion" @delectVersion="delectVersion"
|
||||
@updateVersion="updateVersion" @addVersionSure="addVersionSure" @Dialog="addVersionDialog=$event" @addVersionExamine="addVersionExamine"
|
||||
@versionChange="versionChange" @StatusChange="addVersionStatus=$event"></version>
|
||||
|
||||
|
||||
<div class="sco_cont_home">
|
||||
<div class="SCO_tableHeader">
|
||||
<div style="background-color: #409EFF;color: #fff;">维度</div>
|
||||
<div style="width: 100px;background-color: #409EFF;color: #fff;">权重</div>
|
||||
<div v-for=" value in tier" style="background-color: #409EFF;color: #fff;">
|
||||
指标{{value}}
|
||||
</div>
|
||||
<div style="border-top: 1px solid #ddd;border-right: 1px solid #ddd;margin-top: -1px;margin-left: 1px;background-color: #409EFF;color: #fff;width: 200px;">
|
||||
评分
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;margin-left: 20px;">
|
||||
<div style="border-right: 1px solid #ddd;border-left: 1px solid #ddd;border-top: 1px solid #ddd;">
|
||||
<div v-for="(value,index) in table" style="min-height: 50px;display: flex;border-bottom: 1px solid #ddd;position: relative;">
|
||||
<div style="min-width: 300px;display: flex;align-items: center;justify-content: center;position: relative;">
|
||||
<div style="position: absolute;left: 0;top: 0;color: #409EFF;">
|
||||
<el-dropdown @command="handleCommand">
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-s-operation"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown" trigger="click">
|
||||
<el-dropdown-item icon="el-icon-bottom" :command="'addBrother|'+index">向下添加</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-right" :command="'addSon|'+index" v-show="!value.children.length">向右添加</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-close" :command="'delect|'+index" v-show="index!=0">删除此字段</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-document-copy" :command="'copy|'+index">复制此字段</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<textInput :text="String(value.dimensionName)" :center="true" :examine="3" @input="dimensioninput(value,$event)"></textInput>
|
||||
</div>
|
||||
<div style="width: 100px;borderLeft:1px solid #ddd;display: flex;align-items: center;justify-content: center;flex-shrink: 0;">
|
||||
<textInput :text="String(value.weight)" :examine='2' :center="true" @input="value.weight=$event"></textInput>
|
||||
</div>
|
||||
<recursion :data="value" :tier="1"></recursion>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p style="color: #F56C6C;font-size: 12px;margin-left: 20px;margin-top: 10px;">(1,10]表示 大于1 并且 小于等于 10 <br> 双击编辑</p>
|
||||
|
||||
<div style="margin-top: 50px;margin-bottom: 20px;">
|
||||
<span style="font-size: 14px;margin-left: 20px;margin-right: 10px;color: #409EFF;">计算方式:</span>
|
||||
<el-select v-model="scoreCalculateType" placeholder="请选择" size="mini">
|
||||
<el-option :key="1" label="求和" :value="1"></el-option>
|
||||
<el-option :key="2" label="加权求和" :value="2"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<outcontent :outcontent="outcontent" type="scorecard" style="margin-top: 20px;margin-left: 50px;">
|
||||
<div style="display:flex; align-items: center;">
|
||||
<el-select v-model="out" filterable placeholder="请选择" style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="评分" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
</outcontent>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import version from '@/components/common/Version.vue'
|
||||
import outcontent from '@/components/models/outcontent.vue'
|
||||
import textInput from '../textInput.vue'
|
||||
import recursion from './recursion.vue'
|
||||
import bus from './bus.js'
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
outcontent,
|
||||
recursion,
|
||||
textInput,
|
||||
version
|
||||
},
|
||||
props: {
|
||||
getData: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
|
||||
nameId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
addVersionLoading: false,
|
||||
addVersionDialog: false,
|
||||
tempadd: {},
|
||||
out: '',
|
||||
versionList: [],
|
||||
addVersionStatus: false,
|
||||
version: {},
|
||||
table: [{
|
||||
"id": null,
|
||||
"cardId": '',
|
||||
"dimensionName": "",
|
||||
"fieldId": '',
|
||||
"weight": 1,
|
||||
"executeType": null,
|
||||
"createTime": null,
|
||||
"updateTime": null,
|
||||
"children": [{
|
||||
condition: '',
|
||||
children: [],
|
||||
id: null,
|
||||
"score": 1,
|
||||
"fieldId": '',
|
||||
"coefficient": 1,
|
||||
"calculateType": 1,
|
||||
custom: '',
|
||||
}]
|
||||
}],
|
||||
score: null,
|
||||
loading: false,
|
||||
valueScope: '',
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
"outcontent": [],
|
||||
scoreCalculateType: 1,
|
||||
max: 0,
|
||||
|
||||
parentId: ''
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
|
||||
bus.$on('look', () => {
|
||||
console.log(this.table)
|
||||
})
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getData.getVersion({
|
||||
"id": this.id,
|
||||
}).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.versionList = res.data.versionList
|
||||
this.version = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
this.code = res.data.code
|
||||
this.name = res.data.name
|
||||
this.description = res.data.description
|
||||
this.parentId = res.data.parentId
|
||||
this.getScorecardCont()
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
},
|
||||
|
||||
|
||||
|
||||
tier() {
|
||||
|
||||
this.max = 0
|
||||
|
||||
this.each(this.table, 1)
|
||||
return this.max - 1
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
updateVersion(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
let obj = {
|
||||
scorecardId: this.id,
|
||||
id: this.version.id,
|
||||
scorecardDimension: this.table,
|
||||
scoreCalculateType: this.scoreCalculateType,
|
||||
resultFieldEn: this.out,
|
||||
strategyOutputList: this.outcontent,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description
|
||||
}
|
||||
this.getData.updateVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '版本重命名成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getScorecardCont()
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
addVersionSure(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
let obj = {
|
||||
scorecardId: this.id,
|
||||
scorecardDimension: this.table,
|
||||
scoreCalculateType: this.scoreCalculateType,
|
||||
resultFieldEn: this.out,
|
||||
strategyOutputList: this.outcontent,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description
|
||||
}
|
||||
this.getData.addVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '添加版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getScorecardCont()
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
copyVersion(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
let obj = {
|
||||
scorecardId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description
|
||||
}
|
||||
this.getData.copyVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '复制版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getScorecardCont()
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
addVersionExamine() {
|
||||
if (this.verification()) {
|
||||
return
|
||||
}
|
||||
this.addVersionDialog = true
|
||||
},
|
||||
versionChange() {
|
||||
this.versionList.forEach(value => {
|
||||
if (value.id === this.version.id) {
|
||||
this.version = JSON.parse(JSON.stringify(value))
|
||||
}
|
||||
})
|
||||
this.getScorecardCont()
|
||||
},
|
||||
getScorecardCont() {
|
||||
this.loading = true
|
||||
this.getData.getInfo({
|
||||
id: this.version.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.out = res.data.resultFieldEn
|
||||
this.outcontent = res.data.strategyOutputList
|
||||
if (res.data.scorecardDimension.length > 0) {
|
||||
this.table = res.data.scorecardDimension
|
||||
}
|
||||
if (res.data.scoreCalculateType) {
|
||||
this.scoreCalculateType = res.data.scoreCalculateType
|
||||
}
|
||||
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
delectVersion() { //删除版本
|
||||
this.getData.delectVersion({
|
||||
status: -1,
|
||||
ids: [this.version.id],
|
||||
strategyId: this.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
this.getScorecardCont()
|
||||
}
|
||||
})
|
||||
},
|
||||
addVaersionSure() { // 二次确认添加新版本
|
||||
this.addVersionLoading = true
|
||||
let that = this
|
||||
if (this.verificationTempVersion()) {
|
||||
that.addVersionLoading = false
|
||||
return
|
||||
}
|
||||
|
||||
if (this.addVersionStatus) { // 添加版本
|
||||
add()
|
||||
} else if (this.updateVersion) { //重命名版本
|
||||
updateVersion()
|
||||
} else { // 复制版本
|
||||
copy()
|
||||
|
||||
}
|
||||
|
||||
|
||||
function add() {
|
||||
let obj = {
|
||||
scorecardId: that.id,
|
||||
scorecardDimension: that.table,
|
||||
scoreCalculateType: that.scoreCalculateType,
|
||||
resultFieldEn: that.out,
|
||||
strategyOutputList: that.outcontent,
|
||||
versionCode: that.tempVersion.versionCode,
|
||||
description: that.tempVersion.description
|
||||
}
|
||||
that.getData.addVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
that.$message({
|
||||
message: '添加版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
that.$store.dispatch('regetcache','SCO')
|
||||
that.versionList = res.data
|
||||
that.version = JSON.parse(JSON.stringify(that.versionList[0]))
|
||||
that.addVersionDialog = false
|
||||
that.addVersionStatus = false
|
||||
that.getScorecardCont()
|
||||
}
|
||||
that.addVersionLoading = false
|
||||
})
|
||||
}
|
||||
|
||||
function copy() {
|
||||
let obj = {
|
||||
scorecardId: that.id,
|
||||
id: that.version.id,
|
||||
versionCode: that.tempVersion.versionCode,
|
||||
description: that.tempVersion.description
|
||||
}
|
||||
that.getData.copyVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
that.$message({
|
||||
message: '复制版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
that.$store.dispatch('regetcache','SCO')
|
||||
that.versionList = res.data
|
||||
that.version = JSON.parse(JSON.stringify(that.versionList[0]))
|
||||
that.addVersionDialog = false
|
||||
that.addVersionStatus = false
|
||||
that.getScorecardCont()
|
||||
}
|
||||
that.addVersionLoading = false
|
||||
})
|
||||
}
|
||||
|
||||
function updateVersion() {
|
||||
let obj = {
|
||||
scorecardId: that.id,
|
||||
id: that.version.id,
|
||||
scorecardDimension: that.table,
|
||||
scoreCalculateType: that.scoreCalculateType,
|
||||
resultFieldEn: that.out,
|
||||
strategyOutputList: that.outcontent,
|
||||
versionCode: that.tempVersion.versionCode,
|
||||
description: that.tempVersion.description
|
||||
}
|
||||
that.getData.updateVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
that.$message({
|
||||
message: '版本重命名成功',
|
||||
type: 'success'
|
||||
});
|
||||
that.$store.dispatch('regetcache','SCO')
|
||||
that.versionList = res.data
|
||||
that.version = JSON.parse(JSON.stringify(that.versionList[0]))
|
||||
that.addVersionDialog = false
|
||||
that.addVersionStatus = false
|
||||
that.getScorecardCont()
|
||||
}
|
||||
that.addVersionLoading = false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
sureAddVersion() { // 确认添加新版本
|
||||
if (this.verification()) {
|
||||
return
|
||||
}
|
||||
this.addVersionDialog = true
|
||||
|
||||
},
|
||||
reset() { //重置默认数据
|
||||
this.out = ''
|
||||
this.table = [{
|
||||
"id": null,
|
||||
"cardId": '',
|
||||
"dimensionName": "",
|
||||
"fieldId": '',
|
||||
"weight": 1,
|
||||
"executeType": null,
|
||||
"createTime": null,
|
||||
"updateTime": null,
|
||||
"children": [{
|
||||
condition: '',
|
||||
children: [],
|
||||
id: null,
|
||||
"score": 1,
|
||||
"fieldId": '',
|
||||
"coefficient": 1,
|
||||
"calculateType": 1,
|
||||
custom: '',
|
||||
}]
|
||||
}]
|
||||
this.outcontent = []
|
||||
this.scoreCalculateType = 1
|
||||
},
|
||||
addVersion() {
|
||||
this.addVersionStatus = true
|
||||
this.tempadd = {
|
||||
out: this.out,
|
||||
table: this.table,
|
||||
outcontent: this.outcontent,
|
||||
scoreCalculateType: this.scoreCalculateType
|
||||
}
|
||||
this.reset()
|
||||
},
|
||||
addVersionClose() {
|
||||
this.addVersionStatus = false
|
||||
|
||||
this.out = this.tempadd.out
|
||||
this.table = this.tempadd.table
|
||||
this.outcontent = this.tempadd.outcontent
|
||||
this.scoreCalculateType = this.tempadd.scoreCalculateType
|
||||
|
||||
},
|
||||
dimensioninput(value, e) {
|
||||
value.dimensionName = e
|
||||
},
|
||||
handleCommand(str) {
|
||||
console.log(str)
|
||||
switch (str.split('|')[0]) {
|
||||
case 'addBrother':
|
||||
this.addBrother(str.split('|')[1])
|
||||
break;
|
||||
case 'delect':
|
||||
this.delect(str.split('|')[1])
|
||||
break;
|
||||
case 'addSon':
|
||||
this.addSon(str.split('|')[1])
|
||||
break;
|
||||
case 'copy':
|
||||
this.copy(str.split('|')[1])
|
||||
break;
|
||||
}
|
||||
},
|
||||
each(data, floor) {
|
||||
data.forEach(e => {
|
||||
e.floor = floor
|
||||
if (floor > this.max) {
|
||||
this.max = floor
|
||||
}
|
||||
if (e.children.length > 0) {
|
||||
this.each(e.children, floor + 1)
|
||||
}
|
||||
})
|
||||
},
|
||||
objectSpanMethod() {
|
||||
return {
|
||||
rowspan: 1,
|
||||
colspan: 1
|
||||
}
|
||||
},
|
||||
outAdd(index) {
|
||||
this.outcontent.splice(index, 0, {
|
||||
"fieldId": "",
|
||||
"fieldValue": ""
|
||||
})
|
||||
},
|
||||
outDelect(index) {
|
||||
this.outcontent.splice(index, 1, )
|
||||
},
|
||||
examine(item, issumm) {
|
||||
|
||||
item.forEach(value => {
|
||||
let Z = /^((\[|\()(\d(\d)*(\.(\d)+)?)|\(),((\d(\d)*(\.(\d)+)?(\]|\)))|\))$/
|
||||
|
||||
if (value.children.length > 0) {
|
||||
this.examine(value.children, issumm)
|
||||
}
|
||||
if (value.children.length == 0) {
|
||||
if (value.calculateType == 1 && (String(value.score).trim() === "" || isNaN(Number(String(value.score).trim())))) {
|
||||
issumm.is = false
|
||||
issumm.msg = '请检查是否有分值未填'
|
||||
}
|
||||
if (value.calculateType == 2 && (String(value.coefficient).trim() === "" || isNaN(Number(String(value.coefficient)
|
||||
.trim())))) {
|
||||
issumm.is = false
|
||||
issumm.msg = '请检查是否有系数未填'
|
||||
}
|
||||
if (value.calculateType == 3 && (String(value.custom).trim() === "" || JSON.parse(value.custom).formula.trim() ===
|
||||
"")) {
|
||||
issumm.is = false
|
||||
issumm.msg = '请检查是否有自定义评分未填'
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (!value.weight && value.weight != 0) {
|
||||
if (!Z.test(value.condition)) {
|
||||
issumm.is = false
|
||||
issumm.msg = '请检查是否有范围未填'
|
||||
}
|
||||
}
|
||||
if (!value.weight && value.weight != 0) {
|
||||
if (!value.fieldId) {
|
||||
issumm.is = false
|
||||
issumm.msg = '请检查是否有指标未选'
|
||||
}
|
||||
} else {
|
||||
if (!String(value.dimensionName).trim()) {
|
||||
issumm.is = false
|
||||
issumm.msg = '请检查是否有维度未填'
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
verification() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.code.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return true
|
||||
}
|
||||
if(this.verificationCode(this.code)||this.verificationName(this.name)){
|
||||
return true
|
||||
}
|
||||
let issumm = {
|
||||
is: true,
|
||||
msg: '提交失败 请检查是否有未填项'
|
||||
}
|
||||
|
||||
|
||||
if (this.code.trim() == '') {
|
||||
this.$message.error('请填入评分卡代码,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.name.trim() == '') {
|
||||
this.$message.error('请填入评分卡名称,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.description.trim() == '') {
|
||||
this.$message.error('请填入评分卡描述,并检查空格');
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.outcontent.forEach(value => {
|
||||
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType === "") {
|
||||
|
||||
issumm.is = false
|
||||
issumm.msg = '请检查自定义输出部分是否有未填项'
|
||||
}
|
||||
if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value.fieldValue).formula.trim() ===
|
||||
'')) {
|
||||
issumm.is = false
|
||||
issumm.msg = '请检查自定义输出部分是否有未填项'
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
this.examine(this.table, issumm)
|
||||
if (!issumm.is) {
|
||||
this.$message.error(issumm.msg);
|
||||
issumm.is = true
|
||||
return true
|
||||
}
|
||||
let num = 0
|
||||
let is = false
|
||||
this.table.forEach(value => {
|
||||
if (Number(value.weight) < 0) {
|
||||
is = true
|
||||
return true
|
||||
}
|
||||
if (String(value.weight).trim() == "") {
|
||||
is = true
|
||||
}
|
||||
num += Number(value.weight)
|
||||
|
||||
})
|
||||
if (is) {
|
||||
this.$message.error('权重不允许有负数或空值或空格');
|
||||
return true
|
||||
}
|
||||
if (num != 1 && num != 100 && num != 0) {
|
||||
this.$message.error('权重的和需要为100或1或0');
|
||||
return true
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
|
||||
if (this.verification()) {
|
||||
return
|
||||
}
|
||||
let obj = {
|
||||
"code": this.code.trim(),
|
||||
"name": this.name.trim(),
|
||||
"description": String(this.description).trim(),
|
||||
"author": null,
|
||||
"userId": null,
|
||||
"status": 1,
|
||||
"created": null,
|
||||
"updated": null,
|
||||
versionList: [{
|
||||
scorecardDimension: this.table,
|
||||
scoreCalculateType: this.scoreCalculateType,
|
||||
resultFieldEn: this.out,
|
||||
strategyOutputList: this.outcontent
|
||||
}]
|
||||
}
|
||||
|
||||
if (this.id == 0) {
|
||||
this.loading = true
|
||||
obj.parentId = this.nameId == 99999999 ? 0 : this.nameId
|
||||
obj.parentIds = this.nameId == 99999999 ? 0 : this.nameId
|
||||
obj.versionList[0].versionCode = 'V:0'
|
||||
obj.versionList[0].description = '初始版本'
|
||||
this.getData.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.$emit('Ok', res.data.id)
|
||||
this.versionList = res.data.versionList
|
||||
this.version = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.parentId = this.parentId
|
||||
obj.parentIds = this.parentId
|
||||
obj.versionList[0].id = this.version.id
|
||||
|
||||
this.loading = true
|
||||
this.getData.updatafield(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
// this.$emit('Ok')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
}
|
||||
},
|
||||
change(index) {
|
||||
this.ruledata[index].operator = ""
|
||||
this.ruledata[index].fieldValue = ""
|
||||
},
|
||||
faadd(index) { //rule父节点添加
|
||||
console.log(index)
|
||||
this.ruledata.content.splice(index, 0, {
|
||||
output: {
|
||||
field_name: '1'
|
||||
}
|
||||
})
|
||||
console.log(this.ruledata)
|
||||
|
||||
},
|
||||
fadelect(index) {
|
||||
this.ruledata.splice(index, 1)
|
||||
},
|
||||
// ====================================== v2.1 部分===================================
|
||||
addSon(index) {
|
||||
this.table[index].children.push({
|
||||
condition: '',
|
||||
children: [],
|
||||
id: null,
|
||||
"score": 1,
|
||||
"coefficient": null,
|
||||
"calculateType": 1,
|
||||
custom: '',
|
||||
})
|
||||
},
|
||||
delect(index) {
|
||||
this.table.splice(index, 1)
|
||||
},
|
||||
addBrother(index) {
|
||||
this.table.splice(index + 1, 0, {
|
||||
weight: 0,
|
||||
condition: '',
|
||||
dimensionName: '',
|
||||
children: [{
|
||||
condition: '',
|
||||
children: [],
|
||||
id: null,
|
||||
"score": 1,
|
||||
"fieldId": '',
|
||||
"coefficient": null,
|
||||
"calculateType": 1,
|
||||
custom: '',
|
||||
}],
|
||||
id: null,
|
||||
"score": 1,
|
||||
"coefficient": null,
|
||||
"calculateType": 1,
|
||||
custom: '',
|
||||
})
|
||||
},
|
||||
copy(index) {
|
||||
let obj = JSON.parse(JSON.stringify(this.table[index]))
|
||||
obj.id = null
|
||||
this.table.splice(index + 1, 0, obj)
|
||||
bus.$emit('look')
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
6
h5-enginex-manager/src/components/common/SCO/bus.js
Normal file
6
h5-enginex-manager/src/components/common/SCO/bus.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// 使用 Event Bus
|
||||
const bus = new Vue();
|
||||
|
||||
export default bus;
|
||||
159
h5-enginex-manager/src/components/common/SCO/recursion.vue
Normal file
159
h5-enginex-manager/src/components/common/SCO/recursion.vue
Normal file
@@ -0,0 +1,159 @@
|
||||
<style>
|
||||
.SCO_defen {
|
||||
position: absolute;
|
||||
right: -200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
width: 200px;
|
||||
height: 50px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
border-right: 1px solid #ddd;
|
||||
/* margin-top: 1px; */
|
||||
}
|
||||
|
||||
.el-dropdown-link {
|
||||
cursor: pointer;
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.el-icon-arrow-down {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.demonstration {
|
||||
display: block;
|
||||
color: #8492a6;
|
||||
font-size: 14px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
<div v-for="(item,index) in data.children" :style="{'boxSizing':'border-box','marginLeft':'-1px',display:'flex',borderLeft:'1px solid #ddd',minHeight:'50px',borderBottom:index==(data.children.length-1)?'':'1px solid #ddd'}">
|
||||
<div style="min-width: 295px;margin-left: 5px;margin-top: 5px;position: relative;">
|
||||
|
||||
|
||||
<div style="margin-left: 20px;">
|
||||
<textSelect :data="item" :Number="true"></textSelect>
|
||||
<textInput :text="String(item.condition)" @input="item.condition=$event"></textInput>
|
||||
</div>
|
||||
<div style="position: absolute;left: 0;top: 0;font-size: 12px;color: #409EFF;">
|
||||
<el-dropdown @command="handleCommand" trigger="click">
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-s-operation"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item icon="el-icon-bottom" :command="'addBrother|'+index">向下添加</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-right" :command="'addSon|'+index" v-show="!item.children.length">向右添加</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-close" :command="'delect|'+index">删除此字段</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-document-copy" :command="'copy|'+index">复制此字段</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<recursion v-if="item.children.length>0" :data="item" :tier="tier+1"></recursion>
|
||||
<div v-else class="SCO_defen" >
|
||||
<textSelect :data="item" :type="2" @change="item.score=1;item.coefficient=1;item.custom='';"></textSelect>
|
||||
<textInput style="width: 110px;" v-show="item.calculateType==1" :text="String(item.score)" :examine="2" @input="item.score=$event"></textInput>
|
||||
<textInput style="width: 110px;" v-show="item.calculateType==2" :text="String(item.coefficient)" :examine="2" @input="item.coefficient=$event"></textInput>
|
||||
<textCustom style="width: 110px;" v-if="item.calculateType==3" v-model="item.custom" ></textCustom>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import textInput from '@/components/common/textInput.vue'
|
||||
import textCustom from '@/components/common/textCustom.vue'
|
||||
import textSelect from '@/components/common/textSelect.vue'
|
||||
import bus from './bus.js'
|
||||
export default {
|
||||
components: {
|
||||
textInput,
|
||||
textSelect,
|
||||
textCustom
|
||||
},
|
||||
name: 'recursion',
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
tier: {
|
||||
type: Number,
|
||||
default: -1
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// console.log(this.tier,this.data)
|
||||
this.data.children.forEach(value=>{
|
||||
if(value.coefficient==null){
|
||||
value.coefficient = 0
|
||||
}
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
handleCommand(str) {
|
||||
console.log(str)
|
||||
switch (str.split('|')[0]) {
|
||||
case 'addBrother':
|
||||
this.addBrother(str.split('|')[1])
|
||||
break;
|
||||
case 'delect':
|
||||
this.delect(str.split('|')[1])
|
||||
break;
|
||||
case 'addSon':
|
||||
this.addSon(str.split('|')[1])
|
||||
break;
|
||||
case 'copy':
|
||||
this.copy(str.split('|')[1])
|
||||
break;
|
||||
}
|
||||
},
|
||||
addSon(index) {
|
||||
this.data.children[index].children.push({
|
||||
condition: '',
|
||||
children: [],
|
||||
id: null,
|
||||
"score": 1,
|
||||
"fieldId":'',
|
||||
"coefficient": null,
|
||||
"calculateType": 1,
|
||||
custom:'',
|
||||
})
|
||||
},
|
||||
delect(index) {
|
||||
this.data.children.splice(Number(index), 1)
|
||||
},
|
||||
addBrother(index) {
|
||||
this.data.children.splice(Number(index) + 1, 0, {
|
||||
condition: '',
|
||||
children: [],
|
||||
"score": 1,
|
||||
"coefficient": null,
|
||||
"fieldId":'',
|
||||
"calculateType": 1,
|
||||
custom:'',
|
||||
id: null,
|
||||
})
|
||||
bus.$emit('look')
|
||||
},
|
||||
copy(index) {
|
||||
let obj = JSON.parse(JSON.stringify(this.data.children[index]))
|
||||
obj.id = null
|
||||
this.data.children.splice(Number(index) + 1, 0, obj)
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
103
h5-enginex-manager/src/components/common/Sidebar.vue
Normal file
103
h5-enginex-manager/src/components/common/Sidebar.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<div class="sidebar">
|
||||
<el-menu class="sidebar-el-menu" :default-active="onRoutes" :collapse="collapse" background-color="#324157"
|
||||
text-color="#bfcbd9" active-text-color="#20a0ff" unique-opened :router="true">
|
||||
<template v-for="item in items">
|
||||
<template v-if="item.subs">
|
||||
<el-submenu :index="item.index" :key="item.index">
|
||||
<template slot="title">
|
||||
<i :class="item.icon"></i>
|
||||
<span slot="title">{{ item.title }}</span>
|
||||
</template>
|
||||
<template v-for="subItem in item.subs">
|
||||
<el-submenu v-if="subItem.subs" :index="subItem.index" :key="subItem.index">
|
||||
<template slot="title">{{ subItem.title }}</template>
|
||||
<el-menu-item v-for="(threeItem,i) in subItem.subs" :key="i" :index="threeItem.index">{{ threeItem.title }}</el-menu-item>
|
||||
</el-submenu>
|
||||
<el-menu-item v-else :index="subItem.index" :key="subItem.index">{{ subItem.title }}</el-menu-item>
|
||||
</template>
|
||||
</el-submenu>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-menu-item :index="item.index" :key="item.index">
|
||||
<i :class="item.icon"></i>
|
||||
<span slot="title">{{ item.title }}</span>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</template>
|
||||
</el-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import bus from './bus';
|
||||
import {
|
||||
getMenus
|
||||
} from '../../api/index';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
collapse: false,
|
||||
items: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
onRoutes() {
|
||||
return this.$route.path
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 通过 Event Bus 进行组件间通信,来折叠侧边栏
|
||||
bus.$on('collapse', msg => {
|
||||
this.collapse = msg;
|
||||
// bus.$emit('setcanvasn',msg)
|
||||
bus.$emit('collapse-content', msg);
|
||||
});
|
||||
|
||||
// 获取菜单接口
|
||||
this.getMenus()
|
||||
},
|
||||
|
||||
methods: {
|
||||
async getMenus() {
|
||||
const data = await getMenus({entity:{resourceSystem:'EngineX'}});
|
||||
// console.log('菜单接口返回的数据',data);
|
||||
if (data.status === "0") {
|
||||
this.$message.error(data.msg);
|
||||
if (data.error === "01000103") {
|
||||
this.$router.push('/login')
|
||||
}
|
||||
}
|
||||
|
||||
this.items = data.data;
|
||||
if(this.items.length == 0){
|
||||
this.$message.error('您没有导航权限,请联系管理员');
|
||||
}
|
||||
// console.log("items", this.items);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.sidebar {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 70px;
|
||||
bottom: 0;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.sidebar::-webkit-scrollbar {
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.sidebar-el-menu:not(.el-menu--collapse) {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.sidebar>ul {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
186
h5-enginex-manager/src/components/common/Tags.vue
Normal file
186
h5-enginex-manager/src/components/common/Tags.vue
Normal file
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<div class="tags" v-if="showTags">
|
||||
<ul>
|
||||
<li class="tags-li" v-for="(item,index) in tagsList" :class="{'active': isActive(item.path)}" :key="index">
|
||||
<router-link :to="item.path" class="tags-li-title">
|
||||
{{item.title}}
|
||||
</router-link>
|
||||
<span class="tags-li-icon" @click="closeTags(index)"><i class="el-icon-close"></i></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tags-close-box">
|
||||
<el-dropdown @command="handleTags">
|
||||
<el-button size="mini" type="primary">
|
||||
标签选项<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</el-button>
|
||||
<el-dropdown-menu size="small" slot="dropdown">
|
||||
<el-dropdown-item command="other">关闭其他</el-dropdown-item>
|
||||
<el-dropdown-item command="all">关闭所有</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import bus from './bus';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tagsList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isActive(path) {
|
||||
return path === this.$route.fullPath;
|
||||
},
|
||||
// 关闭单个标签
|
||||
closeTags(index) {
|
||||
const delItem = this.tagsList.splice(index, 1)[0];
|
||||
const item = this.tagsList[index] ? this.tagsList[index] : this.tagsList[index - 1];
|
||||
if (item) {
|
||||
delItem.path === this.$route.fullPath && this.$router.push(item.path);
|
||||
}else{
|
||||
this.$router.push('/');
|
||||
}
|
||||
},
|
||||
// 关闭全部标签
|
||||
closeAll(){
|
||||
this.tagsList = [];
|
||||
this.$router.push('/');
|
||||
},
|
||||
// 关闭其他标签
|
||||
closeOther(){
|
||||
const curItem = this.tagsList.filter(item => {
|
||||
return item.path === this.$route.fullPath;
|
||||
})
|
||||
this.tagsList = curItem;
|
||||
},
|
||||
// 设置标签
|
||||
setTags(route){
|
||||
const isExist = this.tagsList.some(item => {
|
||||
return item.path === route.fullPath;
|
||||
})
|
||||
if(!isExist){
|
||||
if(this.tagsList.length >= 8){
|
||||
this.tagsList.shift();
|
||||
}
|
||||
this.tagsList.push({
|
||||
title: route.meta.title,
|
||||
path: route.fullPath,
|
||||
name: route.matched[1].components.default.name
|
||||
})
|
||||
}
|
||||
bus.$emit('tags', this.tagsList);
|
||||
},
|
||||
handleTags(command){
|
||||
command === 'other' ? this.closeOther() : this.closeAll();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showTags() {
|
||||
return this.tagsList.length > 0;
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
$route(newValue, oldValue){
|
||||
this.setTags(newValue);
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.setTags(this.$route);
|
||||
// 监听关闭当前页面的标签页
|
||||
bus.$on('close_current_tags', () => {
|
||||
for (let i = 0, len = this.tagsList.length; i < len; i++) {
|
||||
const item = this.tagsList[i];
|
||||
if(item.path === this.$route.fullPath){
|
||||
if(i < len - 1){
|
||||
this.$router.push(this.tagsList[i+1].path);
|
||||
}else if(i > 0){
|
||||
this.$router.push(this.tagsList[i-1].path);
|
||||
}else{
|
||||
this.$router.push('/');
|
||||
}
|
||||
this.tagsList.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
.tags {
|
||||
position: relative;
|
||||
height: 30px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
padding-right: 120px;
|
||||
box-shadow: 0 5px 10px #ddd;
|
||||
}
|
||||
|
||||
.tags ul {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.tags-li {
|
||||
float: left;
|
||||
margin: 3px 5px 2px 3px;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
height: 23px;
|
||||
line-height: 23px;
|
||||
border: 1px solid #e9eaec;
|
||||
background: #fff;
|
||||
padding: 0 5px 0 12px;
|
||||
vertical-align: middle;
|
||||
color: #666;
|
||||
-webkit-transition: all .3s ease-in;
|
||||
-moz-transition: all .3s ease-in;
|
||||
transition: all .3s ease-in;
|
||||
}
|
||||
|
||||
.tags-li:not(.active):hover {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.tags-li.active {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tags-li-title {
|
||||
float: left;
|
||||
max-width: 80px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
margin-right: 5px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tags-li.active .tags-li-title {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tags-close-box {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
box-sizing: border-box;
|
||||
padding-top: 1px;
|
||||
text-align: center;
|
||||
width: 110px;
|
||||
height: 30px;
|
||||
background: #fff;
|
||||
box-shadow: -3px 0 15px 3px rgba(0, 0, 0, .1);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
</style>
|
||||
286
h5-enginex-manager/src/components/common/Version.vue
Normal file
286
h5-enginex-manager/src/components/common/Version.vue
Normal file
@@ -0,0 +1,286 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="Rule_version">
|
||||
<el-select value="V:0" placeholder="请选择版本" v-if="!id" :disabled="true" @change="versionChange" size='mini'>
|
||||
</el-select>
|
||||
<el-select v-model="version.id" placeholder="请选择版本" v-else :disabled="addVersionStatus"
|
||||
@change="versionChange" size='mini'>
|
||||
<el-option v-for="item in ruleVersionList" :key="item.id" :label="item.versionCode" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button plain class="Rule_version_buttom" style="margin-left: 10px;" size='mini' @click="addVersion"
|
||||
v-show="!addVersionStatus" :disabled="!id">新增版本</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' type="success" @click="sureAddVersion"
|
||||
v-show="addVersionStatus">确认新增</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' type="danger" @click="addVersionClose"
|
||||
v-show="addVersionStatus">取消新增</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' @click="$emit('Dialog',true)"
|
||||
:disabled="addVersionStatus||!id">复制版本</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' @click="updateVersion=true;$emit('Dialog',true)"
|
||||
:disabled="addVersionStatus||!id">版本重命名</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' type="danger" @click="delectVersion"
|
||||
:disabled="addVersionStatus||!id">删除此版本</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' @click="$emit('exportVersion')"
|
||||
v-if="exportVersion" :disabled="addVersionStatus||!id">导出此版本</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' @click="importVersion" v-if="exportVersion"
|
||||
:disabled="addVersionStatus||!id">导入版本</el-button>
|
||||
|
||||
<span style="font-size: 12px;color: #999;margin-left: 10px;">切换版本并不会自动保存内容 请手动保存</span>
|
||||
|
||||
</div>
|
||||
<span style="color: #00A854;font-size: 14px;margin-left: 10px;">版本描述:{{id?version.description:'初始版本'}}</span>
|
||||
<el-dialog title="提示" :visible.sync="addVersionDialog" width="30%"
|
||||
@close="updateVersion=false;tempVersion.versionCode='',tempVersion.description=''"
|
||||
:close-on-click-modal="false" :close-on-press-escape="false" :show-close="false">
|
||||
<div v-loading="addVersionLoading">
|
||||
<p style="margin-top: 20px;"><span style="width: 30%;">新版本名称:</span>
|
||||
<el-input placeholder="请输入新版本名称" maxlength="30" v-model="tempVersion.versionCode" clearable
|
||||
style="width: 70%;"></el-input>
|
||||
</p>
|
||||
<p style="margin-top: 20px;"><span style="width: 30%;">新版本描述:</span>
|
||||
<el-input placeholder="请输入新版本描述" maxlength="30" v-model="tempVersion.description" clearable
|
||||
style="width: 70%;"></el-input>
|
||||
</p>
|
||||
<div slot="footer" class="dialog-footer" style="text-align: right;margin-top: 20px;">
|
||||
<el-button @click="$emit('Dialog',false)">取 消</el-button>
|
||||
<el-button type="primary" @click="addVersionSure">确 定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog title="提示" :visible.sync="importVersionDialog" width="30%" @close="" :close-on-click-modal="false"
|
||||
:close-on-press-escape="false" :show-close="false">
|
||||
<div v-loading="importVersionLoading">
|
||||
<p style="margin-top: 20px;"><span style="width: 30%;">新版本名称:</span>
|
||||
<el-input placeholder="请输入新版本名称" maxlength="30" v-model="tempVersion.versionCode" clearable
|
||||
style="width: 70%;"></el-input>
|
||||
</p>
|
||||
<p style="margin-top: 20px;"><span style="width: 30%;">新版本描述:</span>
|
||||
<el-input placeholder="请输入新版本描述" maxlength="30" v-model="tempVersion.description" clearable
|
||||
style="width: 70%;"></el-input>
|
||||
</p>
|
||||
|
||||
<div style="display: flex;justify-content: center;padding-top: 20px;">
|
||||
<el-upload class="upload-demo" ref="upload" action="doUpload" :limit="1" :file-list="fileList"
|
||||
:before-upload="beforeUpload" v-loading="Uploadloading">
|
||||
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传json文件,且不超过5MB</div>
|
||||
<div slot="tip" class="el-upload-list__item-name">{{fileName}}</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
|
||||
<div slot="footer" class="dialog-footer" style="text-align: right;margin-top: 20px;">
|
||||
<el-button @click="importVersionDialog=false">取 消</el-button>
|
||||
<el-button type="primary" @click="importVersionSure">确 定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
ruleVersionList: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
version: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
id: '',
|
||||
description: '',
|
||||
versionCode: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
addVersionDialog: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
addVersionLoading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
addVersionStatus: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
exportVersion: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tempJsonObj: null,
|
||||
files: null,
|
||||
fileName: '',
|
||||
fileList: [],
|
||||
importVersionDialog: false,
|
||||
importVersionLoading: false,
|
||||
Uploadloading: false,
|
||||
tempVersion: {
|
||||
versionCode: '',
|
||||
description: '',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
beforeUpload(file) {
|
||||
// console.log(file, '文件');
|
||||
this.files = file;
|
||||
const extension = file.name.split('.')[file.name.split('.').length - 1] === 'json'
|
||||
const isLt2M = file.size / 1024 / 1024 < 5
|
||||
if (!extension) {
|
||||
this.$message.warning('上传模板只能是 json格式!')
|
||||
return
|
||||
}
|
||||
if (!isLt2M) {
|
||||
this.$message.warning('上传模板大小不能超过 5MB!')
|
||||
return
|
||||
}
|
||||
this.fileName = file.name;
|
||||
|
||||
var reader = new FileReader() // 新建一个FileReader
|
||||
reader.readAsText(file, 'UTF-8') // 读取文件
|
||||
reader.onload =(evt)=>{ // 读取完文件之后会回来这里
|
||||
this.tempJsonObj = JSON.parse(evt.target.result) // 读取文件内容
|
||||
console.log(this.tempJsonObj)
|
||||
}
|
||||
return false // 返回false不会自动上传
|
||||
},
|
||||
importVersionSure() {
|
||||
if(this.tempJsonObj==null){
|
||||
this.$message.error('请上传文件')
|
||||
return
|
||||
}
|
||||
if(this.tempVersion.versionCode.trim()===''){
|
||||
this.$message.error('请填写新版本名称')
|
||||
return
|
||||
}
|
||||
if(this.tempVersion.description.trim()===''){
|
||||
this.$message.error('请填写新版本描述')
|
||||
return
|
||||
}
|
||||
console.log(JSON.parse(JSON.stringify(this.tempJsonObj)))
|
||||
this.$emit('importNewVersion',{data:JSON.parse(JSON.stringify(this.tempJsonObj)),name:JSON.parse(JSON.stringify(this.tempVersion))})
|
||||
this.tempJsonObj=null
|
||||
this.tempVersion.versionCode=''
|
||||
this.tempVersion.description=''
|
||||
this.importVersionDialog = false
|
||||
},
|
||||
importVersion() {
|
||||
this.importVersionDialog = true
|
||||
},
|
||||
versionChange(e) {
|
||||
this.ruleVersionList.forEach(value => {
|
||||
if (value.id === this.version.id) {
|
||||
this.$emit('versionChange', value)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
addVersion(e) {
|
||||
// this.addVersionStatus = true
|
||||
this.$emit('StatusChange', true)
|
||||
this.$emit('addVersion', e)
|
||||
},
|
||||
sureAddVersion(e) {
|
||||
this.$emit('addVersionExamine', this.tempVersion)
|
||||
// this.addVersionDialog = true
|
||||
// this.$emit('Dialog',true)
|
||||
},
|
||||
delectVersion(e) {
|
||||
if (this.ruleVersionList.length == 1) {
|
||||
this.$message.error('最少要有一个版本存在')
|
||||
return
|
||||
}
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$emit('delectVersion', e)
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
addVersionSure(e) {
|
||||
if (this.verificationTempVersion()) {
|
||||
this.addVersionLoading = false
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
console.log(1)
|
||||
if (this.addVersionStatus) { // 添加版本
|
||||
this.$emit('addVersionSure', this.tempVersion)
|
||||
} else if (this.updateVersion) { //重命名版本
|
||||
this.$emit('updateVersion', this.tempVersion)
|
||||
} else { // 复制版本
|
||||
this.$emit('copyVersion', this.tempVersion)
|
||||
}
|
||||
// this.addVersionStatus = false
|
||||
// this.$emit('StatusChange',false)
|
||||
|
||||
},
|
||||
addVersionClose(e) {
|
||||
// this.addVersionStatus = false
|
||||
this.$emit('StatusChange', false)
|
||||
this.$emit('addVersionClose', e)
|
||||
},
|
||||
verificationTempVersion() {
|
||||
if (this.tempVersion.versionCode.trim() === "") {
|
||||
this.$message.error('请填入新版本名称')
|
||||
return true
|
||||
}
|
||||
let is = {
|
||||
is: false,
|
||||
msg: '',
|
||||
}
|
||||
this.ruleVersionList.forEach(value => {
|
||||
if (value.versionCode === this.tempVersion.versionCode) {
|
||||
is.is = true
|
||||
is.msg = '已存在此版本名'
|
||||
}
|
||||
})
|
||||
if (is.is) {
|
||||
this.$message.error(is.msg)
|
||||
return true
|
||||
}
|
||||
if (this.tempVersion.description.trim() === "") {
|
||||
this.$message.error('请填入新版本描述')
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.Rule_version {
|
||||
/* margin-top: 20px; */
|
||||
padding-left: 10px;
|
||||
}
|
||||
</style>
|
||||
108
h5-enginex-manager/src/components/common/ZoomView.vue
Normal file
108
h5-enginex-manager/src/components/common/ZoomView.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<style>
|
||||
.zoomView {
|
||||
background-color: #eee;
|
||||
height: 250px;
|
||||
/* overflow: hidden; */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#zoomView_cont {
|
||||
background-color: #DDDDDD;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
transition: all 0.1s;
|
||||
position: absolute;
|
||||
user-select: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
.zoomView_modal{
|
||||
/* background-color: #0000FF; */
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 9;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="zoomView" @mouseup="mouseup" ref="zoomView">
|
||||
<span style="font-size: 12px;color: #aaa;">双击回归原位置</span>
|
||||
<div id="zoomView_cont" ref="zoomViewCont" :style="{transform: 'scale('+mult+','+mult+')',top:top,left:left}">
|
||||
<div class="zoomView_modal">
|
||||
|
||||
</div>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
mult: 1,
|
||||
ismove: false,
|
||||
timeout: null,
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
ClientX: '',
|
||||
ClientY: '',
|
||||
OffsetLeft: '',
|
||||
OffsetTop: '',
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.onmousemove = () => {}
|
||||
window.mouseup = () => {}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.zoomView.onmousewheel = (e) => {
|
||||
this.mult -= e.deltaY / 1000
|
||||
if (this.mult >= 1) {
|
||||
|
||||
} else {
|
||||
this.mult = 1
|
||||
}
|
||||
}
|
||||
this.$refs.zoomView.onmousedown = (e) => {
|
||||
this.ismove = true
|
||||
this.ClientX = e.clientX;
|
||||
this.ClientY = e.clientY;
|
||||
this.OffsetLeft = this.$refs.zoomViewCont.offsetLeft
|
||||
this.OffsetTop = this.$refs.zoomViewCont.offsetTop
|
||||
}
|
||||
window.onmousemove = (e) => {
|
||||
if (this.ismove && (new Date() - this.timeout > 50 || this.timeout == null)) {
|
||||
|
||||
|
||||
this.top = e.clientY - (this.ClientY - this.OffsetTop) + 'px'
|
||||
this.left = e.clientX - (this.ClientX - this.OffsetLeft) + 'px'
|
||||
|
||||
|
||||
|
||||
this.timeout = new Date()
|
||||
}
|
||||
|
||||
}
|
||||
window.mouseup = () => {
|
||||
this.ismove = false
|
||||
}
|
||||
this.$refs.zoomViewCont.ondblclick = () => {
|
||||
this.top = '0px'
|
||||
this.left = '0px'
|
||||
this.mult = 1
|
||||
}
|
||||
this.$refs.zoomView.ondblclick = () => {
|
||||
this.top = '0px'
|
||||
this.left = '0px'
|
||||
this.mult = 1
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
mouseup() {
|
||||
this.ismove = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
87
h5-enginex-manager/src/components/common/autoInput.vue
Normal file
87
h5-enginex-manager/src/components/common/autoInput.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<!-- <div> -->
|
||||
<el-form class="formItenBox">
|
||||
<div v-for="value in rule" :key="value.name">
|
||||
<!-- {{value.name}} -->
|
||||
<div class="formItem" >
|
||||
<p class="formItemTitle">{{ value.label }}</p>
|
||||
<el-input v-if="value.type == String" v-model="data[value.name]" size="mini" class="formInput">
|
||||
</el-input>
|
||||
<el-input v-if="value.type == Number" type="number" v-model="data[value.name]" size="mini"
|
||||
class="formInput"></el-input>
|
||||
|
||||
<el-switch v-if="value.type == Boolean" v-model="data[value.name]" active-color="#13ce66"
|
||||
inactive-color="#ff4949" size="mini"></el-switch>
|
||||
<el-date-picker v-if="value.type == Date" v-model="data[value.name]" type="datetime"
|
||||
placeholder="选择日期时间" size="mini" class="formInput">
|
||||
</el-date-picker>
|
||||
<el-select v-if="value.type == 'Enum'" v-model="data[value.name]" size="mini"
|
||||
class="formInput">
|
||||
<el-option v-for="item in value.Enum" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
<!-- </div> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
rule: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
this.rule.forEach(value=>{
|
||||
if(value.defaultValue){
|
||||
if(!this.data[value.name]){
|
||||
this.data[value.name] = value.defaultValue
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.formItenBox {
|
||||
align-content: space-around;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-content: flex-start;
|
||||
flex-flow: row wrap;
|
||||
flex-direction: column;
|
||||
}
|
||||
.formInput {
|
||||
width: 300px !important;
|
||||
}
|
||||
.formItem {
|
||||
width: 420px;
|
||||
display: flex;
|
||||
|
||||
margin-top: 5px;
|
||||
align-items: center;
|
||||
}
|
||||
.formItemTitle {
|
||||
width: 40%;
|
||||
justify-content: flex-end;
|
||||
padding-right: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
86
h5-enginex-manager/src/components/common/bigElCascader.vue
Normal file
86
h5-enginex-manager/src/components/common/bigElCascader.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<el-cascader :value="value" @input="$emit('input',$evnet)" v-el-select-loadmore="loadMore(num)" filterable
|
||||
:size="size" :options="MyOptions" clearable @change="$emit('change',$event)" :key="Mykey" :props="props">
|
||||
</el-cascader>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
options: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
Mykey: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
props: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
expandTrigger: 'hover'
|
||||
}
|
||||
}
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: 'mini'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
num: 10,
|
||||
MyOptions: [],
|
||||
page: 1
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadMore()
|
||||
},
|
||||
methods: {
|
||||
loadMore(n) {
|
||||
let start = (this.page - 1) * 10
|
||||
this.MyOptions.push(...this.options.splice(start, start + 10))
|
||||
console.log(this.MyOptions)
|
||||
this.page++
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
directives: {
|
||||
|
||||
'el-select-loadmore': (el, binding) => {
|
||||
// 获取element-ui定义好的scroll盒子
|
||||
const SELECTWRAP_DOM = el.querySelector(".el-cascader-menu .el-scrollbar__wrap");
|
||||
console.log(SELECTWRAP_DOM)
|
||||
if (SELECTWRAP_DOM) {
|
||||
SELECTWRAP_DOM.addEventListener("scroll", function() {
|
||||
/**
|
||||
* scrollHeight 获取元素内容高度(只读)
|
||||
* scrollTop 获取或者设置元素的偏移值,
|
||||
* 常用于:计算滚动条的位置, 当一个元素的容器没有产生垂直方向的滚动条, 那它的scrollTop的值默认为0.
|
||||
* clientHeight 读取元素的可见高度(只读)
|
||||
* 如果元素滚动到底, 下面等式返回true, 没有则返回false:
|
||||
* ele.scrollHeight - ele.scrollTop === ele.clientHeight;
|
||||
*/
|
||||
const condition = this.scrollHeight - this.scrollTop <= this.clientHeight;
|
||||
if (condition) this.loadMore();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
94
h5-enginex-manager/src/components/common/bindParam.vue
Normal file
94
h5-enginex-manager/src/components/common/bindParam.vue
Normal file
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<div>
|
||||
<p style="margin-top: 20px;padding-top: 10px;display: flex;align-items: center;">
|
||||
变量:<i class="el-icon-circle-plus-outline" style="color:#409EFF;font-size: 24px;" @click="addVariable"></i>
|
||||
</p>
|
||||
|
||||
<div v-for="(value,index) in Variable" style="display: flex;align-items: center;margin-top: 10px;">
|
||||
<el-input v-model="value.key" style="width: 200px;" placeholder="键" :size="size"></el-input>
|
||||
<p style="margin:10px;">:</p>
|
||||
<el-input v-model="value.value" style="width: 200px;" placeholder="默认值" :size="size"></el-input>
|
||||
<i class="el-icon-circle-close" :style="{color:'#F56C6C',fontSize: '24px',marginLeft:'10px'}"
|
||||
@click="delectVariable(index)"></i>
|
||||
</div>
|
||||
|
||||
|
||||
<p style="margin-top: 20px;display: flex;align-items: center;">
|
||||
字典变量:<i class="el-icon-circle-plus-outline" style="color:#409EFF;font-size: 24px;"
|
||||
@click="addDictVariable"></i></p>
|
||||
|
||||
<div v-for="(value,index) in dictVariable" style="display: flex;align-items: center;margin-top: 10px;">
|
||||
<el-input v-model="value.key" style="width: 200px;" placeholder="键" :size="size"></el-input>
|
||||
<p style="margin:10px;">:</p>
|
||||
<el-select v-model="value.type" placeholder="请选择类型" :size="size">
|
||||
<el-option v-for="item in dictVariableType" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-input v-model="value.value" style="width: 200px;margin-left: 20px;" placeholder="格式" :size="size"></el-input>
|
||||
<i class="el-icon-circle-close" :style="{color:'#F56C6C',fontSize: '24px',marginLeft:'10px'}"
|
||||
@click="delectDictVariable(index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
Variable: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
dictVariable: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
size:{
|
||||
type: String,
|
||||
default:''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dictVariableType: [{
|
||||
label: '时间',
|
||||
value: 'date'
|
||||
}]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addVariable() {
|
||||
this.Variable.push({
|
||||
value: '',
|
||||
key: ''
|
||||
})
|
||||
},
|
||||
delectVariable(index) {
|
||||
this.Variable.splice(index, 1)
|
||||
},
|
||||
addDictVariable() {
|
||||
this.dictVariable.push({
|
||||
key: '',
|
||||
type: '',
|
||||
value: ''
|
||||
})
|
||||
},
|
||||
delectDictVariable(index) {
|
||||
|
||||
this.dictVariable.splice(index, 1)
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
6
h5-enginex-manager/src/components/common/bus.js
Normal file
6
h5-enginex-manager/src/components/common/bus.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// 使用 Event Bus
|
||||
const bus = new Vue();
|
||||
|
||||
export default bus;
|
||||
55
h5-enginex-manager/src/components/common/charts.vue
Normal file
55
h5-enginex-manager/src/components/common/charts.vue
Normal file
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<div :id="sid" :style="{height: height,width:width}">
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as echarts from 'echarts';
|
||||
export default {
|
||||
props: {
|
||||
sid: {
|
||||
type: String,
|
||||
default: 'echartsId'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
},
|
||||
option: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chartDom: null,
|
||||
myChart: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.chartDom = document.getElementById(this.sid);
|
||||
this.myChart = echarts.init(this.chartDom);
|
||||
this.myChart.setOption(this.option);
|
||||
},
|
||||
watch: {
|
||||
option: {
|
||||
handler: function() {
|
||||
this.myChart.clear()
|
||||
this.myChart.setOption(this.option);
|
||||
},
|
||||
// 开启深度监听:只要obj中的任何一个属性发生改变,都会触发相应的代码
|
||||
deep: true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
101
h5-enginex-manager/src/components/common/codemirror.vue
Normal file
101
h5-enginex-manager/src/components/common/codemirror.vue
Normal file
@@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<textarea :ref="MYname" class="codesql" :value="value" style="height:200px;width:600px;" :key="keynum"></textarea>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import "codemirror/theme/ambiance.css";
|
||||
import "codemirror/theme/ayu-dark.css";
|
||||
import "codemirror/lib/codemirror.css";
|
||||
import "codemirror/addon/hint/show-hint.css";
|
||||
|
||||
let CodeMirror = require("codemirror/lib/codemirror");
|
||||
require("codemirror/addon/edit/matchbrackets");
|
||||
require("codemirror/addon/selection/active-line");
|
||||
require("codemirror/mode/javascript/javascript");
|
||||
require("codemirror/mode/sql/sql");
|
||||
require("codemirror/mode/lua/lua");
|
||||
require("codemirror/addon/hint/show-hint");
|
||||
require("codemirror/addon/hint/sql-hint");
|
||||
require("codemirror/addon/hint/javascript-hint");
|
||||
export default {
|
||||
name: "codeMirror",
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: '123'
|
||||
},
|
||||
mime: {
|
||||
type: String,
|
||||
default: 'text/javascript'
|
||||
},
|
||||
autocomplete: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
MYname: {
|
||||
type: String,
|
||||
default: 'mycode'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keynum: 0,
|
||||
editor: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.keynum = 1
|
||||
this.keynum = 0
|
||||
console.log(this.value)
|
||||
},
|
||||
watch:{
|
||||
mime() {
|
||||
|
||||
this.editor.setOption("mode", this.mime)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// let mime = 'text/x-sql'
|
||||
let mime = this.mime
|
||||
let theme = 'ayu-dark' //设置主题,不设置的会使用默认主题
|
||||
let extraKeys = this.autocomplete ? {
|
||||
'Tab': 'autocomplete'
|
||||
} : {}
|
||||
|
||||
this.editor = CodeMirror.fromTextArea(this.$refs[this.MYname], {
|
||||
mode: mime, //选择对应代码编辑器的语言,我这边选的是数据库,根据个人情况自行设置即可
|
||||
indentWithTabs: true,
|
||||
smartIndent: true,
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
theme: theme,
|
||||
// autofocus: true,
|
||||
extraKeys: extraKeys, //自定义快捷键
|
||||
hintOptions: { //自定义提示选项
|
||||
tables: {
|
||||
users: ['name', 'score', 'birthDate'],
|
||||
countries: ['name', 'population', 'size']
|
||||
}
|
||||
}
|
||||
})
|
||||
this.editor.on('changes', (e,e2) => {
|
||||
// console.log( e.display.maxLine.text)
|
||||
let str = e.display.view?e.display.view.map(x=>x.line.text).join(''):''
|
||||
this.$emit('input', str)
|
||||
})
|
||||
console.log(this.editor)
|
||||
//
|
||||
},
|
||||
beforeUnmount() {
|
||||
console.log(1)
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.codesql {
|
||||
font-size: 11pt;
|
||||
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
}
|
||||
</style>
|
||||
56
h5-enginex-manager/src/components/common/condition.vue
Normal file
56
h5-enginex-manager/src/components/common/condition.vue
Normal file
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
+
|
||||
</div>
|
||||
<div>
|
||||
X
|
||||
</div>
|
||||
<div>
|
||||
<el-select v-model="value" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in inp1"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<input type="text">
|
||||
</div>
|
||||
<div>
|
||||
<input type="text">
|
||||
</div>
|
||||
<div>
|
||||
<input type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default{
|
||||
porps:{
|
||||
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
value:1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
351
h5-enginex-manager/src/components/common/cont.vue
Normal file
351
h5-enginex-manager/src/components/common/cont.vue
Normal file
@@ -0,0 +1,351 @@
|
||||
|
||||
|
||||
<template>
|
||||
<div class="cont_cont">
|
||||
|
||||
<div class="cont_left" v-loading="leftloading">
|
||||
<div class="cont_header">
|
||||
<p class="cont_header_title">{{title}}</p>
|
||||
<p class="cont_header_subtitle">{{title}}</p>
|
||||
</div>
|
||||
|
||||
<contNewFule v-model="tempNewF" :newf.sync="newf" @newFileSure="newFileSure" @newFile="newFile" ></contNewFule>
|
||||
<div class="cont_list">
|
||||
<fileHome :data="list" @curr="clickCurrid" :currid="currid" @RenameFun="RenameFun" @RenameClose="RenameClose"
|
||||
@updatafilelist="updatafilelist" @delectFun="delectFun">
|
||||
</fileHome>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right" v-loading="contloading" @click="tempHintLeft=null;tempHintTop=null;">
|
||||
<div v-if="!listRedact">
|
||||
<div v-if="showRight===false" class="cont_right_hint">
|
||||
请先选择左侧文件夹
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="cont_right_top">
|
||||
<div>
|
||||
<el-button type="primary" @click="listRedact=true" :disabled="currid!=99999999?false:'disabled'">新增</el-button>
|
||||
<el-button type="danger" @click="using(-1)" :disabled="this.selection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button type="success" @click="using(1)" :disabled="this.selection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button type="warning" @click="using(0)" :disabled="this.selection.length>0?false:'disabled'">停用</el-button>
|
||||
<!-- <el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'" filterable @change="mixinMoveChange"> -->
|
||||
<el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'"
|
||||
filterable @change="moveChange">
|
||||
<el-option v-for="value in listunfold" :key="value.id" :label="value.name" :value="value.id" v-show="value.id!=99999999"></el-option>
|
||||
</el-select>
|
||||
<!-- 断点 准备移动 -->
|
||||
</div>
|
||||
<div v-if="getData.type==1">
|
||||
<el-button @click="upShow=true">批量导入</el-button>
|
||||
<el-button @click="down">模板下载</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right_cont">
|
||||
<div v-if="data">
|
||||
<el-table border :data="data.data.klist" @select-all="selectAll" @select="select" style="width: 100%"
|
||||
:cell-style="{padding: '10px'}">
|
||||
<el-table-column type="selection" width="70">
|
||||
</el-table-column>
|
||||
<el-table-column v-for="item in getData.row" :key="item.id" :prop="item.row" :label="item.label" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="item.type==='Blooen'">
|
||||
{{scope.row[item.row]?"是":"否"}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='State'">
|
||||
{{scope.row[item.row]=="1"?'启用':'未启用'}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='type'">
|
||||
{{scope.row[item.row]=="1"?'数值型':(scope.row[item.row]=="2"?'字符型':(scope.row[item.row]=="3"?'枚举型':(scope.row[item.row]=="4"?'小数型':(scope.row[item.row]=="5"?'数组型':(scope.row[item.row]=="6"?'JSON型':'')))))}}
|
||||
</span>
|
||||
<span v-else-if="item.fn">
|
||||
{{item.fn(scope.row[item.row])}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='Time'" style="white-space: nowrap;" class="contText">{{
|
||||
new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row[item.row]).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
<span class="contText" v-else>
|
||||
{{scope.row[item.row]}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-button icon="el-icon-setting" circle size="mini" @click="dialogShow(scope.row.id)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="float: right;margin-right: 40px;margin-top: 40px;" :current-page="currPage"
|
||||
@current-change="clickpage" background layout="prev, pager, next" :total="data.data.pager.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<template v-else>
|
||||
<dataManageRedact @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist();currPage=1"
|
||||
:updata="getData.updatafield" :id='tempRedactId' :fieldTypeId="currid" :setsave="getData.setsave" :getInfo="getData.getInfo"
|
||||
:ftype="getData.type"></dataManageRedact>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<el-dialog title="上传文件" :visible.sync="upShow" width="30%" :before-close="upShowClose">
|
||||
<div style="margin: 0 auto;display: flex;justify-content: center;">
|
||||
<el-upload class="upload-demo" ref="upload" action="doUpload" :limit="1" :file-list="fileList" :before-upload="beforeUpload"
|
||||
v-loading="Uploadloading">
|
||||
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传excel文件,且不超过5MB</div>
|
||||
<div slot="tip" class="el-upload-list__item-name">{{fileName}}</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="upShow = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitUpload()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import contNewFule from '@/components/common/contNewFile.vue'
|
||||
import '@/assets/css/cont.css'
|
||||
import fileHome from '@/components/common/fileHome.vue'
|
||||
import dataManageRedact from '@/components/common/dataManageRedact.vue'
|
||||
import contmixin from '@/utils/contminxin/contmixin.js'
|
||||
import {
|
||||
updateFieldFolder
|
||||
} from '@/api/index.js'
|
||||
export default {
|
||||
mixins: [
|
||||
contmixin
|
||||
],
|
||||
components: {
|
||||
fileHome,
|
||||
dataManageRedact,
|
||||
updateFieldFolder,
|
||||
contNewFule
|
||||
},
|
||||
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
|
||||
},
|
||||
watch: {
|
||||
list() {
|
||||
if (this.list.length > 0) {
|
||||
this.leftloading = false
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
Uploadloading: false,
|
||||
tempMove: '',
|
||||
leftloading: true,
|
||||
fileName: "",
|
||||
fileList: [],
|
||||
upShow: false,
|
||||
currPage: 1,
|
||||
currid: null,
|
||||
data: null,
|
||||
contloading: false,
|
||||
newf: false,
|
||||
tempNewF: "",
|
||||
tempHintTop: null,
|
||||
tempHintLeft: null,
|
||||
tempId: null,
|
||||
listRedact: false, //新增页面开启
|
||||
tempRedactId: 0,
|
||||
selection: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getData.getTree({
|
||||
type: this.getData.type
|
||||
}).then(res => {
|
||||
this.list = this.listTreeDeep(res.data, 1)
|
||||
this.clickCurrid(99999999)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
moveChange(e) { //移动文件夹
|
||||
let arr = this.selection.map((value) => {
|
||||
return value.id
|
||||
})
|
||||
if (arr.length < 1) {
|
||||
this.$message.error('未选择任何文件');
|
||||
return
|
||||
}
|
||||
let params = {
|
||||
ids: arr,
|
||||
folderId: e
|
||||
}
|
||||
updateFieldFolder(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.clickCurrid(this.currid)
|
||||
this.$message({
|
||||
message: '移动成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.selection = []
|
||||
}
|
||||
})
|
||||
this.tempMove = ""
|
||||
},
|
||||
|
||||
down() {
|
||||
window.open(window.origin + '/Riskmanage/v2/datamanage/field/downTemplate')
|
||||
},
|
||||
delectFun(id) {
|
||||
let name
|
||||
this.deepGetCurr(id, this.list, (value) => {
|
||||
name = value.name
|
||||
})
|
||||
let params = {
|
||||
status: -1,
|
||||
id: id,
|
||||
fieldType: name
|
||||
}
|
||||
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
|
||||
})
|
||||
},
|
||||
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
|
||||
let obj = {
|
||||
fieldType: params.name,
|
||||
id: params.id,
|
||||
parentId: params.parentId
|
||||
}
|
||||
this.getData.updatalist(obj).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
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
getlist() {
|
||||
this.contloading = true
|
||||
this.listRedact = false
|
||||
let params = {
|
||||
"isCommon": 1,
|
||||
"fieldTypeId": String(this.currid),
|
||||
"pageNo": 1
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
|
||||
},
|
||||
clickpage(e) {
|
||||
this.currPage = e
|
||||
this.contloading = true
|
||||
let params = {
|
||||
"isCommon": 1,
|
||||
"fieldTypeId": String(this.currid),
|
||||
"pageNo": e
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.data = res
|
||||
this.selection = []
|
||||
this.contloading = 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(','),
|
||||
fieldTypeId: this.currid
|
||||
}
|
||||
|
||||
this.getData.fieldusing(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.getlist()
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
}
|
||||
})
|
||||
},
|
||||
newFileSure() {
|
||||
this.leftloading = true
|
||||
let params = {
|
||||
parentId: this.currid,
|
||||
fieldType: this.tempNewF,
|
||||
type: this.getData.type
|
||||
}
|
||||
if(this.mixnewFileZindexVerify(this.list,this.currid)==6){
|
||||
this.$message.error('已达到最深层级')
|
||||
this.leftloading = false
|
||||
return
|
||||
}
|
||||
|
||||
this.mixnewFileSure(params)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
45
h5-enginex-manager/src/components/common/contNewFile.vue
Normal file
45
h5-enginex-manager/src/components/common/contNewFile.vue
Normal file
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<div class="cont_new_file">
|
||||
<div v-if="!newf" @click="newFile"><i class="el-icon-folder-add" @click="newFile" style="margin-right: 10px;"></i>新建文件夹</div>
|
||||
<div v-else style="padding: 5px;box-sizing:border-box;">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<i class="el-icon-folder-add" @click="newFile" style="margin-right: 10px;"></i>
|
||||
<el-input :value="value" @input="$emit('input',$event)" placeholder="请输入新文件夹名字,最长20个字符" size="small" @keyup.enter.native="newFileSure"></el-input>
|
||||
</div>
|
||||
<el-button style="margin-left: 60px;margin-top: 10px;" type="danger" icon="el-icon-close" circle size="mini"
|
||||
@click="newFileClose"></el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle size="mini" @click="newFileSure"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default{
|
||||
props:{
|
||||
newf:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
value:{
|
||||
type:String,
|
||||
default:''
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
newFile(){
|
||||
this.$emit('newFile')
|
||||
},
|
||||
newFileSure(){
|
||||
this.$emit('newFileSure')
|
||||
},
|
||||
newFileClose(){
|
||||
this.$emit('input','')
|
||||
this.$emit('update:newf',false)
|
||||
// newf=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
823
h5-enginex-manager/src/components/common/dataManageRedact.vue
Normal file
823
h5-enginex-manager/src/components/common/dataManageRedact.vue
Normal file
@@ -0,0 +1,823 @@
|
||||
<style>
|
||||
.dataManageRedact {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.MR_checkbox {
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.MR_scope {
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.MR_scope>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.MR_scope>div>p {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.MR_derive {
|
||||
|
||||
margin: 0 40px 0 30px;
|
||||
|
||||
}
|
||||
|
||||
.MR_rule_home {
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
height: 350px;
|
||||
}
|
||||
|
||||
.MR_rule_home::-webkit-scrollbar {
|
||||
display: none;
|
||||
/* Chrome Safari */
|
||||
}
|
||||
|
||||
.MR_toolbar {
|
||||
background-color: #F0F0F0;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
}
|
||||
|
||||
.MR_toolbar>p:hover {
|
||||
color: #fff;
|
||||
|
||||
}
|
||||
|
||||
.codemirrirPs {
|
||||
padding: 5px;
|
||||
margin: 30px 0;
|
||||
background-color: #999;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.codemirrirPs>span:nth-of-type(1) {
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="$emit('close')"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增字段 :</span>
|
||||
<span v-else>编辑字段 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<el-button :icon="smallHeader?'el-icon-bottom':'el-icon-top'" circle @click="openHeader">
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit"></el-button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>字段名称: </p>
|
||||
<el-input placeholder="请输入字段名" maxlength="30" v-model="fieldEn" clearable></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>字段中文名: </p>
|
||||
<el-input placeholder="请输入字段中文名" maxlength="20" v-model="fieldCn" clearable></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>值类型 : </p>
|
||||
<el-select v-model="valueType" placeholder="请选择">
|
||||
<el-option label="数值型" :value="1" v-if="ftype!=5" />
|
||||
<el-option label="字符型" :value="2" v-if="ftype!=5" />
|
||||
<!-- <el-option label="枚举型" :value="3" /> -->
|
||||
<!-- <el-option label="小数型" :value="4" /> -->
|
||||
<!-- <el-option label="数组型" :value="5" /> -->
|
||||
<el-option label="JSON型" :value="6" />
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div style="flex: 1;overflow: auto;">
|
||||
|
||||
<div v-show="isDerivative=='Derivative'" class="MR_derive">
|
||||
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane label="条件区域" name="first">
|
||||
<div class="MR_rule_home">
|
||||
<rule :Data="ruledata" @faadd="faadd" @fadelect="fadelect" @sonadd="sonadd"
|
||||
@sondelect="sondelect" @change="change"></rule>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="公式编辑" name="second">
|
||||
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="groovy脚本" name="third">
|
||||
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div v-show="activeName!=='first'">
|
||||
<teV2 v-model="formula" :hint="activeName=='second'">
|
||||
|
||||
</teV2>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-if="Sourcelist">
|
||||
<div v-if="isDerivative=='SQL'" class="MR_derive">
|
||||
|
||||
<el-select v-model="SQLType" placeholder="请选择数据源类型" style="margin-top: 20px;width: 200px;"
|
||||
@change="SQLName = ''">
|
||||
<el-option v-for="item in SourcelistType" :key="item.type" :label="item.type"
|
||||
:value="item.type">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-select v-model="SQLName" placeholder="请选择数据源" style="margin-top: 20px;margin-left: 20px;">
|
||||
<el-option v-for="item in Sourcelist" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
<bindParam :Variable="sqlVariable" :dictVariable="dictVariable"></bindParam>
|
||||
<!-- <el-input type="textarea" v-model="SQLItem" rows="9" style="margin-top: 20px;"
|
||||
placeholder="请输入SQL语句">
|
||||
</el-input> -->
|
||||
|
||||
<div class="codemirrirPs">
|
||||
<span>
|
||||
{{sqlplaceholder[SQLType]&&sqlplaceholder[SQLType].placeholder}} 按Tab键自动补全
|
||||
|
||||
|
||||
</span>
|
||||
<codemirror v-model="SQLItem" :MYname="sqlplaceholder[SQLType]&&sqlplaceholder[SQLType].mime"
|
||||
:mime="sqlplaceholder[SQLType]&&sqlplaceholder[SQLType].mime"></codemirror>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="ftype==4">
|
||||
<el-select v-model="interfaceId" placeholder="请选择接口" style="margin-top: 20px;margin-left: 20px;">
|
||||
<el-option v-for="item in interfaceList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-cascader style="margin-left: 20px;" placeholder="请选择接口下的字段" v-model="interfaceParseField"
|
||||
:key="keynum" :options="dataJson" :props="{ checkStrictly: true }" clearable></el-cascader>
|
||||
</div>
|
||||
<div v-if="valueType==6" class="MR_derive">
|
||||
<p style="margin-top: 20px;">JSON:</p>
|
||||
<!-- <el-input type="textarea" v-model="jsonValue" :rows="9" style="margin-top: 20px;"
|
||||
placeholder="请输入格式JSON">
|
||||
</el-input> -->
|
||||
<div class="codemirrirPs">
|
||||
<span>
|
||||
请输入 JSON
|
||||
</span>
|
||||
<codemirror v-model="jsonValue" MYname="json" mime="text/javascript" :autocomplete="false">
|
||||
</codemirror>
|
||||
<!-- <p style="background-color: #fff;padding: 5px;border-radius: 3px;"> -->
|
||||
<!-- <el-checkbox v-model="isStaticJsonValue" style="color: #fff;"></el-checkbox><span style="color: #fff;font-size: 12px;margin-left: 10px;">静态</span> -->
|
||||
<!-- </p> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import codemirror from '@/components/common/codemirror.vue'
|
||||
// import fieldUserTable from './fieldUserTable.vue'
|
||||
import bindParam from '@/components/common/bindParam.vue'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import teV2 from '@/components/common/teV2.vue'
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
// import {
|
||||
// getInterfaceList
|
||||
// } from '@/api/index.js'
|
||||
import rule from './rule.vue'
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
// getInterfaceList,
|
||||
// fieldUserTable,
|
||||
rule,
|
||||
teV2,
|
||||
bindParam,
|
||||
codemirror
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
setsave: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
getInfo: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
updata: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
ftype: {
|
||||
type: Number,
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
sqlVariable: [],
|
||||
interfaceParseField: [],
|
||||
keynum: 1,
|
||||
interfaceId: '',
|
||||
jsonValue: '',
|
||||
loading: false,
|
||||
SQLItem: '',
|
||||
SQLName: '',
|
||||
tempFormula: '',
|
||||
formula: '',
|
||||
fieldEn: '',
|
||||
fieldCn: '',
|
||||
valueType: '',
|
||||
SQLType: '',
|
||||
isDerivative: "",
|
||||
isOutput: false,
|
||||
activeName: 'first',
|
||||
isrecord: false, //开始记录
|
||||
text: '', //剪出的字符串
|
||||
tempIndex: null, //暂存index
|
||||
lest: "", //暂存末尾
|
||||
isshow: false,
|
||||
islest: true,
|
||||
isStaticJsonValue: 0, //json是否为静态的 0为否
|
||||
// interfaceList: [],
|
||||
ruledata: [{
|
||||
"fieldSubCond": [{
|
||||
"fieldId": '',
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"logical": ""
|
||||
}],
|
||||
"conditionValue": "",
|
||||
"fieldValue": ""
|
||||
}],
|
||||
dictVariable: [],
|
||||
sqlplaceholder: {
|
||||
MySQL: {
|
||||
placeholder: '请输入sql语句',
|
||||
mime: 'text/x-sql'
|
||||
},
|
||||
Redis: {
|
||||
placeholder: '请输入lua脚本',
|
||||
mime: 'text/x-lua'
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
|
||||
this.$store.dispatch('getfielduser')
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getInfo(this.id, {}).then(res => {
|
||||
this.loading = false
|
||||
|
||||
if (res.status === "1") {
|
||||
this.jsonValue = JSON.stringify(JSON.parse(res.data.fieldVo.jsonValue), null, 4)
|
||||
|
||||
this.fieldCn = res.data.fieldVo.fieldCn
|
||||
// this.isStaticJsonValue = res.data.fieldVo.isStaticJsonValue
|
||||
|
||||
|
||||
|
||||
this.fieldEn = res.data.fieldVo.fieldEn
|
||||
this.valueType = res.data.fieldVo.valueType
|
||||
this.interfaceId = res.data.fieldVo.interfaceId
|
||||
this.interfaceParseField = res.data.fieldVo.interfaceParseField ? res.data.fieldVo
|
||||
.interfaceParseField.split('.') : ''
|
||||
this.fid = res.data.fieldVo.fieldTypeId
|
||||
this.isOutput = res.data.fieldVo.isOutput == 1 ? true : false
|
||||
|
||||
if (res.data.fieldVo.isDerivative) {
|
||||
this.isDerivative = 'Derivative'
|
||||
} else if (res.data.fieldVo.useSql) {
|
||||
this.isDerivative = 'SQL'
|
||||
this.SQLType = this.$store.state.Sourcelist.find(x => x.id == res.data.fieldVo
|
||||
.dataSourceId).type
|
||||
|
||||
this.SQLName = res.data.fieldVo.dataSourceId
|
||||
this.SQLItem = res.data.fieldVo.sqlStatement
|
||||
}
|
||||
if (res.data.hasFormula == "y" || res.data.hasGroovy == "y") {
|
||||
this.formula = JSON.parse(res.data.fieldVo.formula)[0].formula
|
||||
if (res.data.hasFormula == "y") {
|
||||
this.activeName = "second"
|
||||
}
|
||||
if (res.data.hasGroovy == "y") {
|
||||
this.activeName = "third"
|
||||
}
|
||||
} else if (res.data.fieldVo.fieldCondList.length > 0) {
|
||||
|
||||
this.ruledata = res.data.fieldVo.fieldCondList
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
if (res.data.fieldVo.sqlVariable == null) {
|
||||
this.sqlVariable = []
|
||||
} else {
|
||||
this.sqlVariable = JSON.parse(res.data.fieldVo.sqlVariable)
|
||||
}
|
||||
if (res.data.fieldVo.dictVariable == null) {
|
||||
this.dictVariable = []
|
||||
} else {
|
||||
this.dictVariable = JSON.parse(res.data.fieldVo.dictVariable)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// console.log(res.data.fieldVo.fieldCondList)
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
this.isDerivative = 'SQL'
|
||||
console.log(1)
|
||||
} else if (this.ftype == 3) {
|
||||
this.isDerivative = 'Derivative'
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
if (this.ftype == 2) {
|
||||
this.isDerivative = 'SQL'
|
||||
console.log(1)
|
||||
} else if (this.ftype == 3) {
|
||||
this.isDerivative = 'Derivative'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
computed: {
|
||||
interfaceList() {
|
||||
return this.$store.state.Interface
|
||||
},
|
||||
dataJson() {
|
||||
if (this.ftype != 4) {
|
||||
return {}
|
||||
}
|
||||
let obj = {}
|
||||
this.interfaceList.forEach(value => {
|
||||
if (value.id == this.interfaceId) {
|
||||
obj = JSON.parse(value.responseBody)
|
||||
}
|
||||
})
|
||||
|
||||
obj = this.deepGetLayout(obj)
|
||||
console.log(obj)
|
||||
return obj
|
||||
},
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser
|
||||
},
|
||||
SourcelistType() {
|
||||
let arr = []
|
||||
if (this.$store.state.Sourcelist) {
|
||||
this.$store.state.Sourcelist.forEach(value => {
|
||||
let sarr = arr.find(x => x.type == value.type)
|
||||
if (sarr) {
|
||||
sarr.data.push(value)
|
||||
} else {
|
||||
arr.push({
|
||||
type: value.type,
|
||||
data: [value]
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
console.log(arr)
|
||||
return arr
|
||||
},
|
||||
Sourcelist() {
|
||||
let arr = this.SourcelistType.find(x => x.type == this.SQLType)
|
||||
if (arr) {
|
||||
return arr.data
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// this.$refs.textarea.$refs.textarea.onkeydown = (e) => {
|
||||
// if (e.key === 'Backspace') {
|
||||
// this.text = ""
|
||||
// }
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
|
||||
deepGetLayout(obj) {
|
||||
let sobj = []
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (typeof obj[key] == 'object' && !Array.isArray(obj[key]) && obj[key] != null) {
|
||||
sobj.push({
|
||||
label: key,
|
||||
value: key,
|
||||
children: this.deepGetLayout(obj[key])
|
||||
})
|
||||
|
||||
} else if (typeof obj[key] == 'object' && Array.isArray(obj[key]) && obj[key] != null) {
|
||||
sobj.push({
|
||||
label: key,
|
||||
value: key,
|
||||
children: [{
|
||||
label: '元素',
|
||||
value: '[]',
|
||||
children: this.deepGetLayout(obj[key][0])
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
sobj.push({
|
||||
label: key,
|
||||
value: key,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return sobj
|
||||
},
|
||||
submit() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.fieldEn.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return
|
||||
}
|
||||
if (this.verificationCode(this.fieldEn) || this.verificationName(this.fieldCn)) {
|
||||
return
|
||||
}
|
||||
if (this.fieldEn.trim() == '' || this.fieldCn.trim() == '' || this.valueType == '') {
|
||||
this.$message.error('请填入所有字段,并检查空格');
|
||||
return
|
||||
}
|
||||
if (this.isDerivative == 'SQL' && (!this.SQLName || !this.SQLType)) {
|
||||
this.$message.error('请选择数据源');
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (this.ftype == 4 && (!this.interfaceId || this.interfaceParseField.length == 0)) {
|
||||
this.$message.error('请选择接口');
|
||||
return
|
||||
}
|
||||
let is = {
|
||||
is: true,
|
||||
msg: '请填入页面中未填的部分'
|
||||
}
|
||||
if (this.isDerivative == "Derivative" && this.activeName == 'first') {
|
||||
this.ruledata.forEach(value => {
|
||||
if (value.conditionValue.length < 1) {
|
||||
is.is = false
|
||||
}
|
||||
value.fieldSubCond.forEach((item, inde) => {
|
||||
if (item.fieldId == "" || item.operator == "" || item.fieldValue.length < 1) {
|
||||
is.is = false
|
||||
}
|
||||
if (item.logical == "" && inde !== value.fieldSubCond.length - 1) {
|
||||
is.is = false
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
this.sqlVariable.forEach(value => {
|
||||
if (value.value.trim() === "" || value.key.trim() === "") {
|
||||
is.is = false
|
||||
}
|
||||
})
|
||||
|
||||
this.dictVariable.forEach(value => {
|
||||
if (value.key.trim() === "" || value.type === "" || value.value.trim() === "") {
|
||||
is.is = false
|
||||
}
|
||||
})
|
||||
|
||||
let arr = []
|
||||
arr.push(...this.sqlVariable.map(value => value.key))
|
||||
arr.push(...this.dictVariable.map(value => value.key))
|
||||
|
||||
if (arr.length != Array.from(new Set(arr)).length) {
|
||||
is.is = false
|
||||
is.msg = '不允许出现重复的变量'
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (this.ftype == 4 && !this.interfaceId) {
|
||||
is.is = false
|
||||
}
|
||||
if (is.is === false) {
|
||||
this.$message.error(is.msg);
|
||||
return
|
||||
}
|
||||
|
||||
if (this.valueType == 6 && !this.isJSON(this.jsonValue)) {
|
||||
this.$message.error('请检查JSON格式');
|
||||
return
|
||||
}
|
||||
|
||||
let obj = {
|
||||
searchKey: '',
|
||||
fieldEn: this.fieldEn,
|
||||
fieldCn: this.fieldCn,
|
||||
valueType: this.valueType, //字段值类型
|
||||
isDerivative: this.isDerivative == "Derivative" ? 1 : 0, //是否衍生字段
|
||||
isOutput: this.isOutput ? 1 : 0, //是否输出字段
|
||||
// valueScope: this.valueScope, //字段约束范围
|
||||
fieldCondList: '',
|
||||
isStaticJsonValue: this.valueType == 6 ? this.isStaticJsonValue : 0,
|
||||
formulaHidden: '',
|
||||
isUseSql: this.isDerivative == "SQL" ? true : false, //是否使用sql
|
||||
dataSourceId: 0,
|
||||
sqlStatement: '', //sql语句
|
||||
}
|
||||
if (this.valueType == 6) {
|
||||
obj.jsonValue = this.jsonValue
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
if (this.sqlVariable.length == 0) {
|
||||
obj.sqlVariable = null
|
||||
} else {
|
||||
obj.sqlVariable = JSON.stringify(this.sqlVariable)
|
||||
}
|
||||
obj.dictVariable = JSON.stringify(this.dictVariable)
|
||||
}
|
||||
if (this.ftype == 4) {
|
||||
obj.isInterface = 1
|
||||
obj.interfaceId = this.interfaceId
|
||||
obj.interfaceParseField = this.interfaceParseField.join('.')
|
||||
} else {
|
||||
obj.isInterface = 0
|
||||
}
|
||||
// console.log(this.isDerivative)
|
||||
if (this.isDerivative == "Derivative") {
|
||||
if (this.activeName == "first") {
|
||||
obj.fieldCondList = JSON.stringify(this.ruledata)
|
||||
} else if (this.activeName == "second" || this.activeName == "third") {
|
||||
let tempArr = []
|
||||
let num = 0
|
||||
for (let i of this.formula) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 0 && num != 0) {
|
||||
this.formula.match(/@.*?@/g).forEach(value => {
|
||||
let tempObj = {
|
||||
fieldCN: value.substring(1, value.length - 1),
|
||||
fieldCond: ''
|
||||
}
|
||||
tempArr.push(tempObj)
|
||||
})
|
||||
}
|
||||
obj.formulaHidden = JSON.stringify([{
|
||||
fvalue: '',
|
||||
formula: this.formula.trim(),
|
||||
idx: '0',
|
||||
farr: tempArr,
|
||||
}])
|
||||
}
|
||||
|
||||
} else if (this.isDerivative == "SQL") {
|
||||
obj.dataSourceId = this.SQLName
|
||||
obj.sqlStatement = this.SQLItem
|
||||
|
||||
}
|
||||
let isT = true;
|
||||
if (this.isDerivative == "SQL") {
|
||||
let sqlCheck = obj.sqlStatement.match(/(create|update|delete|truncate|alert|drop)\s+/im);
|
||||
if (sqlCheck != null) {
|
||||
isT = false;
|
||||
this.$message.error('存在有风险sql关键词:' + sqlCheck[0].toUpperCase());
|
||||
}
|
||||
}
|
||||
if (isT) {
|
||||
if (this.id == 0) {
|
||||
obj.fieldTypeId = this.fieldTypeId == 99999999 ? 0 : this.fieldTypeId,
|
||||
this.loading = true
|
||||
this.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
// this.$store.dispatch('reGetisOutput')
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.fieldTypeId = this.fid
|
||||
this.loading = true
|
||||
this.updata(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
|
||||
// this.$store.dispatch('reGetisOutput')
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
isJSON(str) {
|
||||
if (typeof str == 'string') {
|
||||
try {
|
||||
var obj = JSON.parse(str);
|
||||
if (typeof obj == 'object' && obj) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.log('error:' + str + '!!!' + e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
change(index, inde) {
|
||||
this.ruledata[index].fieldSubCond[inde].operator = ""
|
||||
this.ruledata[index].fieldSubCond[inde].fieldValue = ""
|
||||
},
|
||||
sondelect(index, inde) {
|
||||
this.ruledata[index].fieldSubCond.splice(inde, 1)
|
||||
},
|
||||
sonadd(index, inde) {
|
||||
this.ruledata[index].fieldSubCond.splice(inde + 1, 0, {
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"logical": ""
|
||||
})
|
||||
},
|
||||
faadd(index) { //rule父节点添加
|
||||
this.ruledata.splice(index + 1, 0, {
|
||||
"conditionValue": "",
|
||||
"fieldSubCond": [{
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"logical": "",
|
||||
|
||||
|
||||
|
||||
}]
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
fadelect(index) {
|
||||
this.ruledata.splice(index, 1)
|
||||
},
|
||||
textareaAdd(text) {
|
||||
if (text === "fx") {
|
||||
this.formula = "def main(_){\n\n}"
|
||||
} else {
|
||||
this.formula += text
|
||||
}
|
||||
},
|
||||
dbclick(e) {
|
||||
let T = ""
|
||||
T = this.formula.split("")
|
||||
|
||||
T.splice(this.tempIndex, this.text.length + 1, '@' + e + '@')
|
||||
this.formula = T.join("")
|
||||
this.isshow = false
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
jsonValue() {
|
||||
console.log(this.jsonValue)
|
||||
},
|
||||
SQLItem() {
|
||||
console.log(this.SQLItem)
|
||||
},
|
||||
interfaceId() {
|
||||
this.keynum++
|
||||
},
|
||||
formula() {
|
||||
let num = 0
|
||||
for (let i of this.formula) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
this.isshow = true
|
||||
for (let i in this.formula) {
|
||||
if (this.formula[i] !== this.tempFormula[i] && this.formula[i] == "@") {
|
||||
|
||||
if (this.islest) {
|
||||
this.tempIndex = i
|
||||
|
||||
this.lest = this.formula.substring(parseInt(this.tempIndex) + 1, this.formula.length)
|
||||
this.islest = false
|
||||
}
|
||||
// console.log('字段:' + this.formula[i] + "暂存字段:" + this.tempFormula[i])
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let T = this.formula.substring(parseInt(this.tempIndex) + 1, this.formula.length)
|
||||
if (this.lest !== "") {
|
||||
// console.log(T)
|
||||
T = T.substring(0, T.indexOf(this.lest))
|
||||
|
||||
} else {
|
||||
T = T.substring(0, T.length)
|
||||
}
|
||||
|
||||
this.text = T
|
||||
|
||||
// console.log('lest:' + this.lest, 'index:' + this.tempIndex, "T:" + T)
|
||||
|
||||
} else {
|
||||
this.islest = true
|
||||
this.text = ""
|
||||
this.tempIndex = null
|
||||
this.isshow = false
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.tempFormula = this.formula
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
427
h5-enginex-manager/src/components/common/dataRinse/RuleCont.vue
Normal file
427
h5-enginex-manager/src/components/common/dataRinse/RuleCont.vue
Normal file
@@ -0,0 +1,427 @@
|
||||
<style>
|
||||
.rule {
|
||||
display: flex;
|
||||
/* margin-left: 5px; */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.Rule_cont {
|
||||
width: 30px;
|
||||
border-top: 1px dashed #C7C6C8;
|
||||
/* border-top: 1px dashed rgb(1,1,1); */
|
||||
margin-top: 7px;
|
||||
flex-grow: 0;
|
||||
height: 1px;
|
||||
/* background-color: #C7C6C8; */
|
||||
margin: 12px 0px 0 0;
|
||||
height: 0;
|
||||
|
||||
}
|
||||
|
||||
.RuleIcon {
|
||||
background-color: #EBEBEB;
|
||||
border: #DADADA 1px solid;
|
||||
border-radius: 4px;
|
||||
padding: 4px 6px 4px 2px;
|
||||
}
|
||||
|
||||
.RuleSelcet .el-input__inner {
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.RuleCont_for_out {
|
||||
border-left: 1px dashed #ccc;
|
||||
border-bottom: 1px dashed #ccc;
|
||||
border-right: 1px dashed #ccc;
|
||||
padding-top: 5px;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="rule" :style="{marginLeft:ZIndex==1?'20px':'0px'}" v-if="data">
|
||||
<div :style="{position: 'absolute',top:'0px', left: '-20px',marginTop: top===0?'0':'8px'}" class="RuleIcon">
|
||||
<el-dropdown trigger="click" @command="handleCommand">
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-s-operation" :style="{color: color[ZIndex%5] ,fontSize: '16px'}"></i>
|
||||
</span>
|
||||
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item icon="el-icon-plus" command="addRule" v-if="data.conditionType!=3">添加规则
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-circle-plus-outline" command="addlogical">添加关系</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-close" command="delect" v-if="ZIndex!=1&&data.conditionType!=4">
|
||||
删除此节点</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div v-if="data.conditionType==1" class="RuleSelcet">
|
||||
|
||||
<div :style="{width: '80px',marginTop: top===0?'0':'8px'}">
|
||||
<el-select v-model="data.logical" placeholder="请选择" size="mini">
|
||||
<el-option :key="1" label="AND" value="&&"></el-option>
|
||||
<el-option :key="2" label="OR" value="||"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 10px;height: 0;border-top: 1px dashed #C7C6C8;margin-top: 19px;margin-left: 5px;">
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
:style="{border: '1px dashed '+ color[ZIndex%5],borderRadius: '5px',paddingRight: '5px',paddingBottom: '5px',position:'relative',minWidth:'30px',minHeight:'40px'}">
|
||||
|
||||
<div
|
||||
:style="{border:'',margin:'',padding:'',paddingLeft:'0px'}">
|
||||
|
||||
<div v-for="(item,index) in data.children" style="display: flex;margin-top: 7px;">
|
||||
<div class="Rule_cont"
|
||||
:style="{marginTop:item.conditionType===0?'12px':(index===0?'11px':'20px')}">
|
||||
</div>
|
||||
<!-- conditionType==2 规则部分 -->
|
||||
<div v-if="item.conditionType==2" style="display: flex;">
|
||||
<!-- {{fieldType}} -->
|
||||
<div v-if="fieldType!='for'" style="display: flex;">
|
||||
<!-- 普通规则部分 -->
|
||||
|
||||
<!-- 不为输出节点 则拉选 fielduser-->
|
||||
<div style="display: flex;">
|
||||
|
||||
<!-- <el-select v-model="item.opType" placeholder="请选择" size="mini" style="width: 100px;" @change="emptyOpKey($event,item)">
|
||||
<el-option :key="value.value" :label="value.label" :value="value.value" v-for="value in ruleList"></el-option>
|
||||
</el-select> -->
|
||||
|
||||
<el-cascader v-model="item.opKey" filterable size="mini" :options="fieldUserObj" clearable @change="ruleCascaderChange(item)"
|
||||
:key="keyValue+(item.random?item.random:0)" :props="{ expandTrigger: 'hover' }" @visible-change="randomAdd(item,$event)" style="width: 300px;flex-shrink: 0;">
|
||||
</el-cascader>
|
||||
<ruleRelation v-model="item.operator" :value2.sync="item.variableValue"
|
||||
:variableType.sync="item.variableType"
|
||||
:valueType="GetValueTypeByJSONEn(item.opKey)" size="mini" :variableDis="[2]"
|
||||
:interceptCustom="true" @CustomCallback="$emit('CustomCallback',item)"
|
||||
></ruleRelation>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<i class="el-icon-circle-close" style="color: #fa4949;margin-left: 5px;"
|
||||
@click="deleteSon(index)"></i>
|
||||
</div>
|
||||
<!-- conditionType==1 关系节点 conditionType==3 for的输出的关系节点 节点部分 -->
|
||||
<div v-if="item.conditionType==1">
|
||||
<!-- {{fieldType}} -->
|
||||
<rule :data="item" :top="index" :ZIndex="ZIndex+1"
|
||||
:index="index" @delectLogical="delectLogical"
|
||||
|
||||
:customUserObj="customUserObj"
|
||||
>
|
||||
</rule>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
import bigElCascader from '@/components/common/bigElCascader.vue'
|
||||
export default {
|
||||
components: {
|
||||
ruleRelation,
|
||||
bigElCascader
|
||||
},
|
||||
name: 'rule',
|
||||
data() {
|
||||
return {
|
||||
color: ['#0D183E', '#409EFF', '#67C23A', '#F56C6C', '#FFCD43'],
|
||||
|
||||
keyValue: 1, //用于给级联选择框重新渲染
|
||||
keyValueReady: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
if (this.data) {
|
||||
if (Array.isArray(this.data.fieldEn)) {
|
||||
if (this.data.fieldEn.length > 0) {
|
||||
this.EnChange(this.data.fieldEn, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
||||
fieldType: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
ZIndex: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
top: {
|
||||
tyep: String,
|
||||
default: '8px'
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
// ruleList:{ //算子
|
||||
// type:Array||null,
|
||||
// default:null
|
||||
// },
|
||||
customUserObj:{ //自定义规则下拉
|
||||
type:Array||null,
|
||||
default:null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
fieldUserObj() {
|
||||
|
||||
if(this.customUserObj){
|
||||
return this.customUserObj
|
||||
}else{
|
||||
return []
|
||||
}
|
||||
// if (this.$store.state.FieldUserObj) {
|
||||
// return this.$store.state.FieldUserObj.data.fieldList
|
||||
// } else {
|
||||
// return []
|
||||
// }
|
||||
},
|
||||
fielduserArr() {
|
||||
let arr = []
|
||||
// console.log(11,this.fielduser)
|
||||
if (this.fielduser.length > 1) {
|
||||
if (this.fieldType != "for") { // 如果元素不为 for 则 用fielduser里的 json 格式指标
|
||||
arr = this.fielduser.filter((value) => {
|
||||
return value.valueType == 6
|
||||
})
|
||||
|
||||
arr = arr.map((value) => {
|
||||
let obj = {
|
||||
value: value.fieldEn,
|
||||
label: value.fieldCn,
|
||||
}
|
||||
obj.children = this.getdeepArr(JSON.parse(value.jsonValue))
|
||||
return obj
|
||||
})
|
||||
}
|
||||
// console.log(arr)
|
||||
return arr
|
||||
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
fielduser() {
|
||||
if (this.$store.state.FieldUser) {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
emptyOpKey(e,item){
|
||||
// console.log(e,item)
|
||||
if(e=='count'){
|
||||
item.opKey = []
|
||||
}
|
||||
},
|
||||
GetValueTypeByJSONEn(en){
|
||||
if(!en){
|
||||
return
|
||||
}
|
||||
|
||||
// console.log(en)
|
||||
|
||||
let obj
|
||||
|
||||
en.forEach((value,index)=>{
|
||||
if(index==0){
|
||||
obj = this.fieldUserObj.find(x=>x.value==value)
|
||||
|
||||
// console.log(this.fieldUserObj)
|
||||
// console.log(obj)
|
||||
// debugger
|
||||
|
||||
}else{
|
||||
obj = obj.children.find(x=>x.value==value)
|
||||
}
|
||||
})
|
||||
return obj&&obj.valueType
|
||||
},
|
||||
|
||||
getvalueTypebyEn(e) { //通过en 获取 valueType
|
||||
if (!Array.isArray(e)) {
|
||||
return
|
||||
}
|
||||
if (e[0][0] !== '%') {
|
||||
return this.mixinGetValueTypeByEn(e[0])
|
||||
}
|
||||
if (e[e.length - 1] == 'length') {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
EnChange(e, clear = true) {
|
||||
|
||||
this.en = e.join('.')
|
||||
if (!clear) return
|
||||
this.deepClearEn(this.data)
|
||||
},
|
||||
deepClearEn(obj) { // 递归清除用到父级的 en
|
||||
obj.children.forEach(value => {
|
||||
if (Array.isArray(value.fieldEn)) {
|
||||
if (value.fieldEn[0][0] == "%") {
|
||||
value.fieldEn = ""
|
||||
}
|
||||
}
|
||||
if (value.children.length > 0) {
|
||||
this.deepClearEn(value)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
getdeepArr(obj) {
|
||||
if (Array.isArray(obj)) {
|
||||
return false
|
||||
} else if (typeof obj == 'object') {
|
||||
let arr = []
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (Array.isArray(obj[key])) {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key
|
||||
})
|
||||
} else if (typeof obj[key] == 'object') {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key,
|
||||
children: this.getdeepArr(obj[key])
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return arr
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
delectLogical(index) {
|
||||
this.data.children.splice(index, 1)
|
||||
},
|
||||
handleCommand(str) {
|
||||
if (str == "addRule") { //添加规则
|
||||
// console.log(this.data)
|
||||
this.data.children.push({
|
||||
"logical": null,
|
||||
"opKey": '',
|
||||
"operator": "",
|
||||
"variableValue": "",
|
||||
"conditionType": 2,
|
||||
"variableType": 1,
|
||||
"children": [],
|
||||
|
||||
})
|
||||
|
||||
|
||||
} else if (str == "addlogical") { //添加链接符
|
||||
let obj = {
|
||||
"logical": '&&',
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"conditionType": 1,
|
||||
"children": [],
|
||||
}
|
||||
this.data.children.push(obj)
|
||||
|
||||
|
||||
} else if (str == "delect") {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$emit('delectLogical', this.index)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
deleteSon(index) {
|
||||
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.data.children.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
ruleCascaderChange(item) {
|
||||
item.valueType = this.mixinGetValueTypeByJSONEn(item.fieldEn)
|
||||
item.fieldValue = ""
|
||||
item.operator = ""
|
||||
},
|
||||
|
||||
},
|
||||
watch: {
|
||||
|
||||
fielduserArr() {
|
||||
if (this.keyValueReady) {
|
||||
this.keyValue++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div v-for="(value,index) in list" style="width: 800px;display: flex;align-items: center;margin-bottom: 10px;">
|
||||
|
||||
|
||||
<el-cascader v-model="value.outputKey" filterable :options="option" clearable placeholder="请选择属性"
|
||||
:key="(value.random?value.random:0)" style="margin-right: 10px;width: 300px;" :props="{ expandTrigger: 'hover' }"
|
||||
@visible-change="randomAdd(value,$event)">
|
||||
</el-cascader>
|
||||
|
||||
|
||||
=
|
||||
<varialeSelect :variableType.sync="value.variableType" :disabled="[2]" size="medium" height="36px"
|
||||
v-model="value.outputValue" style="margin-left: 10px;" :interceptCustom="true" @CustomCallback="$emit('CustomCallback',value)">
|
||||
</varialeSelect>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<i class="el-icon-circle-close" style="color: red;margin-left: 10px;" @click="deleteDataClear(index)"></i>
|
||||
</div>
|
||||
<el-button @click="addDataClear">+</el-button>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
components: {
|
||||
varialeSelect
|
||||
},
|
||||
props: {
|
||||
list: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
option: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
filterType: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
deleteDataClear(index) {
|
||||
this.list.splice(index, 1)
|
||||
},
|
||||
addDataClear() {
|
||||
this.list.push({
|
||||
variableType: 3,
|
||||
variableValue: '',
|
||||
operator: '==',
|
||||
filterType: this.filterType
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -0,0 +1,239 @@
|
||||
|
||||
<template>
|
||||
<div class="cont_cont">
|
||||
|
||||
<div class="cont_left" v-loading="leftloading" v-if="!listRedact">
|
||||
<div class="cont_header">
|
||||
<p class="cont_header_title">{{title}}</p>
|
||||
<p class="cont_header_subtitle">{{title}}</p>
|
||||
</div>
|
||||
<contNewFule v-model="tempNewF" :newf.sync="newf" @newFileSure="newFileSure" @newFile="newFile" ></contNewFule>
|
||||
|
||||
<div class="cont_list">
|
||||
|
||||
|
||||
<fileHome :data="list" @curr="clickCurrid" :currid="currid" @RenameFun="RenameFun" @RenameClose="RenameClose"
|
||||
@updatafilelist="updatafilelist" @delectFun="delectFun">
|
||||
</fileHome>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cont_right" v-loading="contloading" @click="tempHintLeft=null;tempHintTop=null;" >
|
||||
<div v-if="!listRedact">
|
||||
<div v-if="showRight===false" class="cont_right_hint">
|
||||
请先选择左侧文件夹
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="cont_right_top">
|
||||
<div>
|
||||
<el-button type="primary" @click="listRedact=true" :disabled="currid!=99999999?false:'disabled'">新增</el-button>
|
||||
<el-button type="danger" @click="using(-1);$store.dispatch('regetcache', 'decisionTree')" :disabled="this.selection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button type="success" @click="using(1)" :disabled="this.selection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button type="warning" @click="using(0)" :disabled="this.selection.length>0?false:'disabled'">停用</el-button>
|
||||
<el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'"
|
||||
filterable @change="mixinMoveChange">
|
||||
<el-option v-for="value in listunfold" :key="value.id" :label="value.name" :value="value.id" v-show="value.id!=99999999"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-input placeholder="请输入搜索内容" v-model="search">
|
||||
<i slot="suffix" class="el-input__icon el-icon-search" @click="getsearch"></i>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right_cont">
|
||||
<div v-if="data">
|
||||
<el-table border :data="data.data.klist" @select-all="selectAll" @select="select" style="width: 100%"
|
||||
:cell-style="{padding: '10px'}">
|
||||
<el-table-column type="selection" width="70">
|
||||
</el-table-column>
|
||||
<el-table-column v-for="item in getData.row" :key="item.id" :prop="item.row" :label="item.label" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="item.type==='Blooen'">
|
||||
{{scope.row[item.row]?"是":"否"}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='State'">
|
||||
{{scope.row[item.row]==1?'启用':'未启用'}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='Time'" style="white-space: nowrap;" class="contText">{{
|
||||
new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row[item.row]).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
<span v-else-if="item.fn">
|
||||
<!-- {{scope.row[item.row]}} -->
|
||||
{{item.fn(scope.row[item.row])}}
|
||||
</span>
|
||||
<span class="contText" v-else>
|
||||
{{scope.row[item.row]}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-button icon="el-icon-setting" circle size="mini" @click="dialogShow(scope.row.id)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="float: right;margin-right: 40px;margin-top: 40px;" :current-page="currPage"
|
||||
@current-change="clickpage" background layout="prev, pager, next" :total="data.data.pageInfo.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="listRedact" style="height: 100%;overflow: hidden;">
|
||||
<dataManageRedact v-if="listRedact" @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist()" :getData="getData"
|
||||
:id='tempRedactId' :nameId="currid" :type="getData.type"></dataManageRedact>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import contNewFule from '@/components/common/contNewFile.vue'
|
||||
import '@/assets/css/cont.css'
|
||||
import fileHome from '@/components/common/fileHome.vue'
|
||||
import dataManageRedact from './rinseManageRedact.vue'
|
||||
import contmixin from '@/utils/contminxin/contmixin.js'
|
||||
export default {
|
||||
mixins: [
|
||||
contmixin
|
||||
],
|
||||
components: {
|
||||
fileHome,
|
||||
dataManageRedact,
|
||||
contNewFule
|
||||
},
|
||||
created() {
|
||||
|
||||
this.getData.getTree({
|
||||
parentId: 0,
|
||||
treeType: this.getData.treeType,
|
||||
type: 1
|
||||
}).then(res => {
|
||||
this.list = this.listTreeDeep(res.data, 1)
|
||||
this.clickCurrid(99999999)
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
list() {
|
||||
if (this.list.length > 0) {
|
||||
this.leftloading = false
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
tempMove: '',
|
||||
leftloading: true,
|
||||
search: "",
|
||||
fileName: "",
|
||||
fileList: [],
|
||||
upShow: false,
|
||||
currPage: 1,
|
||||
currid: null,
|
||||
data: null,
|
||||
contloading: false,
|
||||
newf: false,
|
||||
tempNewF: "",
|
||||
listRedact: false, //新增页面开启
|
||||
tempRedactId: 0,
|
||||
selection: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
getsearch() {
|
||||
this.contloading = true
|
||||
let params = {
|
||||
entity: {
|
||||
name: this.search,
|
||||
"folderId": String(this.currid) === "99999999" ? '' : String(this.currid),
|
||||
},
|
||||
key: "ruleName",
|
||||
status: "0,1",
|
||||
|
||||
"pageNum": 1,
|
||||
isSearch: 1
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
this.currPage = 1
|
||||
},
|
||||
|
||||
getlist() {
|
||||
this.contloading = true
|
||||
this.listRedact = false
|
||||
let params = {
|
||||
status: "0,1",
|
||||
entity: {},
|
||||
"pageNum": 1
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.entity.folderId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
|
||||
},
|
||||
clickpage(e) {
|
||||
this.currPage = e
|
||||
this.contloading = true
|
||||
let params = {
|
||||
status: "0,1",
|
||||
entity: {},
|
||||
"pageNum": e
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.entity.folderId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
if (res.status == 1) {
|
||||
this.data = res
|
||||
this.selection = []
|
||||
this.contloading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
newFileSure() {
|
||||
this.leftloading = true
|
||||
let params = {
|
||||
parentId: String(this.currid),
|
||||
name: this.tempNewF,
|
||||
"treeType":this.getData.treeType,
|
||||
"type": "1",
|
||||
"engineId": ""
|
||||
}
|
||||
if(this.mixnewFileZindexVerify(this.list,this.currid)==6){
|
||||
this.$message.error('已达到最深层级')
|
||||
this.leftloading = false
|
||||
return
|
||||
}
|
||||
this.mixnewFileSure(params)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
930
h5-enginex-manager/src/components/common/dataRinse/opType.vue
Normal file
930
h5-enginex-manager/src/components/common/dataRinse/opType.vue
Normal file
@@ -0,0 +1,930 @@
|
||||
<style>
|
||||
.opType1_subbtitle {
|
||||
color: #666;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.opType2Cont {
|
||||
background-color: #fff;
|
||||
padding: 5px;
|
||||
margin-top: 10px;
|
||||
border-radius: 10px;
|
||||
border: 1px dotted #aaa
|
||||
}
|
||||
|
||||
.opTypeRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
border-bottom: 1px dotted #eee;
|
||||
padding-bottom: 10px;
|
||||
|
||||
}
|
||||
|
||||
.opTypeRow>p:nth-of-type(1) {
|
||||
width: 100px;
|
||||
|
||||
}
|
||||
|
||||
.opTypeDelete {
|
||||
color: red;
|
||||
margin-left: 10px;
|
||||
font-size: 24px;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.opType_ps {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
|
||||
<div style="padding: 10px;">
|
||||
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
源数据:
|
||||
</p>
|
||||
<div>
|
||||
<el-select v-model="data.inputFieldEn" filterable placeholder="只允许选择JSON类型指标"
|
||||
@change="data.originalDataOp.opField=[];opFieldChange()" style="width: 300px;">
|
||||
<el-option v-for="item in FieldUser" v-if="item.valueType==6" :key="item.value"
|
||||
:label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="opTypeRow" v-if="data.originalDataOp">
|
||||
<p class="opType1_subbtitle">
|
||||
循环对象:
|
||||
</p>
|
||||
<div>
|
||||
|
||||
<el-cascader v-model="data.originalDataOp.opField" filterable :options="getdeepArr(FieldUserJSON)"
|
||||
:key="(data.random?data.random:0)" @visible-change="randomAdd(data,$event)" style="width: 300px;"
|
||||
placeholder="只允许选择'数据'下的数组类型属性,可不选" :props="{ expandTrigger: 'hover' }" @change="opFieldChange">
|
||||
</el-cascader>
|
||||
|
||||
|
||||
<p class="opType_ps">
|
||||
*切换 源数据 和 循环对象 会重置下面所选的信息
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<template v-for="(value,index) in data.conditionAndOutPutList">
|
||||
|
||||
|
||||
<div class="opTypeRow">
|
||||
|
||||
|
||||
<p class="opType1_subbtitle">
|
||||
选择集合:
|
||||
</p>
|
||||
<div>
|
||||
<el-cascader v-model="value.dataCleanBlock.handleCollection" filterable
|
||||
:options="getdeepArr(eachObjJSON)" :key="(value.random?value.random:0)"
|
||||
@visible-change="randomAdd(value,$event)" placeholder="只允许选择'数据'下的数组类型属性"
|
||||
@change="handleCollectionChange(index,$event)" :props="{ expandTrigger: 'hover' }" style="width: 300px;">
|
||||
</el-cascader>
|
||||
<!-- {{eachObjJSON}} -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div :class="opType==2?'opType2Cont':''" v-if="index==0||opType==2" style="position: relative;">
|
||||
|
||||
<!-- <div class="opTypeRow" v-if="opType==2">
|
||||
<p class="opType1_subbtitle">
|
||||
运算
|
||||
</p>
|
||||
<el-input v-model="value.dataCleanBlock.name" style="width: 220px;"></el-input>
|
||||
|
||||
</div> -->
|
||||
|
||||
<div class="opTypeRow">
|
||||
|
||||
<p class="opType1_subbtitle">
|
||||
进入过滤
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<div
|
||||
v-if="value.inputFilterCondition.children&&value.inputFilterCondition.children.length>0&&ValueObj">
|
||||
|
||||
<div v-for="(item,index) in value.inputFilterCondition.children"
|
||||
style="margin-bottom: 10px;display: flex;align-items: center;">
|
||||
<el-cascader v-if="item.operator!='black_list'" v-model="item.opKey" filterable
|
||||
:options="getcustomObj([],value.dataCleanBlock.handleCollection)"
|
||||
:key="cascaKey+(item.random?item.random:0)" @visible-change="randomAdd(item,$event)"
|
||||
:props="{ expandTrigger: 'hover' }" style="margin-right: 20px;width: 300px;flex-shrink: 0;"></el-cascader>
|
||||
|
||||
|
||||
<el-select v-model="item.operator" placeholder="请选择" @change="operatorChange(item)"
|
||||
style="margin-right: 20px;">
|
||||
<el-option v-for="cont in filterOptions" :key="cont.value" :label="cont.label"
|
||||
:value="cont.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-input v-model="item.variableValue" placeholder="请以逗号分割" v-if="item.operator!='min'">
|
||||
</el-input>
|
||||
|
||||
|
||||
<!-- <varialeSelect v-if="item.operator=='black_list'" :variableType.sync="item.variableType"
|
||||
:disabled="[1,2]" :variableCascaderValue="ValueObj" :variableCascader="true"
|
||||
size="medium" height="36px" v-model="item.variableValue" :interceptCustom="true"
|
||||
@CustomCallback="CustomCallback(item,'variableValue','blackList')"
|
||||
style="margin-left: 10px;">
|
||||
</varialeSelect> -->
|
||||
|
||||
|
||||
|
||||
<i class="el-icon-circle-close" style="color: red;margin-left: 10px;"
|
||||
@click="deleteFilterCondition(value.inputFilterCondition.children,index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
<el-button @click="addfilterCondition(value.inputFilterCondition.children)">+</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
分组
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<div
|
||||
v-if="value.dataCleanBlock.groupFields&&value.dataCleanBlock.groupFields.length>0&&ValueObj">
|
||||
|
||||
<div v-for="(item,index) in value.dataCleanBlock.groupFields" style="margin-bottom: 10px;">
|
||||
<el-cascader v-model="value.dataCleanBlock.groupFields[index]" filterable
|
||||
:options="getcustomObj([],value.dataCleanBlock.handleCollection)"
|
||||
:key="cascaKey+(item.random?item.random:0)" @visible-change="randomAdd(item,$event)"
|
||||
:props="{ expandTrigger: 'hover' }" style="width: 300px;">
|
||||
</el-cascader>
|
||||
<i class="el-icon-circle-close" style="color: red;margin-left: 10px;"
|
||||
@click="deleteGroupFields(value.dataCleanBlock.groupFields,index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
<el-button @click="addgroupFields(value.dataCleanBlock.groupFields)">+</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
修改元素条件
|
||||
</p>
|
||||
<rule :data="value.condition" :ZIndex="1" :ruleList="opTypeList"
|
||||
:customUserObj="getcustomObj(ValueObj,value.dataCleanBlock.handleCollection) "
|
||||
@CustomCallback="CustomCallback($event,value.dataCleanBlock.handleCollection,'variableValue')"></rule>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
命中修改
|
||||
</p>
|
||||
<div>
|
||||
<dataClear :list="value.successOutput"
|
||||
:option="getcustomObj([],value.dataCleanBlock.handleCollection)"
|
||||
@CustomCallback="CustomCallback($event,value.dataCleanBlock.handleCollection)">
|
||||
</dataClear>
|
||||
</div>
|
||||
</div>
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
未命中修改
|
||||
</p>
|
||||
<div>
|
||||
<dataClear :list="value.failOutput"
|
||||
:option="getcustomObj([],value.dataCleanBlock.handleCollection)"
|
||||
@CustomCallback="CustomCallback($event,value.dataCleanBlock.handleCollection)">
|
||||
</dataClear>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
返回过滤
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<div
|
||||
v-if="value.resultFilterCondition.children&&value.resultFilterCondition.children.length>0&&ValueObj">
|
||||
|
||||
<div v-for="(item,index) in value.resultFilterCondition.children"
|
||||
style="margin-bottom: 10px;display: flex;align-items: center;">
|
||||
<el-cascader v-if="item.operator!='black_list'" v-model="item.opKey" filterable
|
||||
:options="getcustomObj([],value.dataCleanBlock.handleCollection)"
|
||||
:key="cascaKey+(item.random?item.random:0)" @visible-change="randomAdd(item,$event)"
|
||||
:props="{ expandTrigger: 'hover' }" style="margin-right: 20px;width: 300px;flex-shrink: 0;"></el-cascader>
|
||||
|
||||
|
||||
<el-select v-model="item.operator" placeholder="请选择" @change="operatorChange(item)"
|
||||
style="margin-right: 20px;">
|
||||
<el-option v-for="cont in filterOptions" :key="cont.value" :label="cont.label"
|
||||
:value="cont.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-input v-model="item.variableValue" placeholder="请以逗号分割"
|
||||
v-if="item.operator!='min'">
|
||||
</el-input>
|
||||
|
||||
|
||||
<!-- <varialeSelect v-if="item.operator=='black_list'" :variableType.sync="item.variableType"
|
||||
:disabled="[1,2]" :variableCascaderValue="ValueObj" :variableCascader="true"
|
||||
size="medium" height="36px" v-model="item.variableValue" :interceptCustom="true"
|
||||
@CustomCallback="CustomCallback(item,'variableValue','blackList')"
|
||||
style="margin-left: 10px;">
|
||||
</varialeSelect> -->
|
||||
|
||||
|
||||
|
||||
<i class="el-icon-circle-close" style="color: red;margin-left: 10px;"
|
||||
@click="deleteFilterCondition(value.resultFilterCondition.children,index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
<el-button @click="addfilterCondition(value.resultFilterCondition.children)">+</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p v-if="index>0">
|
||||
<i class="el-icon-circle-close opTypeDelete" @click="deleteConditionAndOutPutList(index)"></i>
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
<el-button type="primary" v-if="opType==2" style="margin: 10px 0 40px 0;" @click="addConditionAndOutPutList"
|
||||
plain>
|
||||
添加处理</el-button>
|
||||
|
||||
<el-dialog title="值编辑器" v-if="dialogVisible" :visible.sync="dialogVisible" width="70%"
|
||||
:close-on-click-modal="false" append-to-body @close="reSetTemp">
|
||||
<teParam v-if="dialogVisible" v-model="tempValue" :paramList="tempParam" :Disabled="teParamdisabled"
|
||||
:options="tempOptions">
|
||||
</teParam>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible=false;reSetTemp()">取 消</el-button>
|
||||
<el-button type="primary" @click="valueCompileCallback()">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import listOutPut from '@/components/common/listOutput.vue'
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
import teParam from './teParam.vue'
|
||||
import rule from './RuleCont.vue'
|
||||
import {
|
||||
GetdeepObj
|
||||
} from '@/utils/GetdeepObj.js'
|
||||
import dataClear from '@/components/common/dataRinse/dataClear.vue'
|
||||
export default {
|
||||
components: {
|
||||
rule,
|
||||
teParam,
|
||||
varialeSelect,
|
||||
|
||||
dataClear
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
valueCompileCallback: () => {}, //值编辑器确定回调
|
||||
dialogVisible:false,
|
||||
tempValue: '',
|
||||
tempParam: [],
|
||||
tempOptions:[],
|
||||
cascaKey: 0, //用于级联选择框重新渲染
|
||||
opTypeList: [{ //算子
|
||||
label: '个数',
|
||||
value: 'count'
|
||||
},
|
||||
{
|
||||
label: '去重个数',
|
||||
value: 'distinct_count'
|
||||
},
|
||||
{
|
||||
label: '最大',
|
||||
value: 'max'
|
||||
},
|
||||
{
|
||||
label: '最小',
|
||||
value: 'min'
|
||||
},
|
||||
{
|
||||
label: '平均',
|
||||
value: 'avg'
|
||||
},
|
||||
],
|
||||
filterOptions: [{
|
||||
value: '==',
|
||||
label: '等于'
|
||||
}, {
|
||||
value: '!=',
|
||||
label: '不等于'
|
||||
}, {
|
||||
value: 'in',
|
||||
label: 'in'
|
||||
}, {
|
||||
value: 'not in',
|
||||
label: 'not in'
|
||||
}, {
|
||||
value: 'min',
|
||||
label: '最小'
|
||||
}],
|
||||
teParamdisabled: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
opType: {
|
||||
type: Number,
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// if (!Array.isArray(this.data.groupFields)) {
|
||||
// this.data.groupFields = [
|
||||
// ['']
|
||||
// ]
|
||||
// }
|
||||
console.log(this.data)
|
||||
|
||||
},
|
||||
methods: {
|
||||
handleCollectionChange(index, e) {
|
||||
console.log(1)
|
||||
// this.data.conditionAndOutPutList[index] = {
|
||||
// condition: {
|
||||
// logical: "&&",
|
||||
// conditionType: 1,
|
||||
// children: []
|
||||
// },
|
||||
// defaultOutput: [],
|
||||
// resultFilterCondition: {
|
||||
// conditionType: 1,
|
||||
// logical: "&&",
|
||||
// children: [],
|
||||
// variableType: 1
|
||||
// },
|
||||
// inputFilterCondition: {
|
||||
// conditionType: 1,
|
||||
// logical: "&&",
|
||||
// children: [],
|
||||
// variableType: 1
|
||||
// },
|
||||
// failOutput: [],
|
||||
// successOutput: [],
|
||||
// dataCleanBlock: {
|
||||
// name: "",
|
||||
// groupFields: [],
|
||||
// handleCollection: e
|
||||
// }
|
||||
// }
|
||||
this.$set(this.data.conditionAndOutPutList,index,{
|
||||
condition: {
|
||||
logical: "&&",
|
||||
conditionType: 1,
|
||||
children: []
|
||||
},
|
||||
defaultOutput: [],
|
||||
resultFilterCondition: {
|
||||
conditionType: 1,
|
||||
logical: "&&",
|
||||
children: [],
|
||||
variableType: 1
|
||||
},
|
||||
inputFilterCondition: {
|
||||
conditionType: 1,
|
||||
logical: "&&",
|
||||
children: [],
|
||||
variableType: 1
|
||||
},
|
||||
failOutput: [],
|
||||
successOutput: [],
|
||||
dataCleanBlock: {
|
||||
name: "",
|
||||
groupFields: [],
|
||||
handleCollection: e
|
||||
}
|
||||
})
|
||||
// value.dataCleanBlock.handleCollection = e
|
||||
},
|
||||
opFieldChange() {
|
||||
this.$emit('opFieldChange')
|
||||
},
|
||||
getCustomField(strarr) {
|
||||
let obj = {}
|
||||
if (strarr.length) {
|
||||
obj = this.FieldUserJSON
|
||||
if (this.data.originalDataOp.opField.length) {
|
||||
this.data.originalDataOp.opField.forEach((value, index) => {
|
||||
obj = obj[value]
|
||||
if (index == this.data.originalDataOp.opField.length - 1) {
|
||||
obj = obj[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
strarr.forEach((value, index) => {
|
||||
obj = obj[value]
|
||||
if (index == strarr.length - 1) {
|
||||
obj = obj[0]
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
return Object.keys(obj).map(value => {
|
||||
return {
|
||||
fieldCn: value,
|
||||
fieldEn: value,
|
||||
id: 1
|
||||
}
|
||||
})
|
||||
},
|
||||
getcustomObj(arr, strarr) {
|
||||
let arr2 = JSON.parse(JSON.stringify(arr))
|
||||
let obj = {}
|
||||
if (strarr.length) {
|
||||
obj = this.FieldUserJSON
|
||||
if (this.data.originalDataOp.opField.length) {
|
||||
this.data.originalDataOp.opField.forEach((value, index) => {
|
||||
obj = obj[value]
|
||||
if (index == this.data.originalDataOp.opField.length - 1) {
|
||||
obj = obj[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
strarr.forEach((value, index) => {
|
||||
obj = obj[value]
|
||||
if (index == strarr.length - 1) {
|
||||
obj = obj[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
arr2.push({
|
||||
label: '集合元素',
|
||||
value: 'handle_collection',
|
||||
children: GetdeepObj(obj, true, true),
|
||||
})
|
||||
|
||||
|
||||
return arr2
|
||||
|
||||
},
|
||||
operatorChange(item) {
|
||||
if (item.operator == 'min') {
|
||||
|
||||
item.variableValue = ''
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
deleteFilterCondition(item, index) {
|
||||
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
item.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
|
||||
addfilterCondition(value) {
|
||||
if (!this.ValueObj) {
|
||||
this.$message.error('此数据下无可用字段')
|
||||
return
|
||||
}
|
||||
value.push({
|
||||
children: [],
|
||||
conditionType: 2,
|
||||
logical: null,
|
||||
variableType: 1,
|
||||
variableValue: "",
|
||||
opKey: [],
|
||||
operator: "in"
|
||||
})
|
||||
},
|
||||
reSetTemp() {
|
||||
this.tempValue = '';
|
||||
this.valueCompileCallback = () => {};
|
||||
this.tempParam = []
|
||||
|
||||
this.teParamdisabled = false
|
||||
|
||||
},
|
||||
deleteConditionAndOutPutList(index) {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.data.conditionAndOutPutList.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
|
||||
},
|
||||
addConditionAndOutPutList() {
|
||||
this.data.conditionAndOutPutList.push({
|
||||
condition: {
|
||||
logical: "&&",
|
||||
conditionType: 1,
|
||||
children: []
|
||||
},
|
||||
defaultOutput: [],
|
||||
resultFilterCondition: {
|
||||
conditionType: 1,
|
||||
logical: "&&",
|
||||
children: [],
|
||||
variableType: 1
|
||||
},
|
||||
inputFilterCondition: {
|
||||
conditionType: 1,
|
||||
logical: "&&",
|
||||
children: [],
|
||||
variableType: 1
|
||||
},
|
||||
failOutput: [],
|
||||
successOutput: [],
|
||||
dataCleanBlock: {
|
||||
name: "",
|
||||
groupFields: [],
|
||||
handleCollection: []
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
CustomCallback(item, strarr,key="outputValue") {
|
||||
|
||||
this.tempOptions=this.getcustomObj([],strarr)
|
||||
|
||||
|
||||
if (!item[key]) {
|
||||
item[key] = JSON.stringify({
|
||||
farr: [],
|
||||
formula: ''
|
||||
})
|
||||
}
|
||||
this.tempValue = JSON.parse(item[key]).formula
|
||||
this.tempParam = JSON.parse(item[key]).farr.map(value=>{
|
||||
value.fieldEn = value.opType +'.'+ value.fieldEn
|
||||
value.fieldEn = value.fieldEn.split('.')
|
||||
return value
|
||||
})
|
||||
console.log(this.tempParam )
|
||||
|
||||
// if (item.arr) {
|
||||
// this.tempAddOpkey = item.arr.map(x => {
|
||||
// return {
|
||||
// fieldEn: x,
|
||||
// fieldCn: x,
|
||||
// id: parseInt(Math.random() * -9999),
|
||||
// outputKey: true
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
// if (type == 'blackList') {
|
||||
// console.log(type)
|
||||
// this.teParamdisabled = true
|
||||
// }
|
||||
|
||||
|
||||
this.dialogVisible = true
|
||||
// console.log(this.tempParam)
|
||||
|
||||
// this.tempParam.forEach(value => {
|
||||
// value.paramList = value.paramList ? value.paramList.map(item => {
|
||||
// item.value = item.type == 2 ? item.value.split('.') : item.value
|
||||
// return item
|
||||
// }) : []
|
||||
// })
|
||||
|
||||
|
||||
|
||||
this.valueCompileCallback = () => {
|
||||
|
||||
let arr = JSON.parse(JSON.stringify(this.tempParam))
|
||||
|
||||
let obj = {
|
||||
farr: arr.map(value => {
|
||||
|
||||
value.opType = value.fieldEn.shift()
|
||||
value.fieldEn = value.fieldEn.join('.')
|
||||
return {
|
||||
fieldCn: value.fieldCn,
|
||||
fieldEn: value.fieldEn,
|
||||
valueType: value.valueType,
|
||||
opType:value.opType
|
||||
}
|
||||
}),
|
||||
formula: this.tempValue
|
||||
}
|
||||
|
||||
// if (type == 'blackList') {
|
||||
// obj.formula = obj.farr[0] ? `@${obj.farr[0].fieldCn}@` : ''
|
||||
// }
|
||||
|
||||
if (this.examineVariableValue(obj)) {
|
||||
return
|
||||
}
|
||||
|
||||
let arr2 = obj.formula.match(/@.*?@/g)
|
||||
|
||||
// if (arr2) {
|
||||
// arr2 = arr2.filter(value => !obj.farr.find(x => x.fieldCn == value.substring(1, value.length -
|
||||
// 1)))
|
||||
|
||||
// arr2 = arr2.map(value => {
|
||||
// return {
|
||||
// fieldCn: value.substring(1, value.length - 1),
|
||||
// fieldEn: value.substring(1, value.length - 1),
|
||||
// temp: true,
|
||||
// valueType: 1
|
||||
// }
|
||||
// })
|
||||
// obj.farr.push(...arr2)
|
||||
|
||||
// }
|
||||
|
||||
item[key] = JSON.stringify(obj)
|
||||
this.dialogVisible = false
|
||||
this.reSetTemp()
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
examineVariableValue(obj) {
|
||||
let is = {
|
||||
is: false,
|
||||
msg: ''
|
||||
}
|
||||
|
||||
if (!obj.formula) {
|
||||
is.is = true
|
||||
is.msg = '请输入自定义内容'
|
||||
}
|
||||
|
||||
obj.farr.forEach(value => {
|
||||
if (!value.fieldEn) {
|
||||
is.is = true
|
||||
is.msg = '请选择入参指标'
|
||||
}
|
||||
if (!value.fieldCn) {
|
||||
is.is = true
|
||||
is.msg = '请输入入参别名'
|
||||
}
|
||||
|
||||
})
|
||||
// 验证是否有重名
|
||||
let DuplicatesArr = obj.farr.map(x => x.Cn)
|
||||
let DuplicatesArr2 = Array.from(new Set(DuplicatesArr))
|
||||
|
||||
if (DuplicatesArr.length !== DuplicatesArr2.length) {
|
||||
is.is = true
|
||||
is.msg = '请查看入参是否有重名'
|
||||
}
|
||||
|
||||
|
||||
// console.log(obj)
|
||||
let arr = obj.formula.match(/@.*?@/g)
|
||||
|
||||
if (arr) {
|
||||
arr.forEach(value => {
|
||||
if (!obj.farr.find(x => x.fieldCn == value.substring(1, value.length - 1))) {
|
||||
is.is = true
|
||||
is.msg = '请检查是否有 未入参 但已使用的 字段'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (is.is) {
|
||||
this.$message.error(is.msg)
|
||||
}
|
||||
return is.is
|
||||
|
||||
},
|
||||
deleteGroupFields(item, index) {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
item.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
addgroupFields(value) { //添加分组
|
||||
console.log(value)
|
||||
if (!this.ValueObj) {
|
||||
this.$message.error('此数据下无可用字段')
|
||||
return
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.push([''])
|
||||
// this.$set(value.groupFields,0,[''])
|
||||
} else {
|
||||
value = [
|
||||
['']
|
||||
]
|
||||
// this.$set(value,'groupFields',[['']])
|
||||
}
|
||||
},
|
||||
|
||||
getdeepArr(obj) {
|
||||
if (Array.isArray(obj)) {
|
||||
return [{
|
||||
value: '[]',
|
||||
label: '元素本身'
|
||||
}]
|
||||
} else if (typeof obj == 'object') {
|
||||
// console.log(obj)
|
||||
let arr = []
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (Array.isArray(obj[key])) {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key
|
||||
})
|
||||
} else if (typeof obj[key] == 'object') {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key,
|
||||
children: this.getdeepArr(obj[key])
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
if (!this.$store.state.FieldUser) {
|
||||
return []
|
||||
} else {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
}
|
||||
},
|
||||
FieldUserObj() {
|
||||
if (!this.$store.state.FieldUserObj) {
|
||||
return []
|
||||
} else {
|
||||
return this.$store.state.FieldUserObj.data.fieldList
|
||||
}
|
||||
},
|
||||
|
||||
FieldUserJSON() { //所选数据源的json
|
||||
if (this.data.inputFieldEn) {
|
||||
let obj = this.FieldUser.find(x => x.fieldEn == this.data.inputFieldEn)
|
||||
|
||||
return obj ? JSON.parse(obj.jsonValue) : {}
|
||||
|
||||
}
|
||||
return {}
|
||||
},
|
||||
eachObjJSON() { //循环对象下层JSON
|
||||
|
||||
if (!this.data.originalDataOp.opField.length) {
|
||||
return this.FieldUserJSON
|
||||
}
|
||||
var arr = this.FieldUserJSON
|
||||
|
||||
this.data.originalDataOp.opField.forEach(value => {
|
||||
if (value == '[]') {
|
||||
arr = arr[0]
|
||||
} else {
|
||||
arr = arr[value]
|
||||
}
|
||||
})
|
||||
console.log(this.data.originalDataOp.opField)
|
||||
|
||||
return arr[0]
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
ValueObj() { //分组输入字段 的 元素 Obj
|
||||
|
||||
let arr = []
|
||||
if (this.data.inputFieldEn) {
|
||||
let obj = this.FieldUser.find(x => x.fieldEn == this.data.inputFieldEn)
|
||||
let arr2 = GetdeepObj(this.FieldUserJSON, true, true)
|
||||
|
||||
arr.push({
|
||||
label: obj.fieldCn,
|
||||
value: 'original',
|
||||
children: arr2
|
||||
})
|
||||
}
|
||||
if (this.data.originalDataOp.opField.length) {
|
||||
let arr2 = this.FieldUserJSON
|
||||
|
||||
this.data.originalDataOp.opField.forEach(value => {
|
||||
|
||||
if (value == '[]') {
|
||||
arr2 = arr2[0]
|
||||
} else {
|
||||
arr2 = arr2[value]
|
||||
}
|
||||
|
||||
})
|
||||
console.log(arr2)
|
||||
arr2 = GetdeepObj(arr2[0], true, true)
|
||||
arr.push({
|
||||
label: '循环对象元素',
|
||||
value: 'data_op',
|
||||
children: arr2
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return arr
|
||||
|
||||
|
||||
// if (this.data.inputFieldEn && this.data.inputFieldEn.length > 0) {
|
||||
// let obj = this.FieldUserObj.find(x => x.value == this.data.inputFieldEn[0])
|
||||
// obj = JSON.parse(obj.jsonValue)
|
||||
// this.data.inputFieldEn.forEach((value, index) => {
|
||||
|
||||
// if (index) {
|
||||
// obj = obj[value]
|
||||
// }
|
||||
|
||||
// })
|
||||
// obj = obj[0]
|
||||
// obj = GetdeepObj(obj, false)
|
||||
// this.cascaKey++
|
||||
|
||||
// return obj
|
||||
// } else {
|
||||
// return null
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,834 @@
|
||||
<style>
|
||||
.listOp_top {
|
||||
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.listOp_cont {}
|
||||
|
||||
.listOp_table_header {
|
||||
width: 350px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.listOp_table_comm {}
|
||||
|
||||
.listOp_score {
|
||||
width: 199px;
|
||||
height: 80px;
|
||||
text-align: center;
|
||||
line-height: 80px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.listOp_home {
|
||||
border-top: 1px solid #ddd;
|
||||
overflow: scroll;
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<!-- :style="{width:$store.state.barShrink?'95vw':'85vw'}" -->
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="mixinClose"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增数据清洗 :</span>
|
||||
<span v-else>编辑数据清洗 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button :icon="smallHeader?'el-icon-bottom':'el-icon-top'" circle @click="openHeader">
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit" :disabled="addVersionStatus">
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>数据清洗代码: </p>
|
||||
<el-input placeholder="请输入数据清洗代码" maxlength="30" v-model="code" clearable :disabled="addVersionStatus">
|
||||
</el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>数据清洗名称:</p>
|
||||
<el-input placeholder="请输入数据清洗名称" maxlength="20" v-model="name" clearable :disabled="addVersionStatus">
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_scope MR_scopeSmall':'MR_scope'">
|
||||
<div>
|
||||
<p>数据清洗描述: </p>
|
||||
<el-input placeholder="请输入决策描述" maxlength="300" v-model="description" clearable
|
||||
:disabled="addVersionStatus" style="margin-left: 20px;"></el-input>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<version style="margin:5px;" :id="id" :ruleVersionList="versionList" :version="version" @addVersion="addVersion"
|
||||
@addVersionClose="addVersionClose" @copyVersion="copyVersion" @delectVersion="delectVersion"
|
||||
@updateVersion="updateVersion" @addVersionSure="addVersionSure" :addVersionDialog="addVersionDialog"
|
||||
@Dialog="addVersionDialog=$event" @addVersionExamine="addVersionExamine"
|
||||
:addVersionLoading="addVersionLoading" @versionChange="versionChange" :addVersionStatus="addVersionStatus"
|
||||
@StatusChange="addVersionStatus=$event"></version>
|
||||
<!-- 版本部分 -->
|
||||
|
||||
<div class="listOp_home">
|
||||
|
||||
<opType :opType="opType" :data="version" @opFieldChange="opFieldChange"></opType>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import opType from './opType.vue'
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import version from '@/components/common/Version.vue'
|
||||
|
||||
const versionOrigin = {
|
||||
inputFieldEn: '',
|
||||
originalDataOp: {
|
||||
opField: [],
|
||||
opType: 'iteration',
|
||||
child: {}
|
||||
},
|
||||
conditionAndOutPutList: [{
|
||||
// eachList: '',
|
||||
condition: {
|
||||
logical: "&&",
|
||||
conditionType: 1,
|
||||
children: []
|
||||
},
|
||||
defaultOutput: [],
|
||||
resultFilterCondition: {
|
||||
conditionType: 1,
|
||||
logical: "&&",
|
||||
children: [],
|
||||
variableType: 1
|
||||
},
|
||||
inputFilterCondition: {
|
||||
conditionType: 1,
|
||||
logical: "&&",
|
||||
children: [],
|
||||
variableType: 1
|
||||
},
|
||||
failOutput: [],
|
||||
successOutput: [],
|
||||
dataCleanBlock: {
|
||||
name: "",
|
||||
opType: 'original',
|
||||
groupFields: [],
|
||||
handleCollection: []
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
version,
|
||||
opType
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
nameId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
addVersionStatus: false,
|
||||
addVersionLoading: false,
|
||||
addVersionDialog: false,
|
||||
tempadd: {},
|
||||
loading: false,
|
||||
priority: '',
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
parentId: '',
|
||||
versionList: [],
|
||||
version: {},
|
||||
opType: 2,
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getData.getVersion(this.id).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.code = res.data.code
|
||||
this.name = res.data.name
|
||||
|
||||
this.priority = res.data.priority
|
||||
this.description = res.data.description
|
||||
this.parentId = res.data.folderId
|
||||
|
||||
|
||||
|
||||
// 版本部分
|
||||
this.versionList = res.data.versionList
|
||||
let obj = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
|
||||
|
||||
this.Enformat(obj, 'Array')
|
||||
console.log(obj)
|
||||
this.version = obj
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 新增初始化
|
||||
this.version = JSON.parse(JSON.stringify(versionOrigin))
|
||||
console.log(this.version)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
opFieldChange(e) {
|
||||
this.version.conditionAndOutPutList = JSON.parse(JSON.stringify(versionOrigin.conditionAndOutPutList))
|
||||
|
||||
console.log(this.version)
|
||||
|
||||
|
||||
},
|
||||
// opTypeChange(e) {
|
||||
// if (e == 1) {
|
||||
// this.version.conditionAndOutPutList = [this.version.conditionAndOutPutList[0]]
|
||||
// } else if (e == 2) {
|
||||
// this.version.groupFields = []
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// },
|
||||
versionChange(e) {
|
||||
let obj = JSON.parse(JSON.stringify(e))
|
||||
this.Enformat(obj, 'Array')
|
||||
|
||||
|
||||
// debugger
|
||||
this.version = obj
|
||||
this.loading = false
|
||||
},
|
||||
addVersionExamine() {
|
||||
|
||||
if (this.getIsempty(this.version)) {
|
||||
return
|
||||
}
|
||||
this.addVersionDialog = true
|
||||
},
|
||||
addVersionSure(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
|
||||
|
||||
let obj = JSON.parse(JSON.stringify(this.version))
|
||||
obj.versionCode = tempVersion.versionCode
|
||||
obj.description = tempVersion.description
|
||||
obj.dataCleanId = this.id
|
||||
|
||||
try {
|
||||
if (Array.isArray(JSON.parse(this.mixinGetFieldByEn(this.version.inputFieldEn).jsonValue))) {
|
||||
obj.inputFieldType = 'list'
|
||||
} else {
|
||||
obj.inputFieldType = 'map'
|
||||
}
|
||||
} catch (e) {
|
||||
this.$message.error('源数据选择出错')
|
||||
this.addVersionLoading = false
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.Enformat(obj, 'String')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.getData.addVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '添加版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.versionChange(this.versionList[0])
|
||||
|
||||
}
|
||||
this.loading = false
|
||||
this.addVersionStatus = false
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
updateVersion(tempVersion) {
|
||||
if (this.getIsempty(this.version)) {
|
||||
return
|
||||
}
|
||||
this.addVersionLoading = true
|
||||
let obj = JSON.parse(JSON.stringify(this.version))
|
||||
obj.versionCode = tempVersion.versionCode
|
||||
obj.description = tempVersion.description
|
||||
obj.dataCleanId = this.id
|
||||
try {
|
||||
if (Array.isArray(JSON.parse(this.mixinGetFieldByEn(this.version.inputFieldEn).jsonValue))) {
|
||||
obj.inputFieldType = 'list'
|
||||
} else {
|
||||
obj.inputFieldType = 'map'
|
||||
}
|
||||
} catch (e) {
|
||||
this.$message.error('源数据选择出错')
|
||||
this.addVersionLoading = false
|
||||
return
|
||||
}
|
||||
this.Enformat(obj, 'String')
|
||||
|
||||
this.getData.updateVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '版本重命名成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.versionChange(this.versionList[0])
|
||||
|
||||
}
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
delectVersion() {
|
||||
this.getData.delectVersion({
|
||||
status: -1,
|
||||
ids: [this.version.id],
|
||||
strategyId: this.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.versionChange(this.versionList[0])
|
||||
}
|
||||
})
|
||||
},
|
||||
copyVersion(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
|
||||
this.getData.copyVersion({
|
||||
dataCleanId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description
|
||||
}).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '复制版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.versionChange(this.versionList[0])
|
||||
|
||||
}
|
||||
this.loading = false
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
addVersionClose() {
|
||||
this.version = this.tempadd
|
||||
this.tempadd = {}
|
||||
},
|
||||
addVersion() {
|
||||
this.tempadd = JSON.parse(JSON.stringify(this.version))
|
||||
|
||||
this.reset()
|
||||
},
|
||||
|
||||
reset() {
|
||||
this.version = JSON.parse(JSON.stringify(versionOrigin))
|
||||
},
|
||||
Enformat(obj, str) {
|
||||
if(obj.originalDataOp.opField){
|
||||
obj.originalDataOp.opField = getformat(obj.originalDataOp.opField)
|
||||
}
|
||||
|
||||
|
||||
|
||||
obj.conditionAndOutPutList.forEach(value => {
|
||||
|
||||
|
||||
value.dataCleanBlock.handleCollection = getformat(value.dataCleanBlock.handleCollection)
|
||||
|
||||
value.successOutput.forEach(item => {
|
||||
if (str == 'String') {
|
||||
item.opType = item.outputKey.shift()
|
||||
} else {
|
||||
item.outputKey = item.opType + '.' + item.outputKey
|
||||
}
|
||||
item.outputKey = getformat(item.outputKey)
|
||||
if (item.variableType == 2) {
|
||||
item.outputValue = getformat(item.outputValue)
|
||||
}
|
||||
})
|
||||
value.failOutput.forEach(item => {
|
||||
|
||||
if (str == 'String') {
|
||||
item.opType = item.outputKey.shift()
|
||||
} else {
|
||||
item.outputKey = item.opType + '.' + item.outputKey
|
||||
}
|
||||
|
||||
item.outputKey = getformat(item.outputKey)
|
||||
if (item.variableType == 2) {
|
||||
item.outputValue = getformat(item.outputValue)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if (str == 'Array') {
|
||||
if (value.dataCleanBlock.groupFields) {
|
||||
|
||||
value.dataCleanBlock.groupFields = JSON.parse(value.dataCleanBlock.groupFields)
|
||||
} else {
|
||||
value.dataCleanBlock.groupFields = []
|
||||
}
|
||||
}
|
||||
|
||||
value.dataCleanBlock.opType = 'handle_collection'
|
||||
value.dataCleanBlock.groupFields = value.dataCleanBlock.groupFields.map(item => {
|
||||
if (str == 'String') {
|
||||
item.shift()
|
||||
} else {
|
||||
item = 'handle_collection.' + item
|
||||
}
|
||||
return getformat(item)
|
||||
})
|
||||
if (str == 'String') {
|
||||
value.dataCleanBlock.groupFields = JSON.stringify(value.dataCleanBlock.groupFields)
|
||||
}
|
||||
|
||||
value.resultFilterCondition.children.forEach(item => {
|
||||
|
||||
|
||||
|
||||
if (str == 'String') {
|
||||
item.opType = item.opKey.shift()
|
||||
} else {
|
||||
item.opKey = item.opType + '.' + item.opKey
|
||||
}
|
||||
|
||||
item.opKey = getformat(item.opKey)
|
||||
})
|
||||
value.inputFilterCondition.children.forEach(item => {
|
||||
|
||||
if (str == 'String') {
|
||||
item.opType = item.opKey.shift()
|
||||
} else {
|
||||
item.opKey = item.opType + '.' + item.opKey
|
||||
}
|
||||
|
||||
item.opKey = getformat(item.opKey)
|
||||
})
|
||||
|
||||
deepformat([value.condition])
|
||||
|
||||
// if(value.condition.children.length>0){
|
||||
// value.defaultOutput = []
|
||||
// }else{
|
||||
// value.defaultOutput = value.successOutput
|
||||
// }
|
||||
|
||||
})
|
||||
|
||||
function deepformat(arr) {
|
||||
arr.forEach(value => {
|
||||
if (value.children && value.children.length > 0) {
|
||||
deepformat(value.children)
|
||||
}
|
||||
|
||||
if (value.conditionType == 2) {
|
||||
|
||||
|
||||
if (str == 'String') {
|
||||
value.opType = value.opKey.shift()
|
||||
} else {
|
||||
value.opKey = value.opType + '.' + value.opKey
|
||||
}
|
||||
|
||||
value.opKey = getformat(value.opKey)
|
||||
|
||||
if (value.variableType == 2) {
|
||||
value.variableValue = getformat(value.variableValue)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function getformat(arr) {
|
||||
if (str == "String") {
|
||||
// debugger
|
||||
console.log(arr)
|
||||
return arr.join('.')
|
||||
} else {
|
||||
return arr.split('.')
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
examine() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.code.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return true
|
||||
}
|
||||
if (this.verificationCode(this.code) || this.verificationName(this.name)) {
|
||||
return true
|
||||
}
|
||||
if (this.code.trim() == '') {
|
||||
this.$message.error('请填入数据清洗代码,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.name.trim() == '') {
|
||||
this.$message.error('请填入数据清洗名称,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.description.trim() == '') {
|
||||
this.$message.error('请填入数据清洗描述,并检查空格');
|
||||
return true
|
||||
}
|
||||
|
||||
let is = {
|
||||
is: false,
|
||||
msg: '提交失败,请检查是否有未填项'
|
||||
}
|
||||
|
||||
|
||||
if (is.is) {
|
||||
this.$message.error(is.msg)
|
||||
return true
|
||||
}
|
||||
|
||||
},
|
||||
getIsempty(obj) {
|
||||
let is = {
|
||||
is: false,
|
||||
msg: ''
|
||||
}
|
||||
|
||||
|
||||
if (!obj.inputFieldEn) {
|
||||
is.is = true
|
||||
is.msg = '请选择 源数据 '
|
||||
}
|
||||
|
||||
// if (!obj.originalDataOp.opField || obj.originalDataOp.opField.length == 0) {
|
||||
// is.is = true
|
||||
// is.msg = '请选择 循环数据 '
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
obj.conditionAndOutPutList.forEach(value => {
|
||||
|
||||
if (!value.dataCleanBlock.handleCollection.length) {
|
||||
is.is = true
|
||||
is.msg = '请选择 集合'
|
||||
}
|
||||
|
||||
value.resultFilterCondition.children.forEach(value => {
|
||||
if (!value.opKey || value.opKey.length == 0) {
|
||||
is.is = true
|
||||
is.msg = '请选择 返回过滤的 Key'
|
||||
}
|
||||
|
||||
|
||||
if ((!value.variableValue || value.variableValue.trim() == '')&&value.operator!='min') {
|
||||
is.is = true
|
||||
is.msg = '请填写 返回过滤的 的值'
|
||||
}
|
||||
|
||||
})
|
||||
value.inputFilterCondition.children.forEach(value => {
|
||||
if (!value.opKey || value.opKey.length == 0) {
|
||||
is.is = true
|
||||
is.msg = '请选择 进入过滤的 Key'
|
||||
}
|
||||
|
||||
|
||||
if ((!value.variableValue || value.variableValue.trim() == '')&&value.operator!='min') {
|
||||
is.is = true
|
||||
is.msg = '请填写 进入过滤的 的值'
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
value.dataCleanBlock.groupFields.forEach(value => {
|
||||
|
||||
if (value.length == 0 || !value[0]) {
|
||||
is.is = true
|
||||
is.msg = '请选择 分组 '
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if (is.is) {
|
||||
return
|
||||
}
|
||||
|
||||
if((value.successOutput.length||value.failOutput.length)&&!value.condition.children.length){
|
||||
is.is=true
|
||||
is.msg = '有命中修改或未命中修改后 条件不能为空'
|
||||
}
|
||||
if (is.is) {
|
||||
return
|
||||
}
|
||||
value.successOutput.forEach(item => {
|
||||
forVerify(is, item, '命中')
|
||||
})
|
||||
|
||||
if (is.is) {
|
||||
return
|
||||
}
|
||||
|
||||
value.failOutput.forEach(item => {
|
||||
forVerify(is, item, '未命中')
|
||||
})
|
||||
|
||||
if (is.is) {
|
||||
return
|
||||
}
|
||||
|
||||
deepexamine(is, [value.condition])
|
||||
if (is.is) {
|
||||
return
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if (is.is) {
|
||||
this.$message.error(is.msg)
|
||||
}
|
||||
return is.is
|
||||
|
||||
|
||||
|
||||
function forVerify(is, item, str) {
|
||||
|
||||
|
||||
console.log(item)
|
||||
if (!item.outputKey) {
|
||||
is.is = true
|
||||
is.msg = `请选择${str}修改的 属性`
|
||||
}
|
||||
|
||||
if (!item.outputValue || !item.outputValue.trim()) {
|
||||
is.is = true
|
||||
is.msg = `请输入${str}修改的 值`
|
||||
} else if (item.variableType == 3 && JSON.parse(item.outputValue).formula.trim() == '') {
|
||||
|
||||
is.is = true
|
||||
is.msg = `请输入${str}修改的 值`
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function 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.opKey) {
|
||||
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 = '关系符下不允许为空'
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
submit() {
|
||||
|
||||
this.loading = true
|
||||
if (this.examine()) {
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
console.log(this.version)
|
||||
if (this.getIsempty(this.version)) {
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
|
||||
let sobj = JSON.parse(JSON.stringify(this.version))
|
||||
|
||||
try {
|
||||
if (Array.isArray(JSON.parse(this.mixinGetFieldByEn(this.version.inputFieldEn).jsonValue))) {
|
||||
sobj.inputFieldType = 'list'
|
||||
} else {
|
||||
sobj.inputFieldType = 'map'
|
||||
}
|
||||
} catch (e) {
|
||||
this.$message.error('源数据选择出错')
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
this.Enformat(sobj, 'String')
|
||||
console.log(sobj)
|
||||
// return
|
||||
let obj = {
|
||||
"code": this.code.trim(),
|
||||
"name": this.name.trim(),
|
||||
"description": String(this.description).trim(),
|
||||
|
||||
"versionList": [sobj],
|
||||
|
||||
}
|
||||
|
||||
if (this.id == 0) {
|
||||
obj.versionList[0].versionCode = 'V:0'
|
||||
obj.versionList[0].description = '初始版本'
|
||||
obj.folderId = this.nameId == 99999999 ? 0 : this.nameId,
|
||||
this.getData.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.versionList = res.data.versionList
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.$emit('Ok')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.folderId = this.parentId
|
||||
obj.versionList[0].id = this.version.id
|
||||
obj.versionList[0].dataCleanId = this.id
|
||||
|
||||
this.getData.updatafield(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.versionList = res.data.versionList
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
computed: {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
486
h5-enginex-manager/src/components/common/dataRinse/teParam.vue
Normal file
486
h5-enginex-manager/src/components/common/dataRinse/teParam.vue
Normal file
@@ -0,0 +1,486 @@
|
||||
<style>
|
||||
.te_top {
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
background-color: #aaa;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
}
|
||||
|
||||
.te_top>p {
|
||||
color: #eee;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.te_top>p:hover {
|
||||
color: #fff;
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.teParamParamList {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
|
||||
<p>
|
||||
入参:
|
||||
</p>
|
||||
<div>
|
||||
|
||||
|
||||
<div v-for="(value,index) in paramList"
|
||||
style="margin-top: 10px;border-bottom: 1px #ddd dotted;padding-bottom: 5px;">
|
||||
|
||||
<el-input v-model="value.fieldCn" style="width: 200px;" placeholder="请输入别名"></el-input>
|
||||
:
|
||||
<el-cascader v-model="value.fieldEn" filterable :options="options" :key="value.random?value.random:0"
|
||||
@visible-change="randomAdd(value,$event)" :props="{ expandTrigger: 'hover' }" style="width: 300px;"></el-cascader>
|
||||
<i class="el-icon-circle-close" style="color: red;font-size: 20px;margin-left: 10px;"
|
||||
@click="deleteparam(index)"></i>
|
||||
|
||||
</div>
|
||||
<el-button @click="addParam" style="margin-top: 10px;">+
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p style="font-size:14px;margin-bottom: 5px;color: #aaa;margin-top: 30px;">
|
||||
‘@’字符选择变量
|
||||
</p>
|
||||
<slot></slot>
|
||||
<div class="te_top" v-if="hint==true">
|
||||
<p @click="textareaAdd('+')">+</p>
|
||||
<p @click="textareaAdd('-')">-</p>
|
||||
<p @click="textareaAdd('*')">*</p>
|
||||
<p @click="textareaAdd('/')">/</p>
|
||||
<p @click="textareaAdd('sqrt(,)')">sqrt</p>
|
||||
<p @click="textareaAdd('In(,)')">In</p>
|
||||
<p @click="textareaAdd('avg(,)')">avg()</p>
|
||||
<p @click="textareaAdd('(,)')">()</p>
|
||||
<p @click="textareaAdd('abs(,)')">abs</p>
|
||||
<p @click="textareaAdd('max(,)')">max</p>
|
||||
<p @click="textareaAdd('min(,)')">min</p>
|
||||
<p @click="textareaAdd('lg(,)')">lg</p>
|
||||
<p @click="textareaAdd('exp(,)')">exp</p>
|
||||
<p @click="textareaAdd('ceil(,)')">ceil</p>
|
||||
<p @click="textareaAdd('floor(,)')">floor</p>
|
||||
</div>
|
||||
<el-input type="textarea" rows="9" placeholder="请输入内容" v-model="formula_show" ref="textarea"
|
||||
@input="$emit('input',formula_show)">
|
||||
</el-input>
|
||||
<fieldUserTable :text="text" :fieldUser="paramList" refs="t" @dbc="dbclick" :show="isshow"
|
||||
@close="isshow=false"></fieldUserTable>
|
||||
<!-- <el-dialog :title="'当前编辑'+nowCurr" :visible.sync="dialogVisible" width="30%" append-to-body>
|
||||
<el-button @click="delect">删除字段</el-button>
|
||||
</el-dialog> -->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import fieldUserTable from '@/components/common/fieldUserTable.vue'
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
components: {
|
||||
fieldUserTable,
|
||||
varialeSelect
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
hint: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
paramList: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
options: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
tempsection: [],
|
||||
sectionVisible: false, //区间编辑弹窗
|
||||
nowCurr: '',
|
||||
dialogVisible: false,
|
||||
isshow: false,
|
||||
text: '',
|
||||
tempIndex: '',
|
||||
lest: '',
|
||||
islest: false,
|
||||
tempFormula: '',
|
||||
formula_show: '',
|
||||
cursorfront: '',
|
||||
cursorlest: '',
|
||||
lastKeyDown: '',
|
||||
// fields: []
|
||||
FieldUserType: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.textarea.$refs.textarea.onkeydown = (e) => {
|
||||
|
||||
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
if (e.key == "Backspace" || e.key == "Delete") {
|
||||
this.lastKeyDown = e.key
|
||||
|
||||
if (e.key == "Backspace" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart - 1,
|
||||
this.$refs.textarea.$refs.textarea.selectionStart) == '@' && (this.isodd(this.formula_show,
|
||||
'@') == false)) {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Backspace")
|
||||
}
|
||||
if (e.key == "Delete" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart, this.$refs
|
||||
.textarea.$refs.textarea.selectionStart + 1) == '@') {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Delete")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
interfaceList() {
|
||||
return this.$store.state.Interface
|
||||
},
|
||||
FieldUser() {
|
||||
if (!this.FieldUserType) {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return this.$store.state.FieldUser.data.fieldList.filter(x => x.valueType == this.FieldUserType)
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.formula_show = this.value
|
||||
|
||||
console.log(this.options)
|
||||
// if (this.Disabled) {
|
||||
// this.FieldUserType = 1
|
||||
// } else {
|
||||
// this.FieldUserType = null
|
||||
// }
|
||||
// console.log(this.FieldUserType)
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
deleteparam(index) {
|
||||
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
|
||||
this.paramList.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
},
|
||||
paramChange(index, id) {
|
||||
let value = this.FieldUser.find(x => x.id == id)
|
||||
if (value.sqlStatement) {
|
||||
let arr = JSON.parse(value.sqlVariable)
|
||||
if (arr) {
|
||||
this.$set(value, 'paramList', arr.map(value => {
|
||||
return {
|
||||
en: value.key,
|
||||
value: "",
|
||||
type: 1
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
if (value.interface) {
|
||||
let obj = this.interfaceList.find(x => x.id == value.interfaceId)
|
||||
if (obj) {
|
||||
this.$set(value, 'paramList', JSON.parse(obj.bindParam).variable.map(value => {
|
||||
return {
|
||||
en: value.key,
|
||||
value: "",
|
||||
type: 1
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.$set(this.paramList, index, JSON.parse(JSON.stringify(value)))
|
||||
},
|
||||
addParam() {
|
||||
// let arr = JSON.parse(JSON.stringify())
|
||||
this.paramList.push({
|
||||
id: '',
|
||||
fieldCn: '',
|
||||
fieldEn: ''
|
||||
})
|
||||
// console.log(arr)
|
||||
// this.$emit('update:paramList', arr)
|
||||
|
||||
console.log(this.paramList)
|
||||
},
|
||||
|
||||
setCaretPosition(ctrl, pos) { //设置光标位置函数
|
||||
if (ctrl.setSelectionRange) {
|
||||
ctrl.focus();
|
||||
this.$nextTick(() => {
|
||||
ctrl.setSelectionRange(pos, pos);
|
||||
})
|
||||
} else if (ctrl.createTextRange) {
|
||||
var range = ctrl.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
},
|
||||
textareaAdd(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea
|
||||
.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
if (e.split(',')[1]) {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + e.split(',')[1] + this.cursorlest
|
||||
} else {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + this.cursorlest
|
||||
}
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront + e.split(',')[0])
|
||||
.length)
|
||||
},
|
||||
|
||||
// 获取 字符串中 有 多少个指定字符
|
||||
getTempIndex(string, str) {
|
||||
let temp = 0
|
||||
for (let num = 0;;) {
|
||||
|
||||
|
||||
if (string.indexOf(str, temp) != -1) {
|
||||
temp = string.indexOf(str, temp)
|
||||
temp++
|
||||
num++
|
||||
} else {
|
||||
return num
|
||||
}
|
||||
}
|
||||
// console.log(string, str)
|
||||
},
|
||||
getTempArreyIndex(array, str) {
|
||||
let num = 0
|
||||
array.forEach((value) => {
|
||||
if (value.field_name == "str") {
|
||||
num++
|
||||
}
|
||||
})
|
||||
return num
|
||||
|
||||
|
||||
},
|
||||
countCurr() {
|
||||
if ((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true)) {} else if (
|
||||
this.lastKeyDown == "Backspace") {
|
||||
this.cursorfront = this.cursorfront.substring(0, this.cursorfront.length - 1)
|
||||
this.cursorlest = '@' + this.cursorlest
|
||||
|
||||
} else if (this.lastKeyDown == "Delete") {
|
||||
this.cursorfront = this.cursorfront + '@'
|
||||
this.cursorlest = this.cursorlest.substr(1);
|
||||
|
||||
}
|
||||
let str = this.cursorfront.substring(this.cursorfront.lastIndexOf('@')) + this.cursorlest
|
||||
.substring(0, this.cursorlest
|
||||
.indexOf('@') + 1)
|
||||
|
||||
this.nowCurr = str + '|' + this.getTempIndex(this.cursorfront, str)
|
||||
// console.log(this.nowCurr)
|
||||
|
||||
},
|
||||
delect(type) {
|
||||
let str = this.nowCurr.split('|')[0]
|
||||
let index = this.nowCurr.split('|')[1]
|
||||
|
||||
// this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
this.delectShow(str, parseInt(index))
|
||||
if (type == 'Backspace') {
|
||||
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length - str.length + 1))
|
||||
} else if (type == 'Delete') {
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length - 1))
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.cursorfront = ""
|
||||
this.cursorlest = ""
|
||||
this.nowCurr = ""
|
||||
this.lastKeyDown = ""
|
||||
|
||||
},
|
||||
|
||||
delectShow(str, index) { // 回显删除
|
||||
|
||||
this.formula_show = this.formula_show.substring(0, this.cursorfront.lastIndexOf('@')) + this
|
||||
.formula_show.substring(
|
||||
this.cursorfront.lastIndexOf('@') + str.length, )
|
||||
this.tempFormula = this.formula_show
|
||||
|
||||
|
||||
},
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
dbclick(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// console.log(this.cursorfront)
|
||||
let T = ""
|
||||
T = this.formula_show.split("")
|
||||
T.splice(this.tempIndex, this.text.length + 1, '@' + e + '@')
|
||||
this.formula_show = T.join("")
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length + e.length + 1 - this
|
||||
.text.length))
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
},
|
||||
deepClone(obj) {
|
||||
if (this.getType(obj) === 'Array') {
|
||||
var res = []
|
||||
} else if (this.getType(obj) === 'Object') {
|
||||
var res = {}
|
||||
} else {
|
||||
return obj
|
||||
}
|
||||
for (var i in obj) {
|
||||
res[i] = this.deepClone(obj[i])
|
||||
}
|
||||
return res
|
||||
},
|
||||
getType(obj) {
|
||||
var res = Object.prototype.toString.call(obj)
|
||||
//截取注意[] 符号,和空格
|
||||
return res.slice(8, -1) // 也可以res.length-1
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
formula_show() {
|
||||
let num = 0
|
||||
|
||||
for (let i of this.formula_show) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
this.isshow = true
|
||||
for (let i in this.formula_show) {
|
||||
if (this.formula_show[i] !== this.tempFormula[i] && this.formula_show[i] == "@") {
|
||||
|
||||
if (this.islest) {
|
||||
this.tempIndex = i
|
||||
|
||||
this.lest = this.formula_show.substring(parseInt(this.tempIndex) + 1, this
|
||||
.formula_show.length)
|
||||
this.islest = false
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let T = this.formula_show.substring(parseInt(this.tempIndex) + 1, this.formula_show.length)
|
||||
if (this.lest !== "") {
|
||||
// console.log(T)
|
||||
T = T.substring(0, T.indexOf(this.lest))
|
||||
|
||||
} else {
|
||||
T = T.substring(0, T.length)
|
||||
}
|
||||
|
||||
this.text = T
|
||||
if (this.text === "@") {
|
||||
this.text = ""
|
||||
}
|
||||
// console.log('lest:' + this.lest, 'index:' + this.tempIndex, "T:" + T)
|
||||
|
||||
} else {
|
||||
this.islest = true
|
||||
this.text = ""
|
||||
this.tempIndex = null
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
}
|
||||
this.tempFormula = this.formula_show
|
||||
this.data.formula_show = this.formula_show
|
||||
this.$emit('input', this.formula_show)
|
||||
},
|
||||
fields: {
|
||||
handler: function() {
|
||||
this.data.fields = this.fields
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
value(value) {
|
||||
console.log(value)
|
||||
this.formula_show = this.value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
6
h5-enginex-manager/src/components/common/decision/bus.js
Normal file
6
h5-enginex-manager/src/components/common/decision/bus.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// 使用 Event Bus
|
||||
const bus = new Vue();
|
||||
|
||||
export default bus;
|
||||
244
h5-enginex-manager/src/components/common/decision/decCont.vue
Normal file
244
h5-enginex-manager/src/components/common/decision/decCont.vue
Normal file
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<div class="cont_cont">
|
||||
|
||||
<div class="cont_left" v-loading="leftloading" v-if="!listRedact">
|
||||
<div class="cont_header">
|
||||
<p class="cont_header_title">{{title}}</p>
|
||||
<p class="cont_header_subtitle">{{title}}</p>
|
||||
</div>
|
||||
<contNewFule v-model="tempNewF" :newf.sync="newf" @newFileSure="newFileSure" @newFile="newFile">
|
||||
</contNewFule>
|
||||
|
||||
<div class="cont_list">
|
||||
|
||||
|
||||
<fileHome :data="list" @curr="clickCurrid" :currid="currid" @RenameFun="RenameFun"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @delectFun="delectFun">
|
||||
</fileHome>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cont_right" v-loading="contloading" @click="tempHintLeft=null;tempHintTop=null;">
|
||||
<div v-if="!listRedact">
|
||||
<div v-if="showRight===false" class="cont_right_hint">
|
||||
请先选择左侧文件夹
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="cont_right_top">
|
||||
<div>
|
||||
<el-button type="primary" @click="listRedact=true"
|
||||
:disabled="currid!=99999999?false:'disabled'">新增</el-button>
|
||||
<el-button type="danger" @click="using(-1);$store.dispatch('regetcache','decisionTable')"
|
||||
:disabled="this.selection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button type="success" @click="using(1)"
|
||||
:disabled="this.selection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button type="warning" @click="using(0)"
|
||||
:disabled="this.selection.length>0?false:'disabled'">停用</el-button>
|
||||
<el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;"
|
||||
:disabled="this.selection.length>0?false:'disabled'" filterable
|
||||
@change="mixinMoveChange">
|
||||
<el-option v-for="value in listunfold" :key="value.id" :label="value.name"
|
||||
:value="value.id" v-show="value.id!=99999999"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-input placeholder="请输入搜索内容" v-model="search">
|
||||
<i slot="suffix" class="el-input__icon el-icon-search" @click="getsearch"></i>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right_cont">
|
||||
<div v-if="data">
|
||||
<el-table border :data="data.data.klist" @select-all="selectAll" @select="select"
|
||||
style="width: 100%" :cell-style="{padding: '10px'}">
|
||||
<el-table-column type="selection" width="70">
|
||||
</el-table-column>
|
||||
<el-table-column v-for="item in getData.row" :key="item.id" :prop="item.row"
|
||||
:label="item.label" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="item.type==='Blooen'">
|
||||
{{scope.row[item.row]?"是":"否"}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='State'">
|
||||
{{scope.row[item.row]==1?'启用':'未启用'}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='Time'" style="white-space: nowrap;"
|
||||
class="contText">{{
|
||||
new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row[item.row]).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
<span class="contText" v-else>
|
||||
{{scope.row[item.row]}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-button icon="el-icon-setting" circle size="mini"
|
||||
@click="dialogShow(scope.row.id)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="float: right;margin-right: 40px;margin-top: 40px;"
|
||||
:current-page="currPage" @current-change="clickpage" background
|
||||
layout="prev, pager, next" :total="data.data.pageInfo.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else style="height: 100%;overflow: hidden;">
|
||||
<dataManageRedact @close="listRedact=false;tempRedactId=0"
|
||||
@Ok="listRedact=false;tempRedactId=0;getlist()" :getData="getData" :id='tempRedactId'
|
||||
:nameId="currid" :type="getData.type"></dataManageRedact>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import contNewFule from '@/components/common/contNewFile.vue'
|
||||
import '@/assets/css/cont.css'
|
||||
import fileHome from '@/components/common/fileHome.vue'
|
||||
import dataManageRedact from './decManageRedact.vue'
|
||||
import contmixin from '@/utils/contminxin/contmixin.js'
|
||||
export default {
|
||||
mixins: [
|
||||
contmixin
|
||||
],
|
||||
components: {
|
||||
contNewFule,
|
||||
fileHome,
|
||||
dataManageRedact
|
||||
},
|
||||
created() {
|
||||
this.getData.getTree({
|
||||
parentId: 0,
|
||||
treeType: this.getData.treeType,
|
||||
type: 1
|
||||
}).then(res => {
|
||||
this.list = this.listTreeDeep(res.data, 1)
|
||||
this.clickCurrid(99999999)
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
list() {
|
||||
if (this.list.length > 0) {
|
||||
this.leftloading = false
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
tempMove: '',
|
||||
leftloading: true,
|
||||
search: "",
|
||||
fileName: "",
|
||||
fileList: [],
|
||||
upShow: false,
|
||||
currPage: 1,
|
||||
currid: null,
|
||||
data: null,
|
||||
contloading: false,
|
||||
newf: false,
|
||||
tempNewF: "",
|
||||
listRedact: false, //新增页面开启
|
||||
tempRedactId: 0,
|
||||
selection: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
getsearch() {
|
||||
this.contloading = true
|
||||
let params = {
|
||||
decisionTables: {
|
||||
name: this.search,
|
||||
},
|
||||
"parentIds": String(this.currid) === "99999999" ? '' : String(this.currid),
|
||||
key: "ruleName",
|
||||
status: "0,1",
|
||||
"pageNum": 1,
|
||||
isSearch: 1
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
this.currPage = 1
|
||||
},
|
||||
|
||||
getlist() {
|
||||
this.contloading = true
|
||||
this.listRedact = false
|
||||
let params = {
|
||||
status: "0,1",
|
||||
decisionTables: {},
|
||||
"pageNum": 1
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.decisionTables.parentId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
|
||||
},
|
||||
clickpage(e) {
|
||||
this.currPage = e
|
||||
this.contloading = true
|
||||
let params = {
|
||||
status: "0,1",
|
||||
decisionTables: {},
|
||||
"pageNum": e
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.decisionTables.parentId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
if (res.status == 1) {
|
||||
this.data = res
|
||||
this.selection = []
|
||||
this.contloading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
newFileSure() {
|
||||
this.leftloading = true
|
||||
let params = {
|
||||
parentId: String(this.currid),
|
||||
name: this.tempNewF,
|
||||
"treeType": "3",
|
||||
"type": "1",
|
||||
"engineId": ""
|
||||
}
|
||||
if(this.mixnewFileZindexVerify(this.list,this.currid)==6){
|
||||
this.$message.error('已达到最深层级')
|
||||
this.leftloading = false
|
||||
return
|
||||
}
|
||||
this.mixnewFileSure(params)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,935 @@
|
||||
<style>
|
||||
|
||||
.dec_top{
|
||||
|
||||
display: flex;
|
||||
}
|
||||
.dec_cont{
|
||||
|
||||
}
|
||||
.dec_table_header{
|
||||
width: 350px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.dec_table_comm{
|
||||
}
|
||||
.dec_score{
|
||||
width: 199px;
|
||||
height: 80px;
|
||||
text-align: center;
|
||||
line-height: 80px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.dec_home{
|
||||
padding-bottom: 20px;
|
||||
border-top: 1px solid #ddd;
|
||||
overflow: scroll;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
<template>
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="mixinClose"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增决策表 :</span>
|
||||
<span v-else>编辑决策表 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button :icon="smallHeader?'el-icon-bottom':'el-icon-top'" circle @click="openHeader">
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit" :disabled="addVersionStatus"></el-button>
|
||||
<!-- <el-button type="danger" icon="el-icon-close" circle @click="$emit('close')"></el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>决策代码: </p>
|
||||
<el-input placeholder="请输入决策表代码" maxlength="30" v-model="code" clearable :disabled="addVersionStatus"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>决策名称:</p>
|
||||
<el-input placeholder="请输入规则名称" maxlength="20" v-model="name" clearable :disabled="addVersionStatus"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_scope MR_scopeSmall':'MR_scope'">
|
||||
<div>
|
||||
<p>决策描述: </p>
|
||||
<el-input placeholder="请输入决策描述" maxlength="300" v-model="description" clearable :disabled="addVersionStatus"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<version style="margin:5px;" :id="id" :ruleVersionList="decisionTablesVersionList" :version="version"
|
||||
@addVersion="addVersion" @addVersionClose="addVersionClose" @copyVersion="copyVersion" @delectVersion="delectVersion"
|
||||
@updateVersion="updateVersion" @addVersionSure="addVersionSure" :addVersionDialog="addVersionDialog" @Dialog="addVersionDialog=$event"
|
||||
@addVersionExamine="addVersionExamine" :addVersionLoading="addVersionLoading" @versionChange="versionChange"
|
||||
:addVersionStatus="addVersionStatus" @StatusChange="addVersionStatus=$event"></version>
|
||||
<!-- 版本部分 -->
|
||||
<div class="dec_home" v-if="leftDetailVo&&topDetailVo&&resultList" :key="num">
|
||||
<!-- 决策主体 -->
|
||||
<div class="dec" style="width: auto;">
|
||||
<div class="dec_top">
|
||||
<!-- top -->
|
||||
<div class="dec_table_header" :style="{width:width,flexShrink:'0'}">
|
||||
</div>
|
||||
<div class="dec_table_comm">
|
||||
<topRecursion :data="topDetailVo" direction="row"></topRecursion>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dec_cont" style="display: flex;">
|
||||
<recursion :data="leftDetailVo" ref="left" id="left" style="flex-shrink: 0;flex-grow:0"></recursion>
|
||||
<div>
|
||||
<div v-for="(value,index) in resultList" :key="index" style="display: flex;">
|
||||
<div v-for="(item,inde) in value" :key="inde" class="dec_score" :style="{borderRight:inde==value.length-1?'1px solid #ddd':''}">
|
||||
<textInput :text="String(item)" click="click" :center="true" :examine="3" @input="input($event,index,inde)"></textInput>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p style="font-size: 12px;color: #666;margin-top: 5px;">*如果只有一行或者一列 且 没有次级节点 则 此行/列 可以为空 执行时会被默认选中</p>
|
||||
<outcontent :outcontent="outcontent" type="decision_tables" style="margin-top: 20px;margin-left: 50px;">
|
||||
<div style="display:flex; align-items: center;">
|
||||
<el-select v-model="out" filterable placeholder="请选择" style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="决策结果" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
</outcontent>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import version from '@/components/common/Version.vue'
|
||||
import outcontent from '@/components/models/outcontent.vue'
|
||||
import recursion from './recursion.vue'
|
||||
import topRecursion from './topRecursion.vue'
|
||||
import textInput from '../textInput.vue'
|
||||
import bus from './bus.js'
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
version,
|
||||
outcontent,
|
||||
topRecursion,
|
||||
recursion,
|
||||
textInput,
|
||||
bus
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
nameId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
num: 0,
|
||||
addVersionStatus: false,
|
||||
addVersionLoading: false,
|
||||
addVersionDialog: false,
|
||||
tempadd: {},
|
||||
out: '',
|
||||
"outcontent": [],
|
||||
SpecialField: {
|
||||
score: '',
|
||||
ruleAudit: 5,
|
||||
lastLogical: '-1'
|
||||
},
|
||||
loading: false,
|
||||
priority: '',
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
leftDetailVo: null,
|
||||
topDetailVo: null,
|
||||
resultList: null,
|
||||
width: '200px',
|
||||
leftLast: [],
|
||||
leftLastobj: [],
|
||||
topLast: [],
|
||||
TopLastobj: [],
|
||||
parentId: '',
|
||||
decisionTablesVersionList: [],
|
||||
version: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getData.getVersion(this.id).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.code = res.data.code
|
||||
this.name = res.data.name
|
||||
this.priority = res.data.priority
|
||||
this.description = res.data.description
|
||||
this.parentId = res.data.parentId
|
||||
// 版本部分
|
||||
this.decisionTablesVersionList = res.data.decisionTablesVersionList
|
||||
this.version = JSON.parse(JSON.stringify(this.decisionTablesVersionList[0]))
|
||||
|
||||
this.getDecCont()
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
this.leftDetailVo = [{
|
||||
"fieldId": '',
|
||||
"fieldEn": [],
|
||||
"logical": "&&",
|
||||
// "type": 2,
|
||||
"indexValue": 0,
|
||||
"valueType": null,
|
||||
"conditionList": [{
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
variableType: 1
|
||||
}],
|
||||
"children": [],
|
||||
random: Math.random()
|
||||
}]
|
||||
this.topDetailVo = [{
|
||||
"fieldId": '',
|
||||
"fieldEn": [],
|
||||
"logical": "&&",
|
||||
// "type": 2,
|
||||
"indexValue": 0,
|
||||
"valueType": null,
|
||||
"conditionList": [{
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
variableType: 1
|
||||
}],
|
||||
"children": [],
|
||||
random: Math.random()
|
||||
}]
|
||||
this.resultList = [
|
||||
[0]
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
if (!this.$store.state.FieldUser) {
|
||||
return []
|
||||
} else {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
bus.$on('reCount', (e) => {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.left) {
|
||||
this.width = this.$refs.left.$el.clientWidth + 'px'
|
||||
}
|
||||
if (e == 'addLeft') {
|
||||
this.addLeft()
|
||||
} else if (e == 'addTop') {
|
||||
this.addTop()
|
||||
} else if (e == 'delectLeft') {
|
||||
this.delectLeft()
|
||||
} else if (e == 'delectTop') {
|
||||
this.delectTop()
|
||||
} else if (e.type == 'copyTop') {
|
||||
this.copyTop(e.data)
|
||||
} else if (e.type == 'copyLeft') {
|
||||
this.copyLeft(e.data)
|
||||
}
|
||||
})
|
||||
})
|
||||
this.getLast()
|
||||
},
|
||||
methods: {
|
||||
versionChange(e) {
|
||||
this.version = JSON.parse(JSON.stringify(e))
|
||||
this.getDecCont()
|
||||
},
|
||||
addVersionExamine() {
|
||||
if (this.examine()) {
|
||||
return
|
||||
}
|
||||
this.addVersionDialog = true
|
||||
},
|
||||
addVersionSure(tempVersion) {
|
||||
this.Enformat(this.leftDetailVo,'String')
|
||||
this.Enformat(this.topDetailVo,'String')
|
||||
this.addVersionLoading = true
|
||||
let obj = {
|
||||
decisionTablesId: this.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description,
|
||||
resultFieldEn: this.out,
|
||||
strategyOutputList: this.outcontent,
|
||||
leftDetailVo: this.leftDetailVo,
|
||||
topDetailVo: this.topDetailVo,
|
||||
resultSet: {
|
||||
resultList: this.resultList,
|
||||
columns: this.resultList[0].length,
|
||||
rows: this.resultList.length,
|
||||
}
|
||||
}
|
||||
this.getData.addVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '添加版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.decisionTablesVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.decisionTablesVersionList[0]))
|
||||
this.getDecCont()
|
||||
}
|
||||
this.addVersionStatus = false
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
updateVersion(tempVersion) {
|
||||
if (this.examine()) {
|
||||
return
|
||||
}
|
||||
this.Enformat(this.leftDetailVo,'String')
|
||||
this.Enformat(this.topDetailVo,'String')
|
||||
this.addVersionLoading = true
|
||||
let obj = {
|
||||
decisionTablesId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description,
|
||||
resultFieldEn: this.out,
|
||||
strategyOutputList: this.outcontent,
|
||||
leftDetailVo: this.leftDetailVo,
|
||||
topDetailVo: this.topDetailVo,
|
||||
resultSet: {
|
||||
resultList: this.resultList,
|
||||
columns: this.resultList[0].length,
|
||||
rows: this.resultList.length,
|
||||
}
|
||||
|
||||
}
|
||||
this.getData.updateVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '版本重命名成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.decisionTablesVersionList = res.data
|
||||
|
||||
this.version = JSON.parse(JSON.stringify(this.decisionTablesVersionList[0]))
|
||||
this.getDecCont()
|
||||
|
||||
}
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
delectVersion() {
|
||||
this.getData.delectVersion({
|
||||
status: -1,
|
||||
ids: [this.version.id],
|
||||
strategyId: this.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.decisionTablesVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.decisionTablesVersionList[0]))
|
||||
this.getDecCont()
|
||||
}
|
||||
})
|
||||
},
|
||||
copyVersion(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
this.getData.copyVersion({
|
||||
decisionTablesId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description
|
||||
}).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '复制版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.decisionTablesVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.decisionTablesVersionList[0]))
|
||||
this.getDecCont()
|
||||
|
||||
}
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
addVersionClose() {
|
||||
|
||||
this.out = this.tempadd.out
|
||||
this.outcontent = this.tempadd.outcontent
|
||||
this.leftDetailVo = this.tempadd.leftDetailVo
|
||||
this.topDetailVo = this.tempadd.topDetailVo
|
||||
this.resultList = this.tempadd.resultList
|
||||
this.getLast()
|
||||
this.$nextTick(() => {
|
||||
this.width = this.$refs.left.$el.clientWidth + 'px'
|
||||
})
|
||||
},
|
||||
addVersion() {
|
||||
this.tempadd = {
|
||||
out: this.out,
|
||||
outcontent: this.outcontent,
|
||||
leftDetailVo: this.leftDetailVo,
|
||||
topDetailVo: this.topDetailVo,
|
||||
resultList: this.resultList,
|
||||
}
|
||||
|
||||
this.reset()
|
||||
this.getLast()
|
||||
this.$nextTick(() => {
|
||||
this.width = this.$refs.left.$el.clientWidth + 'px'
|
||||
})
|
||||
},
|
||||
getDecCont() {
|
||||
this.loading = true
|
||||
this.getData.getInfo(this.version.id).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.num++
|
||||
this.out = res.data.resultFieldEn
|
||||
this.outcontent = res.data.strategyOutputList
|
||||
// console.log(this.outcontent)
|
||||
// this.$set(this.outcontent,res.data.strategyOutputList)
|
||||
this.leftDetailVo = res.data.leftDetailVo
|
||||
this.topDetailVo = res.data.topDetailVo
|
||||
this.resultList = res.data.resultSet.resultList
|
||||
|
||||
this.Enformat(this.leftDetailVo,'Array')
|
||||
this.Enformat(this.topDetailVo,'Array')
|
||||
|
||||
setTimeout(() => {
|
||||
this.width = this.$refs.left.$el.clientWidth + 'px'
|
||||
}, 10)
|
||||
this.getLast()
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.out = ''
|
||||
this.outcontent = []
|
||||
this.leftDetailVo = [{
|
||||
"fieldId": '',
|
||||
"fieldEn": [],
|
||||
"logical": "&&",
|
||||
// "type": 2,
|
||||
"indexValue": 0,
|
||||
"valueType": null,
|
||||
"conditionList": [{
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
variableType: 1
|
||||
}],
|
||||
"children": [],
|
||||
random: Math.random()
|
||||
}]
|
||||
this.topDetailVo = [{
|
||||
"fieldId": '',
|
||||
"fieldEn": [],
|
||||
"logical": "&&",
|
||||
// "type": 2,
|
||||
"indexValue": 0,
|
||||
"valueType": null,
|
||||
"conditionList": [{
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
variableType: 1
|
||||
}],
|
||||
"children": [],
|
||||
random: Math.random()
|
||||
}]
|
||||
this.resultList = [
|
||||
[0]
|
||||
]
|
||||
},
|
||||
examine() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.code.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return true
|
||||
}
|
||||
if(this.verificationCode(this.code)||this.verificationName(this.name)){
|
||||
return true
|
||||
}
|
||||
if (this.code.trim() == '') {
|
||||
this.$message.error('请填入决策表代码,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.name.trim() == '') {
|
||||
this.$message.error('请填入决策表名称,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.description.trim() == '') {
|
||||
this.$message.error('请填入决策表描述,并检查空格');
|
||||
return true
|
||||
}
|
||||
let is = {
|
||||
is: false,
|
||||
msg: '提交失败,请检查是否有未填项'
|
||||
}
|
||||
this.getIsempty(is, this.leftDetailVo)
|
||||
this.getIsempty(is, this.topDetailVo)
|
||||
this.outcontent.forEach(value => {
|
||||
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType === "") {
|
||||
is.is = true
|
||||
is.msg = '请检查自定义输出部分是否有未填项'
|
||||
}
|
||||
if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value.fieldValue).formula.trim() ===
|
||||
'')) {
|
||||
is.is = true
|
||||
is.msg = '请检查自定义输出部分是否有未填项'
|
||||
}
|
||||
})
|
||||
if (is.is) {
|
||||
this.$message.error(is.msg)
|
||||
return true
|
||||
}
|
||||
|
||||
this.leftLastobj = []
|
||||
this.TopLastobj = []
|
||||
this.getLastObj(this.leftLastobj, this.leftDetailVo, true)
|
||||
this.getLastObj(this.TopLastobj, this.topDetailVo, true)
|
||||
this.leftLastobj.forEach((value, index) => {
|
||||
value.indexValue = index
|
||||
value.type=2
|
||||
})
|
||||
this.TopLastobj.forEach((value, index) => {
|
||||
value.indexValue = index
|
||||
value.type=2
|
||||
})
|
||||
let is2 = false
|
||||
this.resultList.forEach(value => {
|
||||
value.forEach(item => {
|
||||
if (String(item).trim() === "") {
|
||||
is2 = true
|
||||
}
|
||||
})
|
||||
})
|
||||
if (is2) {
|
||||
this.$message.error('得分不能为空')
|
||||
return true
|
||||
}
|
||||
},
|
||||
getLast() {
|
||||
this.leftLastobj = []
|
||||
this.TopLastobj = []
|
||||
this.getleftLast().then(res => {
|
||||
this.leftLast = res
|
||||
})
|
||||
this.gettopLast().then(res => {
|
||||
this.topLast = res
|
||||
})
|
||||
this.getLastObj(this.leftLastobj, this.leftDetailVo)
|
||||
this.getLastObj(this.TopLastobj, this.topDetailVo)
|
||||
},
|
||||
input(e, index, inde) {
|
||||
this.resultList[index][inde] = e
|
||||
},
|
||||
copyTop(data) {
|
||||
let arr = [] //总对象
|
||||
let copearr = [] // 插入的索引
|
||||
let datalist = [] // 取出的对象
|
||||
let datalistarr = [] // 取出的对象 在总对象索引
|
||||
let temparr = [] //临时储存即将插入的内容
|
||||
this.getLastObj(arr, this.topDetailVo)
|
||||
arr.forEach((value, index) => {
|
||||
let is = true
|
||||
this.TopLastobj.forEach(item => {
|
||||
if (item == value) {
|
||||
is = false
|
||||
}
|
||||
|
||||
})
|
||||
if (is) {
|
||||
copearr.push(index)
|
||||
}
|
||||
})
|
||||
this.getLastObj(datalist, [data])
|
||||
datalist.forEach(value => {
|
||||
arr.forEach((item, index) => {
|
||||
if (item == value) {
|
||||
datalistarr.push(index)
|
||||
}
|
||||
})
|
||||
})
|
||||
this.resultList.forEach(item => {
|
||||
copearr.forEach((value, index) => {
|
||||
item.splice(value, 0, item[datalistarr[index]])
|
||||
})
|
||||
})
|
||||
this.TopLastobj = arr
|
||||
|
||||
this.getLast()
|
||||
},
|
||||
copyLeft(data) {
|
||||
let arr = [] //总对象
|
||||
let copearr = [] // 插入的索引
|
||||
let datalist = [] // 取出的对象
|
||||
let datalistarr = [] // 取出的对象 在总对象索引
|
||||
let temparr = [] //临时储存即将插入的内容
|
||||
this.getLastObj(arr, this.leftDetailVo)
|
||||
arr.forEach((value, index) => {
|
||||
let is = true
|
||||
this.leftLastobj.forEach(item => {
|
||||
if (item == value) {
|
||||
is = false
|
||||
}
|
||||
})
|
||||
if (is) {
|
||||
copearr.push(index)
|
||||
}
|
||||
})
|
||||
this.getLastObj(datalist, [data])
|
||||
datalist.forEach(value => {
|
||||
arr.forEach((item, index) => {
|
||||
if (item == value) {
|
||||
datalistarr.push(index)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
console.log(copearr, datalistarr)
|
||||
|
||||
|
||||
datalistarr.forEach(value => {
|
||||
temparr.push(this.resultList[value])
|
||||
})
|
||||
this.resultList.splice(copearr[0], 0, ...JSON.parse(JSON.stringify(temparr)))
|
||||
this.leftLastobj = arr
|
||||
this.getLast()
|
||||
},
|
||||
delectTop() {
|
||||
let arr = []
|
||||
let delectarr = []
|
||||
this.getLastObj(arr, this.topDetailVo)
|
||||
if (arr.length == this.TopLastobj.length) {
|
||||
this.TopLastobj = arr;
|
||||
this.getLast()
|
||||
return
|
||||
}
|
||||
|
||||
this.TopLastobj.forEach((value, index) => {
|
||||
let is = true
|
||||
arr.forEach(item => {
|
||||
if (item == value) {
|
||||
is = false
|
||||
}
|
||||
|
||||
})
|
||||
if (is) {
|
||||
delectarr.push(index)
|
||||
}
|
||||
})
|
||||
console.log(this.TopLastobj, arr, delectarr)
|
||||
this.TopLastobj = arr
|
||||
|
||||
delectarr.forEach(value => {
|
||||
this.resultList.forEach(item => {
|
||||
item[value] = null
|
||||
})
|
||||
})
|
||||
this.resultList = this.resultList.map(value => {
|
||||
let arr = value.filter((item) => {
|
||||
return item !== null
|
||||
})
|
||||
return arr
|
||||
})
|
||||
this.getLast()
|
||||
},
|
||||
delectLeft() {
|
||||
let arr = []
|
||||
let delectarr = []
|
||||
this.getLastObj(arr, this.leftDetailVo)
|
||||
if (arr.length == this.leftLastobj.length) {
|
||||
this.leftLastobj = arr;
|
||||
this.getLast()
|
||||
return
|
||||
}
|
||||
this.leftLastobj.forEach((value, index) => {
|
||||
let is = true
|
||||
arr.forEach(item => {
|
||||
if (item == value) {
|
||||
is = false
|
||||
}
|
||||
})
|
||||
if (is) {
|
||||
delectarr.push(index)
|
||||
}
|
||||
})
|
||||
this.leftLastobj = arr
|
||||
|
||||
|
||||
delectarr.forEach(value => {
|
||||
delete this.resultList[value]
|
||||
})
|
||||
this.resultList = this.resultList.filter(value => {
|
||||
return value
|
||||
})
|
||||
this.getLast()
|
||||
},
|
||||
addTop() {
|
||||
this.gettopLast().then(res => {
|
||||
this.TopLastobj = []
|
||||
this.getLast()
|
||||
if (res.length == this.topLast.length) {
|
||||
this.topLast = res
|
||||
return
|
||||
}
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
if (this.topLast[i] != res[i]) {
|
||||
|
||||
this.resultList.forEach(value => {
|
||||
value.splice(i, 0, 0)
|
||||
})
|
||||
// console.log(this.topLast , res)
|
||||
this.topLast = res
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
},
|
||||
addLeft() {
|
||||
this.getleftLast().then(res => {
|
||||
this.leftLastobj = []
|
||||
this.getLast()
|
||||
|
||||
|
||||
if (res.length == this.leftLast.length) {
|
||||
this.leftLast = res
|
||||
return
|
||||
}
|
||||
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
if (this.leftLast[i] != res[i]) {
|
||||
this.gettopLast().then(res => {
|
||||
let arr = []
|
||||
res.forEach(value => {
|
||||
arr.push(0)
|
||||
})
|
||||
this.resultList.splice(i, 0, arr)
|
||||
})
|
||||
this.leftLast = res
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
getLastObj(arr, obj, type = false) {
|
||||
if (!Array.isArray(obj)) {
|
||||
return
|
||||
}
|
||||
obj.forEach(value => {
|
||||
if (type) {
|
||||
value.valueType = this.mixinGetvalueType(value.fieldId)
|
||||
}
|
||||
if (value.children.length > 0) {
|
||||
this.getLastObj(arr, value.children, type)
|
||||
} else {
|
||||
arr.push(value)
|
||||
}
|
||||
})
|
||||
},
|
||||
async getleftLast() {
|
||||
let arr = []
|
||||
await this.$nextTick(() => {
|
||||
arr = document.querySelectorAll('.leftlast')
|
||||
})
|
||||
return arr
|
||||
},
|
||||
async gettopLast() {
|
||||
let arr = []
|
||||
await this.$nextTick(() => {
|
||||
arr = document.querySelectorAll('.toplast')
|
||||
})
|
||||
return arr
|
||||
},
|
||||
getIsempty(is, obj) {
|
||||
console.log(obj)
|
||||
if(obj.length==1&&obj[0].children.length==0&&(obj[0].fieldId==''||obj[0].fieldId==null)){
|
||||
return
|
||||
}
|
||||
obj.forEach(value => {
|
||||
if(value.indexValue != undefined){
|
||||
delete value.indexValue
|
||||
}
|
||||
value.type = 1
|
||||
value.conditionList.forEach(value => {
|
||||
if (!value.operator || (!value.fieldValue && value.fieldValue !== 0)) {
|
||||
is.is = true
|
||||
is.msg = "请检查是否有指标的条件未填写"
|
||||
}
|
||||
})
|
||||
if (!value.fieldId) {
|
||||
is.is = true
|
||||
is.msg = "请检查是否有指标未选"
|
||||
}
|
||||
if (value.children.length > 0) {
|
||||
this.getIsempty(is, value.children)
|
||||
}
|
||||
})
|
||||
},
|
||||
Enformat(arr,str){
|
||||
arr.forEach(value=>{
|
||||
if(str=='String'){
|
||||
if(Array.isArray(value.fieldEn)){ //兼容老数据
|
||||
value.fieldEn=value.fieldEn.join('.')
|
||||
}
|
||||
}else if(str=='Array'){
|
||||
value.fieldEn=value.fieldEn.split('.')
|
||||
}
|
||||
|
||||
if (value.children.length > 0) {
|
||||
this.Enformat(value.children,str)
|
||||
}
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
this.loading = true
|
||||
if (this.examine()) {
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
this.Enformat(this.leftDetailVo,'String')
|
||||
this.Enformat(this.topDetailVo,'String')
|
||||
|
||||
let obj = {
|
||||
"code": this.code.trim(),
|
||||
"name": this.name.trim(),
|
||||
"description": String(this.description).trim(),
|
||||
decisionTablesVersionList: [{
|
||||
resultFieldEn: this.out,
|
||||
strategyOutputList: this.outcontent,
|
||||
leftDetailVo: this.leftDetailVo,
|
||||
topDetailVo: this.topDetailVo,
|
||||
resultSet: {
|
||||
resultList: this.resultList,
|
||||
columns: this.resultList[0].length,
|
||||
rows: this.resultList.length,
|
||||
}
|
||||
}]
|
||||
|
||||
}
|
||||
if (this.id == 0) {
|
||||
|
||||
obj.decisionTablesVersionList[0].versionCode = 'V:0'
|
||||
obj.decisionTablesVersionList[0].description = '初始版本'
|
||||
obj.parentId = this.nameId == 99999999 ? 0 : this.nameId,
|
||||
this.getData.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.parentId = this.parentId
|
||||
obj.decisionTablesVersionList[0].id = this.version.id
|
||||
obj.decisionTablesVersionList[0].decisionTablesId = this.id
|
||||
|
||||
this.getData.updatafield(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
// this.$emit('Ok')
|
||||
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(obj)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
computed: {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
385
h5-enginex-manager/src/components/common/decision/recursion.vue
Normal file
385
h5-enginex-manager/src/components/common/decision/recursion.vue
Normal file
@@ -0,0 +1,385 @@
|
||||
<style>
|
||||
.SCO_defen {
|
||||
position: absolute;
|
||||
right: -200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 200px;
|
||||
height: 50px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
border-right: 1px solid #ddd;
|
||||
/* margin-top: 1px; */
|
||||
}
|
||||
|
||||
.el-dropdown-link {
|
||||
cursor: pointer;
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.el-icon-arrow-down {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.demonstration {
|
||||
display: block;
|
||||
color: #8492a6;
|
||||
font-size: 14px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.recursion_cont {
|
||||
overflow: hidden;
|
||||
/* margin-left: 5px; */
|
||||
/* margin-top: 5px; */
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
.recursion_cont:hover {
|
||||
overflow: unset;
|
||||
|
||||
}
|
||||
|
||||
.dec_condition_ListHome {
|
||||
overflow: scroll;
|
||||
/* background-color: #000000; */
|
||||
border-left: 1px dashed #ddd;
|
||||
}
|
||||
|
||||
.dec_condition_ListHome::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.left:hover {
|
||||
background-color: #ddd;
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.recursion_for {
|
||||
flex-direction: row;
|
||||
display: flex;
|
||||
border: 1px solid #ddd;
|
||||
border-right: 0;
|
||||
border-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div :style="{width: '',display:'block',flexGrow:tier==-1?0:1}" class="recursion">
|
||||
<div v-for="(item,index) in data" :key="item.random" class="recursion_for"
|
||||
:style="{borderBottom:tier==-1&&index==data.length-1?'1px solid #ddd':'',marginTop:item.children.length>=1||item.children.length===0||index==0||tier==-1?'-1px':'',minWidth:item.children.length>0?'':'200px',height:item.children.length===0?'81px':''}">
|
||||
<div class="recursion_cont">
|
||||
<div style="margin-left: 20px;width: 175px;"
|
||||
:class="item.children.length===0?'left leftlast '+Math.random():'left'" @click="openCompile(index)">
|
||||
<span
|
||||
style="font-size: 12px;">{{mixinGetvalueCn(item.fieldId)?mixinGetvalueCn(item.fieldId):'请选择指标'}}</span>
|
||||
<div style="display: flex;">
|
||||
<p>
|
||||
<span style="font-size: 14px;">{{item.logical?mixinGetLogical(item.logical):'AND'}}</span>
|
||||
</p>
|
||||
<div :style="{maxHeight:item.children.length>0?60*item.children.length+'px':'45px'}"
|
||||
class="dec_condition_ListHome">
|
||||
<div v-for="(value,inde) in item.conditionList" style="display: flex;align-items: center;">
|
||||
<span
|
||||
style="margin-left: 10px;margin-right: 5px;font-size: 14px;">{{value.operator=='contains'?'包含':value.operator=='not contains'?'不包含':value.operator}}</span>
|
||||
<span
|
||||
style="font-size: 14px;">{{value.variableType==2?mixinGetCnByEn(value.fieldValue):value.variableType==3?JSON.parse(value.fieldValue).formula:value.fieldValue}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="position: absolute;left: 0;top: 0;font-size: 12px;color: #409EFF;">
|
||||
<el-dropdown @command="handleCommand" trigger="click">
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-s-operation"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<!-- <el-dropdown-item icon="el-icon-finished" :command="'addRule|'+index">添加规则</el-dropdown-item> -->
|
||||
<el-dropdown-item icon="el-icon-bottom" :command="'addBrother|'+index">向下添加
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-right" :command="'addSon|'+index"
|
||||
v-show="!item.children.length">向右添加</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-close" :command="'delect|'+index"
|
||||
v-show="tier!=-1||index!=0">删除此字段</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-document-copy" :command="'copy|'+index">复制此字段
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<recursion v-if="item.children.length>0" :data="item.children" :tier="tier+1" :direction="direction">
|
||||
</recursion>
|
||||
|
||||
</div>
|
||||
|
||||
<el-dialog title="编辑" v-if="dialogVisible" :visible.sync="dialogVisible" width="50%" :before-close="handleClose"
|
||||
:close-on-click-modal="false">
|
||||
|
||||
<!-- <el-select v-model="tempData.fieldId" filterable @change="tempData.fieldEn = mixinGetvalueEn($event);fieldChange(tempData)">
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.id">
|
||||
</el-option>
|
||||
</el-select> -->
|
||||
<el-cascader v-model="tempData.fieldEn" filterable :options="fieldUserObj" clearable
|
||||
@change="fieldChange(tempData)" :props="{ expandTrigger: 'hover' }">
|
||||
</el-cascader>
|
||||
|
||||
<div style="display: flex;margin-top: 10px;">
|
||||
<el-select v-model="tempData.logical" placeholder="请选择关系符">
|
||||
<el-option :key="1" label="AND" value="&&"></el-option>
|
||||
<el-option :key="2" label="OR" value="||"></el-option>
|
||||
</el-select>
|
||||
|
||||
<div style="border-left: 1px dashed #ddd;margin-left: 10px;">
|
||||
<div v-for="(value,index) in tempData.conditionList"
|
||||
style="width: 500px;display: flex;margin-top: 10px;justify-content: flex-start;">
|
||||
<ruleRelation style="width: 120px;" v-model="value.operator" :openValue2="false"
|
||||
:valueType="tempData.valueType" :type="2" size="mini" :andTextInput="true"></ruleRelation>
|
||||
<varialeSelect v-model="value.fieldValue" :variableType.sync="value.variableType"
|
||||
:valueType="tempData.valueType" style="margin-left: 20px;" height="28px"></varialeSelect>
|
||||
|
||||
<i class="el-icon-circle-plus-outline" style="font-size: 20px;color: #409EFF;"
|
||||
@click="addRule(index)"></i>
|
||||
<i class="el-icon-circle-close" :style="{fontSize: '20px',color:index===0?'#ddd':'#F56C6C'}"
|
||||
@click="delectRule(index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogRe">清空并关闭</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogSule">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import textInput from '@/components/common/textInput.vue'
|
||||
import textSelect from '@/components/common/textSelect.vue'
|
||||
import bus from './bus.js'
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tempData: {},
|
||||
tempIndex: ''
|
||||
}
|
||||
},
|
||||
components: {
|
||||
varialeSelect,
|
||||
textInput,
|
||||
textSelect,
|
||||
ruleRelation
|
||||
},
|
||||
name: 'recursion',
|
||||
props: {
|
||||
direction: {
|
||||
type: String,
|
||||
default () {
|
||||
return 'com'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
tier: {
|
||||
type: Number,
|
||||
default: -1
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.data.forEach(value => {
|
||||
if (value.coefficient == null) {
|
||||
value.coefficient = 0
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
dialogRe() {
|
||||
|
||||
this.$set(this.data, this.tempIndex, {
|
||||
"fieldId": '',
|
||||
"fieldEn": [],
|
||||
"logical": "&&",
|
||||
// "type": this.tempData.type,
|
||||
"indexValue": this.tempData.indexValue,
|
||||
"valueType": null,
|
||||
"conditionList": [{
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
variableType: 1
|
||||
}],
|
||||
"children": this.tempData.children,
|
||||
"random": this.tempData.random
|
||||
})
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
dialogSule() {
|
||||
let is = false
|
||||
this.tempData.conditionList.forEach(value => {
|
||||
if (value.operator == "" || String(value.fieldValue).trim() === "") {
|
||||
|
||||
is = true
|
||||
}
|
||||
if (value.variableType == 3 && (value.fieldValue === "" || JSON.parse(value.fieldValue)
|
||||
.formula === "")) {
|
||||
is = true
|
||||
}
|
||||
})
|
||||
|
||||
if (is) {
|
||||
this.$message.error('比较符和值不允许为空')
|
||||
return
|
||||
}
|
||||
// bus.$emit('lookrodem')
|
||||
for (let i in this.tempData) {
|
||||
this.data[this.tempIndex][i] = this.tempData[i]
|
||||
}
|
||||
this.dialogVisible = false;
|
||||
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done();
|
||||
})
|
||||
},
|
||||
openCompile(index) {
|
||||
this.tempIndex = index
|
||||
for (let i in this.data[index]) {
|
||||
if (typeof this.data[index][i] == 'object' && this.data[index][i] != null && i != 'children') {
|
||||
this.$set(this.tempData, i, JSON.parse(JSON.stringify(this.data[index][i])))
|
||||
} else {
|
||||
this.$set(this.tempData, i, this.data[index][i])
|
||||
}
|
||||
}
|
||||
if (this.tempData.conditionList.length == 0) {
|
||||
this.tempData.conditionList.push({
|
||||
operator: '',
|
||||
fieldValue: '',
|
||||
variableType: 1
|
||||
})
|
||||
}
|
||||
this.dialogVisible = true
|
||||
},
|
||||
fieldChange(item) {
|
||||
|
||||
|
||||
item.fieldId = this.mixinGetIdByEn(item.fieldEn[0])
|
||||
item.valueType = this.mixinGetValueTypeByJSONEn(item.fieldEn)
|
||||
console.log(item)
|
||||
item.conditionList.forEach(value => {
|
||||
value.operator = ""
|
||||
})
|
||||
},
|
||||
delectRule(index) {
|
||||
if (index == 0) {
|
||||
return
|
||||
}
|
||||
this.tempData.conditionList.splice(index, 1)
|
||||
},
|
||||
handleCommand(str) {
|
||||
switch (str.split('|')[0]) {
|
||||
case 'addBrother':
|
||||
this.addBrother(str.split('|')[1])
|
||||
break;
|
||||
case 'delect':
|
||||
this.delect(str.split('|')[1])
|
||||
break;
|
||||
case 'addSon':
|
||||
this.addSon(str.split('|')[1])
|
||||
break;
|
||||
case 'copy':
|
||||
this.copy(str.split('|')[1])
|
||||
break;
|
||||
case 'addRule':
|
||||
this.addRule(str.split('|')[1])
|
||||
break;
|
||||
}
|
||||
},
|
||||
addRule(index) {
|
||||
this.tempData.conditionList.splice(index + 1, 0, {
|
||||
operator: '',
|
||||
fieldValue: '',
|
||||
variableType: 1
|
||||
})
|
||||
},
|
||||
addSon(index) {
|
||||
this.data[index].children.push({
|
||||
condition: '',
|
||||
children: [],
|
||||
fieldId: '',
|
||||
fieldEn: [],
|
||||
logical: '&&',
|
||||
id: null,
|
||||
score: 1,
|
||||
coefficient: null,
|
||||
calculateType: 1,
|
||||
conditionList: [{
|
||||
operator: '',
|
||||
variableType: 1,
|
||||
fieldValue: '',
|
||||
}],
|
||||
random: Math.random()
|
||||
})
|
||||
bus.$emit('reCount', 'addLeft')
|
||||
},
|
||||
delect(index) {
|
||||
this.data.splice(index, 1)
|
||||
bus.$emit('reCount', 'delectLeft')
|
||||
},
|
||||
addBrother(index) {
|
||||
this.data.splice(Number(index) + 1, 0, {
|
||||
conditionList: [{
|
||||
operator: '',
|
||||
variableType: 1,
|
||||
fieldValue: '',
|
||||
}],
|
||||
fieldId: '',
|
||||
fieldEn: [],
|
||||
children: [],
|
||||
id: null,
|
||||
logical: '&&',
|
||||
parentId: this.data[0].parentId,
|
||||
random: Math.random()
|
||||
})
|
||||
bus.$emit('reCount', 'addLeft')
|
||||
bus.$emit('look')
|
||||
},
|
||||
copy(index) {
|
||||
console.log(index)
|
||||
let obj = JSON.parse(JSON.stringify(this.data[index]))
|
||||
obj.id = null
|
||||
obj.random = Math.random()
|
||||
this.data.splice(Number(index) + 1, 0, obj)
|
||||
bus.$emit('reCount', {
|
||||
type: 'copyLeft',
|
||||
data: this.data[index]
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
computed: {
|
||||
fieldUserObj() {
|
||||
if (this.$store.state.FieldUserObj) {
|
||||
return this.$store.state.FieldUserObj.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
width() {
|
||||
console.log(this.data)
|
||||
return 1
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,389 @@
|
||||
<style>
|
||||
.SCO_defen {
|
||||
position: absolute;
|
||||
right: -200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 200px;
|
||||
height: 50px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
border-right: 1px solid #ddd;
|
||||
/* margin-top: 1px; */
|
||||
}
|
||||
|
||||
.el-dropdown-link {
|
||||
cursor: pointer;
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.el-icon-arrow-down {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.demonstration {
|
||||
display: block;
|
||||
color: #8492a6;
|
||||
font-size: 14px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.recursion_cont {
|
||||
overflow: hidden;
|
||||
padding-left: 5px;
|
||||
padding-top: 5px;
|
||||
/* box-sizing: border-box; */
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
.recursion_cont:hover {
|
||||
overflow: unset;
|
||||
|
||||
}
|
||||
|
||||
.top:hover {
|
||||
background-color: #ddd;
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.Toprecusion_for {
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
/* margin-left:-1px; */
|
||||
display: flex;
|
||||
border: 1px solid #ddd;
|
||||
border-bottom: 0;
|
||||
border-right: 0;
|
||||
min-height: 80px;
|
||||
flex-shrink: 1;
|
||||
/* borderRight:tier==-1?'1px solid #ddd':'', */
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div :style="{width: '',display:'flex',flexGrow:1}">
|
||||
|
||||
<div v-for="(item,index) in data" :key="item.random" class="Toprecusion_for"
|
||||
:style="{borderRight:tier==-1&&index==data.length-1?'1px solid #ddd':'',marginLeft:tier==-1&&index==0?'':'-1px',marginTop:'-1px',width:item.children.length>0?'':'200px'}">
|
||||
|
||||
<div :style="{'borderBottom':'1px solid #ddd',flexGrow:item.children.length>0?0:1,height:item.children.length>=1?'80px':''}"
|
||||
class="recursion_cont">
|
||||
<div style="margin-left: 20px;width: 175px;"
|
||||
:class="item.children.length==0?'top toplast '+Math.random():'top' " @click="openCompile(index)">
|
||||
<span
|
||||
style="font-size: 12px;">{{mixinGetvalueCn(item.fieldId)?mixinGetvalueCn(item.fieldId):'请选择指标'}}</span>
|
||||
<div style="display: flex;">
|
||||
<p style="border-right: 1px dashed #ddd;">
|
||||
|
||||
<span style="font-size: 14px;">{{item.logical?mixinGetLogical(item.logical):'AND'}}</span>
|
||||
</p>
|
||||
<div>
|
||||
|
||||
<div v-for="(value,inde) in item.conditionList" style="display: flex;align-items: center;">
|
||||
<span
|
||||
style="margin-left: 10px;margin-right: 5px;font-size: 14px;">{{value.operator=='contains'?'包含':value.operator=='not contains'?'不包含':value.operator}}</span>
|
||||
<span
|
||||
style="font-size: 14px;">{{value.variableType==2?mixinGetCnByEn(value.fieldValue):value.variableType==3?JSON.parse(value.fieldValue).formula:value.fieldValue}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="position: absolute;left: 0;top: 0;font-size: 12px;color: #409EFF;">
|
||||
<el-dropdown @command="handleCommand" trigger="click">
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-s-operation"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item icon="el-icon-bottom" :command="'addSon|'+index"
|
||||
v-show="!item.children.length">向下添加</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-right" :command="'addBrother|'+index">向右添加
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-close" :command="'delect|'+index"
|
||||
v-show="tier!=-1||index!=0">删除此字段</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-document-copy" :command="'copy|'+index">复制此字段
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<recursion v-if="item.children.length>0" :data="item.children" :tier="tier+1" :direction="direction">
|
||||
</recursion>
|
||||
</div>
|
||||
<el-dialog title="编辑" v-if="dialogVisible" :visible.sync="dialogVisible" width="50%" :before-close="handleClose"
|
||||
:close-on-click-modal="false">
|
||||
|
||||
<!-- <el-select v-model="tempData.fieldId" filterable @change="tempData.fieldEn = mixinGetvalueEn($event);fieldChange(tempData)">
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.id">
|
||||
</el-option>
|
||||
</el-select> -->
|
||||
<el-cascader v-model="tempData.fieldEn" filterable :options="fieldUserObj" clearable
|
||||
@change="fieldChange(tempData)" :props="{ expandTrigger: 'hover' }">
|
||||
</el-cascader>
|
||||
<div style="display: flex;margin-top: 10px;">
|
||||
<el-select v-model="tempData.logical" placeholder="请选择关系符">
|
||||
<el-option :key="1" label="AND" value="&&"></el-option>
|
||||
<el-option :key="2" label="OR" value="||"></el-option>
|
||||
</el-select>
|
||||
<div style="border-left: 1px dashed #ddd;margin-left: 10px;">
|
||||
<div v-for="(value,index) in tempData.conditionList"
|
||||
style="width: 500px;display: flex;margin-top: 10px;justify-content: flex-start;">
|
||||
<ruleRelation style="width:120px;" :openValue2="false" v-model="value.operator"
|
||||
:valueType="tempData.valueType" :type="2" size="mini" :andTextInput="true"></ruleRelation>
|
||||
<varialeSelect v-model="value.fieldValue" :valueType="tempData.valueType"
|
||||
:variableType.sync="value.variableType" style="margin-left: 20px;" height="28px">
|
||||
</varialeSelect>
|
||||
<i class="el-icon-circle-plus-outline" style="font-size: 20px;color: #409EFF;"
|
||||
@click="addRule(index)"></i>
|
||||
<i class="el-icon-circle-close" :style="{fontSize: '20px',color:index===0?'#ddd':'#F56C6C'}"
|
||||
@click="delectRule(index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogRe">清空并关闭</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogSule">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import textInput from '@/components/common/textInput.vue'
|
||||
import textSelect from '@/components/common/textSelect.vue'
|
||||
import bus from './bus.js'
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tempData: {},
|
||||
tempIndex: ''
|
||||
}
|
||||
},
|
||||
components: {
|
||||
textInput,
|
||||
textSelect,
|
||||
ruleRelation,
|
||||
varialeSelect
|
||||
},
|
||||
name: 'recursion',
|
||||
props: {
|
||||
direction: {
|
||||
type: String,
|
||||
default () {
|
||||
return 'com'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
tier: {
|
||||
type: Number,
|
||||
default: -1
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.data.forEach(value => {
|
||||
if (value.coefficient == null) {
|
||||
value.coefficient = 0
|
||||
}
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
dialogRe() {
|
||||
|
||||
this.$set(this.data, this.tempIndex, {
|
||||
"fieldId": '',
|
||||
"fieldEn": [],
|
||||
"logical": "&&",
|
||||
// "type": this.tempData.type,
|
||||
"indexValue": this.tempData.indexValue,
|
||||
"valueType": null,
|
||||
"conditionList": [{
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
variableType: 1
|
||||
}],
|
||||
"children": this.tempData.children,
|
||||
"random": this.tempData.random
|
||||
})
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
dialogSule() {
|
||||
let is = false
|
||||
this.tempData.conditionList.forEach(value => {
|
||||
if (value.operator == "" || String(value.fieldValue).trim() === "") {
|
||||
|
||||
is = true
|
||||
}
|
||||
if (value.variableType == 3 && (value.fieldValue === "" || JSON.parse(value.fieldValue)
|
||||
.formula === "")) {
|
||||
is = true
|
||||
}
|
||||
})
|
||||
|
||||
if (is) {
|
||||
this.$message.error('比较符和值不允许为空')
|
||||
return
|
||||
}
|
||||
// bus.$emit('lookrodem')
|
||||
for (let i in this.tempData) {
|
||||
this.data[this.tempIndex][i] = this.tempData[i]
|
||||
}
|
||||
this.dialogVisible = false;
|
||||
// this.data[this.tempIndex] = this.tempData
|
||||
|
||||
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done();
|
||||
})
|
||||
},
|
||||
openCompile(index) {
|
||||
this.tempIndex = index
|
||||
for (let i in this.data[index]) {
|
||||
if (typeof this.data[index][i] == 'object' && this.data[index][i] != null && i != 'children') {
|
||||
this.$set(this.tempData, i, JSON.parse(JSON.stringify(this.data[index][i])))
|
||||
} else {
|
||||
this.$set(this.tempData, i, this.data[index][i])
|
||||
|
||||
}
|
||||
}
|
||||
if (this.tempData.conditionList.length == 0) {
|
||||
this.tempData.conditionList.push({
|
||||
operator: '',
|
||||
fieldValue: '',
|
||||
variableType: 1
|
||||
})
|
||||
}
|
||||
|
||||
// console.log(this.tempData)
|
||||
// debugger
|
||||
this.dialogVisible = true
|
||||
},
|
||||
|
||||
delectRule(index) {
|
||||
if (index == 0) {
|
||||
return
|
||||
}
|
||||
this.tempData.conditionList.splice(index, 1)
|
||||
},
|
||||
fieldChange(item) {
|
||||
|
||||
|
||||
item.fieldId = this.mixinGetIdByEn(item.fieldEn[0])
|
||||
item.valueType = this.mixinGetValueTypeByJSONEn(item.fieldEn)
|
||||
console.log(item)
|
||||
item.conditionList.forEach(value => {
|
||||
value.operator = ""
|
||||
})
|
||||
},
|
||||
handleCommand(str) {
|
||||
switch (str.split('|')[0]) {
|
||||
case 'addBrother':
|
||||
this.addBrother(str.split('|')[1])
|
||||
break;
|
||||
case 'delect':
|
||||
this.delect(str.split('|')[1])
|
||||
break;
|
||||
case 'addSon':
|
||||
this.addSon(str.split('|')[1])
|
||||
break;
|
||||
case 'copy':
|
||||
this.copy(str.split('|')[1])
|
||||
break;
|
||||
case 'addRule':
|
||||
this.addRule(str.split('|')[1])
|
||||
break;
|
||||
}
|
||||
},
|
||||
addRule(index) {
|
||||
this.tempData.conditionList.splice(index + 1, 0, {
|
||||
operator: '',
|
||||
fieldValue: '',
|
||||
variableType: 1
|
||||
})
|
||||
},
|
||||
addSon(index) {
|
||||
this.data[index].children.push({
|
||||
fieldId: '',
|
||||
condition: '',
|
||||
children: [],
|
||||
fieldEn: [],
|
||||
logical: '&&',
|
||||
id: null,
|
||||
"score": 1,
|
||||
"coefficient": null,
|
||||
"calculateType": 1,
|
||||
conditionList: [{
|
||||
operator: '',
|
||||
variableType: 1,
|
||||
fieldValue: '',
|
||||
}],
|
||||
random: Math.random()
|
||||
})
|
||||
bus.$emit('reCount', 'addTop')
|
||||
},
|
||||
delect(index) {
|
||||
this.data.splice(index, 1)
|
||||
bus.$emit('reCount', 'delectTop')
|
||||
},
|
||||
addBrother(index) {
|
||||
this.data.splice(Number(index) + 1, 0, {
|
||||
conditionList: [{
|
||||
operator: '',
|
||||
variableType: 1,
|
||||
fieldValue: '',
|
||||
}],
|
||||
fieldId: '',
|
||||
children: [],
|
||||
fieldEn: [],
|
||||
id: null,
|
||||
logical: '&&',
|
||||
parentId: this.data[0].parentId,
|
||||
random: Math.random()
|
||||
})
|
||||
bus.$emit('reCount', 'addTop')
|
||||
bus.$emit('look')
|
||||
},
|
||||
copy(index) {
|
||||
console.log(index)
|
||||
let obj = JSON.parse(JSON.stringify(this.data[index]))
|
||||
obj.id = null
|
||||
obj.random = Math.random()
|
||||
this.data.splice(Number(index) + 1, 0, obj)
|
||||
bus.$emit('reCount', {
|
||||
type: 'copyTop',
|
||||
data: this.data[index]
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
computed: {
|
||||
fieldUserObj() {
|
||||
if (this.$store.state.FieldUserObj) {
|
||||
return this.$store.state.FieldUserObj.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
width() {
|
||||
console.log(this.data)
|
||||
return 1
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,234 @@
|
||||
|
||||
<template>
|
||||
<div class="cont_cont">
|
||||
|
||||
<div class="cont_left" v-loading="leftloading" v-if="!listRedact">
|
||||
<div class="cont_header">
|
||||
<p class="cont_header_title">{{title}}</p>
|
||||
<p class="cont_header_subtitle">{{title}}</p>
|
||||
</div>
|
||||
<contNewFule v-model="tempNewF" :newf.sync="newf" @newFileSure="newFileSure" @newFile="newFile" ></contNewFule>
|
||||
|
||||
<div class="cont_list">
|
||||
|
||||
|
||||
<fileHome :data="list" @curr="clickCurrid" :currid="currid" @RenameFun="RenameFun" @RenameClose="RenameClose"
|
||||
@updatafilelist="updatafilelist" @delectFun="delectFun">
|
||||
</fileHome>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cont_right" v-loading="contloading" @click="tempHintLeft=null;tempHintTop=null;" >
|
||||
<div v-if="!listRedact">
|
||||
<div v-if="showRight===false" class="cont_right_hint">
|
||||
请先选择左侧文件夹
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="cont_right_top">
|
||||
<div>
|
||||
<el-button type="primary" @click="listRedact=true" :disabled="currid!=99999999?false:'disabled'">新增</el-button>
|
||||
<el-button type="danger" @click="using(-1);$store.dispatch('regetcache', 'decisionTree')" :disabled="this.selection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button type="success" @click="using(1)" :disabled="this.selection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button type="warning" @click="using(0)" :disabled="this.selection.length>0?false:'disabled'">停用</el-button>
|
||||
<el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'"
|
||||
filterable @change="mixinMoveChange">
|
||||
<el-option v-for="value in listunfold" :key="value.id" :label="value.name" :value="value.id" v-show="value.id!=99999999"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-input placeholder="请输入搜索内容" v-model="search">
|
||||
<i slot="suffix" class="el-input__icon el-icon-search" @click="getsearch"></i>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right_cont">
|
||||
<div v-if="data">
|
||||
<el-table border :data="data.data.klist" @select-all="selectAll" @select="select" style="width: 100%"
|
||||
:cell-style="{padding: '10px'}">
|
||||
<el-table-column type="selection" width="70">
|
||||
</el-table-column>
|
||||
<el-table-column v-for="item in getData.row" :key="item.id" :prop="item.row" :label="item.label" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="item.type==='Blooen'">
|
||||
{{scope.row[item.row]?"是":"否"}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='State'">
|
||||
{{scope.row[item.row]==1?'启用':'未启用'}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='Time'" style="white-space: nowrap;" class="contText">{{
|
||||
new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row[item.row]).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
<span class="contText" v-else>
|
||||
{{scope.row[item.row]}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-button icon="el-icon-setting" circle size="mini" @click="dialogShow(scope.row.id)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="float: right;margin-right: 40px;margin-top: 40px;" :current-page="currPage"
|
||||
@current-change="clickpage" background layout="prev, pager, next" :total="data.data.pageInfo.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="listRedact" style="height: 100%;overflow: hidden;">
|
||||
<dataManageRedact @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist()" :getData="getData"
|
||||
:id='tempRedactId' :nameId="currid" :type="getData.type"></dataManageRedact>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import contNewFule from '@/components/common/contNewFile.vue'
|
||||
import '@/assets/css/cont.css'
|
||||
import fileHome from '@/components/common/fileHome.vue'
|
||||
import dataManageRedact from './decTreeManageRedact.vue'
|
||||
import contmixin from '@/utils/contminxin/contmixin.js'
|
||||
export default {
|
||||
mixins: [
|
||||
contmixin
|
||||
],
|
||||
components: {
|
||||
contNewFule,
|
||||
fileHome,
|
||||
dataManageRedact
|
||||
},
|
||||
created() {
|
||||
this.getData.getTree({
|
||||
parentId: 0,
|
||||
treeType: this.getData.treeType,
|
||||
type: 1
|
||||
}).then(res => {
|
||||
this.list = this.listTreeDeep(res.data, 1)
|
||||
this.clickCurrid(99999999)
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
list() {
|
||||
if (this.list.length > 0) {
|
||||
this.leftloading = false
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
tempMove: '',
|
||||
leftloading: true,
|
||||
search: "",
|
||||
fileName: "",
|
||||
fileList: [],
|
||||
upShow: false,
|
||||
currPage: 1,
|
||||
currid: null,
|
||||
data: null,
|
||||
contloading: false,
|
||||
newf: false,
|
||||
tempNewF: "",
|
||||
listRedact: false, //新增页面开启
|
||||
tempRedactId: 0,
|
||||
selection: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
getsearch() {
|
||||
this.contloading = true
|
||||
let params = {
|
||||
entity: {
|
||||
name: this.search,
|
||||
"folderId": String(this.currid) === "99999999" ? '' : String(this.currid),
|
||||
},
|
||||
key: "ruleName",
|
||||
status: "0,1",
|
||||
|
||||
"pageNum": 1,
|
||||
isSearch: 1
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
this.currPage = 1
|
||||
},
|
||||
|
||||
getlist() {
|
||||
this.contloading = true
|
||||
this.listRedact = false
|
||||
let params = {
|
||||
status: "0,1",
|
||||
entity: {},
|
||||
"pageNum": 1
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.entity.folderId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
|
||||
},
|
||||
clickpage(e) {
|
||||
this.currPage = e
|
||||
this.contloading = true
|
||||
let params = {
|
||||
status: "0,1",
|
||||
entity: {},
|
||||
"pageNum": e
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.entity.folderId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
if (res.status == 1) {
|
||||
this.data = res
|
||||
this.selection = []
|
||||
this.contloading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
newFileSure() {
|
||||
this.leftloading = true
|
||||
let params = {
|
||||
parentId: String(this.currid),
|
||||
name: this.tempNewF,
|
||||
"treeType":this.getData.treeType,
|
||||
"type": "1",
|
||||
"engineId": ""
|
||||
}
|
||||
if(this.mixnewFileZindexVerify(this.list,this.currid)==6){
|
||||
this.$message.error('已达到最深层级')
|
||||
this.leftloading = false
|
||||
return
|
||||
}
|
||||
this.mixnewFileSure(params)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,532 @@
|
||||
<style>
|
||||
|
||||
.dec_top{
|
||||
|
||||
display: flex;
|
||||
}
|
||||
.dec_cont{
|
||||
|
||||
}
|
||||
.dec_table_header{
|
||||
width: 350px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.dec_table_comm{
|
||||
}
|
||||
.dec_score{
|
||||
width: 199px;
|
||||
height: 80px;
|
||||
text-align: center;
|
||||
line-height: 80px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.dec_home{
|
||||
border-top: 1px solid #ddd;
|
||||
overflow: scroll;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
<template>
|
||||
<!-- :style="{width:$store.state.barShrink?'95vw':'85vw'}" -->
|
||||
<div class="dataManageRedact" v-loading="loading" >
|
||||
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="mixinClose"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增决策树 :</span>
|
||||
<span v-else>编辑决策树 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button :icon="smallHeader?'el-icon-bottom':'el-icon-top'" circle @click="openHeader">
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit" :disabled="addVersionStatus"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>决策树代码: </p>
|
||||
<el-input placeholder="请输入决策树代码" maxlength="30" v-model="code" clearable :disabled="addVersionStatus"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>决策树名称:</p>
|
||||
<el-input placeholder="请输入决策树名称" maxlength="20" v-model="name" clearable :disabled="addVersionStatus"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_scope MR_scopeSmall':'MR_scope'">
|
||||
<div>
|
||||
<p>决策树描述: </p>
|
||||
<el-input placeholder="请输入决策描述" maxlength="300" v-model="description" clearable :disabled="addVersionStatus"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<version style="margin:5px;" :id="id" :ruleVersionList="versionList" :version="version" @addVersion="addVersion"
|
||||
@addVersionClose="addVersionClose" @copyVersion="copyVersion" @delectVersion="delectVersion" @updateVersion="updateVersion"
|
||||
@addVersionSure="addVersionSure" :addVersionDialog="addVersionDialog" @Dialog="addVersionDialog=$event"
|
||||
@addVersionExamine="addVersionExamine" :addVersionLoading="addVersionLoading" @versionChange="versionChange"
|
||||
:addVersionStatus="addVersionStatus" @StatusChange="addVersionStatus=$event"></version>
|
||||
<!-- 版本部分 -->
|
||||
|
||||
<div class="dec_home">
|
||||
<tree :treeData="detailList[0]"></tree>
|
||||
<outcontent :outcontent="outcontent" type="decision_tree" style="margin-top: 20px;margin-left: 50px;">
|
||||
<div style="display:flex; align-items: center;">
|
||||
<el-select v-model="out" filterable placeholder="请选择" style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="决策结果" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
</outcontent>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import tree from '@/components/common/decisionTree/tree.vue'
|
||||
import version from '@/components/common/Version.vue'
|
||||
import outcontent from '@/components/models/outcontent.vue'
|
||||
import textInput from '../textInput.vue'
|
||||
export default {
|
||||
mixins:[mangeRedactMixin],
|
||||
components: {
|
||||
tree,
|
||||
version,
|
||||
outcontent,
|
||||
textInput,
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
nameId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
detailList:[],
|
||||
num:0,
|
||||
addVersionStatus: false,
|
||||
addVersionLoading: false,
|
||||
addVersionDialog: false,
|
||||
tempadd: {},
|
||||
out: '',
|
||||
"outcontent": [],
|
||||
loading: false,
|
||||
priority: '',
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
parentId: '',
|
||||
versionList: [],
|
||||
version: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getData.getVersion(this.id).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.code = res.data.code
|
||||
this.name = res.data.name
|
||||
this.priority = res.data.priority
|
||||
this.description = res.data.description
|
||||
this.parentId = res.data.folderId
|
||||
// 版本部分
|
||||
this.versionList = res.data.versionList
|
||||
this.version = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
this.getDecCont()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.detailList = [{
|
||||
nodeType:'', //普通节点为1 最终节点为2
|
||||
variableType:1,
|
||||
resultValue:'',
|
||||
logical:'&&',
|
||||
fieldEn:[],
|
||||
fieldId:'',
|
||||
conditionList:[{
|
||||
variableType:1,
|
||||
operator:'',
|
||||
fieldValue:''
|
||||
}],
|
||||
children:[]
|
||||
}]
|
||||
// 新增初始化
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
if (!this.$store.state.FieldUser) {
|
||||
return []
|
||||
} else {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
versionChange(e) {
|
||||
this.version = JSON.parse(JSON.stringify(e))
|
||||
this.getDecCont()
|
||||
},
|
||||
addVersionExamine() {
|
||||
if (this.examine()) {
|
||||
return
|
||||
}
|
||||
this.addVersionDialog = true
|
||||
},
|
||||
addVersionSure(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
this.Enformat(this.detailList,'String')
|
||||
let obj = {
|
||||
decisionTreeId: this.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description,
|
||||
resultFieldEn: this.out,
|
||||
strategyOutputList: this.outcontent,
|
||||
detailList:this.detailList
|
||||
}
|
||||
this.getData.addVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '添加版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
this.getDecCont()
|
||||
}
|
||||
this.addVersionStatus = false
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
updateVersion(tempVersion) {
|
||||
if (this.examine()) {
|
||||
return
|
||||
}
|
||||
this.addVersionLoading = true
|
||||
|
||||
this.Enformat(this.detailList,'String')
|
||||
let obj = {
|
||||
decisionTreeId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description,
|
||||
resultFieldEn: this.out,
|
||||
strategyOutputList: this.outcontent,
|
||||
detailList:this.detailList
|
||||
|
||||
}
|
||||
this.getData.updateVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '版本重命名成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
this.getDecCont()
|
||||
|
||||
}
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
delectVersion() {
|
||||
this.getData.delectVersion({
|
||||
status: -1,
|
||||
ids: [this.version.id],
|
||||
strategyId: this.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
this.getDecCont()
|
||||
}
|
||||
})
|
||||
},
|
||||
copyVersion(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
this.getData.copyVersion({
|
||||
decisionTreeId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description
|
||||
}).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '复制版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
this.getDecCont()
|
||||
|
||||
}
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
addVersionClose() {
|
||||
this.out = this.tempadd.out
|
||||
this.outcontent = this.tempadd.outcontent
|
||||
this.detailList = this.tempadd.detailList
|
||||
|
||||
},
|
||||
addVersion() {
|
||||
this.tempadd = {
|
||||
out: this.out,
|
||||
outcontent: this.outcontent,
|
||||
detailList: this.detailList,
|
||||
|
||||
}
|
||||
|
||||
this.reset()
|
||||
},
|
||||
getDecCont() {
|
||||
this.loading = true
|
||||
this.getData.getInfo(this.version.id).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.num++
|
||||
this.out = res.data.resultFieldEn
|
||||
this.outcontent = res.data.strategyOutputList
|
||||
this.detailList = res.data.detailList
|
||||
|
||||
this.Enformat(this.detailList,'Array')
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.out = ''
|
||||
this.outcontent = []
|
||||
this.detailList = [{
|
||||
variableType:1,
|
||||
resultValue:'',
|
||||
logical:'&&',
|
||||
fieldEn:[],
|
||||
fieldId:'',
|
||||
conditionList:[{
|
||||
variableType:1,
|
||||
operator:'',
|
||||
fieldValue:''
|
||||
}],
|
||||
children:[]
|
||||
}]
|
||||
},
|
||||
Enformat(arr,str){
|
||||
arr.forEach(value=>{
|
||||
if(str=='String'){
|
||||
if(Array.isArray(value.fieldEn)){ //兼容老数据
|
||||
value.fieldEn=value.fieldEn.join('.')
|
||||
}
|
||||
}else if(str=='Array'){
|
||||
value.fieldEn=value.fieldEn.split('.')
|
||||
}
|
||||
|
||||
if (value.children.length > 0) {
|
||||
this.Enformat(value.children,str)
|
||||
}
|
||||
})
|
||||
},
|
||||
examine() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.code.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return true
|
||||
}
|
||||
if(this.verificationCode(this.code)||this.verificationName(this.name)){
|
||||
return true
|
||||
}
|
||||
if (this.code.trim() == '') {
|
||||
this.$message.error('请填入决策树代码,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.name.trim() == '') {
|
||||
this.$message.error('请填入决策树名称,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.description.trim() == '') {
|
||||
this.$message.error('请填入决策树描述,并检查空格');
|
||||
return true
|
||||
}
|
||||
|
||||
let is = {
|
||||
is: false,
|
||||
msg: '提交失败,请检查是否有未填项'
|
||||
}
|
||||
this.getIsempty(is, this.detailList)
|
||||
this.outcontent.forEach(value => {
|
||||
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType === "") {
|
||||
is.is = true
|
||||
is.msg = '请检查自定义输出部分是否有未填项'
|
||||
}
|
||||
if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value.fieldValue).formula.trim() ===
|
||||
'')) {
|
||||
is.is = true
|
||||
is.msg = '请检查自定义输出部分是否有未填项'
|
||||
}
|
||||
})
|
||||
if (is.is) {
|
||||
this.$message.error(is.msg)
|
||||
return true
|
||||
}
|
||||
// if (!this.out) {
|
||||
// this.$message.error('请填入输出字段')
|
||||
// return true
|
||||
// }
|
||||
},
|
||||
getIsempty(is, obj) {
|
||||
obj.forEach(value => {
|
||||
|
||||
value.conditionList.forEach(value => {
|
||||
if (!value.operator || (!value.fieldValue && value.fieldValue !== 0)) {
|
||||
is.is = true
|
||||
is.msg = "请检查是否有指标的条件未填写"
|
||||
}
|
||||
})
|
||||
if (!value.fieldId) {
|
||||
is.is = true
|
||||
is.msg = "请检查是否有节点无数据"
|
||||
}
|
||||
if (value.children.length > 0) {
|
||||
this.getIsempty(is, value.children)
|
||||
value.nodeType=1
|
||||
}else{
|
||||
value.nodeType=2
|
||||
if(value.resultValue===""){
|
||||
is.is = true
|
||||
is.msg = "请检查是否有最终节点无结果"
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
console.log(this.detailList)
|
||||
|
||||
this.loading = true
|
||||
if (this.examine()) {
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
this.Enformat(this.detailList,'String')
|
||||
let obj = {
|
||||
"code": this.code.trim(),
|
||||
"name": this.name.trim(),
|
||||
"description": String(this.description).trim(),
|
||||
versionList: [{
|
||||
resultFieldEn: this.out,
|
||||
strategyOutputList: this.outcontent,
|
||||
detailList:this.detailList
|
||||
}]
|
||||
|
||||
}
|
||||
if (this.id == 0) {
|
||||
obj.versionList[0].versionCode = 'V:0'
|
||||
obj.versionList[0].description = '初始版本'
|
||||
obj.folderId = this.nameId == 99999999 ? 0 : this.nameId,
|
||||
this.getData.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.$emit('Ok')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.folderId = this.parentId
|
||||
obj.versionList[0].id = this.version.id
|
||||
obj.versionList[0].decisionTreeId = this.id
|
||||
|
||||
this.getData.updatafield(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('出现问题-_-');
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
computed: {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
343
h5-enginex-manager/src/components/common/decisionTree/tree.vue
Normal file
343
h5-enginex-manager/src/components/common/decisionTree/tree.vue
Normal file
@@ -0,0 +1,343 @@
|
||||
<template>
|
||||
<div>
|
||||
<TreeChart :json="treeData" :class="{landscape: isVertical}" @add="addStock" @delete="deleteStock" />
|
||||
|
||||
<el-dialog :title="tempStatus=='add'?'添加':tempStatus=='change'?'修改':'错误状态'" v-if="dialogVisible" :visible.sync="dialogVisible"
|
||||
width="50%" :before-close="handleClose" :close-on-click-modal="false">
|
||||
|
||||
<!-- <el-select v-model="tempData.fieldId" filterable @change="tempData.fieldEn = mixinGetvalueEn($event);fieldChange(tempData)">
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.id">
|
||||
</el-option>
|
||||
</el-select> -->
|
||||
|
||||
|
||||
<el-cascader v-model="tempData.fieldEn" filterable :options="fieldUserObj" clearable @change="fieldChange(tempData)"
|
||||
:props="{ expandTrigger: 'hover' }" >
|
||||
</el-cascader>
|
||||
|
||||
<div style="display: flex;margin-top: 10px;">
|
||||
<el-select v-model="tempData.logical" placeholder="请选择关系符">
|
||||
<el-option :key="1" label="AND" value="&&"></el-option>
|
||||
<el-option :key="2" label="OR" value="||"></el-option>
|
||||
</el-select>
|
||||
|
||||
<div style="border-left: 1px dashed #ddd;margin-left: 10px;">
|
||||
<div v-for="(value,index) in tempData.conditionList" style="width: 500px;display: flex;margin-top: 10px;justify-content: flex-start;">
|
||||
<ruleRelation style="width: 120px;" :openValue2="false" v-model="value.operator" :valueType="tempData.valueType"
|
||||
:type="2" size="mini" :andTextInput="true"></ruleRelation>
|
||||
<varialeSelect v-model="value.fieldValue" :variableType.sync="value.variableType" :valueType="tempData.valueType" style="margin-left: 20px;" height="28px"></varialeSelect>
|
||||
<i class="el-icon-circle-plus-outline" style="font-size: 20px;color: #409EFF;" @click="addRule(index)"></i>
|
||||
<i class="el-icon-circle-close" :style="{fontSize: '20px',color:index===0?'#ddd':'#F56C6C'}" @click="delectRule(index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false;currentTreeData = {};tempData = {}">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogSule">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="添加结果" v-if="resultDialogVisible" :visible.sync="resultDialogVisible" width="20%" @close="resultDialogClose"
|
||||
:close-on-click-modal="false">
|
||||
<varialeSelect v-model="tempResult.resultValue" :variableType.sync="tempResult.variableType" style="margin-left: 20px;" height="28px"></varialeSelect>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="resultDialogVisible = false;">取 消</el-button>
|
||||
<el-button type="primary" @click="resultDialogSule">确 定</el-button>
|
||||
</span>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TreeChart from '@/components/common/decisionTree/treeNode.vue'
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
name: 'tree',
|
||||
components: {
|
||||
TreeChart,
|
||||
ruleRelation,
|
||||
varialeSelect
|
||||
},
|
||||
props: {
|
||||
treeData: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
computed:{
|
||||
fieldUserObj() {
|
||||
if (this.$store.state.FieldUserObj) {
|
||||
return this.$store.state.FieldUserObj.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tempResult: {
|
||||
resultValue: '',
|
||||
variableType: 1,
|
||||
},
|
||||
resultDialogVisible: false, //添加结果弹窗
|
||||
isVertical: false, // 是否是竖方向,只给最外层的添加
|
||||
dialogVisible: false,
|
||||
tempData: {},
|
||||
currentTreeData: {},
|
||||
tempStatus: '', //临时状态 添加为 ‘add’ 修改为 ‘change’
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
resultDialogClose(){
|
||||
this.tempResult ={
|
||||
resultValue: '',
|
||||
variableType: 1,
|
||||
}
|
||||
this.currentTreeData = {}
|
||||
},
|
||||
deleteResult(data) {
|
||||
this.$confirm('确定删除此结果?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.currentTreeData = data
|
||||
const deleteData = (data) => {
|
||||
data.some((item, i) => {
|
||||
if (item == this.currentTreeData) {
|
||||
item.variableType = 1
|
||||
item.resultValue = ""
|
||||
return
|
||||
} else if (item.children) {
|
||||
deleteData(item.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
let arr = [this.treeData]
|
||||
deleteData(arr)
|
||||
this.treeData = arr[0] ? arr[0] : {},
|
||||
this.currentTreeData = {}
|
||||
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
},
|
||||
resultDialogSule() {
|
||||
if(this.tempResult.resultValue.trim()==""||this.tempResult.resultValue==null||(this.tempResult.variableType==3&&JSON.parse(this.tempResult.resultValue).formula.trim()=="")){
|
||||
this.$message.error('请输入值')
|
||||
return
|
||||
}
|
||||
const deleteData = (data) => {
|
||||
data.some((item, i) => {
|
||||
if (item == this.currentTreeData) {
|
||||
Object.assign(item, this.tempResult)
|
||||
return
|
||||
} else if (item.children) {
|
||||
deleteData(item.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
let arr = [this.treeData]
|
||||
deleteData(arr)
|
||||
this.treeData = arr[0] ? arr[0] : {}
|
||||
|
||||
this.resultDialogVisible = false
|
||||
this.currentTreeData = {}
|
||||
this.tempResult = {
|
||||
resultValue: '',
|
||||
variableType: 1,
|
||||
}
|
||||
|
||||
},
|
||||
addResult(data) {
|
||||
this.currentTreeData = data
|
||||
this.tempResult = {
|
||||
resultValue: '',
|
||||
variableType: 1,
|
||||
}
|
||||
this.resultDialogVisible = true
|
||||
|
||||
},
|
||||
fieldChange(item) {
|
||||
|
||||
|
||||
item.fieldId = this.mixinGetIdByEn(item.fieldEn[0])
|
||||
item.valueType = this.mixinGetValueTypeByJSONEn(item.fieldEn)
|
||||
|
||||
item.conditionList.forEach(value => {
|
||||
value.operator = ""
|
||||
})
|
||||
},
|
||||
dialogSule() {
|
||||
let is = false
|
||||
this.tempData.conditionList.forEach(value => {
|
||||
if (value.operator == "" || String(value.fieldValue).trim() === "") {
|
||||
is = true
|
||||
}
|
||||
if (value.variableType == 3 && (value.fieldValue === "" || JSON.parse(value.fieldValue).formula === "")) {
|
||||
is = true
|
||||
}
|
||||
})
|
||||
if (is) {
|
||||
this.$message.error('比较符和值不允许为空')
|
||||
return
|
||||
}
|
||||
|
||||
const deleteData = (data) => {
|
||||
data.some((item, i) => {
|
||||
if (item == this.currentTreeData) {
|
||||
if (this.tempStatus == 'change') {
|
||||
Object.assign(item, this.tempData)
|
||||
} else if (this.tempStatus == 'add') {
|
||||
item.children.push(this.tempData)
|
||||
// item.nodeType=1
|
||||
}
|
||||
return
|
||||
} else if (item.children) {
|
||||
deleteData(item.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
let arr = [this.treeData]
|
||||
deleteData(arr)
|
||||
this.treeData = arr[0] ? arr[0] : {}
|
||||
this.dialogVisible = false
|
||||
this.currentTreeData = {}
|
||||
this.tempData = {}
|
||||
this.tempStatus = ''
|
||||
},
|
||||
handleClose() {
|
||||
this.dialogVisible = false
|
||||
this.currentTreeData = {}
|
||||
this.tempData = {}
|
||||
},
|
||||
// 新增编辑,val: 0 新增, 1 编辑 ,2 添加结果 3 删除结果 4更改结果
|
||||
addStock(data) {
|
||||
if (data.val == 0) {
|
||||
this.addNode(data.data)
|
||||
} else if (data.val == 1) {
|
||||
this.changeNode(data.data)
|
||||
} else if (data.val == 2) {
|
||||
this.addResult(data.data)
|
||||
} else if (data.val == 3) {
|
||||
this.deleteResult(data.data)
|
||||
}else if (data.val == 4) {
|
||||
this.updateResult(data.data)
|
||||
}
|
||||
|
||||
},
|
||||
updateResult(data){
|
||||
console.log(data)
|
||||
this.resultDialogVisible = true
|
||||
this.currentTreeData = data
|
||||
this.tempResult ={
|
||||
resultValue: data.resultValue,
|
||||
variableType:data.variableType,
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
addNode(data) {
|
||||
this.tempStatus = 'add'
|
||||
this.currentTreeData = data
|
||||
this.tempData = {
|
||||
"conditionList": [{
|
||||
"operator": "",
|
||||
"variableType": 1,
|
||||
"fieldValue": ""
|
||||
}],
|
||||
nodeType:'',
|
||||
"fieldId": "",
|
||||
"children": [],
|
||||
"logical": "&&",
|
||||
"fieldEn": [],
|
||||
resultValue: "",
|
||||
"variableType": 1,
|
||||
}
|
||||
this.dialogVisible = true
|
||||
},
|
||||
addRule(index) {
|
||||
this.tempData.conditionList.splice(index + 1, 0, {
|
||||
operator: '',
|
||||
fieldValue: '',
|
||||
variableType: 1
|
||||
})
|
||||
},
|
||||
delectRule(index) {
|
||||
if (index == 0) {
|
||||
return
|
||||
}
|
||||
this.tempData.conditionList.splice(index, 1)
|
||||
},
|
||||
changeNode(data) {
|
||||
this.currentTreeData = data
|
||||
this.tempStatus = 'change'
|
||||
this.tempData = JSON.parse(JSON.stringify(data))
|
||||
this.dialogVisible = true
|
||||
},
|
||||
// 删除
|
||||
deleteStock(data) {
|
||||
if (data == this.treeData) {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '顶层节点不允许删除'
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
this.$confirm('确定删除此节点?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.currentTreeData = data
|
||||
this.confimdelete()
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
},
|
||||
// 确定删除
|
||||
confimdelete() {
|
||||
// 前端删除 遍历原数据,删除匹配random数据
|
||||
const deleteData = (data) => {
|
||||
data.some((item, i) => {
|
||||
if (item == this.currentTreeData) {
|
||||
data.splice(i, 1)
|
||||
|
||||
return
|
||||
} else if (item.children) {
|
||||
deleteData(item.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
let arr = [this.treeData]
|
||||
deleteData(arr)
|
||||
this.treeData = arr[0] ? arr[0] : {}
|
||||
console.log(this.treeData)
|
||||
this.dialogVisible2 = false
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "成功"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,393 @@
|
||||
<template>
|
||||
<table v-if="treeData && treeData.variableType" style="margin: 0 auto;">
|
||||
<tr>
|
||||
<td :colspan="treeData.children ? treeData.children.length * 2 : 1" :class="{parentLevel: treeData.children, extend: (treeData.children && treeData.children.length)||treeData.resultValue!=''}">
|
||||
<div :class="{node: true, hasMate: treeData.mate}">
|
||||
<div class="person" @click="$emit('click-node', treeData)">
|
||||
<el-popover placement="top" style="display: flex;" trigger="hover">
|
||||
<div style="margin: 0;text-align: center;">
|
||||
<el-button size="mini" type="primary" @click="addStock(0)" v-if="treeData.resultValue==''">添加</el-button>
|
||||
<el-button size="mini" type="primary" @click="addStock(2)" v-if="treeData.children.length==0&&treeData.resultValue==''">添加结果</el-button>
|
||||
<el-button size="mini" type="primary" @click="addStock(3)" v-if="treeData.resultValue!=''">删除结果</el-button>
|
||||
<el-button size="mini" type="primary" @click="addStock(4)" v-if="treeData.resultValue!=''">更改结果</el-button>
|
||||
<el-button type="primary" size="mini" @click="addStock(1)">编辑</el-button>
|
||||
<el-button type="primary" size="mini" @click="deleteStock">删除</el-button>
|
||||
</div>
|
||||
<div class="avat" slot="reference">
|
||||
<p style="font-weight: bold;">
|
||||
{{treeData.fieldId===''?'初始节点':mixinGetvalueCn(treeData.fieldId)}}
|
||||
</p>
|
||||
<div style="display: flex;justify-content: center;">
|
||||
<p style="padding-right: 5px;border-right: 2px dotted #999;margin-right: 5px;min-width: 20px;">{{treeData.logical}}</p>
|
||||
<div>
|
||||
<p v-for="item in treeData.conditionList">
|
||||
{{item.operator}}
|
||||
{{item.variableType==3?JSON.parse(item.fieldValue).formula:item.fieldValue}}
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="extend_handle" v-if=" (treeData.children && treeData.children.length)||treeData.resultValue!=''" @click="toggleExtend(treeData)"></div> -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- 这是一个递归组件,注意,这里还要调用,需要传递的数据这里也要传递,否则操作时拿不到子级的数据 -->
|
||||
<tr v-if="treeData.children && treeData.children.length">
|
||||
<td v-for="(children, index) in treeData.children" :key="index" colspan="2" class="childLevel">
|
||||
<TreeChart :json="children" @add="$emit('add', $event)" @delete="$emit('delete', $event)" @click-node="$emit('click-node', $event)" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="treeData.resultValue!=''">
|
||||
<td colspan="2" class="childLevel">
|
||||
<div class="resultValue" >
|
||||
{{treeData.variableType==3?JSON.parse(treeData.resultValue).formula:treeData.variableType==2?mixinGetCnByEn(treeData.resultValue):treeData.resultValue}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "TreeChart",
|
||||
props: {
|
||||
json: {}, // 渲染数据
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
treeData: {},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// console.log(this.treeData)
|
||||
},
|
||||
watch: {
|
||||
json: {
|
||||
// 遍历当前的数据
|
||||
handler: function(Props) {
|
||||
let extendKey = function(jsonData) {
|
||||
jsonData.extend =
|
||||
jsonData.extend === void 0 ? true : !!jsonData.extend;
|
||||
|
||||
return jsonData;
|
||||
};
|
||||
if (Props) {
|
||||
this.treeData = extendKey(Props);
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleExtend(treeData) {
|
||||
treeData.extend = !treeData.extend;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
|
||||
|
||||
addStock(val) {
|
||||
// console.log(this.treeData)
|
||||
this.$emit('add', {
|
||||
val: val,
|
||||
data: this.treeData
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
deleteStock() {
|
||||
this.$emit('delete', this.treeData)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.resultValue{
|
||||
max-width: 180px;
|
||||
margin: 0 auto;
|
||||
word-break: break-word;
|
||||
margin-top: 5px;
|
||||
font-size: 14px;
|
||||
background-color: #e29700;
|
||||
padding: 10px 5px 5px 5px;
|
||||
border-radius: 4px;
|
||||
white-space: initial;
|
||||
}
|
||||
table {
|
||||
border-collapse: separate !important;
|
||||
border-spacing: 0 !important;
|
||||
}
|
||||
|
||||
td {
|
||||
position: relative;
|
||||
vertical-align: top;
|
||||
padding: 0 0 40px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.parent {
|
||||
background: #199ed8 !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.extend_handle {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 27px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
padding: 10px;
|
||||
transform: translate3d(-15px, 0, 0);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.extend_handle:before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
border: 2px solid;
|
||||
border-color: #ccc #ccc transparent transparent;
|
||||
transform: rotateZ(135deg);
|
||||
transform-origin: 50% 50% 0;
|
||||
transition: transform ease 300ms;
|
||||
}
|
||||
|
||||
.extend_handle:hover:before {
|
||||
border-color: #333 #333 transparent transparent;
|
||||
}
|
||||
|
||||
.extend .extend_handle:before {
|
||||
transform: rotateZ(-45deg);
|
||||
}
|
||||
|
||||
.extend::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 15px;
|
||||
height: 15px;
|
||||
border-left: 2px solid #ccc;
|
||||
transform: translate3d(-1px, 0, 0)
|
||||
}
|
||||
|
||||
.childLevel::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 100%;
|
||||
height: 15px;
|
||||
border-left: 2px solid #ccc;
|
||||
transform: translate3d(-1px, 0, 0)
|
||||
}
|
||||
|
||||
.childLevel::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: -15px;
|
||||
border-top: 2px solid #ccc;
|
||||
}
|
||||
|
||||
.childLevel:first-child:before,
|
||||
.childLevel:last-child:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.childLevel:first-child:after {
|
||||
left: 50%;
|
||||
height: 15px;
|
||||
border: 2px solid;
|
||||
border-color: #ccc transparent transparent #ccc;
|
||||
border-radius: 6px 0 0 0;
|
||||
transform: translate3d(1px, 0, 0)
|
||||
}
|
||||
|
||||
.childLevel:last-child:after {
|
||||
right: 50%;
|
||||
height: 15px;
|
||||
border: 2px solid;
|
||||
border-color: #ccc #ccc transparent transparent;
|
||||
border-radius: 0 6px 0 0;
|
||||
transform: translate3d(-1px, 0, 0)
|
||||
}
|
||||
|
||||
.childLevel:first-child.childLevel:last-child::after {
|
||||
left: auto;
|
||||
border-radius: 0;
|
||||
border-color: transparent #ccc transparent transparent;
|
||||
transform: translate3d(1px, 0, 0)
|
||||
}
|
||||
|
||||
.node {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.node .person {
|
||||
padding-top: 15px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
z-index: 2;
|
||||
width: 180px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.node .person .avat {
|
||||
padding: 5px;
|
||||
padding-top: 10px;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: auto;
|
||||
word-break: break-all;
|
||||
background: #fff;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
|
||||
.opreate_icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.opreate_icon {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: -3px;
|
||||
right: -3px;
|
||||
padding: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
&.company {
|
||||
background: #199ed8;
|
||||
}
|
||||
|
||||
&.other {
|
||||
background: #ccc;
|
||||
}
|
||||
}
|
||||
|
||||
.node .person .avat img {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.node .person .name {
|
||||
height: 2em;
|
||||
line-height: 2em;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.node.hasMate::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 2em;
|
||||
right: 2em;
|
||||
top: 15px;
|
||||
border-top: 2px solid #ccc;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.node.hasMate .person:last-child {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.el-dialog__header {
|
||||
padding: 0;
|
||||
padding-top: 30px;
|
||||
margin: 0 30px;
|
||||
border-bottom: 1px solid #F1F1F1;
|
||||
text-align: left;
|
||||
|
||||
.el-dialog__title {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #464C5B;
|
||||
line-height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.tips {
|
||||
padding: 0 20px;
|
||||
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.blue {
|
||||
color: #00B5EF;
|
||||
}
|
||||
|
||||
.check {
|
||||
margin-left: 100px;
|
||||
}
|
||||
|
||||
.inquiry {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.el-form-item__label {
|
||||
display: block;
|
||||
float: none;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.el-form-item__content {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.el-dialog__body {
|
||||
padding: 30px 25px;
|
||||
|
||||
p {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-dialog__headerbtn {
|
||||
top: 30px;
|
||||
right: 30px;
|
||||
}
|
||||
|
||||
// 竖向
|
||||
.landscape {
|
||||
transform: translate(-100%, 0) rotate(-90deg);
|
||||
transform-origin: 100% 0;
|
||||
|
||||
.node {
|
||||
text-align: left;
|
||||
height: 8em;
|
||||
width: 8em;
|
||||
}
|
||||
|
||||
.person {
|
||||
position: relative;
|
||||
transform: rotate(90deg);
|
||||
// padding-left: 4.5em;
|
||||
// height: 4em;
|
||||
top: 35px;
|
||||
left: 12px;
|
||||
width: 110px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-popover {
|
||||
.el-button {
|
||||
padding: 8px !important;
|
||||
margin-left: 5px !important;
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
80
h5-enginex-manager/src/components/common/directives.js
Normal file
80
h5-enginex-manager/src/components/common/directives.js
Normal file
@@ -0,0 +1,80 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// v-dialogDrag: 弹窗拖拽属性
|
||||
Vue.directive('dialogDrag', {
|
||||
bind(el, binding, vnode, oldVnode) {
|
||||
const dialogHeaderEl = el.querySelector('.el-dialog__header');
|
||||
const dragDom = el.querySelector('.el-dialog');
|
||||
|
||||
dialogHeaderEl.style.cssText += ';cursor:move;'
|
||||
dragDom.style.cssText += ';top:0px;'
|
||||
|
||||
// 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
|
||||
const sty = (() => {
|
||||
if (window.document.currentStyle) {
|
||||
return (dom, attr) => dom.currentStyle[attr];
|
||||
} else {
|
||||
return (dom, attr) => getComputedStyle(dom, false)[attr];
|
||||
}
|
||||
})()
|
||||
|
||||
dialogHeaderEl.onmousedown = (e) => {
|
||||
// 鼠标按下,计算当前元素距离可视区的距离
|
||||
const disX = e.clientX - dialogHeaderEl.offsetLeft;
|
||||
const disY = e.clientY - dialogHeaderEl.offsetTop;
|
||||
|
||||
const screenWidth = document.body.clientWidth; // body当前宽度
|
||||
const screenHeight = document.documentElement.clientHeight; // 可见区域高度(应为body高度,可某些环境下无法获取)
|
||||
|
||||
const dragDomWidth = dragDom.offsetWidth; // 对话框宽度
|
||||
const dragDomheight = dragDom.offsetHeight; // 对话框高度
|
||||
|
||||
const minDragDomLeft = dragDom.offsetLeft;
|
||||
const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth;
|
||||
|
||||
const minDragDomTop = dragDom.offsetTop;
|
||||
const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight;
|
||||
|
||||
|
||||
// 获取到的值带px 正则匹配替换
|
||||
let styL = sty(dragDom, 'left');
|
||||
let styT = sty(dragDom, 'top');
|
||||
|
||||
// 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
|
||||
if (styL.includes('%')) {
|
||||
styL = +document.body.clientWidth * (+styL.replace(/\%/g, '') / 100);
|
||||
styT = +document.body.clientHeight * (+styT.replace(/\%/g, '') / 100);
|
||||
} else {
|
||||
styL = +styL.replace(/\px/g, '');
|
||||
styT = +styT.replace(/\px/g, '');
|
||||
};
|
||||
|
||||
document.onmousemove = function (e) {
|
||||
// 通过事件委托,计算移动的距离
|
||||
let left = e.clientX - disX;
|
||||
let top = e.clientY - disY;
|
||||
|
||||
// 边界处理
|
||||
if (-(left) > minDragDomLeft) {
|
||||
left = -(minDragDomLeft);
|
||||
} else if (left > maxDragDomLeft) {
|
||||
left = maxDragDomLeft;
|
||||
}
|
||||
|
||||
if (-(top) > minDragDomTop) {
|
||||
top = -(minDragDomTop);
|
||||
} else if (top > maxDragDomTop) {
|
||||
top = maxDragDomTop;
|
||||
}
|
||||
|
||||
// 移动当前元素
|
||||
dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`;
|
||||
};
|
||||
|
||||
document.onmouseup = function (e) {
|
||||
document.onmousemove = null;
|
||||
document.onmouseup = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
235
h5-enginex-manager/src/components/common/endRule.vue
Normal file
235
h5-enginex-manager/src/components/common/endRule.vue
Normal file
@@ -0,0 +1,235 @@
|
||||
<template>
|
||||
|
||||
<div class="stop-condition">
|
||||
|
||||
<!-- 标题 -->
|
||||
<div style="background-color: #aaa; height: 30px;line-height: 30px; color: #fff;padding: 10px; box-sizing: border-box; margin: 10px 0;display: flex;align-items: center;justify-content: space-between;">
|
||||
<p>终止条件</p>
|
||||
</div>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<el-button type="primary" round size="mini" @click="selRule(true)" style="margin-top: 10px;">
|
||||
选择({{data.selectedRule.length}})</el-button>
|
||||
|
||||
|
||||
|
||||
<div v-if="data.selectedRule.length>0">
|
||||
<div v-for="(condition,index) in data.conditions" :key="index" class="conditions-wrapper"
|
||||
style="display: flex;">
|
||||
<el-select v-model="condition.fieldCode" placeholder="条数/分数" size="mini" style="width: 110px;">
|
||||
<slot>
|
||||
|
||||
</slot>
|
||||
</el-select>
|
||||
<ruleRelation v-model="condition.operator" :value2.sync="condition.value" :valueType="valueType" size="mini"
|
||||
style="width:200px;"></ruleRelation>
|
||||
|
||||
<el-select v-model="condition.relativeOperator" placeholder="请选择" style="width: 70px;margin-left: 10px;"
|
||||
size="mini" v-if="index!=data.conditions.length-1">
|
||||
<el-option label="and" value="&&"></el-option>
|
||||
<el-option label="or" value="||"></el-option>
|
||||
</el-select>
|
||||
<i class="el-icon-plus" style="font-size: 20px;color: #409EFF;" @click="addCondition(index)"></i>
|
||||
<i class="el-icon-close" style="font-size: 20px;color: #F56C6C;" v-show="index!=0"
|
||||
@click="delCondtion(index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="data.selectedRule.length>0">
|
||||
<div
|
||||
style="background-color: #aaa; height: 30px;line-height: 30px; color: #fff;padding: 10px; box-sizing: border-box; margin: 10px 0;display: flex;align-items: center;justify-content: space-between;">
|
||||
<p>终止结果</p>
|
||||
</div>
|
||||
<div class="setting-wrapper">
|
||||
<el-select v-model="data.output.fieldId" filterable placeholder="输出变量" @change="data.output.fieldCode = mixinGetvalueEn($event)" size="mini" style="width:130px;">
|
||||
<el-option v-for="(item,index) in Fielduser" :key="index" :label="item.fieldCn" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<div class="line">=</div>
|
||||
<varialeSelect v-model="data.output.fieldValue" :valueType="mixinGetvalueType(data.output.fieldId)" :variableType.sync="data.output.variableType" height="28px"></varialeSelect>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog title="选择条件(多选)" :visible="showRuleDialog" width="40%" :append-to-body="true" @close="cancelSelRule">
|
||||
<div>
|
||||
<el-checkbox-group v-model="currentSelectRule">
|
||||
<el-table ref="ruleArr" :data="pageRuleList" size="mini">
|
||||
|
||||
<el-table-column width="60">
|
||||
<template slot-scope="scope">
|
||||
<el-checkbox :label="scope.row.id"> </el-checkbox>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="id" label="id" >
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column :prop="name" label="名称">
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column :prop="code" label="code">
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<el-pagination small layout="prev, pager, next" :total="list.length" :page-size="10"
|
||||
@current-change="page=$event" style="margin-left: 70%;margin-top: 10px;">
|
||||
</el-pagination>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelSelRule">取 消</el-button>
|
||||
<el-button type="primary" @click="selRuleSure">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
components:{ruleRelation,varialeSelect},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}, //nodeJson.terminationInfo
|
||||
list:{
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
onlyOne:{
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
valueType:{
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
name:{
|
||||
type: String,
|
||||
default: 'name'
|
||||
},
|
||||
code:{
|
||||
type: String,
|
||||
default: 'code'
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showRuleDialog: false,
|
||||
page: 1,
|
||||
currentSelectRule:[]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
|
||||
|
||||
},
|
||||
computed: {
|
||||
Fielduser() {
|
||||
if (this.$store.state.FieldUser != null) {
|
||||
this.loading = false
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
pageRuleList(){
|
||||
return this.list.filter((value,index)=>{
|
||||
return index>=(this.page-1)*10&&index<this.page*10
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addCondition(index) {
|
||||
this.data.conditions.splice(index + 1, 0, {
|
||||
"fieldCode": "",
|
||||
"fieldName": "",
|
||||
"valueType": this.valueType,
|
||||
"operator": "",
|
||||
"value": "",
|
||||
"relativeOperator": ""
|
||||
})
|
||||
},
|
||||
selRuleSure(){ //确定选择
|
||||
this.data.selectedRule = this.list.filter(value=>{
|
||||
return this.currentSelectRule.indexOf(value.id)!=-1
|
||||
})
|
||||
if(this.data.selectedRule.length==0){
|
||||
this.$emit('reSetTerminationInfo')
|
||||
}
|
||||
this.showRuleDialog = false
|
||||
|
||||
},
|
||||
cancelSelRule(){ //取消选择规则
|
||||
this.showRuleDialog = false
|
||||
},
|
||||
selRule(isShow) {
|
||||
if(this.onlyOne){
|
||||
console.log(this.data.selectedRule,this.pageRuleList)
|
||||
if(!this.pageRuleList[0]){
|
||||
this.$message.warning('请先选择上方节点')
|
||||
return
|
||||
}
|
||||
if(!this.data.selectedRule.length){
|
||||
this.data.selectedRule = this.pageRuleList
|
||||
this.$message.success('已为选中上方节点')
|
||||
return
|
||||
}else{
|
||||
this.$emit('reSetTerminationInfo')
|
||||
this.$message.success('已为你取消选中上方节点')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
console.log(this.currentSelectRule )
|
||||
|
||||
if (this.list.length > 0 && isShow) {
|
||||
this.showRuleDialog = true;
|
||||
this.currentSelectRule = this.data.selectedRule.map(value=>value.id)
|
||||
} else if (isShow) {
|
||||
this.$message.error('请先选择策略!');
|
||||
}
|
||||
|
||||
},
|
||||
delCondtion(index){
|
||||
this.data.conditions.splice(index, 1);
|
||||
},
|
||||
},
|
||||
watch:{
|
||||
list(newValue){
|
||||
|
||||
if(this.data.selectedRule&&this.data.selectedRule.length>0){
|
||||
let num = -1
|
||||
this.data.selectedRule.forEach((value,index)=>{
|
||||
let is = true
|
||||
newValue.forEach(item=>{
|
||||
if(item.id==value.id){
|
||||
console.log(item.id,value.id)
|
||||
is = false
|
||||
}
|
||||
})
|
||||
if(is){
|
||||
num = index
|
||||
}
|
||||
})
|
||||
|
||||
if(num!=-1){
|
||||
|
||||
this.data.selectedRule.splice(num,1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
208
h5-enginex-manager/src/components/common/fieldUserTable.vue
Normal file
208
h5-enginex-manager/src/components/common/fieldUserTable.vue
Normal file
@@ -0,0 +1,208 @@
|
||||
<style>
|
||||
.fieldUserTable {
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
overflow: hidden;
|
||||
z-index: 9;
|
||||
border: 6px solid #9bcdff;
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box;
|
||||
|
||||
}
|
||||
.FUT_header {
|
||||
background-color: #3584d3;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 3px;
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
.FUT_table::-webkit-scrollbar {
|
||||
display: none;
|
||||
/* Chrome Safari */
|
||||
}
|
||||
.FUT_table{
|
||||
height: 93%;
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
margin-top: 30px;
|
||||
|
||||
}
|
||||
.FUT_table>p {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.FUT_table>p:hover {
|
||||
color: #fff;
|
||||
background-color: #9bcdff;
|
||||
}
|
||||
#fieldUserTabletempcurr{
|
||||
background-color: #d9ebff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div v-show="show" class="fieldUserTable" @mousedown="mousedowm" ref="UserTable" :style="{top:this.tempTop+'px',left:this.tempLeft+'px'}">
|
||||
<div class="FUT_header" >
|
||||
<p>字段列表</p>
|
||||
<p><i class="el-icon-close" @click="$emit('close')"></i></p>
|
||||
</div>
|
||||
<div class="FUT_table" v-show="fieldUserRemind.length>0" id="FUT_table">
|
||||
<p v-for="(item,index) in fieldUserRemind" @dblclick="dbc(item.fieldCn)" :id="index==tempCurIndex?'fieldUserTabletempcurr':''">{{item.fieldCn?item.fieldCn:item.fieldEn}}</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
text: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
fieldUser: {
|
||||
type: Array||Boolean,
|
||||
default: false
|
||||
},
|
||||
show:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tempCurIndex:0,
|
||||
tempTop:300,
|
||||
tempLeft:800,
|
||||
drag:false,
|
||||
tempClientX:0,
|
||||
tempClientY:0,
|
||||
tempOffsetLeft:0,
|
||||
tempOffsetTop:0,
|
||||
temptext:"",
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
beforeUnmount() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
window.onmousemove=(e)=>{
|
||||
if(this.drag){
|
||||
this.tempTop=e.clientY-(this.tempClientY-this.tempOffsetTop)
|
||||
this.tempLeft=e.clientX-(this.tempClientX-this.tempOffsetLeft)
|
||||
}
|
||||
},
|
||||
window.onmouseup=()=>{
|
||||
this.drag=false
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
computed: {
|
||||
fieldUserRemind() {
|
||||
if (this.show === true) {
|
||||
let arr = []
|
||||
|
||||
this.fieldUser.forEach(value => {
|
||||
|
||||
if (value.fieldCn.indexOf(this.text) !== -1) {
|
||||
arr.push({ ...value
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
return arr
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show(){
|
||||
// console.log(this.show)
|
||||
if(this.show){
|
||||
window.onkeydown=(e)=>{
|
||||
if(e.key=='ArrowUp'||e.key=='ArrowDown'){
|
||||
e.preventDefault()
|
||||
var tempcurrDom = document.getElementById('fieldUserTabletempcurr')
|
||||
var FUTTable = document.getElementById('FUT_table')
|
||||
if(e.key=='ArrowUp'&&this.tempCurIndex>0){
|
||||
this.tempCurIndex--
|
||||
}
|
||||
if(e.key=='ArrowDown'&&this.tempCurIndex<this.fieldUserRemind.length-1){
|
||||
this.tempCurIndex++
|
||||
}
|
||||
FUTTable.scrollTop = tempcurrDom.offsetTop-180
|
||||
}
|
||||
if(e.key=='Enter'){
|
||||
e.preventDefault()
|
||||
this.dbc(this.fieldUserRemind[this.tempCurIndex].fieldCn)
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
window.onkeydown=()=>{
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
text(){
|
||||
this.tempCurIndex = 0
|
||||
var FUTTable = document.getElementById('FUT_table')
|
||||
FUTTable.scrollTop =0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
mousedowm(e){
|
||||
this.tempClientX = e.clientX;
|
||||
this.tempClientY = e.clientY;
|
||||
this.tempOffsetLeft=this.$refs.UserTable.offsetLeft
|
||||
this.tempOffsetTop=this.$refs.UserTable.offsetTop
|
||||
|
||||
|
||||
|
||||
this.drag=true
|
||||
|
||||
},
|
||||
dbc(e){
|
||||
this.$emit('dbc',e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
139
h5-enginex-manager/src/components/common/file.vue
Normal file
139
h5-enginex-manager/src/components/common/file.vue
Normal file
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
|
||||
<div :style="{display:show?'block':'none',position:'relative'}">
|
||||
<div @click="opening()" :style="{marginLeft:(5+retract*10)+'px',display:show?'flex':'none'}" class="file_file" @contextmenu.prevent="opening();$emit('fileRight',{e:$event,item:item})">
|
||||
<p style="width: 16px;">
|
||||
<i :class="open?'el-icon-arrow-down':'el-icon-arrow-right'" :style="{display:iconshow?'inline':'none'}"></i>
|
||||
</p>
|
||||
<i :class="iconshow?open?'el-icon-folder-opened file_icon':'el-icon-folder file_icon':'el-icon-folder file_icon'"></i>
|
||||
<span class="file_name" v-show="Rename">
|
||||
<el-input v-model="inputValue" placeholder="回车键确认,esc取消" size="mini" ref="input" @keyup.enter="submit"></el-input>
|
||||
</span>
|
||||
<span class="file_name" v-show="!Rename">{{name}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import bus from '@/components/common/bus.js'
|
||||
export default {
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
name: '',
|
||||
Rename: '',
|
||||
retract: '',
|
||||
open: '',
|
||||
show: '',
|
||||
|
||||
id: '',
|
||||
inputValue: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.input.$refs.input.onkeydown = (e) => {
|
||||
this.keyDown(e)
|
||||
}
|
||||
this.setItem(this.item)
|
||||
},
|
||||
methods: {
|
||||
setItem(e){
|
||||
this.name =e.name
|
||||
this.Rename=e.Rename
|
||||
this.retract=e.ZIndex
|
||||
this.open=e.open
|
||||
this.show=e.show
|
||||
this.id=e.id
|
||||
},
|
||||
keyDown(e) {
|
||||
// console.log(e)
|
||||
if (e.key === "Enter") {
|
||||
if (this.inputValue.length > 20) {
|
||||
this.$message({
|
||||
message: '最大长度20个字符',
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
let params = {
|
||||
name: this.inputValue.trim(),
|
||||
id: this.id
|
||||
}
|
||||
this.$emit("updatafilelist", params)
|
||||
|
||||
|
||||
}
|
||||
} else if (e.key === "Escape") {
|
||||
this.inputValue = ""
|
||||
this.$emit('RenameClose', this.id)
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
opening() {
|
||||
if (!this.Rename) {
|
||||
this.$emit('curr', this.id)
|
||||
}
|
||||
|
||||
},
|
||||
submit(e) {
|
||||
console.log(1)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
Rename() {
|
||||
if (this.Rename === true) {
|
||||
setTimeout(() => {
|
||||
this.$refs.input.focus()
|
||||
}, 10)
|
||||
}
|
||||
},
|
||||
item: {
|
||||
deep: true, //深度监听设置为 true
|
||||
handler: function(e) {
|
||||
this.setItem(e)
|
||||
}
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
iconshow(){
|
||||
return !!this.item.children.length
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.file_file {
|
||||
transition: all .3s;
|
||||
align-items: center;
|
||||
padding: 5px;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.file_icon {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.file_name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
147
h5-enginex-manager/src/components/common/fileHome.vue
Normal file
147
h5-enginex-manager/src/components/common/fileHome.vue
Normal file
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-for="item in data">
|
||||
<file :class="item.id===currid?'file_select':''" @curr="curr" :item="item"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
<div v-for="value in item.children">
|
||||
|
||||
<file :class="value.id===currid?'file_select':''" @curr="curr" :item="value"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
<div v-for="cont in value.children">
|
||||
|
||||
<file :class="cont.id===currid?'file_select':''" @curr="curr" :item="cont"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
<div v-for="cont1 in cont.children">
|
||||
|
||||
<file :class="cont1.id===currid?'file_select':''" @curr="curr" :item="cont1"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
<div v-for="cont2 in cont1.children">
|
||||
|
||||
<file :class="cont2.id===currid?'file_select':''" @curr="curr" :item="cont2"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
<div v-for="cont3 in cont2.children">
|
||||
|
||||
<file :class="cont3.id===currid?'file_select':''" @curr="curr" :item="cont3"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="fileHint" :style="{top:tempHintTop+'px',left:tempHintLeft+'px',display:tempHintTop&&tempHintLeft?'block':'none'}">
|
||||
<p>
|
||||
<el-button type="text" size="mini" @click="RenameFun">重命名</el-button>
|
||||
</p>
|
||||
<p>
|
||||
<el-button type="text" size="mini" @click="delectFun">删除</el-button>
|
||||
</p>
|
||||
<p>
|
||||
<el-button type="text" size="mini" @click="tempHintLeft=null;tempHintTop=null">取消</el-button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import file from './file.vue'
|
||||
export default {
|
||||
components: {
|
||||
file
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
tempHintTop : null,
|
||||
tempHintLeft :null,
|
||||
tempId:null
|
||||
}
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
currid:{
|
||||
type:Number,
|
||||
default : 99999999
|
||||
}
|
||||
},
|
||||
created() {
|
||||
setTimeout(() => {
|
||||
console.log(this.data)
|
||||
}, 1000)
|
||||
},
|
||||
methods: {
|
||||
curr(e) {
|
||||
this.tempHintLeft = null
|
||||
this.tempHintTop = null
|
||||
this.tempId = null
|
||||
this.$emit('curr',e)
|
||||
},
|
||||
RenameClose() {
|
||||
this.$emit('RenameClose',this.tempId )
|
||||
},
|
||||
updatafilelist(e) {
|
||||
this.$emit('updatafilelist',e)
|
||||
},
|
||||
fileRight(e){
|
||||
this.tempHintLeft = e.e.x
|
||||
this.tempHintTop = e.e.y
|
||||
this.tempId = e.item.id
|
||||
},
|
||||
RenameFun(){
|
||||
this.$emit('RenameFun',this.tempId )
|
||||
this.tempHintTop = null,
|
||||
this.tempHintLeft =null,
|
||||
this.tempId=null
|
||||
},
|
||||
delectFun(){
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$emit('delectFun',this.tempId )
|
||||
this.tempHintTop = null,
|
||||
this.tempHintLeft =null,
|
||||
this.tempId=null
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
this.tempHintTop = null
|
||||
this.tempHintLeft = null
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
61
h5-enginex-manager/src/components/common/flowHint.vue
Normal file
61
h5-enginex-manager/src/components/common/flowHint.vue
Normal file
@@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<el-drawer title="操作提示" :visible="open" @update:visible="$emit('update:open',false)">
|
||||
|
||||
<div v-for="value in data" style="padding-left: 10px;">
|
||||
<p style="font-size: 18px;font-weight: bold;">{{value.title}}</p>
|
||||
<div v-for="(item,index) in value.cont" style="padding-left: 10px;margin-top: 3px;">
|
||||
<p :style="{color:item.type=='limit'?'#f56c6c':'#000'}">{{index+1}}.{{item.text}}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</el-drawer>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
open: false
|
||||
},
|
||||
data() {
|
||||
return{
|
||||
data:[{
|
||||
title:'节点',
|
||||
cont:[
|
||||
{text:'红色节点以及名单库决策选项统称为策略节点'},
|
||||
{text:'紫色节点统称为分支节点'},
|
||||
{text:'分支节点后可以有多个节点,但策略节点后只能有一个节点'},
|
||||
{text:'拖动节点可以改变位置,双击节点可以编辑节点内容'},
|
||||
|
||||
]
|
||||
},{
|
||||
title:'连线',
|
||||
cont:[
|
||||
{text:'右键点击节点可以呼出连线,再次右击可以连接下一个节点'},
|
||||
{text:'连线不能封闭',type:'limit'},
|
||||
{text:'并行节点后只能有策略节点,需要使用分支节点可以先聚合',type:'limit'},
|
||||
{text:'多出口节点需要先定义出口并提交才能连线',type:'limit'},
|
||||
{text:'多出口节点不能同时编辑和连线',type:'limit'},
|
||||
|
||||
]
|
||||
},{
|
||||
title:'版本',
|
||||
cont:[
|
||||
{text:'新建和复制版本会生成一个小版本,小版本部署成功后会变成主版本'},
|
||||
]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
30
h5-enginex-manager/src/components/common/i18n.js
Normal file
30
h5-enginex-manager/src/components/common/i18n.js
Normal file
@@ -0,0 +1,30 @@
|
||||
export const messages = {
|
||||
'zh': {
|
||||
i18n: {
|
||||
breadcrumb: '国际化产品',
|
||||
tips: '通过切换语言按钮,来改变当前内容的语言。',
|
||||
btn: '切换英文',
|
||||
title1: '常用用法',
|
||||
p1: '要是你把你的秘密告诉了风,那就别怪风把它带给树。',
|
||||
p2: '没有什么比信念更能支撑我们度过艰难的时光了。',
|
||||
p3: '只要能把自己的事做好,并让自己快乐,你就领先于大多数人了。',
|
||||
title2: '组件插值',
|
||||
info: 'Element组件需要国际化,请参考 {action}。',
|
||||
value: '文档'
|
||||
}
|
||||
},
|
||||
'en': {
|
||||
i18n: {
|
||||
breadcrumb: 'International Products',
|
||||
tips: 'Click on the button to change the current language. ',
|
||||
btn: 'Switch Chinese',
|
||||
title1: 'Common usage',
|
||||
p1: "If you reveal your secrets to the wind you should not blame the wind for revealing them to the trees.",
|
||||
p2: "Nothing can help us endure dark times better than our faith. ",
|
||||
p3: "If you can do what you do best and be happy, you're further along in life than most people.",
|
||||
title2: 'Component interpolation',
|
||||
info: 'The default language of Element is Chinese. If you wish to use another language, please refer to the {action}.',
|
||||
value: 'documentation'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,427 @@
|
||||
<style>
|
||||
.rule {
|
||||
display: flex;
|
||||
/* margin-left: 5px; */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.Rule_cont {
|
||||
width: 30px;
|
||||
border-top: 1px dashed #C7C6C8;
|
||||
/* border-top: 1px dashed rgb(1,1,1); */
|
||||
margin-top: 7px;
|
||||
flex-grow: 0;
|
||||
height: 1px;
|
||||
/* background-color: #C7C6C8; */
|
||||
margin: 12px 0px 0 0;
|
||||
height: 0;
|
||||
|
||||
}
|
||||
|
||||
.RuleIcon {
|
||||
background-color: #EBEBEB;
|
||||
border: #DADADA 1px solid;
|
||||
border-radius: 4px;
|
||||
padding: 4px 6px 4px 2px;
|
||||
}
|
||||
|
||||
.RuleSelcet .el-input__inner {
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.RuleCont_for_out {
|
||||
border-left: 1px dashed #ccc;
|
||||
border-bottom: 1px dashed #ccc;
|
||||
border-right: 1px dashed #ccc;
|
||||
padding-top: 5px;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="rule" :style="{marginLeft:ZIndex==1?'20px':'0px'}" v-if="data">
|
||||
<div :style="{position: 'absolute',top:'0px', left: '-20px',marginTop: top===0?'0':'8px'}" class="RuleIcon">
|
||||
<el-dropdown trigger="click" @command="handleCommand">
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-s-operation" :style="{color: color[ZIndex%5] ,fontSize: '16px'}"></i>
|
||||
</span>
|
||||
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item icon="el-icon-plus" command="addRule" v-if="data.conditionType!=3">添加规则
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-circle-plus-outline" command="addlogical">添加关系</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-close" command="delect" v-if="ZIndex!=1&&data.conditionType!=4">
|
||||
删除此节点</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div v-if="data.conditionType==1" class="RuleSelcet">
|
||||
|
||||
<div :style="{width: '80px',marginTop: top===0?'0':'8px'}">
|
||||
<el-select v-model="data.logical" placeholder="请选择" size="mini">
|
||||
<el-option :key="1" label="AND" value="&&"></el-option>
|
||||
<el-option :key="2" label="OR" value="||"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 10px;height: 0;border-top: 1px dashed #C7C6C8;margin-top: 19px;margin-left: 5px;">
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
:style="{border: '1px dashed '+ color[ZIndex%5],borderRadius: '5px',paddingRight: '5px',paddingBottom: '5px',position:'relative',minWidth:'30px',minHeight:'40px'}">
|
||||
|
||||
<div
|
||||
:style="{border:'',margin:'',padding:'',paddingLeft:'0px'}">
|
||||
|
||||
<div v-for="(item,index) in data.children" style="display: flex;margin-top: 7px;">
|
||||
<div class="Rule_cont"
|
||||
:style="{marginTop:item.conditionType===0?'12px':(index===0?'11px':'20px')}">
|
||||
</div>
|
||||
<!-- conditionType==2 规则部分 -->
|
||||
<div v-if="item.conditionType==2" style="display: flex;">
|
||||
<!-- {{fieldType}} -->
|
||||
<div v-if="fieldType!='for'" style="display: flex;">
|
||||
<!-- 普通规则部分 -->
|
||||
|
||||
<!-- 不为输出节点 则拉选 fielduser-->
|
||||
<div style="display: flex;">
|
||||
|
||||
<el-select v-model="item.opType" placeholder="请选择" size="mini" style="width: 100px;" @change="emptyOpKey($event,item)">
|
||||
<el-option :key="value.value" :label="value.label" :value="value.value" v-for="value in ruleList"></el-option>
|
||||
</el-select>
|
||||
|
||||
<el-cascader v-if="item.opType!='count'" v-model="item.opKey" filterable size="mini" :options="fieldUserObj" clearable @change="ruleCascaderChange(item)"
|
||||
:key="keyValue+(item.random?item.random:0)" style="margin-left: 10px;" :props="{ expandTrigger: 'hover' }" @visible-change="randomAdd(item,$event)">
|
||||
</el-cascader>
|
||||
<ruleRelation v-model="item.operator" :value2.sync="item.variableValue"
|
||||
:variableType.sync="item.variableType"
|
||||
:valueType="GetValueTypeByJSONEn(item.opKey)" size="mini" :variableDis="[2]"
|
||||
:interceptCustom="true" @CustomCallback="$emit('CustomCallback',item)"
|
||||
></ruleRelation>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<i class="el-icon-circle-close" style="color: #fa4949;margin-left: 5px;"
|
||||
@click="deleteSon(index)"></i>
|
||||
</div>
|
||||
<!-- conditionType==1 关系节点 conditionType==3 for的输出的关系节点 节点部分 -->
|
||||
<div v-if="item.conditionType==1">
|
||||
<!-- {{fieldType}} -->
|
||||
<rule :data="item" :top="index" :ZIndex="ZIndex+1"
|
||||
:index="index" @delectLogical="delectLogical"
|
||||
:ruleList="ruleList"
|
||||
:customUserObj="customUserObj"
|
||||
>
|
||||
</rule>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
import bigElCascader from '@/components/common/bigElCascader.vue'
|
||||
export default {
|
||||
components: {
|
||||
ruleRelation,
|
||||
bigElCascader
|
||||
},
|
||||
name: 'rule',
|
||||
data() {
|
||||
return {
|
||||
color: ['#0D183E', '#409EFF', '#67C23A', '#F56C6C', '#FFCD43'],
|
||||
|
||||
keyValue: 1, //用于给级联选择框重新渲染
|
||||
keyValueReady: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
if (this.data) {
|
||||
if (Array.isArray(this.data.fieldEn)) {
|
||||
if (this.data.fieldEn.length > 0) {
|
||||
this.EnChange(this.data.fieldEn, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
||||
fieldType: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
ZIndex: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
top: {
|
||||
tyep: String,
|
||||
default: '8px'
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
ruleList:{ //算子
|
||||
type:Array||null,
|
||||
default:null
|
||||
},
|
||||
customUserObj:{ //自定义规则下拉
|
||||
type:Array||null,
|
||||
default:null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
fieldUserObj() {
|
||||
|
||||
if(this.customUserObj){
|
||||
return this.customUserObj
|
||||
}else{
|
||||
return []
|
||||
}
|
||||
// if (this.$store.state.FieldUserObj) {
|
||||
// return this.$store.state.FieldUserObj.data.fieldList
|
||||
// } else {
|
||||
// return []
|
||||
// }
|
||||
},
|
||||
fielduserArr() {
|
||||
let arr = []
|
||||
// console.log(11,this.fielduser)
|
||||
if (this.fielduser.length > 1) {
|
||||
if (this.fieldType != "for") { // 如果元素不为 for 则 用fielduser里的 json 格式指标
|
||||
arr = this.fielduser.filter((value) => {
|
||||
return value.valueType == 6
|
||||
})
|
||||
|
||||
arr = arr.map((value) => {
|
||||
let obj = {
|
||||
value: value.fieldEn,
|
||||
label: value.fieldCn,
|
||||
}
|
||||
obj.children = this.getdeepArr(JSON.parse(value.jsonValue))
|
||||
return obj
|
||||
})
|
||||
}
|
||||
// console.log(arr)
|
||||
return arr
|
||||
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
fielduser() {
|
||||
if (this.$store.state.FieldUser) {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
emptyOpKey(e,item){
|
||||
console.log(e,item)
|
||||
if(e=='count'){
|
||||
item.opKey = []
|
||||
}
|
||||
},
|
||||
GetValueTypeByJSONEn(en){
|
||||
if(!en){
|
||||
return
|
||||
}
|
||||
|
||||
console.log(en)
|
||||
|
||||
let obj
|
||||
|
||||
en.forEach((value,index)=>{
|
||||
if(index==0){
|
||||
obj = this.fieldUserObj.find(x=>x.value==value)
|
||||
|
||||
console.log(this.fieldUserObj)
|
||||
console.log(obj)
|
||||
// debugger
|
||||
|
||||
}else{
|
||||
obj = obj.children.find(x=>x.value==value)
|
||||
}
|
||||
})
|
||||
return obj&&obj.valueType
|
||||
},
|
||||
|
||||
getvalueTypebyEn(e) { //通过en 获取 valueType
|
||||
if (!Array.isArray(e)) {
|
||||
return
|
||||
}
|
||||
if (e[0][0] !== '%') {
|
||||
return this.mixinGetValueTypeByEn(e[0])
|
||||
}
|
||||
if (e[e.length - 1] == 'length') {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
EnChange(e, clear = true) {
|
||||
|
||||
this.en = e.join('.')
|
||||
if (!clear) return
|
||||
this.deepClearEn(this.data)
|
||||
},
|
||||
deepClearEn(obj) { // 递归清除用到父级的 en
|
||||
obj.children.forEach(value => {
|
||||
if (Array.isArray(value.fieldEn)) {
|
||||
if (value.fieldEn[0][0] == "%") {
|
||||
value.fieldEn = ""
|
||||
}
|
||||
}
|
||||
if (value.children.length > 0) {
|
||||
this.deepClearEn(value)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
getdeepArr(obj) {
|
||||
if (Array.isArray(obj)) {
|
||||
return false
|
||||
} else if (typeof obj == 'object') {
|
||||
let arr = []
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (Array.isArray(obj[key])) {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key
|
||||
})
|
||||
} else if (typeof obj[key] == 'object') {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key,
|
||||
children: this.getdeepArr(obj[key])
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return arr
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
delectLogical(index) {
|
||||
this.data.children.splice(index, 1)
|
||||
},
|
||||
handleCommand(str) {
|
||||
if (str == "addRule") { //添加规则
|
||||
// console.log(this.data)
|
||||
this.data.children.push({
|
||||
"logical": null,
|
||||
"opKey": '',
|
||||
"operator": "",
|
||||
"variableValue": "",
|
||||
"conditionType": 2,
|
||||
"variableType": 1,
|
||||
"children": [],
|
||||
"opType": "",
|
||||
})
|
||||
|
||||
|
||||
} else if (str == "addlogical") { //添加链接符
|
||||
let obj = {
|
||||
"logical": '&&',
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"conditionType": 1,
|
||||
"children": [],
|
||||
}
|
||||
this.data.children.push(obj)
|
||||
|
||||
|
||||
} else if (str == "delect") {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$emit('delectLogical', this.index)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
deleteSon(index) {
|
||||
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.data.children.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
ruleCascaderChange(item) {
|
||||
item.valueType = this.mixinGetValueTypeByJSONEn(item.fieldEn)
|
||||
item.fieldValue = ""
|
||||
item.operator = ""
|
||||
},
|
||||
|
||||
},
|
||||
watch: {
|
||||
|
||||
fielduserArr() {
|
||||
if (this.keyValueReady) {
|
||||
this.keyValue++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,763 @@
|
||||
<style>
|
||||
.listOp_top {
|
||||
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.listOp_cont {}
|
||||
|
||||
.listOp_table_header {
|
||||
width: 350px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.listOp_table_comm {}
|
||||
|
||||
.listOp_score {
|
||||
width: 199px;
|
||||
height: 80px;
|
||||
text-align: center;
|
||||
line-height: 80px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.listOp_home {
|
||||
border-top: 1px solid #ddd;
|
||||
overflow: scroll;
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<!-- :style="{width:$store.state.barShrink?'95vw':'85vw'}" -->
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="mixinClose"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增集合 :</span>
|
||||
<span v-else>编辑集合 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button :icon="smallHeader?'el-icon-bottom':'el-icon-top'" circle @click="openHeader">
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit" :disabled="addVersionStatus">
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>集合代码: </p>
|
||||
<el-input placeholder="请输入集合代码" maxlength="30" v-model="code" clearable :disabled="addVersionStatus">
|
||||
</el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>集合名称:</p>
|
||||
<el-input placeholder="请输入集合名称" maxlength="20" v-model="name" clearable :disabled="addVersionStatus">
|
||||
</el-input>
|
||||
</div>
|
||||
<!-- <div>
|
||||
<p>集合类型:</p>
|
||||
<el-select v-model="opType" placeholder="请选择类型" @change="opTypeChange"
|
||||
:disabled="addVersionStatus||id!=0">
|
||||
<el-option v-for="item in opTypeList" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div> -->
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_scope MR_scopeSmall':'MR_scope'">
|
||||
<div>
|
||||
<p>集合描述: </p>
|
||||
<el-input placeholder="请输入决策描述" maxlength="300" v-model="description" clearable
|
||||
:disabled="addVersionStatus" style="margin-left: 20px;"></el-input>
|
||||
|
||||
<p style="margin-left: 20px;">有效时间: </p>
|
||||
|
||||
<el-date-picker style="margin:0 20px;width: 500px;" v-model="validTime" type="daterange"
|
||||
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :disabled="addVersionStatus">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<version style="margin:5px;" :id="id" :ruleVersionList="versionList" :version="version" @addVersion="addVersion"
|
||||
@addVersionClose="addVersionClose" @copyVersion="copyVersion" @delectVersion="delectVersion"
|
||||
@updateVersion="updateVersion" @addVersionSure="addVersionSure" :addVersionDialog="addVersionDialog"
|
||||
@Dialog="addVersionDialog=$event" @addVersionExamine="addVersionExamine"
|
||||
:addVersionLoading="addVersionLoading" @versionChange="versionChange" :addVersionStatus="addVersionStatus"
|
||||
@StatusChange="addVersionStatus=$event"></version>
|
||||
<!-- 版本部分 -->
|
||||
|
||||
<div class="listOp_home">
|
||||
|
||||
<opType :opType="opType" :data="version" @changeInputFieldEn="changeInputFieldEn"></opType>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import opType from '@/components/common/listOperation/opType.vue'
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import version from '@/components/common/Version.vue'
|
||||
|
||||
const versionOrigin = {
|
||||
inputFieldEn: [],
|
||||
|
||||
conditionAndOutPutList: [{
|
||||
condition: {
|
||||
logical: "&&",
|
||||
conditionType: 1,
|
||||
children: []
|
||||
},
|
||||
defaultOutput: [],
|
||||
filterCondition: {
|
||||
conditionType: 1,
|
||||
logical: "&&",
|
||||
children: [],
|
||||
variableType: 1
|
||||
},
|
||||
failOutput: [],
|
||||
successOutput: [],
|
||||
listOperationBlock: {
|
||||
name: "",
|
||||
groupFields: [],
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
version,
|
||||
opType
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
nameId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
addVersionStatus: false,
|
||||
addVersionLoading: false,
|
||||
addVersionDialog: false,
|
||||
tempadd: {},
|
||||
loading: false,
|
||||
priority: '',
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
parentId: '',
|
||||
versionList: [],
|
||||
version: {},
|
||||
opType: 2,
|
||||
opTypeList: [{
|
||||
value: 1,
|
||||
label: '集合规则'
|
||||
}, {
|
||||
value: 2,
|
||||
label: '集合处理'
|
||||
}, ],
|
||||
validTime: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getData.getVersion(this.id).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.code = res.data.code
|
||||
this.name = res.data.name
|
||||
this.opType = res.data.opType
|
||||
this.priority = res.data.priority
|
||||
this.description = res.data.description
|
||||
this.parentId = res.data.folderId
|
||||
|
||||
if (res.data.startTime) {
|
||||
this.$set(this.validTime, 0, new Date(res.data.startTime))
|
||||
}
|
||||
if (res.data.endTime) {
|
||||
this.$set(this.validTime, 1, new Date(res.data.endTime))
|
||||
}
|
||||
|
||||
// 版本部分
|
||||
this.versionList = res.data.versionList
|
||||
let obj = JSON.parse(JSON.stringify(this.versionList[0]))
|
||||
|
||||
|
||||
this.Enformat(obj, 'Array')
|
||||
this.version = obj
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 新增初始化
|
||||
this.version = JSON.parse(JSON.stringify(versionOrigin))
|
||||
console.log(this.version)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
changeInputFieldEn(e) {
|
||||
this.version = JSON.parse(JSON.stringify(versionOrigin))
|
||||
this.version.inputFieldEn = e
|
||||
console.log(this.version)
|
||||
},
|
||||
// opTypeChange(e) {
|
||||
// if (e == 1) {
|
||||
// this.version.conditionAndOutPutList = [this.version.conditionAndOutPutList[0]]
|
||||
// } else if (e == 2) {
|
||||
// this.version.groupFields = []
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// },
|
||||
versionChange(e) {
|
||||
let obj = JSON.parse(JSON.stringify(e))
|
||||
this.Enformat(obj, 'Array')
|
||||
|
||||
|
||||
// debugger
|
||||
this.version = obj
|
||||
this.loading = false
|
||||
},
|
||||
addVersionExamine() {
|
||||
|
||||
if (this.getIsempty(this.version)) {
|
||||
return
|
||||
}
|
||||
this.addVersionDialog = true
|
||||
},
|
||||
addVersionSure(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
|
||||
|
||||
let obj = JSON.parse(JSON.stringify(this.version))
|
||||
obj.versionCode = tempVersion.versionCode
|
||||
obj.description = tempVersion.description
|
||||
obj.listOpId = this.id
|
||||
this.Enformat(obj, 'String')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.getData.addVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '添加版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.versionChange(this.versionList[0])
|
||||
|
||||
}
|
||||
this.loading = false
|
||||
this.addVersionStatus = false
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
updateVersion(tempVersion) {
|
||||
if (this.getIsempty(this.version)) {
|
||||
return
|
||||
}
|
||||
this.addVersionLoading = true
|
||||
let obj = JSON.parse(JSON.stringify(this.version))
|
||||
obj.versionCode = tempVersion.versionCode
|
||||
obj.description = tempVersion.description
|
||||
obj.listOpId = this.id
|
||||
this.Enformat(obj, 'String')
|
||||
|
||||
this.getData.updateVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '版本重命名成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.versionChange(this.versionList[0])
|
||||
|
||||
}
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
delectVersion() {
|
||||
this.getData.delectVersion({
|
||||
status: -1,
|
||||
ids: [this.version.id],
|
||||
strategyId: this.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.versionChange(this.versionList[0])
|
||||
}
|
||||
})
|
||||
},
|
||||
copyVersion(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
|
||||
this.getData.copyVersion({
|
||||
listOpId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description
|
||||
}).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '复制版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.versionList = res.data
|
||||
this.versionChange(this.versionList[0])
|
||||
|
||||
}
|
||||
this.loading = false
|
||||
this.addVersionDialog = false
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
addVersionClose() {
|
||||
this.version = this.tempadd
|
||||
this.tempadd = {}
|
||||
},
|
||||
addVersion() {
|
||||
this.tempadd = JSON.parse(JSON.stringify(this.version))
|
||||
|
||||
this.reset()
|
||||
},
|
||||
|
||||
reset() {
|
||||
this.version = JSON.parse(JSON.stringify(versionOrigin))
|
||||
},
|
||||
Enformat(obj, str) {
|
||||
|
||||
obj.inputFieldEn = getformat(obj.inputFieldEn)
|
||||
|
||||
|
||||
// if (str == 'Array') {
|
||||
// obj.groupFields = JSON.parse(obj.groupFields)
|
||||
// }
|
||||
// obj.groupFields = obj.groupFields.map(value => {
|
||||
// return getformat(value)
|
||||
// })
|
||||
// if (str == 'String') {
|
||||
// obj.groupFields = JSON.stringify(obj.groupFields)
|
||||
// }
|
||||
|
||||
obj.conditionAndOutPutList.forEach(value => {
|
||||
value.successOutput.forEach(item => {
|
||||
item.outputOpKey = getformat(item.outputOpKey)
|
||||
if (item.variableType == 2) {
|
||||
item.outputValue = getformat(item.outputValue)
|
||||
}
|
||||
})
|
||||
value.failOutput.forEach(item => {
|
||||
item.outputOpKey = getformat(item.outputOpKey)
|
||||
if (item.variableType == 2) {
|
||||
item.outputValue = getformat(item.outputValue)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if (str == 'Array') {
|
||||
if(value.listOperationBlock.groupFields){
|
||||
|
||||
value.listOperationBlock.groupFields = JSON.parse(value.listOperationBlock.groupFields)
|
||||
}else{
|
||||
value.listOperationBlock.groupFields = []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
value.listOperationBlock.groupFields = value.listOperationBlock.groupFields.map(item => {
|
||||
return getformat(item)
|
||||
})
|
||||
if (str == 'String') {
|
||||
value.listOperationBlock.groupFields = JSON.stringify(value.listOperationBlock.groupFields)
|
||||
}
|
||||
|
||||
value.filterCondition.children.forEach(item => {
|
||||
item.opKey = getformat(item.opKey)
|
||||
})
|
||||
|
||||
deepformat([value.condition])
|
||||
|
||||
// if(value.condition.children.length>0){
|
||||
// value.defaultOutput = []
|
||||
// }else{
|
||||
// value.defaultOutput = value.successOutput
|
||||
// }
|
||||
|
||||
})
|
||||
|
||||
function deepformat(arr) {
|
||||
arr.forEach(value => {
|
||||
if (value.children && value.children.length > 0) {
|
||||
deepformat(value.children)
|
||||
}
|
||||
|
||||
if (value.conditionType == 2) {
|
||||
value.opKey = getformat(value.opKey)
|
||||
|
||||
if (value.variableType == 2) {
|
||||
value.variableValue = getformat(value.variableValue)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function getformat(arr) {
|
||||
if (str == "String") {
|
||||
// debugger
|
||||
return arr.join('.')
|
||||
} else {
|
||||
return arr.split('.')
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
examine() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.code.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return true
|
||||
}
|
||||
if (this.verificationCode(this.code) || this.verificationName(this.name)) {
|
||||
return true
|
||||
}
|
||||
if (this.code.trim() == '') {
|
||||
this.$message.error('请填入集合代码,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.name.trim() == '') {
|
||||
this.$message.error('请填入集合名称,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.description.trim() == '') {
|
||||
this.$message.error('请填入集合描述,并检查空格');
|
||||
return true
|
||||
}
|
||||
|
||||
let is = {
|
||||
is: false,
|
||||
msg: '提交失败,请检查是否有未填项'
|
||||
}
|
||||
|
||||
|
||||
if (is.is) {
|
||||
this.$message.error(is.msg)
|
||||
return true
|
||||
}
|
||||
|
||||
},
|
||||
getIsempty(obj) {
|
||||
let is = {
|
||||
is: false,
|
||||
msg: ''
|
||||
}
|
||||
|
||||
|
||||
if (!obj.inputFieldEn || obj.inputFieldEn.length == 0) {
|
||||
is.is = true
|
||||
is.msg = '请选择 数据 '
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
obj.conditionAndOutPutList.forEach(value => {
|
||||
value.filterCondition.children.forEach(value => {
|
||||
if (!value.opKey || value.opKey.length == 0) {
|
||||
is.is = true
|
||||
is.msg = '请选择 过滤的 Key'
|
||||
}
|
||||
|
||||
|
||||
if (!value.variableValue || value.variableValue.trim() == '') {
|
||||
is.is = true
|
||||
is.msg = '请填写 过滤 的值'
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
value.listOperationBlock.groupFields.forEach(value => {
|
||||
// debugger
|
||||
if (value.length == 0 || !value[0]) {
|
||||
is.is = true
|
||||
is.msg = '请选择 分组 '
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if (is.is) {
|
||||
return
|
||||
}
|
||||
|
||||
value.successOutput.forEach(item => {
|
||||
forVerify(is, item, '命中')
|
||||
})
|
||||
|
||||
if (is.is) {
|
||||
return
|
||||
}
|
||||
|
||||
value.failOutput.forEach(item => {
|
||||
forVerify(is, item, '未命中')
|
||||
})
|
||||
|
||||
if (is.is) {
|
||||
return
|
||||
}
|
||||
|
||||
deepexamine(is, [value.condition])
|
||||
if (is.is) {
|
||||
return
|
||||
}
|
||||
|
||||
this.verify(is, value.successOutput, '命中')
|
||||
if (is.is) {
|
||||
return
|
||||
}
|
||||
this.verify(is, value.failOutput, '命中')
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if (is.is) {
|
||||
this.$message.error(is.msg)
|
||||
}
|
||||
return is.is
|
||||
|
||||
|
||||
|
||||
function forVerify(is, item, str) {
|
||||
|
||||
console.log(item)
|
||||
if (!item.outputKey.trim()) {
|
||||
is.is = true
|
||||
is.msg = `请输入${str}输出的KEY`
|
||||
}
|
||||
if (!item.outputOp) {
|
||||
is.is = true
|
||||
is.msg = `请选择${str}输出的算子`
|
||||
}
|
||||
if (!item.outputOpKey) {
|
||||
is.is = true
|
||||
is.msg = `请选择${str}输出的 计算条件`
|
||||
}
|
||||
|
||||
if (item.outputOp != 'custom' && item.outputOp != 'list_element' && item.outputOp !=
|
||||
'count') { //如果不为自定义
|
||||
console.log(item)
|
||||
if (!item.outputOpKey || item.outputOpKey.length == 0 || !item.outputOpKey[0]) {
|
||||
is.is = true
|
||||
is.msg = `请输入${str}输出的 计算依赖(只有算子为集合时可以不选择计算依赖)`
|
||||
}
|
||||
} else if (item.outputOp == 'custom') {
|
||||
// if (item.variableType != 2) {
|
||||
if (!item.outputValue || !item.outputValue.trim()) {
|
||||
is.is = true
|
||||
is.msg = `请输入${str}输出的 值`
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function 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.opType) {
|
||||
is.is = true
|
||||
is.msg = '请选择 条件 的 算子'
|
||||
}
|
||||
if (!value.opKey) {
|
||||
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 = '关系符下不允许为空'
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
verify(is, item, str) {
|
||||
let arr = []
|
||||
|
||||
item.forEach(value => {
|
||||
|
||||
|
||||
if (value.outputOp == 'custom' && value.variableType == 3) {
|
||||
console.log(value)
|
||||
|
||||
let obj = JSON.parse(value.outputValue)
|
||||
let sarr = obj.formula.match(/@.*?@/)
|
||||
if (sarr != null) {
|
||||
sarr.forEach(cont => {
|
||||
let subStr = cont
|
||||
subStr = subStr.substring(1, subStr.length - 1)
|
||||
if (!this.FieldUser.find(x => x.fieldCn == subStr) && !arr.find(x => x ==
|
||||
subStr)) {
|
||||
is.is = true
|
||||
is.msg = `自定义中使用输出Key 只能使用同块并且在自身之上的Key 违规Key:${subStr}`
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
arr.push(value.outputKey)
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
this.loading = true
|
||||
if (this.examine()) {
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
if (this.getIsempty(this.version)) {
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
|
||||
let sobj = JSON.parse(JSON.stringify(this.version))
|
||||
sobj.inputFieldType = 'list'
|
||||
this.Enformat(sobj, 'String')
|
||||
|
||||
let obj = {
|
||||
"code": this.code.trim(),
|
||||
"name": this.name.trim(),
|
||||
"description": String(this.description).trim(),
|
||||
"opType": this.opType,
|
||||
"versionList": [sobj],
|
||||
"startTime": this.validTime && this.validTime[0] ? this.validTime[0] : null,
|
||||
"endTime": this.validTime && this.validTime[1] ? this.validTime[1] : null,
|
||||
}
|
||||
|
||||
if (this.id == 0) {
|
||||
obj.versionList[0].versionCode = 'V:0'
|
||||
obj.versionList[0].description = '初始版本'
|
||||
obj.folderId = this.nameId == 99999999 ? 0 : this.nameId,
|
||||
this.getData.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.versionList = res.data.versionList
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.$emit('Ok')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.folderId = this.parentId
|
||||
obj.versionList[0].id = this.version.id
|
||||
obj.versionList[0].listOpId = this.id
|
||||
|
||||
this.getData.updatafield(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.versionList = res.data.versionList
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
computed: {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,239 @@
|
||||
|
||||
<template>
|
||||
<div class="cont_cont">
|
||||
|
||||
<div class="cont_left" v-loading="leftloading" v-if="!listRedact">
|
||||
<div class="cont_header">
|
||||
<p class="cont_header_title">{{title}}</p>
|
||||
<p class="cont_header_subtitle">{{title}}</p>
|
||||
</div>
|
||||
<contNewFule v-model="tempNewF" :newf.sync="newf" @newFileSure="newFileSure" @newFile="newFile" ></contNewFule>
|
||||
|
||||
<div class="cont_list">
|
||||
|
||||
|
||||
<fileHome :data="list" @curr="clickCurrid" :currid="currid" @RenameFun="RenameFun" @RenameClose="RenameClose"
|
||||
@updatafilelist="updatafilelist" @delectFun="delectFun">
|
||||
</fileHome>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cont_right" v-loading="contloading" @click="tempHintLeft=null;tempHintTop=null;" >
|
||||
<div v-if="!listRedact">
|
||||
<div v-if="showRight===false" class="cont_right_hint">
|
||||
请先选择左侧文件夹
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="cont_right_top">
|
||||
<div>
|
||||
<el-button type="primary" @click="listRedact=true" :disabled="currid!=99999999?false:'disabled'">新增</el-button>
|
||||
<el-button type="danger" @click="using(-1);$store.dispatch('regetcache', 'decisionTree')" :disabled="this.selection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button type="success" @click="using(1)" :disabled="this.selection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button type="warning" @click="using(0)" :disabled="this.selection.length>0?false:'disabled'">停用</el-button>
|
||||
<el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'"
|
||||
filterable @change="mixinMoveChange">
|
||||
<el-option v-for="value in listunfold" :key="value.id" :label="value.name" :value="value.id" v-show="value.id!=99999999"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-input placeholder="请输入搜索内容" v-model="search">
|
||||
<i slot="suffix" class="el-input__icon el-icon-search" @click="getsearch"></i>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right_cont">
|
||||
<div v-if="data">
|
||||
<el-table border :data="data.data.klist" @select-all="selectAll" @select="select" style="width: 100%"
|
||||
:cell-style="{padding: '10px'}">
|
||||
<el-table-column type="selection" width="70">
|
||||
</el-table-column>
|
||||
<el-table-column v-for="item in getData.row" :key="item.id" :prop="item.row" :label="item.label" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="item.type==='Blooen'">
|
||||
{{scope.row[item.row]?"是":"否"}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='State'">
|
||||
{{scope.row[item.row]==1?'启用':'未启用'}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='Time'" style="white-space: nowrap;" class="contText">{{
|
||||
new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row[item.row]).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
<span v-else-if="item.fn">
|
||||
<!-- {{scope.row[item.row]}} -->
|
||||
{{item.fn(scope.row[item.row])}}
|
||||
</span>
|
||||
<span class="contText" v-else>
|
||||
{{scope.row[item.row]}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-button icon="el-icon-setting" circle size="mini" @click="dialogShow(scope.row.id)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="float: right;margin-right: 40px;margin-top: 40px;" :current-page="currPage"
|
||||
@current-change="clickpage" background layout="prev, pager, next" :total="data.data.pageInfo.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="listRedact" style="height: 100%;overflow: hidden;">
|
||||
<dataManageRedact v-if="listRedact" @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist()" :getData="getData"
|
||||
:id='tempRedactId' :nameId="currid" :type="getData.type"></dataManageRedact>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import contNewFule from '@/components/common/contNewFile.vue'
|
||||
import '@/assets/css/cont.css'
|
||||
import fileHome from '@/components/common/fileHome.vue'
|
||||
import dataManageRedact from './listOpManageRedact.vue'
|
||||
import contmixin from '@/utils/contminxin/contmixin.js'
|
||||
export default {
|
||||
mixins: [
|
||||
contmixin
|
||||
],
|
||||
components: {
|
||||
fileHome,
|
||||
dataManageRedact,
|
||||
contNewFule
|
||||
},
|
||||
created() {
|
||||
|
||||
this.getData.getTree({
|
||||
parentId: 0,
|
||||
treeType: this.getData.treeType,
|
||||
type: 1
|
||||
}).then(res => {
|
||||
this.list = this.listTreeDeep(res.data, 1)
|
||||
this.clickCurrid(99999999)
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
list() {
|
||||
if (this.list.length > 0) {
|
||||
this.leftloading = false
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
tempMove: '',
|
||||
leftloading: true,
|
||||
search: "",
|
||||
fileName: "",
|
||||
fileList: [],
|
||||
upShow: false,
|
||||
currPage: 1,
|
||||
currid: null,
|
||||
data: null,
|
||||
contloading: false,
|
||||
newf: false,
|
||||
tempNewF: "",
|
||||
listRedact: false, //新增页面开启
|
||||
tempRedactId: 0,
|
||||
selection: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
getsearch() {
|
||||
this.contloading = true
|
||||
let params = {
|
||||
entity: {
|
||||
name: this.search,
|
||||
"folderId": String(this.currid) === "99999999" ? '' : String(this.currid),
|
||||
},
|
||||
key: "ruleName",
|
||||
status: "0,1",
|
||||
|
||||
"pageNum": 1,
|
||||
isSearch: 1
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
this.currPage = 1
|
||||
},
|
||||
|
||||
getlist() {
|
||||
this.contloading = true
|
||||
this.listRedact = false
|
||||
let params = {
|
||||
status: "0,1",
|
||||
entity: {},
|
||||
"pageNum": 1
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.entity.folderId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
|
||||
},
|
||||
clickpage(e) {
|
||||
this.currPage = e
|
||||
this.contloading = true
|
||||
let params = {
|
||||
status: "0,1",
|
||||
entity: {},
|
||||
"pageNum": e
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.entity.folderId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
if (res.status == 1) {
|
||||
this.data = res
|
||||
this.selection = []
|
||||
this.contloading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
newFileSure() {
|
||||
this.leftloading = true
|
||||
let params = {
|
||||
parentId: String(this.currid),
|
||||
name: this.tempNewF,
|
||||
"treeType":this.getData.treeType,
|
||||
"type": "1",
|
||||
"engineId": ""
|
||||
}
|
||||
if(this.mixnewFileZindexVerify(this.list,this.currid)==6){
|
||||
this.$message.error('已达到最深层级')
|
||||
this.leftloading = false
|
||||
return
|
||||
}
|
||||
this.mixnewFileSure(params)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,646 @@
|
||||
<style>
|
||||
.opType1_subbtitle {
|
||||
color: #666;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.opType2Cont {
|
||||
background-color: #fff;
|
||||
padding: 5px;
|
||||
margin-top: 10px;
|
||||
border-radius: 10px;
|
||||
border: 1px dotted #aaa
|
||||
}
|
||||
|
||||
.opTypeRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
border-bottom: 1px dotted #eee;
|
||||
padding-bottom: 10px;
|
||||
|
||||
}
|
||||
|
||||
.opTypeRow>p:nth-of-type(1) {
|
||||
width: 100px;
|
||||
|
||||
}
|
||||
|
||||
.opTypeDelete {
|
||||
color: red;
|
||||
margin-left: 10px;
|
||||
font-size: 24px;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.opType_ps {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
|
||||
<div style="padding: 10px;">
|
||||
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
数据:
|
||||
</p>
|
||||
<div>
|
||||
<el-cascader v-model="data.inputFieldEn" filterable :options="FieldUserArr"
|
||||
:key="(data.random?data.random:0)" @visible-change="randomAdd(data,$event)"
|
||||
:props="{ expandTrigger: 'hover' }" @change="$emit('changeInputFieldEn',data.inputFieldEn)">
|
||||
</el-cascader>
|
||||
|
||||
<p class="opType_ps">
|
||||
*切换数据源会重置下面所选的信息 请谨慎切换
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div :class="opType==2?'opType2Cont':''" v-for="(value,index) in data.conditionAndOutPutList"
|
||||
v-if="index==0||opType==2" style="position: relative;">
|
||||
|
||||
<div class="opTypeRow" v-if="opType==2">
|
||||
<p class="opType1_subbtitle">
|
||||
运算
|
||||
</p>
|
||||
<el-input v-model="value.listOperationBlock.name" style="width: 220px;"></el-input>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
过滤
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<div v-if="value.filterCondition.children&&value.filterCondition.children.length>0&&ValueObj">
|
||||
|
||||
<div v-for="(item,index) in value.filterCondition.children"
|
||||
style="margin-bottom: 10px;display: flex;align-items: center;">
|
||||
<el-cascader v-if="item.operator!='black_list'" v-model="item.opKey" filterable
|
||||
:options="ValueObj" :key="cascaKey+(item.random?item.random:0)"
|
||||
@visible-change="randomAdd(item,$event)" :props="{ expandTrigger: 'hover' }"
|
||||
style="margin-right: 20px;"></el-cascader>
|
||||
|
||||
|
||||
<el-select v-model="item.operator" placeholder="请选择" @change="operatorChange(item)"
|
||||
style="margin-right: 20px;">
|
||||
<el-option v-for="cont in filterOptions" :key="cont.value" :label="cont.label"
|
||||
:value="cont.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-input v-model="item.variableValue" placeholder="请以逗号分割"
|
||||
v-if="item.operator!='black_list'">
|
||||
</el-input>
|
||||
|
||||
|
||||
<varialeSelect v-if="item.operator=='black_list'" :variableType.sync="item.variableType"
|
||||
:disabled="[1,2]" :variableCascaderValue="ValueObj" :variableCascader="true"
|
||||
size="medium" height="36px" v-model="item.variableValue" :interceptCustom="true"
|
||||
@CustomCallback="CustomCallback(item,'variableValue','blackList')" style="margin-left: 10px;">
|
||||
</varialeSelect>
|
||||
|
||||
|
||||
|
||||
<i class="el-icon-circle-close" style="color: red;margin-left: 10px;"
|
||||
@click="deleteFilterCondition(value.filterCondition.children,index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
<el-button @click="addfilterCondition(value.filterCondition.children)">+</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
分组
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<div
|
||||
v-if="value.listOperationBlock.groupFields&&value.listOperationBlock.groupFields.length>0&&ValueObj">
|
||||
|
||||
<div v-for="(item,index) in value.listOperationBlock.groupFields" style="margin-bottom: 10px;">
|
||||
<el-cascader v-model="value.listOperationBlock.groupFields[index]" filterable :options="ValueObj"
|
||||
:key="cascaKey+(item.random?item.random:0)" @visible-change="randomAdd(item,$event)"
|
||||
:props="{ expandTrigger: 'hover' }"></el-cascader>
|
||||
<i class="el-icon-circle-close" style="color: red;margin-left: 10px;"
|
||||
@click="deleteGroupFields(value.listOperationBlock.groupFields,index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
<el-button @click="addgroupFields(value.listOperationBlock.groupFields)">+</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
条件
|
||||
</p>
|
||||
<rule :data="value.condition" :ZIndex="1" :ruleList="opTypeList" :customUserObj="ValueObj"
|
||||
@CustomCallback="CustomCallback"></rule>
|
||||
|
||||
</div>
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
命中输出:
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<listOutPut :list="value.successOutput"
|
||||
:option="[...opTypeList,{label:'集合',value:'list_element'},{label:'自定义',value:'custom'}]"
|
||||
@CustomCallback="CustomCallback($event,'outputValue')" :ValueObj="ValueObj"></listOutPut>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="opTypeRow">
|
||||
<p class="opType1_subbtitle">
|
||||
未命中输出:
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<listOutPut :list="value.failOutput"
|
||||
:option="[...opTypeList,{label:'集合',value:'list_element'},{label:'自定义',value:'custom'}]"
|
||||
@CustomCallback="CustomCallback($event,'outputValue')" :ValueObj="ValueObj"></listOutPut>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<p v-if="index>0">
|
||||
<i class="el-icon-circle-close opTypeDelete" @click="deleteConditionAndOutPutList(index)"></i>
|
||||
</p>
|
||||
</div>
|
||||
<el-button type="primary" v-if="opType==2" style="margin: 10px 0 40px 0;" @click="addConditionAndOutPutList"
|
||||
plain>
|
||||
添加处理</el-button>
|
||||
|
||||
|
||||
|
||||
|
||||
<el-dialog title="值编辑器" v-if="dialogVisible" :visible.sync="dialogVisible" width="70%"
|
||||
:close-on-click-modal="false" append-to-body @close="reSetTemp">
|
||||
<teParam v-if="dialogVisible" v-model="tempValue" :paramList="tempParam" :tempAddOpkey="tempAddOpkey" :Disabled="teParamdisabled"
|
||||
:variableCascaderValue="ValueObj">
|
||||
</teParam>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible=false;reSetTemp()">取 消</el-button>
|
||||
<el-button type="primary" @click="valueCompileCallback()">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import listOutPut from '@/components/common/listOutput.vue'
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
import teParam from '@/components/common/teParam.vue'
|
||||
import rule from './RuleCont.vue'
|
||||
import {
|
||||
GetdeepObj
|
||||
} from '@/utils/GetdeepObj.js'
|
||||
export default {
|
||||
components: {
|
||||
rule,
|
||||
teParam,
|
||||
varialeSelect,
|
||||
listOutPut
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
valueCompileCallback: () => {}, //值编辑器确定回调
|
||||
dialogVisible: false,
|
||||
tempValue: '',
|
||||
tempParam: [],
|
||||
cascaKey: 0, //用于级联选择框重新渲染
|
||||
opTypeList: [{ //算子
|
||||
label: '个数',
|
||||
value: 'count'
|
||||
},
|
||||
{
|
||||
label: '去重个数',
|
||||
value: 'distinct_count'
|
||||
},
|
||||
{
|
||||
label: '最大',
|
||||
value: 'max'
|
||||
},
|
||||
{
|
||||
label: '最小',
|
||||
value: 'min'
|
||||
},
|
||||
{
|
||||
label: '平均',
|
||||
value: 'avg'
|
||||
},
|
||||
],
|
||||
tempAddOpkey: [], //用于命中未命中弹窗中选择 之前的
|
||||
filterOptions: [{
|
||||
value: 'in',
|
||||
label: 'in'
|
||||
}, {
|
||||
value: 'not in',
|
||||
label: 'not in'
|
||||
}, {
|
||||
value: 'black_list',
|
||||
label: '匹配名单库'
|
||||
}],
|
||||
teParamdisabled:false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
opType: {
|
||||
type: Number,
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// if (!Array.isArray(this.data.groupFields)) {
|
||||
// this.data.groupFields = [
|
||||
// ['']
|
||||
// ]
|
||||
// }
|
||||
console.log(this.data)
|
||||
|
||||
},
|
||||
methods: {
|
||||
operatorChange(item) {
|
||||
if (item.operator == 'black_list') {
|
||||
item.opKey = ['']
|
||||
item.variableType = 3
|
||||
} else {
|
||||
item.variableType = 1
|
||||
}
|
||||
item.variableValue = ''
|
||||
},
|
||||
|
||||
deleteFilterCondition(item, index) {
|
||||
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
item.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
|
||||
addfilterCondition(value) {
|
||||
if (!this.ValueObj) {
|
||||
this.$message.error('此数据下无可用字段')
|
||||
return
|
||||
}
|
||||
value.push({
|
||||
children: [],
|
||||
conditionType: 2,
|
||||
logical: null,
|
||||
variableType: 1,
|
||||
variableValue: "",
|
||||
opKey: [],
|
||||
operator: "in"
|
||||
})
|
||||
},
|
||||
reSetTemp() {
|
||||
this.tempValue = '';
|
||||
this.valueCompileCallback = () => {};
|
||||
this.tempParam = []
|
||||
|
||||
this.teParamdisabled = false
|
||||
|
||||
},
|
||||
deleteConditionAndOutPutList(index) {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.data.conditionAndOutPutList.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
|
||||
},
|
||||
addConditionAndOutPutList() {
|
||||
this.data.conditionAndOutPutList.push({
|
||||
condition: {
|
||||
logical: "&&",
|
||||
conditionType: 1,
|
||||
children: []
|
||||
},
|
||||
defaultOutput: [],
|
||||
failOutput: [],
|
||||
successOutput: [],
|
||||
filterCondition: {
|
||||
conditionType: 1,
|
||||
logical: "&&",
|
||||
children: [],
|
||||
variableType: 1
|
||||
},
|
||||
listOperationBlock: {
|
||||
name: "",
|
||||
groupFields: [],
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
CustomCallback(item, key = "variableValue",type="") {
|
||||
// console.log(item)
|
||||
if (!item[key]) {
|
||||
item[key] = JSON.stringify({
|
||||
farr: [],
|
||||
formula: ''
|
||||
})
|
||||
}
|
||||
this.tempValue = JSON.parse(item[key]).formula
|
||||
this.tempParam = JSON.parse(item[key]).farr.filter(x=>!x.temp)
|
||||
|
||||
if (item.arr) {
|
||||
this.tempAddOpkey = item.arr.map(x => {
|
||||
return {
|
||||
fieldEn: x,
|
||||
fieldCn: x,
|
||||
id: parseInt(Math.random() * -9999),
|
||||
outputKey: true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if(type =='blackList'){
|
||||
console.log(type)
|
||||
this.teParamdisabled = true
|
||||
}
|
||||
|
||||
|
||||
this.dialogVisible = true
|
||||
// console.log(this.tempParam)
|
||||
|
||||
this.tempParam.forEach(value => {
|
||||
value.paramList = value.paramList ? value.paramList.map(item => {
|
||||
item.value = item.type == 2 ? item.value.split('.') : item.value
|
||||
return item
|
||||
}) : []
|
||||
})
|
||||
|
||||
|
||||
|
||||
this.valueCompileCallback = () => {
|
||||
|
||||
let arr = JSON.parse(JSON.stringify(this.tempParam))
|
||||
|
||||
let obj = {
|
||||
farr: arr.map(value => {
|
||||
return {
|
||||
fieldCn: value.fieldCn,
|
||||
fieldEn: value.fieldEn,
|
||||
id: value.id,
|
||||
valueType: value.valueType,
|
||||
sqlStatement: value.sqlStatement,
|
||||
jsonValue: value.jsonValue,
|
||||
paramList: value.paramList ? value.paramList.map(cont => {
|
||||
cont.value = cont.type == 2 ? cont.value.join('.') : cont.value
|
||||
return cont
|
||||
}) : ''
|
||||
}
|
||||
}),
|
||||
formula: this.tempValue
|
||||
}
|
||||
|
||||
if(type=='blackList'){
|
||||
obj.formula = obj.farr[0]?`@${obj.farr[0].fieldCn}@`:''
|
||||
}
|
||||
|
||||
if (this.examineVariableValue(obj)) {
|
||||
return
|
||||
}
|
||||
|
||||
let arr2 = obj.formula.match(/@.*?@/g)
|
||||
|
||||
if(arr2){
|
||||
arr2 = arr2.filter(value=> !obj.farr.find(x=>x.fieldCn==value.substring(1,value.length-1)) )
|
||||
|
||||
arr2 = arr2.map(value=>{
|
||||
return {
|
||||
fieldCn:value.substring(1,value.length-1),
|
||||
fieldEn:value.substring(1,value.length-1),
|
||||
temp : true,
|
||||
valueType:1
|
||||
}
|
||||
})
|
||||
obj.farr.push(...arr2)
|
||||
|
||||
}
|
||||
|
||||
item[key] = JSON.stringify(obj)
|
||||
this.dialogVisible = false
|
||||
this.reSetTemp()
|
||||
// console.log(item)
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
examineVariableValue(obj) {
|
||||
let is = {
|
||||
is: false,
|
||||
msg: ''
|
||||
}
|
||||
|
||||
if (!obj.formula) {
|
||||
is.is = true
|
||||
is.msg = '请输入自定义内容'
|
||||
}
|
||||
|
||||
obj.farr.forEach(value => {
|
||||
if (!value.id || !value.fieldEn) {
|
||||
is.is = true
|
||||
is.msg = '请选择入参指标'
|
||||
}
|
||||
|
||||
if (value.paramList && value.paramList.length > 0) {
|
||||
value.paramList.forEach(item => {
|
||||
if (!item.value) {
|
||||
is.is = true
|
||||
is.msg = '请输入入参指标的次级参数'
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
// 验证是否有重名
|
||||
let DuplicatesArr = obj.farr.map(x => x.id)
|
||||
let DuplicatesArr2 = Array.from(new Set(DuplicatesArr))
|
||||
|
||||
if (DuplicatesArr.length !== DuplicatesArr2.length) {
|
||||
is.is = true
|
||||
is.msg = '请查看入参是否有重名'
|
||||
}
|
||||
|
||||
|
||||
// console.log(obj)
|
||||
let arr = obj.formula.match(/@.*?@/g)
|
||||
|
||||
if (arr) {
|
||||
arr.forEach(value => {
|
||||
if (!obj.farr.find(x => x.fieldCn == value.substring(1, value.length - 1)) && !this
|
||||
.tempAddOpkey.find(x => x.fieldCn == value.substring(1, value.length - 1))) {
|
||||
is.is = true
|
||||
is.msg = '请检查是否有 未入参 但已使用的 字段'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (is.is) {
|
||||
this.$message.error(is.msg)
|
||||
}
|
||||
return is.is
|
||||
|
||||
},
|
||||
deleteGroupFields(item, index) {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
item.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
addgroupFields(value) { //添加分组
|
||||
console.log(value)
|
||||
if (!this.ValueObj) {
|
||||
this.$message.error('此数据下无可用字段')
|
||||
return
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.push([''])
|
||||
// this.$set(value.groupFields,0,[''])
|
||||
} else {
|
||||
value = [
|
||||
['']
|
||||
]
|
||||
// this.$set(value,'groupFields',[['']])
|
||||
}
|
||||
},
|
||||
|
||||
getdeepArr(obj) {
|
||||
if (Array.isArray(obj)) {
|
||||
return false
|
||||
} else if (typeof obj == 'object') {
|
||||
let arr = []
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (Array.isArray(obj[key])) {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key
|
||||
})
|
||||
} else if (typeof obj[key] == 'object') {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key,
|
||||
children: this.getdeepArr(obj[key])
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
if (!this.$store.state.FieldUser) {
|
||||
return []
|
||||
} else {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
}
|
||||
},
|
||||
FieldUserObj() {
|
||||
if (!this.$store.state.FieldUserObj) {
|
||||
return []
|
||||
} else {
|
||||
return this.$store.state.FieldUserObj.data.fieldList
|
||||
}
|
||||
},
|
||||
FieldUserArr() {
|
||||
if (this.FieldUserObj.length == 0) {
|
||||
return []
|
||||
} else {
|
||||
let arr = this.FieldUser.filter((value) => {
|
||||
return value.valueType == 6
|
||||
})
|
||||
|
||||
arr = arr.map((value) => {
|
||||
let obj = {
|
||||
value: value.fieldEn,
|
||||
label: value.fieldCn,
|
||||
}
|
||||
obj.children = this.getdeepArr(JSON.parse(value.jsonValue))
|
||||
return obj
|
||||
})
|
||||
// console.log(arr)
|
||||
return arr
|
||||
}
|
||||
},
|
||||
ValueObj() { //分组输入字段 的 元素 Obj
|
||||
|
||||
|
||||
if (this.data.inputFieldEn && this.data.inputFieldEn.length > 0) {
|
||||
let obj = this.FieldUserObj.find(x => x.value == this.data.inputFieldEn[0])
|
||||
obj = JSON.parse(obj.jsonValue)
|
||||
this.data.inputFieldEn.forEach((value, index) => {
|
||||
|
||||
if (index) {
|
||||
obj = obj[value]
|
||||
}
|
||||
|
||||
})
|
||||
obj = obj[0]
|
||||
obj = GetdeepObj(obj, false)
|
||||
this.cascaKey++
|
||||
|
||||
return obj
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
114
h5-enginex-manager/src/components/common/listOutput.vue
Normal file
114
h5-enginex-manager/src/components/common/listOutput.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div v-for="(value,index) in list" style="width: 800px;display: flex;align-items: center;margin-bottom: 10px;">
|
||||
<el-input v-model="value.outputKey" placeholder="请输入Key" style="width: 160px;margin-right: 10px;">
|
||||
</el-input>
|
||||
:
|
||||
|
||||
<el-select v-model="value.outputOp" clearable placeholder="请选择" style="width: 120px;margin-left: 10px;"
|
||||
@change="Opchange(value)">
|
||||
<el-option v-for="item in option" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-cascader v-model="value.outputOpKey" filterable :options="ValueObj" clearable placeholder="请选择计算依赖"
|
||||
v-if="value.outputOp!='custom'&&value.outputOp!='count'" :key="(value.random?value.random:0)" style="margin-left: 10px;"
|
||||
:props="{ expandTrigger: 'hover' }" @visible-change="randomAdd(value,$event)">
|
||||
</el-cascader>
|
||||
|
||||
|
||||
|
||||
<varialeSelect v-if="value.outputOp=='custom'" :variableType.sync="value.variableType" :disabled="[2]"
|
||||
:variableCascaderValue="ValueObj" :variableCascader="true" size="medium" height="36px"
|
||||
v-model="value.outputValue" :interceptCustom="true" @CustomCallback="CustomCallback(value,list,index)"
|
||||
style="margin-left: 10px;">
|
||||
</varialeSelect>
|
||||
|
||||
|
||||
<i class="el-icon-circle-close" style="color: red;margin-left: 10px;" @click="deleteOutput(index)"></i>
|
||||
</div>
|
||||
<el-button @click="addOutput">+</el-button>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
components: {
|
||||
varialeSelect
|
||||
},
|
||||
props: {
|
||||
ValueObj: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
option: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
CustomCallback(value,list,index) {
|
||||
|
||||
let arr = JSON.parse(JSON.stringify(list))
|
||||
|
||||
arr = list.filter((value,index2) =>index2<index)
|
||||
arr = arr.map(value => value.outputKey)
|
||||
value.arr = []
|
||||
value.arr = arr
|
||||
this.$emit('CustomCallback', value)
|
||||
},
|
||||
|
||||
Opchange(value) {
|
||||
|
||||
value.variableType = 1
|
||||
value.outputValue = ''
|
||||
value.outputOpKey = []
|
||||
|
||||
|
||||
},
|
||||
deleteOutput(index) {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.list.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
},
|
||||
addOutput() {
|
||||
this.list.push({
|
||||
outputKey: '',
|
||||
outputOp: '',
|
||||
variableType: 1,
|
||||
outputValue: '',
|
||||
outputOpKey: []
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
15
h5-enginex-manager/src/components/common/miniSCO.vue
Normal file
15
h5-enginex-manager/src/components/common/miniSCO.vue
Normal file
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
146
h5-enginex-manager/src/components/common/multipleRule.vue
Normal file
146
h5-enginex-manager/src/components/common/multipleRule.vue
Normal file
@@ -0,0 +1,146 @@
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<el-dialog width="40%" title="选择规则" :visible="visible" @update:visible="$emit('update:visible',$event)"
|
||||
@close="close" append-to-body>
|
||||
|
||||
<div style="display: flex;justify-content: flex-end;padding: 10px;">
|
||||
|
||||
<el-select v-if="folderList.length>0" v-model="folderid" placeholder="请选择文件夹" size="mini">
|
||||
<el-option v-for="item in folderList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-input v-model="search" placeholder="搜索" size="mini" style="width: 200px;margin: 0 10px;"></el-input>
|
||||
</div>
|
||||
|
||||
<el-checkbox-group v-model="tempRule">
|
||||
<el-table :data="list" style="width: 100%">
|
||||
|
||||
<el-table-column width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-checkbox :label="scope.row.id+'/'+scope.row.versionId">{{""}}</el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="name" label="名称">
|
||||
</el-table-column>
|
||||
<el-table-column prop="code" label="code">
|
||||
</el-table-column>
|
||||
<el-table-column label="版本">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.versionId" placeholder="请选择版本" size="mini"
|
||||
@change="versionChange(scope.row.id)">
|
||||
<el-option v-for="item in scope.row.versionList" :key="item.id"
|
||||
:label="item.versionCode" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-checkbox-group>
|
||||
<div style="display: flex;justify-content: flex-end;padding: 10px;">
|
||||
<el-pagination layout="prev, pager, next" :current-page.sync="page" :total="list.length">
|
||||
</el-pagination>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="close();$emit('update:visible',false)">取 消</el-button>
|
||||
<el-button type="primary" @click="$emit('OK',tempRule);close()">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
listOr: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
tempRuleOr: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
folderList: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
page: 1,
|
||||
tempRule: [],
|
||||
search: '',
|
||||
folderid: '',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.tempRule = JSON.parse(JSON.stringify(this.tempRuleOr))
|
||||
},
|
||||
computed: {
|
||||
|
||||
listOr2() {
|
||||
return this.listOr.map(value => {
|
||||
this.$set(value, 'versionId', value.versionList[0].id)
|
||||
return value
|
||||
})
|
||||
},
|
||||
list() {
|
||||
|
||||
let arr
|
||||
|
||||
if (this.folderid) {
|
||||
arr = this.listOr2.filter(value => value.folderId == this.folderid)
|
||||
}else{
|
||||
arr = this.listOr2
|
||||
}
|
||||
|
||||
arr = arr.filter(value => value.name.indexOf(this.search) != -1)
|
||||
arr = arr.filter((value, index) => {
|
||||
return index >= (this.page - 1) * 10 && index < this.page * 10
|
||||
})
|
||||
|
||||
return arr
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.tempRule = []
|
||||
this.search = ''
|
||||
this.page = 1,
|
||||
this.$emit('close')
|
||||
},
|
||||
versionChange(id) {
|
||||
// console.log(this.tempRule)
|
||||
this.tempRule = this.tempRule.filter(value => {
|
||||
return Number(value.split('/')[0]) != id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
109
h5-enginex-manager/src/components/common/rule.vue
Normal file
109
h5-enginex-manager/src/components/common/rule.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.rule_home {
|
||||
display: flex;
|
||||
|
||||
}
|
||||
|
||||
.rule_fa {
|
||||
display: flex;
|
||||
width: 20%;
|
||||
height: 30%;
|
||||
margin: 10px 10px 0 0;
|
||||
}
|
||||
|
||||
.rule_son {
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="Data&&FieldUser">
|
||||
<div v-for="(item,index) in Data" class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="$emit('faadd',index)"></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="$emit('fadelect',index)" :disabled="index===0?'disabled':false" style="margin-right: 10px;"></el-button>
|
||||
<el-input v-model="item.conditionValue" style="width: 200px;" maxlength="20" placeholder="请输入内容"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<div v-for="(value,inde) in item.fieldSubCond" class="rule_son">
|
||||
<el-button icon="el-icon-plus" circle @click="$emit('sonadd',index,inde)" ></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="$emit('sondelect',index,inde)" :disabled="inde===0?'disabled':false" style="margin-right: 10px;"></el-button>
|
||||
<el-select v-model="value.fieldId" placeholder="请选择" filterable style="width: 200px;" @change="$emit('change',index,inde)">
|
||||
<el-option v-for="cont in FieldUser.data.fieldList" :key="cont.id" :label="cont.fieldCn" :value="cont.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<ruleRelation v-model="value.operator" :value2.sync="value.fieldValue" :valueType="getvalueType(value.fieldId)" ></ruleRelation>
|
||||
<!-- <el-input v-model="value.fieldValue" maxlength="30" placeholder="请输入内容,最长30位" style="width: 300px;margin-left: 10px;" v-show="getvalueType(value.fieldId)!==3">
|
||||
</el-input>
|
||||
<el-select v-model="value.fieldValue" placeholder="请选择" style="width: 300px;margin-left: 10px;" v-show="getvalueType(value.fieldId)===3">
|
||||
<el-option label="是" value="1"></el-option>
|
||||
<el-option label="否" value="0"></el-option>
|
||||
</el-select> -->
|
||||
<el-select v-model="value.logical" placeholder="请选择" style="width: 100px;margin-left: 10px;" v-show="inde!==item.fieldSubCond.length-1">
|
||||
<el-option label="and" value="&&"></el-option>
|
||||
<el-option label="or" value="or"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
export default {
|
||||
components:{
|
||||
ruleRelation
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log(this.Data)
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser
|
||||
}
|
||||
},
|
||||
props: {
|
||||
Data: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
getvalueType(cont){
|
||||
let num
|
||||
this.FieldUser.data.fieldList.forEach(value=>{
|
||||
if(value.id===cont){
|
||||
num = value.valueType
|
||||
}
|
||||
})
|
||||
return num
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,489 @@
|
||||
<style>
|
||||
|
||||
.easyrule_com{
|
||||
flex: 1;
|
||||
overflow: scroll;
|
||||
margin: 20px 0px 0px 10px;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<template>
|
||||
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="mixinClose"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增规则 :</span>
|
||||
<span v-else>编辑规则 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>规则代码: </p>
|
||||
<el-input placeholder="请输入规则代码" maxlength="30" v-model="code" clearable></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p> 规则名称: </p>
|
||||
<el-input placeholder="请输入规则名称" maxlength="20" v-model="name" clearable></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>优 先 级 : </p>
|
||||
<el-select v-model="priority" placeholder="请选择">
|
||||
<el-option label="0" :value="0" />
|
||||
<el-option label="1" :value="1" />
|
||||
<el-option label="2" :value="2" />
|
||||
<el-option label="3" :value="3" />
|
||||
<el-option label="4" :value="4" />
|
||||
<el-option label="5" :value="5" />
|
||||
<el-option label="6" :value="6" />
|
||||
<el-option label="7" :value="7" />
|
||||
<el-option label="8" :value="8" />
|
||||
<el-option label="9" :value="9" />
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_scope MR_scopeSmall':'MR_scope'">
|
||||
<div>
|
||||
<p>规则描述: </p>
|
||||
<el-input placeholder="请输入规则描述" maxlength="300" v-model="description" clearable></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="easyrule_com">
|
||||
|
||||
<RuleDown :type="1" :Data="ruledata" @faadd="faadd" @outAdd="outAdd" @outDelect="outDelect" @fadelect="fadelect"
|
||||
@change="change" :SpecialField="SpecialField" :outcontent="outcontent">
|
||||
|
||||
<div class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="outAdd(0)" disabled></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
<el-select v-model="resultFieldEn" filterable placeholder="请选择" style="width: 200px;">
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="是否命中" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="outAdd(0)"></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
|
||||
<div style="display: flex;align-items: center;">
|
||||
|
||||
<el-select v-model="scoreFieldEn" filterable placeholder="请选择" style="width: 200px;">
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">=</p>
|
||||
<div>
|
||||
<el-input v-model="SpecialField.score" maxlength="30" style="width: 255px;">
|
||||
<template slot="prepend">得分</template>
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</RuleDown>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import RuleDown from '@/components/common/rule/ruleRule.vue'
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
RuleDown
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
setsave: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
getInfo: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
updata: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
nameId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
scoreFieldEn: '',
|
||||
resultFieldEn: '',
|
||||
loading: false,
|
||||
|
||||
priority: '',
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
ruledata: null,
|
||||
"outcontent": [],
|
||||
SpecialField: {
|
||||
score: '1',
|
||||
ruleAudit: 5,
|
||||
lastLogical: '-1'
|
||||
},
|
||||
tempisEmpty: false,
|
||||
parentId: '',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getInfo(this.id).then(res => {
|
||||
this.scoreFieldEn = res.data.scoreFieldEn
|
||||
this.resultFieldEn = res.data.resultFieldEn
|
||||
this.code = res.data.code
|
||||
this.name = res.data.name
|
||||
this.priority = res.data.priority
|
||||
this.description = res.data.description
|
||||
this.parentId = res.data.parentId
|
||||
this.ruledata = res.data.ruleFieldList ? res.data.ruleFieldList : [{
|
||||
"logical": "",
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": ""
|
||||
}],
|
||||
this.outcontent = res.data.strategyOutputList
|
||||
this.outcontent.forEach(value => {
|
||||
if (!value.variableType) {
|
||||
value.variableType = 1
|
||||
}
|
||||
if (value.variableType == 2) {
|
||||
value.fieldValue = Number(value.fieldValue.split('|')[0])
|
||||
}
|
||||
})
|
||||
this.SpecialField.score = res.data.score
|
||||
this.SpecialField.ruleAudit = res.data.ruleAudit
|
||||
this.SpecialField.lastLogical = res.data.lastLogical
|
||||
|
||||
console.log(res.data.strategyOutputList)
|
||||
this.loading = false
|
||||
})
|
||||
} else {
|
||||
this.ruledata = [{
|
||||
"logical": "",
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": ""
|
||||
}]
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
},
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
getType(obj) {
|
||||
if (obj.conditionType == 2 && !obj.valueType) {
|
||||
obj.valueType = this.mixinGetvalueType(obj.fieldId)
|
||||
}
|
||||
if (obj.children.length > 0) {
|
||||
obj.children.forEach(value => {
|
||||
this.getType(value)
|
||||
})
|
||||
}
|
||||
},
|
||||
outAdd(index) {
|
||||
this.outcontent.splice(index, 0, {
|
||||
"fieldId": "",
|
||||
strategyType: 'base_rule',
|
||||
"fieldValue": "",
|
||||
variableType: 1
|
||||
})
|
||||
},
|
||||
outDelect(index) {
|
||||
this.outcontent.splice(index, 1)
|
||||
},
|
||||
submit() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.code.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return
|
||||
}
|
||||
if (this.code.trim() === '') {
|
||||
this.$message.error('请填入规则代码,并检查空格');
|
||||
return
|
||||
}
|
||||
if (this.priority === '') {
|
||||
this.$message.error('请选择规则优先级');
|
||||
return
|
||||
}
|
||||
if (this.name.trim() === '') {
|
||||
this.$message.error('请填入规则名称,并检查空格');
|
||||
return
|
||||
}
|
||||
if (this.description === '') {
|
||||
this.$message.error('请填入规则描述,并检查空格');
|
||||
return
|
||||
}
|
||||
if (this.resultFieldEn === "" || this.resultFieldEn == null) {
|
||||
this.$message.error('请选择命中时输出变量');
|
||||
return
|
||||
}
|
||||
if (this.scoreFieldEn == "" || this.scoreFieldEn == null) {
|
||||
this.$message.error('请选择得分时输出变量');
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if (isNaN(Number(this.SpecialField.score)) || String(this.SpecialField.score).trim() === "") {
|
||||
this.$message.error('得分只能是数字');
|
||||
return
|
||||
}
|
||||
let is = {
|
||||
is: true,
|
||||
msg: '',
|
||||
}
|
||||
|
||||
this.ruledata.forEach(value => {
|
||||
if (value.logical === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查是否有连接符未选'
|
||||
}
|
||||
if (value.fieldId === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查是否有条件未选'
|
||||
}
|
||||
if (value.operator === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查是否有运算符未选'
|
||||
}
|
||||
if (String(value.fieldValue).trim() === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查是否有条件对比值未填'
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
if (this.SpecialField.score === "" || this.SpecialField.ruleAudit === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查是否得分未填'
|
||||
}
|
||||
|
||||
|
||||
let str = ""
|
||||
this.ruledata.forEach(value => {
|
||||
str += value.logical
|
||||
})
|
||||
|
||||
str += this.SpecialField.lastLogical
|
||||
console.log(str)
|
||||
if (!this.is_leagl_brackets(str)) {
|
||||
this.$message.error('请检查括号完整性');
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.outcontent.forEach(value => {
|
||||
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查自定义输出部分是否有未填项'
|
||||
}
|
||||
if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value.fieldValue).formula.trim() ===
|
||||
'')) {
|
||||
is.is = false
|
||||
is.msg = '请检查自定义输出部分是否有未填项'
|
||||
}
|
||||
})
|
||||
|
||||
if (is.is === false) {
|
||||
this.$message.error(is.msg);
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
this.outcontent.forEach(value => {
|
||||
value.fieldEn = this.mixinGetvalueEn(value.fieldId)
|
||||
if (value.variableType == 2) {
|
||||
|
||||
value.fieldValue = value.fieldValue + '|' + this.mixinGetvalueEn(value.fieldValue)
|
||||
|
||||
}
|
||||
})
|
||||
let obj = {
|
||||
"code": this.code.trim(),
|
||||
"name": this.name.trim(),
|
||||
"priority": this.priority,
|
||||
"description": String(this.description).trim(),
|
||||
|
||||
score: this.SpecialField.score,
|
||||
ruleAudit: this.SpecialField.ruleAudit,
|
||||
scoreFieldEn: this.scoreFieldEn,
|
||||
resultFieldEn: this.resultFieldEn
|
||||
}
|
||||
let arr = this.ruledata.map(value => {
|
||||
value.valueType = this.getvalueType(value.fieldId)
|
||||
console.log(value)
|
||||
return value
|
||||
})
|
||||
obj.difficulty = 1
|
||||
obj.ruleFieldList = arr
|
||||
obj.strategyOutputList = this.outcontent.length > 0 ? this.outcontent : null
|
||||
obj.lastLogical = this.SpecialField.lastLogical
|
||||
|
||||
if (this.id == 0) {
|
||||
this.loading = true
|
||||
obj.parentId = this.nameId == 99999999 ? 0 : this.nameId,
|
||||
this.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.parentId = this.parentId
|
||||
this.loading = true
|
||||
this.updata(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
}
|
||||
},
|
||||
change(index) {
|
||||
this.ruledata[index].operator = ""
|
||||
this.ruledata[index].fieldValue = ""
|
||||
},
|
||||
faadd(index) { //rule父节点添加
|
||||
this.ruledata.splice(index + 1, 0, {
|
||||
"logical": "",
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": ""
|
||||
})
|
||||
|
||||
},
|
||||
fadelect(index) {
|
||||
this.ruledata.splice(index, 1)
|
||||
},
|
||||
is_leagl_brackets(string) {
|
||||
console.log(1)
|
||||
var array = [];
|
||||
for (var i = 0; i < string.length; i++) {
|
||||
var item = string[i];
|
||||
if (item === "(") {
|
||||
array.push("(");
|
||||
} else if (item === ")") {
|
||||
if (array.length === 0) {
|
||||
return false;
|
||||
} else {
|
||||
array.pop();
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
return array.length === 0;
|
||||
},
|
||||
getvalueType(cont) {
|
||||
let num
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id === parseInt(cont)) {
|
||||
num = value.valueType
|
||||
}
|
||||
})
|
||||
return num
|
||||
},
|
||||
getvalueEn(cont) {
|
||||
let num
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id === parseInt(cont)) {
|
||||
num = value.fieldEn
|
||||
console.log(1)
|
||||
}
|
||||
})
|
||||
return num
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
watch: {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,715 @@
|
||||
<style>
|
||||
.rule_com {
|
||||
/* height: 51vh; */
|
||||
flex: 1;
|
||||
overflow: scroll;
|
||||
/* overflow-x: hidden; */
|
||||
margin: 0px 0px 0px 10px;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
.rule_com::-webkit-scrollbar {
|
||||
/* display: none; */
|
||||
/* Chrome Safari */
|
||||
}
|
||||
|
||||
.Rule_version_buttom {
|
||||
/* width: 100px; */
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
|
||||
.rule_outcontent_box {
|
||||
border: 1px dotted #00000022;
|
||||
|
||||
margin-top: 20px;
|
||||
padding: 10px 0 10px 10px;
|
||||
}
|
||||
|
||||
.groovyHint {
|
||||
padding: 5px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="mixinClose"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增规则 :</span>
|
||||
<span v-else>编辑规则 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button :icon="smallHeader?'el-icon-bottom':'el-icon-top'" circle @click="openHeader">
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit" :disabled="addVersionStatus">
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>规则代码: </p>
|
||||
<el-input placeholder="请输入规则代码" maxlength="30" v-model="code" clearable :disabled="addVersionStatus">
|
||||
</el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p> 规则名称: </p>
|
||||
<el-input placeholder="请输入规则名称" maxlength="20" v-model="name" clearable :disabled="addVersionStatus">
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<p> 脚本类型: </p>
|
||||
<el-select v-model="scriptType" placeholder="请选择" :disabled="id===0?'disabled':''">
|
||||
<el-option v-for="item in scriptList" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_scope MR_scopeSmall':'MR_scope'">
|
||||
<div>
|
||||
<p>规则描述: </p>
|
||||
<el-input placeholder="请输入规则描述" maxlength="300" v-model="description" clearable
|
||||
:disabled="addVersionStatus"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<version style="margin:5px;" :id="id" :ruleVersionList="ruleScriptVersionList" :version="version"
|
||||
:addVersionStatus="addVersionStatus" :addVersionDialog="addVersionDialog"
|
||||
:addVersionLoading="addVersionLoading" @addVersion="addVersion" @addVersionClose="addVersionClose"
|
||||
@copyVersion="copyVersion" @delectVersion="delectVersion" @updateVersion="updateVersion"
|
||||
@addVersionSure="addVersionSure" @Dialog="addVersionDialog=$event" @addVersionExamine="addVersionExamine"
|
||||
@versionChange="versionChange" @StatusChange="addVersionStatus=$event"></version>
|
||||
|
||||
<div class="rule_com">
|
||||
<!-- -->
|
||||
|
||||
<teV2 v-model="formula">
|
||||
<div v-if="scripHint[scriptType].top" class="groovyHint"
|
||||
:style="{backgroundColor:scripHint[scriptType].top.backgroundColor,color:scripHint[scriptType].top.color}"
|
||||
v-html="scripHint[scriptType].top.cont">
|
||||
|
||||
</div>
|
||||
</teV2>
|
||||
<div v-if="scripHint[scriptType].bottom" class="groovyHint"
|
||||
:style="{backgroundColor:scripHint[scriptType].bottom.backgroundColor,color:scripHint[scriptType].bottom.color}"
|
||||
v-html="scripHint[scriptType].bottom.cont">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<div class="rule_outcontent_box">
|
||||
<p>命中输出:</p>
|
||||
<div class="rule_home" style="margin-top: 10px;">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="outAdd(0)" disabled></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px">
|
||||
</el-button>
|
||||
</div>
|
||||
<el-select v-model="resultFieldEn" filterable placeholder="请选择" style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="是否命中" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<outcontent :outcontent="outcontent" :ruleOut="true" type="complex_rule" :outType="outTypeSuccess">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-select v-model="scoreFieldEn" filterable placeholder="请选择" style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn"
|
||||
:value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">=</p>
|
||||
<div>
|
||||
<el-input v-model="SpecialField.score" maxlength="30" style="width: 255px;">
|
||||
<template slot="prepend">得分</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
</outcontent>
|
||||
</div>
|
||||
<br> -->
|
||||
<!-- <div class="rule_outcontent_box">
|
||||
<p>未命中输出:</p>
|
||||
<outcontent :outcontent="failOutputList" :unone="true" :ruleOut="true" type="complex_rule"
|
||||
:outType="outTypeFail">
|
||||
|
||||
</outcontent>
|
||||
<div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import teV2 from '@/components/common/teV2.vue'
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import version from '@/components/common/Version.vue'
|
||||
import outcontent from '@/components/models/outcontent.vue'
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
teV2,
|
||||
outcontent,
|
||||
version
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
nameId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
formula: '',
|
||||
scriptType: 'groovy',
|
||||
scriptList: [{
|
||||
label: 'groovy规则',
|
||||
value: 'groovy',
|
||||
}],
|
||||
scripHint: {
|
||||
groovy: {
|
||||
top: {
|
||||
cont: `def main(_) {\n HashMap<String, Object> result = new HashMap<>(); //规则执行的返回值<br>int ruleScore = 0; //规则命中时得分<br> String hitResult = "未命中"; //命中结果,可选类型为:命中、未命中<br> HashMap<String, Object> updateInputMap = new HashMap<>(); //用于更新入参的map,此map中的所有内容将被更新到入参中,key重复的将被覆盖。<br> ArrayList<HashMap<String, Object>> fieldList = new ArrayList<>(); //用于存放输出字段的值<br> //自定义代码区域,根据需要书写逻辑代码<br>`,
|
||||
backgroundColor: '#f4f4f5',
|
||||
color: '#999'
|
||||
},
|
||||
bottom: {
|
||||
cont: ` //返回固定格式的结果用于后续执行<br> result.put("hitResult",hitResult);<br> result.put("ruleScore",ruleScore);<br> result.put("fieldList",fieldList);<br> result.put("updateInputMap",updateInputMap);<br> return result;<br> }`,
|
||||
backgroundColor: '#f4f4f5',
|
||||
color: '#999'
|
||||
}
|
||||
}
|
||||
},
|
||||
topCode: `def main(_) {\n HashMap<String, Object> result = new HashMap<>();\n int ruleScore = 0;\n String hitResult = "未命中";\n HashMap<String, Object> updateInputMap = new HashMap<>();\n ArrayList<HashMap<String, Object>> fieldList = new ArrayList<>();\n //!#$%^\n`,
|
||||
bottomCode: `//!#$%^\n result.put("hitResult",hitResult);\n result.put("ruleScore",ruleScore);\n result.put("fieldList",fieldList);\n result.put("updateInputMap",updateInputMap);\n return result;\n}\n`,
|
||||
// 新增部分
|
||||
tempVersion: {
|
||||
versionCode: '',
|
||||
description: ''
|
||||
},
|
||||
addVersionLoading: false,
|
||||
addVersionDialog: false,
|
||||
version: {},
|
||||
addVersionStatus: false,
|
||||
ruleScriptVersionList: [],
|
||||
scoreFieldEn: '',
|
||||
resultFieldEn: '',
|
||||
loading: false,
|
||||
valueScope: '',
|
||||
priority: 0,
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
// ruledata: null,
|
||||
// outcontent: [],
|
||||
// failOutputList: [],
|
||||
SpecialField: {
|
||||
score: '1',
|
||||
ruleAudit: 5
|
||||
},
|
||||
tempisEmpty: false,
|
||||
parentId: '',
|
||||
// outTypeSuccess: {
|
||||
// outType: 'success'
|
||||
// },
|
||||
// outTypeFail: {
|
||||
// outType: 'fail'
|
||||
// },
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$store.dispatch('getfielduser')
|
||||
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getData.getVersion(this.id).then(res => {
|
||||
this.parentId = res.data.parentId
|
||||
this.ruleScriptVersionList = res.data.ruleScriptVersionList
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleScriptVersionList[0]))
|
||||
this.code = res.data.code
|
||||
this.name = res.data.name
|
||||
this.priority = res.data.priority
|
||||
this.description = res.data.description
|
||||
this.getRuleCont()
|
||||
})
|
||||
} else {
|
||||
// this.ruledata = {
|
||||
// "logical": "&&",
|
||||
// "fieldId": null,
|
||||
// "operator": null,
|
||||
// "fieldValue": null,
|
||||
// "conditionType": 1,
|
||||
// "children": [],
|
||||
// loopGroupActions: []
|
||||
// }
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
if (this.$store.state.FieldUser) {
|
||||
// console.log(this.$store.state.FieldUser.data.fieldList)
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
addVersionExamine() { //添加版本验证
|
||||
if (this.verification()) {
|
||||
return
|
||||
}
|
||||
this.addVersionDialog = true
|
||||
},
|
||||
addVersionSure(tempVersion) { //确定添加版本
|
||||
this.addVersionLoading = true
|
||||
let scriptContent = JSON.stringify(this.sectionSure(this.formula))
|
||||
let obj = {
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description,
|
||||
ruleId: this.id,
|
||||
scriptContent: scriptContent,
|
||||
scriptType: this.scriptType,
|
||||
|
||||
|
||||
// score: this.SpecialField.score,
|
||||
// ruleAudit: this.SpecialField.ruleAudit,
|
||||
// scoreFieldEn: this.scoreFieldEn,
|
||||
// resultFieldEn: this.resultFieldEn,
|
||||
|
||||
// strategyOutputList: this.outcontent,
|
||||
// failOutputList: this.failOutputList
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.getData.addVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '添加版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleScriptVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleScriptVersionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getRuleCont()
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
updateVersion(tempVersion) { //版本重命名
|
||||
this.addVersionLoading = true
|
||||
|
||||
|
||||
let obj = {
|
||||
ruleId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description,
|
||||
scriptContent: JSON.stringify(this.sectionSure(this.formula)),
|
||||
scriptType: this.scriptType,
|
||||
// score: this.SpecialField.score,
|
||||
// ruleAudit: this.SpecialField.ruleAudit,
|
||||
// scoreFieldEn: this.scoreFieldEn,
|
||||
// resultFieldEn: this.resultFieldEn,
|
||||
// strategyOutputList: this.outcontent,
|
||||
// failOutputList: this.failOutputList
|
||||
|
||||
}
|
||||
this.getData.updateVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '版本重命名成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleScriptVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleScriptVersionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getRuleCont()
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
copyVersion(tempVersion) { //复制版本
|
||||
this.addVersionLoading = true
|
||||
let obj = {
|
||||
ruleId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description
|
||||
}
|
||||
this.getData.copyVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '复制版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleScriptVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleScriptVersionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getRuleCont()
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
getRuleCont() { //获取规则
|
||||
this.loading = true
|
||||
this.getData.getInfo({
|
||||
id: this.version.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
if (res.data.scriptContent) this.formula = JSON.parse(res.data.scriptContent).formula
|
||||
.split('//!#$%^\n')[1]
|
||||
// console.log(JSON.parse(res.data.scriptContent).formula)
|
||||
// console.log(this.formula)
|
||||
// this.scoreFieldEn = res.data.scoreFieldEn
|
||||
// this.resultFieldEn = res.data.resultFieldEn
|
||||
// this.getType(res.data.ruleConditionVo)
|
||||
// this.ruledata = res.data.ruleConditionVo ? res.data.ruleConditionVo : {
|
||||
// "logical": "&&",
|
||||
// "fieldId": null,
|
||||
// "operator": null,
|
||||
// "fieldValue": null,
|
||||
// "conditionType": 1,
|
||||
// "children": [],
|
||||
// }
|
||||
// this.outcontent = res.data.strategyOutputList
|
||||
// this.failOutputList = res.data.failOutputList
|
||||
// this.outcontent.forEach(value => {
|
||||
// if (!value.variableType) {
|
||||
// value.variableType = 1
|
||||
// }
|
||||
// })
|
||||
// this.redeepverify(this.ruledata)
|
||||
|
||||
// this.SpecialField.score = res.data.score
|
||||
// this.SpecialField.ruleAudit = res.data.ruleAudit
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
versionChange() { //切换版本
|
||||
this.ruleScriptVersionList.forEach(value => {
|
||||
if (value.id === this.version.id) {
|
||||
this.version = JSON.parse(JSON.stringify(value))
|
||||
this.getRuleCont()
|
||||
}
|
||||
})
|
||||
},
|
||||
addVersion() { //添加版本
|
||||
this.addVersionStatus = true
|
||||
this.tempadd = {
|
||||
// scoreFieldEn: this.scoreFieldEn,
|
||||
// resultFieldEn: this.resultFieldEn,
|
||||
formula: this.formula,
|
||||
// outcontent: this.outcontent,
|
||||
// failOutputList: this.failOutputList,
|
||||
// score: this.SpecialField.score,
|
||||
}
|
||||
this.reset()
|
||||
},
|
||||
|
||||
verification() { //验证
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.code.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return true
|
||||
}
|
||||
if(this.verificationCode(this.code)||this.verificationName(this.name)){
|
||||
return true
|
||||
}
|
||||
if (this.code.trim() === '') {
|
||||
this.$message.error('请填入规则代码,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.priority === '') {
|
||||
this.$message.error('请选择规则优先级');
|
||||
return true
|
||||
}
|
||||
if (this.name.trim() === '') {
|
||||
this.$message.error('请填入规则名称,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.description === '') {
|
||||
this.$message.error('请填入规则描述,并检查空格');
|
||||
return true
|
||||
}
|
||||
// if (this.resultFieldEn === "") {
|
||||
// this.$message.error('请选择命中时输出变量');
|
||||
// return true
|
||||
// }
|
||||
// if (this.scoreFieldEn == "") {
|
||||
// this.$message.error('请选择得分时输出变量');
|
||||
// return true
|
||||
// }
|
||||
if (isNaN(Number(this.SpecialField.score)) || String(this.SpecialField.score).trim() === "") {
|
||||
this.$message.error('得分只能是数字');
|
||||
return true
|
||||
}
|
||||
let is = true
|
||||
this.tempisEmpty = false
|
||||
// this.deepverify(this.ruledata)
|
||||
if (this.tempisEmpty) {
|
||||
return true
|
||||
}
|
||||
// this.outcontent.forEach(value => {
|
||||
// if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType ===
|
||||
// "") {
|
||||
// is = false
|
||||
// }
|
||||
// if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value
|
||||
// .fieldValue).formula.trim() ===
|
||||
// '')) {
|
||||
// is = false
|
||||
// }
|
||||
// })
|
||||
// this.failOutputList.forEach(value => {
|
||||
// if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType ===
|
||||
// "") {
|
||||
// is = false
|
||||
// }
|
||||
// if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value
|
||||
// .fieldValue).formula.trim() ===
|
||||
// '')) {
|
||||
// is = false
|
||||
// }
|
||||
// })
|
||||
if (is === false) {
|
||||
this.$message.error('请检查自定义输出部分是否有未填项');
|
||||
return true
|
||||
}
|
||||
},
|
||||
addVersionClose() { //添加版本取消
|
||||
this.addVersionStatus = false
|
||||
|
||||
this.formula = this.tempadd.formula
|
||||
|
||||
// this.SpecialField.score = this.tempadd.score
|
||||
// this.scoreFieldEn = this.tempadd.scoreFieldEn
|
||||
// this.resultFieldEn = this.tempadd.resultFieldEn
|
||||
|
||||
// this.outcontent = this.tempadd.outcontent
|
||||
// this.failOutputList = this.tempadd.failOutputList
|
||||
},
|
||||
reset() { //数据暂时重置
|
||||
this.formula = ''
|
||||
// this.SpecialField.score = 1
|
||||
// this.outcontent = []
|
||||
// this.failOutputList = []
|
||||
// this.scoreFieldEn = ""
|
||||
// this.resultFieldEn = ""
|
||||
},
|
||||
delectVersion() { //删除版本
|
||||
this.getData.delectVersion({
|
||||
status: -1,
|
||||
ids: [this.version.id],
|
||||
strategyId: this.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleScriptVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleScriptVersionList[0]))
|
||||
this.getRuleCont()
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
// getType(obj) { //获取 规则类型
|
||||
// if (obj.conditionType == 2 && !obj.valueType) {
|
||||
// obj.valueType = this.mixinGetvalueType(obj.fieldId)
|
||||
// }
|
||||
// if (obj.children.length > 0) {
|
||||
// obj.children.forEach(value => {
|
||||
// this.getType(value)
|
||||
// })
|
||||
// }
|
||||
// },
|
||||
// outAdd(index) { //添加自定义输出
|
||||
// this.outcontent.splice(index, 0, {
|
||||
// "fieldId": "",
|
||||
// strategyType: 'base_rule',
|
||||
// "fieldValue": "",
|
||||
// variableType: 1
|
||||
// })
|
||||
// },
|
||||
submit() { //提交
|
||||
|
||||
this.loading = true
|
||||
|
||||
if (this.verification()) {
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
let is = this.sectionSure(this.formula)
|
||||
if (!is) {
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
let scriptContent = JSON.stringify(is)
|
||||
|
||||
|
||||
|
||||
// this.outcontent.forEach(value => {
|
||||
// value.fieldEn = this.mixinGetvalueEn(value.fieldId)
|
||||
// })
|
||||
// this.failOutputList.forEach(value => {
|
||||
// value.fieldEn = this.mixinGetvalueEn(value.fieldId)
|
||||
// })
|
||||
let obj = {
|
||||
"code": this.code.trim(),
|
||||
"name": this.name.trim(),
|
||||
"priority": this.priority,
|
||||
"description": String(this.description).trim(),
|
||||
scriptType: this.scriptType,
|
||||
difficulty: 3,
|
||||
ruleAudit: this.SpecialField.ruleAudit,
|
||||
ruleScriptVersionList: [{
|
||||
// score: this.SpecialField.score,
|
||||
// scoreFieldEn: this.scoreFieldEn,
|
||||
// resultFieldEn: this.resultFieldEn,
|
||||
// strategyOutputList: this.outcontent,
|
||||
// failOutputList: this.failOutputList,
|
||||
scriptType: this.scriptType,
|
||||
scriptContent: scriptContent
|
||||
}],
|
||||
}
|
||||
|
||||
|
||||
if (this.id == 0) {
|
||||
obj.ruleScriptVersionList[0].versionCode = 'V:0'
|
||||
obj.ruleScriptVersionList[0].description = '初始版本'
|
||||
obj.parentId = this.nameId == 99999999 ? 0 : this.nameId,
|
||||
this.getData.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.parentId = this.parentId
|
||||
obj.ruleScriptVersionList[0].id = this.version.id
|
||||
this.getData.updatafield(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
// this.$emit('Ok')
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
}
|
||||
console.log(obj)
|
||||
},
|
||||
sectionSure(tempValue) {
|
||||
tempValue = tempValue ? tempValue.trim() : ''
|
||||
|
||||
if(String(tempValue).match(/@/g)&&String(tempValue).match(/@/g).length%2==1){
|
||||
|
||||
this.$message.error(`@符号不能为单数个`);
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
let arr = String(tempValue).match(/@(.|\n)*?@/g) === null ? [] : tempValue.match(/@(.|\n)*?@/g);
|
||||
let is = false
|
||||
console.log(tempValue)
|
||||
arr = Array.from(new Set(arr))
|
||||
// console.log(arr)
|
||||
let str = ''
|
||||
arr = arr.map(value => {
|
||||
console.log(value)
|
||||
value = value.split('')
|
||||
value.pop()
|
||||
value.shift()
|
||||
value = value.join('')
|
||||
if (this.mixinGetValueByCn(value)) {
|
||||
return this.mixinGetValueByCn(value)
|
||||
} else {
|
||||
is = true
|
||||
str += value+'、'
|
||||
return this.mixinGetValueByCn(value)
|
||||
}
|
||||
|
||||
})
|
||||
if (is) {
|
||||
this.$message.error(`没有找到指标:${str}`);
|
||||
return false
|
||||
}
|
||||
let obj = {
|
||||
farr: arr,
|
||||
formula: this.topCode + tempValue + this.bottomCode
|
||||
}
|
||||
return obj
|
||||
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
331
h5-enginex-manager/src/components/common/rule/ruleCont.vue
Normal file
331
h5-enginex-manager/src/components/common/rule/ruleCont.vue
Normal file
@@ -0,0 +1,331 @@
|
||||
|
||||
<template>
|
||||
<div class="cont_cont">
|
||||
|
||||
<div class="cont_left" v-loading="leftloading" v-if="!listRedact">
|
||||
<div class="cont_header">
|
||||
<p class="cont_header_title">{{title}}</p>
|
||||
<p class="cont_header_subtitle">{{title}}</p>
|
||||
</div>
|
||||
<contNewFule v-model="tempNewF" :newf.sync="newf" @newFileSure="newFileSure" @newFile="newFile" ></contNewFule>
|
||||
|
||||
<div class="cont_list">
|
||||
|
||||
<fileHome :data="list" @curr="clickCurrid" :currid="currid" @RenameFun="RenameFun" @RenameClose="RenameClose"
|
||||
@updatafilelist="updatafilelist" @delectFun="delectFun">
|
||||
</fileHome>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cont_right" v-loading="contloading" @click="tempHintLeft=null;tempHintTop=null;">
|
||||
<div v-if="!listRedact">
|
||||
<div v-if="showRight===false" class="cont_right_hint">
|
||||
请先选择左侧文件夹
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="cont_right_top">
|
||||
<div>
|
||||
<el-button type="primary" @click="listRedact=true" :disabled="currid!=99999999?false:'disabled'">新增</el-button>
|
||||
<el-button type="danger" @click="using(-1)" :disabled="this.selection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button type="success" @click="using(1)" :disabled="this.selection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button type="warning" @click="using(0)" :disabled="this.selection.length>0?false:'disabled'">停用</el-button>
|
||||
<el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'"
|
||||
filterable @change="mixinMoveChange">
|
||||
<el-option v-for="value in listunfold" :key="value.id" :label="value.name" :value="value.id" v-show="value.id!=99999999"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<el-input placeholder="请输入搜索内容" v-model="search">
|
||||
<i slot="suffix" class="el-input__icon el-icon-search" @click="getsearch"></i>
|
||||
</el-input>
|
||||
<el-button style="margin-left: 10px;" @click="upShow=true" v-if="getData.type==1">批量导入</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right_cont">
|
||||
<div v-if="data">
|
||||
<el-table border :data="data.data.klist" @select-all="selectAll" @select="select" style="width: 100%"
|
||||
:cell-style="{padding: '10px'}">
|
||||
<el-table-column type="selection" width="70">
|
||||
</el-table-column>
|
||||
<el-table-column v-for="item in getData.row" :key="item.id" :prop="item.row" :label="item.label" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="item.type==='Blooen'">
|
||||
{{scope.row[item.row]?"是":"否"}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='State'">
|
||||
{{scope.row[item.row]==1?'启用':'未启用'}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='Time'" style="white-space: nowrap;" class="contText">{{
|
||||
new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row[item.row]).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
<span class="contText" v-else>
|
||||
{{scope.row[item.row]}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-button icon="el-icon-setting" circle size="mini" @click="dialogShow(scope.row.id)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="float: right;margin-right: 40px;margin-top: 40px;" :current-page="currPage"
|
||||
@current-change="clickpage" background layout="prev, pager, next" :total="data.data.pageInfo.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else style="height: 100%;overflow: hidden;">
|
||||
<easyDataManageRedact @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist()"
|
||||
:updata="getData.updatafield" :id='tempRedactId' :nameId="currid" :setsave="getData.setsave" :getInfo="getData.getInfo"
|
||||
:type="getData.type" v-if="getData.type==1">
|
||||
</easyDataManageRedact>
|
||||
|
||||
<dataManageRedact @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist()" :getData="getData"
|
||||
:id='tempRedactId' :nameId="currid" :type="getData.type" v-if="getData.type==2">
|
||||
</dataManageRedact>
|
||||
|
||||
<groovyRuleManageRedact @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist()" :getData="getData"
|
||||
:id='tempRedactId' :nameId="currid" :type="getData.type" v-if="getData.type==3">
|
||||
</groovyRuleManageRedact>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog title="上传文件" :visible.sync="upShow" width="30%" :before-close="upShowClose">
|
||||
<div style="margin: 0 auto;display: flex;justify-content: center;">
|
||||
<el-upload class="upload-demo" ref="upload" action="doUpload" :limit="1" :file-list="fileList" :before-upload="beforeUpload"
|
||||
v-loading="Uploadloading">
|
||||
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传excel文件,且不超过5MB</div>
|
||||
<div slot="tip" class="el-upload-list__item-name">{{fileName}}</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="upShow = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitUpload();" :disabled="fileName?false:'disabled'">确定</el-button>
|
||||
</span>
|
||||
|
||||
|
||||
</el-dialog>
|
||||
<el-dialog title="导入结果" :visible.sync="upCallbackShow" width="60%" close-on-click-modal close-on-press-escape
|
||||
show-close>
|
||||
<p style="font-size: 18px;font-weight: bold;">
|
||||
导入成功{{callbackresult.sucRows}}条,失败{{callbackresult.failRows}}条,重复{{callbackresult.repeatRows}}条,已存在{{callbackresult.existRows}}条
|
||||
</p>
|
||||
<div style="">
|
||||
<div style="width:98%;border-bottom: 1px dashed #ddd;padding: 1%;">
|
||||
<p style="font-weight: bold;font-size: 16px;">文件夹不存在({{callbackresult.result.folderNotExistList.length}})</p>
|
||||
<p v-for="value in callbackresult.result.folderNotExistList" style="margin-top: 10px;">{{value}}</p>
|
||||
</div>
|
||||
<div style="width:98%;border-bottom: 1px dashed #ddd;padding: 1%;">
|
||||
<p style="font-weight: bold;font-size: 16px;">系统中已存在的代码({{callbackresult.result.existCodeList.length}})</p>
|
||||
<p v-for="value in callbackresult.result.existCodeList" style="margin-top: 10px;">
|
||||
{{value}}
|
||||
</p>
|
||||
</div>
|
||||
<div style="width:98%;border-bottom: 1px dashed #ddd;padding: 1%;">
|
||||
<p style="font-weight: bold;font-size: 16px;">系统中已存在的名称({{callbackresult.result.existNameList.length}})</p>
|
||||
<p v-for="value in callbackresult.result.existNameList" style="margin-top: 10px;">{{value}}</p>
|
||||
</div>
|
||||
|
||||
<div style="width:98%;border-bottom: 1px dashed #ddd;padding: 1%;">
|
||||
<p style="font-weight: bold;font-size: 16px;">表格中重复的代码({{callbackresult.result.rpCodeList.length}})</p>
|
||||
<p v-for="value in callbackresult.result.rpCodeList" style="margin-top: 10px;">{{value}}</p>
|
||||
</div>
|
||||
<div style="width:98%;border-bottom: 1px dashed #ddd;padding: 1%;">
|
||||
<p style="font-weight: bold;font-size: 16px;">表格中重复的名称({{callbackresult.result.rpNameList.length}})</p>
|
||||
<p v-for="value in callbackresult.result.rpNameList" style="margin-top: 10px;">{{value}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="upCallbackShow = false">取消</el-button>
|
||||
</span>
|
||||
|
||||
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import contNewFule from '@/components/common/contNewFile.vue'
|
||||
import '@/assets/css/cont.css'
|
||||
import dataManageRedact from '@/components/common/rule/ruleManageRedact.vue'
|
||||
import easyDataManageRedact from '@/components/common/rule/easyRuleManageRedact.vue'
|
||||
import groovyRuleManageRedact from '@/components/common/rule/groovyRuleManageRedact.vue'
|
||||
import fileHome from '@/components/common/fileHome.vue'
|
||||
import contmixin from '@/utils/contminxin/contmixin.js'
|
||||
export default {
|
||||
mixins: [
|
||||
contmixin
|
||||
],
|
||||
components: {
|
||||
easyDataManageRedact,
|
||||
groovyRuleManageRedact,
|
||||
// file,
|
||||
dataManageRedact,
|
||||
fileHome,
|
||||
contNewFule
|
||||
},
|
||||
created() {
|
||||
this.getData.getTree({
|
||||
parentId: 0,
|
||||
treeType:this.getData.treeType,
|
||||
type: 1
|
||||
}).then(res => {
|
||||
this.list = this.listTreeDeep(res.data, 1)
|
||||
this.clickCurrid(99999999)
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
list() {
|
||||
if (this.list.length > 0) {
|
||||
this.leftloading = false
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
callbackresult: {
|
||||
sucRows: '',
|
||||
failRows: '',
|
||||
repeatRows: '',
|
||||
existRows: '',
|
||||
result: {
|
||||
existCodeList: [],
|
||||
existNameList: [],
|
||||
folderNotExistList: [],
|
||||
rpCodeList: [],
|
||||
rpNameList: []
|
||||
}
|
||||
},
|
||||
upCallbackShow: false,
|
||||
Uploadloading: false,
|
||||
tempMove: '',
|
||||
leftloading: false, //暂时关闭loading
|
||||
search: "",
|
||||
fileName: "",
|
||||
fileList: [],
|
||||
upShow: false,
|
||||
currPage: 1,
|
||||
currid: null,
|
||||
data: null,
|
||||
contloading: false,
|
||||
newf: false,
|
||||
tempNewF: "",
|
||||
listRedact: false, //新增页面开启
|
||||
tempRedactId: 0,
|
||||
selection: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getsearch() {
|
||||
this.contloading = true
|
||||
let params = {
|
||||
|
||||
key: "ruleName",
|
||||
status: "0,1",
|
||||
"parentIds": String(this.currid) === "99999999" ? '' : String(this.currid),
|
||||
"pageNum": 1,
|
||||
isSearch: 1,
|
||||
ruleInfo: {
|
||||
|
||||
name: this.search,
|
||||
}
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
this.currPage = 1
|
||||
},
|
||||
getlist() {
|
||||
this.contloading = true
|
||||
this.listRedact = false
|
||||
let params = {
|
||||
status: "0,1",
|
||||
ruleInfo: {},
|
||||
"pageNum": 1
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.ruleInfo.parentId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
|
||||
},
|
||||
clickpage(e) {
|
||||
this.currPage = e
|
||||
this.contloading = true
|
||||
let params = {
|
||||
status: "0,1",
|
||||
ruleInfo: {},
|
||||
"pageNum": e
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.ruleInfo.parentId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
this.selection = []
|
||||
}
|
||||
})
|
||||
},
|
||||
newFileSure() {
|
||||
this.leftloading = true
|
||||
let params = {
|
||||
parentId: String(this.currid),
|
||||
name: this.tempNewF,
|
||||
"treeType": this.getData.treeType,
|
||||
"type": "1",
|
||||
"engineId": ""
|
||||
}
|
||||
// if (this.getData.type == 2) {
|
||||
// params.treeType = '5'
|
||||
// }
|
||||
if(this.mixnewFileZindexVerify(this.list,this.currid)==6){
|
||||
this.$message.error('已达到最深层级')
|
||||
this.leftloading = false
|
||||
return
|
||||
}
|
||||
this.mixnewFileSure(params)
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,823 @@
|
||||
<style>
|
||||
.rule_com {
|
||||
/* height: 51vh; */
|
||||
flex: 1;
|
||||
overflow: scroll;
|
||||
/* overflow-x: hidden; */
|
||||
margin: 0px 0px 0px 10px;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
.rule_com::-webkit-scrollbar {
|
||||
/* display: none; */
|
||||
/* Chrome Safari */
|
||||
}
|
||||
|
||||
.Rule_version_buttom {
|
||||
/* width: 100px; */
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
|
||||
.rule_outcontent_box {
|
||||
border: 1px dotted #00000022;
|
||||
|
||||
margin-top: 20px;
|
||||
padding:10px 0 10px 10px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="mixinClose"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增规则 :</span>
|
||||
<span v-else>编辑规则 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button :icon="smallHeader?'el-icon-bottom':'el-icon-top'" circle @click="openHeader">
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit" :disabled="addVersionStatus">
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>规则代码: </p>
|
||||
<el-input placeholder="请输入规则代码" maxlength="30" v-model="code" clearable :disabled="addVersionStatus">
|
||||
</el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p> 规则名称: </p>
|
||||
<el-input placeholder="请输入规则名称" maxlength="20" v-model="name" clearable :disabled="addVersionStatus">
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_scope MR_scopeSmall':'MR_scope'">
|
||||
<div>
|
||||
<p>规则描述: </p>
|
||||
<el-input placeholder="请输入规则描述" maxlength="300" v-model="description" clearable
|
||||
:disabled="addVersionStatus"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<version style="margin:5px;" :id="id" :ruleVersionList="ruleVersionList" :version="version"
|
||||
:addVersionStatus="addVersionStatus" :addVersionDialog="addVersionDialog"
|
||||
:addVersionLoading="addVersionLoading" @addVersion="addVersion" @addVersionClose="addVersionClose"
|
||||
@copyVersion="copyVersion" @delectVersion="delectVersion" @updateVersion="updateVersion"
|
||||
@addVersionSure="addVersionSure" @Dialog="addVersionDialog=$event" @addVersionExamine="addVersionExamine"
|
||||
@versionChange="versionChange" @StatusChange="addVersionStatus=$event" :exportVersion="true" @exportVersion="exportVersion" @importNewVersion="importNewVersion">
|
||||
</version>
|
||||
|
||||
<div class="rule_com">
|
||||
<rule :data="ruledata" :ZIndex="1"></rule>
|
||||
|
||||
<div class="rule_outcontent_box">
|
||||
<p>命中输出:</p>
|
||||
<div class="rule_home" style="margin-top: 10px;">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="outAdd(0)" disabled></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px">
|
||||
</el-button>
|
||||
</div>
|
||||
<el-select v-model="resultFieldEn" filterable placeholder="请选择" style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="是否命中" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<outcontent :outcontent="outcontent" :ruleOut="true" type="complex_rule" :outType="outTypeSuccess">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-select v-model="scoreFieldEn" filterable placeholder="请选择" style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn"
|
||||
:value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">=</p>
|
||||
<div>
|
||||
<el-input v-model="SpecialField.score" maxlength="30" style="width: 255px;">
|
||||
<template slot="prepend">得分</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
</outcontent>
|
||||
</div>
|
||||
<br>
|
||||
<div class="rule_outcontent_box">
|
||||
<p>未命中输出:</p>
|
||||
<outcontent :outcontent="failOutputList" :unone="true" :ruleOut="true" type="complex_rule"
|
||||
:outType="outTypeFail">
|
||||
|
||||
</outcontent>
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import version from '@/components/common/Version.vue'
|
||||
import outcontent from '@/components/models/outcontent.vue'
|
||||
import rule from '@/components/models/RuleCont.vue'
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
rule,
|
||||
outcontent,
|
||||
version
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
nameId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
tempVersion: {
|
||||
versionCode: '',
|
||||
description: ''
|
||||
},
|
||||
addVersionLoading: false,
|
||||
addVersionDialog: false,
|
||||
version: {},
|
||||
addVersionStatus: false,
|
||||
ruleVersionList: [],
|
||||
scoreFieldEn: '',
|
||||
resultFieldEn: '',
|
||||
loading: false,
|
||||
valueScope: '',
|
||||
priority: 0,
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
ruledata: null,
|
||||
outcontent: [],
|
||||
failOutputList: [],
|
||||
SpecialField: {
|
||||
score: '1',
|
||||
ruleAudit: 5
|
||||
},
|
||||
tempisEmpty: false,
|
||||
parentId: '',
|
||||
outTypeSuccess: {
|
||||
outType: 'success'
|
||||
},
|
||||
outTypeFail: {
|
||||
outType: 'fail'
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$store.dispatch('getfielduser')
|
||||
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getData.getVersion(this.id).then(res => {
|
||||
this.parentId = res.data.parentId
|
||||
this.ruleVersionList = res.data.ruleVersionList
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.code = res.data.code
|
||||
this.name = res.data.name
|
||||
this.priority = res.data.priority
|
||||
this.description = res.data.description
|
||||
this.getRuleCont()
|
||||
})
|
||||
} else {
|
||||
this.ruledata = {
|
||||
"logical": "&&",
|
||||
"fieldId": null,
|
||||
"operator": null,
|
||||
"fieldValue": null,
|
||||
"conditionType": 1,
|
||||
"children": [],
|
||||
loopGroupActions: []
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
if(this.$store.state.FieldUser){
|
||||
console.log(this.$store.state.FieldUser.data.fieldList)
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
}else{
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
importNewVersion(e){
|
||||
this.addVersionLoading = true
|
||||
console.log(e)
|
||||
this.tempisEmpty = false
|
||||
this.deepverify(e.data.ruleConditionVo)
|
||||
if (this.tempisEmpty) {
|
||||
this.addVersionLoading = false
|
||||
return true
|
||||
}
|
||||
|
||||
// return
|
||||
let obj = {
|
||||
versionCode: e.name.versionCode,
|
||||
description: e.name.description,
|
||||
ruleId: this.id,
|
||||
score: e.data.score,
|
||||
// ruleAudit: this.SpecialField.ruleAudit,
|
||||
scoreFieldEn: e.data.scoreFieldEn,
|
||||
resultFieldEn: e.data.resultFieldEn,
|
||||
ruleConditionVo: e.data.ruleConditionVo,
|
||||
strategyOutputList: e.data.strategyOutputList,
|
||||
failOutputList: e.data.failOutputList
|
||||
}
|
||||
this.getData.addVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '添加版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getRuleCont()
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
async exportVersion(){
|
||||
const res = await this.getData.getInfo({
|
||||
id: this.version.id
|
||||
})
|
||||
|
||||
if(res.status!='1'){
|
||||
return
|
||||
}
|
||||
|
||||
this.mixinSaveJSON(res.data,`${this.name}_${res.data.description}.json`)
|
||||
|
||||
},
|
||||
addVersionExamine() {
|
||||
if (this.verification()) {
|
||||
return
|
||||
}
|
||||
this.addVersionDialog = true
|
||||
},
|
||||
addVersionSure(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
let tempRuleData = JSON.parse(JSON.stringify(this.ruledata))
|
||||
this.deepTypetransition(tempRuleData)
|
||||
let obj = {
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description,
|
||||
ruleId: this.id,
|
||||
score: this.SpecialField.score,
|
||||
ruleAudit: this.SpecialField.ruleAudit,
|
||||
scoreFieldEn: this.scoreFieldEn,
|
||||
resultFieldEn: this.resultFieldEn,
|
||||
ruleConditionVo: tempRuleData,
|
||||
strategyOutputList: this.outcontent,
|
||||
failOutputList: this.failOutputList
|
||||
}
|
||||
this.getData.addVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '添加版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getRuleCont()
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
updateVersion(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
let tempRuleData = JSON.parse(JSON.stringify(this.ruledata))
|
||||
this.deepTypetransition(tempRuleData)
|
||||
let obj = {
|
||||
ruleId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description,
|
||||
ruleId: this.id,
|
||||
score: this.SpecialField.score,
|
||||
ruleAudit: this.SpecialField.ruleAudit,
|
||||
scoreFieldEn: this.scoreFieldEn,
|
||||
resultFieldEn: this.resultFieldEn,
|
||||
ruleConditionVo: tempRuleData,
|
||||
strategyOutputList: this.outcontent,
|
||||
failOutputList: this.failOutputList
|
||||
|
||||
}
|
||||
this.getData.updateVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '版本重命名成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getRuleCont()
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
copyVersion(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
let obj = {
|
||||
ruleId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description
|
||||
}
|
||||
this.getData.copyVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '复制版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getRuleCont()
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
getRuleCont() {
|
||||
this.loading = true
|
||||
this.getData.getInfo({
|
||||
id: this.version.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.scoreFieldEn = res.data.scoreFieldEn
|
||||
this.resultFieldEn = res.data.resultFieldEn
|
||||
this.getType(res.data.ruleConditionVo)
|
||||
this.ruledata = res.data.ruleConditionVo ? res.data.ruleConditionVo : {
|
||||
"logical": "&&",
|
||||
"fieldId": null,
|
||||
"operator": null,
|
||||
"fieldValue": null,
|
||||
"conditionType": 1,
|
||||
"children": [],
|
||||
}
|
||||
this.outcontent = res.data.strategyOutputList
|
||||
this.failOutputList = res.data.failOutputList
|
||||
this.outcontent.forEach(value => {
|
||||
if (!value.variableType) {
|
||||
value.variableType = 1
|
||||
}
|
||||
})
|
||||
this.redeepverify(this.ruledata)
|
||||
|
||||
this.SpecialField.score = res.data.score
|
||||
this.SpecialField.ruleAudit = res.data.ruleAudit
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
versionChange() {
|
||||
this.ruleVersionList.forEach(value => {
|
||||
if (value.id === this.version.id) {
|
||||
this.version = JSON.parse(JSON.stringify(value))
|
||||
this.getRuleCont()
|
||||
}
|
||||
})
|
||||
},
|
||||
addVersion() {
|
||||
this.addVersionStatus = true
|
||||
this.tempadd = {
|
||||
scoreFieldEn: this.scoreFieldEn,
|
||||
resultFieldEn: this.resultFieldEn,
|
||||
ruledata: this.ruledata,
|
||||
outcontent: this.outcontent,
|
||||
failOutputList: this.failOutputList,
|
||||
score: this.SpecialField.score,
|
||||
}
|
||||
this.reset()
|
||||
},
|
||||
sureAddVersion() {
|
||||
if (this.verification()) {
|
||||
return
|
||||
}
|
||||
this.addVersionDialog = true
|
||||
},
|
||||
verification() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.code.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return true
|
||||
}
|
||||
if(this.verificationCode(this.code)||this.verificationName(this.name)){
|
||||
return true
|
||||
}
|
||||
if (this.code.trim() === '') {
|
||||
this.$message.error('请填入规则代码,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.priority === '') {
|
||||
this.$message.error('请选择规则优先级');
|
||||
return true
|
||||
}
|
||||
if (this.name.trim() === '') {
|
||||
this.$message.error('请填入规则名称,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.description === '') {
|
||||
this.$message.error('请填入规则描述,并检查空格');
|
||||
return true
|
||||
}
|
||||
// if (this.resultFieldEn === "") {
|
||||
// this.$message.error('请选择命中时输出变量');
|
||||
// return true
|
||||
// }
|
||||
// if (this.scoreFieldEn == "") {
|
||||
// this.$message.error('请选择得分时输出变量');
|
||||
// return true
|
||||
// }
|
||||
if (isNaN(Number(this.SpecialField.score)) || String(this.SpecialField.score).trim() === "") {
|
||||
this.$message.error('得分只能是数字');
|
||||
return true
|
||||
}
|
||||
let is = true
|
||||
this.tempisEmpty = false
|
||||
this.deepverify(this.ruledata)
|
||||
if (this.tempisEmpty) {
|
||||
return true
|
||||
}
|
||||
this.outcontent.forEach(value => {
|
||||
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType ===
|
||||
"") {
|
||||
is = false
|
||||
}
|
||||
if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value
|
||||
.fieldValue).formula.trim() ===
|
||||
'')) {
|
||||
is = false
|
||||
}
|
||||
})
|
||||
this.failOutputList.forEach(value => {
|
||||
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType ===
|
||||
"") {
|
||||
is = false
|
||||
}
|
||||
if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value
|
||||
.fieldValue).formula.trim() ===
|
||||
'')) {
|
||||
is = false
|
||||
}
|
||||
})
|
||||
if (is === false) {
|
||||
this.$message.error('请检查自定义输出部分是否有未填项');
|
||||
return true
|
||||
}
|
||||
},
|
||||
addVersionClose() {
|
||||
this.addVersionStatus = false
|
||||
this.SpecialField.score = this.tempadd.score
|
||||
this.scoreFieldEn = this.tempadd.scoreFieldEn
|
||||
this.resultFieldEn = this.tempadd.resultFieldEn
|
||||
this.ruledata = this.tempadd.ruledata
|
||||
this.outcontent = this.tempadd.outcontent
|
||||
this.failOutputList = this.tempadd.failOutputList
|
||||
},
|
||||
reset() {
|
||||
this.ruledata = {
|
||||
"logical": "&&",
|
||||
"fieldId": null,
|
||||
"operator": null,
|
||||
"fieldValue": null,
|
||||
"conditionType": 1,
|
||||
"children": [],
|
||||
loopGroupActions: []
|
||||
}
|
||||
this.SpecialField.score = 1
|
||||
this.outcontent = []
|
||||
this.failOutputList = []
|
||||
this.scoreFieldEn = ""
|
||||
this.resultFieldEn = ""
|
||||
},
|
||||
delectVersion() {
|
||||
this.getData.delectVersion({
|
||||
status: -1,
|
||||
ids: [this.version.id],
|
||||
strategyId: this.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.getRuleCont()
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
getType(obj) {
|
||||
if (obj.conditionType == 2 && !obj.valueType) {
|
||||
obj.valueType = this.mixinGetvalueType(obj.fieldId)
|
||||
}
|
||||
if (obj.children.length > 0) {
|
||||
obj.children.forEach(value => {
|
||||
this.getType(value)
|
||||
})
|
||||
}
|
||||
},
|
||||
outAdd(index) {
|
||||
this.outcontent.splice(index, 0, {
|
||||
"fieldId": "",
|
||||
strategyType: 'base_rule',
|
||||
"fieldValue": "",
|
||||
variableType: 1
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
this.loading = true
|
||||
if (this.verification()) {
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
let tempRuleData = JSON.parse(JSON.stringify(this.ruledata))
|
||||
this.deepTypetransition(tempRuleData)
|
||||
|
||||
|
||||
|
||||
this.outcontent.forEach(value => {
|
||||
value.fieldEn = this.mixinGetvalueEn(value.fieldId)
|
||||
})
|
||||
this.failOutputList.forEach(value => {
|
||||
value.fieldEn = this.mixinGetvalueEn(value.fieldId)
|
||||
})
|
||||
let obj = {
|
||||
"code": this.code.trim(),
|
||||
"name": this.name.trim(),
|
||||
"priority": this.priority,
|
||||
"description": String(this.description).trim(),
|
||||
difficulty: 2,
|
||||
ruleAudit: this.SpecialField.ruleAudit,
|
||||
ruleVersionList: [{
|
||||
score: this.SpecialField.score,
|
||||
scoreFieldEn: this.scoreFieldEn,
|
||||
resultFieldEn: this.resultFieldEn,
|
||||
ruleConditionVo: tempRuleData,
|
||||
strategyOutputList: this.outcontent,
|
||||
failOutputList: this.failOutputList
|
||||
}],
|
||||
}
|
||||
|
||||
|
||||
if (this.id == 0) {
|
||||
obj.ruleVersionList[0].versionCode = 'V:0'
|
||||
obj.ruleVersionList[0].description = '初始版本'
|
||||
obj.parentId = this.nameId == 99999999 ? 0 : this.nameId,
|
||||
this.getData.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.parentId = this.parentId
|
||||
obj.ruleVersionList[0].id = this.version.id
|
||||
this.getData.updatafield(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
// this.$emit('Ok')
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
}
|
||||
console.log(obj)
|
||||
},
|
||||
change(index) {
|
||||
this.ruledata[index].operator = ""
|
||||
this.ruledata[index].fieldValue = ""
|
||||
},
|
||||
redeepverify(obj) {
|
||||
if (obj.fieldEn) {
|
||||
if ((obj.fieldEn.indexOf('.') != -1 && obj.fieldEn[0] == '%') || obj.conditionType == 3||obj.conditionType===2) {
|
||||
obj.fieldEn = obj.fieldEn.split('.')
|
||||
}
|
||||
}
|
||||
if (obj.children.length > 0) {
|
||||
obj.children.forEach(value => {
|
||||
this.redeepverify(value)
|
||||
})
|
||||
}
|
||||
if (obj.loopGroupActions.length > 0) {
|
||||
obj.loopGroupActions.forEach(value => {
|
||||
if (value.actionValue.indexOf('.') != -1) {
|
||||
value.actionValue = value.actionValue.split('.')
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
deepverify(obj) {
|
||||
if (this.tempisEmpty) {
|
||||
return
|
||||
}
|
||||
if (obj.conditionType == 0) {
|
||||
if (obj.fieldId && obj.fieldValue && obj.operator) {} else {
|
||||
this.tempisEmpty = true
|
||||
return
|
||||
}
|
||||
}
|
||||
if (obj.children.length === 0 && obj.conditionType != 2) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('非规则节点后不允许为空');
|
||||
return
|
||||
}
|
||||
|
||||
if (obj.conditionType == 5) { //如果是条件组
|
||||
if (obj.children.length === 0 && obj.conditionType != 5) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('条件组后不允许为空');
|
||||
return
|
||||
}
|
||||
obj.condGroupResultCondition.children[0].fieldValue = obj.condGroupResultCondition.children[0]
|
||||
.fieldValue.trim()
|
||||
obj.condGroupResultCondition.children[1].fieldValue = obj.condGroupResultCondition.children[1]
|
||||
.fieldValue.trim()
|
||||
if (obj.condGroupResultCondition.children[0].fieldValue.trim() === "" || obj.condGroupResultCondition
|
||||
.children[1].fieldValue
|
||||
.trim() ===
|
||||
"" || isNaN(Number(obj.condGroupResultCondition.children[0].fieldValue)) || isNaN(Number(obj
|
||||
.condGroupResultCondition
|
||||
.children[1].fieldValue))) {
|
||||
if (obj.condGroupResultCondition.children[0].fieldValue !== 0 && obj.condGroupResultCondition
|
||||
.children[1].fieldValue !==
|
||||
0) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('条件组命中条件只能为数字且不为空与空格');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (obj.condGroupResultCondition.children[0].fieldValue < 0) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('条件组命中左边不能小于0');
|
||||
return
|
||||
}
|
||||
if (obj.condGroupResultCondition.children[1].fieldValue > obj.children.length) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('条件组命中右边不能大于条件总个数');
|
||||
return
|
||||
}
|
||||
if (Number(obj.condGroupResultCondition.children[0].fieldValue) > Number(obj.condGroupResultCondition
|
||||
.children[1].fieldValue)) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('条件组命中左边不能大于右边');
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
if (obj.conditionType == 3 && !obj.fieldEn) { //如果是for节点 且没有选择 被遍历的指标
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('for后需要确定循环的数组');
|
||||
return
|
||||
}
|
||||
if (obj.conditionType == 2) {
|
||||
obj.fieldValue = obj.fieldValue.trim()
|
||||
if (!obj.fieldEn || !obj.operator || !obj.fieldValue) {
|
||||
if (obj.fieldValue !== 0) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('规则节点不允许有空值');
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj.conditionType == 3 && obj.loopResultCondition.children.length === 0) { //如果是for节点 且没有子节点
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('for的输出节点后不允许为空');
|
||||
return
|
||||
}
|
||||
if (obj.conditionType == 3 && obj.loopResultCondition.children.length != 0) { //如果是for节点 且 有输出节点
|
||||
obj.loopResultCondition.children.forEach(value => {
|
||||
this.deepverify(value)
|
||||
})
|
||||
}
|
||||
if (obj.children.length > 0) { //如果有子节点
|
||||
obj.children.forEach(value => {
|
||||
this.deepverify(value)
|
||||
})
|
||||
}
|
||||
if (obj.loopGroupActions.length > 0) { //如果有输出节点
|
||||
console.log(obj)
|
||||
let is = false
|
||||
obj.loopGroupActions.forEach(value => {
|
||||
if (!value.actionKey || !value.actionType || !value.actionValue) {
|
||||
if (value.actionValue === 0 && value.actionType != 1) {
|
||||
this.tempisEmpty = true
|
||||
|
||||
is = true
|
||||
}
|
||||
}
|
||||
})
|
||||
if (is) {
|
||||
this.$message.error('输出变量不允许有空值');
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
deepTypetransition(obj) {
|
||||
if (Array.isArray(obj.fieldEn)) {
|
||||
obj.fieldEn = obj.fieldEn.join('.')
|
||||
}
|
||||
if (obj.children.length > 0) {
|
||||
obj.children.forEach(value => {
|
||||
this.deepTypetransition(value)
|
||||
})
|
||||
}
|
||||
if (obj.loopGroupActions.length > 0) {
|
||||
obj.loopGroupActions.forEach(value => {
|
||||
if (Array.isArray(value.actionValue)) {
|
||||
value.actionValue = value.actionValue.join('.')
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
478
h5-enginex-manager/src/components/common/rule/ruleRule.vue
Normal file
478
h5-enginex-manager/src/components/common/rule/ruleRule.vue
Normal file
@@ -0,0 +1,478 @@
|
||||
<style>
|
||||
|
||||
.rule_home {
|
||||
display: flex;
|
||||
|
||||
}
|
||||
|
||||
.rule_fa {
|
||||
display: flex;
|
||||
width: 20%;
|
||||
height: 30%;
|
||||
margin: 10px 10px 0 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.rule_son {
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.rule_dialg_header{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 40px;
|
||||
}
|
||||
.rule_dialg_cont{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
height: 40vh;
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.rule_dialg_cont>div{
|
||||
width: 30%;
|
||||
overflow: hidden;
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.rule_dialg_cont>div:hover{
|
||||
|
||||
overflow: unset;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="margin-left: 20px;margin-top: 20px;">
|
||||
<div v-if="Data&&FieldUser">
|
||||
<div v-if="type==1">
|
||||
条件:
|
||||
<div v-for="(item,index) in Data" class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="$emit('faadd',index)"></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="$emit('fadelect',index)" :disabled="index===0?'disabled':false"
|
||||
style="margin-right: 10px;"></el-button>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
|
||||
|
||||
<el-select v-show="index===0" v-model="item.logical" placeholder="请选择" style="width: 200px;margin-right: 10px;">
|
||||
<el-option label="(" value="("></el-option>
|
||||
<el-option label="((" value="(("></el-option>
|
||||
<el-option label="(((" value="((("></el-option>
|
||||
<el-option label="空置" value="-1"></el-option>
|
||||
</el-select>
|
||||
<el-select v-show="index!=0" v-model="item.logical" placeholder="请选择" style="width: 200px;margin-right: 10px;">
|
||||
<el-option v-for="cont in logical" :key="cont.id" :label="cont.label" :value="cont.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select :value="getCn(item.fieldId,2)" placeholder="请选择" style="width: 200px;" @change="$emit('change',index)"
|
||||
@focus="dataClick(index,item.fieldId)">
|
||||
</el-select>
|
||||
|
||||
|
||||
<ruleRelation v-model="item.operator" :value2.sync="item.fieldValue" :valueType="getvalueType(item.fieldId)"></ruleRelation>
|
||||
|
||||
<!-- <el-input v-model="item.fieldValue" maxlength="30" placeholder="请输入内容,最长30位" style="width: 300px;margin-left: 10px;"
|
||||
v-show="getvalueType(item.fieldId)!==3">
|
||||
</el-input>
|
||||
<el-select v-model="item.fieldValue" placeholder="请选择" style="width: 300px;margin-left: 10px;" v-show="getvalueType(item.fieldId)===3">
|
||||
<el-option label="是" value="1"></el-option>
|
||||
<el-option label="否" value="0"></el-option>
|
||||
</el-select> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle disabled='disabled'></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
<el-select v-model="SpecialField.lastLogical" placeholder="请选择" style="width: 200px;">
|
||||
<el-option label=")" value=")"></el-option>
|
||||
<el-option label="))" value="))"></el-option>
|
||||
<el-option label=")))" value=")))"></el-option>
|
||||
<el-option label="空置" value="-1"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
输出:
|
||||
<slot></slot>
|
||||
<!-- <div class="rule_home">
|
||||
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle disabled='disabled'></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-input value="命中动作:" maxlength="30" style="width: 200px;margin-right: 10px;" disabled></el-input>
|
||||
<p style="margin-right: 10px;">=</p>
|
||||
<el-select v-model="SpecialField.ruleAudit" placeholder="请选择" style="width: 200px;">
|
||||
<el-option label="终止决策流" :value="2"></el-option>
|
||||
<el-option label="继续决策流" :value="5"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
</div> -->
|
||||
|
||||
<div v-for="(value,index) in outcontent" class="rule_home">
|
||||
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="$emit('outAdd',index+1)"></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="$emit('outDelect',index)" style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-select :value="getCn(value.fieldId)" placeholder="请选择" style="width: 200px;margin-right: 10px;" @focus="outClick(index)">
|
||||
</el-select>
|
||||
<p style="margin-right: 10px;">=</p>
|
||||
<div style="display: flex;">
|
||||
<div style="font-size: 14px;padding-right: 5px;width: 60px;height: 40px;background-color: #d4d4d4;border-radius: 4px;line-height: 40px;color: #fff;text-align: center;">
|
||||
<!-- <el-select v-model="value.variableType" placeholder="请选择" @change="value.fieldValue=''">
|
||||
<el-option label="常量" value="1"></el-option>
|
||||
<el-option label="变量" value="2"></el-option>
|
||||
</el-select> -->
|
||||
|
||||
|
||||
|
||||
|
||||
<el-dropdown trigger="click" @command="value.variableType=$event;value.fieldValue=''">
|
||||
<span class="el-dropdown-link" style="color: #fff;">
|
||||
{{value.variableType==1?"常量":"变量"}}<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item icon="el-icon-caret-right" :command="1">常量</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-caret-right" :command="2">变量</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<el-input v-show="value.variableType==1" v-model="value.fieldValue" maxlength="30" style="width: 200px;margin-right:10px;margin-left: -5px;"></el-input>
|
||||
<!-- {{Number(value.fieldValue.split('|')[0])}} -->
|
||||
<el-select v-show="value.variableType==2" filterable v-model="value.fieldValue" placeholder="请选择" style="width: 200px;margin-right:10px;margin-left: -5px;">
|
||||
<el-option v-for="item in FieldUser" :label="item.fieldCn" :value="Number(item.id)"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog title="输入参数" :visible.sync="dialogVisible" width="50%">
|
||||
|
||||
<div class="rule_dialg_header">
|
||||
请选择参数:
|
||||
<div>
|
||||
<el-input v-model="search" maxlength="30" placeholder="快速搜索"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rule_dialg_cont">
|
||||
<div v-for="value in fradioList">
|
||||
<el-radio v-model="radio" :label="value.id" border size="mini">{{value.fieldCn}}</el-radio>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false;radio='';search=''">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogSure()">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
export default {
|
||||
components: {
|
||||
ruleRelation
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
search: '',
|
||||
tempcur: '',
|
||||
|
||||
radioList: [],
|
||||
radio: '',
|
||||
dialogVisible: false,
|
||||
logical: [{
|
||||
value: '&&',
|
||||
label: 'and',
|
||||
}, {
|
||||
value: '||',
|
||||
label: 'or',
|
||||
}, {
|
||||
value: '(',
|
||||
label: '(',
|
||||
}, {
|
||||
value: '((',
|
||||
label: '((',
|
||||
}, {
|
||||
value: '(((',
|
||||
label: '(((',
|
||||
}, {
|
||||
value: ')',
|
||||
label: ')',
|
||||
}, {
|
||||
value: '))',
|
||||
label: '))',
|
||||
}, {
|
||||
value: ')))',
|
||||
label: ')))',
|
||||
}, {
|
||||
value: '&&(',
|
||||
label: 'and (',
|
||||
}, {
|
||||
value: '&&((',
|
||||
label: 'and ((',
|
||||
}, {
|
||||
value: '&&(((',
|
||||
label: 'and (((',
|
||||
}, {
|
||||
value: ')&&',
|
||||
label: ') and',
|
||||
}, {
|
||||
value: '))&&',
|
||||
label: '))and',
|
||||
}, {
|
||||
value: ')))&&',
|
||||
label: ')))and',
|
||||
}, {
|
||||
value: ')&&(',
|
||||
label: ')and(',
|
||||
}, {
|
||||
value: '))&&',
|
||||
label: '))and',
|
||||
}, {
|
||||
value: ')&&((',
|
||||
label: ') and ((',
|
||||
}, {
|
||||
value: ')&&(((',
|
||||
label: ') and (((',
|
||||
}, {
|
||||
value: '))&&(',
|
||||
label: ')) and (',
|
||||
}, {
|
||||
value: '))&&((',
|
||||
label: ')) and ((',
|
||||
}, {
|
||||
value: '))&&(((',
|
||||
label: ')) and (((',
|
||||
}, {
|
||||
value: ')))&&(',
|
||||
label: '))) and (',
|
||||
}, {
|
||||
value: ')))&&((',
|
||||
label: '))) and ((',
|
||||
}, {
|
||||
value: ')))&&(((',
|
||||
label: '))) and (((',
|
||||
}, {
|
||||
value: '||(',
|
||||
label: 'or (',
|
||||
}, {
|
||||
value: '||((',
|
||||
label: 'or ((',
|
||||
}, {
|
||||
value: '||(((',
|
||||
label: 'or(((',
|
||||
}, {
|
||||
value: ')||',
|
||||
label: ') or ',
|
||||
}, {
|
||||
value: '))||',
|
||||
label: ')) or ',
|
||||
}, {
|
||||
value: ')))||',
|
||||
label: '))) or ',
|
||||
}, {
|
||||
value: ')||(',
|
||||
label: ' ) or (',
|
||||
}, {
|
||||
value: ')||((',
|
||||
label: ' ) or (( ',
|
||||
}, {
|
||||
value: '))||(',
|
||||
label: ')) or ( ',
|
||||
}, {
|
||||
value: '))||((',
|
||||
label: ')) or (( ',
|
||||
}, {
|
||||
value: '))||(((',
|
||||
label: ')) or (((',
|
||||
}, {
|
||||
value: ')))||(',
|
||||
label: ' ))) or (',
|
||||
}, {
|
||||
value: ')))||((',
|
||||
label: '))) or ((',
|
||||
}, {
|
||||
value: ')))||(((',
|
||||
label: '))) or (((',
|
||||
}, {
|
||||
value: '-1',
|
||||
label: '空置',
|
||||
}]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log(this.Data)
|
||||
},
|
||||
computed: {
|
||||
|
||||
FieldUser() {
|
||||
if (this.$store.state.FieldUser) {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
outPutUser() {
|
||||
if (this.$store.state.Output) {
|
||||
return this.$store.state.Output.data.paramMap.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
fradioList() {
|
||||
if (this.search != "") {
|
||||
let arr = []
|
||||
|
||||
arr = this.radioList.filter(value => {
|
||||
if (value.fieldCn.indexOf(this.search) != -1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
return arr
|
||||
} else {
|
||||
return this.radioList
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
props: {
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
Data: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
SpecialField: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
outcontent: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
dialogSure() {
|
||||
|
||||
if (this.radio == '') {
|
||||
this.$message.error('请选择一个字段,或者选择取消')
|
||||
} else {
|
||||
if (this.tempcur.split('###')[1] === "Data") {
|
||||
this.Data.forEach((value, index) => {
|
||||
if (index === parseInt(this.tempcur.split('###')[0])) {
|
||||
console.log(value)
|
||||
value.fieldId = this.radio + '|' + this.getvalueEn(this.radio)
|
||||
value.operator = ""
|
||||
value.fieldValue = ""
|
||||
}
|
||||
})
|
||||
} else if (this.tempcur.split('###')[1] === "out") {
|
||||
console.log(this.outcontent)
|
||||
this.outcontent.forEach((value, index) => {
|
||||
if (index === parseInt(this.tempcur.split('###')[0])) {
|
||||
value.fieldId = this.radio
|
||||
value.fieldEn = this.mixinGetvalueEn(this.radio)
|
||||
value.fieldValue = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
this.dialogVisible = false;
|
||||
this.radio = '';
|
||||
this.search = '';
|
||||
}
|
||||
|
||||
},
|
||||
getCn(id, type) {
|
||||
let Cn
|
||||
if (type != 2) {
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id == parseInt(id)) {
|
||||
Cn = value.fieldCn
|
||||
return
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id == parseInt(id)) {
|
||||
Cn = value.fieldCn
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
return Cn
|
||||
},
|
||||
getvalueEn(cont) {
|
||||
let num
|
||||
console.log(cont)
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id === parseInt(cont)) {
|
||||
num = value.fieldEn
|
||||
console.log(1)
|
||||
}
|
||||
})
|
||||
return num
|
||||
},
|
||||
dataClick(index, id) {
|
||||
this.tempcur = index + '###Data'
|
||||
this.radioList = this.FieldUser
|
||||
this.radio = Number(id.split('|')[0])
|
||||
console.log(id)
|
||||
this.dialogVisible = true
|
||||
},
|
||||
outClick(index) {
|
||||
this.tempcur = index + '###out'
|
||||
console.log(this.tempcur)
|
||||
this.radioList = this.FieldUser
|
||||
this.dialogVisible = true
|
||||
},
|
||||
getvalueType(cont) {
|
||||
let num
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id === parseInt(cont)) {
|
||||
num = value.valueType
|
||||
}
|
||||
})
|
||||
return num
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
144
h5-enginex-manager/src/components/common/ruleRelation.vue
Normal file
144
h5-enginex-manager/src/components/common/ruleRelation.vue
Normal file
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<div style="display: inline;">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-select v-model="data" :size="size" :filterable="type==2?'filterable':false" placeholder="请选择"
|
||||
ref="select" style="width: 100px;margin-left: 10px;" @change="change" @blur="$emit('blur')">
|
||||
<el-option label="大于" value=">" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="大于等于" value=">=" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="等于" value="==" v-show="[5].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="小于" value="<" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="小于等于" value="<=" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="不等于" value="!=" v-show="[5].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="包含" value="contains" v-show="[2,5,6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="不包含" value="not contains" v-show="[2,5,6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="为空" value="is empty" v-show="[6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="不为空" value="not empty" v-show="[6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="正则匹配" value="regex" v-show="[2].indexOf(valueType)!=-1"></el-option>
|
||||
</el-select>
|
||||
|
||||
<el-input :value="value2" @input="$emit('update:value2',$event)" maxlength="30" :size="size"
|
||||
placeholder="请输入内容,最长30位" style="width: 100px;margin-left: 10px;"
|
||||
v-if="!variableType&&openValue2&&valueType!==3&&['is empty','not empty'].indexOf(data)==-1">
|
||||
</el-input>
|
||||
<el-select :value="value2" @input="$emit('update:value2',$event)" placeholder="请选择" :size="size"
|
||||
style="width: 100px;margin-left: 10px;" v-if="!variableType&&openValue2&&valueType===3">
|
||||
<el-option label="是" value="="></el-option>
|
||||
<el-option label="否" value="!="></el-option>
|
||||
</el-select>
|
||||
<varialeSelect v-if="variableType" :valueType="valueType"
|
||||
:disabled="variableDisList" :variableType="variableType"
|
||||
@update:variableType="$emit('update:variableType',$event)" :value="value2"
|
||||
@input="$emit('update:value2',$event)" v-bind="$attrs" :interceptCustom="interceptCustom" @CustomCallback="$emit('CustomCallback',$event)" style="margin-left: 10px;"></varialeSelect>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
components: {
|
||||
varialeSelect
|
||||
},
|
||||
props: {
|
||||
openValue2: { //是否打开后半截输入框
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
value2: { //后半截输入框的Key
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
type: { //是否打开搜索
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
openSelect: { //是否自动打开下拉选择框
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
value: { //大于小于等信息
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
valueType: { //数字 或者字符串 或者 JSON
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
size: { //大小
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
variableType: { //是否打开 常量变量自定义 以及默认为哪个 0为不打开
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
variableDis: { //禁用常量变量自定义
|
||||
type: Array || null,
|
||||
default: null
|
||||
},
|
||||
interceptCustom:{
|
||||
type:Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
data: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.data = this.value
|
||||
// console.log(this.$listeners)
|
||||
},
|
||||
methods: {
|
||||
change() {
|
||||
this.$emit('change')
|
||||
if (['is empty', 'not empty'].indexOf(this.data) == -1) {
|
||||
if (this.data == 'regex') {
|
||||
this.$emit('update:value2', '')
|
||||
} else {
|
||||
this.$emit('update:value2', '0')
|
||||
}
|
||||
}
|
||||
if (this.data == 'regex') { //如果选择正则匹配 则只能为变量
|
||||
this.$emit('update:variableType', 1)
|
||||
}
|
||||
|
||||
|
||||
this.$emit('input', this.data)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
variableDisList() {
|
||||
|
||||
let arr = []
|
||||
if (this.variableDis) {
|
||||
|
||||
arr.push(...this.variableDis)
|
||||
}
|
||||
if (this.data == 'regex') {
|
||||
arr.push(...[2, 3])
|
||||
}
|
||||
arr = Array.from(new Set(arr))
|
||||
return arr
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value() {
|
||||
this.data = this.value
|
||||
},
|
||||
openSelect() {
|
||||
if (this.openSelect) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.select.focus()
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
576
h5-enginex-manager/src/components/common/te.vue
Normal file
576
h5-enginex-manager/src/components/common/te.vue
Normal file
@@ -0,0 +1,576 @@
|
||||
<style>
|
||||
.te_top{
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
background-color: #aaa;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
user-select: none;
|
||||
}
|
||||
.te_top>p{
|
||||
color: #eee;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
line-height: 30px;
|
||||
}
|
||||
.te_top>p:hover{
|
||||
color: #fff;
|
||||
cursor:pointer
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
|
||||
<p style="font-size:14px;margin-bottom: 5px;color: #aaa;">
|
||||
‘@’字符选择变量
|
||||
</p>
|
||||
<div class="te_top">
|
||||
<p @click="textareaAdd('+')">+</p>
|
||||
<p @click="textareaAdd('-')">-</p>
|
||||
<p @click="textareaAdd('*')">*</p>
|
||||
<p @click="textareaAdd('/')">/</p>
|
||||
<p @click="textareaAdd('sqrt(,)')">sqrt</p>
|
||||
<p @click="textareaAdd('In(,)')">In</p>
|
||||
<p @click="textareaAdd('avg(,)')">avg()</p>
|
||||
<p @click="textareaAdd('(,)')">()</p>
|
||||
<p @click="textareaAdd('abs(,)')">abs</p>
|
||||
<p @click="textareaAdd('max(,)')">max</p>
|
||||
<p @click="textareaAdd('min(,)')">min</p>
|
||||
<p @click="textareaAdd('lg(,)')">lg</p>
|
||||
<p @click="textareaAdd('exp(,)')">exp</p>
|
||||
<p @click="textareaAdd('ceil(,)')">ceil</p>
|
||||
<p @click="textareaAdd('floor(,)')">floor</p>
|
||||
</div>
|
||||
<el-input type="textarea" rows="9" placeholder="请输入内容" v-model="formula_show" ref="textarea" @input="$emit('input',formula_show)">
|
||||
</el-input>
|
||||
<fieldUserTable :text="text" :fieldUser="FieldUser" refs="t" @dbc="dbclick" :show="isshow" @close="isshow=false"></fieldUserTable>
|
||||
<el-dialog :title="'当前编辑'+nowCurr" :visible.sync="dialogVisible" width="30%" append-to-body>
|
||||
<el-button @click="delect">删除字段</el-button>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import fieldUserTable from '@/components/common/fieldUserTable.vue'
|
||||
import {
|
||||
validateSection
|
||||
} from '@/api/index.js'
|
||||
import bus from './SCO/bus.js'
|
||||
export default {
|
||||
components: {
|
||||
fieldUserTable
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
tempsection: [],
|
||||
sectionVisible: false, //区间编辑弹窗
|
||||
nowCurr: '',
|
||||
dialogVisible: false,
|
||||
isshow: false,
|
||||
text: '',
|
||||
tempIndex: '',
|
||||
lest: '',
|
||||
islest: false,
|
||||
tempFormula: '',
|
||||
formula_show: '',
|
||||
cursorfront: '',
|
||||
cursorlest: '',
|
||||
lastKeyDown: '',
|
||||
fields: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.textarea.$refs.textarea.onkeydown = (e) => {
|
||||
|
||||
if (e.key == 'a') {
|
||||
if (e.ctrlKey) {
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
if (e.key == "Backspace" || e.key == "Delete") {
|
||||
this.lastKeyDown = e.key
|
||||
|
||||
if (e.key == "Backspace" && this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart - 1,
|
||||
this.$refs.textarea.$refs.textarea.selectionStart) == '@' && (this.isodd(this.formula_show, '@') == false)) {
|
||||
e.preventDefault()
|
||||
this.openDialog()
|
||||
}
|
||||
if (e.key == "Delete" && this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart, this.$refs
|
||||
.textarea.$refs.textarea.selectionStart + 1) == '@') {
|
||||
e.preventDefault()
|
||||
this.openDialog()
|
||||
}
|
||||
}
|
||||
if (((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true)) || (this.dialogVisible ==
|
||||
true)) {
|
||||
|
||||
e.preventDefault()
|
||||
this.openDialog()
|
||||
}
|
||||
}
|
||||
this.$refs.textarea.$refs.textarea.onclick = (e) => {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
if ((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true) && this.formula_show
|
||||
.indexOf(
|
||||
'@') != -1) {
|
||||
this.openDialog()
|
||||
}
|
||||
|
||||
}
|
||||
this.$refs.textarea.$refs.textarea.onfocus = () => {
|
||||
document.body.onmousemove = (e) => {
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
this.$refs.textarea.$refs.textarea.onblur = () => {
|
||||
document.body.onmousemove = (e) => {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.formula_show = this.value
|
||||
console.log(this.formula_show,this.value)
|
||||
bus.$on('getOk', (e) => {
|
||||
this.formula_show = e.formula_show
|
||||
this.tempFormula = e.formula_show
|
||||
this.fields = this.deepClone(e.fields)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
setCaretPosition(ctrl, pos) { //设置光标位置函数
|
||||
if (ctrl.setSelectionRange) {
|
||||
ctrl.focus();
|
||||
this.$nextTick(()=>{
|
||||
ctrl.setSelectionRange(pos, pos);
|
||||
})
|
||||
} else if (ctrl.createTextRange) {
|
||||
var range = ctrl.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
},
|
||||
textareaAdd(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
if(e.split(',')[1]){
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + e.split(',')[1] + this.cursorlest
|
||||
}else{
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + this.cursorlest
|
||||
}
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea,(this.cursorfront + e.split(',')[0]).length)
|
||||
|
||||
// console.log(e, this.formula_show)
|
||||
},
|
||||
sectionSure() {
|
||||
this.loading = true
|
||||
let isNot = false
|
||||
let Z = /^(\[|\()\d*,\d*(\]|\))$/
|
||||
this.tempsection.forEach(value => {
|
||||
if (!Z.test(value.segment)) {
|
||||
isNot = true
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
if (isNot) {
|
||||
this.$message.error('请检查区间格式');
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
|
||||
let arr = this.tempsection.map(value => {
|
||||
return value.segment
|
||||
})
|
||||
|
||||
validateSection(arr).then(res => {
|
||||
if (res.status == "1") {
|
||||
if (res.data.result == "1") {
|
||||
this.$message({
|
||||
message: res.data.msg,
|
||||
type: 'success'
|
||||
});
|
||||
let isNotValue = false
|
||||
this.tempsection.forEach(value => {
|
||||
if (value.value == "") {
|
||||
|
||||
isNotValue = true
|
||||
}
|
||||
})
|
||||
if (isNotValue) {
|
||||
|
||||
setTimeout(() => {
|
||||
this.$message.error('值不能为空');
|
||||
}, 10)
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
let ind = this.cursorfront.match(/@.*?@/g) === null ? [] : this.cursorfront.match(/@.*?@/g);
|
||||
this.fields[ind.length].segments = this.deepClone(this.tempsection)
|
||||
this.sectionVisible = false
|
||||
this.tempsection = []
|
||||
|
||||
} else {
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
|
||||
}
|
||||
this.loading = false
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
delectSegment(index) {
|
||||
this.tempsection.splice(index, 1)
|
||||
},
|
||||
addSegment(index) {
|
||||
this.tempsection.splice(index, 0, {
|
||||
"segment": "",
|
||||
"value": ''
|
||||
})
|
||||
},
|
||||
// 打开区间编辑
|
||||
openSection() {
|
||||
let ind = this.cursorfront.match(/@.*?@/g) === null ? [] : this.cursorfront.match(/@.*?@/g);
|
||||
this.tempsection = this.deepClone(this.fields[ind.length].segments)
|
||||
// this.sectionVisible = true
|
||||
},
|
||||
// 获取 字符串中 有 多少个指定字符
|
||||
getTempIndex(string, str) {
|
||||
let temp = 0
|
||||
for (let num = 0;;) {
|
||||
|
||||
|
||||
if (string.indexOf(str, temp) != -1) {
|
||||
temp = string.indexOf(str, temp)
|
||||
temp++
|
||||
num++
|
||||
} else {
|
||||
return num
|
||||
}
|
||||
}
|
||||
// console.log(string, str)
|
||||
},
|
||||
getTempArreyIndex(array, str) {
|
||||
let num = 0
|
||||
array.forEach((value) => {
|
||||
if (value.field_name == "str") {
|
||||
num++
|
||||
}
|
||||
})
|
||||
return num
|
||||
|
||||
|
||||
},
|
||||
countCurr() {
|
||||
if ((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true)) {
|
||||
// console.log(this.cursorfront.substring(this.cursorfront.lastIndexOf('@')))
|
||||
// console.log(this.cursorlest.substring(0,this.cursorlest.indexOf('@')+1))
|
||||
// console.log(this.cursorfront.lastIndexOf('@'),'上半句最后一个@')
|
||||
|
||||
|
||||
|
||||
} else if (this.lastKeyDown == "Backspace") {
|
||||
this.cursorfront = this.cursorfront.substring(0, this.cursorfront.length - 1)
|
||||
this.cursorlest = '@' + this.cursorlest
|
||||
|
||||
} else if (this.lastKeyDown == "Delete") {
|
||||
this.cursorfront = this.cursorfront + '@'
|
||||
this.cursorlest = this.cursorlest.substr(1);
|
||||
|
||||
}
|
||||
let str = this.cursorfront.substring(this.cursorfront.lastIndexOf('@')) + this.cursorlest.substring(0, this.cursorlest
|
||||
.indexOf('@') + 1)
|
||||
// console.log(this.cursorfront, str)
|
||||
// console.log(this.formula_show.indexOf(str,1),'整句中str的位置(1)')
|
||||
this.nowCurr = str + '|' + this.getTempIndex(this.cursorfront, str)
|
||||
|
||||
|
||||
},
|
||||
openDialog() {
|
||||
this.countCurr()
|
||||
this.dialogVisible = true
|
||||
this.$refs.textarea.$refs.textarea.blur()
|
||||
|
||||
// 数组添加
|
||||
if (this.getTempIndex(this.formula_show, this.nowCurr.split('|')[0]) > this.getTempArreyIndex(this.fields, this.nowCurr
|
||||
.split('|')[0].substring(1, this.nowCurr.split('|')[0].Length - 1))) {
|
||||
|
||||
|
||||
let ind = this.cursorfront.match(/@.*?@/g) === null ? [] : this.cursorfront.match(/@.*?@/g);
|
||||
let ind2 = this.formula_show.match(/@.*?@/g) === null ? [] : this.formula_show.match(/@.*?@/g);
|
||||
|
||||
|
||||
// console.log(this.fields, ind2, ind, ind2)
|
||||
let name = this.nowCurr.split('|')[0].substring(1, this.nowCurr.split('|')[0].length - 1)
|
||||
let obj = {}
|
||||
this.FieldUser.data.fieldList.forEach(value => {
|
||||
if (value.fieldCn === name) {
|
||||
obj = value
|
||||
}
|
||||
})
|
||||
if (typeof this.fields[ind.length] === 'object' && this.fields[ind.length].field_type != 0) {
|
||||
// console.log(this.fields[ind.length].length)
|
||||
if (this.fields.length < ind2.length) {
|
||||
|
||||
// console.log(ind)
|
||||
|
||||
this.fields.splice(ind.length, 0, {
|
||||
"field_id": obj.id,
|
||||
"field_code": obj.fieldEn,
|
||||
"field_name": name,
|
||||
"field_type": 1,
|
||||
"segments": [{
|
||||
"segment": "",
|
||||
"value": ''
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
// this.fields[ind.length] = {
|
||||
// n: Math.random()
|
||||
// }
|
||||
// 开启数据回显
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// this.fields[ind.length] = {
|
||||
// "field_id": obj.id,
|
||||
// "field_code": obj.fieldEn,
|
||||
// "field_name": name,
|
||||
// "field_type": 1,
|
||||
// "segments": [{
|
||||
// "segment": "",
|
||||
// "value": ''
|
||||
// }]
|
||||
// }
|
||||
this.$set(this.fields, ind.length, {
|
||||
"field_id": obj.id,
|
||||
"field_code": obj.fieldEn,
|
||||
"field_name": name,
|
||||
"field_type": 1,
|
||||
"segments": [{
|
||||
"segment": "",
|
||||
"value": ''
|
||||
}]
|
||||
})
|
||||
for (let i = 0; i < ind.length; i++) {
|
||||
|
||||
if (typeof this.fields[i] !== 'object') {
|
||||
// this.fields[i] = {
|
||||
// "field_id": 0,
|
||||
// "field_code": "",
|
||||
// "field_name": "",
|
||||
// "field_type": 0,
|
||||
// "segments": [{
|
||||
// "segment": "",
|
||||
// "value": ''
|
||||
// }]
|
||||
// }
|
||||
|
||||
|
||||
this.$set(this.fields, i, {
|
||||
"field_id": 0,
|
||||
"field_code": "",
|
||||
"field_name": "",
|
||||
"field_type": 0,
|
||||
"segments": [{
|
||||
"segment": "",
|
||||
"value": ''
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// console.log(this.fields)
|
||||
} else { //数组更新
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
delect() {
|
||||
let str = this.nowCurr.split('|')[0]
|
||||
let index = this.nowCurr.split('|')[1]
|
||||
this.delectShow(str, parseInt(index))
|
||||
this.delectArray(str, parseInt(index))
|
||||
this.dialogVisible = false
|
||||
this.cursorfront = ""
|
||||
this.cursorlest = ""
|
||||
this.nowCurr = ""
|
||||
this.lastKeyDown = ""
|
||||
|
||||
},
|
||||
|
||||
delectShow(str, index) { // 回显删除
|
||||
|
||||
// console.log(this.cursorfront.lastIndexOf('@'))
|
||||
this.formula_show = this.formula_show.substring(0, this.cursorfront.lastIndexOf('@')) + this.formula_show.substring(
|
||||
this.cursorfront.lastIndexOf('@') + str.length, )
|
||||
this.tempFormula = this.formula_show
|
||||
|
||||
|
||||
},
|
||||
delectArray(str, index) { // 数组删除
|
||||
let ind = this.cursorfront.match(/@.*?@/g) === null ? [] : this.cursorfront.match(/@.*?@/g);
|
||||
|
||||
// console.log(ind)
|
||||
this.fields.splice(ind.length, 1)
|
||||
// console.log(this.fields)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
dbclick(e) {
|
||||
let T = ""
|
||||
T = this.formula_show.split("")
|
||||
T.splice(this.tempIndex, this.text.length + 1, '@' + e + '@')
|
||||
this.formula_show = T.join("")
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
},
|
||||
deepClone(obj) {
|
||||
if (this.getType(obj) === 'Array') {
|
||||
var res = []
|
||||
} else if (this.getType(obj) === 'Object') {
|
||||
var res = {}
|
||||
} else {
|
||||
return obj
|
||||
}
|
||||
for (var i in obj) {
|
||||
res[i] = this.deepClone(obj[i])
|
||||
}
|
||||
return res
|
||||
},
|
||||
getType(obj) {
|
||||
var res = Object.prototype.toString.call(obj)
|
||||
//截取注意[] 符号,和空格
|
||||
return res.slice(8, -1) // 也可以res.length-1
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
formula_show() {
|
||||
let num = 0
|
||||
|
||||
for (let i of this.formula_show) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
this.isshow = true
|
||||
for (let i in this.formula_show) {
|
||||
if (this.formula_show[i] !== this.tempFormula[i] && this.formula_show[i] == "@") {
|
||||
|
||||
if (this.islest) {
|
||||
this.tempIndex = i
|
||||
|
||||
this.lest = this.formula_show.substring(parseInt(this.tempIndex) + 1, this.formula_show.length)
|
||||
this.islest = false
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let T = this.formula_show.substring(parseInt(this.tempIndex) + 1, this.formula_show.length)
|
||||
if (this.lest !== "") {
|
||||
// console.log(T)
|
||||
T = T.substring(0, T.indexOf(this.lest))
|
||||
|
||||
} else {
|
||||
T = T.substring(0, T.length)
|
||||
}
|
||||
|
||||
this.text = T
|
||||
if (this.text === "@") {
|
||||
this.text = ""
|
||||
}
|
||||
// console.log('lest:' + this.lest, 'index:' + this.tempIndex, "T:" + T)
|
||||
|
||||
} else {
|
||||
this.islest = true
|
||||
this.text = ""
|
||||
this.tempIndex = null
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
}
|
||||
this.tempFormula = this.formula_show
|
||||
this.data.formula_show = this.formula_show
|
||||
this.$emit('input', this.formula_show)
|
||||
},
|
||||
fields: {
|
||||
handler: function() {
|
||||
this.data.fields = this.fields
|
||||
},
|
||||
deep: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
503
h5-enginex-manager/src/components/common/teParam.vue
Normal file
503
h5-enginex-manager/src/components/common/teParam.vue
Normal file
@@ -0,0 +1,503 @@
|
||||
<style>
|
||||
.te_top {
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
background-color: #aaa;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
}
|
||||
|
||||
.te_top>p {
|
||||
color: #eee;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.te_top>p:hover {
|
||||
color: #fff;
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.teParamParamList {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
|
||||
<p>
|
||||
入参:
|
||||
</p>
|
||||
<div>
|
||||
|
||||
|
||||
<div v-for="(value,index) in paramList"
|
||||
style="margin-top: 10px;border-bottom: 1px #ddd dotted;padding-bottom: 5px;">
|
||||
<el-select v-model="value.id" filterable placeholder="请选择" @change="paramChange(index,$event)">
|
||||
<el-option v-for="item in FieldUser" :label="item.fieldCn" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<i class="el-icon-circle-close" style="color: red;font-size: 20px;margin-left: 10px;"
|
||||
@click="deleteparam(index)"></i>
|
||||
|
||||
<div v-if="value.paramList" v-for="item in value.paramList" class="teParamParamList">
|
||||
{{item.en}} : <varialeSelect :disabled="[3]" :variableCascader="true" v-bind="$attrs"
|
||||
:variableType.sync="item.type" v-model="item.value" style="margin-left: 10px;"></varialeSelect>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<el-button @click="addParam" style="margin-top: 10px;" :disabled="Disabled&¶mList.length>0">+
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p style="font-size:14px;margin-bottom: 5px;color: #aaa;margin-top: 30px;" v-show="!Disabled">
|
||||
‘@’字符选择变量
|
||||
</p>
|
||||
<slot></slot>
|
||||
<div class="te_top" v-if="hint==true">
|
||||
<p @click="textareaAdd('+')">+</p>
|
||||
<p @click="textareaAdd('-')">-</p>
|
||||
<p @click="textareaAdd('*')">*</p>
|
||||
<p @click="textareaAdd('/')">/</p>
|
||||
<p @click="textareaAdd('sqrt(,)')">sqrt</p>
|
||||
<p @click="textareaAdd('In(,)')">In</p>
|
||||
<p @click="textareaAdd('avg(,)')">avg()</p>
|
||||
<p @click="textareaAdd('(,)')">()</p>
|
||||
<p @click="textareaAdd('abs(,)')">abs</p>
|
||||
<p @click="textareaAdd('max(,)')">max</p>
|
||||
<p @click="textareaAdd('min(,)')">min</p>
|
||||
<p @click="textareaAdd('lg(,)')">lg</p>
|
||||
<p @click="textareaAdd('exp(,)')">exp</p>
|
||||
<p @click="textareaAdd('ceil(,)')">ceil</p>
|
||||
<p @click="textareaAdd('floor(,)')">floor</p>
|
||||
</div>
|
||||
<el-input type="textarea" rows="9" placeholder="请输入内容" v-model="formula_show" ref="textarea"
|
||||
:disabled="Disabled" v-show="!Disabled" @input="$emit('input',formula_show)">
|
||||
</el-input>
|
||||
<fieldUserTable :text="text" :fieldUser="[...paramList,...tempAddOpkey]" refs="t" @dbc="dbclick" :show="isshow"
|
||||
@close="isshow=false"></fieldUserTable>
|
||||
<!-- <el-dialog :title="'当前编辑'+nowCurr" :visible.sync="dialogVisible" width="30%" append-to-body>
|
||||
<el-button @click="delect">删除字段</el-button>
|
||||
</el-dialog> -->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import fieldUserTable from '@/components/common/fieldUserTable.vue'
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
import bus from './SCO/bus.js'
|
||||
export default {
|
||||
components: {
|
||||
fieldUserTable,
|
||||
varialeSelect
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
hint: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
paramList: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
tempAddOpkey: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
Disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
tempsection: [],
|
||||
sectionVisible: false, //区间编辑弹窗
|
||||
nowCurr: '',
|
||||
dialogVisible: false,
|
||||
isshow: false,
|
||||
text: '',
|
||||
tempIndex: '',
|
||||
lest: '',
|
||||
islest: false,
|
||||
tempFormula: '',
|
||||
formula_show: '',
|
||||
cursorfront: '',
|
||||
cursorlest: '',
|
||||
lastKeyDown: '',
|
||||
// fields: []
|
||||
FieldUserType: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.textarea.$refs.textarea.onkeydown = (e) => {
|
||||
|
||||
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
if (e.key == "Backspace" || e.key == "Delete") {
|
||||
this.lastKeyDown = e.key
|
||||
|
||||
if (e.key == "Backspace" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart - 1,
|
||||
this.$refs.textarea.$refs.textarea.selectionStart) == '@' && (this.isodd(this.formula_show,
|
||||
'@') == false)) {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Backspace")
|
||||
}
|
||||
if (e.key == "Delete" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart, this.$refs
|
||||
.textarea.$refs.textarea.selectionStart + 1) == '@') {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Delete")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
interfaceList() {
|
||||
return this.$store.state.Interface
|
||||
},
|
||||
FieldUser() {
|
||||
if (!this.FieldUserType) {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return this.$store.state.FieldUser.data.fieldList.filter(x => x.valueType == this.FieldUserType)
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.formula_show = this.value
|
||||
console.log(this.Disabled)
|
||||
|
||||
if (this.Disabled) {
|
||||
this.FieldUserType = 1
|
||||
} else {
|
||||
this.FieldUserType = null
|
||||
}
|
||||
console.log(this.FieldUserType)
|
||||
// console.log(this.formula_show, this.value)
|
||||
bus.$on('getOk', (e) => {
|
||||
this.formula_show = e.formula_show
|
||||
this.tempFormula = e.formula_show
|
||||
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
|
||||
deleteparam(index) {
|
||||
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
|
||||
this.paramList.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
paramChange(index, id) {
|
||||
let value = this.FieldUser.find(x => x.id == id)
|
||||
if (value.sqlStatement) {
|
||||
let arr = JSON.parse(value.sqlVariable)
|
||||
if (arr) {
|
||||
this.$set(value, 'paramList', arr.map(value => {
|
||||
return {
|
||||
en: value.key,
|
||||
value: "",
|
||||
type: 1
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
if (value.interface) {
|
||||
let obj = this.interfaceList.find(x => x.id == value.interfaceId)
|
||||
if (obj) {
|
||||
this.$set(value, 'paramList', JSON.parse(obj.bindParam).variable.map(value => {
|
||||
return {
|
||||
en: value.key,
|
||||
value: "",
|
||||
type: 1
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.$set(this.paramList, index, JSON.parse(JSON.stringify(value)))
|
||||
},
|
||||
addParam() {
|
||||
// let arr = JSON.parse(JSON.stringify())
|
||||
|
||||
this.paramList.push({
|
||||
id: ''
|
||||
})
|
||||
// console.log(arr)
|
||||
// this.$emit('update:paramList', arr)
|
||||
|
||||
console.log(this.paramList)
|
||||
},
|
||||
|
||||
setCaretPosition(ctrl, pos) { //设置光标位置函数
|
||||
if (ctrl.setSelectionRange) {
|
||||
ctrl.focus();
|
||||
this.$nextTick(() => {
|
||||
ctrl.setSelectionRange(pos, pos);
|
||||
})
|
||||
} else if (ctrl.createTextRange) {
|
||||
var range = ctrl.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
},
|
||||
textareaAdd(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea
|
||||
.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
if (e.split(',')[1]) {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + e.split(',')[1] + this.cursorlest
|
||||
} else {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + this.cursorlest
|
||||
}
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront + e.split(',')[0])
|
||||
.length)
|
||||
},
|
||||
|
||||
// 获取 字符串中 有 多少个指定字符
|
||||
getTempIndex(string, str) {
|
||||
let temp = 0
|
||||
for (let num = 0;;) {
|
||||
|
||||
|
||||
if (string.indexOf(str, temp) != -1) {
|
||||
temp = string.indexOf(str, temp)
|
||||
temp++
|
||||
num++
|
||||
} else {
|
||||
return num
|
||||
}
|
||||
}
|
||||
// console.log(string, str)
|
||||
},
|
||||
getTempArreyIndex(array, str) {
|
||||
let num = 0
|
||||
array.forEach((value) => {
|
||||
if (value.field_name == "str") {
|
||||
num++
|
||||
}
|
||||
})
|
||||
return num
|
||||
|
||||
|
||||
},
|
||||
countCurr() {
|
||||
if ((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true)) {} else if (
|
||||
this.lastKeyDown == "Backspace") {
|
||||
this.cursorfront = this.cursorfront.substring(0, this.cursorfront.length - 1)
|
||||
this.cursorlest = '@' + this.cursorlest
|
||||
|
||||
} else if (this.lastKeyDown == "Delete") {
|
||||
this.cursorfront = this.cursorfront + '@'
|
||||
this.cursorlest = this.cursorlest.substr(1);
|
||||
|
||||
}
|
||||
let str = this.cursorfront.substring(this.cursorfront.lastIndexOf('@')) + this.cursorlest
|
||||
.substring(0, this.cursorlest
|
||||
.indexOf('@') + 1)
|
||||
|
||||
this.nowCurr = str + '|' + this.getTempIndex(this.cursorfront, str)
|
||||
// console.log(this.nowCurr)
|
||||
|
||||
},
|
||||
delect(type) {
|
||||
let str = this.nowCurr.split('|')[0]
|
||||
let index = this.nowCurr.split('|')[1]
|
||||
|
||||
// this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
this.delectShow(str, parseInt(index))
|
||||
if (type == 'Backspace') {
|
||||
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length - str.length + 1))
|
||||
} else if (type == 'Delete') {
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length - 1))
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.cursorfront = ""
|
||||
this.cursorlest = ""
|
||||
this.nowCurr = ""
|
||||
this.lastKeyDown = ""
|
||||
|
||||
},
|
||||
|
||||
delectShow(str, index) { // 回显删除
|
||||
|
||||
this.formula_show = this.formula_show.substring(0, this.cursorfront.lastIndexOf('@')) + this
|
||||
.formula_show.substring(
|
||||
this.cursorfront.lastIndexOf('@') + str.length, )
|
||||
this.tempFormula = this.formula_show
|
||||
|
||||
|
||||
},
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
dbclick(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// console.log(this.cursorfront)
|
||||
let T = ""
|
||||
T = this.formula_show.split("")
|
||||
T.splice(this.tempIndex, this.text.length + 1, '@' + e + '@')
|
||||
this.formula_show = T.join("")
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length + e.length + 1 - this
|
||||
.text.length))
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
},
|
||||
deepClone(obj) {
|
||||
if (this.getType(obj) === 'Array') {
|
||||
var res = []
|
||||
} else if (this.getType(obj) === 'Object') {
|
||||
var res = {}
|
||||
} else {
|
||||
return obj
|
||||
}
|
||||
for (var i in obj) {
|
||||
res[i] = this.deepClone(obj[i])
|
||||
}
|
||||
return res
|
||||
},
|
||||
getType(obj) {
|
||||
var res = Object.prototype.toString.call(obj)
|
||||
//截取注意[] 符号,和空格
|
||||
return res.slice(8, -1) // 也可以res.length-1
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
formula_show() {
|
||||
let num = 0
|
||||
|
||||
for (let i of this.formula_show) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
this.isshow = true
|
||||
for (let i in this.formula_show) {
|
||||
if (this.formula_show[i] !== this.tempFormula[i] && this.formula_show[i] == "@") {
|
||||
|
||||
if (this.islest) {
|
||||
this.tempIndex = i
|
||||
|
||||
this.lest = this.formula_show.substring(parseInt(this.tempIndex) + 1, this
|
||||
.formula_show.length)
|
||||
this.islest = false
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let T = this.formula_show.substring(parseInt(this.tempIndex) + 1, this.formula_show.length)
|
||||
if (this.lest !== "") {
|
||||
// console.log(T)
|
||||
T = T.substring(0, T.indexOf(this.lest))
|
||||
|
||||
} else {
|
||||
T = T.substring(0, T.length)
|
||||
}
|
||||
|
||||
this.text = T
|
||||
if (this.text === "@") {
|
||||
this.text = ""
|
||||
}
|
||||
// console.log('lest:' + this.lest, 'index:' + this.tempIndex, "T:" + T)
|
||||
|
||||
} else {
|
||||
this.islest = true
|
||||
this.text = ""
|
||||
this.tempIndex = null
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
}
|
||||
this.tempFormula = this.formula_show
|
||||
this.data.formula_show = this.formula_show
|
||||
this.$emit('input', this.formula_show)
|
||||
},
|
||||
fields: {
|
||||
handler: function() {
|
||||
this.data.fields = this.fields
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
value(value) {
|
||||
console.log(value)
|
||||
this.formula_show = this.value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
373
h5-enginex-manager/src/components/common/teV2.vue
Normal file
373
h5-enginex-manager/src/components/common/teV2.vue
Normal file
@@ -0,0 +1,373 @@
|
||||
<style>
|
||||
.te_top {
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
background-color: #aaa;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
}
|
||||
|
||||
.te_top>p {
|
||||
color: #eee;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.te_top>p:hover {
|
||||
color: #fff;
|
||||
cursor: pointer
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
|
||||
<p style="font-size:14px;margin-bottom: 5px;color: #aaa;">
|
||||
‘@’字符选择变量
|
||||
</p>
|
||||
<slot></slot>
|
||||
<div class="te_top" v-if="hint==true">
|
||||
<p @click="textareaAdd('+')">+</p>
|
||||
<p @click="textareaAdd('-')">-</p>
|
||||
<p @click="textareaAdd('*')">*</p>
|
||||
<p @click="textareaAdd('/')">/</p>
|
||||
<p @click="textareaAdd('sqrt(,)')">sqrt</p>
|
||||
<p @click="textareaAdd('In(,)')">In</p>
|
||||
<p @click="textareaAdd('avg(,)')">avg()</p>
|
||||
<p @click="textareaAdd('(,)')">()</p>
|
||||
<p @click="textareaAdd('abs(,)')">abs</p>
|
||||
<p @click="textareaAdd('max(,)')">max</p>
|
||||
<p @click="textareaAdd('min(,)')">min</p>
|
||||
<p @click="textareaAdd('lg(,)')">lg</p>
|
||||
<p @click="textareaAdd('exp(,)')">exp</p>
|
||||
<p @click="textareaAdd('ceil(,)')">ceil</p>
|
||||
<p @click="textareaAdd('floor(,)')">floor</p>
|
||||
</div>
|
||||
<el-input type="textarea" rows="9" placeholder="请输入内容" v-model="formula_show" ref="textarea"
|
||||
@input="$emit('input',formula_show)">
|
||||
</el-input>
|
||||
<fieldUserTable :text="text" :fieldUser="FieldUser" refs="t" @dbc="dbclick" :show="isshow"
|
||||
@close="isshow=false"></fieldUserTable>
|
||||
<!-- <el-dialog :title="'当前编辑'+nowCurr" :visible.sync="dialogVisible" width="30%" append-to-body>
|
||||
<el-button @click="delect">删除字段</el-button>
|
||||
</el-dialog> -->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import fieldUserTable from '@/components/common/fieldUserTable.vue'
|
||||
|
||||
import bus from './SCO/bus.js'
|
||||
export default {
|
||||
components: {
|
||||
fieldUserTable
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
hint:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
tempsection: [],
|
||||
sectionVisible: false, //区间编辑弹窗
|
||||
nowCurr: '',
|
||||
dialogVisible: false,
|
||||
isshow: false,
|
||||
text: '',
|
||||
tempIndex: '',
|
||||
lest: '',
|
||||
islest: false,
|
||||
tempFormula: '',
|
||||
formula_show: '',
|
||||
cursorfront: '',
|
||||
cursorlest: '',
|
||||
lastKeyDown: '',
|
||||
// fields: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.textarea.$refs.textarea.onkeydown = (e) => {
|
||||
|
||||
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
if (e.key == "Backspace" || e.key == "Delete") {
|
||||
this.lastKeyDown = e.key
|
||||
|
||||
if (e.key == "Backspace" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart - 1,
|
||||
this.$refs.textarea.$refs.textarea.selectionStart) == '@' && (this.isodd(this.formula_show,
|
||||
'@') == false)) {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Backspace")
|
||||
}
|
||||
if (e.key == "Delete" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart, this.$refs
|
||||
.textarea.$refs.textarea.selectionStart + 1) == '@') {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Delete")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.formula_show = this.value
|
||||
|
||||
// console.log(this.formula_show, this.value)
|
||||
bus.$on('getOk', (e) => {
|
||||
this.formula_show = e.formula_show
|
||||
this.tempFormula = e.formula_show
|
||||
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
setCaretPosition(ctrl, pos) { //设置光标位置函数
|
||||
if (ctrl.setSelectionRange) {
|
||||
ctrl.focus();
|
||||
this.$nextTick(() => {
|
||||
ctrl.setSelectionRange(pos, pos);
|
||||
})
|
||||
} else if (ctrl.createTextRange) {
|
||||
var range = ctrl.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
},
|
||||
textareaAdd(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea
|
||||
.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
if (e.split(',')[1]) {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + e.split(',')[1] + this.cursorlest
|
||||
} else {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + this.cursorlest
|
||||
}
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront + e.split(',')[0])
|
||||
.length)
|
||||
},
|
||||
|
||||
// 获取 字符串中 有 多少个指定字符
|
||||
getTempIndex(string, str) {
|
||||
let temp = 0
|
||||
for (let num = 0;;) {
|
||||
|
||||
|
||||
if (string.indexOf(str, temp) != -1) {
|
||||
temp = string.indexOf(str, temp)
|
||||
temp++
|
||||
num++
|
||||
} else {
|
||||
return num
|
||||
}
|
||||
}
|
||||
// console.log(string, str)
|
||||
},
|
||||
getTempArreyIndex(array, str) {
|
||||
let num = 0
|
||||
array.forEach((value) => {
|
||||
if (value.field_name == "str") {
|
||||
num++
|
||||
}
|
||||
})
|
||||
return num
|
||||
|
||||
|
||||
},
|
||||
countCurr() {
|
||||
if ((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true)) {} else if (
|
||||
this.lastKeyDown == "Backspace") {
|
||||
this.cursorfront = this.cursorfront.substring(0, this.cursorfront.length - 1)
|
||||
this.cursorlest = '@' + this.cursorlest
|
||||
|
||||
} else if (this.lastKeyDown == "Delete") {
|
||||
this.cursorfront = this.cursorfront + '@'
|
||||
this.cursorlest = this.cursorlest.substr(1);
|
||||
|
||||
}
|
||||
let str = this.cursorfront.substring(this.cursorfront.lastIndexOf('@')) + this.cursorlest
|
||||
.substring(0, this.cursorlest
|
||||
.indexOf('@') + 1)
|
||||
|
||||
this.nowCurr = str + '|' + this.getTempIndex(this.cursorfront, str)
|
||||
// console.log(this.nowCurr)
|
||||
|
||||
},
|
||||
delect(type) {
|
||||
let str = this.nowCurr.split('|')[0]
|
||||
let index = this.nowCurr.split('|')[1]
|
||||
|
||||
// this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
this.delectShow(str, parseInt(index))
|
||||
if(type=='Backspace'){
|
||||
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length-str.length+1))
|
||||
}else if(type=='Delete'){
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length-1))
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.cursorfront = ""
|
||||
this.cursorlest = ""
|
||||
this.nowCurr = ""
|
||||
this.lastKeyDown = ""
|
||||
|
||||
},
|
||||
|
||||
delectShow(str, index) { // 回显删除
|
||||
|
||||
this.formula_show = this.formula_show.substring(0, this.cursorfront.lastIndexOf('@')) + this
|
||||
.formula_show.substring(
|
||||
this.cursorfront.lastIndexOf('@') + str.length, )
|
||||
this.tempFormula = this.formula_show
|
||||
|
||||
|
||||
},
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
dbclick(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// console.log(this.cursorfront)
|
||||
let T = ""
|
||||
T = this.formula_show.split("")
|
||||
T.splice(this.tempIndex, this.text.length + 1, '@' + e + '@')
|
||||
this.formula_show = T.join("")
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length+e.length+1-this.text.length))
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
},
|
||||
deepClone(obj) {
|
||||
if (this.getType(obj) === 'Array') {
|
||||
var res = []
|
||||
} else if (this.getType(obj) === 'Object') {
|
||||
var res = {}
|
||||
} else {
|
||||
return obj
|
||||
}
|
||||
for (var i in obj) {
|
||||
res[i] = this.deepClone(obj[i])
|
||||
}
|
||||
return res
|
||||
},
|
||||
getType(obj) {
|
||||
var res = Object.prototype.toString.call(obj)
|
||||
//截取注意[] 符号,和空格
|
||||
return res.slice(8, -1) // 也可以res.length-1
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
formula_show() {
|
||||
let num = 0
|
||||
|
||||
for (let i of this.formula_show) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
this.isshow = true
|
||||
for (let i in this.formula_show) {
|
||||
if (this.formula_show[i] !== this.tempFormula[i] && this.formula_show[i] == "@") {
|
||||
|
||||
if (this.islest) {
|
||||
this.tempIndex = i
|
||||
|
||||
this.lest = this.formula_show.substring(parseInt(this.tempIndex) + 1, this
|
||||
.formula_show.length)
|
||||
this.islest = false
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let T = this.formula_show.substring(parseInt(this.tempIndex) + 1, this.formula_show.length)
|
||||
if (this.lest !== "") {
|
||||
// console.log(T)
|
||||
T = T.substring(0, T.indexOf(this.lest))
|
||||
|
||||
} else {
|
||||
T = T.substring(0, T.length)
|
||||
}
|
||||
|
||||
this.text = T
|
||||
if (this.text === "@") {
|
||||
this.text = ""
|
||||
}
|
||||
// console.log('lest:' + this.lest, 'index:' + this.tempIndex, "T:" + T)
|
||||
|
||||
} else {
|
||||
this.islest = true
|
||||
this.text = ""
|
||||
this.tempIndex = null
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
}
|
||||
this.tempFormula = this.formula_show
|
||||
this.data.formula_show = this.formula_show
|
||||
this.$emit('input', this.formula_show)
|
||||
},
|
||||
fields: {
|
||||
handler: function() {
|
||||
this.data.fields = this.fields
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
value(value){
|
||||
console.log(value)
|
||||
this.formula_show = this.value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
136
h5-enginex-manager/src/components/common/textCustom.vue
Normal file
136
h5-enginex-manager/src/components/common/textCustom.vue
Normal file
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<div style="width: 100%;margin-left: 5px;">
|
||||
<div class="textInput" v-if="click=='dbl'" @dblclick="dialogVisibleOpen" :style="{'color':color,textAlign:center?'center':'left'}">{{value.trim()===""||JSON.parse(value).formula.trim()==""?'-':JSON.parse(value).formula}}</div>
|
||||
|
||||
|
||||
<el-dialog title="自定义" v-if="dialogVisible" :visible.sync="dialogVisible" width="30%" append-to-body>
|
||||
<teV2 v-model="tempValue"></teV2>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible=false;tempValue=''">取 消</el-button>
|
||||
<el-button type="primary" @click="sectionSure" :disabled="type3Sure">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import teV2 from '@/components/common/teV2.vue'
|
||||
export default {
|
||||
components: {
|
||||
teV2
|
||||
},
|
||||
props: {
|
||||
center: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
click: {
|
||||
type: String,
|
||||
default: 'dbl'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
color: '#000',
|
||||
dialogVisible: false,
|
||||
tempValue: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
dialogVisibleOpen() {
|
||||
// console.log('this.value',this.value)
|
||||
this.tempValue = this.value==""?this.value:JSON.parse(this.value).formula
|
||||
this.dialogVisible = true
|
||||
},
|
||||
sectionSure(e) {
|
||||
// console.log(this.tempValue)
|
||||
let arr = String(this.tempValue).match(/@(.|\n)*?@/g) === null ? [] : this.tempValue.match(/@(.|\n)*?@/g);
|
||||
let is = false
|
||||
arr = Array.from(new Set(arr))
|
||||
// console.log(arr)
|
||||
arr = arr.map(value => {
|
||||
// console.log(value)
|
||||
value = value.split('')
|
||||
value.pop()
|
||||
value.shift()
|
||||
value = value.join('')
|
||||
if (this.mixinGetValueByCn(value)) {
|
||||
return this.mixinGetValueByCn(value)
|
||||
} else {
|
||||
is = true
|
||||
this.$message.error(`没有找到指标:${value}`);
|
||||
return this.mixinGetValueByCn(value)
|
||||
}
|
||||
|
||||
})
|
||||
if (is) {
|
||||
return
|
||||
}
|
||||
let obj = {
|
||||
farr: arr,
|
||||
formula: this.tempValue.trim()
|
||||
}
|
||||
if(this.tempValue.trim()===""){
|
||||
this.color = '#ee0000'
|
||||
}else{
|
||||
|
||||
this.color = '#009500'
|
||||
}
|
||||
|
||||
this.$emit('input', JSON.stringify(obj))
|
||||
this.dialogVisible = false
|
||||
},
|
||||
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
computed: {
|
||||
type3Sure() {
|
||||
return this.isodd(this.tempValue, '@')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.textInput {
|
||||
|
||||
width: 100% !important;
|
||||
table-layout: fixed !important;
|
||||
word-wrap: break-all !important;
|
||||
word-break: normal !important;
|
||||
overflow: hidden !important;
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
142
h5-enginex-manager/src/components/common/textInput.vue
Normal file
142
h5-enginex-manager/src/components/common/textInput.vue
Normal file
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<div style="width: 100%;margin-left: 5px;">
|
||||
<div class="textInput" v-if="click=='dbl'" @dblclick="openinput=true" :style="{'color':color,textAlign:center?'center':'left'}"
|
||||
v-show="!openinput">{{mytext.trim()==""?'-':mytext}}</div>
|
||||
<div class="textInput" v-if="click=='click'" @click="openinput=true" :style="{'color':color,textAlign:center?'center':'left'}"
|
||||
v-show="!openinput">{{mytext.trim()==""?'-':mytext}}</div>
|
||||
|
||||
<el-input v-show="openinput" ref='input' maxlength="30" v-model="mytext" placeholder="请输入内容" size="mini" @input="input" @blur="openinput=false"></el-input>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
center: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
examine: {
|
||||
type: Number,
|
||||
default: 1 // 1为范围检查 2为数字检查
|
||||
},
|
||||
click: {
|
||||
type: String,
|
||||
default: 'dbl'
|
||||
},
|
||||
defcolor:{
|
||||
type: String,
|
||||
default: '#000'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
color: '#000',
|
||||
openinput: false,
|
||||
mytext: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.color = this.defcolor
|
||||
this.mytext = this.text ? this.text : this.text === 0 ? this.text : '-'
|
||||
if (this.text == null) {
|
||||
this.mytext = "-"
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.input.$refs.input.onkeydown = (e) => {
|
||||
if (e.key == 'Enter') {
|
||||
this.$refs.input.$refs.input.blur()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
input(e) {
|
||||
this.$emit('input', e)
|
||||
},
|
||||
verify(type = 1) {
|
||||
if (!this.mytext && this.mytext != 0) {
|
||||
this.mytext = '-'
|
||||
this.color = '#f00'
|
||||
} else {
|
||||
if (this.examine == 1) {
|
||||
if (this.type == 1) {
|
||||
// let Z = /^(\[|\()(\d|\.)*,(\d|\.)*(\]|\))$/
|
||||
let Z = /^((\[|\()(\d(\d)*(\.(\d)+)?)|\(),((\d(\d)*(\.(\d)+)?(\]|\)))|\))$/
|
||||
if (!Z.test(this.mytext)) {
|
||||
if (type == 1) {
|
||||
this.$message.error('该字段为数值型 请填写范围区间 如:[123,456) 留空请使用 "(" ');
|
||||
}
|
||||
this.color = "#ee0000"
|
||||
|
||||
} else {
|
||||
this.color = "#009500"
|
||||
}
|
||||
}
|
||||
} else if (this.examine == 2) {
|
||||
if (typeof Number(this.mytext) == 'number' && !isNaN(Number(this.mytext))) {
|
||||
|
||||
|
||||
this.color = "#009500"
|
||||
} else {
|
||||
if (type == 1) {
|
||||
this.$message.error('请填写数字');
|
||||
}
|
||||
this.color = "#ee0000"
|
||||
}
|
||||
} else if (this.examine == 3) {
|
||||
|
||||
if (String(this.mytext).trim() === "") {
|
||||
this.color = "#ee0000"
|
||||
} else {
|
||||
|
||||
this.color = "#009500"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
text() {
|
||||
this.mytext = this.text
|
||||
},
|
||||
openinput() {
|
||||
if (this.openinput) {
|
||||
if (this.mytext == "-") {
|
||||
this.mytext = ""
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.input.$refs.input.focus()
|
||||
})
|
||||
} else {
|
||||
this.verify()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.textInput {
|
||||
|
||||
width: 100% !important;
|
||||
table-layout: fixed !important;
|
||||
word-wrap: break-all !important;
|
||||
word-break: normal !important;
|
||||
overflow: hidden !important;
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
158
h5-enginex-manager/src/components/common/textSelect.vue
Normal file
158
h5-enginex-manager/src/components/common/textSelect.vue
Normal file
@@ -0,0 +1,158 @@
|
||||
<style>
|
||||
.textSelectSpan {
|
||||
font-size: 14px;
|
||||
width: 120px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.textSelectSpan:hover {
|
||||
overflow: unset;
|
||||
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div style="display: flex;" v-if="type==1">
|
||||
<p v-show="!openSelect" @dblclick="openSelect=true;" class="textSelectSpan" :style="{'color':color}">{{data.fieldName?data.fieldName:'请选择指标'}}</p>
|
||||
<el-select v-model="data.fieldId" v-show="openSelect" filterable remote placeholder="请选择" size="mini" @change="change"
|
||||
ref="select" @blur="blur" @visible-change="visibleChange">
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="display: flex;width: 80px;margin-left: 5px;" v-else-if="type==2">
|
||||
<p v-show="!openSelect" @dblclick="openSelect=true;" class="textSelectSpan" :style="{'color':color}">{{data.calculateType==1?'分值':data.calculateType==2?'系数':'自定义'}}</p>
|
||||
<el-select v-model="data.calculateType" v-show="openSelect" filterable placeholder="请选择" size="mini" @change="change"
|
||||
ref="select" @blur="blur" @visible-change="visibleChange">
|
||||
<el-option :key="1" label="分值" :value="1"></el-option>
|
||||
<el-option :key="2" label="系数" :value="2"></el-option>
|
||||
<el-option :key="3" label="自定义" :value="3"></el-option>
|
||||
</el-select>
|
||||
:
|
||||
</div>
|
||||
<div style="display: flex;width: 30px;margin-left: 5px;" v-else-if="type==3">
|
||||
<p v-show="!openSelect" @dblclick="openSelect=true;" class="textSelectSpan" :style="{'color':color}">{{data.operator?data.operator=='contains'?'包含':data.operator=='not contains'?'不包含':data.operator:'-'}}</p>
|
||||
<ruleRelation v-model="data.operator" :openValue2="false" :valueType="valueType" :openSelect="openSelect" :type="2" v-show="openSelect"
|
||||
size="mini" @change="change" ref="select" @blur="blur" @visible-change="visibleChange" :andTextInput="true"></ruleRelation>
|
||||
:
|
||||
</div>
|
||||
<div style="display: flex;width: 40px;margin-left: 5px;" v-else-if="type==4">
|
||||
<p v-show="!openSelect" @dblclick="openSelect=true;" class="textSelectSpan" :style="{'color':color}">{{data.logical=='||'?'OR':'AND'}}</p>
|
||||
<el-select v-model="data.logical" v-show="openSelect" filterable placeholder="请选择" size="mini" @change="change" ref="select" @blur="blur" @visible-change="visibleChange">
|
||||
<el-option :key="1" label="AND" value="&&"></el-option>
|
||||
<el-option :key="2" label="OR" value="||"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
export default {
|
||||
components: {
|
||||
ruleRelation
|
||||
},
|
||||
props: {
|
||||
valueType: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
Number:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
color: '#000',
|
||||
openSelect: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
if (this.type == 1) {
|
||||
if (!this.data.fieldId) {
|
||||
this.data.fieldName = '请选择指标'
|
||||
} else {
|
||||
this.data.fieldName = this.mixinGetvalueCn(this.data.fieldId)
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
|
||||
},
|
||||
watch: {
|
||||
openSelect() {
|
||||
if (this.openSelect && this.type != 3) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.select.focus()
|
||||
})
|
||||
}
|
||||
},
|
||||
'data.operator'() {
|
||||
if (this.data.operator == "" || this.data.operator == "-") {
|
||||
this.color = '#F56C6C'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
visibleChange(e) {
|
||||
if (!e) {
|
||||
|
||||
this.openSelect = false
|
||||
|
||||
}
|
||||
},
|
||||
blur() {
|
||||
setTimeout(() => {
|
||||
this.openSelect = false
|
||||
}, 200)
|
||||
},
|
||||
change(e) {
|
||||
|
||||
|
||||
// this.type==3?return : ''
|
||||
if(this.type==1){
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id == e) {
|
||||
this.data.fieldName = value.fieldCn
|
||||
}
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.openSelect = false
|
||||
}, 200)
|
||||
this.color = '#409EFF'
|
||||
|
||||
this.$emit('change')
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
if (this.$store.state.FieldUser == null) {
|
||||
return []
|
||||
} else {
|
||||
if(this.Number){
|
||||
return this.$store.state.FieldUser.data.fieldList.filter(value=>value.valueType==1)
|
||||
}else{
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
415
h5-enginex-manager/src/components/common/watch_strategy.vue
Normal file
415
h5-enginex-manager/src/components/common/watch_strategy.vue
Normal file
@@ -0,0 +1,415 @@
|
||||
<template>
|
||||
|
||||
<el-dialog :visible="strategyDialogVisible" width="70%"
|
||||
@update:visible="$emit('update:strategyDialogVisible',$event)" :show-close="false">
|
||||
<div style="position: relative;">
|
||||
<div style="position: absolute;height: 100%;width: 100%;z-index: 9999;">
|
||||
|
||||
</div>
|
||||
<!-- {{data}} -->
|
||||
<div v-if="data.strategyType==2">
|
||||
<div v-if="data.difficulty==2">
|
||||
|
||||
<type2 :ZIndex="1" :data="data.snapshot.ruleConditionVo"></type2>
|
||||
|
||||
<div class="rule_outcontent_box">
|
||||
<p>命中输出:</p>
|
||||
<div class="rule_home" style="margin-top: 10px;">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="outAdd(0)" disabled></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px">
|
||||
</el-button>
|
||||
</div>
|
||||
<el-select v-model="data.snapshot.resultFieldEn" filterable placeholder="请选择"
|
||||
style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn"
|
||||
:value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="是否命中" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<outcontent :outcontent="data.snapshot.strategyOutputList" :ruleOut="true" type="complex_rule"
|
||||
:outType="{
|
||||
outType: 'success'
|
||||
}">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-select v-model="data.snapshot.scoreFieldEn" filterable placeholder="请选择"
|
||||
style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn"
|
||||
:value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">=</p>
|
||||
<div>
|
||||
<el-input v-model="data.snapshot.score" maxlength="30" style="width: 255px;">
|
||||
<template slot="prepend">得分</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
</outcontent>
|
||||
</div>
|
||||
<br>
|
||||
<div class="rule_outcontent_box">
|
||||
<p>未命中输出:</p>
|
||||
<outcontent :outcontent="data.snapshot.failOutputList" :unone="true" :ruleOut="true"
|
||||
type="complex_rule" :outType="{
|
||||
outType: 'fail'
|
||||
}">
|
||||
|
||||
</outcontent>
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="data.difficulty==3">
|
||||
<el-input type="textarea" :rows="30" placeholder="请输入内容"
|
||||
:value="JSON.parse(data.snapshot.scriptContent).formula">
|
||||
</el-input>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div v-if="data.strategyType==4" class="watch_SCO">
|
||||
<div class="SCO_tableHeader">
|
||||
<div style="background-color: #409EFF;color: #fff;">维度</div>
|
||||
<div style="width: 100px;background-color: #409EFF;color: #fff;">权重</div>
|
||||
<div v-for=" value in tier" style="background-color: #409EFF;color: #fff;">
|
||||
指标{{value}}
|
||||
</div>
|
||||
<div style="border-top: 1px solid #ddd;border-right: 1px solid #ddd;margin-top: -1px;margin-left: 1px;background-color: #409EFF;color: #fff;width: 200px;">
|
||||
评分
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;margin-left: 20px;">
|
||||
|
||||
<div style="border-right: 1px solid #ddd;border-left: 1px solid #ddd;border-top: 1px solid #ddd;">
|
||||
|
||||
<div v-for="(value,index) in data.snapshot.scorecardDimension" style="min-height: 50px;display: flex;border-bottom: 1px solid #ddd;position: relative;">
|
||||
<div style="min-width: 300px;display: flex;align-items: center;justify-content: center;position: relative;">
|
||||
<div style="position: absolute;left: 0;top: 0;color: #409EFF;">
|
||||
<el-dropdown >
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-s-operation"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown" trigger="click">
|
||||
<el-dropdown-item icon="el-icon-bottom" :command="'addBrother|'+index">向下添加</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-right" :command="'addSon|'+index" v-show="!value.children.length">向右添加</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-close" :command="'delect|'+index" v-show="index!=0">删除此字段</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-document-copy" :command="'copy|'+index">复制此字段</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<textInput :text="String(value.dimensionName)" :center="true" :examine="3" ></textInput>
|
||||
</div>
|
||||
<div style="width: 100px;borderLeft:1px solid #ddd;display: flex;align-items: center;justify-content: center;flex-shrink: 0;">
|
||||
<textInput :text="String(value.weight)" :examine='2' :center="true" @input="value.weight=$event"></textInput>
|
||||
</div>
|
||||
<SCOrecursion :data="value" :tier="1"></SCOrecursion>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="margin-top: 50px;margin-bottom: 20px;">
|
||||
<span style="font-size: 14px;margin-left: 20px;margin-right: 10px;color: #409EFF;">计算方式:</span>
|
||||
<el-select v-model="data.snapshot.scoreCalculateType" placeholder="请选择" size="mini">
|
||||
<el-option :key="1" label="求和" :value="1"></el-option>
|
||||
<el-option :key="2" label="加权求和" :value="2"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<outcontent :outcontent="data.snapshot.strategyOutputList" type="scorecard" style="margin-top: 20px;margin-left: 50px;">
|
||||
<div style="display:flex; align-items: center;">
|
||||
<el-select v-model="data.snapshot.resultFieldEn" filterable placeholder="请选择" style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="评分" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
</outcontent>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div v-if="data.strategyType==17" style="background-color: #f3f3f3;padding: 20px;">
|
||||
<tree :treeData="data.snapshot.detailList[0]"></tree>
|
||||
|
||||
<outcontent :outcontent="data.snapshot.strategyOutputList" type="decision_tree"
|
||||
style="margin-top: 20px;margin-left: 50px;">
|
||||
<div style="display:flex; align-items: center;">
|
||||
<el-select v-model="data.snapshot.resultFieldEn" filterable placeholder="请选择"
|
||||
style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn"
|
||||
:value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="决策结果" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
</outcontent>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div v-if="data.strategyType==16">
|
||||
<div class="dec" style="width: auto;">
|
||||
<div class="dec_top">
|
||||
<!-- top -->
|
||||
<div class="dec_table_header" :style="{width:width,flexShrink:'0'}">
|
||||
</div>
|
||||
<div class="dec_table_comm">
|
||||
<topRecursion :data="data.snapshot.topDetailVo" direction="row"></topRecursion>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dec_cont" style="display: flex;">
|
||||
<recursion :data="data.snapshot.leftDetailVo" ref="left" id="left"
|
||||
style="flex-shrink: 0;flex-grow:0"></recursion>
|
||||
<div>
|
||||
<div v-for="(value,index) in data.snapshot.resultSet.resultList" :key="index"
|
||||
style="display: flex;">
|
||||
<div v-for="(item,inde) in value" :key="inde" class="dec_score"
|
||||
:style="{borderRight:inde==value.length-1?'1px solid #ddd':''}">
|
||||
<textInput :text="String(item)" click="click" :center="true" :examine="3"
|
||||
@input="input($event,index,inde)"></textInput>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<outcontent :outcontent="data.snapshot.strategyOutputList" type="decision_tables" style="margin-top: 20px;margin-left: 50px;">
|
||||
<div style="display:flex; align-items: center;">
|
||||
<el-select v-model="data.snapshot.resultFieldEn" filterable placeholder="请选择" style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="决策结果" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
</outcontent>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="$emit('update:strategyDialogVisible',false)">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SCOrecursion from '@/components/common/SCO/recursion.vue'
|
||||
import recursion from '@/components/common/decision/recursion.vue'
|
||||
import topRecursion from '@/components/common/decision/topRecursion.vue'
|
||||
import textInput from '@/components/common/textInput.vue'
|
||||
import tree from '@/components/common/decisionTree/tree.vue'
|
||||
import type2 from '@/components/models/RuleCont.vue'
|
||||
import outcontent from '@/components/models/outcontent.vue'
|
||||
export default {
|
||||
components: {
|
||||
SCOrecursion,
|
||||
type2,
|
||||
outcontent,
|
||||
tree,
|
||||
recursion,
|
||||
topRecursion,
|
||||
textInput
|
||||
},
|
||||
|
||||
props: {
|
||||
strategyDialogVisible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dataCont: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
data: {},
|
||||
width: '0px',
|
||||
max: 0,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (!this.dataCont || !this.dataCont.strategyType) return
|
||||
this.data = JSON.parse(JSON.stringify(this.dataCont))
|
||||
this.data.snapshot = JSON.parse(this.data.snapshot)
|
||||
if (this.dataCont.strategyType == 2) {
|
||||
this.Type2redeepverify(this.data.snapshot.ruleConditionVo)
|
||||
}
|
||||
if (this.dataCont.strategyType == 17) {
|
||||
this.Type1617Enformat(this.data.snapshot.detailList, 'Array')
|
||||
}
|
||||
if (this.dataCont.strategyType == 16) {
|
||||
this.Type1617Enformat(this.data.snapshot.leftDetailVo,'Array')
|
||||
this.Type1617Enformat(this.data.snapshot.topDetailVo,'Array')
|
||||
}
|
||||
console.log(this.data)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.left) {
|
||||
this.width = this.$refs.left.$el.clientWidth + 'px'
|
||||
}
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
if (this.$store.state.FieldUser) {
|
||||
console.log(this.$store.state.FieldUser.data.fieldList)
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
tier() {
|
||||
|
||||
this.max = 0
|
||||
|
||||
this.each(this.data.snapshot.scorecardDimension, 1)
|
||||
return this.max - 1
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
Type2redeepverify(obj) {
|
||||
if (obj.fieldEn) {
|
||||
if ((obj.fieldEn.indexOf('.') != -1 && obj.fieldEn[0] == '%') || obj.conditionType == 3 || obj
|
||||
.conditionType === 2) {
|
||||
obj.fieldEn = obj.fieldEn.split('.')
|
||||
}
|
||||
}
|
||||
if (obj.children.length > 0) {
|
||||
obj.children.forEach(value => {
|
||||
this.Type2redeepverify(value)
|
||||
})
|
||||
}
|
||||
if (obj.loopGroupActions.length > 0) {
|
||||
obj.loopGroupActions.forEach(value => {
|
||||
if (value.actionValue.indexOf('.') != -1) {
|
||||
value.actionValue = value.actionValue.split('.')
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
Type1617Enformat(arr, str) {
|
||||
arr.forEach(value => {
|
||||
if (str == 'String') {
|
||||
if (Array.isArray(value.fieldEn)) { //兼容老数据
|
||||
value.fieldEn = value.fieldEn.join('.')
|
||||
}
|
||||
} else if (str == 'Array') {
|
||||
value.fieldEn = value.fieldEn.split('.')
|
||||
}
|
||||
|
||||
if (value.children.length > 0) {
|
||||
this.Type1617Enformat(value.children, str)
|
||||
}
|
||||
})
|
||||
},
|
||||
each(data, floor) {
|
||||
data.forEach(e => {
|
||||
e.floor = floor
|
||||
if (floor > this.max) {
|
||||
this.max = floor
|
||||
}
|
||||
if (e.children.length > 0) {
|
||||
this.each(e.children, floor + 1)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style >
|
||||
.watch_SCO p{
|
||||
margin-bottom: unset;
|
||||
}
|
||||
.rule_outcontent_box {
|
||||
border: 1px dotted #00000022;
|
||||
|
||||
margin-top: 20px;
|
||||
padding: 10px 0 10px 10px;
|
||||
}
|
||||
.dec_top{
|
||||
|
||||
display: flex;
|
||||
}
|
||||
.dec_table_header{
|
||||
width: 350px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.dec_score{
|
||||
width: 199px;
|
||||
height: 80px;
|
||||
text-align: center;
|
||||
line-height: 80px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.SCO_tableHeader{
|
||||
display: flex;
|
||||
margin-left: 20px;
|
||||
/* margin-top: 20px; */
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
.SCO_tableHeader>div{
|
||||
height: 40px;
|
||||
width: 300px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-left: 1px solid #ddd;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user