|
@@ -0,0 +1,72 @@
|
|
|
+import { PageContainer } from '@ant-design/pro-layout'
|
|
|
+import React, { useEffect, useRef, useState } from 'react'
|
|
|
+import { useRequest } from 'umi'
|
|
|
+import ShowTitleMenu from '../Attendance/components/ShowTitleMenu'
|
|
|
+import type { FormInstance } from 'antd'
|
|
|
+import { message } from 'antd'
|
|
|
+import ProForm, { ProFormDigit } from '@ant-design/pro-form'
|
|
|
+
|
|
|
+const titleOptions = [{ label: '通用设置', value: 0 }]
|
|
|
+
|
|
|
+const CommonSetting: React.FC = () => {
|
|
|
+ const formRef = useRef<FormInstance>(null)
|
|
|
+ const [state, setState] = useState({
|
|
|
+ menuId: 0,
|
|
|
+ contentValue: ''
|
|
|
+ })
|
|
|
+ const onSelect = (menuId: string) => {
|
|
|
+ setState({ ...state, menuId })
|
|
|
+ }
|
|
|
+ const { run: tryUpdateCommonSetting } = useRequest(
|
|
|
+ (params: API.UpdateCommonSetting) => {
|
|
|
+ return updateCommonSetting(params)
|
|
|
+ },
|
|
|
+ {
|
|
|
+ manual: true,
|
|
|
+ onSuccess: () => {
|
|
|
+ message.success('更新成功')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ useEffect(() => {
|
|
|
+ if (state.menuId === 0) {
|
|
|
+ formRef.current?.setFieldsValue(...state.contentValue)
|
|
|
+ }
|
|
|
+ }, [state.menuId])
|
|
|
+ return (
|
|
|
+ <PageContainer title={false} breadcrumb={false}>
|
|
|
+ <div className="h-full w-full flex flex-row">
|
|
|
+ <ShowTitleMenu onSelect={onSelect} options={titleOptions} defaultValue={0} />
|
|
|
+ <div className="w-max-3/4">
|
|
|
+ <div className="ml-8 bg-white p-4 shadow-md shadow-hex-3e2c5a relative">
|
|
|
+ <div>
|
|
|
+ <div className="text-xl font-bold">服务记录编辑删除限时</div>
|
|
|
+ <div className="my-4 text-gray-500 text-opacity-50">
|
|
|
+ 用户新建记录和备注后,可在设置的时间(小时)内进行[编辑]和[删除]操作。
|
|
|
+ </div>
|
|
|
+ {state.menuId === 0 ? (
|
|
|
+ <ProForm
|
|
|
+ formRef={formRef}
|
|
|
+ layout="horizontal"
|
|
|
+ onFinish={async values => {
|
|
|
+ await tryUpdateCommonSetting(values)
|
|
|
+ message.success('更新成功')
|
|
|
+ return true
|
|
|
+ }}
|
|
|
+ initialValues={{ parametersType: 1 }}>
|
|
|
+ <ProForm.Group>
|
|
|
+ <ProFormDigit label="客户服务记录:" width="xs" name="client" />
|
|
|
+ <ProFormDigit label="单位服务记录:" width="xs" name="company" />
|
|
|
+ <ProFormDigit label="软件锁备注:" width="xs" name="lock" />
|
|
|
+ </ProForm.Group>
|
|
|
+ </ProForm>
|
|
|
+ ) : null}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </PageContainer>
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
+export default CommonSetting
|