From c7aece35a62b6e91fd98a625bf0e53f64bfbd18d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 17 八月 2023 16:22:15 +0800
Subject: [PATCH] 2023-08-17

---
 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx |  122 ++++++++++++++++++++++++++++++++--------
 1 files changed, 98 insertions(+), 24 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
index 555ed77..2ec586a 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
@@ -19,6 +19,7 @@
 const { confirm } = Modal
 const { Paragraph } = Typography
 const EditTable = asyncComponent(() => import('@/templates/zshare/editTable'))
+const FullScripts = asyncComponent(() => import('@/templates/zshare/verifycard/fullScripts'))
 
 class VerifyCard extends Component {
   static propTpyes = {
@@ -122,7 +123,7 @@
       {
         title: '鎶ラ敊缂栫爜',
         dataIndex: 'errorCode',
-        width: '12%',
+        width: '10%',
         editable: true,
         inputType: 'select',
         options: [
@@ -135,13 +136,24 @@
       {
         title: '楠岃瘉绫诲瀷',
         dataIndex: 'verifyType',
-        width: '12%',
-        render: (text, record) => record.verifyType === 'logic' ? '閫昏緫楠岃瘉' : '鐗╃悊楠岃瘉',
+        width: '14%',
+        render: (text, record) => {
+          let names = {
+            physical: '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級',
+            logic: '閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級',
+            physical_temp: '鐗╃悊楠岃瘉锛堜粎涓存椂琛級',
+            logic_temp: '閫昏緫楠岃瘉锛堜粎涓存椂琛級',
+          }
+
+          return names[text] || '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級'
+        },
         inputType: 'select',
         editable: true,
         options: [
-          { value: 'physical', text: '鐗╃悊楠岃瘉' },
-          { value: 'logic', text: '閫昏緫楠岃瘉' }
+          { value: 'physical', text: '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級' },
+          { value: 'logic', text: '閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級' },
+          { value: 'physical_temp', text: '鐗╃悊楠岃瘉锛堜粎涓存椂琛級' },
+          { value: 'logic_temp', text: '閫昏緫楠岃瘉锛堜粎涓存椂琛級' }
         ]
       },
       {
@@ -239,15 +251,22 @@
 
   UNSAFE_componentWillMount() {
     const { card } = this.props
-    let _verify = fromJS(card.verify || {range: 1}).toJS()
+    let _verify = fromJS(card.verify || {}).toJS()
     let _columns = _verify.columns || []
+
+    delete _verify.dataresource
 
     // 鏃ф暟鎹吋瀹�
     _columns = _columns.map(col => {
       col.required = col.required || 'true'
       col.type = col.type || 'Nvarchar(50)'
       col.import = col.import || 'true'
-      col.required = col.required || 'true'
+
+      if (col.type === 'text' || col.type === 'image') {
+        col.type = 'Nvarchar(50)'
+      } else if (col.type === 'number') {
+        col.type = 'Decimal(18,2)'
+      }
       
       if (/^Nvarchar/ig.test(col.type)) {
         col.limit = col.type.match(/\d+/)[0]
@@ -259,6 +278,10 @@
 
       return col
     })
+
+    if (!_verify.hasOwnProperty('range')) {
+      _verify.range = 1
+    }
 
     this.setState({
       verify: {
@@ -302,7 +325,7 @@
     _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp)
     _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉
     
-    Api.getSystemConfig(_sParam).then(res => {
+    Api.getCloudConfig(_sParam).then(res => {
       if (res.status) {
         let _scripts = res.data.map(item => {
           return {
@@ -353,7 +376,7 @@
 
     let _columns = JSON.parse(JSON.stringify(verify.columns))
 
-    let _cols = _columns.map(col => col.Column )
+    let _cols = _columns.map(col => col.Column)
 
     columns.forEach(col => {
       if (col.field && !_cols.includes(col.field)) {
@@ -442,20 +465,41 @@
   changeColumns = (columns) => {
     const { verify } = this.state
 
+    let reset = false
     columns = columns.map(col => {
+      col.type = col.type || 'Nvarchar(50)'
+      if (col.type === 'text' || col.type === 'image') {
+        col.type = 'Nvarchar(50)'
+      } else if (col.type === 'number') {
+        col.type = 'Decimal(18,2)'
+      }
+
       if (/^Nvarchar/ig.test(col.type)) {
         col.limit = col.type.match(/\d+/) ? col.type.match(/\d+/)[0] : '20000'
       } else if (/^Decimal/ig.test(col.type)) {
         col.limit = col.type.match(/\d+/ig)[1]
+        if (col.required === 'false') {
+          reset = true
+        }
         col.required = 'true'
       } else if (/^int/ig.test(col.type)) {
+        if (col.required === 'false') {
+          reset = true
+        }
         col.required = 'true'
       } else {
         col.limit = ''
       }
 
+      col.required = col.required || 'true'
+      col.import = col.import || 'true'
+
       return col
     })
+
+    if (reset) {
+      message.warning('鏁板�肩被鍨嬪潎涓哄繀濉��')
+    }
 
     this.setState({verify: {...verify, columns}}, () => {
       this.resetUniqueColumns()
@@ -741,13 +785,18 @@
             <Form {...formItemLayout}>
               <Row gutter={24}>
                 <Col span={8}>
-                  <Form.Item label="琛ㄥ悕">
+                  <Form.Item label={
+                    <Tooltip placement="bottomLeft" title="瀵煎叆鏃跺伐浣滆〃鍚嶄笌excel涓繀椤讳竴鑷达紝娉細宸ヤ綔琛ㄥ悕涓篠heet1涓攅xcel涓粎鏈変竴涓伐浣滆〃鏃朵笉杩涜琛ㄥ悕楠岃瘉銆�">
+                      <QuestionCircleOutlined className="mk-form-tip" />
+                      宸ヤ綔琛�
+                    </Tooltip>
+                  }>
                     {getFieldDecorator('sheet', {
                       initialValue: verify.sheet || '',
                       rules: [
                         {
                           required: true,
-                          message: '璇疯緭鍏ヨ〃鍚�!'
+                          message: '璇疯緭鍏ュ伐浣滆〃鍚�!'
                         }
                       ]
                     })(<Input placeholder="" autoComplete="off" />)}
@@ -790,7 +839,7 @@
               娓呯┖Excel鍒�
             </Button>
             <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>娉細鏁板�肩被鍨嬶紙int 鎴� decimal锛夛紝鍐呭涓哄繀濉紱鏈�澶у�煎拰鏈�灏忓�煎湪绫诲瀷涓烘暟鍊兼椂鏈夋晥銆�</Col>
-            <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/>
+            <EditTable actions={['edit', 'move', 'copy', 'del', 'extra:required:鏄惁蹇呭~']} type="excelcolumn" data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/>
           </TabPane>
           {card.intertype === 'system' ? <TabPane tab={
             <span>
@@ -807,6 +856,23 @@
               {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null}
             </span>
           } key="scripts" id="mk-exin-script">
+            <FullScripts
+              verify={verify}
+              getScriptsFullForm={() => this.scriptsFullForm}
+              getScriptsForm={() => this.scriptsForm}
+              handleStatus={this.handleStatus}
+              handleDelete={this.handleDelete}
+            >
+              <CustomScript
+                type="fullscreen"
+                btn={this.props.card}
+                usefulfields={verify.columns}
+                scripts={verify.scripts}
+                systemScripts={this.state.systemScripts}
+                scriptsChange={this.scriptsChange}
+                wrappedComponentRef={(inst) => this.scriptsFullForm = inst}
+              />
+            </FullScripts>
             <CustomScript
               btn={this.props.card}
               usefulfields={verify.columns}
@@ -821,7 +887,7 @@
             <Form {...formItemLayout}>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> S </span>
                     <Button onClick={() => {this.showError('S')}} type="primary" size="small">
                       鏌ョ湅
@@ -829,14 +895,14 @@
                   </Form.Item>
                 </Col>
                 <Col span={8}>
-                  <Form.Item label={'鍋滅暀鏃堕棿'}>
+                  <Form.Item label="鍋滅暀鏃堕棿">
                     <InputNumber defaultValue={verify.stime || 2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} />
                   </Form.Item>
                 </Col>
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> Y </span>
                     <Button onClick={() => {this.showError('Y')}} type="primary" size="small">
                       鏌ョ湅
@@ -846,7 +912,15 @@
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
+                    <span className="errorval"> -1 </span>
+                    鎵ц鎴愬姛鏃犳彁绀恒��
+                  </Form.Item>
+                </Col>
+              </Row>
+              <Row gutter={24}>
+                <Col offset={6} span={6}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> N </span>
                     <Button onClick={() => {this.showError('N')}} type="primary" size="small">
                       鏌ョ湅
@@ -854,14 +928,14 @@
                   </Form.Item>
                 </Col>
                 <Col span={8}>
-                  <Form.Item label={'鍋滅暀鏃堕棿'}>
+                  <Form.Item label="鍋滅暀鏃堕棿">
                     <InputNumber defaultValue={verify.ntime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} />
                   </Form.Item>
                 </Col>
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> F </span>
                     <Button onClick={() => {this.showError('F')}} type="primary" size="small">
                       鏌ョ湅
@@ -869,14 +943,14 @@
                   </Form.Item>
                 </Col>
                 <Col span={8}>
-                  <Form.Item label={'鍋滅暀鏃堕棿'}>
+                  <Form.Item label="鍋滅暀鏃堕棿">
                     <InputNumber defaultValue={verify.ftime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} />
                   </Form.Item>
                 </Col>
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> E </span>
                     <Button onClick={() => {this.showError('E')}} type="primary" size="small">
                       鏌ョ湅
@@ -886,7 +960,7 @@
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> NM </span>
                     <Button onClick={() => {this.showError('NM')}} type="primary" size="small">
                       鏌ョ湅
@@ -896,9 +970,9 @@
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
-                    <span className="errorval"> -1 </span>
-                    涓嶆彁绀�
+                  <Form.Item label="鎻愮ず缂栫爜">
+                    <span className="errorval"> -2 </span>
+                    鎵ц澶辫触鏃犳彁绀�
                   </Form.Item>
                 </Col>
               </Row>

--
Gitblit v1.8.0