From 95afd40fc2741ac0ce59c2091f6cfce1f98877d4 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 24 六月 2021 09:15:45 +0800
Subject: [PATCH] 2021-06-24

---
 src/templates/zshare/formconfig.jsx |  231 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 194 insertions(+), 37 deletions(-)

diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx
index 74f69e9..c5e049c 100644
--- a/src/templates/zshare/formconfig.jsx
+++ b/src/templates/zshare/formconfig.jsx
@@ -298,6 +298,59 @@
     roleList = []
   }
 
+  let typeOptions = []
+
+  if (sessionStorage.getItem('appType') === 'mob') {
+    typeOptions = [{
+      value: 'text',
+      text: Formdict['model.form.text']
+    }, {
+      value: 'checkcard',
+      text: '閫夐」鍗�'
+    }, {
+      value: 'date',
+      text: Formdict['model.form.dateday']
+    }, {
+      value: 'datemonth',
+      text: Formdict['model.form.datemonth']
+    }]
+    if (!['text', 'checkcard', 'date', 'datemonth'].includes(card.type)) {
+      card.type = 'text'
+    }
+  } 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']
+    }]
+  }
+
   return [
     {
       type: 'text',
@@ -322,34 +375,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',
@@ -395,6 +421,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 +500,7 @@
     {
       type: 'options',
       key: 'options',
-      label: '',
+      label: '閫夐」',
       initVal: card.options || [],
       required: true,
       readonly: false
@@ -531,6 +626,20 @@
     },
     {
       type: 'radio',
+      key: 'multiple',
+      label: '鍙閫�',
+      initVal: card.multiple || 'false',
+      required: true,
+      options: [{
+        value: 'true',
+        text: '鏄�'
+      }, {
+        value: 'false',
+        text: '鍚�'
+      }]
+    },
+    {
+      type: 'radio',
       key: 'required',
       label: Formdict['model.required'],
       initVal: card.required || 'false',
@@ -596,6 +705,20 @@
       }]
     },
     {
+      type: 'color',
+      key: 'backgroundColor',
+      label: '鑳屾櫙鑹�',
+      initVal: card.backgroundColor || '',
+      required: false
+    },
+    {
+      type: 'color',
+      key: 'borderColor',
+      label: '杈规棰滆壊',
+      initVal: card.borderColor || '',
+      required: false
+    },
+    {
       type: 'multiselect',
       key: 'blacklist',
       label: Formdict['header.form.blacklist'],
@@ -615,6 +738,8 @@
  * @param {*} type           鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡
  */
 export function getActionForm (card, functip, config, usefulFields, type, menulist = [], printTemps = []) {
+  let columns = (config.columns || []).filter(col => col.field)
+
   let opentypes = [
     {
       value: 'pop',
@@ -1125,6 +1250,23 @@
         value: 'false',
         text: '闈炲繀濉�'
       }]
+    },
+    {
+      type: 'select',
+      key: 'controlField',
+      label: '鎺у埗瀛楁',
+      tooltip: '绂佺敤鎺у埗瀛楁锛屽彲鏍规嵁鏁版嵁鎺у埗鎸夐挳鏄惁绂佺敤銆�',
+      initVal: card.controlField || '',
+      required: false,
+      options: [{label: '鏃�', field: ''}, ...columns]
+    },
+    {
+      type: 'text',
+      key: 'controlVal',
+      label: '鎺у埗鍊�',
+      tooltip: '褰撻�夋嫨鎺у埗瀛楁锛屼笖瀛楁鍊间笌鎺у埗鍊肩浉绛夋椂锛屾寜閽細绂佺敤锛屽涓�肩敤閫楀彿鍒嗛殧銆�',
+      initVal: card.controlVal || '',
+      required: false
     }
   ]
 }
@@ -2363,26 +2505,27 @@
       type: 'select',
       key: 'fileType',
       label: '鏄剧ず鏂瑰紡',
-      initVal: card.fileType || 'text',
+      initVal: card.fileType || (appType === 'mob' ? 'picture-card' : 'text'),
       options: [{
+        value: 'text',
+        text: '鏂囦欢'
+      }, {
         value: 'picture',
         text: '鍥炬枃淇℃伅'
       }, {
         value: 'picture-card',
         text: '鍥剧墖鍗�'
-      }, {
-        value: 'text',
-        text: '鏂囦欢'
       }]
     },
     {
       type: 'number',
       key: 'maxfile',
-      min: 1,
-      max: 1000000,
+      min: 0,
+      max: 1000,
       precision: 0,
       label: '鏈�澶ф枃浠舵暟',
       initVal: card.maxfile || '',
+      tooltip: '绛変簬0鏃朵笉鍋氶檺鍒躲��',
       required: false
     },
     {
@@ -2507,6 +2650,20 @@
       }]
     },
     {
+      type: 'color',
+      key: 'backgroundColor',
+      label: '鑳屾櫙鑹�',
+      initVal: card.backgroundColor || '',
+      required: false
+    },
+    {
+      type: 'color',
+      key: 'borderColor',
+      label: '杈规棰滆壊',
+      initVal: card.borderColor || '',
+      required: false
+    },
+    {
       type: 'radio',
       key: 'declareType',
       label: '鏁版嵁绫诲瀷',
@@ -2561,9 +2718,9 @@
     {
       type: 'radio',
       key: 'compress',
-      label: '鍓嶇鍘嬬缉',
+      label: '鍘嬬缉',
       initVal: card.compress || 'false',
-      tooltip: '鍓嶇鍘嬬缉蹇呴』涓哄浘鐗囥��',
+      tooltip: '鏂囦欢鍘嬬缉蹇呴』涓哄浘鐗囷紝鍥剧墖鏍煎紡涓簀pg銆乸ng銆乬if 鎴� jpeg',
       options: [{
         value: 'true',
         text: Formdict['model.true']

--
Gitblit v1.8.0