Bläddra i källkod

Merge branch 'dev' of ssh://10.10.100.21/source/uas-office-integration into dev

samhoo 5 år sedan
förälder
incheckning
38cada19a9

+ 13 - 4
uas-office-web/uas-mobile/src/components/common/currencyDetail/CurrencyDetail.jsx

@@ -5,6 +5,7 @@
 
 import React, { Component } from 'react'
 import {
+  isEmptyObject,
   isObjEmpty,
   isObjNull,
   strContain,
@@ -198,13 +199,15 @@ class CurrencyDetail extends Component {
                     break
                   case 2:
                     //附件
-                   /* formItems.push(
+                    formItems.push(
                       <FormEnclosure
                         billModel={billModel}
                         groupIndex={g}
+                        childIndex={i}
                         baseUrl={_baseURL}
-                        childIndex={i}/>,
-                    )*/
+                        onTextChange={this.onTextChange.bind(this)}
+                      />,
+                    )
                     break
                   default:
                     break
@@ -397,7 +400,7 @@ class CurrencyDetail extends Component {
    */
   onDbfindSubmit = (selectModel) => {
     let selectMap = {}
-    mModalList.forEach(item => {
+    mModalList.forEach((item, index) => {
       if (item.isSelected) {
         const selectObj = item.obj
         for (let key in selectObj) {
@@ -407,6 +410,11 @@ class CurrencyDetail extends Component {
             selectMap[key] = selectObj[key]
           }
         }
+      } else if (isEmptyObject(selectMap) &&
+        (index === (mModalList.length - 1))) {
+        for (let key in item.obj) {
+          selectMap[key] = ''
+        }
       }
     })
     this.dbfindRefresh(selectModel, selectMap)
@@ -876,6 +884,7 @@ class CurrencyDetail extends Component {
 
   onSubmitClick = () => {
     const { billGroupList } = this.state
+    console.log(billGroupList)
     if (!isObjEmpty(billGroupList)) {
       let formFields = [], gridGroupFields = []
       for (let i = 0; i < billGroupList.length; i++) {

+ 65 - 41
uas-office-web/uas-mobile/src/components/common/formNew/FormEnclosure.jsx

@@ -6,10 +6,11 @@
 import React, { Component } from 'react'
 import './formCommon.less'
 import { Upload } from 'antd'
-import { isObjNull } from '../../../utils/common/common.util'
+import { getBracketStr, isObjNull } from '../../../utils/common/common.util'
 import { Toast } from 'antd-mobile'
 import { UploadOutlined } from '@ant-design/icons'
-import BillModel from '../../../model/common/BillModel'
+import BillModel, { billReadOnly } from '../../../model/common/BillModel'
+import store from '../../../redux/store/store'
 
 let uploadFail = false
 
@@ -42,10 +43,7 @@ export default class FormEnclosure extends Component {
     const { billModel } = this.state
 
     let valueItem = this.getEnclosureCom(billModel)
-    return (
-      this.renderTwoLines(
-        billModel,
-        valueItem))
+    return (valueItem)
   }
 
   /**
@@ -77,44 +75,65 @@ export default class FormEnclosure extends Component {
    * @param billModel
    */
   getEnclosureCom = (billModel) => {
-    return <div style={{
-      margin: '4px 10px 10px',
-    }}>
-      <Upload
-        action={this.props.baseUrl + '/mobile/uploadAttachs.action'}
-        listType={'picture'}
-        multiple={true}
-        fileList={billModel.fileList ? billModel.fileList : []}
-        showUploadList={true}
-        withCredentials={true}
-        beforeUpload={this.beforeUpload}
-        onChange={this.handleChange}
-        // onPreview={this.handlePreview}
-        // onRemove={this.handleRemove}
-        // onDownload={() => {}}
-        // data={''}
-        method={'post'}
-        className={'upload-list-inline'}
-      >
-        <div style={{ display: 'flex', alignItems: 'center' }}>
-          <div
-            className={'uploadBtn'}>
-            <UploadOutlined
-              style={{ color: 'white' }}/>
-            <span style={{ fontSize: '12px', marginLeft: '6px' }}>选择文件</span>
+    return <Upload
+      action={this.props.baseUrl + '/mobile/uploadAttachs.action'}
+      listType={'picture'}
+      multiple={true}
+      disabled={billReadOnly(billModel)}
+      fileList={billModel.fileList ? billModel.fileList : []}
+      showUploadList={true}
+      withCredentials={true}
+      beforeUpload={this.beforeUpload}
+      onChange={this.handleChange}
+      // onPreview={this.handlePreview}
+      onRemove={this.handleRemove}
+      // onDownload={() => {}}
+      // data={''}
+      method={'post'}
+      className={'upload-list-inline'}
+    >
+      <div className='form-common-layout'
+           style={{
+             borderBottom: 'none',
+             width: '100vw',
+           }}>
+        <div style={{
+          display: 'flex',
+          flex: 1,
+        }}>
+          <div style={{
+            minWidth: '90px',
+            fontSize: '14px',
+            color: '#333333',
+          }}>{billModel.caption}</div>
+          <div className={!billModel.allowBlank
+            ? 'form-input-fill'
+            : 'visibleHidden'}>*
           </div>
-          <span className='promptText'>(不能超过100MB)</span>
         </div>
-      </Upload>
-    </div>
+
+        {
+          billReadOnly(billModel) ||
+          <div style={{ display: 'flex', alignItems: 'center' }}>
+            <div
+              className={'uploadBtn'}>
+              <UploadOutlined
+                style={{ color: 'white' }}/>
+              <span
+                style={{ fontSize: '12px', marginLeft: '6px' }}>选择文件</span>
+            </div>
+            <span className='promptText'>(不能超过100MB)</span>
+          </div>
+        }
+      </div>
+    </Upload>
   }
 
   handleChange = ({ fileList }) => {
-    console.log('filelist', fileList)
     if (uploadFail) {
       return
     }
-    const { count } = this.props
+    const { count, onTextChange, groupIndex, childIndex } = this.props
     const { billModel } = this.state
     if (isObjNull(count) || fileList.length <= count) {
       //{"success":true,"id":"[52650]"}
@@ -122,15 +141,20 @@ export default class FormEnclosure extends Component {
       if (fileList) {
         fileList.forEach((file, index) => {
           file.enclosureId = (file.response && file.response.id)
-            ? file.response.id
-            : ''
+            ? getBracketStr(file.response.id)
+            : file.enclosureId
+          if (file.enclosureId) {
+            value = value + file.enclosureId + ';'
+            file.url = this.props.baseUrl + '/common/downloadbyId.action?id=' +
+              file.enclosureId
+              + '&master=' + store.getState().userState.accountCode
+          }
         })
       }
+      console.log(fileList)
       billModel.fileList = fileList
       this.setState({ billModel })
-      // this.props.onTextChange &&
-      // this.props.onTextChange(this.props.groupIndex, this.props.childIndex,
-      //   value)
+      onTextChange && onTextChange(groupIndex, childIndex, value)
     }
   }
 

+ 7 - 13
uas-office-web/uas-mobile/src/components/common/formNew/FormInput.jsx

@@ -17,7 +17,7 @@ import { isObjEmpty, isObjNull } from '../../../utils/common/common.util'
 import moment from 'moment'
 import BillModel, {
   billGetValue, billIsDate, billIsHtml, billIsMultiLine, billIsNum,
-  billIsSelect,
+  billIsSelect, billReadOnly,
 } from '../../../model/common/BillModel'
 
 export default class FormInput extends Component {
@@ -150,15 +150,13 @@ export default class FormInput extends Component {
   getTextCom (billModel) {
     return <TextareaItem
       className='form-input-value' autoHeight
-      placeholder={(billModel.readOnly ||
-        billModel.editable === 'F')
+      placeholder={billReadOnly(billModel)
         ? ''
         : (billIsSelect(billModel)
           ? '请选择'
           : '请输入')}
       clear={true}
-      editable={(billModel.readOnly ||
-        billModel.editable === 'F')
+      editable={billReadOnly(billModel)
         ? false
         : (billIsSelect(billModel)
           ? false
@@ -201,10 +199,8 @@ export default class FormInput extends Component {
         dismissText: '取消',
       }}
       mode={type === 'DT' ? 'datetime' : 'date'}
-      extra={(billModel.readOnly ||
-        billModel.editable === 'F') ? ' ' : type === 'DT' ? '选择时间' : '选择日期'}
-      disabled={(billModel.readOnly ||
-        billModel.editable === 'F') ? true : false}
+      extra={billReadOnly(billModel) ? ' ' : type === 'DT' ? '选择时间' : '选择日期'}
+      disabled={billReadOnly(billModel) ? true : false}
       value={!isObjEmpty(billGetValue(billModel))
         ? new Date(billGetValue(billModel).replace(/\-/g, '/'))
         : ''}
@@ -227,14 +223,12 @@ export default class FormInput extends Component {
    */
   getNumCom (billModel) {
     return <InputItem className='form-input-value' clear
-                      placeholder={(billModel.readOnly ||
-                        billModel.editable === 'F')
+                      placeholder={billReadOnly(billModel)
                         ? ''
                         : (billIsSelect(billModel)
                           ? '请选择'
                           : '请输入')}
-                      editable={(billModel.readOnly ||
-                        billModel.editable === 'F') ? false : (billIsSelect(
+                      editable={billReadOnly(billModel) ? false : (billIsSelect(
                         billModel)
                         ? false
                         : true)}

+ 1 - 0
uas-office-web/uas-mobile/src/components/common/formNew/formCommon.less

@@ -165,6 +165,7 @@
 
 .upload-list-inline .ant-upload-list-item {
   /*附件列表格式*/
+  margin: 8px;
 }
 
 .uploadBtn {

+ 29 - 0
uas-office-web/uas-mobile/src/configs/antd.config.less

@@ -104,3 +104,32 @@
 .ant-empty-normal {
   margin: 65px 0 !important;
 }
+
+/********************附件**************************/
+.ant-upload-list-picture .ant-upload-list-item, .ant-upload-list-picture-card .ant-upload-list-item {
+  height: 54px !important;
+}
+
+.ant-upload-list-picture .ant-upload-list-item-name, .ant-upload-list-picture-card .ant-upload-list-item-name {
+  line-height: 36px !important;
+}
+
+.ant-upload-list-picture .ant-upload-list-item-thumbnail, .ant-upload-list-picture-card .ant-upload-list-item-thumbnail {
+  width: 36px !important;
+  height: 36px !important;
+  line-height: 44px !important;
+
+  & img {
+    width: 36px !important;
+    height: 36px !important;
+  }
+}
+
+.ant-upload-list-item-card-actions.picture {
+  top: 16px !important;
+  padding-right: 10px;
+}
+
+.ant-btn-icon-only.ant-btn-sm > * {
+  font-size: 18px !important;
+}

+ 4 - 0
uas-office-web/uas-mobile/src/model/common/BillModel.js

@@ -86,6 +86,10 @@ export function billGetDisplay (billModel) {
   return billModel.display || billGetValue(billModel)
 }
 
+export function billReadOnly (billModel) {
+  return (billModel.readOnly || billModel.editable === 'F')
+}
+
 /**
  * 字段是否显示
  * @param billModel

+ 9 - 3
uas-office-web/uas-mobile/src/utils/common/form.request.js

@@ -75,14 +75,20 @@ export function getBillGroup (groupItem, groupIndex, isDetail) {
       billModel.appwidth = fieldItem.appwidth
       billModel.length = fieldItem.length
       billModel.isdefault = fieldItem.isdefault
-      billModel.caption = fieldItem.caption
-      billModel.type = fieldItem.type//前端类型
-      billModel.sourcetype = fieldItem.sourcetype//字段原类型
       billModel.readOnly = (fieldItem.readOnly || isDetail)
       billModel.field = fieldItem.field
       billModel.logicType = fieldItem.logicType
       billModel.findFunctionName = fieldItem.findfunctionname
       billModel.allowBlank = (fieldItem.allowBlank || isDetail)
+      billModel.caption = fieldItem.caption
+
+      billModel.type = fieldItem.type//前端类型
+      billModel.sourcetype = fieldItem.sourcetype//字段原类型
+      if (billModel.type === 'MF' && !billGroup.isForm) {
+        //移动端不支持从表的放大镜多选类型
+        //将多选类型识别为放大镜单选类型
+        billModel.type = 'DF'
+      }
 
       billModel.value = fieldItem.value
       billModel.display = fieldItem.display