|
|
@@ -1,5 +1,5 @@
|
|
|
import React, { useState, useEffect, useRef } from 'react'
|
|
|
-import { Button, Col, Row, Tabs, Upload } from 'antd'
|
|
|
+import { Button, Col, message, Row, Tabs, Upload } from 'antd'
|
|
|
import ProForm, {
|
|
|
ProFormDatePicker,
|
|
|
ProFormSelect,
|
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
marriageOptions
|
|
|
} from '@/components/EditableForm/src/useOptions'
|
|
|
import { UploadOutlined } from '@ant-design/icons'
|
|
|
-import { queryStaffOwner } from '@/services/user'
|
|
|
+import { queryStaffOwner, updateBaseStaff, updateFinanceStaff } from '@/services/user'
|
|
|
import consts from '@/consts'
|
|
|
|
|
|
const { TabPane } = Tabs
|
|
|
@@ -49,19 +49,12 @@ const AvatarView = ({ avatar }) => (
|
|
|
|
|
|
const BaseView = () => {
|
|
|
const baseRef = useRef(null)
|
|
|
- // const baseRef = useRef(null)
|
|
|
- const financialRef = useRef(null)
|
|
|
const [staff, setStaff] = useState(null)
|
|
|
const layout = {
|
|
|
layout: 'horizontal',
|
|
|
labelCol: { flex: '120px' }
|
|
|
}
|
|
|
- const handleTabChange = key => {
|
|
|
- console.log(key)
|
|
|
- if (key === '3') {
|
|
|
- financialRef.current?.setFieldsValue({ ...staff })
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
async function initData() {
|
|
|
const { code = -1, data = {} } = await queryStaffOwner()
|
|
|
@@ -73,14 +66,20 @@ const BaseView = () => {
|
|
|
initData()
|
|
|
}, [])
|
|
|
return (
|
|
|
- <Tabs defaultActiveKey="1" onChange={handleTabChange}>
|
|
|
+ <Tabs defaultActiveKey="1">
|
|
|
<TabPane tab="基本信息" key="1">
|
|
|
<div className={styles.baseView}>
|
|
|
<div className={styles.left}>
|
|
|
<ProForm
|
|
|
{...layout}
|
|
|
formRef={baseRef}
|
|
|
- // onFinish={handleFinish}
|
|
|
+ onFinish={async values => {
|
|
|
+ const { code = -1 } = await updateBaseStaff(values)
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ message.success('更新成功')
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }}
|
|
|
submitter={{
|
|
|
resetButtonProps: false,
|
|
|
submitButtonProps: {
|
|
|
@@ -232,7 +231,24 @@ const BaseView = () => {
|
|
|
<TabPane tab="财务信息" key="3">
|
|
|
<div className={styles.baseView}>
|
|
|
<div className="w-3/4">
|
|
|
- <ProForm layout="horizontal" labelCol={{ flex: '150px' }} formRef={financialRef}>
|
|
|
+ <ProForm
|
|
|
+ layout="horizontal"
|
|
|
+ labelCol={{ flex: '150px' }}
|
|
|
+ onFinish={async values => {
|
|
|
+ const { code = -1 } = await updateFinanceStaff(values)
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ message.success('更新成功')
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }}
|
|
|
+ submitter={{
|
|
|
+ resetButtonProps: false,
|
|
|
+ submitButtonProps: {
|
|
|
+ className: 'ml-150px'
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ initialValues={{ ...staff }}
|
|
|
+ >
|
|
|
{/* <ProFormGroup title="报销收款帐号"> */}
|
|
|
<h4 className="mb-4 font-bold">报销收款帐号</h4>
|
|
|
<Row>
|