From 4a18149d7ca9a0ea3ad569297f34e928c59e2025 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 21 三月 2020 20:30:08 +0800
Subject: [PATCH] 2020-03-21

---
 /dev/null                                       |    4 
 src/templates/modalconfig/index.jsx             |   22 +
 src/views/printTemplate/option.js               |    8 
 package-lock.json                               |   10 +
 src/tabviews/zshare/actionList/index.jsx        |  179 +++++++++++++----
 src/templates/zshare/verifycardprint/index.jsx  |   73 ++++++-
 src/views/printTemplate/index.jsx               |   10 +
 src/templates/modalconfig/source.jsx            |  265 +++++++++++++-------------
 package.json                                    |    2 
 src/templates/zshare/formconfig.jsx             |    0 
 src/templates/zshare/verifycardprint/index.scss |   18 +
 11 files changed, 391 insertions(+), 200 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index c4a90a7..b70d0b5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3548,6 +3548,11 @@
       "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
       "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
     },
+    "codemirror": {
+      "version": "5.52.2",
+      "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.52.2.tgz",
+      "integrity": "sha512-WCGCixNUck2HGvY8/ZNI1jYfxPG5cRHv0VjmWuNzbtCLz8qYA5d+je4QhSSCtCaagyeOwMi/HmmPTjBgiTm2lQ=="
+    },
     "codepage": {
       "version": "1.14.0",
       "resolved": "https://registry.npmjs.org/codepage/-/codepage-1.14.0.tgz",
@@ -13393,6 +13398,11 @@
         }
       }
     },
+    "react-codemirror2": {
+      "version": "7.1.0",
+      "resolved": "https://registry.npmjs.org/react-codemirror2/-/react-codemirror2-7.1.0.tgz",
+      "integrity": "sha512-Rel0QbPnCTjHxgZYt6TkGw4icSZXNyONHb72a+1wWA+PlYJIvzFAv4pZlDPG0rpKpKmy4kSUlkoWgneH7w3A0g=="
+    },
     "react-dev-utils": {
       "version": "9.0.3",
       "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-9.0.3.tgz",
diff --git a/package.json b/package.json
index 2313fc6..427cc41 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,7 @@
     "babel-preset-react-app": "9.0.0",
     "camelcase": "^5.2.0",
     "case-sensitive-paths-webpack-plugin": "2.2.0",
+    "codemirror": "^5.52.2",
     "css-loader": "2.1.1",
     "dotenv": "6.2.0",
     "dotenv-expand": "4.2.0",
@@ -57,6 +58,7 @@
     "prop-types": "^15.7.2",
     "react": "^16.9.0",
     "react-app-polyfill": "^1.0.2",
+    "react-codemirror2": "^7.1.0",
     "react-dev-utils": "^9.0.3",
     "react-dnd": "^9.4.0",
     "react-dnd-html5-backend": "^9.4.0",
diff --git a/src/tabviews/tabmanage/config.js b/src/tabviews/tabmanage/config.js
deleted file mode 100644
index adffbdc..0000000
--- a/src/tabviews/tabmanage/config.js
+++ /dev/null
@@ -1,4 +0,0 @@
-// 鐗堟湰鍗囩骇椤甸潰閰嶇疆
-export const verupMainTable = {
-  
-}
diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx
index ed8ab47..942dd60 100644
--- a/src/tabviews/zshare/actionList/index.jsx
+++ b/src/tabviews/zshare/actionList/index.jsx
@@ -225,7 +225,61 @@
       formdata[_data.key] = _data.value
     })
 
-    if (!btn.verify || !btn.verify.Template || !btn.verify.linkUrl) {
+    // btn.verify.printFunc = `
+    //   let _data = data[0]
+    //   _data = JSON.parse(_data)
+
+    //   let socket = new WebSocket(_data.wsaddr)
+      
+    //   // 鎵撳紑Socket
+    //   socket.onopen = () => {
+    //     notification.success({
+    //       top: 92,
+    //       message: '鎵撳嵃璇锋眰宸插彂鍑恒��',
+    //       duration: 2
+    //     })
+    //     socket.send(JSON.stringify(_data.data))
+    //   }
+    //   // 鐩戝惉娑堟伅
+    //   socket.onmessage = (event) => {
+    //     let data = ''
+
+    //     if (event.data) {
+    //       try {
+    //         data = JSON.parse(event.data)
+    //       } catch {
+    //         notification.warning({
+    //           top: 92,
+    //           message: event.data,
+    //           duration: 10
+    //         })
+    //         data = ''
+    //       }
+    //     }
+
+    //     if (data && data.message && !data.status) {
+    //       notification.warning({
+    //         top: 92,
+    //         message: data.message,
+    //         duration: 10
+    //       })
+    //     }
+    //   }
+
+    //   socket.onerror = () => {
+    //     notification.warning({
+    //       top: 92,
+    //       message: '鏃犳硶杩炴帴鍒�:' + _data.wsaddr,
+    //       duration: 10
+    //     })
+    //   }
+    // `
+
+    if (
+      !btn.verify ||
+      (btn.verify.printMode === 'normal' && (!btn.verify.Template || !btn.verify.linkUrl)) ||
+      (btn.verify.printMode === 'custom' && !btn.verify.printFunc)
+    ) {
       notification.warning({
         top: 92,
         message: '璇峰畬鍠勬墦鍗伴獙璇佷俊鎭紒',
@@ -235,7 +289,7 @@
     }
 
     let printlist = []
-    let templates = [btn.verify.Template]
+    let templates = [btn.verify.Template || '']
     let printCount = 1
 
     if (formdata.printCount && typeof(formdata.printCount) === 'number' && formdata.printCount >= 1) {
@@ -263,34 +317,45 @@
             }
           })
         }
-        resolve('getTemp')
+
+        if (btn.verify.printMode === 'custom') {
+          this.execCustomPrint(btn, printlist)
+        } else {
+          resolve('getTemp')
+        }
       } else {
         this.getprintdata(btn, data, formdata, formlist).then(result => {
-          result.list.forEach(item => {
-            let _cell = item.data
-
-            if (_cell.TemplateID) {
-              templates.push(_cell.TemplateID)
-            } else {
-              _cell.TemplateID = btn.verify.Template
-            }
-
-            let _count = printCount
-
-            if (item.count && typeof(item.count) === 'number' && item.count >= 1) {
-              _count = item.count
-            }
-
-            for (let i = 0; i < _count; i++) {
-              printlist.push({...formdata, ..._cell})
-            }
-          })
+          if (result.next === 'getTemp') {
+            result.list.forEach(item => {
+              let _cell = item.data
+  
+              if (_cell.TemplateID) {
+                templates.push(_cell.TemplateID)
+              } else {
+                _cell.TemplateID = btn.verify.Template
+              }
+  
+              let _count = printCount
+  
+              if (item.count && typeof(item.count) === 'number' && item.count >= 1) {
+                _count = item.count
+              }
+  
+              for (let i = 0; i < _count; i++) {
+                printlist.push({...formdata, ..._cell})
+              }
+            })
+          } else if (result.next === 'customPrint') {
+            this.execCustomPrint(btn, result.list)
+          }
           
           resolve(result.next)
         })
       }
     }).then(res => {
+      // 鑾峰彇鎵撳嵃妯℃澘 getTemp
       if (!res) return
+      if (res !== 'getTemp') return false
 
       templates = Array.from(new Set(templates)) // 鍘婚噸
 
@@ -345,6 +410,18 @@
         this.execError(errorMsg, btn)
       }
     })
+  }
+
+  execCustomPrint = (btn, printdata) => {
+    this.setState({loadingUuid: ''})
+
+    try {
+      // eslint-disable-next-line
+      let func = new Function('data', 'notification', btn.verify.printFunc)  // 鏈�鍚庝竴涓弬鏁板綋鍑芥暟浣撴潵鎵ц锛屽墠闈㈢殑鍙傛暟褰撴垚鍑芥暟浣撶殑鍙傛暟銆�
+      func(printdata, notification)
+    } catch (e) {
+      console.warn(e)
+    }
   }
 
   getprintdata = (btn, data, formdata, formlist) => {
@@ -411,15 +488,20 @@
             let errorMsg = ''
             result.forEach(res => {
               if (res.status) {
-                res.data.forEach(_item => {
-                  _list.push({data: _item, count: res.printCount})
-                })
+                if (btn.verify.printMode === 'custom') {
+                  // _list.push(res.data)
+                  _list.push('{"status": true,"message": "","ErrCode": "","ErrMesg": "", "wsaddr": "ws://127.0.0.1:13529","wstype": "local/server","data": [{"cmd": "print","requestID": "202003091036391803ACEAAE08DF7454599AEA243D8959F","version": "1.0","task": {"taskID": "202003091036391803ACEAAE08DF7454599AEA243D8959F","preview": false,"printer": "Microsoft Print To PDF", "documents": [{"documentID": "05512003090002A243D8959F","contents": [{"data": {"Bill": "05512003090002","ReturnProduct": ""},"templateURL": "http://css.positecgroup.com/template/warespaceprint01/2020010810525789956968_U000000001.srt","ectype": "jdpop"}]}]}}	]}')
+                } else {
+                  res.data.forEach(_item => {
+                    _list.push({data: _item, count: res.printCount})
+                  })
+                }
               } else {
                 errorMsg = res
               }
             })
             if (!errorMsg) {
-              resolve({next: 'getTemp', list: _list})
+              resolve({next: btn.verify.printMode === 'custom' ? 'customPrint' : 'getTemp', list: _list})
             } else {
               this.execError(errorMsg, btn)
               resolve({next: false, list: _list})
@@ -507,13 +589,17 @@
 
         return Api.genericInterface(_callbackparam)
       } else if (response.status) {
-        response.data.forEach(_item => {
-          _list.push({data: _item, count: response.printCount})
-        })
+        if (btn.verify.printMode === 'custom') {
+          _list.push(response.data)
+        } else {
+          response.data.forEach(_item => {
+            _list.push({data: _item, count: response.printCount})
+          })
+        }
 
         // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹�
         if (params.length === 0) {
-          _resolve({next: 'getTemp', list: _list})
+          _resolve({next: btn.verify.printMode === 'custom' ? 'customPrint' : 'getTemp', list: _list})
         } else {
           this.printOuterLoopRequest(params, btn, _list, _resolve)
         }
@@ -525,13 +611,17 @@
       if (!response) return
 
       if (response.status) {
-        response.data.forEach(_item => {
-          _list.push({data: _item, count: response.printCount})
-        })
+        if (btn.verify.printMode === 'custom') {
+          _list.push(response.data)
+        } else {
+          response.data.forEach(_item => {
+            _list.push({data: _item, count: response.printCount})
+          })
+        }
 
         // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹�
         if (params.length === 0) {
-          _resolve({next: 'getTemp', list: _list})
+          _resolve({next: btn.verify.printMode === 'custom' ? 'customPrint' : 'getTemp', list: _list})
         } else {
           this.printOuterLoopRequest(params, btn, _list, _resolve)
         }
@@ -550,12 +640,16 @@
 
     Api.genericInterface(param).then(res => {
       if (res.status) {
-        res.data.forEach(_item => {
-          _list.push({data: _item, count: res.printCount})
-        })
+        if (btn.verify.printMode === 'custom') {
+          _list.push(res.data)
+        } else {
+          res.data.forEach(_item => {
+            _list.push({data: _item, count: res.printCount})
+          })
+        }
 
         if (params.length === 0) {
-          _resolve({next: 'getTemp', list: _list})
+          _resolve({next: btn.verify.printMode === 'custom' ? 'customPrint' : 'getTemp', list: _list})
         } else {
           this.printInnerLoopRequest(params, btn, _list, _resolve)
         }
@@ -1353,15 +1447,6 @@
       })
     } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず
 
-    // } else if (res.Relogin === 'true') { // 鍒囨崲鐢ㄦ埛鍔熻兘
-    //   sessionStorage.setItem('avatar', res.icon || '')
-    //   sessionStorage.setItem('UserID', res.UserID)
-    //   sessionStorage.setItem('SessionUid', Utils.getuuid())
-    //   sessionStorage.setItem('LoginUID', res.LoginUID)
-    //   sessionStorage.setItem('User_Name', res.UserName)
-      
-    //   window.location.reload()
-    //   return
     }
     
     if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') {
diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx
index 32f5fe2..a1d9d59 100644
--- a/src/templates/modalconfig/index.jsx
+++ b/src/templates/modalconfig/index.jsx
@@ -20,7 +20,7 @@
 import GroupForm from './groupform'
 import EditCard from './editcard'
 import MenuForm from './menuform'
-import Source from './source'
+import { BaseConfig, SearchItems } from './source'
 import './index.scss'
 
 const { Panel } = Collapse
@@ -64,7 +64,8 @@
     originConfig: null,    // 鍘熷鑿滃崟
     groupVisible: false,   // 鍏ㄥ眬閰嶇疆妯℃�佹
     curgroup: null,        // 褰撳墠缁勶紝鏂板缓鎴栫紪杈�
-    optionLibs: null       // 鑷畾涔変笅鎷夐�夐」搴�
+    optionLibs: null,      // 鑷畾涔変笅鎷夐�夐」搴�
+    sources: null          // 琛ㄥ崟绫诲瀷
   }
 
   /**
@@ -127,7 +128,7 @@
         })
       }
     } else {
-      _config = JSON.parse(JSON.stringify((Source.baseConfig)))
+      _config = JSON.parse(JSON.stringify(BaseConfig))
     }
 
     if (!_config.setting.title) {
@@ -137,8 +138,19 @@
     // 涓昏彍鍗曞凡鏈夐�夋嫨鐨勮〃鍚嶏紝妯℃�佹娌℃湁琛ㄥ悕鏃讹紝澶嶅埗涓昏彍鍗曡〃鍚�
     _config.tables = _config.tables.length === 0 ? _menu.tables : _config.tables
 
+    let _source = JSON.parse(JSON.stringify(SearchItems))
+    if (!!this.props.editTab) {
+      _source.push({
+        type: 'form',
+        label: this.state.dict['header.form.linkMain'],
+        subType: 'linkMain',
+        url: ''
+      })
+    }
+
     this.setState({
       menu: _menu,
+      source: _source,
       optionLibs: optionLibs,
       config: _config,
       selectedTables: _config.tables || [],
@@ -1126,7 +1138,7 @@
   }
 
   render () {
-    const { config } = this.state
+    const { config, source } = this.state
 
     return (
       <div className="modal-form-board">
@@ -1173,7 +1185,7 @@
               </Panel>
               <Panel header={this.state.dict['header.menu.form']} key="1">
                 <div className="search-element">
-                  {Source.searchItems.map((item, index) => {
+                  {source.map((item, index) => {
                     return (<SourceElement key={index} content={item}/>)
                   })}
                 </div>
diff --git a/src/templates/modalconfig/source.jsx b/src/templates/modalconfig/source.jsx
index 0cb243c..c340150 100644
--- a/src/templates/modalconfig/source.jsx
+++ b/src/templates/modalconfig/source.jsx
@@ -4,142 +4,139 @@
 
 const CommonDict = (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS
 
-class CommonTableBaseData {
-  baseConfig = {
-    type: 'Modal',
-    setting: {
-      title: '',
-      width: 60,
-      cols: '2',
-      container: 'tab',
-      focus: '',
-      finish: 'close',
-      clickouter: 'unclose',
-      display: 'modal'
-    },
-    tables: [],
-    groups: [],
-    fields: [
-      {
-        origin: true,
-        uuid: Utils.getuuid(),
-        label: 'label',
-        field: '',
-        initval: '',
-        type: 'text',
-        resourceType: '0',
-        setAll: 'false',
-        options: [],
-        orderType: 'asc',
-        decimal: 0,
-        min: '',
-        max: '',
-        readonly: 'false',
-        required: 'false'
-      }, {
-        origin: true,
-        uuid: Utils.getuuid(),
-        label: 'label',
-        field: '',
-        initval: '',
-        type: 'select',
-        resourceType: '0',
-        setAll: 'false',
-        options: [],
-        orderType: 'asc',
-        decimal: 0,
-        min: '',
-        max: '',
-        readonly: 'false',
-        required: 'false'
-      }, {
-        origin: true,
-        uuid: Utils.getuuid(),
-        label: 'label',
-        field: '',
-        initval: '',
-        type: 'date',
-        resourceType: '0',
-        setAll: 'false',
-        options: [],
-        orderType: 'asc',
-        decimal: 0,
-        min: '',
-        max: '',
-        readonly: 'false',
-        required: 'false'
-      }
-    ]
-  }
-
-  searchItems = [
+export const BaseConfig = {
+  type: 'Modal',
+  setting: {
+    title: '',
+    width: 60,
+    cols: '2',
+    container: 'tab',
+    focus: '',
+    finish: 'close',
+    clickouter: 'unclose',
+    display: 'modal'
+  },
+  tables: [],
+  groups: [],
+  fields: [
     {
-      type: 'form',
-      label: CommonDict['header.form.text'],
-      subType: 'text',
-      url: ''
-    },
-    {
-      type: 'form',
-      label: CommonDict['header.form.number'],
-      subType: 'number',
-      url: ''
-    },
-    {
-      type: 'form',
-      label: CommonDict['header.form.select'],
-      subType: 'select',
-      url: ''
-    },
-    {
-      type: 'form',
-      label: CommonDict['header.form.multiselect'],
-      subType: 'multiselect',
-      url: ''
-    },
-    {
-      type: 'form',
-      label: CommonDict['header.form.link'],
-      subType: 'link',
-      url: ''
-    },
-    {
-      type: 'form',
-      label: CommonDict['header.form.fileupload'],
-      subType: 'fileupload',
-      url: ''
-    },
-    {
-      type: 'form',
-      label: CommonDict['header.form.dateday'],
-      subType: 'date',
-      url: ''
-    },
-    {
-      type: 'form',
-      label: CommonDict['header.form.datemonth'],
-      subType: 'datemonth',
-      url: ''
-    },
-    {
-      type: 'form',
-      label: CommonDict['header.form.datetime'],
-      subType: 'datetime',
-      url: ''
-    },
-    {
-      type: 'form',
-      label: CommonDict['header.form.textarea'],
-      subType: 'textarea',
-      url: ''
-    },
-    {
-      type: 'form',
-      label: CommonDict['header.form.funcvar'],
-      subType: 'funcvar',
-      url: ''
+      origin: true,
+      uuid: Utils.getuuid(),
+      label: 'label',
+      field: '',
+      initval: '',
+      type: 'text',
+      resourceType: '0',
+      setAll: 'false',
+      options: [],
+      orderType: 'asc',
+      decimal: 0,
+      min: '',
+      max: '',
+      readonly: 'false',
+      required: 'false'
+    }, {
+      origin: true,
+      uuid: Utils.getuuid(),
+      label: 'label',
+      field: '',
+      initval: '',
+      type: 'select',
+      resourceType: '0',
+      setAll: 'false',
+      options: [],
+      orderType: 'asc',
+      decimal: 0,
+      min: '',
+      max: '',
+      readonly: 'false',
+      required: 'false'
+    }, {
+      origin: true,
+      uuid: Utils.getuuid(),
+      label: 'label',
+      field: '',
+      initval: '',
+      type: 'date',
+      resourceType: '0',
+      setAll: 'false',
+      options: [],
+      orderType: 'asc',
+      decimal: 0,
+      min: '',
+      max: '',
+      readonly: 'false',
+      required: 'false'
     }
   ]
 }
 
-export default new CommonTableBaseData()
+export const SearchItems = [
+  {
+    type: 'form',
+    label: CommonDict['header.form.text'],
+    subType: 'text',
+    url: ''
+  },
+  {
+    type: 'form',
+    label: CommonDict['header.form.number'],
+    subType: 'number',
+    url: ''
+  },
+  {
+    type: 'form',
+    label: CommonDict['header.form.select'],
+    subType: 'select',
+    url: ''
+  },
+  {
+    type: 'form',
+    label: CommonDict['header.form.multiselect'],
+    subType: 'multiselect',
+    url: ''
+  },
+  {
+    type: 'form',
+    label: CommonDict['header.form.link'],
+    subType: 'link',
+    url: ''
+  },
+  {
+    type: 'form',
+    label: CommonDict['header.form.fileupload'],
+    subType: 'fileupload',
+    url: ''
+  },
+  {
+    type: 'form',
+    label: CommonDict['header.form.dateday'],
+    subType: 'date',
+    url: ''
+  },
+  {
+    type: 'form',
+    label: CommonDict['header.form.datemonth'],
+    subType: 'datemonth',
+    url: ''
+  },
+  {
+    type: 'form',
+    label: CommonDict['header.form.datetime'],
+    subType: 'datetime',
+    url: ''
+  },
+  {
+    type: 'form',
+    label: CommonDict['header.form.textarea'],
+    subType: 'textarea',
+    url: ''
+  },
+  {
+    type: 'form',
+    label: CommonDict['header.form.funcvar'],
+    subType: 'funcvar',
+    url: ''
+  }
+]
+
diff --git a/src/templates/zshare/formconfig.js b/src/templates/zshare/formconfig.jsx
similarity index 100%
rename from src/templates/zshare/formconfig.js
rename to src/templates/zshare/formconfig.jsx
diff --git a/src/templates/zshare/verifycardprint/index.jsx b/src/templates/zshare/verifycardprint/index.jsx
index 6379135..5847ad1 100644
--- a/src/templates/zshare/verifycardprint/index.jsx
+++ b/src/templates/zshare/verifycardprint/index.jsx
@@ -2,9 +2,15 @@
 import PropTypes from 'prop-types'
 import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Input, Select, Radio } from 'antd'
 import moment from 'moment'
+import {UnControlled as CodeMirror} from 'react-codemirror2'
+import 'codemirror/mode/javascript/javascript'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
+
+import 'codemirror/lib/codemirror.css'
+// import 'codemirror/theme/solarized.css'
+import 'codemirror/theme/cobalt.css'
 
 import './index.scss'
 
@@ -24,6 +30,7 @@
     verify: {},
     templates: [],
     selectimg: '',
+    printMode: 'normal'
   }
 
   UNSAFE_componentWillMount() {
@@ -34,7 +41,9 @@
         ..._verify,
         Template: _verify.Template || ''
       },
-      linkType: _verify.linkType || 'system'
+      linkType: _verify.linkType || 'system',
+      printMode: _verify.printMode || 'normal',
+      printFunc: _verify.printFunc || '// Function(data, notification) // data-鎵撳嵃鏁版嵁鍒楄〃锛宯otification-淇℃伅鎻愮ず鎺т欢',
     })
   }
 
@@ -167,6 +176,14 @@
     })
   }
 
+  changePrintMode = (e) => {
+    let value = e.target.value
+
+    this.setState({
+      printMode: value
+    })
+  }
+
   changeLinkType = (e) => {
     let value = e.target.value
 
@@ -184,7 +201,7 @@
   render() {
     const { getFieldDecorator } = this.props.form
 
-    const { verify, linkType } = this.state
+    const { verify, linkType, printMode, printFunc } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -203,6 +220,42 @@
             <Form {...formItemLayout}>
               <Row gutter={24}>
                 <Col span={8}>
+                  <Form.Item label={'鎵撳嵃妯″紡'}>
+                    {getFieldDecorator('printMode', {
+                      initialValue: printMode || 'normal'
+                    })(
+                      <Radio.Group onChange={this.changePrintMode}>
+                        <Radio value="normal">鏍囧噯</Radio>
+                        <Radio value="custom">鑷畾涔�</Radio>
+                      </Radio.Group>
+                    )}
+                  </Form.Item>
+                </Col>
+                {printMode === 'custom' ? <Col span={24}>
+                  <Form.Item label={'澶勭悊鍑芥暟'} className="printFunc">
+                    {getFieldDecorator('printFunc', {
+                      initialValue: printFunc || '',
+                      rules: [
+                        {
+                          required: true,
+                          message: this.props.dict['form.required.input'] + '澶勭悊鍑芥暟!'
+                        }
+                      ]
+                    })(
+                      <CodeMirror
+                        className="code-mirror-area"
+                        options={{
+                          mode: 'text/javascript',
+                          theme: 'cobalt',
+                          lineNumbers: true,
+                          lineWrapping: true
+                        }}
+                        onBeforeChange={() => {}}
+                      />
+                    )}
+                  </Form.Item>
+                </Col> : null}
+                {printMode === 'normal' ? <Col span={8}>
                   <Form.Item label={'閾炬帴绫诲瀷'}>
                     {getFieldDecorator('linkType', {
                       initialValue: linkType || 'system'
@@ -213,8 +266,8 @@
                       </Radio.Group>
                     )}
                   </Form.Item>
-                </Col>
-                <Col span={8}>
+                </Col> : null}
+                {printMode === 'normal' ? <Col span={8}>
                   <Form.Item label={'閾炬帴鍦板潃'}>
                     {getFieldDecorator('linkUrl', {
                       initialValue: verify.linkUrl || '127.0.0.1:13529',
@@ -226,8 +279,8 @@
                       ]
                     })(<Input placeholder="" autoComplete="off" disabled={linkType === 'system'} />)}
                   </Form.Item>
-                </Col>
-                <Col span={8}>
+                </Col> : null }
+                {printMode === 'normal' ? <Col span={8}>
                   <Form.Item label={'鎵撳嵃妯℃澘'}>
                     {getFieldDecorator('Template', {
                       initialValue: verify.Template || '',
@@ -247,10 +300,10 @@
                       </Select>
                     )}
                   </Form.Item>
-                </Col>
-                <Col span={9}>
-                  <img style={{width: '90%', marginBottom: '25px'}} src={this.state.selectimg} alt=""/>
-                </Col>
+                </Col> : null }
+                {printMode === 'normal' ? <Col span={8} offset={8}>
+                  <img className="legend" src={this.state.selectimg} alt=""/>
+                </Col> : null }
               </Row>
             </Form>
           </TabPane>
diff --git a/src/templates/zshare/verifycardprint/index.scss b/src/templates/zshare/verifycardprint/index.scss
index cdbf6b1..fc537bc 100644
--- a/src/templates/zshare/verifycardprint/index.scss
+++ b/src/templates/zshare/verifycardprint/index.scss
@@ -19,4 +19,22 @@
     padding: 0 5px;
     cursor: pointer;
   }
+  .legend {
+    width: 100%;
+    margin-bottom: 25px;
+    margin-left: -2px;
+    box-shadow: 0px 0px 2px #bcbcbc;
+  }
+  .printFunc {
+    .ant-form-item-label {
+      width: 10.7%;
+    }
+    .ant-form-item-control-wrapper {
+      width: 89.3%;
+    }
+  }
+  .code-mirror-area {
+    font-size : 14px;
+    line-height : 25px;
+  }
 }
\ No newline at end of file
diff --git a/src/views/printTemplate/index.jsx b/src/views/printTemplate/index.jsx
index 5134fa3..2a1e0dd 100644
--- a/src/views/printTemplate/index.jsx
+++ b/src/views/printTemplate/index.jsx
@@ -305,6 +305,16 @@
     window.addEventListener('resize', this.handleResize)
 
     this.loadconfig()
+
+    document.onkeydown = (event) => {
+      const { editItemId, editItemType } = this.state
+      let e = event || window.event
+      let keyCode = e.keyCode || e.which || e.charCode
+
+      if (keyCode === 46 && editItemId && editItemType !== 'Template') {
+        this.deleteItem()
+      }
+    }
   }
 
   handleResize = () => {
diff --git a/src/views/printTemplate/option.js b/src/views/printTemplate/option.js
index fbf2b1c..7f57041 100644
--- a/src/views/printTemplate/option.js
+++ b/src/views/printTemplate/option.js
@@ -803,6 +803,14 @@
       options: fields
     },
     {
+      type: 'text',
+      key: 'cusfield',
+      label: '鑷畾涔�',
+      initval: item.cusfield || '',
+      required: true,
+      hidden: true
+    },
+    {
       type: 'number',
       key: 'left',
       label: '璺濆乏',

--
Gitblit v1.8.0