bindDialog.vue
4.39 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
119
120
121
122
123
124
125
<template>
<div>
<a-modal v-model:open="dialogVisible" :title="titleVisible" @ok="handleOk">
<a-spin :spinning="submitted" style="margin-top: 16px;">
<div class="disabledTip" v-if="bindStatus == 1">
<div class="outlinedBox">
<InfoCircleOutlined style="font-size: 16px; color: #1956FE;" />
</div>
<div class="disabledTxt">
<span>确定将此报告绑定到车辆 ( </span>
<span v-for="item in bindList" :key="item.id">
车源号:{{ item?.vehicle?.baseInfo?.sourceNo || '-' }}
</span>
<span> ) 的前端拍卖页面吗?</span>
</div>
</div>
<div class="disabledTip" v-if="bindStatus == 2">
<div class="outlinedBox">
<InfoCircleOutlined style="font-size: 16px; color: #FC8B0A;" />
</div>
<div class="disabledTxt">解绑后,该报告将不再于前端展示,是否确认解绑?</div>
</div>
</a-spin>
</a-modal>
<a-modal v-model:open="tipVisible" title="提示" :width="760">
<div style="width: 100%;max-height: 560px;overflow: auto;">
<div v-for="item in tipList" :key="item" style="height: 32px;line-height: 32px;">
<InfoCircleOutlined style="font-size: 15px; color: #FC8B0A;" />
<span style="padding-left: 8px;">{{ item }}</span>
</div>
</div>
<template #footer></template>
</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 bindDialog extends EnhanceFormComponent<User> {
bindList = [];
dialogVisible = false;
titleVisible = '绑定提示';
bindStatus = null;
tipVisible = false;
tipList = [];
init(data): void {
this.bindStatus = data.bindStatus;
if (this.bindStatus === 1) {
this.titleVisible = '绑定提示';
} else {
this.titleVisible = '解绑提示';
}
this.bindList = data.bindList || [];
this.dialogVisible = true;
}
handleOk() {
this.submitted = true;
const formData = { idList: this.bindList.map(item => item.id) }
if (this.bindStatus == 1) {
DetectionController.inspectReportBind(this.axios, formData).then(response => {
if (response?.data?.code == '200') {
message.success("操作成功");
this.$emit("emitOk");
this.dialogVisible = false;
} else if (response?.data?.code == '1001009') {
this.tipList = (response?.data?.message || '').split("|") || [];
this.$emit("emitOk");
this.dialogVisible = false;
this.tipVisible = true;
} else {
message.error(response?.data?.message || '操作失败');
}
}).finally(() => this.submitted = false);
} else if (this.bindStatus == 2) {
DetectionController.inspectReportUnbind(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">
.disabledTip {
width: 100%;
height: 68px;
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>