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