add conclusion page
parent
d7cdf46026
commit
b68e3db0a3
11
doc/api.md
11
doc/api.md
|
|
@ -492,3 +492,14 @@ Request
|
||||||
"substitute": "晓洋" // 未找人代班则为空
|
"substitute": "晓洋" // 未找人代班则为空
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 值班总结上传 `POST /member/conclusion`
|
||||||
|
|
||||||
|
Request
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"token": "token_test",
|
||||||
|
"conclusion": "周四第三班,一人请假,共收两台电脑,均劝退已取回。由上一班交接两台电脑,其中一台维修成功已取回,一台仍在维修。"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
@ -143,4 +143,10 @@ export default {
|
||||||
'POST /upload/pic': {
|
'POST /upload/pic': {
|
||||||
success: true,
|
success: true,
|
||||||
},
|
},
|
||||||
|
'POST /member/conclusion': {
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
id: 514,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,15 @@ import {
|
||||||
AtButton,
|
AtButton,
|
||||||
AtForm,
|
AtForm,
|
||||||
AtMessage,
|
AtMessage,
|
||||||
AtInput,
|
|
||||||
AtList,
|
AtList,
|
||||||
AtListItem,
|
AtListItem,
|
||||||
AtModal,
|
|
||||||
} from 'taro-ui';
|
} from 'taro-ui';
|
||||||
import { Component, ReactNode } from 'react';
|
import React, { Component, ReactNode } from 'react';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import { Picker, View } from '@tarojs/components';
|
import { Picker, View } from '@tarojs/components';
|
||||||
import { askLeave } from '@/service/askleave';
|
import PicUploader from '@/components/PicUploader/PicUploader';
|
||||||
|
import { conclude } from '@/service/conclude';
|
||||||
import './Conclusion.scss';
|
import './Conclusion.scss';
|
||||||
|
|
||||||
const submitInterval = 5000;
|
const submitInterval = 5000;
|
||||||
|
|
@ -21,19 +20,23 @@ export default class ConclusionPage extends Component {
|
||||||
state = {
|
state = {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isDisable: false,
|
isDisable: false,
|
||||||
showModal: false,
|
conclusion: '',
|
||||||
range: [
|
conclusionId: 0,
|
||||||
['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
range: [pt.get().askLeave.shift.week, pt.get().askLeave.shift.shift],
|
||||||
['第一班', '第二班', '第三班'],
|
|
||||||
],
|
|
||||||
shift: [0, 0],
|
shift: [0, 0],
|
||||||
reason: '',
|
|
||||||
substitute: '',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
Taro.setNavigationBarTitle({
|
Taro.setNavigationBarTitle({
|
||||||
title: pt.get().navBar.askLeave,
|
title: pt.get().navBar.conclusion,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
uploaderRef = React.createRef<PicUploader>();
|
||||||
|
|
||||||
|
handleConclusionChange(conclusion: string) {
|
||||||
|
this.setState({
|
||||||
|
conclusion,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,57 +47,11 @@ export default class ConclusionPage extends Component {
|
||||||
console.log(event);
|
console.log(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
onModalClose() {
|
|
||||||
this.setState({
|
|
||||||
showModal: false,
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
this.setState({
|
|
||||||
isDisable: false,
|
|
||||||
});
|
|
||||||
}, submitInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
onModalCancel() {
|
|
||||||
this.setState({
|
|
||||||
showModal: false,
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
this.setState({
|
|
||||||
isDisable: false,
|
|
||||||
});
|
|
||||||
}, submitInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
onModalConfirm() {
|
|
||||||
this.setState({
|
|
||||||
showModal: false,
|
|
||||||
});
|
|
||||||
askLeave(this);
|
|
||||||
setTimeout(() => {
|
|
||||||
this.setState({
|
|
||||||
isDisable: false,
|
|
||||||
});
|
|
||||||
}, submitInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleReasonChange(reason: string) {
|
|
||||||
this.setState({
|
|
||||||
reason,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSubstituteChange(substitute: string) {
|
|
||||||
this.setState({
|
|
||||||
substitute,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDisable: true,
|
isDisable: true,
|
||||||
});
|
});
|
||||||
if (this.state.reason == '') {
|
if (this.state.conclusion == '') {
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.blank,
|
message: pt.get().button.submitText.blank,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
|
@ -106,13 +63,8 @@ export default class ConclusionPage extends Component {
|
||||||
}, submitInterval);
|
}, submitInterval);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.state.substitute == '') {
|
conclude(this);
|
||||||
this.setState({
|
this.uploaderRef.current?.onUpload();
|
||||||
showModal: true,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
askLeave(this);
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDisable: false,
|
isDisable: false,
|
||||||
|
|
@ -123,16 +75,6 @@ export default class ConclusionPage extends Component {
|
||||||
return (
|
return (
|
||||||
<View style={{ marginTop: '30rpx', width: '94%', marginLeft: '3%' }}>
|
<View style={{ marginTop: '30rpx', width: '94%', marginLeft: '3%' }}>
|
||||||
<AtMessage />
|
<AtMessage />
|
||||||
<AtModal
|
|
||||||
isOpened={this.state.showModal}
|
|
||||||
title={pt.get().askLeave.modal.title}
|
|
||||||
cancelText={pt.get().modal.cancel}
|
|
||||||
confirmText={pt.get().modal.confirm}
|
|
||||||
onClose={this.onModalClose.bind(this)}
|
|
||||||
onCancel={this.onModalCancel.bind(this)}
|
|
||||||
onConfirm={this.onModalConfirm.bind(this)}
|
|
||||||
content={pt.get().askLeave.modal.content}
|
|
||||||
/>
|
|
||||||
<AtForm onSubmit={this.onSubmit.bind(this)}>
|
<AtForm onSubmit={this.onSubmit.bind(this)}>
|
||||||
<View style={{ width: '98%', marginLeft: '1%' }}>
|
<View style={{ width: '98%', marginLeft: '1%' }}>
|
||||||
<Picker
|
<Picker
|
||||||
|
|
@ -156,22 +98,19 @@ export default class ConclusionPage extends Component {
|
||||||
className='at-article__h3'
|
className='at-article__h3'
|
||||||
style={{ marginTop: '20rpx', marginBottom: '20rpx' }}
|
style={{ marginTop: '20rpx', marginBottom: '20rpx' }}
|
||||||
>
|
>
|
||||||
{pt.get().askLeave.reason.title}
|
{pt.get().conclusion.title}
|
||||||
</View>
|
</View>
|
||||||
<AtTextarea
|
<AtTextarea
|
||||||
value={this.state.reason}
|
value={this.state.conclusion}
|
||||||
onChange={this.handleReasonChange.bind(this)}
|
onChange={this.handleConclusionChange.bind(this)}
|
||||||
maxLength={200}
|
maxLength={200}
|
||||||
placeholder={pt.get().askLeave.reason.placeHolder}
|
height={400}
|
||||||
|
placeholder={pt.get().conclusion.placeHolder}
|
||||||
/>
|
/>
|
||||||
|
<PicUploader
|
||||||
<AtInput
|
ref={this.uploaderRef}
|
||||||
name='substitute'
|
source='conclusion'
|
||||||
title={pt.get().askLeave.substitute.title}
|
id={this.state.conclusionId}
|
||||||
type='text'
|
|
||||||
placeholder={pt.get().askLeave.substitute.placeHolder}
|
|
||||||
value={this.state.substitute}
|
|
||||||
onChange={this.handleSubstituteChange.bind(this)}
|
|
||||||
/>
|
/>
|
||||||
<View>
|
<View>
|
||||||
<AtButton
|
<AtButton
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
export interface ConclusionText {
|
||||||
|
title: string;
|
||||||
|
placeHolder: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const conclusionTextZhCn: ConclusionText = {
|
||||||
|
title: '值班总结',
|
||||||
|
placeHolder:
|
||||||
|
'请在此填写完整的值班情况,包括:几人请假;收到几台电脑;后续的处理情况;上一班交接的电脑情况;下一班对接的电脑情况;另外,请拍照记录值班桌整理情况',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const conclusionTextEnUs: ConclusionText = {
|
||||||
|
title: 'Duty Conclusion',
|
||||||
|
placeHolder:
|
||||||
|
'Please fill in the complete duty situation here, including: how many people were on leave; how many computers were received; how the follow-up was handled; how the computers were handed over by the previous shift; how the computers were docked by the next shift; Also, please take photos to document the organization of the duty desk',
|
||||||
|
};
|
||||||
|
|
@ -26,6 +26,11 @@ import {
|
||||||
} from './ActIndicator';
|
} from './ActIndicator';
|
||||||
import { NotFoundText, notFound } from './404';
|
import { NotFoundText, notFound } from './404';
|
||||||
import { AskLeaveText, askLeaveEnUs, askLeaveZhCn } from './AskLeave';
|
import { AskLeaveText, askLeaveEnUs, askLeaveZhCn } from './AskLeave';
|
||||||
|
import {
|
||||||
|
ConclusionText,
|
||||||
|
conclusionTextEnUs,
|
||||||
|
conclusionTextZhCn,
|
||||||
|
} from './Conclusion';
|
||||||
|
|
||||||
interface TextRecord {
|
interface TextRecord {
|
||||||
common: CommonText;
|
common: CommonText;
|
||||||
|
|
@ -48,6 +53,7 @@ interface TextRecord {
|
||||||
actIndicator: ActIndicatorText;
|
actIndicator: ActIndicatorText;
|
||||||
notFound: NotFoundText;
|
notFound: NotFoundText;
|
||||||
askLeave: AskLeaveText;
|
askLeave: AskLeaveText;
|
||||||
|
conclusion: ConclusionText;
|
||||||
}
|
}
|
||||||
|
|
||||||
const textZhCn: TextRecord = {
|
const textZhCn: TextRecord = {
|
||||||
|
|
@ -71,6 +77,7 @@ const textZhCn: TextRecord = {
|
||||||
actIndicator: actIndicatorZhCn,
|
actIndicator: actIndicatorZhCn,
|
||||||
notFound: notFound,
|
notFound: notFound,
|
||||||
askLeave: askLeaveZhCn,
|
askLeave: askLeaveZhCn,
|
||||||
|
conclusion: conclusionTextZhCn,
|
||||||
};
|
};
|
||||||
|
|
||||||
const textEnUs: TextRecord = {
|
const textEnUs: TextRecord = {
|
||||||
|
|
@ -94,6 +101,7 @@ const textEnUs: TextRecord = {
|
||||||
actIndicator: actIndicatorEnUs,
|
actIndicator: actIndicatorEnUs,
|
||||||
notFound: notFound,
|
notFound: notFound,
|
||||||
askLeave: askLeaveEnUs,
|
askLeave: askLeaveEnUs,
|
||||||
|
conclusion: conclusionTextEnUs,
|
||||||
};
|
};
|
||||||
|
|
||||||
// type Lang = 'zh_CN' | 'en_US' | ...;
|
// type Lang = 'zh_CN' | 'en_US' | ...;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
import ConclusionPage from '@/pages/Conclusion/Conclusion';
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import pt from '@/plain-text';
|
||||||
|
import wechatUser from '@/wechat';
|
||||||
|
import { getUrl } from '.';
|
||||||
|
|
||||||
|
export function conclude(that: ConclusionPage) {
|
||||||
|
that.setState({
|
||||||
|
isLoading: true,
|
||||||
|
});
|
||||||
|
Taro.request({
|
||||||
|
url: getUrl('/member/conclusion'),
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
token: wechatUser.getToken(),
|
||||||
|
conclusion: that.state.conclusion,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res.data);
|
||||||
|
that.setState({
|
||||||
|
isLoading: false,
|
||||||
|
conclusionId: res.data.data.id,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.success,
|
||||||
|
type: 'success',
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err.errMsg);
|
||||||
|
that.setState({
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.error + err.errMsg,
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue