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 | 99 +++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 90 insertions(+), 9 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index 6890210..e195f6b 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -248,6 +248,7 @@ item.hidden = item.Hide === 'true' item.required = !item.hidden && item.required === 'true' item.advanced = item.advanced === 'true' + item.$forbid = item.query === 'false' if (item.type === 'date') { // 鏃堕棿鎼滅储 item.initval = item.initval ? moment().subtract(item.initval, 'days').format('YYYY-MM-DD') : '' @@ -356,7 +357,8 @@ type: cell.type, label: cell.label, value: cell.initval, - required: cell.required + required: cell.required, + forbid: cell.$forbid } if (cell.type === 'multiselect' || (cell.type === 'checkcard' && cell.multiple === 'true')) { @@ -705,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) @@ -733,9 +737,11 @@ arrfield = arrfield.join(',') if (item.orderBy) { - sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} ) a order by orderfield ${item.orderType}` + // sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} ) a order by orderfield ${item.orderType}` + sql = `select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} order by orderfield ${item.orderType}` } else { - sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield} from ${_datasource}) a` + // sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield} from ${_datasource}) a` + sql = `select distinct ${arrfield} from ${_datasource}` } if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 @@ -1358,7 +1364,7 @@ }) // 闇�瑕佸0鏄庣殑鍙橀噺闆� - let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'login_city'] + let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'login_city', 'bid'] // 涓婚敭瀛楁 let primaryKey = setting.primaryKey || 'id' @@ -1379,7 +1385,7 @@ if (!_initvars.includes(_key)) { _initvars.push(_key) - if (form.type === 'number') { + if (form.type === 'number' || form.type === 'rate') { let val = form.value if (typeof(val) !== 'number') { val = parseFloat(val) @@ -1388,6 +1394,8 @@ } } _initFormfields.push(`@${_key}=${val}`) + } else if (['date', 'datemonth', 'datetime'].includes(form.type)) { + _initFormfields.push(`@${_key}='${form.value || '1900-01-01'}'`) } else { _initFormfields.push(`@${_key}='${form.value}'`) } @@ -1406,6 +1414,8 @@ _type = 'datetime' } else if (form.type === 'number') { _type = `decimal(18,${form.fieldlen})` + } else if (form.type === 'rate') { + _type = `decimal(18,2)` } _declarefields.push(`@${_key} ${_type}`) @@ -1480,7 +1490,7 @@ _declarefields = ',' + _declarefields } _sql = `/* 绯荤粺鐢熸垚 */ - Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@login_city nvarchar(50),@ModularDetailCode nvarchar(50)${_declarefields} + Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@login_city nvarchar(50),@bid nvarchar(50),@ModularDetailCode nvarchar(50)${_declarefields} ` // 琛ㄥ崟鍙橀噺璧嬪�� @@ -2032,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 () { @@ -2251,6 +2330,8 @@ type = 'datetime=null' } else if (item.type === 'number') { type = `decimal(18,${item.decimal})=0` + } else if (item.type === 'rate') { + type = `decimal(18,2)=0` } else { type = 'nvarchar(50)=\'\'' } -- Gitblit v1.8.0