From ce70be666bcd78a7e16e739040488cf7e7256cc2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 31 五月 2021 15:49:43 +0800
Subject: [PATCH] 2021-05-31

---
 src/tabviews/custom/components/form/normal-form/index.jsx |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 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..aa6387c 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,13 +60,33 @@
       _data = {}
     }
 
+    let roleId = sessionStorage.getItem('role_id') || ''
+
     config.subcards = config.subcards.map(group => {
       group.subButton.uuid = group.uuid
       group.subButton.$menuId = group.uuid
       group.subButton.Ot = 'requiredSgl'
-      group.subButton.btnstyle = group.subButton.style
       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
     })
@@ -229,6 +249,14 @@
       })
     }
 
+    let requireFields = searches.filter(item => item.required && (!item.value || item.value.length === 0))
+    if (requireFields.length > 0) {
+      this.setState({
+        loading: false
+      })
+      return
+    }
+
     this.setState({
       loading: true
     })

--
Gitblit v1.8.0