zl 5 éve
szülő
commit
db2cfe5949
4 módosított fájl, 34 hozzáadás és 36 törlés
  1. 19 5
      src/apis/index.js
  2. 2 4
      src/layouts/mainLayout/index.js
  3. 2 12
      src/pages/dc/index.js
  4. 11 15
      src/pages/dc/list.js

+ 19 - 5
src/apis/index.js

@@ -17,18 +17,32 @@ export function login (data) {
 }
 
 export function fetchApi (url, params) {
-  if (params && params.method === 'POST') {
+  if (params.body) {
     return request({
       method: 'POST',
       url,
-      data: params.body,
+      data: params.body
     })
   } else {
     return request({
-      method: 'get',
+      method: 'POST',
       url,
-      params,
-      data: {}
+      data: params
     })
   }
+
+  // if (params && params.method === 'POST') {
+  //   return request({
+  //     method: 'POST',
+  //     url,
+  //     data: params.body,
+  //   })
+  // } else {
+  //   return request({
+  //     method: 'get',
+  //     url,
+  //     params,
+  //     data: {}
+  //   })
+  // }
 }

+ 2 - 4
src/layouts/mainLayout/index.js

@@ -52,10 +52,8 @@ export default class MainLayout extends React.PureComponent {
                     <Icon type="code-sandbox"/>
                     <span>数据中心</span>
                   </span>}>
-                <Menu.Item key="1" onClick={() => { router.push('/dc') }}>用户报表</Menu.Item>
-                <Menu.Item key="2" onClick={() => { router.push('/dc/sheet') }}>数据报表</Menu.Item>
-                <Menu.Item key="3">订单报表</Menu.Item>
-                <Menu.Item key="4">拍品报表</Menu.Item>
+                <Menu.Item key="1" onClick={() => { router.push('/dc') }}>数据管理</Menu.Item>
+                <Menu.Item key="2" onClick={() => { router.push('/dc/list') }}>数据报表</Menu.Item>
               </SubMenu>
             </Menu>
           </Sider>

+ 2 - 12
src/pages/dc/index.js

@@ -1,12 +1,11 @@
 import React from 'react'
 import { connect } from 'dva'
-import { message, Divider, Popconfirm } from 'antd'
+import { Divider, message, Popconfirm } from 'antd'
 import { FilterTable } from 'wptpc-design'
-import router from 'umi/router'
 import s from './index.less'
 import Edit from './components/Edit'
 import { dc } from '@/conf/config'
-// const apiUrl = 'http://localhost:9090/dc/web/get-rule-list'
+
 const apiUrl = `${dc}/dc/web/get-rule-list`
 
 @connect(({ loading }) => ({
@@ -69,8 +68,6 @@ class Index extends React.PureComponent {
         title: '描述',
         dataIndex: 'desc'
       },
-      // { title: '创建时间', dataIndex: 'createTime' },
-      // { title: '更新时间', dataIndex: 'modifyTime' },
       {
         title: '操作',
         dataIndex: 'actions',
@@ -97,13 +94,6 @@ class Index extends React.PureComponent {
         label: '创建',
         type: 'primary',
         onClick: () => this.editItem({ fieldsJson: '{}' })
-      },
-      {
-        label: '全部规则列表',
-        type: '',
-        onClick: () => {
-          router.push('/dc/list')
-        }
       }
     ]
   }

+ 11 - 15
src/pages/dc/list.js

@@ -2,6 +2,7 @@ import React from 'react'
 import { FilterTable } from 'wptpc-design'
 import s from './index.less'
 import { dc } from '@/conf/config'
+
 const apiUrl = `${dc}/dc/web/get-all-rule-field`
 
 class List extends React.PureComponent {
@@ -11,11 +12,16 @@ class List extends React.PureComponent {
   }
 
   filterSetting = {
-    // isClearSearch: true,
-    // formFields: [
-    //   { label: 'ID:', type: 'input', key: 'id', placeholder: '请输入账户ID' },
-    // ],
-    // // 在接口请求前,可以修改给接口的入参
+    isClearSearch: true,
+    formFields: [
+      {
+        label: '描述:',
+        type: 'input',
+        key: 'desc',
+        placeholder: '请输入相关描述'
+      }
+    ]
+    // 在接口请求前,可以修改给接口的入参
     // beforeSearchFunc: params => {
     //   params.pageNum = params.pageNum
     // }
@@ -46,22 +52,12 @@ class List extends React.PureComponent {
         dataIndex: 'url'
       }
     ],
-    // 通过这个函数可以获取列表的刷新的函数,编辑、删除后可以用它来刷新列表
     getRefresh: refresh => {
       this.refresh = refresh
     }
-    // 筛选和列表的中间位置如果有批量操作按钮,可以放在这个位置
-    // batchBtns: [{
-    //   label: '创建',
-    //   type: 'primary',
-    //   onClick: () => this.editItem({ fieldsJson: '{}' })
-    // }]
   }
 
   render () {
-    // const { showModal, params } = this.state
-    // const { actionLoading } = this.props
-
     return (
       <div className={s.templatePage}>
         <FilterTable filterSetting={this.filterSetting} tableSetting={this.tableSetting} apiUrl={apiUrl} isPage={false}/>