From 67036fb0ed31d77ca33b660ce5f9f47c29ae65c0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 03 三月 2024 11:47:46 +0800
Subject: [PATCH] 2024-03-03

---
 src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx |  484 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 376 insertions(+), 108 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 06fefad..c34c943 100644
--- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx
+++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx
@@ -1,13 +1,8 @@
-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       // 鎼滅储鏉′欢瀵硅薄
  */
-export function getColumnForm (card, fields = [], columns = []) {
+export function getColumnForm (card, fields = [], columns = [], wrap) {
   let roleList = sessionStorage.getItem('sysRoles')
   if (roleList) {
     try {
@@ -19,55 +14,94 @@
     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']
-  }, {
-    value: 'textarea',
-    text: Formdict['model.form.textarea']
+    text: '鏁板瓧'
   }, {
     value: 'custom',
     text: '鑷畾涔夊垪'
   }, {
-    value: 'action',
-    text: '鎿嶄綔'
-  }, {
     value: 'formula',
     text: '鍏紡'
+  }, {
+    value: 'textarea',
+    text: '澶氳鏂囨湰'
+  }, {
+    value: 'colspan',
+    text: '鍚堝苟鍒�'
   }, {
     value: 'index',
     text: '搴忓彿'
   }]
 
   let editCols = [
+    // {
+    //   field: '$sub',
+    //   label: '鎻愪氦'
+    // },
     {
-      field: '$sub',
-      label: '鎻愪氦'
+      field: '$noAct',
+      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
-      })
-    }
+
+  if (card.enter === '$sub') {
+    card.enter = '$noAct'
+  }
+  if (wrap.commit === 'change') {
+    editCols[0].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 + '锛堜笅涓�琛岋級'
+    })
   })
+
+  editCols.push({
+    field: '$next_' + card.uuid,
+    label: card.label + '锛堜笅涓�琛岋級'
+  })
+
+  if (wrap.commit === 'change') {
+    editCols.push({
+      field: '$noActX',
+      label: '鏃犲姩浣�',
+      disabled: card.editType !== 'select'
+    })
+  } else if (card.enter === '$noActX') {
+    card.enter = '$noAct'
+  }
 
   return [
     {
@@ -80,7 +114,7 @@
     {
       type: 'select',
       key: 'type',
-      label: Formdict['model.form.type'],
+      label: '绫诲瀷',
       initVal: card.type,
       required: true,
       options: options
@@ -88,7 +122,7 @@
     {
       type: 'select',
       key: 'field',
-      label: Formdict['model.form.field'],
+      label: '瀛楁',
       initVal: card.field,
       required: true,
       options: fields
@@ -99,68 +133,79 @@
       min: 20,
       max: 1000,
       precision: 0,
-      label: Formdict['model.form.columnWidth'],
+      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 || card.type === 'custom' ? 'false' : 'true'),
       required: true,
       options: [{
         value: 'true',
-        text: Formdict['model.true']
+        text: '鏄�'
       }, {
         value: 'false',
-        text: Formdict['model.false']
+        text: '鍚�'
+      }]
+    },
+    {
+      type: 'select',
+      key: 'sortField',
+      label: '鎺掑簭瀛楁',
+      initVal: card.sortField || '',
+      required: true,
+      options: fields
+    },
+    {
+      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: '鍙冲榻�'
       }]
     },
     {
@@ -178,7 +223,7 @@
       }]
     },
     {
-      type: 'radio',
+      type: 'select',
       key: 'editType',
       label: '缂栬緫绫诲瀷',
       initVal: card.editType || 'text',
@@ -192,6 +237,45 @@
       }, {
         value: 'switch',
         text: '寮�鍏�'
+      }, {
+        value: 'date',
+        text: '鏃ユ湡锛堝ぉ锛�'
+      }, {
+        value: 'popSelect',
+        text: '閫夋嫨鍣�'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'precision',
+      label: '绮剧‘搴�',
+      initVal: card.precision || 'day',
+      options: [{
+        value: 'day',
+        text: '澶�'
+      }, {
+        value: 'hour',
+        text: '灏忔椂'
+      }, {
+        value: 'minute',
+        text: '鍒嗛挓'
+      }, {
+        value: 'second',
+        text: '绉�'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'declareType',
+      label: '鏁版嵁绫诲瀷',
+      tooltip: '澹版槑鍙橀噺鏃剁殑绫诲瀷锛屾椂闂存牸寮廳atetime鎴栨枃鏈牸寮弉varchar(50)銆�',
+      initVal: card.declareType || 'datetime',
+      options: [{
+        value: 'datetime',
+        text: 'datetime'
+      }, {
+        value: 'nvarchar(50)',
+        text: 'nvarchar(50)'
       }]
     },
     {
@@ -245,16 +329,6 @@
       }]
     },
     {
-      type: 'select',
-      key: 'editField',
-      label: '缂栬緫瀛楁',
-      initVal: card.editField || '',
-      tooltip: '褰撳�间笌鎻愮ず鏂囧瓧涓嶅悓鏃讹紝鍙澶栨坊鍔犵紪杈戝瓧娈碉紝浣滀负瀹為檯鍊肩殑褰曞叆瀛楁銆�',
-      allowClear: true,
-      required: false,
-      options: fields
-    },
-    {
       type: 'options',
       key: 'options',
       label: '閫夐」',
@@ -266,7 +340,187 @@
       key: 'dataSource',
       label: '鏁版嵁婧�',
       initVal: card.dataSource || '',
+      placeholder: '绯荤粺鍙橀噺锛歮k_departmentcode銆乵k_organization銆乵k_user_type銆傚叕鍏卞�粿BID@銆�',
       required: true,
+    },
+    {
+      type: 'fields',
+      key: 'columns',
+      label: '瀛楁闆�',
+      initVal: card.columns || [],
+      required: true,
+      readonly: false,
+      columns: [
+        {
+          title: '鍚嶇О',
+          dataIndex: 'label',
+          inputType: 'input',
+          editable: true,
+          initval: 'label',
+          width: '20%'
+        },
+        {
+          title: '瀛楁',
+          dataIndex: 'field',
+          inputType: 'input',
+          editable: true,
+          unique: true,
+          strict: true,
+          copy: true,
+          initval: 'field',
+          rules: [{
+            pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig,
+            message: '璇蜂娇鐢ㄦ暟瀛椼�佸瓧姣嶃�佹眽瀛椾互鍙奯-'
+          }],
+          width: '20%'
+        },
+        {
+          title: '闅愯棌',
+          dataIndex: 'Hide',
+          inputType: 'radio',
+          editable: true,
+          width: '20%',
+          initval: 'false',
+          options: [
+            {value: 'true', text: '鏄�'},
+            {value: 'false', text: '鍚�'},
+          ],
+          render: (text, record) => {
+            if (text === 'true') {
+              return '鏄�'
+            } else {
+              return '鍚�'
+            }
+          }
+        },
+        {
+          title: '鎺掑簭',
+          dataIndex: 'IsSort',
+          inputType: 'radio',
+          editable: true,
+          width: '20%',
+          initval: 'false',
+          options: [
+            {value: 'true', text: '鏄�'},
+            {value: 'false', text: '鍚�'},
+          ],
+          render: (text, record) => {
+            if (text === 'true') {
+              return '鏄�'
+            } else {
+              return '鍚�'
+            }
+          }
+        },
+        {
+          title: '鍒楀',
+          dataIndex: 'Width',
+          inputType: 'number',
+          editable: true,
+          width: '20%',
+          initval: 120
+        }
+      ]
+    },
+    {
+      type: 'select',
+      key: 'primaryKey',
+      label: '涓婚敭',
+      initVal: card.primaryKey || '',
+      required: true,
+      readonly: false,
+      options: 'columns'
+    },
+    {
+      type: 'text',
+      key: 'order',
+      label: '榛樿鎺掑簭',
+      initVal: card.order || '',
+      placeholder: 'ID asc',
+      required: true
+    },
+    {
+      type: 'select',
+      key: 'showField',
+      label: '鏄剧ず瀛楁',
+      initVal: card.showField || '',
+      tooltip: '鐢ㄤ簬鎺у埗鍗曞厓鏍间腑鐨勬樉绀哄唴瀹广��',
+      required: false,
+      options: 'columns'
+    },
+    {
+      type: 'select',
+      key: 'controlField',
+      label: '绂佺敤瀛楁',
+      initVal: card.controlField || '',
+      tooltip: '鐢ㄤ簬鎺у埗琛屾暟鎹槸鍚﹀彲閫夋嫨銆傚瓧娈靛�间负true鏃讹紝閫夐」涓嶅彲閫夈��',
+      required: false,
+      allowClear: true,
+      options: 'columns'
+    },
+    {
+      type: 'text',
+      key: 'searchKey',
+      label: '鎼滅储瀛楁',
+      initVal: card.searchKey || '',
+      tooltip: '澶氫釜鍊艰鐢ㄩ�楀彿鍒嗛殧銆�',
+      required: false,
+      rules: [{
+        pattern: /^[0-9a-zA-Z,_-]*$/ig,
+        message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶄互鍙奯-',
+      }]
+    },
+    {
+      type: 'number',
+      key: 'popWidth',
+      label: '寮圭獥瀹藉害',
+      initVal: card.popWidth || 60,
+      tooltip: '灏忎簬100鏃朵负鐧惧垎鐜囷紝澶т簬100鏃朵负缁濆鍊笺��',
+      required: true
+    },
+    {
+      type: 'radio',
+      key: 'laypage',
+      label: '鍒嗛〉',
+      initVal: card.laypage || 'true',
+      required: false,
+      options: [{
+        value: 'true',
+        text: '鏄�'
+      }, {
+        value: 'false',
+        text: '鍚�'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'onload',
+      label: '鍒濆鍖�',
+      initVal: card.onload || 'true',
+      tooltip: '褰撴病鏈夎缃悳绱㈠瓧娈垫椂锛屽垵濮嬪寲鍔犺浇鏁版嵁銆�',
+      required: false,
+      options: [{
+        value: 'true',
+        text: '鍔犺浇'
+      }, {
+        value: 'false',
+        text: '涓嶅姞杞�'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'cache',
+      label: '閫夐」鏌ヨ',
+      initVal: card.cache || 'true',
+      tooltip: '鏁版嵁鏌ヨ鏄惁浣跨敤缂撳瓨銆�',
+      required: false,
+      options: [{
+        value: 'true',
+        text: '缂撳瓨'
+      }, {
+        value: 'false',
+        text: '瀹炴椂'
+      }]
     },
     {
       type: 'text',
@@ -296,10 +550,10 @@
       initVal: card.orderType || 'asc',
       options: [{
         value: 'asc',
-        text: Formdict['header.form.asc']
+        text: '姝e簭'
       }, {
         value: 'desc',
-        text: Formdict['header.form.desc']
+        text: '鍊掑簭'
       }]
     },
     {
@@ -355,35 +609,46 @@
       type: 'select',
       key: 'enter',
       label: '鍥炶溅鍒囨崲',
-      initVal: card.enter || '$next',
-      tooltip: '鍖呮嫭鏂囨湰鎴栨暟鍊煎洖杞︿簨浠躲�佷笅鎷夎彍鍗曢�変腑浜嬩欢銆佸紑鍏冲垏鎹簨浠躲��',
+      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: 'select',
+      key: 'clearField',
+      label: '娓呯┖瀛楁',
+      initVal: card.clearField || '',
+      tooltip: '褰撳墠瀛楁缂栬緫鏃堕渶瑕佹竻绌虹殑瀛楁銆�',
+      allowClear: true,
+      required: false,
+      options: fields
+    },
     {
       type: 'number',
       key: 'decimal',
       min: 0,
       max: 18,
       precision: 0,
-      label: Formdict['header.form.decimal'],
-      initVal: card.decimal || 0,
+      label: '灏忔暟浣�',
+      initVal: card.decimal,
       required: false
     },
     {
@@ -405,7 +670,7 @@
     {
       type: 'select',
       key: 'format',
-      label: Formdict['header.form.format'],
+      label: '鏍煎紡鍖�',
       initVal: card.format || 'none',
       options: [{
         value: 'none',
@@ -425,7 +690,7 @@
     {
       type: 'select',
       key: 'textFormat',
-      label: Formdict['header.form.format'],
+      label: '鏍煎紡鍖�',
       initVal: card.textFormat || 'none',
       options: [{
         value: 'none',
@@ -445,28 +710,16 @@
     {
       type: 'text',
       key: 'prefix',
-      label: Formdict['header.form.prefix'],
+      label: '鍓嶇紑',
       initVal: card.prefix || '',
       required: false,
     },
     {
       type: 'text',
       key: 'postfix',
-      label: Formdict['header.form.postfix'],
+      label: '鍚庣紑',
       initVal: card.postfix || '',
       required: false,
-    },
-    {
-      type: 'radio',
-      key: 'eval',
-      label: '瑙f瀽',
-      initVal: card.eval || 'true',
-      tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滄槸鈥濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃惁鈥濄��',
-      required: false,
-      options: [
-        { value: 'true', text: '鏄�' },
-        { value: 'false', text: '鍚�' }
-      ]
     },
     {
       type: 'textarea',
@@ -486,9 +739,24 @@
       options: fields
     },
     {
+      type: 'radio',
+      key: 'noValue',
+      label: '绌哄��',
+      initVal: card.noValue || 'show',
+      tooltip: '鏁板�间负 0 鎴栨椂闂村皬浜� 1949-10-02 鏃讹紝鏄惁鏄剧ず',
+      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