Merge pull request #6 from Object-you/h5-zj-220809Start

规则改为块类型 加入数组本身选项
This commit is contained in:
FiboAI
2022-08-09 11:20:42 +08:00
committed by GitHub
11 changed files with 982 additions and 778 deletions

View File

@@ -76,7 +76,7 @@ switch (process.env.NODE_ENV) {
case 'wang': // 汪环境 case 'wang': // 汪环境
proxyObj = { proxyObj = {
'/Riskmanage': { '/Riskmanage': {
target: 'http://192.168.50.228:8080', // 生产环境 target: 'http://192.168.50.223:8080', // 生产环境
changeOrigin: true, // 是否跨域 changeOrigin: true, // 是否跨域
pathRewrite: { pathRewrite: {
'^/Riskmanage': '/Riskmanage' '^/Riskmanage': '/Riskmanage'

View File

@@ -0,0 +1,71 @@
<template>
<el-cascader :value="cascaderValue" filterable :props="{ expandTrigger: 'hover' }" v-bind="$attrs"
:options="options" @change="change" :key="key" @visible-change="changeKey"></el-cascader>
</template>
<script>
export default {
props: {
value: {
type: String | Array
},
options: {
type: Array,
default: () => []
},
isString: {
type: Boolean,
default: false
}
},
data() {
return {
key: 1
}
},
methods: {
change(e) {
let value
if (this.isString) {
value = e.join('.')
} else {
value = e
}
// console.log(value)
this.$emit('input', value)
this.$emit('change', value)
},
changeKey(is) {
if (is) {
return
}
setTimeout(() => {
this.key++
}, 200)
},
},
computed: {
cascaderValue() {
if (this.isString) {
return this.value ? this.value.split('.') : []
} else {
return this.value
}
}
},
watch: {
options() {
this.key++
}
}
}
</script>

View File

@@ -6,11 +6,13 @@
/* overflow-x: hidden; */ /* overflow-x: hidden; */
margin: 0px 0px 0px 10px; margin: 0px 0px 0px 10px;
padding-bottom: 100px; padding-bottom: 100px;
} }
.rule_com::-webkit-scrollbar { .rule_com::-webkit-scrollbar {
/* display: none; */ /* display: none; */
/* Chrome Safari */ /* Chrome Safari */
} }
.Rule_version_buttom { .Rule_version_buttom {
@@ -20,10 +22,17 @@
.rule_outcontent_box { .rule_outcontent_box {
border: 1px dotted #00000022; border: 1px dotted #00000022;
position: relative;
margin-top: 20px; margin-top: 10px;
padding: 10px 0 10px 10px; padding: 10px 0 10px 10px;
} }
.rule_outcontent_box>p {
font-size: 12px;
position: absolute;
top: 4px;
left: 10px;
}
</style> </style>
<template> <template>
@@ -71,58 +80,82 @@
:addVersionLoading="addVersionLoading" @addVersion="addVersion" @addVersionClose="addVersionClose" :addVersionLoading="addVersionLoading" @addVersion="addVersion" @addVersionClose="addVersionClose"
@copyVersion="copyVersion" @delectVersion="delectVersion" @updateVersion="updateVersion" @copyVersion="copyVersion" @delectVersion="delectVersion" @updateVersion="updateVersion"
@addVersionSure="addVersionSure" @Dialog="addVersionDialog = $event" @addVersionExamine="addVersionExamine" @addVersionSure="addVersionSure" @Dialog="addVersionDialog = $event" @addVersionExamine="addVersionExamine"
@versionChange="versionChange" @StatusChange="addVersionStatus=$event" :exportVersion="true" @exportVersion="exportVersion" @importNewVersion="importNewVersion"> @versionChange="versionChange" @StatusChange="addVersionStatus = $event" :exportVersion="true"
@exportVersion="exportVersion" @importNewVersion="importNewVersion">
</version> </version>
<div class="rule_com"> <div class="rule_com">
<rule :data="ruledata" :ZIndex="1"></rule> <el-button icon="el-icon-plus" type="success" size="mini" circle @click="addRuleBlock()"></el-button>
<template v-for="(item, index) in ruleBlockVoList ">
<div style="border: 1px solid #9cb1c7 ;padding: 10px;margin: 10px;position: relative;">
<div style="position: absolute;top:10px;right: 10px;z-index: 2;">
<el-button icon="el-icon-top" :disabled="!index" type="info" size="mini" circle
@click="goTop(index)"></el-button>
<el-button icon="el-icon-bottom" type="info" :disabled="index == ruleBlockVoList.length - 1"
size="mini" circle @click="goBootom(index)">
</el-button>
<el-button icon="el-icon-close" type="danger" :disabled="!index" size="mini" circle
@click="deleteRuleBlock(index)"></el-button>
</div>
<rule :data="item.ruleConditionVo" :ZIndex="1"></rule>
<div class="rule_outcontent_box"> <div class="rule_outcontent_box">
<p>命中输出</p> <p>命中输出</p>
<div class="rule_home" style="margin-top: 10px;"> <div class="rule_home" style="margin-top: 10px;">
<div class="rule_fa"> <div class="rule_fa">
<el-button icon="el-icon-plus" circle @click="outAdd(0)" disabled></el-button> <el-button icon="el-icon-plus" size="mini" circle @click="outAdd(0)" disabled>
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px"> </el-button>
<el-button icon="el-icon-close" size="mini" circle disabled='disabled'
style="margin-right: 10px">
</el-button> </el-button>
</div> </div>
<el-select v-model="resultFieldEn" filterable placeholder="请选择" style="width: 200px;" clearable> <el-select v-model="item.resultFieldEn" size="mini" filterable placeholder="请选择"
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn"> style="width: 200px;" clearable>
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn"
:value="item.fieldEn">
</el-option> </el-option>
</el-select> </el-select>
<p style="margin: 10px;"> <p style="margin: 10px;">
= =
</p> </p>
<el-select filterable value="是否命中" disabled style="width: 255px;"> <el-select filterable value="是否命中" size="mini" disabled style="width: 255px;">
</el-select> </el-select>
</div> </div>
<outcontent :outcontent="outcontent" :ruleOut="true" type="complex_rule" :outType="outTypeSuccess"> <outcontent :outcontent="item.strategyOutputList" size='mini' :ruleOut="true"
type="complex_rule" :outType="outTypeSuccess">
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<el-select v-model="scoreFieldEn" filterable placeholder="请选择" style="width: 200px;" clearable> <el-select v-model="item.scoreFieldEn" size="mini" filterable placeholder="请选择"
style="width: 200px;" clearable>
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" <el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn"
:value="item.fieldEn"> :value="item.fieldEn">
</el-option> </el-option>
</el-select> </el-select>
<p style="margin: 10px;">=</p> <p style="margin: 10px;">=</p>
<div> <div>
<el-input v-model="SpecialField.score" maxlength="30" style="width: 255px;"> <el-input v-model="item.score" size="mini" maxlength="30" style="width: 255px;">
<template slot="prepend">得分</template> <template slot="prepend">得分</template>
</el-input> </el-input>
</div> </div>
</div> </div>
</outcontent> </outcontent>
</div> </div>
<br>
<div class="rule_outcontent_box"> <div class="rule_outcontent_box">
<p>未命中输出:</p> <p style="font-size: 12px;">未命中输出:</p>
<outcontent :outcontent="failOutputList" :unone="true" :ruleOut="true" type="complex_rule" <outcontent :outcontent="item.failOutputList" size='mini' :unone="true" :ruleOut="true"
:outType="outTypeFail"> type="complex_rule" :outType="outTypeFail">
</outcontent> </outcontent>
<div> <div>
</div> </div>
</div> </div>
</div>
</template>
</div> </div>
</div> </div>
</template> </template>
@@ -133,6 +166,29 @@
import version from '@/components/common/Version.vue' import version from '@/components/common/Version.vue'
import outcontent from '@/components/models/outcontent.vue' import outcontent from '@/components/models/outcontent.vue'
import rule from '@/components/models/RuleCont.vue' import rule from '@/components/models/RuleCont.vue'
class ruledata {
constructor() {
this.logical = "&&"
this.fieldId = null
this.operator = null
this.fieldValue = null
this.conditionType = 1
this.children = []
this.loopGroupActions = []
}
}
class ruleBlock {
constructor() {
this.score = '1'
this.failOutputList = []
this.strategyOutputList = []
this.resultFieldEn = ''
this.ruleConditionVo = new ruledata()
this.scoreFieldEn = ''
}
}
export default { export default {
mixins: [mangeRedactMixin], mixins: [mangeRedactMixin],
components: { components: {
@@ -176,22 +232,21 @@
version: {}, version: {},
addVersionStatus: false, addVersionStatus: false,
ruleVersionList: [], ruleVersionList: [],
scoreFieldEn: '', // scoreFieldEn: '',
resultFieldEn: '', // resultFieldEn: '',
loading: false, loading: false,
valueScope: '', valueScope: '',
priority: 0, priority: 0,
code: '', code: '',
name: '', name: '',
description: '', description: '',
ruledata: null, // ruledata: null,
outcontent: [], // outcontent: [],
failOutputList: [], // failOutputList: [],
SpecialField: { // SpecialField: {
score: '1', // score: '1',
ruleAudit: 5 // },
}, // tempisEmpty: false,
tempisEmpty: false,
parentId: '', parentId: '',
outTypeSuccess: { outTypeSuccess: {
outType: 'success' outType: 'success'
@@ -199,6 +254,7 @@
outTypeFail: { outTypeFail: {
outType: 'fail' outType: 'fail'
}, },
ruleBlockVoList: []
} }
}, },
created() { created() {
@@ -217,15 +273,7 @@
this.getRuleCont() this.getRuleCont()
}) })
} else { } else {
this.ruledata = { this.ruleBlockVoList = [new ruleBlock()]
"logical": "&&",
"fieldId": null,
"operator": null,
"fieldValue": null,
"conditionType": 1,
"children": [],
loopGroupActions: []
}
} }
}, },
computed: { computed: {
@@ -242,13 +290,32 @@
}, },
methods: { methods: {
goTop(index) {
let obj = this.ruleBlockVoList[index]
this.ruleBlockVoList.splice(index, 1)
this.ruleBlockVoList.splice(index - 1, 0, obj)
},
goBootom(index) {
let obj = this.ruleBlockVoList[index]
this.ruleBlockVoList.splice(index, 1)
this.ruleBlockVoList.splice(index + 1, 0, obj)
},
deleteRuleBlock(index) {
this.ruleBlockVoList.splice(index, 1)
},
addRuleBlock() {
this.ruleBlockVoList.push(new ruleBlock())
},
importNewVersion(e) { importNewVersion(e) {
this.addVersionLoading = true this.addVersionLoading = true
console.log(e) console.log(e)
this.tempisEmpty = false let tempisEmpty = {
this.deepverify(e.data.ruleConditionVo) is: false,
if (this.tempisEmpty) { msg: ''
this.addVersionLoading = false }
this.ruleBlockVoListVerify(tempisEmpty, e.data.ruleBlockVoList)
if (tempisEmpty.is) {
this.$message.error(tempisEmpty.msg)
return true return true
} }
@@ -257,13 +324,7 @@
versionCode: e.name.versionCode, versionCode: e.name.versionCode,
description: e.name.description, description: e.name.description,
ruleId: this.id, ruleId: this.id,
score: e.data.score, ruleBlockVoList: e.data.ruleBlockVoList,
// 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 => { this.getData.addVersion(obj).then(res => {
if (res.status == '1') { if (res.status == '1') {
@@ -280,17 +341,6 @@
} }
this.addVersionLoading = false this.addVersionLoading = false
}) })
}, },
async exportVersion() { async exportVersion() {
const res = await this.getData.getInfo({ const res = await this.getData.getInfo({
@@ -312,19 +362,15 @@
}, },
addVersionSure(tempVersion) { addVersionSure(tempVersion) {
this.addVersionLoading = true this.addVersionLoading = true
let tempRuleData = JSON.parse(JSON.stringify(this.ruledata))
this.deepTypetransition(tempRuleData) // this.deepTypetransition(tempRuleData)
let obj = { let obj = {
versionCode: tempVersion.versionCode, versionCode: tempVersion.versionCode,
description: tempVersion.description, description: tempVersion.description,
ruleId: this.id, ruleId: this.id,
score: this.SpecialField.score,
ruleAudit: this.SpecialField.ruleAudit, ruleBlockVoList: this.ruleBlockVoList,
scoreFieldEn: this.scoreFieldEn,
resultFieldEn: this.resultFieldEn,
ruleConditionVo: tempRuleData,
strategyOutputList: this.outcontent,
failOutputList: this.failOutputList
} }
this.getData.addVersion(obj).then(res => { this.getData.addVersion(obj).then(res => {
if (res.status == '1') { if (res.status == '1') {
@@ -345,21 +391,15 @@
}, },
updateVersion(tempVersion) { updateVersion(tempVersion) {
this.addVersionLoading = true this.addVersionLoading = true
let tempRuleData = JSON.parse(JSON.stringify(this.ruledata))
this.deepTypetransition(tempRuleData) // this.deepTypetransition(tempRuleData)
let obj = { let obj = {
ruleId: this.id, ruleId: this.id,
id: this.version.id, id: this.version.id,
versionCode: tempVersion.versionCode, versionCode: tempVersion.versionCode,
description: tempVersion.description, description: tempVersion.description,
ruleId: this.id,
score: this.SpecialField.score, ruleBlockVoList: this.ruleBlockVoList,
ruleAudit: this.SpecialField.ruleAudit,
scoreFieldEn: this.scoreFieldEn,
resultFieldEn: this.resultFieldEn,
ruleConditionVo: tempRuleData,
strategyOutputList: this.outcontent,
failOutputList: this.failOutputList
} }
this.getData.updateVersion(obj).then(res => { this.getData.updateVersion(obj).then(res => {
@@ -408,28 +448,28 @@
id: this.version.id id: this.version.id
}).then(res => { }).then(res => {
if (res.status == "1") { if (res.status == "1") {
this.scoreFieldEn = res.data.scoreFieldEn // this.scoreFieldEn = res.data.scoreFieldEn
this.resultFieldEn = res.data.resultFieldEn // this.resultFieldEn = res.data.resultFieldEn
this.getType(res.data.ruleConditionVo) this.getType(res.data.ruleConditionVo)
this.ruledata = res.data.ruleConditionVo ? res.data.ruleConditionVo : { this.ruleBlockVoList = res.data.ruleBlockVoList
"logical": "&&", // this.ruledata = res.data.ruleConditionVo ? res.data.ruleConditionVo : {
"fieldId": null, // "logical": "&&",
"operator": null, // "fieldId": null,
"fieldValue": null, // "operator": null,
"conditionType": 1, // "fieldValue": null,
"children": [], // "conditionType": 1,
} // "children": [],
this.outcontent = res.data.strategyOutputList // }
this.failOutputList = res.data.failOutputList // this.outcontent = res.data.strategyOutputList
this.outcontent.forEach(value => { // this.failOutputList = res.data.failOutputList
if (!value.variableType) { // this.outcontent.forEach(value => {
value.variableType = 1 // if (!value.variableType) {
} // value.variableType = 1
}) // }
this.redeepverify(this.ruledata) // })
// // this.redeepverify(this.ruledata)
this.SpecialField.score = res.data.score // this.SpecialField.score = res.data.score
this.SpecialField.ruleAudit = res.data.ruleAudit
} }
this.loading = false this.loading = false
}) })
@@ -445,12 +485,7 @@
addVersion() { addVersion() {
this.addVersionStatus = true this.addVersionStatus = true
this.tempadd = { this.tempadd = {
scoreFieldEn: this.scoreFieldEn, ruleBlockVoList : this.ruleBlockVoList
resultFieldEn: this.resultFieldEn,
ruledata: this.ruledata,
outcontent: this.outcontent,
failOutputList: this.failOutputList,
score: this.SpecialField.score,
} }
this.reset() this.reset()
}, },
@@ -493,67 +528,44 @@
// this.$message.error('请选择得分时输出变量'); // this.$message.error('请选择得分时输出变量');
// return true // return true
// } // }
if (isNaN(Number(this.SpecialField.score)) || String(this.SpecialField.score).trim() === "") {
this.$message.error('得分只能是数字'); let tempisEmpty = {
return true is: false,
} msg: ''
let is = true }
this.tempisEmpty = false this.ruleBlockVoListVerify(tempisEmpty, this.ruleBlockVoList)
this.deepverify(this.ruledata) if (tempisEmpty.is) {
if (this.tempisEmpty) { this.$message.error(tempisEmpty.msg)
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 return true
} }
}, },
addVersionClose() { addVersionClose() {
this.addVersionStatus = false this.addVersionStatus = false
this.SpecialField.score = this.tempadd.score // this.SpecialField.score = this.tempadd.score
this.scoreFieldEn = this.tempadd.scoreFieldEn // this.scoreFieldEn = this.tempadd.scoreFieldEn
this.resultFieldEn = this.tempadd.resultFieldEn // this.resultFieldEn = this.tempadd.resultFieldEn
this.ruledata = this.tempadd.ruledata // this.ruledata = this.tempadd.ruledata
this.outcontent = this.tempadd.outcontent // this.outcontent = this.tempadd.outcontent
this.failOutputList = this.tempadd.failOutputList // this.failOutputList = this.tempadd.failOutputList
this.ruleBlockVoList = this.tempadd.ruleBlockVoList
}, },
reset() { reset() {
this.ruledata = { // this.ruledata = {
"logical": "&&", // "logical": "&&",
"fieldId": null, // "fieldId": null,
"operator": null, // "operator": null,
"fieldValue": null, // "fieldValue": null,
"conditionType": 1, // "conditionType": 1,
"children": [], // "children": [],
loopGroupActions: [] // loopGroupActions: []
} // }
this.SpecialField.score = 1 // this.SpecialField.score = 1
this.outcontent = [] // this.outcontent = []
this.failOutputList = [] // this.failOutputList = []
this.scoreFieldEn = "" // this.scoreFieldEn = ""
this.resultFieldEn = "" // this.resultFieldEn = ""
this.ruleBlockVoList = [new ruleBlock()]
}, },
delectVersion() { delectVersion() {
this.getData.delectVersion({ this.getData.delectVersion({
@@ -574,14 +586,14 @@
}, },
getType(obj) { getType(obj) {
if (obj.conditionType == 2 && !obj.valueType) { // if (obj.conditionType == 2 && !obj.valueType) {
obj.valueType = this.mixinGetvalueType(obj.fieldId) // obj.valueType = this.mixinGetvalueType(obj.fieldId)
} // }
if (obj.children.length > 0) { // if (obj.children.length > 0) {
obj.children.forEach(value => { // obj.children.forEach(value => {
this.getType(value) // this.getType(value)
}) // })
} // }
}, },
outAdd(index) { outAdd(index) {
this.outcontent.splice(index, 0, { this.outcontent.splice(index, 0, {
@@ -592,36 +604,39 @@
}) })
}, },
submit() { submit() {
this.loading = true this.loading = true
if (this.verification()) { if (this.verification()) {
this.loading = false this.loading = false
return return
} }
let tempRuleData = JSON.parse(JSON.stringify(this.ruledata)) // let tempRuleData = JSON.parse(JSON.stringify(this.ruledata))
this.deepTypetransition(tempRuleData) // this.deepTypetransition(tempRuleData)
this.outcontent.forEach(value => { // this.outcontent.forEach(value => {
value.fieldEn = this.mixinGetvalueEn(value.fieldId) // value.fieldEn = this.mixinGetvalueEn(value.fieldId)
}) // })
this.failOutputList.forEach(value => { // this.failOutputList.forEach(value => {
value.fieldEn = this.mixinGetvalueEn(value.fieldId) // value.fieldEn = this.mixinGetvalueEn(value.fieldId)
}) // })
let obj = { let obj = {
"code": this.code.trim(), "code": this.code.trim(),
"name": this.name.trim(), "name": this.name.trim(),
"priority": this.priority, "priority": this.priority,
"description": String(this.description).trim(), "description": String(this.description).trim(),
difficulty: 2, difficulty: 2,
ruleAudit: this.SpecialField.ruleAudit,
ruleVersionList: [{ ruleVersionList: [{
score: this.SpecialField.score, // score: this.SpecialField.score,
scoreFieldEn: this.scoreFieldEn, // scoreFieldEn: this.scoreFieldEn,
resultFieldEn: this.resultFieldEn, // resultFieldEn: this.resultFieldEn,
ruleConditionVo: tempRuleData, // ruleConditionVo: tempRuleData,
strategyOutputList: this.outcontent, // strategyOutputList: this.outcontent,
failOutputList: this.failOutputList // failOutputList: this.failOutputList
ruleBlockVoList: this.ruleBlockVoList
}], }],
} }
@@ -642,7 +657,7 @@
} }
}).catch(err => { }).catch(err => {
this.loading = false this.loading = false
this.$message.error('网络出现问题-_-');
}) })
} else { } else {
obj.id = this.id obj.id = this.id
@@ -660,7 +675,7 @@
} }
}).catch(err => { }).catch(err => {
this.loading = false this.loading = false
this.$message.error('网络出现问题-_-');
}) })
} }
console.log(obj) console.log(obj)
@@ -669,46 +684,85 @@
this.ruledata[index].operator = "" this.ruledata[index].operator = ""
this.ruledata[index].fieldValue = "" 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('.')
}
})
ruleBlockVoListVerify(tempisEmpty, ruleBlockVoList) {
ruleBlockVoList.forEach(obj => {
if (!tempisEmpty.is) {
this.deepverify(tempisEmpty, obj.ruleConditionVo)
let is = false
obj.strategyOutputList.forEach(value => {
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType ===
"") {
is = true
this.verifyFlicker(value)
} }
}, if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value
deepverify(obj) { .fieldValue).formula.trim() ===
if (this.tempisEmpty) { '')) {
is = true
this.verifyFlicker(value)
}
})
obj.failOutputList.forEach(value => {
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType ===
"") {
is = true
this.verifyFlicker(value)
}
if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value
.fieldValue).formula.trim() ===
'')) {
is = true
this.verifyFlicker(value)
}
})
if (is === true) {
tempisEmpty.msg = '请检查自定义输出部分是否有未填项'
tempisEmpty.is = true
return true
}
if (isNaN(Number(obj.score)) || String(obj.score).trim() === "") {
tempisEmpty.msg = '得分只能是数字'
tempisEmpty.is = true
return return
} }
}
})
},
deepverify(tempisEmpty, obj) {
if (tempisEmpty.is) {
return
}
if (obj.conditionType == 0) { if (obj.conditionType == 0) {
if (obj.fieldId && obj.fieldValue && obj.operator) { } else { if (obj.fieldId && obj.fieldValue && obj.operator) { } else {
this.tempisEmpty = true tempisEmpty.is = true
return return
} }
} }
if (obj.children.length === 0 && obj.conditionType != 2) { if (obj.children.length === 0 && obj.conditionType != 2) {
this.tempisEmpty = true tempisEmpty.is = true
this.$message.error('非规则节点后不允许为空'); tempisEmpty.msg = '非规则节点后不允许为空'
this.verifyFlicker(obj)
return return
} }
if (obj.conditionType == 5) { //如果是条件组 if (obj.conditionType == 5) { //如果是条件组
if (obj.children.length === 0 && obj.conditionType != 5) { if (obj.children.length === 0 && obj.conditionType != 5) {
this.tempisEmpty = true tempisEmpty.is = true
this.$message.error('条件组后不允许为空'); tempisEmpty.msg = '条件组后不允许为空'
return return
} }
obj.condGroupResultCondition.children[0].fieldValue = obj.condGroupResultCondition.children[0] obj.condGroupResultCondition.children[0].fieldValue = obj.condGroupResultCondition.children[0]
@@ -724,97 +778,127 @@
if (obj.condGroupResultCondition.children[0].fieldValue !== 0 && obj.condGroupResultCondition if (obj.condGroupResultCondition.children[0].fieldValue !== 0 && obj.condGroupResultCondition
.children[1].fieldValue !== .children[1].fieldValue !==
0) { 0) {
this.tempisEmpty = true tempisEmpty.is = true
this.$message.error('条件组命中条件只能为数字且不为空与空格'); tempisEmpty.msg = '条件组命中条件只能为数字且不为空与空格'
this.verifyFlicker(obj,'red1')
return return
} }
} }
if (obj.condGroupResultCondition.children[0].fieldValue < 0) { if (obj.condGroupResultCondition.children[0].fieldValue < 0) {
this.tempisEmpty = true tempisEmpty.is = true
this.$message.error('条件组命中左边不能小于0'); tempisEmpty.msg = '条件组命中左边不能小于0'
this.verifyFlicker(obj,'red1')
return return
} }
if (obj.condGroupResultCondition.children[1].fieldValue > obj.children.length) { if (obj.condGroupResultCondition.children[1].fieldValue > obj.children.length) {
this.tempisEmpty = true tempisEmpty.is = true
this.$message.error('条件组命中右边不能大于条件总个数'); tempisEmpty.msg = '条件组命中右边不能大于条件总个数'
this.verifyFlicker(obj,'red1')
return return
} }
if (Number(obj.condGroupResultCondition.children[0].fieldValue) > Number(obj.condGroupResultCondition if (Number(obj.condGroupResultCondition.children[0].fieldValue) > Number(obj.condGroupResultCondition
.children[1].fieldValue)) { .children[1].fieldValue)) {
this.tempisEmpty = true tempisEmpty.is = true
this.$message.error('条件组命中左边不能大于右边'); tempisEmpty.msg = '条件组命中左边不能大于右边'
this.verifyFlicker(obj,'red1')
return return
} }
} }
if (obj.conditionType == 3 && !obj.fieldEn) { //如果是for节点 且没有选择 被遍历的指标 if (obj.conditionType == 3 && !obj.fieldEn) { //如果是for节点 且没有选择 被遍历的指标
this.tempisEmpty = true tempisEmpty.is = true
this.$message.error('for后需要确定循环的数组'); tempisEmpty.msg = 'for后需要确定循环的数组'
this.verifyFlicker(obj,'red1')
return return
} }
if (obj.conditionType == 2) { if (obj.conditionType == 2) {
obj.fieldValue = obj.fieldValue.trim() obj.fieldValue = obj.fieldValue.trim()
if (!obj.fieldEn || !obj.operator || !obj.fieldValue) { if (!obj.fieldEn || !obj.operator || !obj.fieldValue) {
if (obj.fieldValue !== 0) { if (obj.fieldValue !== 0) {
this.tempisEmpty = true tempisEmpty.is = true
this.$message.error('规则节点不允许有空值'); tempisEmpty.msg = '规则节点不允许有空值'
this.verifyFlicker(obj)
return return
} }
} }
} }
if (obj.conditionType == 3 && obj.loopResultCondition.children.length === 0) { //如果是for节点 且没有子节点 if (obj.conditionType == 3 && obj.loopResultCondition.children.length === 0) { //如果是for节点 且没有子节点
this.tempisEmpty = true tempisEmpty.is = true
this.$message.error('for的输出节点后不允许为空'); tempisEmpty.msg = 'for的输出节点后不允许为空'
this.verifyFlicker(obj,'red2')
return return
} }
if (obj.conditionType == 3 && obj.loopResultCondition.children.length != 0) { //如果是for节点 且 有输出节点 if (obj.conditionType == 3 && obj.loopResultCondition.children.length != 0) { //如果是for节点 且 有输出节点
obj.loopResultCondition.children.forEach(value => { obj.loopResultCondition.children.forEach(value => {
this.deepverify(value) this.deepverify(tempisEmpty, value)
}) })
} }
if (obj.children.length > 0) { //如果有子节点 if (obj.children.length > 0) { //如果有子节点
obj.children.forEach(value => { obj.children.forEach(value => {
this.deepverify(value) this.deepverify(tempisEmpty, value)
}) })
} }
if (obj.loopGroupActions.length > 0) { //如果有输出节点 if (obj.loopGroupActions.length > 0) { //如果有输出节点
console.log(obj)
let is = false let is = false
obj.loopGroupActions.forEach(value => { obj.loopGroupActions.forEach(value => {
if (!value.actionKey || !value.actionType || !value.actionValue) { if (!value.actionKey || !value.actionType ) {
if (value.actionValue === 0 && value.actionType != 1) { this.verifyFlicker(value)
this.tempisEmpty = true is = true
}else{
if (!value.actionValue &&( value.actionType != 1&&value.actionType != 5)) {
console.log(value)
this.verifyFlicker(value)
is = true is = true
} }
} }
}) })
if (is) { if (is) {
this.$message.error('输出变量不允许有空值'); tempisEmpty.is = true
tempisEmpty.msg = '输出变量不允许有空值'
return return
} }
} }
}, },
deepTypetransition(obj) { async verifyFlicker(obj,str = 'red') {
if (Array.isArray(obj.fieldEn)) { this.$set(obj, str, true)
obj.fieldEn = obj.fieldEn.join('.')
let MaxFlicker = 6
flicker(0)
function flicker(num) {
setTimeout(() => {
obj[str] = !obj[str]
if (num < MaxFlicker) {
flicker(num + 1)
} }
if (obj.children.length > 0) {
obj.children.forEach(value => { }, 300)
this.deepTypetransition(value)
})
} }
if (obj.loopGroupActions.length > 0) {
obj.loopGroupActions.forEach(value => {
if (Array.isArray(value.actionValue)) {
value.actionValue = value.actionValue.join('.')
}
})
} }
} // 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: { watch: {

View File

@@ -3,17 +3,19 @@
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<el-select v-model="data" :size="size" :filterable="type==2?'filterable':false" placeholder="请选择" <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')"> 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,7].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,7].indexOf(valueType)==-1"></el-option>
<el-option label="等于" value="==" v-show="[5].indexOf(valueType)==-1"></el-option> <el-option label="等于" value="==" v-show="[5,7].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,7].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,7].indexOf(valueType)==-1"></el-option>
<el-option label="不等于" value="!=" v-show="[5].indexOf(valueType)==-1"></el-option> <el-option label="不等于" value="!=" v-show="[5,7].indexOf(valueType)==-1"></el-option>
<el-option label="包含" value="contains" v-show="[2,5,6].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="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="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="not empty" v-show="[6].indexOf(valueType)!=-1"></el-option>
<el-option label="正则匹配" value="regex" v-show="[2].indexOf(valueType)!=-1"></el-option> <el-option label="正则匹配" value="regex" v-show="[2].indexOf(valueType)!=-1"></el-option>
<el-option label="匹配" value="array contains" v-show="[7].indexOf(valueType)!=-1"></el-option>
<el-option label="不匹配" value="array not contains" v-show="[7].indexOf(valueType)!=-1"></el-option>
</el-select> </el-select>
<el-input :value="value2" @input="$emit('update:value2',$event)" maxlength="30" :size="size" <el-input :value="value2" @input="$emit('update:value2',$event)" maxlength="30" :size="size"

View File

@@ -16,6 +16,7 @@
margin: 12px 0px 0 0; margin: 12px 0px 0 0;
height: 0; height: 0;
} }
.RuleIcon { .RuleIcon {
@@ -42,6 +43,7 @@
<template> <template>
<div class="rule" :style="{marginLeft:ZIndex==1?'20px':'0px'}" v-if="data"> <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"> <div :style="{position: 'absolute',top:'0px', left: '-20px',marginTop: top===0?'0':'8px'}" class="RuleIcon">
<el-dropdown trigger="click" @command="handleCommand"> <el-dropdown trigger="click" @command="handleCommand">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
@@ -91,35 +93,42 @@
</div> </div>
<div> <div>
<div <div
:style="{border: '1px dashed '+ color[ZIndex%5],borderRadius: '5px',paddingRight: '5px',paddingBottom: '5px',position:'relative',minWidth:'30px',minHeight:'40px'}"> :style="{border: '1px dashed '+ color[ZIndex%5],borderRadius: '5px',paddingRight: '5px',paddingBottom: '5px',position:'relative',minWidth:'30px',minHeight:'40px',backgroundColor:data.red&&(data.conditionType==1||data.conditionType==4||data.conditionType==5)?'#f56c6c':''}">
<div v-if="data.conditionType==3" style="display: flex;margin-top: 6px;"> <!-- {{data}} -->
<div class="Rule_cont" :style="{marginTop:'12px'}"></div> <div v-if="data.conditionType==3" style="display: flex;margin-top: 6px;" :style="{backgroundColor:data.red1?'#f56c6c':''}">
<el-cascader v-model="data.fieldEn" filterable size="mini" :options="fielduserArr" :key="keyValue+(data.random?data.random:0)" @visible-change="randomAdd(data,$event)" <div class="Rule_cont" :style="{marginTop:'12px'}"></div>
:props="{ expandTrigger: 'hover' }" @change="EnChange"></el-cascader> <myCascader v-model="data.fieldEn" size="mini" :options="fielduserArr" isString clearable @change="EnChange"></myCascader>
<!-- <el-cascader v-model="data.fieldEn" filterable size="mini" :options="fielduserArr" :key="keyValue+(data.random?data.random:0)" @visible-change="randomAdd(data,$event)"
:props="{ expandTrigger: 'hover' }" @change="EnChange"></el-cascader> -->
<!-- for 的输入 --> <!-- for 的输入 -->
</div> </div>
<div <div
:style="{border:data.conditionType==3?'1px dotted #000':'',margin:data.conditionType==3?'5px 10px ':'',padding:data.conditionType==3?'8px':'',paddingLeft:'0px'}"> :style="{backgroundColor:data.red&&data.conditionType==3?'#f56c6c':'',border:data.conditionType==3?'1px dotted #000':'',margin:data.conditionType==3?'5px 10px ':'',padding:data.conditionType==3?'8px':'',paddingLeft:'0px'}">
{{typeof sdataJson!= 'object'&&typeof sdataJson!= 'array'&&data.conditionType==3?'此处不支持继续遍历请删除此节点':''}} {{typeof sdataJson!= 'object'&&typeof sdataJson!= 'array'&&data.conditionType==3?'此处不支持继续遍历请删除此节点':''}}
<div v-for="(item,index) in data.children" style="display: flex;margin-top: 7px;"> <div v-for="(item,index) in data.children" style="display: flex;margin-top: 7px;">
<div class="Rule_cont" <div class="Rule_cont"
:style="{marginTop:item.conditionType===0?'12px':(index===0?'11px':'20px')}"> :style="{marginTop:item.conditionType===0?'12px':(index===0?'11px':'20px')}">
</div> </div>
<!-- conditionType==2 规则部分 --> <!-- conditionType==2 规则部分 -->
<div v-if="item.conditionType==2" style="display: flex;"> <div v-if="item.conditionType==2" style="display: flex;">
<!-- {{fieldType}} --> <!-- {{fieldType}} -->
<div v-if="fieldType!='for'" style="display: flex;"> <div v-if="fieldType!='for'" style="display: flex;">
<!-- 普通规则部分 --> <!-- 普通规则部分 -->
<!-- 不为输出节点 则拉选 fielduser--> <!-- 不为输出节点 则拉选 fielduser-->
<div v-if="data.conditionType!=4&&out!='out'" style="display: flex;"> <div v-if="data.conditionType!=4&&out!='out'" style="display: flex;" :style="{backgroundColor:item.red?'#f56c6c':''}">
<el-cascader v-model="item.fieldEn" filterable size="mini" :options="fieldUserObj" clearable @change="ruleCascaderChange(item)" <myCascader v-model="item.fieldEn" size="mini" :options="fieldUserObj" isString clearable @change="ruleCascaderChange(item)"></myCascader>
<!-- <el-cascader v-model="item.fieldEn" filterable size="mini" :options="fieldUserObj" clearable @change="ruleCascaderChange(item)"
:key="keyValue+(item.random?item.random:0)" :props="{ expandTrigger: 'hover' }" @visible-change="randomAdd(item,$event)"> :key="keyValue+(item.random?item.random:0)" :props="{ expandTrigger: 'hover' }" @visible-change="randomAdd(item,$event)">
</el-cascader> </el-cascader> -->
<!-- <bigElCascader v-model="item.fieldEn" filterable size="mini" :options="fieldUserObj" <!-- <bigElCascader v-model="item.fieldEn" filterable size="mini" :options="fieldUserObj"
clearable @change="ruleCascaderChange(item)" :Mykey="keyValue" clearable @change="ruleCascaderChange(item)" :Mykey="keyValue"
@@ -131,7 +140,8 @@
<!-- 加入 变量选择 --> <!-- 加入 变量选择 -->
</div> </div>
<div v-else style="display: flex;"> <div v-else style="display: flex;" :style="{backgroundColor:item.red?'#f56c6c':''}">
打点1
<el-select v-model="item.fieldEn" size="mini" filterable <el-select v-model="item.fieldEn" size="mini" filterable
@change="selectChange(item)"> @change="selectChange(item)">
<el-option v-for="cont in suseingfield" :key="cont.id" :label="cont.fieldCn" <el-option v-for="cont in suseingfield" :key="cont.id" :label="cont.fieldCn"
@@ -156,14 +166,17 @@
</el-select> --> </el-select> -->
</div> </div>
<div v-else style="display: flex;"> <div v-else style="display: flex;" :style="{backgroundColor:item.red?'#f56c6c':''}">
<!-- {{sEn}} --> <!-- {{sEn}} -->
<!-- for规则部分 --> <!-- for规则部分 -->
<!-- {{sEn}} --> <!-- {{sEn}} -->
<el-cascader size="mini" filterable v-model="item.fieldEn" :options="getUserObj" @visible-change="randomAdd(item,$event)"
<myCascader v-model="item.fieldEn" size="mini" :options="getUserObj" isString clearable @change="forChange(item)"></myCascader>
<!-- <el-cascader size="mini" filterable v-model="item.fieldEn" :options="getUserObj" @visible-change="randomAdd(item,$event)"
:key="keyValue+(item.random?item.random:0)" :props="{ expandTrigger: 'hover' }" @change="forChange(item)"> :key="keyValue+(item.random?item.random:0)" :props="{ expandTrigger: 'hover' }" @change="forChange(item)">
</el-cascader> </el-cascader> -->
<ruleRelation v-model="item.operator" :value2.sync="item.fieldValue" <ruleRelation v-model="item.operator" :value2.sync="item.fieldValue"
:variableType.sync="item.variableType" :valueType="getvalueTypebyEn(item.fieldEn)" :variableType.sync="item.variableType" :valueType="getvalueTypebyEn(item.fieldEn)"
@@ -194,14 +207,14 @@
</div> </div>
</div> </div>
<div v-if="data.conditionType==3" style="margin-left: 25px;margin-top: 10px;"> <div v-if="data.conditionType==3" style="margin-left: 25px;margin-top: 10px;" :style="{backgroundColor:data.red2?'#f56c6c':''}">
<!-- for 的输出 --> <!-- for 的输出 -->
<!-- 打点 - for输出 -->
<rule :suseingfield="useingfield" :out="'out'" :data="data.loopResultCondition" :ZIndex="ZIndex+1" <rule :suseingfield="useingfield" :out="'out'" :data="data.loopResultCondition" :ZIndex="ZIndex+1"
@delectLogical="delectLogical"></rule> @delectLogical="delectLogical"></rule>
</div> </div>
</div> </div>
<div v-if="data.conditionType==5" class="RuleCont_for_out"> <div v-if="data.conditionType==5" class="RuleCont_for_out" :style="{backgroundColor:data.red1?'#f56c6c':''}">
<span style="font-size: 12px;margin-left: 5px;">命中条件</span> <span style="font-size: 12px;margin-left: 5px;">命中条件</span>
[ [
<el-input size="mini" v-model="data.condGroupResultCondition.children[0].fieldValue" <el-input size="mini" v-model="data.condGroupResultCondition.children[0].fieldValue"
@@ -213,8 +226,12 @@
</div> </div>
<div v-if="data.loopGroupActions.length>0" class="RuleCont_for_out"> <div v-if="data.loopGroupActions.length>0" class="RuleCont_for_out">
<!-- 打点 - for计算 -->
<div v-for="(item,index) in data.loopGroupActions" <div v-for="(item,index) in data.loopGroupActions"
style="display: flex; align-items: center;margin-bottom: 5px;margin-left: 5px;"> style="display: flex; align-items: center;margin-bottom: 5px;margin-left: 5px;"
:style="{backgroundColor:item.red?'#f56c6c':''}"
>
<el-select v-model="item.actionKey" style="width: 150px;" size="mini" filterable> <el-select v-model="item.actionKey" style="width: 150px;" size="mini" filterable>
<el-option v-for="cont in fielduser" :key="cont.id" :label="cont.fieldCn" :value="cont.fieldEn" <el-option v-for="cont in fielduser" :key="cont.id" :label="cont.fieldCn" :value="cont.fieldEn"
v-if="item.actionType!=6||cont.valueType==6"> v-if="item.actionType!=6||cont.valueType==6">
@@ -230,9 +247,10 @@
<el-input size="mini" style="width: 120px;" v-model="item.actionValue" <el-input size="mini" style="width: 120px;" v-model="item.actionValue"
v-if="[2,4,6,7].indexOf(item.actionType)!=-1"></el-input> v-if="[2,4,6,7].indexOf(item.actionType)!=-1"></el-input>
<el-cascader size="mini" style="width: 120px;" filterable v-model="item.actionValue" <myCascader v-model="item.actionValue" v-if="item.actionType==3" style="width: 120px;" size="mini" :options="getUserObj" isString clearable @change="forChange(item)"></myCascader>
<!-- <el-cascader size="mini" style="width: 120px;" filterable v-model="item.actionValue"
:options="getUserObj" :key="keyValue+(item.random?item.random:0)" v-if="item.actionType==3" @visible-change="randomAdd(item,$event)" :options="getUserObj" :key="keyValue+(item.random?item.random:0)" v-if="item.actionType==3" @visible-change="randomAdd(item,$event)"
:props="{ expandTrigger: 'hover' }"></el-cascader> :props="{ expandTrigger: 'hover' }"></el-cascader> -->
<i class="el-icon-circle-plus-outline" style="color: #66B1FF;margin-left: 3px;" <i class="el-icon-circle-plus-outline" style="color: #66B1FF;margin-left: 3px;"
@click="addLoopOut(index)"></i> @click="addLoopOut(index)"></i>
@@ -288,8 +306,8 @@
}, },
mounted() { mounted() {
if (this.data) { if (this.data) {
// console.log(this.data.fieldEn) // console.log(this.data)
if (Array.isArray(this.data.fieldEn)) { if (this.data.fieldEn) {
if (this.data.fieldEn.length > 0) { if (this.data.fieldEn.length > 0) {
this.EnChange(this.data.fieldEn, false) this.EnChange(this.data.fieldEn, false)
} }
@@ -369,12 +387,12 @@
let obj = {} let obj = {}
if (this.fieldType == "for") { if (this.fieldType == "for") {
obj = this.sdataJson obj = this.sdataJson
} else if (Array.isArray(this.data.fieldEn)) { } else if (this.data.fieldEn) {
// console.log(1, this.data.fieldEn) console.log(1, this.data.fieldEn)
obj = JSON.parse(this.mixinGetFieldByEn(this.data.fieldEn[0]).jsonValue) obj = JSON.parse(this.mixinGetFieldByEn(this.data.fieldEn.split('.')[0]).jsonValue)
} }
if (Array.isArray(this.data.fieldEn)) { if (this.data.fieldEn) {
this.data.fieldEn.forEach((value, index) => { this.data.fieldEn.split('.').forEach((value, index) => {
if (index != 0) { if (index != 0) {
obj = obj[value] obj = obj[value]
} }
@@ -492,6 +510,7 @@
item.operator = "" item.operator = ""
}, },
getvalueTypebyEn(e) { //通过En 获取 valueType getvalueTypebyEn(e) { //通过En 获取 valueType
e && (e = e.split('.'))
if (!Array.isArray(e)) { if (!Array.isArray(e)) {
return return
} }
@@ -527,14 +546,14 @@
}, },
EnChange(e, clear = true) { EnChange(e, clear = true) {
this.En = e.join('.') this.En = e
if (!clear) return if (!clear) return
this.deepClearEn(this.data) this.deepClearEn(this.data)
}, },
deepClearEn(obj) { // 递归清除用到父级的 En deepClearEn(obj) { // 递归清除用到父级的 En
obj.children.forEach(value => { obj.children.forEach(value => {
if (Array.isArray(value.fieldEn)) { if (value.fieldEn) {
if (value.fieldEn[0][0] == "%") { if (value.fieldEn[0] == "%") {
value.fieldEn = "" value.fieldEn = ""
} }
} }
@@ -700,7 +719,7 @@
this.data.children.push({ this.data.children.push({
"logical": 'for', "logical": 'for',
"fieldId": "", "fieldId": "",
"fieldEn":[], "fieldEn":"",
"operator": "", "operator": "",
"fieldValue": "", "fieldValue": "",
"conditionType": 3, "conditionType": 3,

View File

@@ -75,16 +75,17 @@
<div> <div>
<div class="rule_home"> <div class="rule_home">
<div class="rule_fa"> <div class="rule_fa">
<el-button icon="el-icon-plus" circle @click="outAdd(0)"></el-button> <el-button icon="el-icon-plus" circle @click="outAdd(0)" :size="size"></el-button>
<el-button icon="el-icon-close" circle @click="outDelect(index)" v-if="!unone" disabled style="margin-right: 10px"></el-button> <el-button icon="el-icon-close" circle @click="outDelect(index)" :size="size" v-if="!unone" disabled style="margin-right: 10px"></el-button>
</div> </div>
<slot></slot> <slot></slot>
</div> </div>
<div v-for="(value,index) in outcontent" class="rule_home" style="display: flex;position: relative;"> <div v-for="(value,index) in outcontent" class="rule_home" style="display: flex;position: relative;" :style="{backgroundColor:value.red?'#f56c6c':''}">
<!-- {{value}} -->
<div class="rule_fa"> <div class="rule_fa">
<el-button icon="el-icon-plus" circle @click="outAdd(index+1)"></el-button> <el-button icon="el-icon-plus" circle @click="outAdd(index+1)" :size="size"></el-button>
<el-button icon="el-icon-close" circle @click="outDelect(index)" style="margin-right: 10px"></el-button> <el-button icon="el-icon-close" circle @click="outDelect(index)" :size="size" style="margin-right: 10px"></el-button>
</div> </div>
<div v-if="ruleOut" class="ruleOut"> <div v-if="ruleOut" class="ruleOut">
<span :style="{backgroundColor:value.outCondition?'#afd7ff':'#e8e8e8',border:value.outCondition?'1px solid #409EFF':'1px solid #adadad',color:value.outCondition?'#409EFF':'#adadad',fontSize:'12px',padding:'2px'}" <span :style="{backgroundColor:value.outCondition?'#afd7ff':'#e8e8e8',border:value.outCondition?'1px solid #409EFF':'1px solid #adadad',color:value.outCondition?'#409EFF':'#adadad',fontSize:'12px',padding:'2px'}"
@@ -92,11 +93,11 @@
</div> </div>
<div style="display: flex;align-items: center;"> <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 :value="getCn(value.fieldId)" :size="size" placeholder="请选择" style="width: 200px;margin-right: 10px;" @focus="outClick(index)">
</el-select> </el-select>
<p style="margin-right: 10px;">=</p> <p style="margin-right: 10px;">=</p>
<varialeSelect v-model="value.fieldValue" :valueType="mixinGetvalueType(value.fieldId)" :variableType.sync="value.variableType" width="255px" height="40px" size="—"></varialeSelect> <varialeSelect v-model="value.fieldValue" :size="size" :valueType="mixinGetvalueType(value.fieldId)" :variableType.sync="value.variableType" width="255px"></varialeSelect>
</div> </div>
</div> </div>
@@ -201,6 +202,10 @@
default: () => { default: () => {
return null return null
} }
},
size:{
type: String,
default: ''
} }
}, },
// watch: { // watch: {
@@ -320,6 +325,7 @@
if (this.radio == '') { if (this.radio == '') {
this.$message.error('请选择一个字段,或者选择取消') this.$message.error('请选择一个字段,或者选择取消')
} else { } else {
// console.log(this.tempcur)
if (this.tempcur.split('###')[1] === "Data") { if (this.tempcur.split('###')[1] === "Data") {
this.Data.forEach((value, index) => { this.Data.forEach((value, index) => {
if (index === parseInt(this.tempcur.split('###')[0])) { if (index === parseInt(this.tempcur.split('###')[0])) {
@@ -330,10 +336,11 @@
} }
}) })
} else if (this.tempcur.split('###')[1] === "out") { } else if (this.tempcur.split('###')[1] === "out") {
console.log(this.outcontent) // console.log(this.outcontent)
this.outcontent.forEach((value, index) => { this.outcontent.forEach((value, index) => {
if (index === parseInt(this.tempcur.split('###')[0])) { if (index === parseInt(this.tempcur.split('###')[0])) {
value.fieldId = this.radio value.fieldId = this.radio
value.fieldEn = this.mixinGetvalueEn(value.fieldId)
// value.fieldEn = this.mixinGetvalueEn(this.radio) // value.fieldEn = this.mixinGetvalueEn(this.radio)
this.$set(value,'fieldEn',this.mixinGetvalueEn(this.radio)) this.$set(value,'fieldEn',this.mixinGetvalueEn(this.radio))
value.fieldValue = '' value.fieldValue = ''

View File

@@ -89,6 +89,7 @@
style="text-align: center;font-size: 100px;color: #d0d0d0;margin-top: 50px;user-select: none;"> style="text-align: center;font-size: 100px;color: #d0d0d0;margin-top: 50px;user-select: none;">
请选择引擎信息 请选择引擎信息
</p> </p>
<template v-if="versionId">
<el-row :gutter="20" style="margin-top: 20px;" > <el-row :gutter="20" style="margin-top: 20px;" >
<el-col :span="24"> <el-col :span="24">
<el-card shadow="hover" v-if="engineSummary"> <el-card shadow="hover" v-if="engineSummary">
@@ -238,12 +239,12 @@
</el-row> </el-row>
<el-row :gutter="20" style="margin-top: 20px;"> <el-row :gutter="20" style="margin-top: 20px;">
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" v-if="option1.series[0].data.length"> <el-card shadow="hover">
<charts sid="chart1" :option="option1" :height="chart1Size[0]" :width="chart1Size[1]"></charts> <charts sid="chart1" :option="option1" :height="chart1Size[0]" :width="chart1Size[1]"></charts>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" style="position: relative;" v-if="option1.series[0].data.length"> <el-card shadow="hover" style="position: relative;" >
<el-table :data="option1TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}"> <el-table :data="option1TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}">
<el-table-column prop="result" label="调用时间" width="180"> <el-table-column prop="result" label="调用时间" width="180">
</el-table-column> </el-table-column>
@@ -255,7 +256,7 @@
</el-row> </el-row>
<el-row :gutter="20" style="margin-top: 20px;"> <el-row :gutter="20" style="margin-top: 20px;">
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" v-if="option2PutList.length"> <el-card shadow="hover" >
<el-select v-model="option2Put" size="mini" multiple collapse-tags value-key="id" :loading="option2PutList.length==0" <el-select v-model="option2Put" size="mini" multiple collapse-tags value-key="id" :loading="option2PutList.length==0"
style="margin-left: 20px;position: absolute;" filterable placeholder="请选择决策结果" :key="num"> style="margin-left: 20px;position: absolute;" filterable placeholder="请选择决策结果" :key="num">
<el-option v-for="item in option2PutList" :key="item[0].id" :label="item[0].result" :value="item"> <el-option v-for="item in option2PutList" :key="item[0].id" :label="item[0].result" :value="item">
@@ -265,7 +266,7 @@
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" style="position: relative;" v-if="option2PutList.length"> <el-card shadow="hover" style="position: relative;" >
<el-table :data="option2TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}"> <el-table :data="option2TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}">
<el-table-column prop="result" label="结果" width="180"> <el-table-column prop="result" label="结果" width="180">
</el-table-column> </el-table-column>
@@ -277,7 +278,7 @@
</el-row> </el-row>
<el-row :gutter="20" style="margin-top: 20px;"> <el-row :gutter="20" style="margin-top: 20px;">
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" style="position: relative;" v-if="option3PutList.length"> <el-card shadow="hover" style="position: relative;" >
<el-select v-model="option3Put" size="mini" multiple collapse-tags value-key="id" :loading="option3PutList.length==0" <el-select v-model="option3Put" size="mini" multiple collapse-tags value-key="id" :loading="option3PutList.length==0"
style="margin-left: 20px;position: absolute;" filterable placeholder="请选择规则及版本" :key="num"> style="margin-left: 20px;position: absolute;" filterable placeholder="请选择规则及版本" :key="num">
<el-option v-for="item in option3PutList" :key="item[0].id" :label="item[0].ruleName+':'+item[0].ruleVersionCode" <el-option v-for="item in option3PutList" :key="item[0].id" :label="item[0].ruleName+':'+item[0].ruleVersionCode"
@@ -288,7 +289,7 @@
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" v-if="option3PutList.length"> <el-card shadow="hover">
<el-table :data="option3TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}"> <el-table :data="option3TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}">
<el-table-column prop="result" label="命中" width="180"> <el-table-column prop="result" label="命中" width="180">
</el-table-column> </el-table-column>
@@ -300,7 +301,7 @@
</el-row> </el-row>
<el-row :gutter="20" style="margin-top: 20px;"> <el-row :gutter="20" style="margin-top: 20px;">
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" style="position: relative;" v-if="option4PutList.length"> <el-card shadow="hover" style="position: relative;" >
<el-select v-model="option4Put" size="mini" multiple collapse-tags value-key="id" :loading="option4PutList.length==0" <el-select v-model="option4Put" size="mini" multiple collapse-tags value-key="id" :loading="option4PutList.length==0"
style="margin-left: 20px;position: absolute;" filterable placeholder="请选择节点" :key="num"> style="margin-left: 20px;position: absolute;" filterable placeholder="请选择节点" :key="num">
<el-option v-for="item in option4PutList" :key="item[0].id" :label="item[0].nodeName" :value="item"> <el-option v-for="item in option4PutList" :key="item[0].id" :label="item[0].nodeName" :value="item">
@@ -310,7 +311,7 @@
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" v-if="option4PutList.length"> <el-card shadow="hover" >
<el-table :data="option4TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}"> <el-table :data="option4TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}">
<el-table-column prop="result" label="命中" width="180"> <el-table-column prop="result" label="命中" width="180">
</el-table-column> </el-table-column>
@@ -322,7 +323,7 @@
</el-row> </el-row>
<el-row :gutter="20" style="margin-top: 20px;"> <el-row :gutter="20" style="margin-top: 20px;">
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" style="position: relative;" v-if="option5PutList.length"> <el-card shadow="hover" style="position: relative;" >
<el-select v-model="option5Put" size="mini" :loading="option5PutList.length==0" style="margin-left: 20px;position: absolute;z-index: 5;" <el-select v-model="option5Put" size="mini" :loading="option5PutList.length==0" style="margin-left: 20px;position: absolute;z-index: 5;"
filterable value-key="[0][0].id" placeholder="请选择评分卡节点" :key="num"> filterable value-key="[0][0].id" placeholder="请选择评分卡节点" :key="num">
<el-option v-for="item in option5PutList" :key="item[0][0].id" :label="item[0][0].scorecardName" :value="item"> <el-option v-for="item in option5PutList" :key="item[0][0].id" :label="item[0][0].scorecardName" :value="item">
@@ -332,7 +333,7 @@
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" style="position: relative;" v-if="option5PutList.length"> <el-card shadow="hover" style="position: relative;" >
<el-table :data="option5TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}"> <el-table :data="option5TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}">
<el-table-column prop="result" label="命中" width="180"> <el-table-column prop="result" label="命中" width="180">
</el-table-column> </el-table-column>
@@ -344,7 +345,7 @@
</el-row> </el-row>
<el-row :gutter="20" style="margin-top: 20px;"> <el-row :gutter="20" style="margin-top: 20px;">
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" style="position: relative;" v-if="option6PutList.length"> <el-card shadow="hover" style="position: relative;" >
<el-select v-model="option6Put" size="mini" :loading="option6PutList.length==0" style="margin-left: 20px;position: absolute;z-index: 5;" <el-select v-model="option6Put" size="mini" :loading="option6PutList.length==0" style="margin-left: 20px;position: absolute;z-index: 5;"
filterable value-key="[0][0].id" placeholder="请选择入参" :key="num"> filterable value-key="[0][0].id" placeholder="请选择入参" :key="num">
<el-option v-for="item in option6PutList" :key="item[0][0].id" :label="item[0][0].decisonTablesName" :value="item"> <el-option v-for="item in option6PutList" :key="item[0][0].id" :label="item[0][0].decisonTablesName" :value="item">
@@ -354,7 +355,7 @@
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-card shadow="hover" style="position: relative;" v-if="option6PutList.length"> <el-card shadow="hover" style="position: relative;" >
<el-table :data="option6TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}"> <el-table :data="option6TableData" style="width: 100%;height: 300px;" :default-sort="{prop:'resultCount',order:'descending'}">
<el-table-column prop="result" label="命中" width="180"> <el-table-column prop="result" label="命中" width="180">
@@ -366,6 +367,7 @@
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
</template>
</div> </div>
</template> </template>

View File

@@ -17,7 +17,7 @@ import store from './store'
import './styles/index.scss'; // global css import './styles/index.scss'; // global css
import myMixin from '@/utils/mixin.js'; import myMixin from '@/utils/mixin.js';
import myCascader from './components/common/Cascader'
// import 'codemirror/lib/codemirror.css' // import 'codemirror/lib/codemirror.css'
// import VueCodemirror from 'vue-codemirror' // import VueCodemirror from 'vue-codemirror'
@@ -36,6 +36,9 @@ const i18n = new VueI18n({
}); });
Vue.component("myCascader",myCascader)
Date.prototype.format = function(fmt) { Date.prototype.format = function(fmt) {
var o = { var o = {
"M+": this.getMonth() + 1, //月份 "M+": this.getMonth() + 1, //月份

View File

@@ -212,7 +212,7 @@ export default new Vuex.Store({
value: value.fieldEn, value: value.fieldEn,
valueType: value.valueType, valueType: value.valueType,
jsonValue: value.jsonValue, jsonValue: value.jsonValue,
children: GetdeepObj(JSON.parse(value.jsonValue)) children: GetdeepObj(JSON.parse(value.jsonValue),true,true,true)
} }
} else { } else {
return { return {

View File

@@ -1,4 +1,4 @@
export const GetdeepObj = (obj, length = true ,first=false) => { export const GetdeepObj = (obj, length = true ,first=false,my = false) => {
if (typeof obj == 'object' && !Array.isArray(obj)) { if (typeof obj == 'object' && !Array.isArray(obj)) {
let arr = [] let arr = []
for (let key in obj) { for (let key in obj) {
@@ -20,7 +20,15 @@ export const GetdeepObj = (obj, length = true ,first=false) => {
obj2.children.push({ obj2.children.push({
value: '[]', value: '[]',
label: '第一项', label: '第一项',
children: GetdeepObj(obj[key][0], length,first) children: GetdeepObj(obj[key][0], length,first,my)
})
}
if (my) {
console.log(1)
obj2.children.push({
value: 'array',
label: '本身',
valueType: 7,
}) })
} }
arr.push(obj2) arr.push(obj2)
@@ -28,7 +36,7 @@ export const GetdeepObj = (obj, length = true ,first=false) => {
arr.push({ arr.push({
value: key, value: key,
label: key, label: key,
children: GetdeepObj(obj[key], length,first) children: GetdeepObj(obj[key], length,first,my)
}) })
} else { } else {
arr.push({ arr.push({
@@ -54,7 +62,14 @@ export const GetdeepObj = (obj, length = true ,first=false) => {
obj.push({ obj.push({
value: '[0]', value: '[0]',
label: '第一项', label: '第一项',
children: GetdeepObj(obj[0], length,first) children: GetdeepObj(obj[0], length,first,my)
})
}
if (my) {
obj.push({
value: 'array',
label: '本身',
valueType: 7,
}) })
} }

View File

@@ -80,6 +80,7 @@ export default {
}, },
mixinGetValueTypeByJSONEn(e){ mixinGetValueTypeByJSONEn(e){
if(!e||e.length==0) return if(!e||e.length==0) return
if(typeof e == 'string') e = e.split('.')
if(!Array.isArray(e)) e=e.split('.') if(!Array.isArray(e)) e=e.split('.')
let obj =this.FieldUserObj let obj =this.FieldUserObj
e.forEach((value,index)=>{ e.forEach((value,index)=>{