Procházet zdrojové kódy

feat: 优化打包体检

lanjianrong před 4 roky
rodič
revize
086240816a

+ 3 - 0
config/config.js

@@ -60,6 +60,9 @@ export default defineConfig({
   },
   exportStatic: {},
   esbuild: {},
+  nodeModulesTransform: {
+    type: 'none'
+  },
   fastRefresh: {},
   nodeModulesTransform: {
     type: 'none' // 提升编译速度加速,加速

+ 5 - 7
package.json

@@ -47,7 +47,7 @@
     "not ie <= 10"
   ],
   "dependencies": {
-    "@ant-design/charts": "^1.1.20",
+    "@ant-design/charts": "1.2.14",
     "@ant-design/icons": "^4.0.0",
     "@ant-design/pro-descriptions": "^1.0.19",
     "@ant-design/pro-form": "1.42.1",
@@ -58,21 +58,17 @@
     "ahooks": "^2.10.0",
     "antd": "4.16.12",
     "classnames": "^2.2.6",
-    "copy-to-clipboard": "^3.3.1",
     "crypto-js": "^4.0.0",
     "dayjs": "^1.10.4",
-    "dragm": "^0.0.5",
     "install": "^0.13.0",
-    "lodash": "^4.17.11",
+    "lodash-es": "^4.17.21",
     "omit.js": "^2.0.2",
     "qs": "^6.9.4",
     "react": "17.0.2",
     "react-copy-to-clipboard": "^5.0.4",
     "react-dom": "17.0.2",
     "react-helmet-async": "^1.0.4",
-    "umi": "3.5.4",
-    "upgrade": "^1.1.0",
-    "use-merge-value": "^1.0.1"
+    "umi": "3.5.4"
   },
   "devDependencies": {
     "@ant-design/pro-cli": "^1.0.18",
@@ -120,6 +116,8 @@
     "puppeteer-core": "^5.0.0",
     "stylelint": "^13.9.0",
     "typescript": "^4.0.3",
+    "upgrade": "^1.1.0",
+    "use-merge-value": "^1.0.1",
     "webpack": "^5.40.0",
     "windicss": "3.1.7",
     "windicss-webpack-plugin": "1.4.5"

+ 19 - 19
src/components/Modal/src/components/DragIniter.tsx

@@ -1,22 +1,22 @@
-/* eslint-disable */
-import React, { PureComponent } from 'react'
-import DragM from 'dragm'
+// /* eslint-disable */
+// import React, { PureComponent } from 'react'
+// import DragM from 'dragm'
 
-export default class DragIniter extends PureComponent<{ uid: string; title?: string }> {
-  updateTransform = transformStr => {
-    this.modalDom.style.transform = transformStr
-  }
+// export default class DragIniter extends PureComponent<{ uid: string; title?: string }> {
+//   updateTransform = transformStr => {
+//     this.modalDom.style.transform = transformStr
+//   }
 
-  componentDidMount() {
-    this.modalDom = document.getElementsByClassName(`d_${this.props.uid}`)[0]
-  }
+//   componentDidMount() {
+//     this.modalDom = document.getElementsByClassName(`d_${this.props.uid}`)[0]
+//   }
 
-  render() {
-    const { title } = this.props
-    return (
-      <DragM updateTransform={this.updateTransform}>
-        <div className="py-16px px-24px w-full min-h-56px">{title}</div>
-      </DragM>
-    )
-  }
-}
+//   render() {
+//     const { title } = this.props
+//     return (
+//       <DragM updateTransform={this.updateTransform}>
+//         <div className="py-16px px-24px w-full min-h-56px">{title}</div>
+//       </DragM>
+//     )
+//   }
+// }

+ 1 - 1
src/components/RightContent/Book/index.tsx

@@ -1,6 +1,6 @@
 import { useState, useEffect } from 'react'
 import ws, { CmdType, onMessage } from '@/utils/ws'
-import { debounce } from 'lodash'
+import { debounce } from 'lodash-es'
 import UesrList from './components/UserList'
 import { useModel } from 'umi'
 

+ 1 - 1
src/components/RightContent/NoticeIcon/index.tsx

@@ -1,6 +1,6 @@
 import { useCallback, useEffect, useState } from 'react'
 import { Tag, message } from 'antd'
-import { groupBy } from 'lodash'
+import { groupBy } from 'lodash-es'
 import { useModel } from 'umi'
 
 import NoticeIcon from './NoticeIcon'

+ 1 - 1
src/pages/Customer/Business/index.jsx

@@ -7,7 +7,7 @@ import AddBusiness from './components/AddBusiness'
 import Detail from './components/BusinessDetail'
 import { useModal } from '@/components/Modal'
 import CompanyDetail from '../Company/components/CompanyDetail'
-import { Funnel } from '@ant-design/charts'
+import Funnel from '@ant-design/charts/es/plots/funnel'
 import BasicTable from '@/components/Table'
 import { getAuthCache, getPermAuthCache, setAuthCache } from '@/utils/auth'
 import { PermDataTypeEunm } from '@/pages/Customer/Company/components/PermSelect'

+ 53 - 107
src/pages/Customer/Test/index.jsx

@@ -1,108 +1,54 @@
-import BasicTable from '@/components/Table'
-import consts from '@/consts'
-import { queryCompany } from '@/services/customer'
-import { refactorSortField } from '@/utils/utils'
-import React from 'react'
+// import * as echarts from 'echarts/core'
+// import { useEffect } from 'react'
+// // 引入柱状图图表,图表后缀都为 Chart
+// import { BarChart } from 'echarts/charts'
+// // 引入提示框,标题,直角坐标系,数据集,内置数据转换器组件,组件后缀都为 Component
+// import {
+//   TitleComponent,
+//   TooltipComponent,
+//   GridComponent,
+//   DatasetComponent,
+//   DatasetComponentOption,
+//   TransformComponent
+// } from 'echarts/components'
+// // 标签自动布局,全局过渡动画等特性
+// import { LabelLayout, UniversalTransition } from 'echarts/features'
+// // 引入 Canvas 渲染器,注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
+// import { CanvasRenderer } from 'echarts/renderers'
 
-export default function Index() {
-  const columns = [
-    {
-      title: '客户名称',
-      dataIndex: 'companyName',
-      width: 150,
-      fixed: 'left',
-      sorter: true
-    },
-    {
-      title: '地区',
-      dataIndex: 'districtName',
-      width: 100
-    },
-    {
-      title: '客户电话',
-      dataIndex: 'phone',
-      width: 80
-    },
-    {
-      title: '联系人',
-      dataIndex: 'clientTotal',
-      width: 80
-    },
-    {
-      title: '客户性质',
-      dataIndex: 'nature',
-      width: 80
-    },
-    {
-      title: '客户地址',
-      dataIndex: 'address',
-      width: 80
-    },
-    {
-      title: '客户传真',
-      dataIndex: 'fax',
-      width: 80
-    },
-    {
-      title: '网址',
-      dataIndex: 'webservice',
-      search: false,
-      width: 80
-    },
-    {
-      title: '乘车路线',
-      dataIndex: 'ride',
-      search: false,
-      width: 80
-    },
-    {
-      title: '地标建筑',
-      dataIndex: 'landmarks',
-      search: false,
-      width: 80
-    },
-    {
-      title: '参考住宿',
-      dataIndex: 'stay',
-      search: false,
-      width: 80
-    },
-    {
-      title: '备注',
-      dataIndex: 'remarks',
-      search: false,
-      width: 80
-    },
-    {
-      title: '创建人',
-      dataIndex: 'staffName',
-      search: false,
-      width: 80
-    }
-  ]
-  return (
-    <BasicTable
-      resizable={true}
-      columns={columns}
-      rowKey={row => row.id}
-      search={false}
-      headerTitle="客户列表"
-      mainMenuType="customer"
-      columnStateType="COMPANY"
-      rowSelection={{
-        type: 'checkbox',
-        columnWidth: 25
-      }}
-      request={async (params, sort, filter) => {
-        const srotOrder = refactorSortField(sort)
-        const { code = -1, data: { customer = [], total = 0 } = { customer: [], total: 0 } } =
-          await queryCompany({ ...params, ...srotOrder, ...filter })
-        return {
-          data: customer,
-          success: code === consts.RET_CODE.SUCCESS,
-          total
-        }
-      }}
-    />
-  )
-}
+// // 注册必须的组件
+// echarts.use([
+//   TitleComponent,
+//   TooltipComponent,
+//   GridComponent,
+//   DatasetComponent,
+//   TransformComponent,
+//   BarChart,
+//   LabelLayout,
+//   UniversalTransition,
+//   CanvasRenderer
+// ])
+
+// export default function Index() {
+//   useEffect(() => {
+//     const myChart = echarts.init(document.getElementById('mian11'))
+//     myChart.setOption({
+//       title: {
+//         text: 'ECharts 入门示例'
+//       },
+//       tooltip: {},
+//       xAxis: {
+//         data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
+//       },
+//       yAxis: {},
+//       series: [
+//         {
+//           name: '销量',
+//           type: 'bar',
+//           data: [5, 20, 36, 10, 10, 20]
+//         }
+//       ]
+//     })
+//   }, [])
+//   return <div id="mian11" style={{ width: '300px', height: '500px' }} />
+// }

+ 1 - 1
src/pages/Workbench/Dashboard/components/BusinessChar.jsx

@@ -1,4 +1,4 @@
-import { DualAxes } from '@ant-design/charts'
+import DualAxes from '@ant-design/charts/es/plots/dualAxes'
 import { Card, Select } from 'antd'
 import { connect } from 'umi'
 import React, { useEffect } from 'react'

+ 1 - 1
src/utils.js

@@ -1,5 +1,5 @@
 import utils, { importAll } from '@/src/basic/utils'
-import merge from 'lodash/merge'
+import merge from 'lodash-es/merge'
 
 const baseUtils = importAll(require.context('./utils', true, /\.js$/))