From d59f518f466274b2caeb2e01c10c92deafe7c93b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 09 二月 2022 11:48:29 +0800 Subject: [PATCH] 2022-02-09 --- src/utils/utils.js | 77 +++++++++++++++++++++++++++++++++++++- 1 files changed, 74 insertions(+), 3 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index c777212..e195f6b 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -707,14 +707,16 @@ static getSelectQueryOptions (item) { let arrfield = [item.valueField, item.valueText] - if (item.type === 'link') { - arrfield.push(item.linkField) - } else if (item.type === 'checkcard') { + if (item.type === 'checkcard') { arrfield = item.fields.map(f => f.field) arrfield.push(item.cardValField) if (item.urlField) { arrfield.push(item.urlField) } + } + + if (item.linkField) { + arrfield.push(item.linkField) } if (['select', 'radio', 'link', 'checkcard'].includes(item.type) && item.linkSubField && item.linkSubField.length > 0) { arrfield.push(...item.linkSubField) @@ -2040,6 +2042,75 @@ } /** + * @description 鑾峰彇鏍囪淇℃伅 + */ +export function getMark (marks, record, style = {}) { + let icon = null + let color = null + let position = null + + marks.some(mark => { + let originVal = record[mark.field[0]] + '' + let contrastVal = '' + let result = false + + if (mark.field[1] === 'static') { + contrastVal = mark.contrastValue + '' + } else { + contrastVal = record[mark.field[2]] + '' + } + + if (mark.match === '=') { + result = originVal === contrastVal + } else if (mark.match === '!=') { + result = originVal !== contrastVal + } else if (mark.match === 'like') { + result = originVal.indexOf(contrastVal) > -1 + } else if (mark.match === '>') { + result = parseFloat(originVal) > parseFloat(contrastVal) + } else if (mark.match === '<') { + result = parseFloat(originVal) < parseFloat(contrastVal) + } + + if (!result) return false + + let type = mark.signType[0] + + if (type === 'font') { + style.color = mark.color + } else if (type === 'background') { + style.background = mark.color + if (mark.fontColor) { + style.color = mark.fontColor + } + } else if (type === 'underline') { + style.textDecoration = 'underline' + style.color = mark.color + } else if (type === 'line-through') { + style.textDecoration = 'line-through' + style.color = mark.color + } else if (type.indexOf('icon') > -1) { + icon = mark.signType[mark.signType.length - 1] + color = mark.color + if (type === 'iconfront' || mark.signType[1] === 'front') { + position = 'front' + } else { + position = 'back' + } + } + + return true + }) + + return { + style, + icon, + color, + position + } +} + +/** * @description 鐢熸垚鏇挎崲鍑芥暟鍒楄〃 */ export function setGLOBFuncs () { -- Gitblit v1.8.0