add button disable in ticketdetail with relavant services
parent
f3f5be793b
commit
97a8d0570a
|
|
@ -6,9 +6,9 @@
|
||||||
"owner": "唐姐姐",
|
"owner": "唐姐姐",
|
||||||
"phone": "15555555555",
|
"phone": "15555555555",
|
||||||
"description": "清灰",
|
"description": "清灰",
|
||||||
"workers": [],
|
"workers": ["宇航员"],
|
||||||
"createdTime": "2024-03-07T19:52:48.523303",
|
"createdTime": "2024-03-07T19:52:48.523303",
|
||||||
"status": 2,
|
"status": 5,
|
||||||
"isConfirmed": false,
|
"isConfirmed": false,
|
||||||
"notes": [
|
"notes": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import { addToOreo } from '@/service/addToOreo';
|
||||||
import { pickTicket } from '@/service/pickTicket';
|
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';
|
||||||
|
|
||||||
const submitInterval = 5000;
|
const submitInterval = 5000;
|
||||||
|
|
||||||
|
|
@ -35,14 +36,18 @@ interface TicketDetailState {
|
||||||
comment: string;
|
comment: string;
|
||||||
isOreoLoading: boolean;
|
isOreoLoading: boolean;
|
||||||
isOreoDisable: boolean;
|
isOreoDisable: boolean;
|
||||||
|
isOreoDisable_main: boolean;
|
||||||
isPickLoading: boolean;
|
isPickLoading: boolean;
|
||||||
isPickDisable: boolean;
|
isPickDisable: boolean;
|
||||||
|
isPickDisable_main: boolean;
|
||||||
isRetrieveLoading: boolean;
|
isRetrieveLoading: boolean;
|
||||||
isRetrieveDisable: boolean;
|
isRetrieveDisable: boolean;
|
||||||
|
isRetrieveDisable_main: boolean;
|
||||||
isStatusLoading: boolean;
|
isStatusLoading: boolean;
|
||||||
isStatusDisable: boolean;
|
isStatusDisable: boolean;
|
||||||
isCommentLoading: boolean;
|
isCommentLoading: boolean;
|
||||||
isCommentDisable: boolean;
|
isCommentDisable: boolean;
|
||||||
|
isCommentDisable_main: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
|
|
@ -57,14 +62,18 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
comment: '',
|
comment: '',
|
||||||
isOreoLoading: false,
|
isOreoLoading: false,
|
||||||
isOreoDisable: false,
|
isOreoDisable: false,
|
||||||
|
isOreoDisable_main: false,
|
||||||
isPickLoading: false,
|
isPickLoading: false,
|
||||||
isPickDisable: false,
|
isPickDisable: false,
|
||||||
|
isPickDisable_main: false,
|
||||||
isRetrieveLoading: false,
|
isRetrieveLoading: false,
|
||||||
isRetrieveDisable: false,
|
isRetrieveDisable: false,
|
||||||
|
isRetrieveDisable_main: false,
|
||||||
isStatusLoading: false,
|
isStatusLoading: false,
|
||||||
isStatusDisable: false,
|
isStatusDisable: false,
|
||||||
isCommentLoading: false,
|
isCommentLoading: false,
|
||||||
isCommentDisable: false,
|
isCommentDisable: false,
|
||||||
|
isCommentDisable_main: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
|
|
@ -74,6 +83,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
id: id,
|
id: id,
|
||||||
isMember: wechatUser.getAccess(),
|
isMember: wechatUser.getAccess(),
|
||||||
});
|
});
|
||||||
|
getDisable(this, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
onAddToOreo(): void {
|
onAddToOreo(): void {
|
||||||
|
|
@ -237,7 +247,9 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
>
|
>
|
||||||
<AtButton
|
<AtButton
|
||||||
loading={this.state.isPickLoading}
|
loading={this.state.isPickLoading}
|
||||||
disabled={this.state.isPickDisable}
|
disabled={
|
||||||
|
this.state.isPickDisable || this.state.isPickDisable_main
|
||||||
|
}
|
||||||
type='secondary'
|
type='secondary'
|
||||||
onClick={this.onPick.bind(this)}
|
onClick={this.onPick.bind(this)}
|
||||||
>
|
>
|
||||||
|
|
@ -250,7 +262,9 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
>
|
>
|
||||||
<AtButton
|
<AtButton
|
||||||
loading={this.state.isOreoLoading}
|
loading={this.state.isOreoLoading}
|
||||||
disabled={this.state.isOreoDisable}
|
disabled={
|
||||||
|
this.state.isOreoDisable || this.state.isOreoDisable_main
|
||||||
|
}
|
||||||
type='primary'
|
type='primary'
|
||||||
onClick={this.onAddToOreo.bind(this)}
|
onClick={this.onAddToOreo.bind(this)}
|
||||||
>
|
>
|
||||||
|
|
@ -280,7 +294,9 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
|
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
|
||||||
>
|
>
|
||||||
<AtButton
|
<AtButton
|
||||||
disabled={this.state.isCommentDisable}
|
disabled={
|
||||||
|
this.state.isCommentDisable || this.state.isCommentDisable_main
|
||||||
|
}
|
||||||
loading={this.state.isCommentLoading}
|
loading={this.state.isCommentLoading}
|
||||||
type='secondary'
|
type='secondary'
|
||||||
onClick={this.onAddComment.bind(this)}
|
onClick={this.onAddComment.bind(this)}
|
||||||
|
|
@ -301,7 +317,9 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
>
|
>
|
||||||
<AtButton
|
<AtButton
|
||||||
loading={this.state.isRetrieveLoading}
|
loading={this.state.isRetrieveLoading}
|
||||||
disabled={this.state.isRetrieveDisable}
|
disabled={
|
||||||
|
this.state.isRetrieveDisable || this.state.isRetrieveDisable_main
|
||||||
|
}
|
||||||
type='primary'
|
type='primary'
|
||||||
onClick={this.onRetrieved.bind(this)}
|
onClick={this.onRetrieved.bind(this)}
|
||||||
>
|
>
|
||||||
|
|
@ -313,7 +331,9 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
style={{ marginRight: '20rpx', paddingLeft: '10rpx', width: '50%' }}
|
style={{ marginRight: '20rpx', paddingLeft: '10rpx', width: '50%' }}
|
||||||
>
|
>
|
||||||
<AtButton
|
<AtButton
|
||||||
disabled={this.state.isCommentDisable}
|
disabled={
|
||||||
|
this.state.isCommentDisable || this.state.isCommentDisable_main
|
||||||
|
}
|
||||||
loading={this.state.isCommentLoading}
|
loading={this.state.isCommentLoading}
|
||||||
type='secondary'
|
type='secondary'
|
||||||
onClick={this.onAddComment.bind(this)}
|
onClick={this.onAddComment.bind(this)}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ export class TicketInfo {
|
||||||
createdTime: moment.Moment;
|
createdTime: moment.Moment;
|
||||||
status: FixStatus;
|
status: FixStatus;
|
||||||
info: Info;
|
info: Info;
|
||||||
|
workers: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TicketNote {
|
export class TicketNote {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import wechatUser from '@/wechat';
|
||||||
|
import { getUrl } from '.';
|
||||||
|
|
||||||
|
export function getDisable(that: TicketDetail, id: number) {
|
||||||
|
Taro.request({
|
||||||
|
url: getUrl('/tickets/info'),
|
||||||
|
method: 'GET',
|
||||||
|
data: {
|
||||||
|
id: id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
const data = res.data.data;
|
||||||
|
if (data.status === 3 || data.status === 5 || data.status === 7) {
|
||||||
|
that.setState({
|
||||||
|
isRetrieveDisable_main: true,
|
||||||
|
isCommentDisable_main: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (wechatUser.getAccess()) {
|
||||||
|
if (data.workers.includes(wechatUser.getInfo().name)) {
|
||||||
|
that.setState({
|
||||||
|
isPickDisable_main: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((reason) => {
|
||||||
|
console.error(reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ export function memberLogin(that: UserMemberPage) {
|
||||||
wechatUser.setInfo(res.data.data as UserInfo);
|
wechatUser.setInfo(res.data.data as UserInfo);
|
||||||
wechatUser.setAccess(true);
|
wechatUser.setAccess(true);
|
||||||
Taro.reLaunch({
|
Taro.reLaunch({
|
||||||
url: '/pages/member/member',
|
url: '/pages/index/index',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ export function getTicketInfo(that: DetailFramework, id: number) {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
type: data.type,
|
type: data.type,
|
||||||
device: data.device,
|
device: data.device,
|
||||||
|
workers: data.workers,
|
||||||
deviceModel: data.deviceModel,
|
deviceModel: data.deviceModel,
|
||||||
description: data.description,
|
description: data.description,
|
||||||
createdTime: moment(data.createdTime as string),
|
createdTime: moment(data.createdTime as string),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue