From 03a22ec6f9ad7303d10b4c65bb5bc6fa5cbd448a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 22 十月 2022 23:21:42 +0800
Subject: [PATCH] 2022-10-22

---
 src/templates/zshare/unattended/index.jsx |   35 ++++++++++++++++++++++++-----------
 1 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/src/templates/zshare/unattended/index.jsx b/src/templates/zshare/unattended/index.jsx
index 3881333..abb8018 100644
--- a/src/templates/zshare/unattended/index.jsx
+++ b/src/templates/zshare/unattended/index.jsx
@@ -2,6 +2,7 @@
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
 import { Modal, Button } from 'antd'
+import { UserOutlined } from '@ant-design/icons'
 
 import SettingForm from './settingform'
 import './index.scss'
@@ -26,25 +27,37 @@
     const { config } = this.props
     let actions = []
 
-    config.action.forEach(item => {
-      if (item.position !== 'toolbar') return
-      if (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print')) {
-        actions.push(item)
-      }
-    })
+    if (config.components) {
+      config.components[0].action.forEach(item => {
+        if (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print')) {
+          actions.push(item)
+        }
+      })
+    } else {
+      config.action.forEach(item => {
+        if (item.position !== 'toolbar') return
+        if (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print')) {
+          actions.push(item)
+        }
+      })
+    }
 
     this.setState({
       actions,
-      autoMatic: config.autoMatic || {enable: 'false'},
+      autoMatic: config.autoMatic || {enable: 'false', onFail: 'stop', onSuccess: 'stay', action: ''},
       visible: true
     })
   }
 
   submit = () => {
-    // let config = fromJS(this.props.config).toJS()
+    const { config } = this.props
 
     this.settingRef.handleConfirm().then(res => {
-      
+      this.setState({
+        visible: false
+      })
+
+      this.props.updateConfig({...config, autoMatic: res})
     })
   }
 
@@ -53,12 +66,12 @@
 
     return (
       <div style={{display: 'inline-block'}}>
-        <Button className="mk-border-purple" icon="user" onClick={this.trigger}>鏃犱汉鍊煎畧</Button>
+        <Button className="mk-border-purple" onClick={this.trigger}><UserOutlined/> 鏃犱汉鍊煎畧</Button>
         <Modal
           title="鏃犱汉鍊煎畧"
           wrapClassName="unattended-field-modal"
           visible={visible}
-          width={600}
+          width={800}
           maskClosable={false}
           onOk={this.submit}
           onCancel={() => { this.setState({ visible: false })}}

--
Gitblit v1.8.0