refactor state structure in ticketdetail
parent
b14d9c363d
commit
3375e00b37
|
|
@ -8,7 +8,7 @@
|
||||||
"description": "清灰",
|
"description": "清灰",
|
||||||
"workers": ["宇航员"],
|
"workers": ["宇航员"],
|
||||||
"createdTime": "2024-03-07T19:52:48.523303",
|
"createdTime": "2024-03-07T19:52:48.523303",
|
||||||
"status": 5,
|
"status": 4,
|
||||||
"isConfirmed": false,
|
"isConfirmed": false,
|
||||||
"notes": [
|
"notes": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,35 +23,50 @@ import { pickTicket } from '@/service/pickTicket';
|
||||||
import { retrieve } from '@/service/retrieve';
|
import { retrieve } from '@/service/retrieve';
|
||||||
import { changeStatus } from '@/service/changeStatus';
|
import { changeStatus } from '@/service/changeStatus';
|
||||||
import { getDisable } from '@/service/getDisable';
|
import { getDisable } from '@/service/getDisable';
|
||||||
|
import { StatusStr } from './TicketNote';
|
||||||
|
|
||||||
const submitInterval = 5000;
|
const submitInterval = 5000;
|
||||||
|
|
||||||
interface TicketDetailState {
|
interface TicketDetailState {
|
||||||
id: number;
|
id: number;
|
||||||
isMember: boolean;
|
isMember: boolean;
|
||||||
showOreoModal: boolean;
|
show: {
|
||||||
showCommentLayout: boolean;
|
modal: {
|
||||||
showReminderLayout: boolean;
|
oreo: boolean;
|
||||||
showRetrieveModal: boolean;
|
retrieve: boolean;
|
||||||
showStatusSheet: boolean;
|
pick: boolean;
|
||||||
showPickModal: boolean;
|
};
|
||||||
|
layout: {
|
||||||
|
comment: boolean;
|
||||||
|
reminder: boolean;
|
||||||
|
};
|
||||||
|
actionSheet: {
|
||||||
|
status: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
comment: string;
|
comment: string;
|
||||||
isOreoLoading: boolean;
|
isLoading: {
|
||||||
isOreoDisable: boolean;
|
oreo: boolean;
|
||||||
isOreoDisable_main: boolean;
|
pick: boolean;
|
||||||
isPickLoading: boolean;
|
retrieve: boolean;
|
||||||
isPickDisable: boolean;
|
comment: boolean;
|
||||||
isPickDisable_main: boolean;
|
status: boolean;
|
||||||
isRetrieveLoading: boolean;
|
reminder: boolean;
|
||||||
isRetrieveDisable: boolean;
|
};
|
||||||
isRetrieveDisable_main: boolean;
|
isDisable: {
|
||||||
isStatusLoading: boolean;
|
oreo: boolean;
|
||||||
isStatusDisable: boolean;
|
pick: boolean;
|
||||||
isCommentLoading: boolean;
|
retrieve: boolean;
|
||||||
isCommentDisable: boolean;
|
comment: boolean;
|
||||||
isCommentDisable_main: boolean;
|
status: boolean;
|
||||||
isReminderLoading: boolean;
|
reminder: boolean;
|
||||||
isReminderDisable: boolean;
|
};
|
||||||
|
isDisable_main: {
|
||||||
|
oreo: boolean;
|
||||||
|
pick: boolean;
|
||||||
|
retrieve: boolean;
|
||||||
|
comment: boolean;
|
||||||
|
};
|
||||||
reminderList: Array<number>;
|
reminderList: Array<number>;
|
||||||
statusToBe: number;
|
statusToBe: number;
|
||||||
}
|
}
|
||||||
|
|
@ -60,29 +75,43 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
state: Readonly<TicketDetailState> = {
|
state: Readonly<TicketDetailState> = {
|
||||||
id: 0,
|
id: 0,
|
||||||
isMember: false,
|
isMember: false,
|
||||||
showOreoModal: false,
|
show: {
|
||||||
showCommentLayout: false,
|
modal: {
|
||||||
showReminderLayout: false,
|
oreo: false,
|
||||||
showRetrieveModal: false,
|
retrieve: false,
|
||||||
showStatusSheet: false,
|
pick: false,
|
||||||
showPickModal: false,
|
},
|
||||||
|
layout: {
|
||||||
|
comment: false,
|
||||||
|
reminder: false,
|
||||||
|
},
|
||||||
|
actionSheet: {
|
||||||
|
status: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
comment: '',
|
comment: '',
|
||||||
isOreoLoading: false,
|
isLoading: {
|
||||||
isOreoDisable: false,
|
oreo: false,
|
||||||
isOreoDisable_main: false,
|
pick: false,
|
||||||
isPickLoading: false,
|
retrieve: false,
|
||||||
isPickDisable: false,
|
comment: false,
|
||||||
isPickDisable_main: false,
|
status: false,
|
||||||
isRetrieveLoading: false,
|
reminder: false,
|
||||||
isRetrieveDisable: false,
|
},
|
||||||
isRetrieveDisable_main: false,
|
isDisable: {
|
||||||
isStatusLoading: false,
|
oreo: false,
|
||||||
isStatusDisable: false,
|
pick: false,
|
||||||
isCommentLoading: false,
|
retrieve: false,
|
||||||
isCommentDisable: false,
|
comment: false,
|
||||||
isCommentDisable_main: false,
|
status: false,
|
||||||
isReminderDisable: false,
|
reminder: false,
|
||||||
isReminderLoading: false,
|
},
|
||||||
|
isDisable_main: {
|
||||||
|
oreo: false,
|
||||||
|
pick: false,
|
||||||
|
retrieve: false,
|
||||||
|
comment: false,
|
||||||
|
},
|
||||||
reminderList: [],
|
reminderList: [],
|
||||||
statusToBe: 0,
|
statusToBe: 0,
|
||||||
};
|
};
|
||||||
|
|
@ -99,79 +128,157 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
|
|
||||||
onAddToOreo(): void {
|
onAddToOreo(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showOreoModal: true,
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
modal: {
|
||||||
|
...this.state.show.modal,
|
||||||
|
oreo: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onAddComment(): void {
|
onAddComment(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showCommentLayout: true,
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
layout: {
|
||||||
|
...this.state.show.layout,
|
||||||
|
comment: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onRetrieved(): void {
|
onRetrieved(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showRetrieveModal: true,
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
modal: {
|
||||||
|
...this.state.show.modal,
|
||||||
|
retrieve: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onPick(): void {
|
onPick(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showPickModal: true,
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
modal: {
|
||||||
|
...this.state.show.modal,
|
||||||
|
pick: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeStatus(): void {
|
onChangeStatus(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showStatusSheet: true,
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
actionSheet: {
|
||||||
|
...this.state.show.actionSheet,
|
||||||
|
status: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOreoCancel(): void {
|
handleOreoCancel(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showOreoModal: false,
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
modal: {
|
||||||
|
...this.state.show.modal,
|
||||||
|
oreo: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCommentCancel(): void {
|
handleCommentCancel(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showCommentLayout: false,
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
layout: {
|
||||||
|
...this.state.show.layout,
|
||||||
|
comment: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleReminderCancel(): void {
|
handleReminderCancel(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showReminderLayout: false,
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
layout: {
|
||||||
|
...this.state.show.layout,
|
||||||
|
reminder: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleRetrieveCancel(): void {
|
handleRetrieveCancel(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showRetrieveModal: false,
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
modal: {
|
||||||
|
...this.state.show.modal,
|
||||||
|
retrieve: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleStatusCancel(): void {
|
handleStatusCancel(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showStatusSheet: false,
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
actionSheet: {
|
||||||
|
...this.state.show.actionSheet,
|
||||||
|
status: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePickCancel(): void {
|
handlePickCancel(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showPickModal: false,
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
modal: {
|
||||||
|
...this.state.show.modal,
|
||||||
|
pick: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOreoConfirm(): void {
|
handleOreoConfirm(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
isOreoDisable: true,
|
isDisable: {
|
||||||
showOreoModal: false,
|
...this.state.isDisable,
|
||||||
|
oreo: true,
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
modal: {
|
||||||
|
...this.state.show.modal,
|
||||||
|
oreo: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
addToOreo(this);
|
addToOreo(this);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isOreoDisable: false,
|
isDisable: {
|
||||||
|
...this.state.isDisable,
|
||||||
|
oreo: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}, submitInterval);
|
}, submitInterval);
|
||||||
return;
|
return;
|
||||||
|
|
@ -179,13 +286,25 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
|
|
||||||
handleRetrieveConfirm(): void {
|
handleRetrieveConfirm(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
isRetrieveDisable: true,
|
isDisable: {
|
||||||
showRetrieveModal: false,
|
...this.state.isDisable,
|
||||||
|
retrieve: true,
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
modal: {
|
||||||
|
...this.state.show.modal,
|
||||||
|
retrieve: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
retrieve(this);
|
retrieve(this);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isRetrieveDisable: false,
|
isDisable: {
|
||||||
|
...this.state.isDisable,
|
||||||
|
retrieve: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}, submitInterval);
|
}, submitInterval);
|
||||||
return;
|
return;
|
||||||
|
|
@ -193,34 +312,72 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
|
|
||||||
handlePickConfirm(): void {
|
handlePickConfirm(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
isPickDisable: true,
|
isDisable: {
|
||||||
showPickModal: false,
|
...this.state.isDisable,
|
||||||
|
pick: true,
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
modal: {
|
||||||
|
...this.state.show.modal,
|
||||||
|
pick: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
pickTicket(this);
|
pickTicket(this);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isPickDisable: false,
|
isDisable: {
|
||||||
|
...this.state.isDisable,
|
||||||
|
pick: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}, submitInterval);
|
}, submitInterval);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleStatusChange(status: number): void {
|
handleStatusChange(status: number): void {
|
||||||
this.setState({
|
|
||||||
showStatusSheet: false,
|
|
||||||
isStatusDisable: true,
|
|
||||||
});
|
|
||||||
if (status == 3 || status == 5 || status == 7) {
|
if (status == 3 || status == 5 || status == 7) {
|
||||||
this.setState({
|
this.setState({
|
||||||
showReminderLayout: true,
|
isDisable: {
|
||||||
|
...this.state.isDisable,
|
||||||
|
status: true,
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
actionSheet: {
|
||||||
|
...this.state.show.actionSheet,
|
||||||
|
status: false,
|
||||||
|
},
|
||||||
|
layout: {
|
||||||
|
...this.state.show.layout,
|
||||||
|
reminder: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
statusToBe: status,
|
statusToBe: status,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
changeStatus(this, status);
|
this.setState({
|
||||||
|
isDisable: {
|
||||||
|
...this.state.isDisable,
|
||||||
|
status: true,
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
actionSheet: {
|
||||||
|
...this.state.show.actionSheet,
|
||||||
|
status: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
changeStatus(this);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isStatusDisable: false,
|
isDisable: {
|
||||||
|
...this.state.isDisable,
|
||||||
|
status: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}, submitInterval);
|
}, submitInterval);
|
||||||
return;
|
return;
|
||||||
|
|
@ -235,8 +392,17 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
|
|
||||||
onCommentSubmit() {
|
onCommentSubmit() {
|
||||||
this.setState({
|
this.setState({
|
||||||
isCommentDisable: true,
|
isDisable: {
|
||||||
showCommentLayout: false,
|
...this.state.isDisable,
|
||||||
|
comment: true,
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
layout: {
|
||||||
|
...this.state.show.layout,
|
||||||
|
comment: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
if (this.state.comment == '') {
|
if (this.state.comment == '') {
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
|
|
@ -245,7 +411,10 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isCommentDisable: false,
|
isDisable: {
|
||||||
|
...this.state.isDisable,
|
||||||
|
comment: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}, submitInterval);
|
}, submitInterval);
|
||||||
return;
|
return;
|
||||||
|
|
@ -253,7 +422,10 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
submitComment(this);
|
submitComment(this);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isCommentDisable: false,
|
isDisable: {
|
||||||
|
...this.state.isDisable,
|
||||||
|
comment: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}, submitInterval);
|
}, submitInterval);
|
||||||
}
|
}
|
||||||
|
|
@ -266,18 +438,31 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
onReminderSubmit() {
|
onReminderSubmit() {
|
||||||
this.setState({
|
|
||||||
isReminderDisable: true,
|
|
||||||
});
|
|
||||||
if (
|
if (
|
||||||
this.state.reminderList.includes(1) &&
|
this.state.reminderList.includes(1) &&
|
||||||
this.state.reminderList.includes(3)
|
this.state.reminderList.includes(3)
|
||||||
) {
|
) {
|
||||||
this.setState({
|
this.setState({
|
||||||
showReminderLayout: false,
|
isDisable: {
|
||||||
|
...this.state.isDisable,
|
||||||
|
reminder: true,
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
...this.state.show,
|
||||||
|
layout: {
|
||||||
|
...this.state.show.layout,
|
||||||
|
reminder: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
changeStatus(this, this.state.statusToBe);
|
changeStatus(this);
|
||||||
} else {
|
} else {
|
||||||
|
this.setState({
|
||||||
|
isDisable: {
|
||||||
|
...this.state.isDisable,
|
||||||
|
reminder: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().ticketDetail.reminder.error,
|
message: pt.get().ticketDetail.reminder.error,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
|
@ -285,7 +470,10 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isReminderDisable: false,
|
isDisable: {
|
||||||
|
...this.state.isDisable,
|
||||||
|
reminder: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}, submitInterval);
|
}, submitInterval);
|
||||||
}
|
}
|
||||||
|
|
@ -321,9 +509,9 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
|
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
|
||||||
>
|
>
|
||||||
<AtButton
|
<AtButton
|
||||||
loading={this.state.isPickLoading}
|
loading={this.state.isLoading.pick}
|
||||||
disabled={
|
disabled={
|
||||||
this.state.isPickDisable || this.state.isPickDisable_main
|
this.state.isDisable.pick || this.state.isDisable_main.pick
|
||||||
}
|
}
|
||||||
type='secondary'
|
type='secondary'
|
||||||
onClick={this.onPick.bind(this)}
|
onClick={this.onPick.bind(this)}
|
||||||
|
|
@ -336,9 +524,9 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
|
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
|
||||||
>
|
>
|
||||||
<AtButton
|
<AtButton
|
||||||
loading={this.state.isOreoLoading}
|
loading={this.state.isLoading.oreo}
|
||||||
disabled={
|
disabled={
|
||||||
this.state.isOreoDisable || this.state.isOreoDisable_main
|
this.state.isDisable.oreo || this.state.isDisable_main.oreo
|
||||||
}
|
}
|
||||||
type='primary'
|
type='primary'
|
||||||
onClick={this.onAddToOreo.bind(this)}
|
onClick={this.onAddToOreo.bind(this)}
|
||||||
|
|
@ -356,8 +544,8 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
|
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
|
||||||
>
|
>
|
||||||
<AtButton
|
<AtButton
|
||||||
loading={this.state.isStatusLoading}
|
loading={this.state.isLoading.status}
|
||||||
disabled={this.state.isStatusDisable}
|
disabled={this.state.isDisable.status}
|
||||||
type='primary'
|
type='primary'
|
||||||
onClick={this.onChangeStatus.bind(this)}
|
onClick={this.onChangeStatus.bind(this)}
|
||||||
>
|
>
|
||||||
|
|
@ -370,9 +558,10 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
>
|
>
|
||||||
<AtButton
|
<AtButton
|
||||||
disabled={
|
disabled={
|
||||||
this.state.isCommentDisable || this.state.isCommentDisable_main
|
this.state.isDisable.comment ||
|
||||||
|
this.state.isDisable_main.comment
|
||||||
}
|
}
|
||||||
loading={this.state.isCommentLoading}
|
loading={this.state.isLoading.comment}
|
||||||
type='secondary'
|
type='secondary'
|
||||||
onClick={this.onAddComment.bind(this)}
|
onClick={this.onAddComment.bind(this)}
|
||||||
>
|
>
|
||||||
|
|
@ -391,9 +580,10 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
|
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
|
||||||
>
|
>
|
||||||
<AtButton
|
<AtButton
|
||||||
loading={this.state.isRetrieveLoading}
|
loading={this.state.isLoading.retrieve}
|
||||||
disabled={
|
disabled={
|
||||||
this.state.isRetrieveDisable || this.state.isRetrieveDisable_main
|
this.state.isDisable.retrieve ||
|
||||||
|
this.state.isDisable_main.retrieve
|
||||||
}
|
}
|
||||||
type='primary'
|
type='primary'
|
||||||
onClick={this.onRetrieved.bind(this)}
|
onClick={this.onRetrieved.bind(this)}
|
||||||
|
|
@ -407,9 +597,9 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
>
|
>
|
||||||
<AtButton
|
<AtButton
|
||||||
disabled={
|
disabled={
|
||||||
this.state.isCommentDisable || this.state.isCommentDisable_main
|
this.state.isDisable.comment || this.state.isDisable_main.comment
|
||||||
}
|
}
|
||||||
loading={this.state.isCommentLoading}
|
loading={this.state.isLoading.comment}
|
||||||
type='secondary'
|
type='secondary'
|
||||||
onClick={this.onAddComment.bind(this)}
|
onClick={this.onAddComment.bind(this)}
|
||||||
>
|
>
|
||||||
|
|
@ -419,6 +609,26 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const actionSheetItemList: Array<StatusStr> = [
|
||||||
|
'0',
|
||||||
|
'1',
|
||||||
|
'2',
|
||||||
|
'3',
|
||||||
|
'4',
|
||||||
|
'5',
|
||||||
|
'6',
|
||||||
|
'7',
|
||||||
|
];
|
||||||
|
|
||||||
|
const sheetItemsRenderer = actionSheetItemList.map((item, idx) => (
|
||||||
|
<AtActionSheetItem
|
||||||
|
key={idx}
|
||||||
|
onClick={this.handleStatusChange.bind(this, idx)}
|
||||||
|
>
|
||||||
|
{pt.get().ticketDetail.statusModifyMessage.get(item)}
|
||||||
|
</AtActionSheetItem>
|
||||||
|
));
|
||||||
|
|
||||||
const isInfoShow = {
|
const isInfoShow = {
|
||||||
device: true,
|
device: true,
|
||||||
createdTime: true,
|
createdTime: true,
|
||||||
|
|
@ -433,7 +643,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
<View>
|
<View>
|
||||||
<AtMessage />
|
<AtMessage />
|
||||||
<AtModal
|
<AtModal
|
||||||
isOpened={this.state.showOreoModal}
|
isOpened={this.state.show.modal.oreo}
|
||||||
title={pt.get().modal.addToOreo.title}
|
title={pt.get().modal.addToOreo.title}
|
||||||
cancelText={pt.get().modal.cancel}
|
cancelText={pt.get().modal.cancel}
|
||||||
confirmText={pt.get().modal.confirm}
|
confirmText={pt.get().modal.confirm}
|
||||||
|
|
@ -442,7 +652,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
content={pt.get().modal.addToOreo.content}
|
content={pt.get().modal.addToOreo.content}
|
||||||
/>
|
/>
|
||||||
<AtModal
|
<AtModal
|
||||||
isOpened={this.state.showRetrieveModal}
|
isOpened={this.state.show.modal.retrieve}
|
||||||
title={pt.get().modal.retrieve.title}
|
title={pt.get().modal.retrieve.title}
|
||||||
cancelText={pt.get().modal.cancel}
|
cancelText={pt.get().modal.cancel}
|
||||||
confirmText={pt.get().modal.confirm}
|
confirmText={pt.get().modal.confirm}
|
||||||
|
|
@ -451,7 +661,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
content={pt.get().modal.retrieve.content}
|
content={pt.get().modal.retrieve.content}
|
||||||
/>
|
/>
|
||||||
<AtModal
|
<AtModal
|
||||||
isOpened={this.state.showPickModal}
|
isOpened={this.state.show.modal.pick}
|
||||||
title={pt.get().modal.pick.title}
|
title={pt.get().modal.pick.title}
|
||||||
cancelText={pt.get().modal.cancel}
|
cancelText={pt.get().modal.cancel}
|
||||||
confirmText={pt.get().modal.confirm}
|
confirmText={pt.get().modal.confirm}
|
||||||
|
|
@ -460,7 +670,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
content={pt.get().modal.pick.content}
|
content={pt.get().modal.pick.content}
|
||||||
/>
|
/>
|
||||||
<AtFloatLayout
|
<AtFloatLayout
|
||||||
isOpened={this.state.showCommentLayout}
|
isOpened={this.state.show.layout.comment}
|
||||||
title={pt.get().ticketDetail.comment.title}
|
title={pt.get().ticketDetail.comment.title}
|
||||||
onClose={this.handleCommentCancel.bind(this)}
|
onClose={this.handleCommentCancel.bind(this)}
|
||||||
>
|
>
|
||||||
|
|
@ -478,7 +688,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
</AtForm>
|
</AtForm>
|
||||||
</AtFloatLayout>
|
</AtFloatLayout>
|
||||||
<AtFloatLayout
|
<AtFloatLayout
|
||||||
isOpened={this.state.showReminderLayout}
|
isOpened={this.state.show.layout.reminder}
|
||||||
title={pt.get().ticketDetail.reminder.title}
|
title={pt.get().ticketDetail.reminder.title}
|
||||||
onClose={this.handleReminderCancel.bind(this)}
|
onClose={this.handleReminderCancel.bind(this)}
|
||||||
>
|
>
|
||||||
|
|
@ -489,46 +699,23 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
onChange={this.handleReminderChange.bind(this)}
|
onChange={this.handleReminderChange.bind(this)}
|
||||||
/>
|
/>
|
||||||
<AtButton
|
<AtButton
|
||||||
loading={this.state.isReminderLoading}
|
loading={this.state.isLoading.reminder}
|
||||||
formType='submit'
|
formType='submit'
|
||||||
type='primary'
|
type='primary'
|
||||||
disabled={this.state.isReminderDisable}
|
disabled={this.state.isDisable.reminder}
|
||||||
>
|
>
|
||||||
{pt.get().button.buttonText.submit}
|
{pt.get().button.buttonText.submit}
|
||||||
</AtButton>
|
</AtButton>
|
||||||
</AtForm>
|
</AtForm>
|
||||||
</AtFloatLayout>
|
</AtFloatLayout>
|
||||||
<AtActionSheet
|
<AtActionSheet
|
||||||
isOpened={this.state.showStatusSheet}
|
isOpened={this.state.show.actionSheet.status}
|
||||||
cancelText={pt.get().ticketDetail.status.cancel}
|
cancelText={pt.get().ticketDetail.status.cancel}
|
||||||
title={pt.get().ticketDetail.status.title}
|
title={pt.get().ticketDetail.status.title}
|
||||||
onCancel={this.handleStatusCancel.bind(this)}
|
onCancel={this.handleStatusCancel.bind(this)}
|
||||||
onClose={this.handleStatusCancel.bind(this)}
|
onClose={this.handleStatusCancel.bind(this)}
|
||||||
>
|
>
|
||||||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 0)}>
|
{sheetItemsRenderer}
|
||||||
{pt.get().ticketDetail.statusModifyMessage.get('0')}
|
|
||||||
</AtActionSheetItem>
|
|
||||||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 1)}>
|
|
||||||
{pt.get().ticketDetail.statusModifyMessage.get('1')}
|
|
||||||
</AtActionSheetItem>
|
|
||||||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 2)}>
|
|
||||||
{pt.get().ticketDetail.statusModifyMessage.get('2')}
|
|
||||||
</AtActionSheetItem>
|
|
||||||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 3)}>
|
|
||||||
{pt.get().ticketDetail.statusModifyMessage.get('3')}
|
|
||||||
</AtActionSheetItem>
|
|
||||||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 4)}>
|
|
||||||
{pt.get().ticketDetail.statusModifyMessage.get('4')}
|
|
||||||
</AtActionSheetItem>
|
|
||||||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 5)}>
|
|
||||||
{pt.get().ticketDetail.statusModifyMessage.get('5')}
|
|
||||||
</AtActionSheetItem>
|
|
||||||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 6)}>
|
|
||||||
{pt.get().ticketDetail.statusModifyMessage.get('6')}
|
|
||||||
</AtActionSheetItem>
|
|
||||||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 7)}>
|
|
||||||
{pt.get().ticketDetail.statusModifyMessage.get('7')}
|
|
||||||
</AtActionSheetItem>
|
|
||||||
</AtActionSheet>
|
</AtActionSheet>
|
||||||
<DetailFramework
|
<DetailFramework
|
||||||
middleButton={middleButton}
|
middleButton={middleButton}
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,4 @@ export class ShowElements {
|
||||||
notelist: JSX.Element;
|
notelist: JSX.Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type StatusStr = '1' | '2' | '3' | '4' | '5';
|
export type StatusStr = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7';
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ export default class UserPage extends Component {
|
||||||
className='at-row at-row__justify--center at-row__align--center'
|
className='at-row at-row__justify--center at-row__align--center'
|
||||||
style='height:120rpx;color:#696969;'
|
style='height:120rpx;color:#696969;'
|
||||||
>
|
>
|
||||||
<Text style={{ fontSize: '32rpx' }}> EVA Eta v1.0.1</Text>
|
<Text style={{ fontSize: '32rpx' }}> EVA Eta v1.0.2</Text>
|
||||||
</View>
|
</View>
|
||||||
<AtList>
|
<AtList>
|
||||||
<AtListItem
|
<AtListItem
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,10 @@ import { getUrl } from '.';
|
||||||
|
|
||||||
export function addToOreo(that: TicketDetail) {
|
export function addToOreo(that: TicketDetail) {
|
||||||
that.setState({
|
that.setState({
|
||||||
isOreoLoading: true,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
oreo: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/tickets/addtooreo'),
|
url: getUrl('/tickets/addtooreo'),
|
||||||
|
|
@ -19,7 +22,10 @@ export function addToOreo(that: TicketDetail) {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
that.setState({
|
that.setState({
|
||||||
isOreoLoading: false,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
oreo: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.success,
|
message: pt.get().button.submitText.success,
|
||||||
|
|
@ -29,7 +35,10 @@ export function addToOreo(that: TicketDetail) {
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err.errMsg);
|
console.log(err.errMsg);
|
||||||
that.setState({
|
that.setState({
|
||||||
isOreoLoading: false,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
oreo: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.error + err.errMsg,
|
message: pt.get().button.submitText.error + err.errMsg,
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,12 @@ import { getUrl } from '.';
|
||||||
|
|
||||||
const reLaunchInterval = 1000;
|
const reLaunchInterval = 1000;
|
||||||
|
|
||||||
export function changeStatus(that: TicketDetail, status: number) {
|
export function changeStatus(that: TicketDetail) {
|
||||||
that.setState({
|
that.setState({
|
||||||
isStatusLoading: true,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
status: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/tickets/update'),
|
url: getUrl('/tickets/update'),
|
||||||
|
|
@ -16,13 +19,16 @@ export function changeStatus(that: TicketDetail, status: number) {
|
||||||
data: {
|
data: {
|
||||||
token: wechatUser.getToken(),
|
token: wechatUser.getToken(),
|
||||||
id: that.state.id,
|
id: that.state.id,
|
||||||
status: status,
|
status: that.state.statusToBe,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
that.setState({
|
that.setState({
|
||||||
isStatusLoading: false,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
status: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.success,
|
message: pt.get().button.submitText.success,
|
||||||
|
|
@ -37,7 +43,10 @@ export function changeStatus(that: TicketDetail, status: number) {
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err.errMsg);
|
console.log(err.errMsg);
|
||||||
that.setState({
|
that.setState({
|
||||||
isStatusLoading: false,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
status: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.error + err.errMsg,
|
message: pt.get().button.submitText.error + err.errMsg,
|
||||||
|
|
|
||||||
|
|
@ -13,19 +13,24 @@ export function getDisable(that: TicketDetail, id: number) {
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.data;
|
const data = res.data.data;
|
||||||
|
let isDisable_main = that.state.isDisable_main;
|
||||||
if (data.status === 3 || data.status === 5 || data.status === 7) {
|
if (data.status === 3 || data.status === 5 || data.status === 7) {
|
||||||
that.setState({
|
isDisable_main.retrieve = true;
|
||||||
isRetrieveDisable_main: true,
|
isDisable_main.comment = true;
|
||||||
isCommentDisable_main: true,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (wechatUser.getAccess()) {
|
if (wechatUser.getAccess()) {
|
||||||
if (data.workers.includes(wechatUser.getInfo().name)) {
|
if (data.workers.includes(wechatUser.getInfo().name)) {
|
||||||
|
isDisable_main.pick = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
that.setState({
|
that.setState({
|
||||||
isPickDisable_main: true,
|
isDisable_main: {
|
||||||
|
...that.state.isDisable_main,
|
||||||
|
retrieve: isDisable_main.retrieve,
|
||||||
|
comment: isDisable_main.comment,
|
||||||
|
pick: isDisable_main.pick,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((reason) => {
|
.catch((reason) => {
|
||||||
console.log(reason.errMsg);
|
console.log(reason.errMsg);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@ const reLaunchInterval = 1000;
|
||||||
|
|
||||||
export function pickTicket(that: TicketDetail) {
|
export function pickTicket(that: TicketDetail) {
|
||||||
that.setState({
|
that.setState({
|
||||||
isPickLoading: true,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
pick: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/tickets/pick'),
|
url: getUrl('/tickets/pick'),
|
||||||
|
|
@ -21,7 +24,10 @@ export function pickTicket(that: TicketDetail) {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
that.setState({
|
that.setState({
|
||||||
isPickLoading: false,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
pick: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.success,
|
message: pt.get().button.submitText.success,
|
||||||
|
|
@ -36,7 +42,10 @@ export function pickTicket(that: TicketDetail) {
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err.errMsg);
|
console.log(err.errMsg);
|
||||||
that.setState({
|
that.setState({
|
||||||
isPickLoading: false,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
pick: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.error + err.errMsg,
|
message: pt.get().button.submitText.error + err.errMsg,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@ const reLaunchInterval = 1000;
|
||||||
|
|
||||||
export function retrieve(that: TicketDetail) {
|
export function retrieve(that: TicketDetail) {
|
||||||
that.setState({
|
that.setState({
|
||||||
isRetrieveLoading: true,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
retrieve: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/tickets/retrieve'),
|
url: getUrl('/tickets/retrieve'),
|
||||||
|
|
@ -21,7 +24,10 @@ export function retrieve(that: TicketDetail) {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
that.setState({
|
that.setState({
|
||||||
isRetrieveLoading: false,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
retrieve: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.success,
|
message: pt.get().button.submitText.success,
|
||||||
|
|
@ -36,7 +42,10 @@ export function retrieve(that: TicketDetail) {
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err.errMsg);
|
console.log(err.errMsg);
|
||||||
that.setState({
|
that.setState({
|
||||||
isRetrieveLoading: false,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
retrieve: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.error + err.errMsg,
|
message: pt.get().button.submitText.error + err.errMsg,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@ const reLaunchInterval = 1000;
|
||||||
|
|
||||||
export function submitComment(that: TicketDetail) {
|
export function submitComment(that: TicketDetail) {
|
||||||
that.setState({
|
that.setState({
|
||||||
isCommentLoading: true,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
comment: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/report'),
|
url: getUrl('/report'),
|
||||||
|
|
@ -21,7 +24,10 @@ export function submitComment(that: TicketDetail) {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
that.setState({
|
that.setState({
|
||||||
isCommentLoading: false,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
comment: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.success,
|
message: pt.get().button.submitText.success,
|
||||||
|
|
@ -36,7 +42,10 @@ export function submitComment(that: TicketDetail) {
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err.errMsg);
|
console.log(err.errMsg);
|
||||||
that.setState({
|
that.setState({
|
||||||
isCommentLoading: false,
|
isLoading: {
|
||||||
|
...that.state.isLoading,
|
||||||
|
comment: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.error + err.errMsg,
|
message: pt.get().button.submitText.error + err.errMsg,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue