From e4da07b71dddb3b01b58ecaf21ae5b7052e98b7d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 26 八月 2020 16:01:01 +0800
Subject: [PATCH] 2020-08-26

---
 src/views/menudesign/index.jsx |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx
index 79bd9e8..e78a014 100644
--- a/src/views/menudesign/index.jsx
+++ b/src/views/menudesign/index.jsx
@@ -22,6 +22,7 @@
 const MenuForm = asyncComponent(() => import('@/menu/menuform'))
 const SourceWrap = asyncComponent(() => import('@/menu/modelsource'))
 const MenuShell = asyncComponent(() => import('@/menu/menushell'))
+// const Controller = asyncComponent(() => import('@/mob/controller'))
 // const DataSource = asyncComponent(() => import('@/mob/datasource'))
 const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent'))
 
@@ -39,6 +40,7 @@
   }
 
   UNSAFE_componentWillMount() {
+    
     this.getMenuParam()
     // this.testFunc()
   }
@@ -50,6 +52,10 @@
     this.setState = () => {
       return
     }
+  }
+
+  reloadTab = () => {
+    
   }
 
   closeView = () => {
@@ -155,6 +161,8 @@
           config: fromJS(config).toJS(),
           openEdition: result.open_edition || '',
         })
+
+        this.getRoleFields()
       } else {
         notification.warning({
           top: 92,
@@ -162,6 +170,44 @@
           duration: 5
         })
       }
+    })
+  }
+
+  getRoleFields = () => {
+    Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => {
+      if (res.status) {
+        let _permFuncField = []
+        let _sysRoles = []
+
+        if (res.Roles && res.Roles.length > 0) {
+          _sysRoles = res.Roles.map(role => {
+            return {
+              uuid: Utils.getuuid(),
+              value: role.RoleID,
+              text: role.RoleName
+            }
+          })
+        }
+
+        if (res.sModular && res.sModular.length > 0) {
+          res.sModular.forEach(field => {
+            if (field.ModularNo) {
+              _permFuncField.push(field.ModularNo)
+            }
+          })
+          _permFuncField = _permFuncField.sort()
+        }
+
+        this.setState({
+          config: {...this.state.config, sysRoles: _sysRoles, permFuncField: _permFuncField}
+        })
+      }
+    })
+  }
+
+  initMenuList = (list) => {
+    this.setState({
+      config: {...this.state.config, fstMenuList: list}
     })
   }
 
@@ -212,6 +258,8 @@
   updatetable = (config, fields) => {
     const { tableFields } = this.state
 
+    config.tableFields = fields ? fields : tableFields
+
     this.setState({
       config: config,
       tableFields: fields ? fields : tableFields
@@ -240,22 +288,26 @@
                     parentId={this.props.match.params.ParentId}
                     MenuName={this.props.match.params.MenuName}
                     MenuNo={this.props.match.params.MenuNo}
+                    initMenuList={this.initMenuList}
                     updateConfig={this.updateConfig}
                   />
                   {/* 琛ㄥ悕娣诲姞 */}
-                  {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null}
+                  {config ? <TableComponent config={config} updatetable={this.updatetable}/> : null}
                 </Panel>
                 {/* 缁勪欢娣诲姞 */}
                 <Panel header={dict['mob.component']} key="component">
                   <SourceWrap />
                 </Panel>
+                {/* <Panel header={dict['mob.style']} key="style">
+                  <Controller />
+                </Panel> */}
               </Collapse>
             </div>
             <div className="menu-view">
               <Card title={
                 <div>
                   {config && config.MenuName} 
-                  <Icon type="redo" style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={() => this.reloadTab(true)} />
+                  <Icon type="redo" style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={() => this.reloadTab()} />
                 </div>
               } bordered={false} extra={
                 <div>
@@ -263,7 +315,7 @@
                   <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{dict['mob.save']}</Button>
                 </div>
               } style={{ width: '100%' }}>
-                {config ? <MenuShell config={config} handleList={this.updateConfig} /> : null}
+                {config ? <MenuShell config={config} handleList={this.updateConfig} deleteCard={this.deleteCard} /> : null}
               </Card>
             </div>
           </div>

--
Gitblit v1.8.0