cancelDialog.vue
4.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<template>
<div>
<a-modal v-model:open="dialogVisible" title="取消工单" @ok="handleOk">
<a-spin :spinning="submitted" style="margin-top: 16px;">
<a-form layout="vertical" :model="postData" :label-col="labelCol" :wrapper-col="wrapperCol"
ref="formRef">
<div class="disabledTip">
<div class="outlinedBox">
<InfoCircleOutlined style="font-size: 15px; color: #FC8B0A;" />
</div>
<div class="disabledTxt">是否确认取消工单「{{ pageData.woId || '-' }}」?
<br>取消后将通知检测师「{{ pageData?.inspector?.name || '-' }}」,该操作不可撤销。
</div>
</div>
<a-form-item name="cancelType" label="取消原因" :rules="[{ required: true, message: '请选择取消原因' }]">
<a-select ref="select" v-model:value="postData.cancelType" placeholder="请选择取消原因"
style="width: 456px;">
<a-select-option value="车主取消">车主取消</a-select-option>
<a-select-option value="车辆已售">车辆已售</a-select-option>
<a-select-option value="重复派单">重复派单</a-select-option>
<a-select-option value="信息错误">信息错误</a-select-option>
</a-select>
</a-form-item>
<a-form-item name="cancelReason" label="备注说明">
<a-textarea v-model:value="postData.cancelReason" show-count :maxlength="500"
style="width: 456px;" />
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</div>
</template>
<script lang="ts">
import { Component } from 'vue-facing-decorator';
import { EnhanceFormComponent } from "@/core/form/EnhanceFormComponent";
import { DetectionController } from "@/api/DetectionController";
import { message } from "ant-design-vue";
import { User } from "lib/src/entity/security/entity/User";
import { InfoCircleOutlined } from "@ant-design/icons-vue";
@Component({
components: { InfoCircleOutlined }
})
export default class cancelDialog extends EnhanceFormComponent<User> {
pageData = {};
dialogVisible = false;
postData = { id: '', cancelType: null, cancelReason: '' }
init(data): void {
this.pageData = data;
this.postData.id = data.id;
this.postData.cancelType = null;
this.postData.cancelReason = '';
this.dialogVisible = true;
}
handleOk() {
this.$refs.formRef.validate().then((valid) => {
if (valid) {
this.submitted = true;
const formData = {
id: this.postData.id,
cancelType: this.postData.cancelType,
cancelReason: this.postData.cancelReason,
}
DetectionController.inspectOrderCancel(this.axios, formData).then(response => {
if (response?.data?.code == '200') {
message.success("操作成功");
this.$emit("emitOk");
this.dialogVisible = false;
} else {
message.error(response?.data?.message || '操作失败');
}
}).finally(() => this.submitted = false);
}
});
}
}
</script>
<style scoped lang="less">
.tipBox {
width: 100%;
height: 22px;
line-height: 22px;
color: #2f3133;
font-size: 14px;
font-weight: 400;
font-family: "HarmonyOSSansSC";
}
.disabledTip {
width: 100%;
height: 68px;
border-radius: 4px;
background: #fc8b0a1a;
display: flex;
margin-bottom: 20px;
margin-top: 24px;
}
.outlinedBox {
float: left;
margin-left: 16px;
margin-top: 16px;
}
.disabledTxt {
padding-top: 14px;
padding-bottom: 14px;
padding-right: 16px;
padding-left: 8px;
}
</style>