Jelajahi Sumber

feat: 服务记录编辑删除限时 暂未对接接口

outaozhen 3 tahun lalu
induk
melakukan
0fb088009f

+ 6 - 0
config/routes.ts

@@ -76,6 +76,12 @@
         redirect: '/business/attendance'
       },
       {
+        path: '/business/commonSetting',
+        name: 'commonSetting',
+        component: './business/CommonSetting',
+        access: 'authRouteFilter'
+      },
+      {
         path: '/business/attendance',
         name: 'attendance',
         component: './business/Attendance',

+ 1 - 0
src/locales/zh-CN/menu.ts

@@ -12,6 +12,7 @@ export default {
   'menu.role.product': '产品',
   'menu.role.statistic': '统计',
   'menu.business': '业务参数',
+  'menu.business.commonSetting': '通用',
   'menu.business.attendance': '考勤',
   'menu.business.contact': '客户',
   'menu.business.invoice': '开票合同',

+ 72 - 0
src/pages/Business/CommonSetting/index.tsx

@@ -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

+ 6 - 0
src/services/user/typings.d.ts

@@ -291,6 +291,12 @@ declare namespace API {
     name: string
   }
 
+  type UpdateCommonSetting = {
+    client: srting
+    company: string
+    lock: string
+  }
+
   type InvoiceList = {
     id: string
     name: string