You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.6 KiB
JavaScript
101 lines
2.6 KiB
JavaScript
import {getConfigs} from "@/api/system/sysCustomConfig";
|
|
import {Message} from "element-ui";
|
|
function getColer(item,value){
|
|
const colorRule = item.colorRule;
|
|
if(colorRule && colorRule.indexOf(",") != -1){
|
|
var arr = colorRule.split("|");
|
|
var reColor = "";
|
|
arr.some(s => {
|
|
var arrTemp = s.split(",");
|
|
const type = arrTemp[0]
|
|
const valueT = arrTemp[1]
|
|
const color = arrTemp[2]
|
|
if(type == "=" && value == valueT){
|
|
reColor = color;
|
|
}else if(type == ">=" && value >= valueT){
|
|
reColor = color;
|
|
}else if(type == ">" && value > valueT){
|
|
reColor = color;
|
|
}else if(type == "<" && value < valueT){
|
|
reColor = color;
|
|
}else if(type == "<=" && value <= valueT){
|
|
reColor = color;
|
|
} else if(type == "0"){
|
|
reColor = color;
|
|
}
|
|
})
|
|
return reColor;
|
|
}else{
|
|
return colorRule;
|
|
}
|
|
}
|
|
|
|
|
|
export async function getHead(businessType,type){
|
|
try {
|
|
var subData = {};
|
|
subData.businessType = businessType;
|
|
subData.type = type;
|
|
const re = await getConfigs(subData);
|
|
if(re.code != 20000){
|
|
Message.error("获取配置失败");
|
|
}
|
|
return re;
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
}
|
|
|
|
|
|
export function executeFuc(_this,row,type,clickFuc,obj){
|
|
// 0 列表点击事件 1 列表页按钮事件 2 编辑页表单事件 3 列表页复选框事件 4列表页颜色方法 5列表查询框方法
|
|
if("1" == type){
|
|
//列表页按钮事件
|
|
return callModelFun(_this,clickFuc,row);
|
|
}else if("4" == type){
|
|
//列表页颜色方法
|
|
if(clickFuc) {
|
|
return getColer(clickFuc, obj);
|
|
}
|
|
}else if("5" == type){
|
|
//列表查询条件查询input方法
|
|
if(clickFuc){
|
|
return callModelFun(_this,clickFuc,row);
|
|
}else{
|
|
return false;
|
|
}
|
|
}else if("2" == type){
|
|
if(clickFuc){
|
|
//编辑页表单事件
|
|
return callModelFun(_this,clickFuc,row);
|
|
}else{
|
|
return true;
|
|
}
|
|
}else if("3" == type){
|
|
//列表页复选框事件
|
|
if(clickFuc){
|
|
return callModelFun(_this,clickFuc,row);
|
|
}else{
|
|
return true;
|
|
}
|
|
}else if("0" == type){
|
|
//表单点击事件
|
|
if(clickFuc){
|
|
return callModelFun(_this,clickFuc,row);
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 根据方法名称调用方法
|
|
*/
|
|
function callModelFun(_this,funcName,row) {
|
|
let methods = _this.$options.methods;
|
|
// 解释说明一下, this需要传入目标方法, 否则,在目标方法中修改data中的值, 将不会重新渲染dom, 跟v-if结合使用的过程中需要注意
|
|
return methods[funcName](_this,row);
|
|
}
|
|
|
|
|