linkmore-design
Version:
🌈 🚀lm组件库。🚀
145 lines • 3.39 kB
JavaScript
// 关系组中的每一项Props
// type类型
var operatorType; // 关系组Props
(function (operatorType) {
operatorType[operatorType["input"] = 0] = "input";
operatorType[operatorType["enum"] = 1] = "enum";
operatorType[operatorType["select"] = 2] = "select";
operatorType[operatorType["checkbox"] = 3] = "checkbox";
operatorType[operatorType["cascader"] = 4] = "cascader";
operatorType[operatorType["date"] = 5] = "date";
operatorType[operatorType["range"] = 6] = "range";
operatorType[operatorType["number"] = 7] = "number";
operatorType[operatorType["code"] = 8] = "code";
})(operatorType || (operatorType = {}));
export var getOpetatorGroup = function getOpetatorGroup(locale, fieldValueSource, fieldValueType) {
var isContains = fieldValueType === 'string' && fieldValueSource !== 4;
var contains = isContains ? 'contains' : 'in';
var notContains = isContains ? 'not_contains' : 'not_in';
var enumOptions = [{
label: locale.equal,
value: 'equal'
}, {
label: locale.notEqual,
value: 'not_equal'
}, {
label: locale.contains,
value: contains
}, {
label: locale.notContains,
value: notContains
}, {
label: locale.empty,
value: 'empty'
}, {
label: locale.notEmpty,
value: 'not_empty'
}];
var dateOptions = [{
label: locale.equal,
value: 'equal'
}, {
label: locale.notEqual,
value: 'not_equal'
}, {
label: locale.lessThan,
value: 'less_than'
}, {
label: locale.greaterThan,
value: 'greater_than'
}, {
label: locale.between,
value: 'between'
}, {
label: locale.empty,
value: 'empty'
}, {
label: locale.notEmpty,
value: 'not_empty'
}];
return {
// 名称类型
input: [{
label: locale.equal,
value: 'equal'
}, {
label: locale.notEqual,
value: 'not_equal'
}, {
label: locale.contains,
value: contains
}, {
label: locale.notContains,
value: notContains
}, {
label: locale.empty,
value: 'empty'
}, {
label: locale.notEmpty,
value: 'not_empty'
}],
// 枚举类型
enum: enumOptions,
select: enumOptions,
checkbox: enumOptions,
cascader: enumOptions,
// 日期类型
date: dateOptions,
range: dateOptions,
// 金额类型
number: [{
label: '=',
value: 'equal'
}, {
label: '≠',
value: 'not_equal'
}, {
label: '>',
value: 'greater_than'
}, {
label: '≧',
value: 'greater_than_or_equal'
}, {
label: '<',
value: 'less_than'
}, {
label: '≦',
value: 'less_than_or_equal'
}, {
label: locale.empty,
value: 'empty'
}, {
label: locale.notEmpty,
value: 'not_empty'
}],
// 单号类型
code: [{
label: locale.equal,
value: 'equal'
}, {
label: locale.notEqual,
value: 'not_equal'
}, {
label: locale.startsWith,
value: 'starts_with'
}, {
label: locale.endsWith,
value: 'ends_with'
}, {
label: locale.contains,
value: contains
}, {
label: locale.notContains,
value: notContains
}, {
label: locale.empty,
value: 'empty'
}, {
label: locale.notEmpty,
value: 'not_empty'
}]
};
};
export default {
getOpetatorGroup: getOpetatorGroup
};