add conclusion page
parent
d7cdf46026
commit
b68e3db0a3
11
doc/api.md
11
doc/api.md
|
|
@ -492,3 +492,14 @@ Request
|
|||
"substitute": "晓洋" // 未找人代班则为空
|
||||
}
|
||||
```
|
||||
|
||||
### 值班总结上传 `POST /member/conclusion`
|
||||
|
||||
Request
|
||||
|
||||
```json
|
||||
{
|
||||
"token": "token_test",
|
||||
"conclusion": "周四第三班,一人请假,共收两台电脑,均劝退已取回。由上一班交接两台电脑,其中一台维修成功已取回,一台仍在维修。"
|
||||
}
|
||||
```
|
||||
|
|
@ -143,4 +143,10 @@ export default {
|
|||
'POST /upload/pic': {
|
||||
success: true,
|
||||
},
|
||||
'POST /member/conclusion': {
|
||||
success: true,
|
||||
data: {
|
||||
id: 514,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,16 +3,15 @@ import {
|
|||
AtButton,
|
||||
AtForm,
|
||||
AtMessage,
|
||||
AtInput,
|
||||
AtList,
|
||||
AtListItem,
|
||||
AtModal,
|
||||
} from 'taro-ui';
|
||||
import { Component, ReactNode } from 'react';
|
||||
import React, { Component, ReactNode } from 'react';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
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';
|
||||
|
||||
const submitInterval = 5000;
|
||||
|
|
@ -21,19 +20,23 @@ export default class ConclusionPage extends Component {
|
|||
state = {
|
||||
isLoading: false,
|
||||
isDisable: false,
|
||||
showModal: false,
|
||||
range: [
|
||||
['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
['第一班', '第二班', '第三班'],
|
||||
],
|
||||
conclusion: '',
|
||||
conclusionId: 0,
|
||||
range: [pt.get().askLeave.shift.week, pt.get().askLeave.shift.shift],
|
||||
shift: [0, 0],
|
||||
reason: '',
|
||||
substitute: '',
|
||||
};
|
||||
|
||||
componentDidMount(): void {
|
||||
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);
|
||||
}
|
||||
|
||||
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() {
|
||||
this.setState({
|
||||
isDisable: true,
|
||||
});
|
||||
if (this.state.reason == '') {
|
||||
if (this.state.conclusion == '') {
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.submitText.blank,
|
||||
type: 'error',
|
||||
|
|
@ -106,13 +63,8 @@ export default class ConclusionPage extends Component {
|
|||
}, submitInterval);
|
||||
return;
|
||||
}
|
||||
if (this.state.substitute == '') {
|
||||
this.setState({
|
||||
showModal: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
askLeave(this);
|
||||
conclude(this);
|
||||
this.uploaderRef.current?.onUpload();
|
||||
setTimeout(() => {
|
||||
this.setState({
|
||||
isDisable: false,
|
||||
|
|
@ -123,16 +75,6 @@ export default class ConclusionPage extends Component {
|
|||
return (
|
||||
<View style={{ marginTop: '30rpx', width: '94%', marginLeft: '3%' }}>
|
||||
<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)}>
|
||||
<View style={{ width: '98%', marginLeft: '1%' }}>
|
||||
<Picker
|
||||
|
|
@ -156,22 +98,19 @@ export default class ConclusionPage extends Component {
|
|||
className='at-article__h3'
|
||||
style={{ marginTop: '20rpx', marginBottom: '20rpx' }}
|
||||
>
|
||||
{pt.get().askLeave.reason.title}
|
||||
{pt.get().conclusion.title}
|
||||
</View>
|
||||
<AtTextarea
|
||||
value={this.state.reason}
|
||||
onChange={this.handleReasonChange.bind(this)}
|
||||
value={this.state.conclusion}
|
||||
onChange={this.handleConclusionChange.bind(this)}
|
||||
maxLength={200}
|
||||
placeholder={pt.get().askLeave.reason.placeHolder}
|
||||
height={400}
|
||||
placeholder={pt.get().conclusion.placeHolder}
|
||||
/>
|
||||
|
||||
<AtInput
|
||||
name='substitute'
|
||||
title={pt.get().askLeave.substitute.title}
|
||||
type='text'
|
||||
placeholder={pt.get().askLeave.substitute.placeHolder}
|
||||
value={this.state.substitute}
|
||||
onChange={this.handleSubstituteChange.bind(this)}
|
||||
<PicUploader
|
||||
ref={this.uploaderRef}
|
||||
source='conclusion'
|
||||
id={this.state.conclusionId}
|
||||
/>
|
||||
<View>
|
||||
<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';
|
||||
import { NotFoundText, notFound } from './404';
|
||||
import { AskLeaveText, askLeaveEnUs, askLeaveZhCn } from './AskLeave';
|
||||
import {
|
||||
ConclusionText,
|
||||
conclusionTextEnUs,
|
||||
conclusionTextZhCn,
|
||||
} from './Conclusion';
|
||||
|
||||
interface TextRecord {
|
||||
common: CommonText;
|
||||
|
|
@ -48,6 +53,7 @@ interface TextRecord {
|
|||
actIndicator: ActIndicatorText;
|
||||
notFound: NotFoundText;
|
||||
askLeave: AskLeaveText;
|
||||
conclusion: ConclusionText;
|
||||
}
|
||||
|
||||
const textZhCn: TextRecord = {
|
||||
|
|
@ -71,6 +77,7 @@ const textZhCn: TextRecord = {
|
|||
actIndicator: actIndicatorZhCn,
|
||||
notFound: notFound,
|
||||
askLeave: askLeaveZhCn,
|
||||
conclusion: conclusionTextZhCn,
|
||||
};
|
||||
|
||||
const textEnUs: TextRecord = {
|
||||
|
|
@ -94,6 +101,7 @@ const textEnUs: TextRecord = {
|
|||
actIndicator: actIndicatorEnUs,
|
||||
notFound: notFound,
|
||||
askLeave: askLeaveEnUs,
|
||||
conclusion: conclusionTextEnUs,
|
||||
};
|
||||
|
||||
// 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