2 Komitmen 0e1d16f2be ... b3257cd870

Pembuat SHA1 Pesan Tanggal
  touchitvoid b3257cd870 feat: 投诉建议相关 2 tahun lalu
  touchitvoid 48d0ed2165 fix: 报时报修接口fix 2 tahun lalu

+ 2 - 2
src/services/complaint.ts

@@ -10,8 +10,8 @@ export const ComplaintApi = params => {
 }
 
 // 获取投诉详情 /api/v1/suggestion/order/info
-export const GetComplaintInfo = () => request({
-  url: '/suggestion/order/info',
+export const GetComplaintInfo = search => request({
+  url: '/suggestion/order/info' + search,
   method: 'get'
 })
 

+ 4 - 3
src/services/fix.ts

@@ -10,9 +10,10 @@ export const FixApi = params => {
 }
 
 // 获取报事报修详情 /api/v1/repair/order/info
-export const GetFixOrderInfo = () => request({
-  url: '/repair/order/info',
-  method: 'get'
+export const GetFixOrderInfo = search => request({
+  url: '/repair/order/info' + search,
+  method: 'get',
+
 })
 
 // 派单

+ 5 - 0
src/utils.ts

@@ -0,0 +1,5 @@
+// 切割时间戳
+export const GetTimeStamp = time => {
+  return +new Date(time).valueOf().toString().substring(0, 10)
+}
+  

+ 17 - 7
src/views/Complaint/handle.tsx

@@ -80,24 +80,28 @@ const ComplaintHandle: React.FC = (props: any) => {
           <Button
             className="mr-1.5"
             onClick={() => {
+              orderForm.resetFields()
               setState(prevState => ({
                 ...prevState,
-                formMode: 'return',
-                orderVisible: true
+                formMode: 'refund',
+                orderVisible: true,
+                editId: row.id
               }))
             }}
           >退单</Button>,
           <Button
             className="mr-1.5"
             onClick={() => {
-              props.history.push('/admin/fix/order-detail')
+              props.history.push(`/admin/complaint/detail?id=${row.id}`)
             }}
           >详情</Button>,
           <Button onClick={() => {
+            orderForm.resetFields()
             setState(prevState => ({
               ...prevState,
               formMode: 'finish',
-              orderVisible: true
+              orderVisible: true,
+              editId: row.id
             }))
           }}>办结</Button>
         ]
@@ -156,7 +160,7 @@ const ComplaintHandle: React.FC = (props: any) => {
   </React.Fragment>
 
   const Forms = {
-    return: ChargeBackForm,
+    refund: ChargeBackForm,
     finish: FinishForm,
     send: SendForm
   }
@@ -171,7 +175,7 @@ const ComplaintHandle: React.FC = (props: any) => {
       finish: ComplaintOrderFinish
     }
     orderForm.validateFields().then(async values => {
-      await _Api[state.formMode]({ ...values, id: state.editId })
+      await _Api[state.formMode]({ ...values, id: state.editId, current_uid: 1 })
       message.success('操作成功!')
       orderForm.resetFields()
       actionRef.current?.reloadAndRest()
@@ -179,6 +183,12 @@ const ComplaintHandle: React.FC = (props: any) => {
     })
   }
 
+  const titleMap = {
+    refund: '退单',
+    finish: '办结工单',
+    send: '转单'
+  }
+
   return (
     <React.Fragment>
       <ProTable
@@ -190,7 +200,7 @@ const ComplaintHandle: React.FC = (props: any) => {
         columns={columns}
       />
       <Modal
-        title='转单'
+        title={titleMap[state.formMode]}
         visible={state.orderVisible}
         onOk={onSubmit}
         onCancel={() => setState(pre => ({ ...pre, orderVisible: false }))}

+ 21 - 5
src/views/Complaint/index.tsx

@@ -59,11 +59,21 @@ const ComplaintPage: React.FC = (props: any) => {
       dataIndex: 'option',
       search: false,
       render: (_, row, index, action) => {
-        return [
+        const DETAIL_BUTTON = <Button
+          className="mr-1.5"
+          onClick={() => {
+            props.history.push(`/admin/complaint/detail?id=${row.id}`)
+          }}
+        >详情</Button>
+        return ['已派单', '已完结'].includes(row.status) ? DETAIL_BUTTON : [
           <Button
             className="mr-1.5"
             onClick={() => {
               form.setFieldsValue(row)
+              setPic(row.apply_pic.map(url => ({
+                thumbUrl: url,
+                response: { data: url }
+              })))
               setState(prevState => ({
                 ...prevState,
                 visible: true,
@@ -73,12 +83,18 @@ const ComplaintPage: React.FC = (props: any) => {
           >编辑</Button>,
           <Button
             className="mr-1.5"
-            onClick={() => {}}
+            onClick={() => {
+              setState(prevState => ({
+                ...prevState,
+                orderVisible: true,
+                editId: row.id
+              }))
+            }}
           >派单</Button>,
           <Button
             className="mr-1.5"
             onClick={() => {
-              props.history.push('/admin/complaint/detail')
+              props.history.push(`/admin/complaint/detail?id=${row.id}`)
             }}
           >详情</Button>,
           <Button onClick={() => {
@@ -136,7 +152,7 @@ const ComplaintPage: React.FC = (props: any) => {
   const [orderForm] = Form.useForm()
   const handleSendOrder = () => {
     orderForm.validateFields().then(async values => {
-      await ComplaintOrderSend({ ...values, id: state.editId })
+      await ComplaintOrderSend({ ...values, id: state.editId, current_uid: 1 })
       message.success('操作成功!')
       orderForm.resetFields()
       actionRef.current?.reloadAndRest()
@@ -173,7 +189,7 @@ const ComplaintPage: React.FC = (props: any) => {
           wrapperCol={{ span: 15 }}
           form={orderForm}
         >
-          <Form.Item label='报修师傅' name="current_uid" rules={[{ required: true }]}>
+          <Form.Item label='处理对象' name="current_uid" rules={[{ required: true }]}>
             <Select placeholder='请选择' options={cUsers} />
           </Form.Item>
           <Form.Item label='处理意见' name="feedback" rules={[{ required: true }]}>

+ 29 - 19
src/views/Complaint/order-detail.tsx

@@ -6,19 +6,19 @@ import { GetComplaintInfo } from "../../services/complaint"
 const columns = [
   {
     title: 'ID',
-    dataIndex: ''
+    dataIndex: 'id'
   },
   {
     title: '处理人',
-    dataIndex: ''
+    dataIndex: 'user'
   },
   {
     title: '状态',
-    dataIndex: ''
+    dataIndex: 'status'
   },
   {
     title: '处理时间',
-    dataIndex: ''
+    dataIndex: 'handle_time'
   },
   {
     title: '意见',
@@ -26,22 +26,30 @@ const columns = [
   },
 ]
 const infoKeys = [
-  { label: '分类名称', key: '' },
-  { label: '联系地址', key: '' },
-  { label: '报修人', key: '' },
-  { label: '联系方式', key: '' },
-  { label: '预约时间', key: '' },
-  { label: '报修时间', key: '' },
-  { label: '报修内容', key: '' },
-  { label: '报修图片', key: '', col: 24, type: 'picture' },
+  { label: '投诉类型', key: 'suggestion_type' },
+  { label: '联系人', key: 'apply_people' },
+  { label: '联系方式', key: 'apply_people_phone' },
+  { label: '投诉内容', key: 'apply_content' },
+  { label: '投诉图片', key: '', col: 24, type: 'picture' },
 ]
 
 const OrderDetail: React.FC = () => {
 
-  const history = useHistory()
+  const history: any = useHistory()
+  const [orderInfo, setOrderInfo]: any = React.useState({
+    base_info: {
+      apply_pic: []
+    }
+  })
+
+  const statusItems = { 1: '投诉', 2: '建议' }
+  const visitLevel = { 1: '满意', 2: '不满意' }
 
   React.useEffect(() => {
-    GetComplaintInfo()
+    GetComplaintInfo(history.location.search).then((res: any) => {
+      res.base_info.suggestion_type = statusItems[res.base_info.suggestion_type]
+      setOrderInfo(res)
+    })
   }, [])
 
   return (
@@ -61,8 +69,10 @@ const OrderDetail: React.FC = () => {
                 <Col span={item.col || 8}>
                   <Form.Item label={item.label}>
                     { item.type === 'picture' ? (
-                      <Image className="mr-1.5" width={120} src="https://hbimg.huabanimg.com/683615e8e5dd8c4660efbdf1fbc3c26f1da40cae2a7a7-fcKebd_fw658/format/webp" />
-                    ) : item.label }
+                      orderInfo.base_info.apply_pic.map(url =>
+                        <Image width={100} src={url} />
+                      )
+                    ) : orderInfo?.base_info[item.key] }
                   </Form.Item>
                 </Col>
               ))
@@ -72,13 +82,13 @@ const OrderDetail: React.FC = () => {
       </Card>
       <Divider />
       <Card title="工单流转">
-        <Table columns={columns} bordered />
+        <Table dataSource={orderInfo.list} columns={columns} bordered />
       </Card>
       <Divider />
       <Card title="回访/业主评价">
         <Form>
-          <Form.Item label="满意度">xxxxxx</Form.Item>
-          <Form.Item label="业主评价">xxxxxxxxxxxxxxxxxx</Form.Item>
+          <Form.Item label="满意度">{ visitLevel[orderInfo.base_info?.return_visit_level] || '暂无' }</Form.Item>
+          <Form.Item label="业主评价">{ orderInfo.base_info?.return_visit_content || '暂无评价' }</Form.Item>
         </Form>
       </Card>
     </React.Fragment>

+ 3 - 17
src/views/Complaint/return-visit.tsx

@@ -3,7 +3,7 @@ import type { ActionType } from '@ant-design/pro-table'
 import ProTable from '@ant-design/pro-table'
 import { Button, Modal, Form, Input, message, Select } from 'antd'
 import { withRouter } from 'react-router-dom'
-import { ComplaintOrderFinish, ComplaintApi } from '../../services/complaint'
+import { ComplaintOrderReturnVisit, ComplaintApi } from '../../services/complaint'
 import './index.scss'
 
 const ComplaintReturnVisit: React.FC = (props: any) => {
@@ -52,16 +52,6 @@ const ComplaintReturnVisit: React.FC = (props: any) => {
         3: { text: '已完结' },
       }
     },
-    {
-      title: '状态',
-      dataIndex: 'status',
-      search: false,
-      valueEnum: {
-        1: { text: '未派单' },
-        2: { text: '已派单' },
-        3: { text: '已完结' },
-      }
-    },
     {
       title: '操作',
       dataIndex: 'option',
@@ -71,10 +61,8 @@ const ComplaintReturnVisit: React.FC = (props: any) => {
           <Button
             className="mr-1.5"
             onClick={() => {
-              orderForm.setFieldsValue(row)
               setState(prevState => ({
                 ...prevState,
-                formMode: 'send',
                 orderVisible: true,
                 editId: row.id
               }))
@@ -82,9 +70,7 @@ const ComplaintReturnVisit: React.FC = (props: any) => {
           >回访</Button>,
           <Button
             className="mr-1.5"
-            onClick={() => {
-              props.history.push('/admin/fix/order-detail')
-            }}
+            onClick={() => props.history.push(`/admin/complaint/detail?id=${row.id}`)}
           >详情</Button>,
         ]
       }
@@ -102,7 +88,7 @@ const ComplaintReturnVisit: React.FC = (props: any) => {
 
   const onSubmit = () => {
     orderForm.validateFields().then(async values => {
-      await ComplaintOrderFinish({ ...values, id: state.editId })
+      await ComplaintOrderReturnVisit({ ...values, id: state.editId })
       message.success('操作成功!')
       orderForm.resetFields()
       actionRef.current?.reloadAndRest()

+ 30 - 13
src/views/Fix/online-form.tsx

@@ -9,6 +9,8 @@ import { PlusOutlined } from "@ant-design/icons"
 import { useFixClass } from "./hooks"
 import { useBuildingHouse } from "../building/hooks"
 import { useUser } from "../User/hooks"
+import { GetTimeStamp } from "../../utils"
+import moment from "moment"
 
 const FixOnlineForm: React.FC = (props: any) => {
   const columns: any = [
@@ -69,11 +71,22 @@ const FixOnlineForm: React.FC = (props: any) => {
       dataIndex: 'option',
       search: false,
       render: (_, row, index, action) => {
-        return [
+        const DETAIL_BUTTON = <Button
+          className="mr-1.5"
+          onClick={() => {
+            props.history.push(`/admin/fix/order-detail?id=${row.id}`)
+          }}
+        >详情</Button>
+        return ['已派单', '已完结'].includes(row.status) ? DETAIL_BUTTON : [
           <Button
             className="mr-1.5"
             onClick={() => {
+              row.appointment = moment(row.appointment)
               form.setFieldsValue(row)
+              setPic(row.apply_pic.map(url => ({
+                thumbUrl: url,
+                response: { data: url }
+              })))
               setState(prevState => ({
                 ...prevState,
                 visible: true,
@@ -86,16 +99,12 @@ const FixOnlineForm: React.FC = (props: any) => {
             onClick={() => {
               setState(prevState => ({
                 ...prevState,
-                orderVisible: true
+                orderVisible: true,
+                editId: row.id
               }))
             }}
           >派单</Button>,
-          <Button
-            className="mr-1.5"
-            onClick={() => {
-              props.history.push('/admin/fix/order-detail')
-            }}
-          >详情</Button>,
+          DETAIL_BUTTON,
           <Button onClick={() => {
             Modal.confirm({
               title: '删除记录',
@@ -145,7 +154,7 @@ const FixOnlineForm: React.FC = (props: any) => {
         method: state.editId ? 'put' : 'post',
         ...values,
         apply_pic: pic.map(({ response }) => response.data),
-        appointment: values.appointment.valueOf(),
+        appointment: GetTimeStamp(values.appointment),
         id: state.editId,
         // garden_id: 3,
       })
@@ -158,7 +167,7 @@ const FixOnlineForm: React.FC = (props: any) => {
 
   const handleSendOrder = () => {
     orderForm.validateFields().then(async values => {
-      await FixOrderSend({ ...values, id: state.editId })
+      await FixOrderSend({ ...values, id: state.editId, current_uid: 1 })
       message.success('操作成功!')
       orderForm.resetFields()
       actionRef.current?.reloadAndRest()
@@ -178,7 +187,9 @@ const FixOnlineForm: React.FC = (props: any) => {
             type="primary"
             key="primary"
             onClick={() => {
-              setState(preState => ({ ...preState, visible: true }))
+              form.resetFields()
+              setPic([])
+              setState(preState => ({ ...preState, visible: true, editId: null }))
             }}
           >添加</Button>
         ]}
@@ -204,7 +215,7 @@ const FixOnlineForm: React.FC = (props: any) => {
         </Form>
       </Modal>
       <Modal
-        title='添加报修'
+        title={state.editId ? '编辑报修': '添加报修'}
         visible={state.visible}
         onOk={onSubmit}
         onCancel={() => setState(pre => ({ ...pre, visible: false }))}
@@ -224,7 +235,7 @@ const FixOnlineForm: React.FC = (props: any) => {
             <Input placeholder="请输入" />
           </Form.Item>
           <Form.Item label='预约时间' name="appointment" rules={[{ required: true }]}>
-            <DatePicker showTime placeholder="选择时间" format="YYYY-MM-DD" />
+            <DatePicker showTime placeholder="选择时间" format="YYYY-MM-DD HH:mm" />
           </Form.Item>
           <Form.Item label='报修内容' name="apply_content" rules={[{ required: true }]}>
             <Input.TextArea placeholder="多行输入" rows={4} />
@@ -237,6 +248,12 @@ const FixOnlineForm: React.FC = (props: any) => {
               onChange={(({ fileList }) => setPic(fileList))}
             >{ uploadButton }</Upload>
           </Form.Item>
+          <Form.Item label='区域' name="area" rules={[{ required: true }]}>
+            <Select placeholder='请选择' options={[
+              { label: '公共区域', value: 1  },
+              { label: '室内', value: 2  },
+            ]} />
+          </Form.Item>
           <Form.Item label='联系地址' name="house_id" rules={[{ required: true }]}>
             <Select placeholder='请选择' options={buildHouse} />
           </Form.Item>

+ 44 - 21
src/views/Fix/order-detail.tsx

@@ -6,50 +6,71 @@ import { GetFixOrderInfo } from "../../services/fix"
 const columns = [
   {
     title: 'ID',
-    dataIndex: ''
+    dataIndex: 'id'
   },
   {
     title: '处理人',
-    dataIndex: ''
+    dataIndex: 'user'
   },
   {
     title: '状态',
-    dataIndex: ''
+    dataIndex: 'status'
   },
   {
     title: '处理时间',
-    dataIndex: ''
+    dataIndex: 'handle_time'
   },
   {
     title: '意见',
-    dataIndex: ''
+    dataIndex: 'feedback'
   },
 ]
 const infoKeys = [
-  { label: '分类名称', key: '' },
-  { label: '联系地址', key: '' },
-  { label: '报修人', key: '' },
-  { label: '联系方式', key: '' },
-  { label: '预约时间', key: '' },
-  { label: '报修时间', key: '' },
-  { label: '报修内容', key: '' },
+  { label: '分类名称', key: 'class_name' },
+  { label: '联系地址', key: 'house_name' },
+  { label: '报修人', key: 'apply_people' },
+  { label: '联系方式', key: 'apply_people_phone' },
+  { label: '预约时间', key: 'appointment' },
+  { label: '报修时间', key: 'created_at' },
+  { label: '报修内容', key: 'apply_content' },
   { label: '报修图片', key: '', col: 24, type: 'picture' },
 ]
 
 const OrderDetail: React.FC = () => {
 
   const history = useHistory()
+  const [orderInfo, setOrderInfo]: any = React.useState({
+    base_info: {
+      apply_pic: []
+    }
+  })
+  const visitLevel = {
+    1: '满意',
+    2: '不满意'
+  }
+
+  React.useEffect(() => {
+    GetFixOrderInfo(history.location.search)
+      .then((res) => {
+        setOrderInfo(res)
+      })
+  }, [])
 
   React.useEffect(() => {
-    GetFixOrderInfo()
+    console.log(orderInfo.base_info.apply_pic)
   })
 
   return (
-    <React.Fragment>
+    <div className="print-container">
       <div className="flex justify-between items-center pb-3" style={{ fontSize: '18px' }}>
         报事报修/在线报修
         <div>
-          <Button className="mr-1.5" type="primary">打印</Button>
+          <Button className="mr-1.5" type="primary" onClick={() => {
+            // @ts-ignore
+            window.document.body.innerHTML = document.querySelector('.print-container').innerHTML as any
+            window.print()
+            window.location.reload()
+          }}>打印</Button>
           <Button onClick={() => history.goBack()}>返回</Button>
         </div>
       </div>
@@ -61,8 +82,10 @@ const OrderDetail: React.FC = () => {
                 <Col span={item.col || 8}>
                   <Form.Item label={item.label}>
                     { item.type === 'picture' ? (
-                      <Image className="mr-1.5" width={120} src="https://hbimg.huabanimg.com/683615e8e5dd8c4660efbdf1fbc3c26f1da40cae2a7a7-fcKebd_fw658/format/webp" />
-                    ) : item.label }
+                      orderInfo.base_info.apply_pic.map(url =>
+                        <Image width={100} src={url} />
+                      )
+                    ) : orderInfo?.base_info[item.key] }
                   </Form.Item>
                 </Col>
               ))
@@ -72,16 +95,16 @@ const OrderDetail: React.FC = () => {
       </Card>
       <Divider />
       <Card title="工单流转">
-        <Table columns={columns} bordered />
+        <Table dataSource={orderInfo.list} columns={columns} bordered />
       </Card>
       <Divider />
       <Card title="回访/业主评价">
         <Form>
-          <Form.Item label="满意度">xxxxxx</Form.Item>
-          <Form.Item label="业主评价">xxxxxxxxxxxxxxxxxx</Form.Item>
+          <Form.Item label="满意度">{ visitLevel[orderInfo.base_info?.return_visit_level] || '暂无' }</Form.Item>
+          <Form.Item label="业主评价">{ orderInfo.base_info?.return_visit_content || '暂无评价' }</Form.Item>
         </Form>
       </Card>
-    </React.Fragment>
+    </div>
 
   )
 }

+ 1 - 1
src/views/Fix/return-visit.tsx

@@ -81,7 +81,7 @@ const FixReturnVisit: React.FC = (props: any) => {
           <Button
             className="mr-1.5"
             onClick={() => {
-              props.history.push('/admin/fix/order-detail')
+              props.history.push(`/admin/fix/order-detail?id=${row.id}`)
             }}
           >详情</Button>,
         ]

+ 18 - 6
src/views/Fix/to-do.tsx

@@ -85,8 +85,9 @@ const FixTodo: React.FC = (props: any) => {
             onClick={() => {
               setState(prevState => ({
                 ...prevState,
-                formMode: 'return',
-                orderVisible: true
+                formMode: 'refund',
+                orderVisible: true,
+                editId: row.id
               }))
             }}
           >退单</Button>,
@@ -100,7 +101,8 @@ const FixTodo: React.FC = (props: any) => {
             setState(prevState => ({
               ...prevState,
               formMode: 'finish',
-              orderVisible: true
+              orderVisible: true,
+              editId: row.id
             }))
           }}>办结</Button>
         ]
@@ -162,7 +164,7 @@ const FixTodo: React.FC = (props: any) => {
   </React.Fragment>
 
   const Forms = {
-    return: ChargeBackForm,
+    refund: ChargeBackForm,
     finish: FinishForm,
     send: SendForm
   }
@@ -177,7 +179,11 @@ const FixTodo: React.FC = (props: any) => {
       finish: FixOrderFinish
     }
     orderForm.validateFields().then(async values => {
-      await _Api[state.formMode]({ ...values, id: state.editId })
+      const params: any = { id: state.editId }
+      if (values.repair_pic) {
+        params.repair_pic = pic.map(({ response }) => response.data)
+      }
+      await _Api[state.formMode]({ ...values, ...params })
       message.success('操作成功!')
       orderForm.resetFields()
       actionRef.current?.reloadAndRest()
@@ -185,6 +191,12 @@ const FixTodo: React.FC = (props: any) => {
     })
   }
 
+  const titleMap = {
+    refund: '退单',
+    finish: '办结工单',
+    send: '转单'
+  }
+
   return (
     <React.Fragment>
       <ProTable
@@ -196,7 +208,7 @@ const FixTodo: React.FC = (props: any) => {
         columns={columns}
       />
       <Modal
-        title='转单'
+        title={titleMap[state.formMode]}
         visible={state.orderVisible}
         onOk={onSubmit}
         onCancel={() => setState(pre => ({ ...pre, orderVisible: false }))}