From cd49c7caada72872817b36712db7bd9e338a081f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 二月 2021 18:33:47 +0800
Subject: [PATCH] 2021-02-18

---
 src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx |   19 +++
 src/views/mobmanage/submutilform/index.scss                                       |    4 
 src/views/mobmanage/index.jsx                                                     |  124 +++++++++++++++++---
 src/templates/zshare/verifycard/callbackcustomscript/index.jsx                    |   14 ++
 src/views/mobmanage/mutilform/index.jsx                                           |   53 +-------
 src/templates/zshare/verifycard/customscript/index.jsx                            |   19 +++
 src/views/mobmanage/submutilform/index.jsx                                        |  123 ++++++++++++++++++++
 7 files changed, 293 insertions(+), 63 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
index 3268132..37604b8 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
@@ -147,6 +147,25 @@
           }
         })
 
+        if (!values.uuid) {
+          if (values.position === 'init') {
+            _initCustomScript += `
+            /* 鍒濆鍖栬剼鏈� */
+            ${values.sql}
+            `
+          } else if (values.position === 'front') {
+            _prevCustomScript += `
+            /* 榛樿sql鍓嶈剼鏈� */
+            ${values.sql}
+            `
+          } else {
+            _backCustomScript += `
+            /* 榛樿sql鍚庤剼鏈� */
+            ${values.sql}
+            `
+          }
+        }
+
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
diff --git a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx
index bdfb92e..5d9f5e7 100644
--- a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx
+++ b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx
@@ -107,6 +107,20 @@
           }
         })
 
+        if (!values.uuid) {
+          if (values.position === 'front') {
+            _prevCustomScript += `
+            /* 榛樿sql鍓嶈剼鏈� */
+            ${values.sql}
+            `
+          } else {
+            _backCustomScript += `
+            /* 榛樿sql鍚庤剼鏈� */
+            ${values.sql}
+            `
+          }
+        }
+
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx
index e94e463..f7f1d2e 100644
--- a/src/templates/zshare/verifycard/customscript/index.jsx
+++ b/src/templates/zshare/verifycard/customscript/index.jsx
@@ -114,6 +114,25 @@
           }
         })
 
+        if (!values.uuid) {
+          if (values.position === 'init') {
+            _initCustomScript += `
+            /* 鍒濆鍖栬剼鏈� */
+            ${values.sql}
+            `
+          } else if (values.position === 'front') {
+            _prevCustomScript += `
+            /* 榛樿sql鍓嶈剼鏈� */
+            ${values.sql}
+            `
+          } else {
+            _backCustomScript += `
+            /* 榛樿sql鍚庤剼鏈� */
+            ${values.sql}
+            `
+          }
+        }
+
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
diff --git a/src/views/mobmanage/index.jsx b/src/views/mobmanage/index.jsx
index 261e72c..f4c551e 100644
--- a/src/views/mobmanage/index.jsx
+++ b/src/views/mobmanage/index.jsx
@@ -1,6 +1,7 @@
 import React, {Component} from 'react'
 // import { fromJS } from 'immutable'
 import { Spin, notification, Button, Table, Modal } from 'antd'
+import moment from 'moment'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
@@ -17,7 +18,7 @@
     appsublist: [],
     columns: [
       { title: '搴旂敤鍚嶇О', dataIndex: 'remark', key: 'remark', align: 'center' },
-      { title: '搴旂敤鍙傛暟', dataIndex: 'kei_no', key: 'kei_no', align: 'center' },
+      { title: '搴旂敤缂栫爜', dataIndex: 'kei_no', key: 'kei_no', align: 'center' },
       {
         title: 'Action',
         key: 'action',
@@ -52,7 +53,7 @@
         render: (text, record) => (
           <div>
             <Button type="link" onClick={() => this.deleteSubApp(record)} style={{color: '#ff4d4f'}}>鍒犻櫎</Button>
-            <Button type="link" onClick={() => this.jumpMenu(record)}>缂栬緫搴旂敤</Button>
+            <Button type="link" onClick={() => this.jumpApp(record)}>缂栬緫搴旂敤</Button>
           </div>
         )
       },
@@ -61,6 +62,8 @@
     selectSubApp: null,
     selectedRowKeys: [],
     selectedSubRowKeys: [],
+    visible: false,
+    subVisible: false
   }
 
   UNSAFE_componentWillMount() {
@@ -118,13 +121,8 @@
     console.log(record)
   }
   
-  jumpMenu = (card) => {
-    console.log(card)
-    // let _type = 'mob'
-    // if (card.type === 'pc') {
-    //   _type = 'pc'
-    // }
-    // this.props.history.replace(`/mobdesign/${card.uuid}/${_type}/${card.keiNo}/${card.name}`)
+  jumpApp = (item) => {
+    console.log(item)
   }
 
   /**
@@ -159,7 +157,7 @@
   }
 
   trigerApp = (type) => {
-    if ((type === 'appedit' && !this.state.selectApp) || (type === 'subappedit' && !this.state.selectSubApp)) {
+    if (type === 'edit' && !this.state.selectApp) {
       notification.warning({
         top: 92,
         message: '璇烽�夋嫨闇�瑕佺紪杈戠殑搴旂敤锛�',
@@ -173,11 +171,84 @@
     })
   }
 
+  trigerSubApp = (type) => {
+    if (type === 'edit' && !this.state.selectSubApp) {
+      notification.warning({
+        top: 92,
+        message: '璇烽�夋嫨闇�瑕佺紪杈戠殑瀛愬簲鐢紒',
+        duration: 5
+      })
+      return
+    }
+
+    this.setState({
+      subVisible: type
+    })
+  }
+
   
   submitCard = () => {
-    const { card } = this.state
+    const { selectApp, visible } = this.state
 
     this.mobcardRef.handleConfirm().then(res => {
+      this.setState({
+        confirmloading: true
+      })
+
+      let param = {
+        func: 's_kei_addupt',
+        ID: visible === 'edit' ? selectApp.ID : Utils.getuuid(),
+        exec_type: 'y',
+        remark: res.remark,
+        kei_no: res.kei_no,
+        LText: ''
+      }
+
+      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+      param.secretkey = Utils.encrypt('', param.timestamp)
+
+      if (visible === 'edit' && selectApp.sublist && selectApp.sublist.length > 0) {
+        param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}'`)
+        param.LText = param.LText.join(' union all ')
+        param.LText = Utils.formatOptions(param.LText)
+      }
+
+      Api.getCloudConfig(param).then(result => {
+        if (result.status) {
+          notification.success({
+            top: 92,
+            message: '鎿嶄綔鎴愬姛锛�',
+            duration: 5
+          })
+
+          this.setState({
+            confirmloading: false,
+            visible: false,
+            loading: true
+          })
+          this.getAppList()
+        } else {
+          this.setState({
+            confirmloading: false
+          })
+          notification.warning({
+            top: 92,
+            message: result.message,
+            duration: 5
+          })
+        }
+      }, () => {
+        this.setState({
+          confirmloading: false
+        })
+      })
+    })
+  }
+
+  submitSubCard = () => {
+    const { card } = this.state
+
+    this.submobcardRef.handleConfirm().then(res => {
       this.setState({
         confirmloading: true
       })
@@ -203,7 +274,7 @@
             visible: false,
             loading: true
           })
-          this.getMobCards()
+          this.getAppList()
         } else {
           this.setState({
             confirmloading: false
@@ -223,7 +294,7 @@
   }
 
   render () {
-    const { loading, visible, columns, applist, appsublist, selectedRowKeys, selectedSubRowKeys, subcolumns, selectApp, selectSubApp } = this.state
+    const { loading, visible, subVisible, columns, applist, appsublist, selectedRowKeys, selectedSubRowKeys, subcolumns, selectApp, selectSubApp } = this.state
 
     return (
       <div className="mk-app-manage">
@@ -236,8 +307,8 @@
         }
         <div className="app-table">
           <div className="app-action">
-            <Button className="mk-green" onClick={() => this.trigerApp('appplus')}>娣诲姞</Button>
-            <Button className="mk-purple" onClick={() => this.trigerApp('appedit')}>淇敼</Button>
+            <Button className="mk-green" onClick={() => this.trigerApp('plus')}>娣诲姞</Button>
+            <Button className="mk-purple" onClick={() => this.trigerApp('edit')}>淇敼</Button>
           </div>
           <Table
             rowKey="ID"
@@ -251,8 +322,8 @@
         <div className="app-table">
           <div className="sub-app-title"><span>瀛愬簲鐢�</span></div>
           <div className="app-action">
-            <Button className="mk-green" onClick={() => this.trigerApp('subappplus')}>娣诲姞</Button>
-            <Button className="mk-purple" onClick={() => this.trigerApp('subappedit')}>淇敼</Button>
+            <Button className="mk-green" onClick={() => this.trigerSubApp('plus')}>娣诲姞</Button>
+            <Button className="mk-purple" onClick={() => this.trigerSubApp('edit')}>淇敼</Button>
           </div>
           <Table
             rowKey="ID"
@@ -264,19 +335,32 @@
           />
         </div>
         <Modal
-          // className="mob-card-modal"
           title={'缂栬緫搴旂敤'}
           width={'600px'}
           maskClosable={false}
           visible={!!visible}
-          onCancel={() => this.setState({visible: ''})}
+          onCancel={() => this.setState({visible: false})}
           confirmLoading={this.state.confirmloading}
           onOk={this.submitCard}
           cancelText="鍙栨秷"
           okText="纭畾"
           destroyOnClose
         >
-          <MutilForm card={visible === 'appedit' ? selectApp : (visible === 'subappedit' ? selectSubApp : '')} wrappedComponentRef={(inst) => this.mobcardRef = inst} inputSubmit={this.submitCard} />
+          <MutilForm type={visible} card={visible === 'edit' ? selectApp : ''} wrappedComponentRef={(inst) => this.mobcardRef = inst} inputSubmit={this.submitCard} />
+        </Modal>
+        <Modal
+          title={'缂栬緫瀛愬簲鐢�'}
+          width={'600px'}
+          maskClosable={false}
+          visible={!!subVisible}
+          onCancel={() => this.setState({subVisible: false})}
+          confirmLoading={this.state.confirmloading}
+          onOk={this.submitSubCard}
+          cancelText="鍙栨秷"
+          okText="纭畾"
+          destroyOnClose
+        >
+          <MutilForm type={subVisible} card={subVisible === 'edit' ? selectSubApp : ''} wrappedComponentRef={(inst) => this.submobcardRef = inst} inputSubmit={this.submitSubCard} />
         </Modal>
       </div>
     )
diff --git a/src/views/mobmanage/mutilform/index.jsx b/src/views/mobmanage/mutilform/index.jsx
index dbdf288..0dca07e 100644
--- a/src/views/mobmanage/mutilform/index.jsx
+++ b/src/views/mobmanage/mutilform/index.jsx
@@ -1,10 +1,11 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Select, Radio } from 'antd'
+import { Form, Row, Col, Input } from 'antd'
 import './index.scss'
 
 class MainSearch extends Component {
   static propTpyes = {
+    type: PropTypes.any,         // 缂栬緫绫诲瀷
     card: PropTypes.any,         // 缂栬緫搴旂敤
     inputSubmit: PropTypes.func  // input鍥炶溅鎻愪氦
   }
@@ -33,7 +34,7 @@
   }
 
   render() {
-    const { card } = this.props
+    const { card, type } = this.props
     const { getFieldDecorator } = this.props.form
     const formItemLayout = {
       labelCol: {
@@ -50,8 +51,8 @@
         <Row gutter={24}>
           <Col span={24}>
             <Form.Item label="搴旂敤鍚�">
-              {getFieldDecorator('name', {
-                initialValue: card ? card.name : '',
+              {getFieldDecorator('remark', {
+                initialValue: card ? card.remark : '',
                 rules: [{
                   required: true,
                   message: '璇疯緭鍏ュ簲鐢ㄥ悕!'
@@ -63,27 +64,9 @@
             </Form.Item>
           </Col>
           <Col span={24}>
-            <Form.Item label="搴旂敤绫诲瀷">
-              {getFieldDecorator('type', {
-                initialValue: card ? card.type : 'mob',
-                rules: [
-                  {
-                    required: true,
-                    message: '璇烽�夋嫨搴旂敤绫诲瀷!'
-                  }
-                ]
-              })(
-                <Select>
-                  <Select.Option value="mob">绉诲姩绔�</Select.Option>
-                  <Select.Option value="pc">PC绔�</Select.Option>
-                </Select>
-              )}
-            </Form.Item>
-          </Col>
-          <Col span={24}>
             <Form.Item label="搴旂敤缂栫爜">
-              {getFieldDecorator('keiNo', {
-                initialValue: card ? card.keiNo : '',
+              {getFieldDecorator('kei_no', {
+                initialValue: card ? card.kei_no : '',
                 rules: [{
                   required: true,
                   message: '璇疯緭鍏ュ簲鐢ㄧ紪鐮�!'
@@ -91,26 +74,10 @@
                   pattern: /^[a-zA-Z_]*$/ig,
                   message: '搴旂敤缂栫爜鍙厑璁稿寘鍚ぇ灏忓啓瀛楁瘝鍙奯!'
                 }, {
-                  max: 20,
-                  message: '搴旂敤缂栫爜涓嶅彲瓒呰繃20涓瓧绗�!'
+                  max: 10,
+                  message: '搴旂敤缂栫爜涓嶅彲瓒呰繃10涓瓧绗�!'
                 }]
-              })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)}
-            </Form.Item>
-          </Col>
-          <Col span={24}>
-            <Form.Item label="鏉冮檺绠$悊">
-              {getFieldDecorator('role_manage', {
-                initialValue: card ? card.role_manage || 'false' : 'false',
-                rules: [{
-                  required: true,
-                  message: '璇烽�夋嫨鏄惁鍚敤鏉冮檺绠$悊!'
-                }]
-              })(
-                <Radio.Group>
-                  <Radio value="true">鍚敤</Radio>
-                  <Radio value="false">涓嶅惎鐢�</Radio>
-                </Radio.Group>
-              )}
+              })(<Input placeholder="" disabled={type === 'edit'} autoComplete="off" onPressEnter={this.handleSubmit} />)}
             </Form.Item>
           </Col>
         </Row>
diff --git a/src/views/mobmanage/submutilform/index.jsx b/src/views/mobmanage/submutilform/index.jsx
new file mode 100644
index 0000000..4861b60
--- /dev/null
+++ b/src/views/mobmanage/submutilform/index.jsx
@@ -0,0 +1,123 @@
+import React, {Component} from 'react'
+import PropTypes from 'prop-types'
+import { Form, Row, Col, Input, Select, Radio } from 'antd'
+import './index.scss'
+
+class MainSearch extends Component {
+  static propTpyes = {
+    type: PropTypes.any,         // 缂栬緫绫诲瀷
+    card: PropTypes.any,         // 缂栬緫搴旂敤
+    inputSubmit: PropTypes.func  // input鍥炶溅鎻愪氦
+  }
+
+  state = {}
+
+  /**
+   * @description 鑾峰彇琛ㄥ崟鍊�
+   */
+  handleConfirm = () => {
+    return new Promise(resolve => {
+      this.props.form.validateFieldsAndScroll((err, values) => {
+        if (!err) {
+          resolve(values)
+        }
+      })
+    })
+  }
+
+  /**
+   * @description 鍥炶溅鎻愪氦
+   */
+  handleSubmit = (e) => {
+    e.preventDefault()
+    this.props.inputSubmit()
+  }
+
+  render() {
+    const { card, type } = this.props
+    const { getFieldDecorator } = this.props.form
+    const formItemLayout = {
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 8 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 }
+      }
+    }
+    return (
+      <Form {...formItemLayout} className="mob-card-edit-form">
+        <Row gutter={24}>
+          <Col span={24}>
+            <Form.Item label="搴旂敤鍚�">
+              {getFieldDecorator('name', {
+                initialValue: card ? card.name : '',
+                rules: [{
+                  required: true,
+                  message: '璇疯緭鍏ュ簲鐢ㄥ悕!'
+                }, {
+                  max: 20,
+                  message: '搴旂敤鍚嶄笉鍙秴杩�20涓瓧绗�!'
+                }]
+              })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)}
+            </Form.Item>
+          </Col>
+          <Col span={24}>
+            <Form.Item label="搴旂敤绫诲瀷">
+              {getFieldDecorator('type', {
+                initialValue: card ? card.type : 'mob',
+                rules: [
+                  {
+                    required: true,
+                    message: '璇烽�夋嫨搴旂敤绫诲瀷!'
+                  }
+                ]
+              })(
+                <Select>
+                  <Select.Option value="mob">绉诲姩绔�</Select.Option>
+                  <Select.Option value="pc">PC绔�</Select.Option>
+                </Select>
+              )}
+            </Form.Item>
+          </Col>
+          <Col span={24}>
+            <Form.Item label="搴旂敤缂栫爜">
+              {getFieldDecorator('keiNo', {
+                initialValue: card ? card.keiNo : '',
+                rules: [{
+                  required: true,
+                  message: '璇疯緭鍏ュ簲鐢ㄧ紪鐮�!'
+                }, {
+                  pattern: /^[a-zA-Z_]*$/ig,
+                  message: '搴旂敤缂栫爜鍙厑璁稿寘鍚ぇ灏忓啓瀛楁瘝鍙奯!'
+                }, {
+                  max: 20,
+                  message: '搴旂敤缂栫爜涓嶅彲瓒呰繃20涓瓧绗�!'
+                }]
+              })(<Input placeholder="" disabled={type === 'edit'} autoComplete="off" onPressEnter={this.handleSubmit} />)}
+            </Form.Item>
+          </Col>
+          <Col span={24}>
+            <Form.Item label="鏉冮檺绠$悊">
+              {getFieldDecorator('role_manage', {
+                initialValue: card ? card.role_manage || 'false' : 'false',
+                rules: [{
+                  required: true,
+                  message: '璇烽�夋嫨鏄惁鍚敤鏉冮檺绠$悊!'
+                }]
+              })(
+                <Radio.Group>
+                  <Radio value="true">鍚敤</Radio>
+                  <Radio value="false">涓嶅惎鐢�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
+        </Row>
+      </Form>
+    )
+  }
+}
+
+export default Form.create()(MainSearch)
\ No newline at end of file
diff --git a/src/views/mobmanage/submutilform/index.scss b/src/views/mobmanage/submutilform/index.scss
new file mode 100644
index 0000000..28344fe
--- /dev/null
+++ b/src/views/mobmanage/submutilform/index.scss
@@ -0,0 +1,4 @@
+.mob-card-edit-form {
+  padding: 0px 24px 20px;
+
+}
\ No newline at end of file

--
Gitblit v1.8.0