From 4d08cb2fa0daad4b7593a2b8282466b000194344 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 27 七月 2021 14:29:55 +0800
Subject: [PATCH] 2021-07-27

---
 src/views/rolemanage/index.jsx                       |    1 
 src/pc/transfer/index.jsx                            |   44 ++++++++
 src/pc/transfer/settingform/index.jsx                |    8 
 src/views/printTemplate/option.js                    |    8 +
 src/views/printTemplate/print.js                     |   10 +
 src/views/appmanage/index.jsx                        |   87 ++++++++++------
 src/views/printTemplate/mutilform/index.jsx          |   32 +++---
 src/menu/components/share/sourcecomponent/index.jsx  |    2 
 src/tabviews/zshare/actionList/printbutton/index.jsx |   46 ++++++++
 src/views/appmanage/scriptform/index.jsx             |    1 
 src/views/printTemplate/mutilform/index.scss         |   14 ++
 11 files changed, 192 insertions(+), 61 deletions(-)

diff --git a/src/menu/components/share/sourcecomponent/index.jsx b/src/menu/components/share/sourcecomponent/index.jsx
index d59dfc1..a5b88bc 100644
--- a/src/menu/components/share/sourcecomponent/index.jsx
+++ b/src/menu/components/share/sourcecomponent/index.jsx
@@ -78,6 +78,8 @@
           width={visible !== 'system' ? 600 : 1000}
           closable={false}
           maskClosable={false}
+          okText="纭畾"
+          cancelText="鍙栨秷"
           onOk={this.popSubmit}
           onCancel={() => {this.setState({visible: ''})}}
           destroyOnClose
diff --git a/src/pc/transfer/index.jsx b/src/pc/transfer/index.jsx
index 615c3b8..d2fb44e 100644
--- a/src/pc/transfer/index.jsx
+++ b/src/pc/transfer/index.jsx
@@ -2,11 +2,9 @@
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
 import { Button, Modal, notification } from 'antd'
-// import moment from 'moment'
 
 import zhCN from '@/locales/zh-CN/model.js'
 import enUS from '@/locales/en-US/model.js'
-// import Utils from '@/utils/utils.js'
 import SettingForm from './settingform'
 import Api from '@/api'
 import './index.scss'
@@ -28,10 +26,48 @@
   }
 
   verifySubmit = () => {
+    const { MenuID } = this.props
+
     this.verifyRef.handleConfirm().then(res => {
+      let param = {
+        func: 's_sVersionDetail_CloudAdd',
+        kei_no: sessionStorage.getItem('kei_no'),
+        kei_no_detail: sessionStorage.getItem('typename'),
+        lang: sessionStorage.getItem('lang'),
+        BID: res.VersionName,
+        VType: 'mob_menu',
+        TrdMenuID: MenuID
+      }
+
       this.setState({
-        // loading: true,
-        visible: false
+        loading: true
+      })
+      
+      Api.getCloudConfig(param).then(result => {
+        if (result.status) {
+          notification.success({
+            top: 92,
+            message: '鎿嶄綔鎴愬姛锛�',
+            duration: 3
+          })
+          this.setState({
+            loading: false,
+            visible: false
+          })
+        } else {
+          this.setState({
+            loading: false
+          })
+          notification.warning({
+            top: 92,
+            message: result.message,
+            duration: 5
+          })
+        }
+      }, () => {
+        this.setState({
+          loading: false
+        })
       })
     })
   }
diff --git a/src/pc/transfer/settingform/index.jsx b/src/pc/transfer/settingform/index.jsx
index 70bc505..40d2fb0 100644
--- a/src/pc/transfer/settingform/index.jsx
+++ b/src/pc/transfer/settingform/index.jsx
@@ -32,18 +32,18 @@
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
-        sm: { span: 8 }
+        sm: { span: 6 }
       },
       wrapperCol: {
         xs: { span: 24 },
-        sm: { span: 16 }
+        sm: { span: 18 }
       }
     }
 
     return (
       <Form {...formItemLayout}>
         <Row gutter={24}>
-          <Col span={20}>
+          <Col span={22}>
             <Form.Item label="浼犺緭鍙�">
               {getFieldDecorator('VersionName', {
                 initialValue: '',
@@ -54,7 +54,7 @@
               })(
                 <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                   {translist.map(option =>
-                    <Select.Option key={option.VersionName} value={option.VersionName}>{option.ProgramName}</Select.Option>
+                    <Select.Option key={option.VersionName} value={option.VersionName}>{`${option.ProgramName}(${option.VersionName})`}</Select.Option>
                   )}
                 </Select>
               )}
diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx
index 3a412a3..fb45054 100644
--- a/src/tabviews/zshare/actionList/printbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/printbutton/index.jsx
@@ -302,6 +302,7 @@
 
       let errorMsg = ''
       let _temps = {}
+      let images = []
 
       result.forEach(res => {
         if (res.status && !errorMsg) {
@@ -315,6 +316,7 @@
               status: false
             }
           } else {
+            images = [...images, ..._temp.imgs]
             _temps[res.tempId] = _temp
           }
         } else if (!errorMsg) {
@@ -323,7 +325,38 @@
       })
 
       if (!errorMsg) {
-        this.execPrint(printlist, _temps, formdata)
+        if (images.length > 0) {
+          let errorUrls = []
+          images.forEach(url => {
+            let img = new Image()
+            img.onerror = () => {
+              errorUrls.push(url)
+            }
+            img.src = url
+          })
+
+          setTimeout(() => {
+            if (errorUrls.length > 0) {
+              notification.warning({
+                top: 92,
+                message: '妯℃澘涓浘鐗� ' + errorUrls.join('锛�') + ' 宸插け鏁堬紒',
+                duration: 5
+              })
+              Object.keys(_temps).forEach(key => {
+                _temps[key].config.ReportHeader.Control = _temps[key].config.ReportHeader.Control.map(item => {
+                  if (item.Type === 'image' && errorUrls.includes(item.Value)) {
+                    item.Value = ''
+                  }
+                  return item
+                })
+              })
+            }
+
+            this.execPrint(printlist, _temps, formdata)
+          }, 500)
+        } else {
+          this.execPrint(printlist, _temps, formdata)
+        }
       } else {
         this.execError(errorMsg)
       }
@@ -601,6 +634,7 @@
     let _configparam = ''  // 鎵撳嵃閰嶇疆淇℃伅
     let fields = []        // 妯℃澘涓墍闇�瀛楁
     let nonEFields = []    // 闈炵┖瀛楁
+    let imgs = []
 
     if (!res.ConfigParam) {
       error = '鏈幏鍙栧埌鎵撳嵃妯℃澘淇℃伅锛�'
@@ -614,7 +648,6 @@
       if (!configParam) {
         error = '鎵撳嵃妯℃澘瑙f瀽閿欒锛�'
       } else {
-        
         let control = configParam.elements.map(element => {
           let _field = element.field
 
@@ -661,6 +694,12 @@
             item.ImageWidth = element.imgWidth
             item.ImageHeight = element.imgHeight
             item.Trimming = ''
+            if (element.productValue && window.GLOB.systemType === 'production') {
+              item.Value = element.productValue
+              imgs.push(item.Value)
+            } else if (item.Value) {
+              imgs.push(item.Value)
+            }
           } else if (item.Type === 'text') {
             item.FontFamily = element.fontFamily
             item.FontSize = element.fontSize
@@ -721,7 +760,8 @@
       error: error,
       config: _configparam,
       fields: fields,
-      nonEFields: nonEFields
+      nonEFields: nonEFields,
+      imgs: imgs
     }
   }
 
diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx
index 41a56ca..91fb606 100644
--- a/src/views/appmanage/index.jsx
+++ b/src/views/appmanage/index.jsx
@@ -305,45 +305,66 @@
   }
 
   submitScript = () => {
-    // const { selectTran } = this.state
+    const { selectTran } = this.state
 
     this.scriptRef.handleConfirm().then(res => {
       this.setState({
         confirmloading: true
       })
-      // let param = {}
-      // s_sVersionDetail_Add
-      // s_sVersionDetail_CloudAdd
 
-      // Api.getCloudConfig(param).then(result => {
-      //   if (result.status) {
-      //     notification.success({
-      //       top: 92,
-      //       message: '鎿嶄綔鎴愬姛锛�',
-      //       duration: 3
-      //     })
-      //     this.setState({
-      //       scriptIndex: 1,
-      //       confirmloading: false,
-      //       scriptVisible: false
-      //     }, () => {
-      //       this.getScriptList()
-      //     })
-      //   } else {
-      //     this.setState({
-      //       confirmloading: false
-      //     })
-      //     notification.warning({
-      //       top: 92,
-      //       message: result.message,
-      //       duration: 5
-      //     })
-      //   }
-      // }, () => {
-      //   this.setState({
-      //     confirmloading: false
-      //   })
-      // })
+      let kei_no = res.appId.split(',')[1]
+      let lang = res.subAppId.split(',')[1]
+      let kei_no_detail = res.subAppId.split(',')[2]
+      
+      let param = {
+        func: 's_sVersionDetail_CloudAdd',
+        kei_no: kei_no,
+        kei_no_detail: kei_no_detail,
+        lang: lang,
+        BID: selectTran.ID
+      }
+
+      if (res.VType === 'subapp') {
+        param.VType = 'mob_menu'
+        param.TrdMenuID = ''
+        param.upid = md5(window.GLOB.appkey + kei_no + kei_no_detail + lang)
+      } else if (res.VType === 'view') {
+        param.VType = 'mob_menu'
+        param.TrdMenuID = res.viewId
+      } else if (res.VType === 'role') {
+        param.VType = 'mob_roletree'
+        param.upid = md5(window.GLOB.appkey + kei_no + kei_no_detail + lang)
+      }
+
+      Api.getCloudConfig(param).then(result => {
+        if (result.status) {
+          notification.success({
+            top: 92,
+            message: '鎿嶄綔鎴愬姛锛�',
+            duration: 3
+          })
+          this.setState({
+            scriptIndex: 1,
+            confirmloading: false,
+            scriptVisible: false
+          }, () => {
+            this.getScriptList()
+          })
+        } else {
+          this.setState({
+            confirmloading: false
+          })
+          notification.warning({
+            top: 92,
+            message: result.message,
+            duration: 5
+          })
+        }
+      }, () => {
+        this.setState({
+          confirmloading: false
+        })
+      })
     })
   }
 
diff --git a/src/views/appmanage/scriptform/index.jsx b/src/views/appmanage/scriptform/index.jsx
index 0e0d257..999599d 100644
--- a/src/views/appmanage/scriptform/index.jsx
+++ b/src/views/appmanage/scriptform/index.jsx
@@ -166,6 +166,7 @@
                 <Select onChange={this.changeType}>
                   <Select.Option value="subapp">瀛愬簲鐢�</Select.Option>
                   <Select.Option value="view">椤甸潰</Select.Option>
+                  <Select.Option value="role">鏉冮檺鏍�</Select.Option>
                 </Select>
               )}
             </Form.Item>
diff --git a/src/views/printTemplate/mutilform/index.jsx b/src/views/printTemplate/mutilform/index.jsx
index 46471dd..120c3fd 100644
--- a/src/views/printTemplate/mutilform/index.jsx
+++ b/src/views/printTemplate/mutilform/index.jsx
@@ -1,12 +1,14 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Form, Row, Col, Input, InputNumber, Select } from 'antd'
+import { Form, Row, Col, Input, InputNumber, Select, Tooltip, Icon } from 'antd'
 import { formRule } from '@/utils/option.js'
-import FileUpload from '@/tabviews/zshare/fileupload'
+// import FileUpload from '@/tabviews/zshare/fileupload'
+import asyncComponent from '@/utils/asyncComponent'
 import './index.scss'
 
 const { TextArea } = Input
+const FileUpload = asyncComponent(() => import('@/menu/components/share/sourcecomponent'))
 
 class MainSearch extends Component {
   static propTpyes = {
@@ -114,11 +116,6 @@
         })
       }
     }
-    this.handleSubmit()
-  }
-
-  updateImg = (val) => {
-    this.props.form.setFieldsValue({ value: val })
     this.handleSubmit()
   }
 
@@ -231,7 +228,12 @@
       } else if (item.type === 'fileupload') {
         fields.push(
           <Col span={24} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={
+              item.tooltip ? <Tooltip placement="topLeft" title={item.tooltip}>
+                <Icon type="question-circle" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
               {getFieldDecorator(item.key, {
                 initialValue: item.initval || '',
                 rules: [
@@ -241,12 +243,7 @@
                   }
                 ]
               })(
-                <FileUpload config={{
-                  initval: item.initval || '',
-                  suffix: '',
-                  maxfile: 1,
-                  fileType: 'text'
-                }} onChange={this.updateImg} />
+                <FileUpload type="picture" placement="right" onChange={this.handleSubmit} />
               )}
             </Form.Item>
           </Col>
@@ -254,7 +251,12 @@
       } else if (item.type === 'textarea') {
         fields.push(
           <Col span={24} key={index}>
-            <Form.Item label={item.label} >
+            <Form.Item label={
+              item.tooltip ? <Tooltip placement="topLeft" title={item.tooltip}>
+                <Icon type="question-circle" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
               {getFieldDecorator(item.key, {
                 initialValue: item.initval || '',
                 rules: [
diff --git a/src/views/printTemplate/mutilform/index.scss b/src/views/printTemplate/mutilform/index.scss
index 2b92a82..006a247 100644
--- a/src/views/printTemplate/mutilform/index.scss
+++ b/src/views/printTemplate/mutilform/index.scss
@@ -21,6 +21,20 @@
   //     width: 89.5%;
   //   }
   // }
+  .mk-source-wrap {
+    >.ant-radio-group {
+      >.ant-radio-button-wrapper:last-child {
+        display: none;
+      }
+      >.ant-radio-button-wrapper:not(:first-child) {
+        border-radius: 0 4px 4px 0;
+      }
+    }
+  }
+  .anticon-question-circle {
+    color: #c49f47;
+    margin-right: 3px;
+  }
   .ant-input-number {
     width: 100%;
   }
diff --git a/src/views/printTemplate/option.js b/src/views/printTemplate/option.js
index 3731a2b..1671000 100644
--- a/src/views/printTemplate/option.js
+++ b/src/views/printTemplate/option.js
@@ -795,6 +795,14 @@
       required: false
     },
     {
+      type: 'textarea',
+      key: 'productValue',
+      label: '姝e紡鍦板潃',
+      initval: item.productValue || '',
+      tooltip: '姝e紡绯荤粺浣跨敤鐨勫浘鐗囷紝涓虹┖鏃朵娇鐢ㄥ浘鐗囧湴鍧�銆�',
+      required: false
+    },
+    {
       type: 'select',
       key: 'field',
       label: '鍏宠仈瀛楁',
diff --git a/src/views/printTemplate/print.js b/src/views/printTemplate/print.js
index b2cbe6f..4247780 100644
--- a/src/views/printTemplate/print.js
+++ b/src/views/printTemplate/print.js
@@ -382,7 +382,7 @@
 
       if (image.complete) {
         context.drawImage(image, _left, _top, element.imgWidth, element.imgHeight)
-
+        
         context.restore() // 閲嶇疆鐢诲竷
         if (elements.length > 0) {
           this.sketchothers(context, elements, selectId, ratio, resolve)
@@ -401,6 +401,14 @@
           }
         }
       }
+      image.onerror = () => {
+        context.restore() // 閲嶇疆鐢诲竷
+        if (elements.length > 0) {
+          this.sketchothers(context, elements, selectId, ratio, resolve)
+        } else {
+          this.cachesketch(context, resolve)
+        }
+      }
     }
   }
 
diff --git a/src/views/rolemanage/index.jsx b/src/views/rolemanage/index.jsx
index d1e8533..e9164c3 100644
--- a/src/views/rolemanage/index.jsx
+++ b/src/views/rolemanage/index.jsx
@@ -13,7 +13,6 @@
 
 const { confirm } = Modal
 const { TreeNode } = Tree
-// const { Paragraph } = Typography
 const { Search } = Input
 
 const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS

--
Gitblit v1.8.0