|
|
@@ -1,4 +1,4 @@
|
|
|
-import { Tabs } from 'antd'
|
|
|
+import { Button, Tabs } from 'antd'
|
|
|
import React, { useMemo } from 'react'
|
|
|
import { dayjsFormat } from '@/utils/utils'
|
|
|
import classNames from 'classnames'
|
|
|
@@ -7,6 +7,9 @@ import { VList } from 'virtuallist-antd'
|
|
|
import consts from '@/consts'
|
|
|
import type { ProColumns } from '@ant-design/pro-table'
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
+import { updateCustomerService, delCustomerService } from '@/services/customer'
|
|
|
+import { useModal } from '@/components/ModalStore'
|
|
|
+import { useRequest } from 'umi'
|
|
|
const { TabPane } = Tabs
|
|
|
|
|
|
export enum Servicelog {
|
|
|
@@ -54,7 +57,27 @@ type ClientLowerListProps = {
|
|
|
serviceList: API.ServiceLogItem[]
|
|
|
}
|
|
|
|
|
|
-export const renderServiceLogItem = (item: API.ServiceLogItem) => {
|
|
|
+export const ServiceLogItem: React.FC<{ item: API.ServiceLogItem }> = ({ item }) => {
|
|
|
+ const dispatchModal = useModal()
|
|
|
+
|
|
|
+ const { run: truUpdate, loading: comfirmLoading } = useRequest(updateCustomerService, {
|
|
|
+ manual: true
|
|
|
+ })
|
|
|
+ const { run: truDel, loading: delLoading } = useRequest(delCustomerService, {
|
|
|
+ manual: true
|
|
|
+ })
|
|
|
+ const handleOnUpdateComfirm = async (serviceLog: API.ServiceLogItem) => {
|
|
|
+ const data = await truUpdate(serviceLog)
|
|
|
+ console.log(data)
|
|
|
+
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ const handleOnDelComfirm = async (id: string) => {
|
|
|
+ truDel({ id })
|
|
|
+ }
|
|
|
+ const handleOnEdit = async (defaultValues: API.ServiceLogItem) => {
|
|
|
+ dispatchModal('M_RECORD_ADD', { defaultValues, onConfirm: handleOnUpdateComfirm })
|
|
|
+ }
|
|
|
return (
|
|
|
<div
|
|
|
className={classNames(
|
|
|
@@ -77,7 +100,7 @@ export const renderServiceLogItem = (item: API.ServiceLogItem) => {
|
|
|
/>
|
|
|
<div className="flex flex-col items-center ml-2">
|
|
|
<div className="text-sm font-medium text-opacity-80 text-black">{item.staffName}</div>
|
|
|
- <div className="text-xs text-opacity-40 text-black h-1rem">
|
|
|
+ <div className="text-xs text-opacity-40 text-black h-4">
|
|
|
{dayjsFormat(item.createTime, 'HH:mm:ss')}
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -99,6 +122,21 @@ export const renderServiceLogItem = (item: API.ServiceLogItem) => {
|
|
|
<div className="bg-white bg-opacity-80 rounded-sm text-black text-opacity-60 text-sm mt-3 p-2">
|
|
|
{item.mark}
|
|
|
</div>
|
|
|
+ {item.isOperation ? (
|
|
|
+ <div className="mt-2">
|
|
|
+ <Button size="small" onClick={() => handleOnEdit(item)} loading={comfirmLoading}>
|
|
|
+ 编辑
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ size="small"
|
|
|
+ danger
|
|
|
+ loading={delLoading}
|
|
|
+ onClick={() => handleOnDelComfirm(item.id)}
|
|
|
+ className="ml-1">
|
|
|
+ 删除
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
</div>
|
|
|
</div>
|
|
|
)
|
|
|
@@ -119,21 +157,6 @@ const ClientLowerList: React.FC<ClientLowerListProps> = ({ logList: { log: logs
|
|
|
key: 'operatorName',
|
|
|
ellipsis: true,
|
|
|
width: 115
|
|
|
- // render: (_, record) => (
|
|
|
- // <div className="flex items-center">
|
|
|
- // <div
|
|
|
- // className="rounded-1/2 w-5 h-5"
|
|
|
- // style={{
|
|
|
- // backgroundImage: `url(${
|
|
|
- // (isDevMode() ? 'http://cld2qa.com' : 'http://zhcld.com') +
|
|
|
- // (record.avatar ?? consts.DEFAULT_AVATAR)
|
|
|
- // })`,
|
|
|
- // backgroundSize: 'cover'
|
|
|
- // }}
|
|
|
- // />
|
|
|
- // <div className="ml-1 text-opacity-80 text-sm leading-4">{record.operatorName}</div>
|
|
|
- // </div>
|
|
|
- // )
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
|
@@ -165,7 +188,7 @@ const ClientLowerList: React.FC<ClientLowerListProps> = ({ logList: { log: logs
|
|
|
<div className="sheet-panel-record">
|
|
|
{serviceList.map(item => (
|
|
|
<div className="mb-3" key={item.id}>
|
|
|
- {renderServiceLogItem(item)}
|
|
|
+ <ServiceLogItem item={item} />
|
|
|
</div>
|
|
|
))}
|
|
|
</div>
|