瀏覽代碼

Merge branch 'dev' of http://192.168.1.41:3000/lanjianrong/management into dev

caipin 4 年之前
父節點
當前提交
96134b2ca9

+ 10 - 0
src/pages/Contract/Content/Income/components/Tabs/Receivable/index.module.scss

@@ -3,3 +3,13 @@
     margin: 8px 0;
   }
 }
+
+
+.MoneyFormItem {
+  :global(.ant-input) {
+    border-color: none;
+  }
+  :global(.ant-input:hover) {
+    border-color: none;
+  }
+}

+ 28 - 2
src/pages/Contract/Content/Income/components/Tabs/Receivable/index.tsx

@@ -1,5 +1,6 @@
 import DatePicker from '@/components/DatePicker'
 import FileModal from '@/components/FileModal'
+import MoneyInput from '@/components/MoneyInput'
 import { useTabHeighAuto } from '@/hooks/tabHooks'
 import { commonStore, contractStore } from '@/store/mobx'
 import { ContractType } from '@/store/mobx/contract'
@@ -10,6 +11,7 @@ import consts from '@/utils/consts'
 import { dayjsFormat, formatMoney } from '@/utils/util'
 import { DisconnectOutlined } from '@ant-design/icons'
 import { Form, Input, Popconfirm, Table, Select } from 'antd'
+import BigNumber from 'bignumber.js'
 // import locale from 'antd/es/date-picker/locale/zh_CN'
 import dayjs from 'dayjs'
 import { observer } from 'mobx-react'
@@ -36,6 +38,9 @@ const EditableCell: React.FC<iEditableCellProps> = ({
     case 'DatePicker':
       cellNode = <DatePicker size="small" allowClear />
       break
+    case 'MoneyInput':
+      cellNode = <MoneyInput></MoneyInput>
+      break
     case 'Select':
       cellNode = <Select size="small">{commonStore.returnWayOptions.map(item => (<Option key={item} value={item}>{item}</Option>))}</Select>
       break
@@ -51,6 +56,10 @@ const EditableCell: React.FC<iEditableCellProps> = ({
   return (
     <td {...restProps}>
       {editing ? (
+        cellType === 'MoneyInput' ?
+        <Form.Item name={dataIndex} rules={[ { required: true, message: '请输入合同金额' } ]} className={styles.MoneyFormItem}>
+          {cellNode}
+        </Form.Item>:
         <Form.Item name={dataIndex} style={{ margin: 0 }} rules={[ dataIndex === 'remarks' ? {} : { required: true, message: `请${cellType === 'text' ? '输入' : '选择'}${title}!` } ]}>
           {cellNode}
         </Form.Item>
@@ -162,7 +171,7 @@ const Receivable: React.FC<ReceivableProps> = ({ updateTreeAndContract, type })
       editable: true,
       width: '12%',
       // eslint-disable-next-line react/display-name
-      render: (text: string) => <span className="pi-text-right pi-width-100P">{formatMoney(text)}</span>
+      render: (text: string) => <span className="pi-text-right pi-width-100P">{formatMoney(new BigNumber(text).toString())}</span>
     },
     {
       title: type === ContractType.INCOME ? '回款方式' : '支付方式',
@@ -240,11 +249,28 @@ const Receivable: React.FC<ReceivableProps> = ({ updateTreeAndContract, type })
     if (!col.editable) {
       return col
     }
+    let cellType = 'text'
+    switch (col.dataIndex) {
+      case 'createTime':
+        cellType = 'DatePicker'
+        break
+      case 'time':
+        cellType = 'DatePicker'
+        break
+      case 'way':
+        cellType = 'Select'
+        break
+      case 'price':
+        cellType = 'MoneyInput'
+        break
+      default:
+        break
+    }
     return {
       ...col,
       onCell: (record: iReceivableState) => ({
         record,
-        cellType: col.dataIndex === 'createTime' || col.dataIndex === 'time' ? 'DatePicker' : col.dataIndex === 'way' ? 'Select' : 'text',
+        cellType,
         dataIndex: col.dataIndex,
         title: col.title,
         editing: isEditing(record)

+ 10 - 1
src/pages/Dashboard/index.module.scss

@@ -30,14 +30,17 @@
       line-height: 1.2;
     }
   }
+  .cardFixedHeight {
+    height: calc(100vh - 34px - (1.5rem + 15px) * 2 - 18px - 1rem - 33px - 0.5rem);
+  }
   .card {
     display: flex;
     flex-direction: column;
+    overflow: hidden;
     word-wrap: break-word;
     background-color: #ffffff;
     background-clip: border-box;
     border: 1px solid rgba(0, 0, 0, 0.125);
-    border-radius: 0.25rem;
     .cardTitle {
       font-weight: 500;
       line-height: 1.2;
@@ -61,11 +64,17 @@
     }
     .cardBody {
       padding: 1.25rem;
+      overflow-y: auto;
       & > ul {
         padding-left: 0;
         margin: 0;
         list-style: none;
         & > li {
+          &:last-of-type {
+            padding-bottom: 0;
+            border-bottom: none;
+          }
+
           padding-bottom: 1rem;
           margin-bottom: 1rem;
           border-bottom: 1px solid #dee2e6;

+ 2 - 1
src/pages/Dashboard/index.scss

@@ -1,5 +1,5 @@
 .dashborad-content {
-  overflow-y: auto;
+  overflow: hidden;
   background: #e4e7ea;
 }
 
@@ -38,6 +38,7 @@
   margin-top: 0.5rem;
 }
 
+
 .list-group {
   padding: 0;
   margin: 0;

+ 4 - 4
src/pages/Dashboard/index.tsx

@@ -53,7 +53,7 @@ const Index = () => {
           <p className={styles.downtimeText}>系统将于 2019年3月10日 14:09 开始停机维护,持续30分钟。造成不便敬请谅解。</p>
         </div> */}
         <div className="pi-justify-between">
-          <div className={[ styles.card, 'pi-flex-quintuple' ].join(' ')}>
+          <div className={[ styles.card, styles.cardFixedHeight, 'pi-flex-quintuple' ].join(' ')}>
             <div className={styles.cardHeader}>
               <span>需要你处理</span>
             </div>
@@ -88,7 +88,7 @@ const Index = () => {
               }
             </div>
           </div>
-          <div className={[ styles.card, 'pi-flex-quintuple', 'pi-mg-lr-30' ].join(' ')}>
+          <div className={[ styles.card, styles.cardFixedHeight, 'pi-flex-quintuple', 'pi-mg-lr-30' ].join(' ')}>
             <div className={styles.cardHeader}>
               <span>需要你关注</span>
             </div>
@@ -129,8 +129,8 @@ const Index = () => {
             </div>
           </div>
           <div className="pi-flex-twice pi-flex-column">
-            <div className={styles.card}>
-              <div className={styles.cardBody}>
+            <div className={styles.card} style={{height: 'auto'}}>
+              <div className={styles.cardBody} >
                 <div className={styles.cardTitle}>
                   <h5>纵横技术支持</h5>
                   <h6 className="pi-muted">{userStore.projectInfo.staffName}</h6>

+ 1 - 1
src/types/contract.d.ts

@@ -114,7 +114,7 @@ export interface iEditableCellProps extends React.HTMLAttributes<HTMLElement> {
   editing: boolean
   dataIndex: string
   title: any
-  cellType: 'DatePicker' | 'text' | 'Select'
+  cellType: 'DatePicker' | 'text' | 'Select' | 'MoneyInput'
   record: iReceivableState
   index: number
   children: React.ReactNode

+ 0 - 2
src/utils/history.ts

@@ -1,6 +1,4 @@
 import { createBrowserHistory } from 'history'
 const createHistory = createBrowserHistory()
 
-console.log(createHistory)
-
 export default createHistory