From b816a38598a2b96f244ba1aacec05f7071b1a803 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 26 三月 2021 16:09:56 +0800
Subject: [PATCH] 2021-03-26

---
 src/tabviews/custom/components/form/normal-form/index.jsx |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/tabviews/custom/components/form/normal-form/index.jsx b/src/tabviews/custom/components/form/normal-form/index.jsx
index d94b17b..8d3fc08 100644
--- a/src/tabviews/custom/components/form/normal-form/index.jsx
+++ b/src/tabviews/custom/components/form/normal-form/index.jsx
@@ -6,7 +6,7 @@
 // import moment from 'moment'
 
 import Api from '@/api'
-// import Utils from '@/utils/utils.js'
+import Utils from '@/utils/utils.js'
 import UtilsDM from '@/utils/utils-datamanage.js'
 import asyncComponent from '@/utils/asyncComponent'
 import asyncSpinComponent from '@/utils/asyncSpinComponent'
@@ -46,7 +46,7 @@
     let _data = null
     let _sync = false
     
-    if (config.setting && config.wrap.datatype !== 'static') {
+    if (config.wrap.datatype !== 'static') {
       _sync = config.setting.sync === 'true'
 
       if (_sync && data && data[config.dataName]) {
@@ -60,6 +60,8 @@
       _data = {}
     }
 
+    let roleId = sessionStorage.getItem('role_id') || ''
+
     config.subcards = config.subcards.map(group => {
       group.subButton.uuid = group.uuid
       group.subButton.$menuId = group.uuid
@@ -68,6 +70,25 @@
       group.subButton.OpenType = 'formSubmit'
       group.subButton.execError = 'never'
 
+      group.fields = group.fields.map(cell => {
+        // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗�
+        if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
+          let _option = Utils.getSelectQueryOptions(cell)
+  
+          cell.data_sql = Utils.formatOptions(_option.sql)
+          cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql))
+          cell.arr_field = _option.field
+        }
+  
+        // 瀛楁鏉冮檺榛戝悕鍗�
+        if (!cell.blacklist || !roleId || cell.blacklist.length === 0) return cell
+        if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
+          cell.hidden = 'true'
+        }
+  
+        return cell
+      })
+
       return group
     })
 

--
Gitblit v1.8.0