shaogen1995 1 rok pred
rodič
commit
61c66baba2

+ 24 - 22
src/pages/A2Abusiness/AddBusiness/index.tsx

@@ -22,7 +22,7 @@ import { mapDataAll3 } from '@/pages/C1User/AddUser/city'
 import UpXlsx from '@/components/UpXlsx'
 import AddCamera from '@/pages/A1Camera/AddCamera'
 import dayjs from 'dayjs'
-import { A2AtopTypeArr, A2AtopTypeObj, TopTypeType } from '../data'
+import { A2AtopTypeEditLabel, A2AtopTypeObj, TopTypeType } from '../data'
 import { A2AListCamerasType } from '@/types'
 
 type Props = {
@@ -252,22 +252,24 @@ function AddBusiness({ topType, openInfo, closeFu, upTableFu, addTableFu }: Prop
           </div>
 
           <Form.Item
-            label={`${A2AtopTypeArr.find(v => v.key === topType)?.name}日期`}
+            label={`${A2AtopTypeEditLabel(topType)}日期`}
             name='dateStart'
             rules={[{ required: true, message: '请选择日期!' }]}
           >
             <DatePicker placeholder='请选择日期' />
           </Form.Item>
 
-          {['ZL'].includes(topType) ? (
-            <Form.Item label='预计归还日期' name='dateEnd'>
+          {['ZL', 'WX'].includes(topType) ? (
+            <Form.Item label={topType === 'ZL' ? '预计归还日期' : '完成日期'} name='dateEnd'>
               <DatePicker placeholder='请选择日期' />
             </Form.Item>
           ) : null}
 
-          {['BX', 'DS'].includes(topType) ? (
+          {['BX', 'DS', 'WX'].includes(topType) ? (
             <div className='formBox'>
-              <div className='formBoxLL'>{topType === 'BX' ? '问题描述' : '定损结果'}:</div>
+              <div className='formBoxLL'>
+                {topType === 'BX' ? '问题描述' : topType === 'DS' ? '定损结果' : '处理结果'}:
+              </div>
               <div className='formBoxRR'>
                 <ZRichTexts
                   check={false}
@@ -282,23 +284,23 @@ function AddBusiness({ topType, openInfo, closeFu, upTableFu, addTableFu }: Prop
           ) : null}
 
           {['DS'].includes(topType) ? (
-            <>
-              <Form.Item
-                label='定损报价'
-                name='price'
-                rules={[{ required: true, message: '请输入内容!' }]}
-              >
-                <InputNumber
-                  style={{ width: 300 }}
-                  placeholder='请输入数字,支持小数点后两位'
-                  precision={2}
-                />
-              </Form.Item>
+            <Form.Item
+              label='定损报价'
+              name='price'
+              rules={[{ required: true, message: '请输入内容!' }]}
+            >
+              <InputNumber
+                style={{ width: 300 }}
+                placeholder='请输入数字,支持小数点后两位'
+                precision={2}
+              />
+            </Form.Item>
+          ) : null}
 
-              <Form.Item label='报损单发送对象' name='user'>
-                <Input maxLength={30} showCount placeholder='请输入内容' />
-              </Form.Item>
-            </>
+          {['DS', 'WX'].includes(topType) ? (
+            <Form.Item label={topType === 'DS' ? '报损单发送对象' : '处理人'} name='user'>
+              <Input maxLength={30} showCount placeholder='请输入内容' />
+            </Form.Item>
           ) : null}
 
           <div className='formBox'>

+ 6 - 0
src/pages/A2Abusiness/data.ts

@@ -31,3 +31,9 @@ export const A2AtopTypeObj: any = {
   DS: '报损方',
   WX: '收货方'
 }
+
+export const A2AtopTypeEditLabel = (topType: TopTypeType) => {
+  let name = A2AtopTypeArr.find(v => v.key === topType)!.name
+  if (name === '维修') name = '送修'
+  return name
+}

+ 51 - 0
src/pages/ALookPage/A2WX/index.module.scss

@@ -1,4 +1,55 @@
 .A2WX {
+  position: absolute;
+  z-index: 10;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 15px 24px;
   :global {
+    .lookWXBtn {
+      text-align: end;
+      margin-bottom: 10px;
+      padding-right: 45px;
+    }
+
+    .lookWXBox {
+      width: 100%;
+      height: calc(100% - 42px);
+      position: relative;
+      overflow-y: auto;
+      .lookTit {
+        width: calc(100% - 30px);
+        font-weight: 700;
+        color: var(--themeColor);
+        font-size: 18px;
+        padding: 12px 0;
+        border-top: 1px solid #ccc;
+      }
+      .lookTit {
+        display: flex;
+        width: 1000px;
+        justify-content: space-between;
+      }
+    }
+
+    .lookWXBoxAdd {
+      position: absolute;
+      top: 0;
+      left: 0;
+      z-index: 100;
+      width: 100%;
+      height: 100%;
+      padding: 50px;
+      background-color: rgba(0, 0, 0, 0.6);
+      border-radius: 10px;
+      & > div {
+        position: relative;
+        width: 100%;
+        height: 100%;
+      }
+    }
   }
 }

+ 141 - 2
src/pages/ALookPage/A2WX/index.tsx

@@ -1,9 +1,148 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useState } from 'react'
 import styles from './index.module.scss'
+import { useParams } from 'react-router-dom'
+import { A2A_APIgetInfo, A2A_APIremove } from '@/store/action/A2Abusiness'
+import { Button } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { A1addType } from '@/pages/A1Camera/data'
+import { MessageFu } from '@/utils/message'
+import history from '@/utils/history'
+import { A2AListCamerasType, A2AListType } from '@/types'
+import AddBusiness from '@/pages/A2Abusiness/AddBusiness'
+import LookTxt from '../components/LookTxt'
+import { A2AtopTypeObj } from '@/pages/A2Abusiness/data'
+import LookTxt2 from '../components/LookTxt2'
+import LookTable from '../components/LookTable'
+import { lookTable2 } from '../components/LookTable/tableData'
+
 function A2WX() {
+  const urlObj: any = useParams()
+
+  const [urlId, setUrlId] = useState(0)
+
+  const [info, setInfo] = useState({} as A2AListType)
+
+  // 获取地址栏参数
+  useEffect(() => {
+    setUrlId(Number(urlObj.id))
+  }, [urlObj])
+
+  // 通过id获取详情
+  const getInfoFu = useCallback(async (id: number) => {
+    const res = await A2A_APIgetInfo(id)
+    if (res.code === 0) {
+      const data = res.data
+
+      const rtf = data.rtf || '{"isSection":"true","txtArr":[{"txt":"<p></p>"}]}'
+      const refObj = JSON.parse(rtf)
+
+      const rtfDesc = data.rtfDesc || '{"isSection":"true","txtArr":[{"txt":"<p></p>"}]}'
+      const rtfDescObj = JSON.parse(rtfDesc)
+      setInfo({
+        ...data,
+        cameras: data.cameras || [],
+        files: data.files || [],
+        rtf: refObj,
+        rtfDesc: rtfDescObj
+      })
+    }
+  }, [])
+
+  // 进页面发送请求
+  useEffect(() => {
+    if (urlId) {
+      getInfoFu(urlId)
+    }
+  }, [getInfoFu, urlId])
+
+  // 点击删除
+  const delFu = useCallback(async () => {
+    const res = await A2A_APIremove(urlId)
+    if (res.code === 0) {
+      MessageFu.success('删除成功!')
+      history.go(-1)
+    }
+  }, [urlId])
+
+  // 点击编辑
+  const [openInfo, setOpenInfo] = useState<A1addType>({ id: 0, txt: '' })
+
+  // 第二个信息标题
+  const tit2 = useMemo(() => {
+    return Reflect.get(A2AtopTypeObj, info.type)
+  }, [info.type])
+
   return (
     <div className={styles.A2WX}>
-      <div className='pageTitle'>业务订单-查看(租赁)</div>
+      <div className='pageTitle'>业务订单-查看(维修)</div>
+
+      <div className='lookWXBtn'>
+        <Button type='primary' onClick={() => setOpenInfo({ id: urlId, txt: '编辑' })}>
+          编辑
+        </Button>
+        &emsp;
+        <MyPopconfirm
+          txtK='删除'
+          loc='bottom'
+          onConfirm={() => delFu()}
+          Dom={<Button danger>删除</Button>}
+        />
+      </div>
+
+      {info.id ? (
+        <div className='lookWXBox'>
+          <div className='lookTit'>订单信息</div>
+
+          <LookTxt info={info} />
+
+          <div className='lookTit'>{tit2}信息</div>
+
+          <LookTxt2 info={info} tit2={tit2} />
+
+          <div className='lookTit'>相机清单</div>
+
+          <LookTable
+            list={info.cameras}
+            columnsTemp={lookTable2}
+            lastBtn={[
+              {
+                title: '操作',
+                render: (item: A2AListCamerasType) => (
+                  <Button
+                    size='small'
+                    type='text'
+                    onClick={() => history.push(`/lookList/${item.id}`)}
+                  >
+                    查看
+                  </Button>
+                )
+              }
+            ]}
+          />
+          {/* 待完善 */}
+          <div className='lookTit'>
+            <div>物流订单</div>
+            <div>
+              <Button type='primary'>新增出库</Button>
+            </div>
+          </div>
+        </div>
+      ) : null}
+
+      {/* 编辑 出来的页面 */}
+      {openInfo.id ? (
+        <div className='lookWXBoxAdd'>
+          <div>
+            <AddBusiness
+              topType={info.type}
+              openInfo={openInfo}
+              closeFu={() => setOpenInfo({ id: 0, txt: '' })}
+              upTableFu={() => getInfoFu(urlId)}
+              addTableFu={() => {}}
+            />
+          </div>
+        </div>
+      ) : null}
     </div>
   )
 }

+ 19 - 17
src/pages/ALookPage/components/LookTxt/index.tsx

@@ -2,7 +2,7 @@ import React, { useEffect, useRef } from 'react'
 import styles from './index.module.scss'
 import { A2AListType } from '@/types'
 import Z3upFiles from '@/components/Z3upFiles'
-import { A2AtopTypeArr } from '@/pages/A2Abusiness/data'
+import { A2AtopTypeEditLabel } from '@/pages/A2Abusiness/data'
 
 type Props = {
   info: A2AListType
@@ -44,21 +44,23 @@ function LookTxt({ info }: Props) {
 
       <div className='lLtxt'>
         <div className='lLtxtLeft'>
-          <span>*</span> {A2AtopTypeArr.find(v => v.key === info.type)?.name}日期 :
+          <span>*</span> {A2AtopTypeEditLabel(info.type)}日期 :
         </div>
         <div className='lLtxtRight'>{info.dateStart}</div>
       </div>
 
-      {['ZL'].includes(info.type) ? (
+      {['ZL', 'WX'].includes(info.type) ? (
         <div className='lLtxt'>
-          <div className='lLtxtLeft'>预计归还日期:</div>
+          <div className='lLtxtLeft'>{info.type === 'ZL' ? '预计归还日期' : '完成日期'}:</div>
           <div className='lLtxtRight'>{info.dateEnd || '(空)'}</div>
         </div>
       ) : null}
 
-      {['BX', 'DS'].includes(info.type) ? (
+      {['BX', 'DS', 'WX'].includes(info.type) ? (
         <div className='lLtxt'>
-          <div className='lLtxtLeft'>{info.type === 'BX' ? '问题描述' : '定损结果'}:</div>
+          <div className='lLtxtLeft'>
+            {info.type === 'BX' ? '问题描述' : info.type === 'DS' ? '定损结果' : '处理结果'}:
+          </div>
           <div
             className='lLtxtRight'
             dangerouslySetInnerHTML={{
@@ -69,19 +71,19 @@ function LookTxt({ info }: Props) {
       ) : null}
 
       {['DS'].includes(info.type) ? (
-        <>
-          <div className='lLtxt'>
-            <div className='lLtxtLeft'>
-              <span>*</span> 定损报价:
-            </div>
-            <div className='lLtxtRight'>{info.price || '(空)'}</div>
+        <div className='lLtxt'>
+          <div className='lLtxtLeft'>
+            <span>*</span> 定损报价:
           </div>
+          <div className='lLtxtRight'>{info.price || '(空)'}</div>
+        </div>
+      ) : null}
 
-          <div className='lLtxt'>
-            <div className='lLtxtLeft'>定损单发送对象:</div>
-            <div className='lLtxtRight'>{info.user || '(空)'}</div>
-          </div>
-        </>
+      {['DS', 'WX'].includes(info.type) ? (
+        <div className='lLtxt'>
+          <div className='lLtxtLeft'>{info.type === 'DS' ? '报损单发送对象' : '处理人'}:</div>
+          <div className='lLtxtRight'>{info.user || '(空)'}</div>
+        </div>
       ) : null}
 
       <div className='lLtxt'>