Переглянути джерело

完善一波小细节。开始写查看

shaogen1995 1 рік тому
батько
коміт
a46a40416f

+ 7 - 6
src/components/Z3upFiles/index.tsx

@@ -10,6 +10,7 @@ import { EyeOutlined, UploadOutlined, CloseOutlined, DownloadOutlined } from '@a
 import classNames from 'classnames'
 import { baseURL } from '@/utils/http'
 import { authFilesLookFu } from '@/utils/authFilesLook'
+import { TopTypeType } from '@/pages/A2Abusiness/data'
 
 type Props = {
   max: number //最多传多少个文件
@@ -25,7 +26,7 @@ type Props = {
   tips?: string
   // 文件大小
   size?: number
-  topType: string
+  topType: TopTypeType
 }
 
 function Z3upFiles(
@@ -101,10 +102,10 @@ function Z3upFiles(
     [accept, dirCode, fileList, fromData, myUrl, size, topType, type]
   )
 
-  // 列表删除某一个文件 待完善
+  // 列表删除某一个文件
   const delImgListFu = useCallback(
-    (index: number) => {
-      const newItems = fileList.filter((v, i) => i !== index)
+    (id: number) => {
+      const newItems = fileList.filter(v => v.id !== id)
       setFileList(newItems)
     },
     [fileList, setFileList]
@@ -149,7 +150,7 @@ function Z3upFiles(
         ) : null}
 
         <div className='Z3files'>
-          {fileList.map((v, i) => (
+          {fileList.map(v => (
             <div className='Z3filesRow' key={v.id}>
               <div className='Z3files1' title={v.fileName}>
                 {v.fileName}
@@ -179,7 +180,7 @@ function Z3upFiles(
                   title='删除后无法恢复,是否删除?'
                   okText='删除'
                   cancelText='取消'
-                  onConfirm={() => delImgListFu(i)}
+                  onConfirm={() => delImgListFu(v.id)}
                   okButtonProps={{ loading: false }}
                 >
                   <CloseOutlined rev={undefined} title='删除' hidden={isLook} />

+ 2 - 1
src/components/ZRichTexts/index.tsx

@@ -18,6 +18,7 @@ import { baseURL } from '@/utils/http'
 import { forwardRef, useImperativeHandle } from 'react'
 import { API_upFile } from '@/store/action/layout'
 import { Button } from 'antd'
+import { TopTypeType } from '@/pages/A2Abusiness/data'
 
 export type SectionArrType = {
   id: number
@@ -30,7 +31,7 @@ type Props = {
   isLook: boolean //是否是查看进来
   ref: any //当前自己的ref,给父组件调用
   myUrl: string //上传的api地址
-  topType: string
+  topType: TopTypeType
 }
 
 function ZRichTexts({ check, dirCode, isLook, myUrl, topType }: Props, ref: any) {

+ 0 - 12
src/pages/A1Camera/A1Look/index.module.scss

@@ -1,12 +0,0 @@
-.AAAAA {
-  position: absolute;
-  top: 0;
-  left: 0;
-  width: 100%;
-  height: 100%;
-  z-index: 10;
-  border-radius: 10px;
-  background-color: #fff;
-  :global {
-  }
-}

+ 0 - 13
src/pages/A1Camera/A1Look/index.tsx

@@ -1,13 +0,0 @@
-import React from 'react'
-import styles from './index.module.scss'
-function A1Look() {
-  return (
-    <div className={styles.A1Look}>
-      <h1>A1Look</h1>
-    </div>
-  )
-}
-
-const MemoA1Look = React.memo(A1Look)
-
-export default MemoA1Look

+ 1 - 1
src/pages/A1Camera/data.ts

@@ -100,5 +100,5 @@ export const typeInOptions = [
 // 新增编辑的 type
 export type A1addType = {
   id: number
-  txt: '' | '新增' | '编辑' | '查看'
+  txt: '' | '新增' | '编辑'
 }

+ 3 - 6
src/pages/A1Camera/index.tsx

@@ -249,7 +249,8 @@ function A1Camera() {
         title: '操作',
         render: (item: A1ListType) => (
           <>
-            <Button size='small' type='text' onClick={() => setLookId(item.id)}>
+            {/* // 查看 待完善 */}
+            <Button size='small' type='text'>
               查看
             </Button>
             <Button
@@ -295,8 +296,7 @@ function A1Camera() {
     const obj = {
       '': '相机列表',
       新增: '相机列表-新增',
-      编辑: '相机列表-编辑',
-      查看: '相机列表-查看'
+      编辑: '相机列表-编辑'
     }
     return obj[openInfo.txt]
   }, [openInfo.txt])
@@ -304,9 +304,6 @@ function A1Camera() {
   // 上传xlsx 的ref
   const upXlsxRef = useRef<any>(null)
 
-  // 查看 待完善
-  const [lookId, setLookId] = useState(0)
-
   return (
     <div className={styles.A1Camera}>
       <div className='pageTitle'>{leftTitle}</div>

+ 4 - 0
src/pages/A2Abusiness/AddBusiness/index.module.scss

@@ -81,6 +81,10 @@
       }
       .formBox2 {
         margin-bottom: -10px;
+        .formBoxLL {
+          position: relative;
+          top: 4px;
+        }
       }
     }
     .A2AtableBoxAdd {

+ 4 - 3
src/pages/A2Abusiness/AddBusiness/index.tsx

@@ -11,9 +11,10 @@ import { mapDataAll3 } from '@/pages/C1User/AddUser/city'
 import UpXlsx from '@/components/UpXlsx'
 import AddCamera from '@/pages/A1Camera/AddCamera'
 import dayjs from 'dayjs'
+import { TopTypeType } from '../data'
 
 type Props = {
-  topType: string
+  topType: TopTypeType
   openInfo: A1addType
   closeFu: () => void
   upTableFu: () => void
@@ -223,7 +224,7 @@ function AddBusiness({ topType, openInfo, closeFu, upTableFu, addTableFu }: Prop
               <Z3upFiles
                 max={5}
                 accept='*'
-                isLook={openInfo.txt === '查看'}
+                isLook={false}
                 ref={listFilesRef}
                 fileCheck={false}
                 dirCode='A2business'
@@ -251,7 +252,7 @@ function AddBusiness({ topType, openInfo, closeFu, upTableFu, addTableFu }: Prop
               <ZRichTexts
                 check={false}
                 dirCode='A2business'
-                isLook={openInfo.txt === '查看'}
+                isLook={false}
                 ref={ZRichTextsRef1}
                 myUrl='cms/order/upload'
                 topType={topType}

+ 3 - 1
src/pages/A2Abusiness/data.ts

@@ -15,10 +15,12 @@ export type A2AFromDataType = {
   pageNum: number
 }
 
-export const A2AtopTypeArr = [
+export const A2AtopTypeArr: { name: string; key: TopTypeType }[] = [
   { name: '租赁', key: 'ZL' },
   { name: '销售', key: 'XS' },
   { name: '报修', key: 'BX' },
   { name: '定损', key: 'DS' },
   { name: '维修', key: 'WX' }
 ]
+
+export type TopTypeType = 'ZL' | 'XS' | 'BX' | 'DS' | 'WX'

+ 5 - 8
src/pages/A2Abusiness/index.tsx

@@ -1,7 +1,7 @@
 import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import { useDispatch, useSelector } from 'react-redux'
-import { A2AFromDataType, A2AtopTypeArr } from './data'
+import { A2AFromDataType, A2AtopTypeArr, TopTypeType } from './data'
 import { A2A_APIgetlist, A2A_APIgetlistDerive, A2A_APIremove } from '@/store/action/A2Abusiness'
 import { RootState } from '@/store'
 import { MessageFu } from '@/utils/message'
@@ -36,7 +36,7 @@ function A2Abusiness() {
   const dispatch = useDispatch()
 
   // 顶部的type 按钮
-  const [topType, setTopType] = useState('ZL')
+  const [topType, setTopType] = useState<TopTypeType>('ZL')
 
   // 筛选和分页
   const [tableSelect, setTableSelect] = useState(tableSelectBase)
@@ -258,7 +258,8 @@ function A2Abusiness() {
         title: '操作',
         render: (item: A2AListType) => (
           <>
-            <Button size='small' type='text' onClick={() => setLookId(item.id)}>
+            {/* // 查看 待完善 */}
+            <Button size='small' type='text'>
               查看
             </Button>
             <Button
@@ -293,8 +294,7 @@ function A2Abusiness() {
     const obj = {
       '': '业务订单',
       新增: '业务订单-新增',
-      编辑: '业务订单-编辑',
-      查看: '业务订单-查看'
+      编辑: '业务订单-编辑'
     }
     return obj[openInfo.txt]
   }, [openInfo.txt])
@@ -310,9 +310,6 @@ function A2Abusiness() {
     setTableSelect({ ...tableSelect, dateStart, dateEnd })
   }
 
-  // 查看 待完善
-  const [lookId, setLookId] = useState(0)
-
   return (
     <div className={styles.A2Abusiness}>
       <div className='pageTitle'>