From f6a1ab6a58215cf7546976a86eb6face1a7be32f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 30 七月 2021 15:37:17 +0800 Subject: [PATCH] 2021-07-30 --- src/templates/zshare/formconfig.jsx | 346 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 284 insertions(+), 62 deletions(-) diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 1dd0495..54f99eb 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -288,6 +288,7 @@ */ export function getSearchForm (card, linkableFields) { let roleList = sessionStorage.getItem('sysRoles') + let appType = sessionStorage.getItem('appType') if (roleList) { try { roleList = JSON.parse(roleList) @@ -296,6 +297,71 @@ } } else { roleList = [] + } + + let typeOptions = [] + + if (appType === 'mob') { + typeOptions = [{ + value: 'range', + text: '鏁板�硷紙鍖洪棿锛�' + }, { + value: 'checkcard', + text: '閫夐」鍗�' + }, { + value: 'date', + text: Formdict['model.form.dateday'] + }, { + value: 'datemonth', + text: Formdict['model.form.datemonth'] + }, { + value: 'daterange', + text: Formdict['model.form.daterange'] + }] + } else { + typeOptions = [{ + value: 'text', + text: Formdict['model.form.text'] + }, { + value: 'select', + text: Formdict['model.form.select'] + }, { + value: 'multiselect', + text: Formdict['model.form.multiselect'] + }, { + value: 'link', + text: Formdict['model.form.link'] + }, { + value: 'checkcard', + text: '閫夐」鍗�' + }, { + value: 'date', + text: Formdict['model.form.dateday'] + }, { + value: 'dateweek', + text: Formdict['model.form.dateweek'] + }, { + value: 'datemonth', + text: Formdict['model.form.datemonth'] + }, { + value: 'daterange', + text: Formdict['model.form.daterange'] + }, { + value: 'group', + text: Formdict['model.form.dategroup'] + }] + } + + if (card.focus) { + if (['text', 'multiselect'].includes(card.type)) { + card.match = 'like' + } else if (['select', 'link', 'checkcard'].includes(card.type)) { + card.match = '=' + } else if (card.type === 'date') { + card.match = '>=' + } else if (['datemonth', 'dateweek', 'daterange', 'range'].includes(card.type)) { + card.match = 'between' + } } return [ @@ -322,34 +388,7 @@ label: Formdict['model.form.type'], initVal: card.type, required: true, - options: [{ - value: 'text', - text: Formdict['model.form.text'] - }, { - value: 'select', - text: Formdict['model.form.select'] - }, { - value: 'multiselect', - text: Formdict['model.form.multiselect'] - }, { - value: 'link', - text: Formdict['model.form.link'] - }, { - value: 'date', - text: Formdict['model.form.dateday'] - }, { - value: 'dateweek', - text: Formdict['model.form.dateweek'] - }, { - value: 'datemonth', - text: Formdict['model.form.datemonth'] - }, { - value: 'daterange', - text: Formdict['model.form.daterange'] - }, { - value: 'group', - text: Formdict['model.form.dategroup'] - }] + options: typeOptions }, { type: 'text', @@ -363,7 +402,7 @@ type: 'text', key: 'initval', label: Formdict['header.form.initval'], - tooltip: '绫诲瀷涓轰笅鎷夎彍鍗曟椂锛屽垵濮嬪�煎簲涓烘暟鎹殑Value鍊硷紙浣跨敤鏁版嵁婧愭椂锛屽簲涓恒�婂�悸峰瓧娈点�嬬殑鍊硷級', + tooltip: '绫诲瀷涓轰笅鎷夎彍鍗曟椂锛屽垵濮嬪�煎簲涓烘暟鎹殑Value鍊硷紙浣跨敤鏁版嵁婧愭椂锛屽簲涓恒�婂�悸峰瓧娈点�嬬殑鍊硷級;绫诲瀷涓烘暟鍊硷紙鍖洪棿锛夋椂锛屽垵濮嬪�间娇鐢ㄩ�楀彿鎷兼帴锛屼緥濡� 3,10', initVal: card.initval, required: false }, @@ -395,6 +434,75 @@ }] }, { + type: 'radio', + key: 'display', + label: '鏄剧ず', + initVal: card.display || 'text', + required: true, + options: [{ + value: 'text', + text: '鏂囨湰' + }, { + value: 'picture', + text: '鍥剧墖' + }] + }, + { + type: 'number', + key: 'width', + min: 1, + max: 24, + precision: 0, + label: '鍏冪礌瀹藉害', + initVal: card.width || 4, + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + required: true + }, + { + type: 'text', + key: 'cardValField', + label: Formdict['header.form.valueField'], + initVal: card.cardValField || 'Value', + required: true, + readonly: false + }, + { + type: 'text', + key: 'urlField', + label: '鍦板潃瀛楁', + initVal: card.urlField || '', + required: true, + readonly: false + }, + { + type: 'radio', + key: 'picratio', + label: '鍥剧墖姣斾緥', + initVal: card.picratio || '1:1', + required: true, + options: [{ + value: '1:1', + text: '1:1' + }, { + value: '3:2', + text: '3:2' + }, { + value: '4:3', + text: '4:3' + }, { + value: '16:9', + text: '16:9' + }] + }, + { + type: 'fields', + key: 'fields', + label: '瀛楁闆�', + initVal: card.fields || [], + required: true, + readonly: false + }, + { type: 'textarea', key: 'dataSource', label: Formdict['header.form.datasource'], @@ -405,7 +513,7 @@ { type: 'options', key: 'options', - label: '', + label: '閫夐」', initVal: card.options || [], required: true, readonly: false @@ -526,8 +634,23 @@ max: 24, label: Formdict['header.form.ratio'], tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', - initVal: card.ratio, + initVal: card.ratio || 6, + forbid: appType === 'mob', required: false + }, + { + type: 'radio', + key: 'multiple', + label: '鍙閫�', + initVal: card.multiple || 'false', + required: true, + options: [{ + value: 'true', + text: '鏄�' + }, { + value: 'false', + text: '鍚�' + }] }, { type: 'radio', @@ -555,19 +678,44 @@ text: Formdict['model.false'] }] }, + // { + // type: 'radio', + // key: 'transfer', + // label: '浼犻��', + // initVal: card.transfer || 'false', + // tooltip: '鏁版嵁鏌ヨ鏃讹紝绫诲瀷瀛楁鏄惁浣滀负鍙傛暟浼犻�掞紝绫诲瀷瀛楁瀵瑰簲鍊间负 {"鏃�": "day", "鍛�": "week", "鏈�": "month", "瀛�": "quarter", "骞�": "year", "鑷畾涔�": "customized"}銆�', + // options: [{ + // value: 'true', + // text: Formdict['model.true'] + // }, { + // value: 'false', + // text: Formdict['model.false'] + // }] + // }, { - type: 'radio', - key: 'transfer', - label: '浼犻��', - initVal: card.transfer || 'false', - tooltip: '鏁版嵁鏌ヨ鏃讹紝绫诲瀷瀛楁鏄惁浣滀负鍙傛暟浼犻�掞紝绫诲瀷瀛楁瀵瑰簲鍊间负 {"鏃�": "day", "鍛�": "week", "鏈�": "month", "瀛�": "quarter", "骞�": "year", "鑷畾涔�": "customized"}銆�', - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] - }] + type: 'number', + key: 'maxValue', + label: '鏈�澶у��', + initVal: card.maxValue, + forbid: appType !== 'mob', + required: true + }, + { + type: 'number', + key: 'minValue', + label: '鏈�灏忓��', + initVal: card.minValue, + forbid: appType !== 'mob', + required: true + }, + { + type: 'number', + key: 'step', + label: '姝ラ暱', + initVal: card.step, + tooltip: '姝ラ暱鍙栧�煎繀椤诲ぇ浜� 0锛屽苟涓斿彲琚� (max - min) 鏁撮櫎', + forbid: appType !== 'mob', + required: true }, { type: 'radio', @@ -587,6 +735,7 @@ key: 'advanced', label: '楂樼骇鎼滅储', initVal: card.advanced || 'false', + forbid: appType === 'mob', options: [{ value: 'true', text: Formdict['model.true'] @@ -594,6 +743,36 @@ value: 'false', text: Formdict['model.false'] }] + }, + { + type: 'radio', + key: 'inputType', + label: '杈撳叆鏍峰紡', + initVal: card.inputType || 'input', + required: false, + forbid: appType === null, + options: [{ + value: 'input', + text: '杈撳叆妗�' + }, { + value: 'search', + text: '鎼滅储妗�' + }] + }, + { + type: 'color', + key: 'backgroundColor', + label: '鑳屾櫙鑹�', + initVal: card.backgroundColor || '', + tooltip: '璁剧疆鑳屾櫙鑹插悗锛岄�変腑鏁堟灉鐢辫儗鏅鑹叉帶鍒躲��', + required: false + }, + { + type: 'color', + key: 'borderColor', + label: '杈规棰滆壊', + initVal: card.borderColor || '', + required: false }, { type: 'multiselect', @@ -2175,7 +2354,7 @@ min: 1, max: 24, precision: 0, - label: '鍗$墖瀹藉害', + label: '鍏冪礌瀹藉害', initVal: card.width || 4, tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', required: true @@ -2376,6 +2555,9 @@ }, { value: 'letter&number', text: Formdict['header.form.letter&number'] + }, { + value: 'phone', + text: '鎵嬫満鍙�' }] }, { @@ -2404,19 +2586,6 @@ initVal: card.maxfile || '', tooltip: '绛変簬0鏃朵笉鍋氶檺鍒躲��', required: false - }, - { - type: 'radio', - key: 'hidelabel', - label: '闅愯棌鍚嶇О', - initVal: card.hidelabel || 'false', - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] - }] }, { type: 'radio', @@ -2490,11 +2659,14 @@ label: '鎵爜', initVal: card.scan || 'false', options: [{ - value: 'true', - text: '鍚敤' - }, { value: 'false', - text: '涓嶅惎鐢�' + text: '绂佺敤' + }, { + value: 'simple', + text: '鍗曟' + }, { + value: 'multi', + text: '杩炵画' }], forbid: appType !== 'mob' }, @@ -2527,10 +2699,38 @@ }] }, { + type: 'radio', + key: 'hidelabel', + label: '闅愯棌鍚嶇О', + initVal: card.hidelabel || 'false', + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'arrange', + label: '鍏冪礌鎺掑垪', + initVal: card.arrange || 'adaptive', + forbid: appType !== 'mob', + options: [{ + value: 'line', + text: '鏁磋' + }, { + value: 'adaptive', + text: '鑷�傚簲' + }] + }, + { type: 'color', key: 'backgroundColor', label: '鑳屾櫙鑹�', initVal: card.backgroundColor || '', + tooltip: '璁剧疆鑳屾櫙鑹插悗锛岄�変腑鏁堟灉鐢辫儗鏅鑹叉帶鍒躲��', required: false }, { @@ -2675,6 +2875,20 @@ }, { type: 'radio', + key: 'splitline', + label: '鍒嗗壊绾�', + initVal: card.splitline || 'true', + forbid: appType !== 'mob', + options: [{ + value: 'true', + text: '鏄剧ず' + }, { + value: 'false', + text: '闅愯棌' + }] + }, + { + type: 'radio', key: 'count', label: '璁℃暟鍔熻兘', initVal: card.count || 'false', @@ -2702,7 +2916,7 @@ type: 'text', key: 'supvalue', label: '鏄剧ず鍊�', - tooltip: '璇峰~鍐欐樉绀哄�硷紝鍙湁涓婄骇琛ㄥ崟鍊间笌鏄剧ず鍊肩浉鍚屾椂锛岃琛ㄥ崟鎵嶄細鏄剧ず锛屾敞锛氬涓�肩敤閫楀彿鍒嗛殧銆�', + tooltip: '璇峰~鍐欐樉绀哄�硷紝鍙湁涓婄骇琛ㄥ崟鍊间笌鏄剧ず鍊肩浉鍚屾椂锛岃琛ㄥ崟鎵嶄細鏄剧ず锛屾敞锛�1銆佸涓�肩敤閫楀彿鍒嗛殧锛�2銆佷笂绾ц〃鍗曞垵濮嬪�间负$first鏃舵殏鏈鐞嗐��', initVal: card.supvalue || '', required: true, readonly: false @@ -2727,6 +2941,14 @@ }, { type: 'text', + key: 'placeholder', + label: '鎻愮ず淇℃伅', + tooltip: '瀛楁棰勬湡鍊肩殑鎻愮ず淇℃伅銆�', + initVal: card.placeholder || '', + required: false + }, + { + type: 'text', key: 'emptyText', label: '绌哄�兼枃鏈�', tooltip: '绌哄�肩殑鎻愮ず鏂囨湰锛岄�夋嫨璁剧疆绌哄�兼椂鏈夋晥锛岄粯璁ゅ�间负銆婄┖銆嬨��', -- Gitblit v1.8.0