shaogen1995 1 anno fa
parent
commit
8542224eff

+ 3 - 0
src/assets/styles/base.css

@@ -168,3 +168,6 @@ textarea {
   border-radius: 10px;
   background: transparent;
 }
+.lLtxtRight p {
+  min-height: 10px;
+}

+ 7 - 0
src/assets/styles/base.less

@@ -271,3 +271,10 @@ textarea {
   border-radius: 10px;
   background: transparent;
 }
+
+// 查看的富文本 p标签的最小高度设置
+.lLtxtRight {
+  p {
+    min-height: 10px;
+  }
+}

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

@@ -1,7 +1,18 @@
 import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import { A1addType } from '@/pages/A1Camera/data'
-import { Button, DatePicker, Form, FormInstance, Input, Select, Table, Tag, Tooltip } from 'antd'
+import {
+  Button,
+  DatePicker,
+  Form,
+  FormInstance,
+  Input,
+  InputNumber,
+  Select,
+  Table,
+  Tag,
+  Tooltip
+} from 'antd'
 import { A2A_APIadd, A2A_APIgetInfo } from '@/store/action/A2Abusiness'
 import { MessageFu } from '@/utils/message'
 import ZRichTexts from '@/components/ZRichTexts'
@@ -93,9 +104,12 @@ function AddBusiness({ topType, openInfo, closeFu, upTableFu, addTableFu }: Prop
       // 回显 合同附件
       listFilesRef.current.sonFilesShowFu(data.files)
 
-      // 设置富文本
+      // 设置富文本-备注
       ZRichTextsRef1.current?.ritxtShowFu(JSON.parse(data.rtf))
 
+      // 设置富文本-问题描述
+      ZRichTextsRef2.current?.ritxtShowFu(JSON.parse(data.rtfDesc))
+
       // 回显表格
       setTableList(
         data.cameras.map((v: any) => ({
@@ -143,14 +157,17 @@ function AddBusiness({ topType, openInfo, closeFu, upTableFu, addTableFu }: Prop
       const zlProvince = value.city.split('-')[0]
       const zlCity = value.city.split('-')[1]
 
-      // 富文本
+      // 富文本-备注
       const rtf = ZRichTextsRef1.current?.fatherBtnOkFu() || { flag: true }
+      // 富文本-问题描述
+      const rtfDesc = ZRichTextsRef2.current?.fatherBtnOkFu() || { flag: true }
 
       const obj = {
         ...value,
         id: openInfo.txt === '新增' ? null : openInfo.id,
         fileIds: listFilesRes.join(','),
         rtf: JSON.stringify(rtf.val || ''),
+        rtfDesc: JSON.stringify(rtfDesc.val || ''),
         cameras: tableList,
         dateStart,
         dateEnd,
@@ -182,6 +199,7 @@ function AddBusiness({ topType, openInfo, closeFu, upTableFu, addTableFu }: Prop
 
   // 富文本的ref
   const ZRichTextsRef1 = useRef<any>(null)
+  const ZRichTextsRef2 = useRef<any>(null)
 
   // 合同附件的ref
   const listFilesRef = useRef<any>(null)
@@ -247,6 +265,42 @@ function AddBusiness({ topType, openInfo, closeFu, upTableFu, addTableFu }: Prop
             </Form.Item>
           ) : null}
 
+          {['BX', 'DS'].includes(topType) ? (
+            <div className='formBox'>
+              <div className='formBoxLL'>{topType === 'BX' ? '问题描述' : '定损结果'}:</div>
+              <div className='formBoxRR'>
+                <ZRichTexts
+                  check={false}
+                  dirCode='A2business'
+                  isLook={false}
+                  ref={ZRichTextsRef2}
+                  myUrl='cms/order/upload'
+                  topType={topType}
+                />
+              </div>
+            </div>
+          ) : 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='user'>
+                <Input maxLength={30} showCount placeholder='请输入内容' />
+              </Form.Item>
+            </>
+          ) : null}
+
           <div className='formBox'>
             <div className='formBoxLL'>备注:</div>
             <div className='formBoxRR'>

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

@@ -1,4 +1,55 @@
 .A2BX {
+  position: absolute;
+  z-index: 10;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 15px 24px;
   :global {
+    .lookBXBtn {
+      text-align: end;
+      margin-bottom: 10px;
+      padding-right: 45px;
+    }
+
+    .lookBXBox {
+      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;
+      }
+    }
+
+    .lookBXBoxAdd {
+      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 - 1
src/pages/ALookPage/A2BX/index.tsx

@@ -1,9 +1,149 @@
-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 A2BX() {
+  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.A2BX}>
       <div className='pageTitle'>业务订单-查看(报修)</div>
+
+      <div className='lookBXBtn'>
+        <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='lookBXBox'>
+          <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='lookBXBoxAdd'>
+          <div>
+            <AddBusiness
+              topType={info.type}
+              openInfo={openInfo}
+              closeFu={() => setOpenInfo({ id: 0, txt: '' })}
+              upTableFu={() => getInfoFu(urlId)}
+              addTableFu={() => {}}
+            />
+          </div>
+        </div>
+      ) : null}
     </div>
   )
 }

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

@@ -1,4 +1,55 @@
 .A2XS {
+  position: absolute;
+  z-index: 10;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 15px 24px;
   :global {
+    .lookXSBtn {
+      text-align: end;
+      margin-bottom: 10px;
+      padding-right: 45px;
+    }
+
+    .lookXSBox {
+      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;
+      }
+    }
+
+    .lookXSBoxAdd {
+      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%;
+      }
+    }
   }
 }

+ 137 - 1
src/pages/ALookPage/A2XS/index.tsx

@@ -1,9 +1,145 @@
-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 A2XS() {
+  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)
+      setInfo({
+        ...data,
+        cameras: data.cameras || [],
+        files: data.files || [],
+        rtf: refObj
+      })
+    }
+  }, [])
+
+  // 进页面发送请求
+  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.A2XS}>
       <div className='pageTitle'>业务订单-查看(销售)</div>
+
+      <div className='lookXSBtn'>
+        <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='lookXSBox'>
+          <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='lookXSBoxAdd'>
+          <div>
+            <AddBusiness
+              topType={info.type}
+              openInfo={openInfo}
+              closeFu={() => setOpenInfo({ id: 0, txt: '' })}
+              upTableFu={() => getInfoFu(urlId)}
+              addTableFu={() => {}}
+            />
+          </div>
+        </div>
+      ) : null}
     </div>
   )
 }

+ 20 - 5
src/pages/ALookPage/components/LookTxt/index.tsx

@@ -2,6 +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'
 
 type Props = {
   info: A2AListType
@@ -43,15 +44,29 @@ function LookTxt({ info }: Props) {
 
       <div className='lLtxt'>
         <div className='lLtxtLeft'>
-          <span>*</span> 租赁日期 :
+          <span>*</span> {A2AtopTypeArr.find(v => v.key === info.type)?.name}日期 :
         </div>
         <div className='lLtxtRight'>{info.dateStart}</div>
       </div>
 
-      <div className='lLtxt'>
-        <div className='lLtxtLeft'>预计归还日期:</div>
-        <div className='lLtxtRight'>{info.dateEnd || '(空)'}</div>
-      </div>
+      {['ZL'].includes(info.type) ? (
+        <div className='lLtxt'>
+          <div className='lLtxtLeft'>预计归还日期:</div>
+          <div className='lLtxtRight'>{info.dateEnd || '(空)'}</div>
+        </div>
+      ) : null}
+
+      {['BX'].includes(info.type) ? (
+        <div className='lLtxt'>
+          <div className='lLtxtLeft'>问题描述:</div>
+          <div
+            className='lLtxtRight'
+            dangerouslySetInnerHTML={{
+              __html: info.rtfDesc.isSection ? '(空)' : info.rtfDesc.txtArr[0].txt
+            }}
+          ></div>
+        </div>
+      ) : null}
 
       <div className='lLtxt'>
         <div className='lLtxtLeft'>备注:</div>

+ 1 - 1
src/types/api/A2Abusiness.ts

@@ -25,7 +25,7 @@ export type A2AListType = {
   pcs: number
   price?: any
   rtf: { isSection: boolean; txtArr: { txt: string }[] }
-  rtfDesc: string
+  rtfDesc: { isSection: boolean; txtArr: { txt: string }[] }
   type: TopTypeType
   updateTime: string
   user: string