Przeglądaj źródła

uas手机版
获取报表高级筛选配置

RaoMeng 5 lat temu
rodzic
commit
b53b69e5d1

+ 11 - 1
uas-office-web/uas-mobile/src/components/common/currencyDetail/CurrencyDetail.jsx

@@ -94,7 +94,7 @@ class CurrencyDetail extends Component {
       message.error('单据caller为空,单据获取失败')
     } else {
       const { formData } = this.props
-      if (!isObjEmpty(formData)) {
+      if (!isObjNull(formData)) {
         this.setState({
           billGroupList: formData,
         })
@@ -111,6 +111,16 @@ class CurrencyDetail extends Component {
     this.promptAlert && this.promptAlert.close()
   }
 
+  shouldComponentUpdate (nextProps, nextState, nextContext) {
+    if (isObjEmpty(this.state.billGroupList) &&
+      !isObjEmpty(nextProps.formData)) {
+      this.setState({
+        billGroupList: nextProps.formData,
+      })
+    }
+    return true
+  }
+
   render () {
     const { isDetail } = this.props
     let formItems = this.getFormItems()

+ 12 - 11
uas-office-web/uas-mobile/src/components/common/currencyList/CurrencyList.jsx

@@ -26,6 +26,7 @@ import { saveListState } from '../../../redux/actions/listState'
 import { LIST_PAGE_SIZE } from '../../../configs/constans.config'
 import CurrencyDetail from '../currencyDetail/CurrencyDetail'
 import { refreshFormState } from '../../../redux/actions/formState'
+import { getFormAndGrid } from '../../../utils/common/form.request'
 
 class CurrencyList extends Component {
 
@@ -70,6 +71,13 @@ class CurrencyList extends Component {
     } else {
       this.recoveryScroll()
     }
+    const {
+      requestSearchConfig,
+      formState: { filterGroupList },
+    } = this.props
+    if (isObjEmpty(filterGroupList) && !isObjNull(requestSearchConfig)) {
+      requestSearchConfig()
+    }
   }
 
   componentWillUnmount () {
@@ -182,6 +190,7 @@ class CurrencyList extends Component {
     const {
       params, formState: { filterGroupList },
     } = this.props
+    console.log(filterGroupList)
     return (
       <div
         className='currency-list-content-filter-content'>
@@ -238,9 +247,6 @@ class CurrencyList extends Component {
     saveListState({
       scrollTop: ReactDOM.findDOMNode(this.lv).scrollTop,
     })
-    refreshFormState({
-      filterGroupList: this.cd && this.cd.state.billGroupList,
-    })
     const { onItemClick } = this.props
     onItemClick && onItemClick(rowData)
   }
@@ -255,9 +261,6 @@ class CurrencyList extends Component {
     saveListState({
       scrollTop: ReactDOM.findDOMNode(this.lv).scrollTop,
     })
-    refreshFormState({
-      filterGroupList: this.cd && this.cd.state.billGroupList,
-    })
     const { onDocAdd } = this.props
     onDocAdd && onDocAdd()
   }
@@ -277,11 +280,9 @@ class CurrencyList extends Component {
   }
 
   onFilterCommit = () => {
-    // const { formState: { filterGroupList } } = this.props
-    // let formAndGrid = getFormAndGrid(filterGroupList)
-    // console.log(formAndGrid)
-    console.log(this.lv)
-    console.log(this.cd)
+    const filterGroupList = this.cd && this.cd.state.billGroupList
+    let formAndGrid = getFormAndGrid(filterGroupList)
+    console.log(formAndGrid)
   }
 }
 

+ 0 - 209
uas-office-web/uas-mobile/src/components/common/currencyList/visitApplyBill.js

@@ -1,209 +0,0 @@
-import BillGroupModel from '../../../model/common/BillGroupModel'
-import BillModel from '../../../model/common/BillModel'
-
-export function visitApplyBill () {
-  let billGroup = new BillGroupModel()
-  let billModel = new BillModel()
-  let now = new Date()
-  return ([
-    {
-      ...billGroup,
-      isForm: true,
-      group: '筛选条件',
-      showBillFields: [
-        {
-          ...billModel,
-          type: 'S',
-          caption: '单号',
-          field: 'name',
-          readOnly: 'F',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'F',
-        },
-        {
-          ...billModel,
-          type: 'S',
-          caption: '币别',
-          field: 'idCard',
-          readOnly: 'F',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'F',
-        },
-        {
-          ...billModel,
-          type: 'N',
-          caption: '手机号',
-          field: 'mobile',
-          readOnly: 'F',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'F',
-          // inputType: 'phone',
-        },
-        {
-          ...billModel,
-          type: 'S',
-          caption: '仓管员',
-          field: 'objectName',
-          readOnly: 'F',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'F',
-        },
-        {
-          ...billModel,
-          type: 'D',
-          caption: '日期',
-          field: 'visitTime',
-          readOnly: 'F',
-          value: now.getFullYear() + '-' + (now.getMonth() + 1) + '-' +
-            now.getDate(),
-          display: now.getTime(),
-          defValue: '',
-          allowBlank: 'F',
-        },
-      ],
-      hideBillFields: [
-        {
-          ...billModel,
-          type: 'S',
-          caption: '拜访者ID',
-          field: 'visitorId',
-          readOnly: 'T',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'T',
-        },
-        {
-          ...billModel,
-          type: 'S',
-          caption: '微信openid',
-          field: 'openid',
-          readOnly: 'T',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'T',
-        },
-        {
-          ...billModel,
-          type: 'S',
-          caption: '学校ID',
-          field: 'schoolId',
-          readOnly: 'T',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'T',
-        },
-      ],
-    },
-    {
-      ...billGroup,
-      isForm: false,
-      group: '条件明细',
-      lastInType: true,
-      showBillFields: [
-        {
-          ...billModel,
-          type: 'S',
-          caption: '单号',
-          field: 'name',
-          readOnly: 'F',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'F',
-        },
-        {
-          ...billModel,
-          type: 'S',
-          caption: '币别',
-          field: 'idCard',
-          readOnly: 'F',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'F',
-        },
-        {
-          ...billModel,
-          type: 'N',
-          caption: '手机号',
-          field: 'mobile',
-          readOnly: 'F',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'F',
-          // inputType: 'phone',
-        },
-        {
-          ...billModel,
-          type: 'S',
-          caption: '仓管员',
-          field: 'objectName',
-          readOnly: 'F',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'F',
-        },
-        {
-          ...billModel,
-          type: 'D',
-          caption: '日期',
-          field: 'visitTime',
-          readOnly: 'F',
-          value: now.getFullYear() + '-' + (now.getMonth() + 1) + '-' +
-            now.getDate(),
-          display: now.getTime(),
-          defValue: '',
-          allowBlank: 'F',
-        },
-      ],
-      hideBillFields: [
-        {
-          ...billModel,
-          type: 'S',
-          caption: '拜访者ID',
-          field: 'visitorId',
-          readOnly: 'T',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'T',
-        },
-        {
-          ...billModel,
-          type: 'S',
-          caption: '微信openid',
-          field: 'openid',
-          readOnly: 'T',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'T',
-        },
-        {
-          ...billModel,
-          type: 'S',
-          caption: '学校ID',
-          field: 'schoolId',
-          readOnly: 'T',
-          value: '',
-          display: '',
-          defValue: '',
-          allowBlank: 'T',
-        },
-      ],
-    },
-  ])
-}

+ 3 - 0
uas-office-web/uas-mobile/src/configs/api.config.js

@@ -46,6 +46,9 @@ export const API = {
     '/mobile/appweb/report/queryReportList.action',
   //获取报表列表
   REPORT_GETREPORTLIST: _baseURL + '/mobile/appweb/report/getOrderList.action',
+  //获取报表高级配置
+  REPORT_GETORDERSEARCHFORM: _baseURL +
+    '/mobile/appweb/report/getOrderSearchForm.action',
 
   /*******************************待办*************************************/
   //待办事项目列表

+ 21 - 4
uas-office-web/uas-mobile/src/pages/private/report/ReportList.jsx

@@ -12,11 +12,12 @@ import { API } from '../../../configs/api.config'
 import { LIST_PAGE_SIZE } from '../../../configs/constans.config'
 import { isObjEmpty } from '../../../utils/common/common.util'
 import { message } from 'antd'
-import { visitApplyBill } from '../../../components/common/currencyList/visitApplyBill'
 import { Drawer } from 'antd-mobile'
 import CurrencyListItem
   from '../../../components/common/currencyList/CurrencyListItem'
 import './report.less'
+import { getBillGroup } from '../../../utils/common/form.request'
+import { refreshFormState } from '../../../redux/actions/formState'
 
 class ReportList extends Component {
 
@@ -118,9 +119,25 @@ class ReportList extends Component {
    * 获取筛选条件配置
    */
   requestSearchConfig = () => {
-    const filterTest = new visitApplyBill()
-    saveListState({
-      filterList: filterTest,
+    fetchPostObj(API.REPORT_GETORDERSEARCHFORM, {
+      caller: this.props.match.params.caller,
+      id: this.props.match.params.id,
+    }).then(response => {
+      if (!isObjEmpty(response, response.data, response.data.list)) {
+        const formGroup = {
+          groupTitle: '筛选条件',
+          isForm: true,
+          fieldList: response.data.list,
+        }
+        const billGroup = getBillGroup(formGroup, 0)
+        const billGroupList = [billGroup]
+        console.log(billGroupList)
+        refreshFormState({
+          filterGroupList: billGroupList,
+        })
+      }
+    }).catch(error => {
+
     })
   }
 

+ 4 - 5
uas-office-web/uas-mobile/src/pages/private/service/ServiceList.jsx

@@ -12,7 +12,6 @@ import { Toast } from 'antd-mobile'
 import { fetchPostObj } from '../../../utils/common/fetchRequest'
 import { API } from '../../../configs/api.config'
 import { message } from 'antd'
-import { visitApplyBill } from '../../../components/common/currencyList/visitApplyBill'
 import { LIST_PAGE_SIZE } from '../../../configs/constans.config'
 import { refreshFormState } from '../../../redux/actions/formState'
 
@@ -129,10 +128,10 @@ class ServiceList extends Component {
    * 获取筛选条件配置
    */
   requestSearchConfig = () => {
-    const filterTest = new visitApplyBill()
-    refreshFormState({
-      filterGroupList: filterTest,
-    })
+    // const filterTest = new visitApplyBill()
+    // refreshFormState({
+    //   filterGroupList: filterTest,
+    // })
   }
 
   /**

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

@@ -71,7 +71,7 @@ export function getBillGroup (groupItem, groupIndex, isDetail) {
       // billModel.childIndex = filedIndex
       billModel.appwidth = fieldItem.appwidth
       billModel.length = fieldItem.length
-      billModel.isdefault = fieldItem.isdefault
+      billModel.isdefault = true || fieldItem.isdefault
       billModel.caption = fieldItem.caption
       billModel.type = fieldItem.type//前端类型
       billModel.sourcetype = fieldItem.sourcetype//字段原类型