From ac1d52c46ff9019fcc93cf3d5e7ab17cf850824e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 10 八月 2023 16:05:24 +0800 Subject: [PATCH] 2023-08-10 --- src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 390 ++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 298 insertions(+), 92 deletions(-) diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index c345c81..c9f7736 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -1,8 +1,3 @@ -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' - -const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS - /** * @description 鑾峰彇鏄剧ず鍒楄〃鍗曢厤缃俊鎭� * @param {object} card // 鎼滅储鏉′欢瀵硅薄 @@ -19,25 +14,28 @@ roleList = [] } - if (['picture', 'link', 'colspan'].includes(card.type)) { + if (['picture', 'link'].includes(card.type)) { card.type = 'text' } let options = [{ value: 'text', - text: Formdict['model.form.text'] + text: '鏂囨湰' }, { value: 'number', - text: Formdict['model.form.number'] + text: '鏁板瓧' }, { value: 'textarea', - text: Formdict['model.form.textarea'] + text: '澶氳鏂囨湰' }, { value: 'custom', text: '鑷畾涔夊垪' }, { - value: 'action', - text: '鎿嶄綔' + value: 'colspan', + text: '鍚堝苟鍒�' + }, { + value: 'formula', + text: '鍏紡' }, { value: 'index', text: '搴忓彿' @@ -45,17 +43,42 @@ let editCols = [ { + field: '$sub', + label: '鎻愪氦' + }, + { field: '$next', label: '涓嬩竴琛�' + }, + { + field: '$noAct', + label: '鏃犲姩浣�' } ] - columns.forEach(col => { - if (col.editable === 'true' && col.uuid !== card.uuid) { - editCols.push({ - field: col.uuid, - label: col.label - }) - } + + let cols = [] + let getcols = (columns, suplabel = '') => { + columns.forEach(col => { + if (col.editable === 'true' && col.uuid !== card.uuid) { + cols.push({ + field: col.uuid, + label: suplabel + col.label + }) + } else if (col.type === 'colspan') { + getcols(col.subcols, col.label + '-') + } + }) + } + + getcols(columns) + + editCols.push(...cols) + + cols.forEach(col => { + editCols.push({ + field: '$next_' + col.field, + label: col.label + '锛堜笅涓�琛岋級' + }) }) return [ @@ -69,7 +92,7 @@ { type: 'select', key: 'type', - label: Formdict['model.form.type'], + label: '绫诲瀷', initVal: card.type, required: true, options: options @@ -77,7 +100,7 @@ { type: 'select', key: 'field', - label: Formdict['model.form.field'], + label: '瀛楁', initVal: card.field, required: true, options: fields @@ -87,70 +110,72 @@ key: 'Width', min: 20, max: 1000, - decimal: 0, - label: Formdict['model.form.columnWidth'], + precision: 0, + label: '鍒楀', initVal: card.Width || 120, required: true }, { type: 'radio', key: 'Hide', - label: Formdict['model.hidden'], + label: '闅愯棌', initVal: card.Hide || 'false', required: true, options: [{ value: 'true', - text: Formdict['model.true'] + text: '鏄�' }, { value: 'false', - text: Formdict['model.false'] + text: '鍚�' }] }, { type: 'radio', key: 'IsSort', - label: Formdict['model.sort'], - initVal: card.IsSort || 'false', + label: '鎺掑簭', + initVal: card.IsSort || (card.isSub ? 'false' : 'true'), required: true, - forbidden: card.isSub, options: [{ value: 'true', - text: Formdict['model.true'] + text: '鏄�' }, { value: 'false', - text: Formdict['model.false'] + text: '鍚�' + }] + }, + { + type: 'radio', + key: 'eval', + label: '瑙f瀽鏂瑰紡', + initVal: card.eval || 'false', + tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滆绠椻�濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃瓧娈垫浛鎹⑩�濓紝浣跨敤鍑芥暟鏃跺叆鍙備负data锛堟暟缁勶級銆�', + required: false, + options: [{ + value: 'false', + text: '瀛楁鏇挎崲' + }, { + value: 'true', + text: '璁$畻' + }, { + value: 'func', + text: '鍑芥暟' }] }, { type: 'radio', key: 'Align', - label: Formdict['model.form.align'], + label: '瀵归綈鏂瑰紡', initVal: card.Align || 'left', required: true, options: [{ value: 'left', - text: Formdict['model.form.alignLeft'] + text: '宸﹀榻�' }, { value: 'center', - text: Formdict['model.form.alignCenter'] + text: '灞呬腑' }, { value: 'right', - text: Formdict['model.form.alignRight'] - }] - }, - { - type: 'radio', - key: 'sum', - label: '鏄剧ず鍚堣', - initVal: card.sum || 'false', - tooltip: '鍚堣淇℃伅鍙湪浣跨敤绯荤粺鏁版嵁婧愭椂鏈夋晥銆�', - required: false, - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] + text: '鍙冲榻�' }] }, { @@ -169,6 +194,144 @@ }, { type: 'radio', + key: 'editType', + label: '缂栬緫绫诲瀷', + initVal: card.editType || 'text', + required: true, + options: [{ + value: 'text', + text: '鏂囨湰' + }, { + value: 'select', + text: '涓嬫媺' + }, { + value: 'switch', + text: '寮�鍏�' + }] + }, + { + type: 'text', + key: 'initval', + label: '榛樿鍊�', + initVal: card.initval, + tooltip: '浣跨敤$copy鏃讹紝琛ㄧず鏂板鏃跺鍒朵笂涓�琛屼俊鎭��', + required: false + }, + { + type: 'text', + key: 'openVal', + label: '寮�鍚��', + initVal: card.openVal || '', + required: false + }, + { + type: 'text', + key: 'closeVal', + label: '鍏抽棴鍊�', + initVal: card.closeVal || '', + required: false + }, + { + type: 'text', + key: 'openText', + label: '寮�鍚彁绀�', + initVal: card.openText || '', + required: false + }, + { + type: 'text', + key: 'closeText', + label: '鍏抽棴鎻愮ず', + initVal: card.closeText || '', + required: false + }, + { + type: 'radio', + key: 'resourceType', + label: '閫夐」鏉ユ簮', + initVal: card.resourceType || '0', + required: true, + options: [{ + value: '0', + text: '鑷畾涔�' + }, { + value: '1', + text: '鏁版嵁婧�' + }] + }, + { + type: 'options', + key: 'options', + label: '閫夐」', + initVal: card.options || [], + required: true, + }, + { + type: 'codemirror', + key: 'dataSource', + label: '鏁版嵁婧�', + initVal: card.dataSource || '', + placeholder: '绯荤粺鍙橀噺锛歮k_departmentcode銆乵k_organization銆乵k_user_type銆�', + required: true, + }, + { + type: 'text', + key: 'valueField', + label: '鍊悸峰瓧娈�', + initVal: card.valueField || '', + required: true, + }, + { + type: 'text', + key: 'valueText', + label: '鏂囨湰路瀛楁', + initVal: card.valueText || '', + required: true, + }, + { + type: 'text', + key: 'orderBy', + label: '鎺掑簭路瀛楁', + initVal: card.orderBy || '', + required: false, + }, + { + type: 'select', + key: 'orderType', + label: '鎺掑簭鏂瑰紡', + initVal: card.orderType || 'asc', + options: [{ + value: 'asc', + text: '姝e簭' + }, { + value: 'desc', + text: '鍊掑簭' + }] + }, + { + type: 'text', + key: 'disableField', + label: '绂佺敤路瀛楁', + initVal: card.disableField || '', + tooltip: '璁剧疆绂佺敤瀛楁锛屼笖瀛楁鍊间负true鏃讹紝閫夐」涓嶅彲閫夈��', + required: false, + }, + { + type: 'radio', + key: 'dropdown', + label: '涓嬫媺瀹藉害', + initVal: card.dropdown || 'flex', + required: false, + options: [{ + value: 'flex', + text: '鑷�傚簲' + }, { + value: 'fixed', + text: '瀹氬' + }] + }, + { + type: 'radio', key: 'required', label: '蹇呭~', initVal: card.required || 'false', @@ -182,53 +345,52 @@ }] }, { - type: 'text', - key: 'initval', - label: '榛樿鍊�', - initVal: card.initval, - tooltip: '浣跨敤$copy鏃讹紝琛ㄧず鏂板鏃跺鍒朵笂涓�琛屼俊鎭��', - required: false + type: 'radio', + key: 'database', + label: '鏁版嵁搴�', + initVal: card.database || 'local', + options: [{ + value: 'local', + text: '鏈湴' + }, { + value: 'sso', + text: '绯荤粺' + }] }, { type: 'select', key: 'enter', label: '鍥炶溅鍒囨崲', - initVal: card.enter || '$next', + initVal: card.enter || '$noAct', + tooltip: '鍖呮嫭鏂囨湰鎴栨暟鍊煎洖杞︿簨浠躲�佷笅鎷夎彍鍗曢�変腑浜嬩欢銆佸紑鍏冲垏鎹簨浠躲��', options: editCols }, { - type: 'radio', - key: 'footEnter', - label: '鏈鍥炶溅', - initVal: card.footEnter || 'false', - tooltip: '鏂板鍔熻兘浠呭湪琛ㄦ牸鍙柊澧炴椂鏈夋晥銆�', - options: [{ - value: 'sub', - text: '鎻愪氦' - }, { - value: 'add', - text: '鏂板' - }, { - value: 'false', - text: '鏃犲姩浣�' - }] + type: 'select', + key: 'ctrlField', + label: '绂佺敤瀛楁', + initVal: card.ctrlField || '', + tooltip: '鎺у埗鍗曞厓鏍兼槸鍚﹀彲浠ョ紪杈戙��', + allowClear: true, + required: false, + options: fields + }, + { + type: 'text', + key: 'ctrlValue', + label: '绂佺敤鍊�', + initVal: card.ctrlValue || '', + tooltip: '澶氫釜鍊肩敤閫楀彿鍒嗛殧銆�', + required: false }, { type: 'number', key: 'decimal', min: 0, max: 18, - decimal: 0, - label: Formdict['header.form.decimal'], - initVal: card.decimal || 0, - required: true - }, - { - type: 'number', - key: 'max', - label: '鏈�澶у��', - initVal: card.max, - unlimit: true, + precision: 0, + label: '灏忔暟浣�', + initVal: card.decimal, required: false }, { @@ -240,30 +402,44 @@ required: false }, { + type: 'number', + key: 'max', + label: '鏈�澶у��', + initVal: card.max, + unlimit: true, + required: false + }, + { type: 'select', key: 'format', - label: Formdict['header.form.format'], + label: '鏍煎紡鍖�', initVal: card.format || 'none', options: [{ value: 'none', - text: Formdict['model.empty'] + text: '鏃�' }, { value: 'thdSeparator', - text: Formdict['header.form.thdSeparator'] + text: '鍗冨垎浣�' }, { value: 'percent', text: '鐧惧垎姣�' + }, { + value: 'abs', + text: '缁濆鍊�' }], required: false }, { type: 'select', key: 'textFormat', - label: Formdict['header.form.format'], + label: '鏍煎紡鍖�', initVal: card.textFormat || 'none', options: [{ value: 'none', - text: Formdict['model.empty'] + text: '鏃�' + }, { + value: 'encryption', + text: '鍔犲瘑' }, { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' @@ -276,23 +452,53 @@ { type: 'text', key: 'prefix', - label: Formdict['header.form.prefix'], + label: '鍓嶇紑', initVal: card.prefix || '', required: false, - readonly: false }, { type: 'text', key: 'postfix', - label: Formdict['header.form.postfix'], + label: '鍚庣紑', initVal: card.postfix || '', required: false, - readonly: false + }, + { + type: 'textarea', + key: 'formula', + label: '鍏紡', + initVal: card.formula || '', + tooltip: '鎵ц鏃朵細浣跨敤鏌ヨ鍒扮殑鏁版嵁鏇挎崲鐩稿簲鐨勫瓧娈碉紝灞曠ず鑾峰緱鐨勭粨鏋滐紝鍦ㄤ笉浣跨敤瑙f瀽鏃舵崲琛岀鎴栫┖鏍间細鏇挎崲涓洪〉闈㈠厓绱犮�傚彲浣跨敤JS鐨勪竴浜涜娉曪紝濡傦細涓夊厓琛ㄨ揪寮� @field1@ > @field2@ ? 0 : 1锛汳ath瀵硅薄锛屽彇缁濆鍊� Math.abs(@field@)銆佸洓鑸嶄簲鍏� Math.round(@field@)绛�', + placeholder: '渚嬪锛欯price@ * @number@', + required: true + }, + { + type: 'multiselect', + key: 'linkSubField', + label: '濉厖琛ㄥ崟', + tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婁俊鎭嚜鍔ㄥ~鍏ュ叧鑱旂殑瀛楁涓��', + initVal: card.linkSubField || [], + options: fields + }, + { + type: 'radio', + key: 'noValue', + label: '绌哄��', + initVal: card.noValue || 'show', + tooltip: '褰撳�间负0鏃舵槸鍚︽樉绀�', + required: false, + options: [{ + value: 'show', + text: '鏄剧ず' + }, { + value: 'hide', + text: '闅愯棌' + }] }, { type: 'multiselect', key: 'blacklist', - label: Formdict['header.form.blacklist'], + label: '榛戝悕鍗�', initVal: card.blacklist || [], required: false, options: roleList -- Gitblit v1.8.0