From c98e45bfac25e9110ad0383faac54a54d98ea9d5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 18 十一月 2021 20:47:04 +0800 Subject: [PATCH] 2021-11-18 --- src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 295 ++++++++++++++++++++++------------------------------------ 1 files changed, 113 insertions(+), 182 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 e2b4ae1..ff20115 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -7,8 +7,7 @@ * @description 鑾峰彇鏄剧ず鍒楄〃鍗曢厤缃俊鎭� * @param {object} card // 鎼滅储鏉′欢瀵硅薄 */ -export function getColumnForm (card, fields = []) { - let appType = sessionStorage.getItem('appType') +export function getColumnForm (card, fields = [], columns = []) { let roleList = sessionStorage.getItem('sysRoles') if (roleList) { try { @@ -20,22 +19,8 @@ roleList = [] } - let menulist = [] - - if (appType === 'pc') { - menulist = sessionStorage.getItem('appMenus') - } else if (!appType) { - menulist = sessionStorage.getItem('fstMenuList') - } - - if (menulist) { - try { - menulist = JSON.parse(menulist) - } catch (e) { - menulist = [] - } - } else { - menulist = [] + if (['picture', 'link', 'colspan'].includes(card.type)) { + card.type = 'text' } let options = [{ @@ -45,35 +30,36 @@ value: 'number', text: Formdict['model.form.number'] }, { - value: 'picture', - text: Formdict['model.form.picture'] - }, { - value: 'link', - text: Formdict['model.form.href'] - }, { value: 'textarea', text: Formdict['model.form.textarea'] }, { value: 'custom', text: '鑷畾涔夊垪' }, { - value: 'colspan', - text: '鍚堝苟鍒�' + value: 'action', + text: '鎿嶄綔' + }, { + value: 'formula', + text: '鍏紡' }, { value: 'index', text: '搴忓彿' }] - if (!card.isSub) { - options.push({ - value: 'action', - text: '鎿嶄綔' - }) - } - - if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { - card.perspective = '' - } + let editCols = [ + { + field: '$next', + label: '涓嬩竴琛�' + } + ] + columns.forEach(col => { + if (col.editable === 'true' && col.uuid !== card.uuid) { + editCols.push({ + field: col.uuid, + label: col.label + }) + } + }) return [ { @@ -100,14 +86,6 @@ options: fields }, { - type: 'select', - key: 'nameField', - label: Formdict['model.name'] + Formdict['model.form.field'], - initVal: card.nameField || '', - required: false, - options: [{uuid: 'empty', field: '', label: '绌�'}, ...fields] - }, - { type: 'number', key: 'Width', min: 20, @@ -116,20 +94,6 @@ label: Formdict['model.form.columnWidth'], initVal: card.Width || 120, required: true - }, - { - type: 'radio', - key: 'joint', - label: Formdict['model.form.paramJoint'], - initVal: card.joint || 'true', - required: true, - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] - }] }, { type: 'radio', @@ -149,7 +113,7 @@ type: 'radio', key: 'IsSort', label: Formdict['model.sort'], - initVal: card.IsSort || 'true', + initVal: card.IsSort || 'false', required: true, forbidden: card.isSub, options: [{ @@ -179,21 +143,6 @@ }, { type: 'radio', - key: 'rowspan', - label: '琛屽悎骞�', - initVal: card.rowspan || 'false', - tooltip: '鐩搁偦琛屼俊鎭浉鍚屾椂锛屽崟鍏冩牸鍚堝苟銆�', - required: false, - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] - }] - }, - { - type: 'radio', key: 'sum', label: '鏄剧ず鍚堣', initVal: card.sum || 'false', @@ -208,6 +157,66 @@ }] }, { + type: 'radio', + key: 'editable', + label: '鍙紪杈�', + initVal: card.editable || 'false', + required: true, + options: [{ + value: 'false', + text: '鍚�' + }, { + value: 'true', + text: '鏄�' + }] + }, + { + type: 'radio', + key: 'required', + label: '蹇呭~', + initVal: card.required || 'false', + required: false, + options: [{ + value: 'false', + text: '鍚�' + }, { + value: 'true', + text: '鏄�' + }] + }, + { + type: 'text', + key: 'initval', + label: '榛樿鍊�', + initVal: card.initval, + tooltip: '浣跨敤$copy鏃讹紝琛ㄧず鏂板鏃跺鍒朵笂涓�琛屼俊鎭��', + required: false + }, + { + type: 'select', + key: 'enter', + label: '鍥炶溅鍒囨崲', + initVal: card.enter || '$next', + options: editCols + }, + { + type: 'radio', + key: 'footEnter', + label: '鏈鍥炶溅', + initVal: card.footEnter || 'false', + tooltip: '鏂板鍔熻兘浠呭湪琛ㄦ牸鍙柊澧炴椂鏈夋晥銆�', + options: [{ + value: 'sub', + text: '鎻愪氦' + }, { + value: 'add', + text: '鏂板' + }, { + value: 'false', + text: '鏃犲姩浣�' + }] + }, + { type: 'number', key: 'decimal', min: 0, @@ -216,6 +225,22 @@ label: Formdict['header.form.decimal'], initVal: card.decimal || 0, required: true + }, + { + type: 'number', + key: 'max', + label: '鏈�澶у��', + initVal: card.max, + unlimit: true, + required: false + }, + { + type: 'number', + key: 'min', + label: '鏈�灏忓��', + initVal: card.min, + unlimit: true, + required: false }, { type: 'select', @@ -268,119 +293,25 @@ readonly: false }, { - type: 'select', - key: 'lenWidRadio', - label: '闀垮姣�', - initVal: card.lenWidRadio || '1:1', - required: true, + type: 'radio', + key: 'eval', + label: '瑙f瀽', + initVal: card.eval || 'true', + tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滄槸鈥濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃惁鈥濄��', + required: false, options: [ - { value: '1:1', text: '1:1' }, - { value: '4:3', text: '4:3' }, - { value: '3:2', text: '3:2' }, - { value: '16:9', text: '16:9' }, - { value: '2:1', text: '2:1' }, - { value: '3:1', text: '3:1' }, - { value: '4:1', text: '4:1' }, - { value: '5:1', text: '5:1' }, - { value: '6:1', text: '6:1' }, - { value: '7:1', text: '7:1' }, - { value: '8:1', text: '8:1' }, - { value: '9:1', text: '9:1' }, - { value: '10:1', text: '10:1' }, - { value: '3:4', text: '3:4' }, - { value: '2:3', text: '2:3' }, - { value: '9:16', text: '9:16' }, + { value: 'true', text: '鏄�' }, + { value: 'false', text: '鍚�' } ] - }, - { - type: 'radio', - key: 'picSort', - label: '鍥剧墖鎺掑垪', - initVal: card.picSort || '1', - tooltip: '鍚屼竴鍗曞厓鏍煎唴锛屽惈鏈夊寮犲浘鐗囨椂鐨勫垪鏁般��', - required: false, - options: [{ - value: '1', - text: '1' - }, { - value: '2', - text: '2' - }, { - value: '3', - text: '3' - }, { - value: '4', - text: '4' - }] - }, - { - type: 'radio', - key: 'scale', - label: Formdict['header.form.clickscale'], - initVal: card.scale || 'false', - required: false, - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] - }] - }, - { - type: 'radio', - key: 'perspective', - label: '瀛楁閫忚', - initVal: card.perspective || '', - options: [{ - value: '', - text: '鏃�' - }, { - value: 'linkmenu', - text: '鑿滃崟' - }, { - value: 'linkurl', - text: '閾炬帴' - }], - forbidden: appType === 'mob' - }, - { - type: appType === 'pc' ? 'select' : 'cascader', - key: 'linkmenu', - label: Formdict['model.menu'], - initVal: card.linkmenu || (appType === 'pc' ? '' : []), - required: true, - options: menulist, - forbidden: appType === 'mob' }, { type: 'textarea', - key: 'linkurl', - label: '閾炬帴鍦板潃', - initVal: card.linkurl || '', - required: true, - forbidden: appType === 'mob' - }, - { - type: 'multiselect', - key: 'linkfields', - label: '鍏宠仈瀛楁', - initVal: card.linkfields || [], - required: false, - options: fields, - forbidden: appType === 'mob' - }, - { - type: 'radio', - key: 'open', - label: '鎵撳紑鏂瑰紡', - initVal: card.open || 'blank', - required: false, - forbid: appType !== 'pc', - options: [ - { value: 'blank', text: '鏂扮獥鍙�' }, - { value: 'self', text: '褰撳墠绐楀彛' } - ] + key: 'formula', + label: '鍏紡', + initVal: card.formula || '', + tooltip: '鎵ц鏃朵細浣跨敤鏌ヨ鍒扮殑鏁版嵁鏇挎崲鐩稿簲鐨勫瓧娈碉紝灞曠ず鑾峰緱鐨勭粨鏋溿�傚彲浣跨敤JS鐨勪竴浜涜娉曪紝濡傦細涓夊厓琛ㄨ揪寮� @field1@ > @field2@ ? 0 : 1锛汳ath瀵硅薄锛屽彇缁濆鍊� Math.abs(@field@)銆佸洓鑸嶄簲鍏� Math.round(@field@)绛�', + placeholder: '渚嬪锛欯price@ * @number@', + required: true }, { type: 'multiselect', -- Gitblit v1.8.0