优化事件执行

20231126-yw
yuanwei 1 year ago
parent f078db3410
commit 0a2d35fa97

@ -47,64 +47,42 @@ export async function getHead(businessType,type){
}
export function executeFuc(_this,row,number,type,clickFuc,value){
export function executeFuc(_this,row,type,clickFuc,obj){
// 0 列表点击事件 1 列表页按钮事件 2 编辑页表单事件 3 列表页复选框事件 4列表页颜色方法 5列表查询框方法
if("1" == type){
//按钮事件
//列表页按钮事件
return callModelFun(_this,clickFuc,row);
}else if("3" == type){
//按钮是否禁用事件
if(clickFuc){
return callModelFun(_this,clickFuc,row);
}else{
return false;
}
}else if("4" == type){
//颜色方法
//列表页颜色方法
if(clickFuc) {
return getColer(clickFuc, value);
return getColer(clickFuc, obj);
}
}else if("5" == type){
//查询input方法
//列表查询条件查询input方法
if(clickFuc){
return callModelFun(_this,clickFuc,row);
}else{
return false;
}
}else if("6" == type){
//查询input方法
}else if("2" == type){
if(clickFuc){
//编辑页表单事件
return callModelFun(_this,clickFuc,row);
}else{
return false;
}
}else if("2" == type){
if(number.clickFuc){
//表单事件
return callModelFun(_this,number.clickFuc,row);
}else{
return true;
}
}else if(number != null && number >= 0){
//复选框事件
var checkSelectableFuc = ""
_this.tableObj.tableList.forEach(obj => {
if(obj.columnType == "selection"){
checkSelectableFuc = obj.clickFuc;
}
})
//
if(checkSelectableFuc){
return callModelFun(_this,checkSelectableFuc,row);
}else if("3" == type){
//列表页复选框事件
if(clickFuc){
return callModelFun(_this,clickFuc,row);
}else{
return true;
}
}else{
console.log(row);
}else if("0" == type){
//表单点击事件
if(_this.tableObj.handleChangeFuc){
return callModelFun(_this,_this.tableObj.handleChangeFuc,row);
if(clickFuc){
return callModelFun(_this,clickFuc,row);
}
return true;
}
}

@ -10,7 +10,7 @@
v-model="filterQuery[item.columnName]"
:placeholder="item.columnDesc"
:disabled="executeEval(null,item.disabledFuc,false)"
@keyup.enter.native="executeFuc($event,null,'5',item.clickFuc)"
@keyup.enter.native="executeFuc($event,'5',item.clickFuc)"
clearable
></el-input>
</el-form-item>
@ -34,7 +34,7 @@
:disabled="executeEval(null,item.disabledFuc,false)"
filterable
remote
:remote-method="(query) => executeFuc(query, null,'6',item.clickFuc)"
:remote-method="(query) => executeFuc(query,'5',item.clickFuc)"
clearable>
<el-option
v-for="item in options[item.clickFuc]"
@ -171,7 +171,7 @@
v-loading="loading"
highlight-current-row="true"
:row-class-name="tableRowClassName"
@current-change="executeFuc"
@current-change="(row) => executeFuc(row,'0',tableObj.handleChangeFuc)"
@selection-change="handleSelectionUdiChange"
>
<template v-for="(item, index) in tableHeader">
@ -182,7 +182,7 @@
v-if="item.columnType == 'selection'"
type="selection"
:width="item.width"
:selectable="executeFuc"></el-table-column>
:selectable="(row,number) => executeFuc(row,'3',item.clickFuc)"></el-table-column>
<el-table-column
v-if="item.columnType == 'radio' && executeEval(row,item.expression,true)"
@ -207,7 +207,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<span :style="{color: executeFuc(scope.row,null,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{ item.lableRuleObj[scope.row[item.columnName]] }}</span>
<span :style="{color: executeFuc(scope.row,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{ item.lableRuleObj[scope.row[item.columnName]] }}</span>
</template>
</el-table-column>
<el-table-column
@ -220,7 +220,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<el-tag :type="executeFuc(scope.row,null,'4',item,item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName])">
<el-tag :type="executeFuc(scope.row,'4',item,item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName])">
<span>{{ item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName] }}</span>
</el-tag>
</template>
@ -241,7 +241,7 @@
:key="buttonItem"
v-if="executeEval(scope.row,buttonItem.hasPermi,true)"
:disabled="executeEval(scope.row,buttonItem.disabledFuc,false)"
@click.native.stop="executeFuc(scope.row,null,'1',buttonItem.clickFuc)"
@click.native.stop="executeFuc(scope.row,'1',buttonItem.clickFuc)"
>{{ buttonItem.name }}
</el-button>
</template>
@ -256,7 +256,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<span :style="{color: executeFuc(scope.row,null,'4',item,scope.row[item.columnName])}">{{ scope.row[item.columnName] }}</span>
<span :style="{color: executeFuc(scope.row,'4',item,scope.row[item.columnName])}">{{ scope.row[item.columnName] }}</span>
</template>
</el-table-column>
@ -837,8 +837,8 @@ export default {
_this.options.findMethod = []
});
},
executeFuc(row,number,type,clickFuc,value){
return executeFuc(this,row,number,type,clickFuc,value);
executeFuc(row,type,clickFuc,value){
return executeFuc(this,row,type,clickFuc,value);
},
executeEval(row,expression,defaultRet){
if(expression){

@ -50,7 +50,7 @@
v-model="filterQuery[item.columnName]"
:placeholder="item.columnDesc"
:disabled="executeEval(null,item.disabledFuc,false)"
@keyup.enter.native="executeFuc($event,null,'5',item.clickFuc)"
@keyup.enter.native="executeFuc($event,'5',item.clickFuc)"
clearable
></el-input>
</el-form-item>
@ -74,7 +74,7 @@
:disabled="executeEval(null,item.disabledFuc,false)"
filterable
remote
:remote-method="(query) => executeFuc(query, null,'6',item.clickFuc)"
:remote-method="(query) => executeFuc(query,'5',item.clickFuc)"
clearable>
<el-option
v-for="item in options[item.clickFuc]"
@ -304,7 +304,7 @@
style="width: 100%"
border
key="1"
@current-change="executeFuc"
@current-change="(row) => executeFuc(row,'0',tableObj.handleChangeFuc)"
>
<template v-for="(item, index) in tableHeader">
<el-table-column
@ -314,7 +314,7 @@
v-if="item.columnType == 'selection'"
type="selection"
:width="item.width"
:selectable="executeFuc"></el-table-column>
:selectable="(row,number) => executeFuc(row,'3',item.clickFuc)"></el-table-column>
<el-table-column
v-if="item.columnType == 'radio' && executeEval(row,item.expression,true)"
@ -339,7 +339,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<span :style="{color: executeFuc(scope.row,null,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{ item.lableRuleObj[scope.row[item.columnName]] }}</span>
<span :style="{color: executeFuc(scope.row,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{ item.lableRuleObj[scope.row[item.columnName]] }}</span>
</template>
</el-table-column>
<el-table-column
@ -352,7 +352,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<el-tag :type="executeFuc(scope.row,null,'4',item,item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName])">
<el-tag :type="executeFuc(scope.row,'4',item,item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName])">
<span>{{ item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName] }}</span>
</el-tag>
</template>
@ -373,7 +373,7 @@
:key="buttonItem"
v-if="executeEval(scope.row,buttonItem.hasPermi,true)"
:disabled="executeEval(scope.row,buttonItem.disabledFuc,false)"
@click.native.stop="executeFuc(scope.row,null,'1',buttonItem.clickFuc)"
@click.native.stop="executeFuc(scope.row,'1',buttonItem.clickFuc)"
>{{ buttonItem.name }}
</el-button>
</template>
@ -388,7 +388,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<span :style="{color: executeFuc(scope.row,null,'4',item,scope.row[item.columnName])}">{{ scope.row[item.columnName] }}</span>
<span :style="{color: executeFuc(scope.row,'4',item,scope.row[item.columnName])}">{{ scope.row[item.columnName] }}</span>
</template>
</el-table-column>
@ -2395,8 +2395,8 @@ export default {
this.loading = false;
});
},
executeFuc(row,number,type,clickFuc,value){
return executeFuc(this,row,number,type,clickFuc,value);
executeFuc(row,type,clickFuc,value){
return executeFuc(this,row,type,clickFuc,value);
},
executeEval(row,expression,defaultRet){
if(expression){

@ -74,7 +74,7 @@
v-model="filterQuery[item.columnName]"
:placeholder="item.columnDesc"
:disabled="executeEval(null,item.disabledFuc,false)"
@keyup.enter.native="executeFuc($event,null,'5',item.clickFuc)"
@keyup.enter.native="executeFuc($event,'5',item.clickFuc)"
clearable
></el-input>
</el-form-item>
@ -98,7 +98,7 @@
:disabled="executeEval(null,item.disabledFuc,false)"
filterable
remote
:remote-method="(query) => executeFuc(query, null,'6',item.clickFuc)"
:remote-method="(query) => executeFuc(query,'5',item.clickFuc)"
clearable>
<el-option
v-for="item in options[item.clickFuc]"
@ -309,7 +309,7 @@
v-if="item.columnType == 'selection'"
type="selection"
:width="item.width"
:selectable="executeFuc"></el-table-column>
:selectable="(row,number) => executeFuc(row,'3',item.clickFuc)"></el-table-column>
<el-table-column
v-if="item.columnType == 'radio' && executeEval(row,item.expression,true)"
@ -334,7 +334,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<span :style="{color: executeFuc(scope.row,null,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{ item.lableRuleObj[scope.row[item.columnName]] }}</span>
<span :style="{color: executeFuc(scope.row,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{ item.lableRuleObj[scope.row[item.columnName]] }}</span>
</template>
</el-table-column>
<el-table-column
@ -347,7 +347,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<el-tag :type="executeFuc(scope.row,null,'4',item,item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName])">
<el-tag :type="executeFuc(scope.row,'4',item,item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName])">
<span>{{ item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName] }}</span>
</el-tag>
</template>
@ -368,7 +368,7 @@
:key="buttonItem"
v-if="executeEval(scope.row,buttonItem.hasPermi,true)"
:disabled="executeEval(scope.row,buttonItem.disabledFuc,false)"
@click.native.stop="executeFuc(scope.row,null,'1',buttonItem.clickFuc)"
@click.native.stop="executeFuc(scope.row,'1',buttonItem.clickFuc)"
>{{ buttonItem.name }}
</el-button>
</template>
@ -383,7 +383,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<span :style="{color: executeFuc(scope.row,null,'4',item,scope.row[item.columnName])}">{{ scope.row[item.columnName] }}</span>
<span :style="{color: executeFuc(scope.row,'4',item,scope.row[item.columnName])}">{{ scope.row[item.columnName] }}</span>
</template>
</el-table-column>
@ -1526,7 +1526,7 @@ import {thirdSysDetail} from "@/api/basic/product/udiRelevance";
import {finProductSet} from "@/api/param/systemParamConfig";
import selectUdiVersion from './UdiinfoSelectVersion'
import {
getHead,executeFuc,executeEval
getHead,executeFuc
} from "@/utils/customConfig";
export default {
@ -1932,8 +1932,8 @@ export default {
this.detailList = [];
});
},
executeFuc(row,number,type,clickFuc,value){
return executeFuc(this,row,number,type,clickFuc,value);
executeFuc(row,type,clickFuc,value){
return executeFuc(this,row,type,clickFuc,value);
},
executeEval(row,expression,defaultRet){
if(expression){

@ -9,7 +9,7 @@
v-model="filterQuery[item.columnName]"
:placeholder="item.columnDesc"
:disabled="executeEval(null,item.disabledFuc,false)"
@keyup.enter.native="executeFuc($event,null,'5',item.clickFuc)"
@keyup.enter.native="executeFuc($event,'5',item.clickFuc)"
clearable
></el-input>
</el-form-item>
@ -33,7 +33,7 @@
:disabled="executeEval(null,item.disabledFuc,false)"
filterable
remote
:remote-method="(query) => executeFuc(query, null,'6',item.clickFuc)"
:remote-method="(query) => executeFuc(query,'5',item.clickFuc)"
clearable>
<el-option
v-for="item in options[item.clickFuc]"
@ -174,7 +174,7 @@
v-if="item.columnType == 'selection'"
type="selection"
:width="item.width"
:selectable="executeFuc"></el-table-column>
:selectable="(row,number) => executeFuc(row,'3',item.clickFuc)"></el-table-column>
<el-table-column
v-if="item.columnType == 'radio' && executeEval(row,item.expression,true)"
@ -199,7 +199,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<span :style="{color: executeFuc(scope.row,null,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{ item.lableRuleObj[scope.row[item.columnName]] }}</span>
<span :style="{color: executeFuc(scope.row,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{ item.lableRuleObj[scope.row[item.columnName]] }}</span>
</template>
</el-table-column>
<el-table-column
@ -212,7 +212,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<el-tag :type="executeFuc(scope.row,null,'4',item,item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName])">
<el-tag :type="executeFuc(scope.row,'4',item,item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName])">
<span>{{ item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName] }}</span>
</el-tag>
</template>
@ -233,7 +233,7 @@
:key="buttonItem"
v-if="executeEval(scope.row,buttonItem.hasPermi,true)"
:disabled="executeEval(scope.row,buttonItem.disabledFuc,false)"
@click.native.stop="executeFuc(scope.row,null,'1',buttonItem.clickFuc)"
@click.native.stop="executeFuc(scope.row,'1',buttonItem.clickFuc)"
>{{ buttonItem.name }}
</el-button>
</template>
@ -248,7 +248,7 @@
:key="item.columnName"
>
<template slot-scope="scope">
<span :style="{color: executeFuc(scope.row,null,'4',item,scope.row[item.columnName])}">{{ scope.row[item.columnName] }}</span>
<span :style="{color: executeFuc(scope.row,'4',item,scope.row[item.columnName])}">{{ scope.row[item.columnName] }}</span>
</template>
</el-table-column>
@ -849,8 +849,8 @@ export default {
_this.options.findMethod = [];
});
},
executeFuc(row,number,type,clickFuc,value){
return executeFuc(this,row,number,type,clickFuc,value);
executeFuc(row,type,clickFuc,value){
return executeFuc(this,row,type,clickFuc,value);
},
executeEval(row,expression,defaultRet){
if(expression){

File diff suppressed because it is too large Load Diff

@ -45,7 +45,7 @@
<el-table-column prop="colorRule" show-overflow-tooltip="true" label="颜色规则"></el-table-column>
<el-table-column prop="buttonRule" show-overflow-tooltip="true" label="按钮规则"></el-table-column>
<el-table-column prop="clickFuc" label="点击事件"></el-table-column>
<el-table-column prop="expression" label="是否展示eval表达式"></el-table-column>
<el-table-column prop="hasPermi" label="是否展示eval表达式"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
@ -101,7 +101,7 @@
<el-option label="el-tag" value="eltag" />
<el-option label="按钮" value="button" />
<el-option label="默认" value="text" />
<el-option label="特殊" value="other" />
</el-select>
</el-form-item>
</el-col>
@ -218,15 +218,18 @@
<el-form-item label-width="50px" label="名称" :prop="'buttonList.' + i + '.name'">
<el-input type="input" style="width: 120px;" v-model="item.name" placeholder="请输入名称"></el-input>
</el-form-item>
<el-form-item label-width="50px" label="样式" :prop="'buttonList.' + i + '.style'">
<el-input type="input" style="width: 120px;" v-model="item.style" placeholder="请输入样式"></el-input>
</el-form-item>
<!-- <el-form-item label-width="50px" label="样式" :prop="'buttonList.' + i + '.style'">-->
<!-- <el-input type="input" style="width: 120px;" v-model="item.style" placeholder="请输入样式"></el-input>-->
<!-- </el-form-item>-->
<el-form-item label-width="70px" label="禁用eval表达式" :prop="'buttonList.' + i + '.disabledFuc'">
<el-input type="input" style="width: 120px;" v-model="item.disabledFuc" placeholder="请输入禁用eval表达式"></el-input>
</el-form-item>
<el-form-item label-width="70px" label="点击方法" :prop="'buttonList.' + i + '.clickFuc'">
<el-input type="input" style="width: 120px;" v-model="item.clickFuc" placeholder="请输入点击方法"></el-input>
</el-form-item>
<el-form-item label-width="70px" label="是否展示eval表达式" :prop="'buttonList.' + i + '.hasPermi'">
<el-input type="input" style="width: 120px;" v-model="item.hasPermi" placeholder="请输入是否展示eval表达式"></el-input>
</el-form-item>
<i v-if="i === 0" @click="addButtonList" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-circle-plus"></i>
<i @click="deleteButtonList(i)" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-remove"></i>
</div>
@ -245,8 +248,8 @@
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="是否展示eval表达式" prop="expression" class="query-form-item">
<el-input v-model="subData.expression" style="width: 80%" placeholder="请输入是否展示eval表达式"
<el-form-item label="是否展示eval表达式" prop="hasPermi" class="query-form-item">
<el-input v-model="subData.hasPermi" style="width: 80%" placeholder="请输入是否展示eval表达式"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
@ -316,7 +319,8 @@
size: '',
style: '',
name: '',
clickFuc: ''
clickFuc: '',
hasPermi:'',
}]
},
formVisible: false,
@ -348,6 +352,7 @@
"eltag":"el-tag",
"button":"按钮",
"text":"默认",
"other":"特殊",
},
isShowMap: {
"1": "显示",
@ -442,7 +447,7 @@
this.conditionForm.lableList = lableList;
const buttonRule = this.subData.buttonRule;
var buttonList = [{type: '', size: '', style: '', name: '', clickFuc: '', disabledFuc: ''}]
var buttonList = [{type: '', size: '', style: '', name: '', clickFuc: '', disabledFuc: '', hasPermi: ''}]
if(buttonRule){
var jsonArr = JSON.parse(buttonRule);
var buttonList = []
@ -453,7 +458,8 @@
style: obj.style,
name: obj.name,
clickFuc: obj.clickFuc,
disabledFuc: obj.disabledFuc
disabledFuc: obj.disabledFuc,
hasPermi:obj.hasPermi
})
})
}
@ -540,7 +546,8 @@
style: obj.style,
name: obj.name,
clickFuc: obj.clickFuc,
disabledFuc: obj.disabledFuc
disabledFuc: obj.disabledFuc,
hasPermi:obj.hasPermi
})
}
})

Loading…
Cancel
Save