From 1dfd49b103e721f9bb63fd4d472b6fcc225d94a1 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 12 三月 2020 18:42:20 +0800
Subject: [PATCH] 2020-03-12

---
 src/templates/tableshare/formconfig.js |  476 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 467 insertions(+), 9 deletions(-)

diff --git a/src/templates/tableshare/formconfig.js b/src/templates/tableshare/formconfig.js
index 08380d8..57410cd 100644
--- a/src/templates/tableshare/formconfig.js
+++ b/src/templates/tableshare/formconfig.js
@@ -190,6 +190,37 @@
         value: 'button',
         text: Formdict['header.form.button']
       }]
+    },
+    {
+      type: 'radio',
+      key: 'database',
+      label: Formdict['header.form.database'],
+      initVal: card.database || 'local',
+      options: [{
+        value: 'local',
+        text: Formdict['header.form.database.local']
+      }, {
+        value: 'sso',
+        text: Formdict['header.form.database.sso']
+      }]
+    },
+    {
+      type: 'number',
+      key: 'ratio',
+      min: 1,
+      max: 24,
+      label: Formdict['header.form.ratio'],
+      tooltip: '姣忚鍒嗕负24浠斤紝姣斾緥鍙缃负1-24',
+      initVal: card.ratio,
+      required: false
+    },
+    {
+      type: 'select',
+      key: 'quick',
+      label: Formdict['header.form.quickadd'],
+      initVal: '',
+      required: false,
+      options: []
     }
   ]
 }
@@ -247,8 +278,43 @@
       }, {
         value: 'outerpage',
         text: Formdict['header.form.newpage.outer']
+      }, {
+        value: 'funcbutton',
+        text: Formdict['header.form.funcbutton']
       }]
-    }, {
+    },
+    {
+      type: 'select',
+      key: 'funcType',
+      label: Formdict['header.form.funcType'],
+      initVal: card.funcType || '',
+      required: true,
+      options: [{
+        value: 'changeuser',
+        text: Formdict['header.form.func.changeuser']
+      }, {
+        value: 'print',
+        text: Formdict['header.form.func.print']
+      }]
+    },
+    {
+      type: 'select',
+      key: 'execMode',
+      label: Formdict['header.form.execMode'],
+      initVal: card.execMode || 'exec',
+      required: true,
+      options: [{
+        value: 'exec',
+        text: Formdict['header.form.exec']
+      }, {
+        value: 'prompt',
+        text: Formdict['header.form.prompt']
+      }, {
+        value: 'pop',
+        text: Formdict['header.form.popform']
+      }]
+    },
+    {
       type: 'select',
       key: 'tabType',
       label: Formdict['header.form.tabType'],
@@ -270,10 +336,13 @@
     {
       type: 'select',
       key: 'pageTemplate',
-      label: Formdict['header.form.pageTemplate'],
+      label: Formdict['header.form.newpage.type'],
       initVal: card.pageTemplate || '',
       required: true,
-      options: []
+      options: [{
+        value: 'print',
+        text: Formdict['header.menu.printTemplate']
+      }]
     },
     {
       type: 'text',
@@ -371,11 +440,39 @@
       type: 'select',
       key: 'tabTemplate',
       label: '鏍囩妯℃澘',
-      initVal: card.tabTemplate || 'formTab',
+      initVal: card.tabTemplate || 'FormTab',
       required: true,
       options: [{
-        value: 'formTab',
+        value: 'FormTab',
         text: '甯︽爣绛捐〃鍗�'
+      }]
+    },
+    {
+      type: 'select',
+      key: 'afterExecSuccess',
+      label: Formdict['header.form.afterExecSuccess'],
+      initVal: card.afterExecSuccess || 'close',
+      required: true,
+      options: [{
+        value: 'close',
+        text: Formdict['header.close']
+      }, {
+        value: 'notclose',
+        text: Formdict['header.notclose']
+      }]
+    },
+    {
+      type: 'select',
+      key: 'afterExecError',
+      label: Formdict['header.form.afterExecError'],
+      initVal: card.afterExecError || 'notclose',
+      required: true,
+      options: [{
+        value: 'close',
+        text: Formdict['header.close']
+      }, {
+        value: 'notclose',
+        text: Formdict['header.notclose']
       }]
     },
     {
@@ -447,10 +544,17 @@
     },
     {
       type: 'text',
+      key: 'sheet',
+      label: Formdict['header.form.tablename'],
+      initVal: card.sheet || config.setting.tableName || '',
+      required: true
+    },
+    {
+      type: 'text',
       key: 'sql',
-      label: Formdict['header.form.datasource'],
+      label: Formdict['header.form.tablename'],
       initVal: card.sql || config.setting.tableName || '',
-      tooltip: Formdict['header.form.actionhelp.datasource'],
+      tooltip: Formdict['header.form.actionhelp.tablename'],
       required: false
     },
     {
@@ -461,6 +565,20 @@
       tooltip: Formdict['header.form.actionhelp.sqlType'],
       required: false,
       options: []
+    },
+    {
+      type: 'radio',
+      key: 'pagination',
+      label: Formdict['header.form.pagination'],
+      initVal: card.pagination || 'false',
+      required: false,
+      options: [{
+        value: 'true',
+        text: Formdict['header.form.true']
+      }, {
+        value: 'false',
+        text: Formdict['header.form.false']
+      }]
     }
   ]
 }
@@ -568,8 +686,8 @@
       max: 18,
       decimal: 0,
       label: Formdict['header.form.decimal'],
-      initVal: card.decimal,
-      required: false
+      initVal: card.decimal || 0,
+      required: true
     },
     {
       type: 'select',
@@ -664,6 +782,346 @@
         text: '缁胯壊锛堣儗鏅級'
       }],
       required: false
+    },
+    {
+      type: 'number',
+      key: 'fieldlength',
+      label: Formdict['header.form.field.length'],
+      initVal: card.fieldlength || (card.type === 'text' ? 50 : 512),
+      required: false
+    }
+  ]
+}
+
+/**
+ * @description 鑾峰彇琛ㄥ崟閰嶇疆淇℃伅
+ * @param {*} card 
+ * @param {*} inputfields 
+ */
+export function getModalForm (card, inputfields, linkableFields, linksupFields, subtable = false) {
+  let _openType = []
+  let _fieldlength = 50
+
+  if (subtable) {
+    _openType.push({
+      value: 'linkMain',
+      text: Formdict['header.form.linkMain']
+    })
+  }
+
+  if (card.type === 'textarea' || card.type === 'fileupload') {
+    _fieldlength = 512
+  }
+
+  return [
+    {
+      type: 'text',
+      key: 'label',
+      label: Formdict['header.form.name'],
+      initVal: card.label,
+      required: true,
+      readonly: false
+    },
+    {
+      type: 'text',
+      key: 'field',
+      label: Formdict['header.form.field'],
+      initVal: card.field || '',
+      required: true,
+      readonly: false
+    },
+    {
+      type: 'select',
+      key: 'type',
+      label: Formdict['header.form.type'],
+      initVal: card.type,
+      required: true,
+      options: [{
+        value: 'text',
+        text: Formdict['header.form.text']
+      }, {
+        value: 'number',
+        text: Formdict['header.form.number']
+      }, {
+        value: 'select',
+        text: Formdict['header.form.select']
+      }, {
+        value: 'multiselect',
+        text: Formdict['header.form.multiselect']
+      }, {
+        value: 'link',
+        text: Formdict['header.form.link']
+      }, {
+        value: 'fileupload',
+        text: Formdict['header.form.fileupload']
+      }, {
+        value: 'date',
+        text: Formdict['header.form.dateday']
+      }, {
+        value: 'datemonth',
+        text: Formdict['header.form.datemonth']
+      }, {
+        value: 'datetime',
+        text: Formdict['header.form.datetime']
+      }, {
+        value: 'textarea',
+        text: Formdict['header.form.textarea']
+      }, {
+        value: 'funcvar',
+        text: Formdict['header.form.funcvar']
+      },
+      ..._openType]
+    },
+    {
+      type: 'text',
+      key: 'initval',
+      label: Formdict['header.form.initval'],
+      initVal: card.initval || '',
+      required: false
+    },
+    {
+      type: 'radio',
+      key: 'resourceType',
+      label: Formdict['header.form.resourceType'],
+      initVal: card.resourceType || '0',
+      required: true,
+      options: [{
+        value: '0',
+        text: Formdict['header.form.custom']
+      }, {
+        value: '1',
+        text: Formdict['header.form.datasource']
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'setAll',
+      label: Formdict['header.form.setAll'],
+      initVal: card.setAll || 'false',
+      options: [{
+        value: 'true',
+        text: Formdict['header.form.true']
+      }, {
+        value: 'false',
+        text: Formdict['header.form.false']
+      }]
+    },
+    {
+      type: 'textarea',
+      key: 'dataSource',
+      label: Formdict['header.form.datasource'],
+      initVal: card.dataSource || '',
+      required: true,
+      readonly: false
+    },
+    {
+      type: 'options',
+      key: 'options',
+      label: '',
+      initVal: card.options || [],
+      required: true,
+      readonly: false
+    },
+    {
+      type: 'select',
+      key: 'linkField',
+      label: Formdict['header.form.linkField'],
+      initVal: card.linkField || '',
+      required: true,
+      readonly: false,
+      options: linkableFields
+    },
+    {
+      type: 'text',
+      key: 'valueField',
+      label: Formdict['header.form.valueField'],
+      initVal: card.valueField || '',
+      required: true,
+      readonly: false
+    },
+    {
+      type: 'text',
+      key: 'valueText',
+      label: Formdict['header.form.valueText'],
+      initVal: card.valueText || '',
+      required: true,
+      readonly: false
+    },
+    {
+      type: 'text',
+      key: 'orderBy',
+      label: Formdict['header.form.orderBy'],
+      initVal: card.orderBy || '',
+      required: false,
+      readonly: false
+    },
+    {
+      type: 'select',
+      key: 'orderType',
+      label: Formdict['header.form.orderType'],
+      initVal: card.orderType || 'asc',
+      options: [{
+        value: 'asc',
+        text: Formdict['header.form.asc']
+      }, {
+        value: 'desc',
+        text: Formdict['header.form.desc']
+      }]
+    },
+    {
+      type: 'number',
+      key: 'decimal',
+      label: Formdict['header.form.decimal'],
+      initVal: card.decimal || 0,
+      required: true
+    },
+    {
+      type: 'number',
+      key: 'min',
+      label: '鏈�灏忓��',
+      initVal: card.min || '',
+      required: false
+    },
+    {
+      type: 'number',
+      key: 'max',
+      label: '鏈�澶у��',
+      initVal: card.max || '',
+      required: false
+    },
+    {
+      type: 'select',
+      key: 'regular',
+      label: Formdict['header.form.regular'],
+      initVal: card.regular || '',
+      options: [{
+        value: '',
+        text: Formdict['header.form.empty']
+      }, {
+        value: 'number',
+        text: Formdict['header.form.number']
+      }, {
+        value: 'letter',
+        text: Formdict['header.form.letter']
+      }, {
+        value: 'letter&number',
+        text: Formdict['header.form.letter&number']
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'readonly',
+      label: Formdict['header.form.readonly'],
+      initVal: card.readonly || 'false',
+      options: [{
+        value: 'true',
+        text: Formdict['header.form.true']
+      }, {
+        value: 'false',
+        text: Formdict['header.form.false']
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'required',
+      label: Formdict['header.form.field.required'],
+      initVal: card.required || 'true',
+      options: [{
+        value: 'true',
+        text: Formdict['header.form.true']
+      }, {
+        value: 'false',
+        text: Formdict['header.form.false']
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'hidden',
+      label: Formdict['header.form.field.ishidden'],
+      initVal: card.hidden || 'false',
+      options: [{
+        value: 'true',
+        text: Formdict['header.form.true']
+      }, {
+        value: 'false',
+        text: Formdict['header.form.false']
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'database',
+      label: Formdict['header.form.database'],
+      initVal: card.database || 'local',
+      options: [{
+        value: 'local',
+        text: Formdict['header.form.database.local']
+      }, {
+        value: 'sso',
+        text: Formdict['header.form.database.sso']
+      }]
+    },
+    {
+      type: 'number',
+      key: 'fieldlength',
+      label: Formdict['header.form.field.length'],
+      tooltip: '鏂囨湰銆佷笅鎷夋銆佹棩鏈熺瓑瀛楁榛樿闀垮害涓�50锛屽琛屾枃鏈笌鏂囦欢涓婁紶瀛楁榛樿闀垮害涓�512',
+      initVal: card.fieldlength || _fieldlength,
+      required: false
+    },
+    {
+      type: 'radio',
+      key: 'readin',
+      label: Formdict['header.form.readin'],
+      tooltip: Formdict['header.form.readin.tooltip'],
+      initVal: card.readin || 'true',
+      options: [{
+        value: 'true',
+        text: Formdict['header.form.true']
+      }, {
+        value: 'false',
+        text: Formdict['header.form.false']
+      }]
+    },
+    {
+      type: 'number',
+      key: 'maxRows',
+      label: Formdict['header.form.maxRows'],
+      initVal: card.maxRows || 6,
+      required: false
+    },
+    {
+      type: 'select',
+      key: 'supField',
+      label: '涓婄骇琛ㄥ崟',
+      tooltip: '涓婄骇琛ㄥ崟涓轰笅鎷夐�夋嫨鎴栧叧鑱旇彍鍗曪紝璁剧疆涓婄骇琛ㄥ崟鍚庯紝璇ヨ〃鍗曞彈鎺т簬涓婄骇鑿滃崟锛屾敞锛氬彈鎺у叧绯诲湪璇ヨ〃鍗曢殣钘忔椂澶辨晥銆�',
+      initVal: card.supField || '',
+      required: false,
+      readonly: false,
+      options: linksupFields
+    },
+    {
+      type: 'text',
+      key: 'supvalue',
+      label: '鏄剧ず鍊�',
+      tooltip: '閫夋嫨涓婄骇琛ㄥ崟鍚庯紝濉啓鏄剧ず鍊硷紝鍙湁涓婄骇琛ㄥ崟鍊间笌鏄剧ず鍊肩浉鍚屾椂锛岃琛ㄥ崟鎵嶄細鏄剧ず锛屾敞锛氬涓�肩敤閫楀彿鍒嗛殧銆�',
+      initVal: card.supvalue || '',
+      required: true,
+      readonly: false
+    },
+    {
+      type: 'select',
+      key: 'quick',
+      label: Formdict['header.form.quickadd'],
+      initVal: '',
+      required: false,
+      options: []
+    },
+    {
+      type: 'multiselect',
+      key: 'linkSubField',
+      label: Formdict['header.form.linkForm'],
+      initVal: card.linkSubField || [],
+      options: inputfields
     }
   ]
 }
\ No newline at end of file

--
Gitblit v1.8.0