dayAnalysisRerun.vue
4.23 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<template>
<a-form class="data-return-form" :model="queryForm" layout="inline" :label-col="{ style: { width: '70px' } }">
<a-form-item label="集团:">
<a-select v-model:value="queryForm.account_id" style="width: 280px" mode="multiple" :maxTagCount="1" :options="accountList" @change="onAccountChange" optionFilterProp="label" show-search>
</a-select>
</a-form-item>
<a-form-item label="广场:">
<a-select v-model:value="queryForm.plaza_id" style="width: 280px" mode="multiple" :maxTagCount="1" :options="plazaList" optionFilterProp="label" show-search>
</a-select>
</a-form-item>
<a-form-item label="开始日期:">
<a-date-picker v-model:value="queryForm.startDate" />
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker v-model:value="queryForm.endDate" />
</a-form-item>
<a-form-item>
<a-button type="primary" @click="confirmSearch">开始</a-button>
</a-form-item>
</a-form>
<!--新的日志-->
<div class="card-container">
<a-card title="全天分析重跑结果" style="width: 600px">
<el-row v-for="(item,index) in msgLogList" :key="index" style="padding: 2px 0;">
<el-col :span="8">
{{item.time}}
</el-col>
<el-col :span="16">
全天分析任务已提交,正在重跑中...
</el-col>
</el-row>
</a-card>
</div>
</template>
<script>
import { reactive, ref, toRaw } from 'vue'
import moment from 'moment'
import { ElMessage } from 'element-plus'
import snapshotRecordApi from '@/views/SnapshotCluster/SnapshotRecord/SnapshotRecordApi'
import { isArray } from '@/PublicUtil/Judgment'
import { formatDate } from '@/PublicUtil/PublicUtil'
import dayAnalysisRerunApi from '@/views/dayAnalysisRerun/dayAnalysisRerunApi'
export default {
components: {
VNodes: (_, {attrs}) => {
return attrs.vnodes
},
},
setup() {
const accountList = ref([])
const plazaList = ref([])
const queryForm = reactive({
account_id: [],
plaza_id: [],
startDate: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'),
endDate: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'),
})
const onAccountChange = function() {
getPlazaList()
}
const getPlazaList = function() {
queryForm.plaza_id = []
plazaList.value = []
snapshotRecordApi.getPlazaList({
account_id: queryForm.account_id.toString()
}).then(
(r) => {
if (isArray(r)) {
for (const item of r) {
plazaList.value.push({
value: item.id,
label: item.name,
})
}
}
}
)
}
const getAccountList = function() {
queryForm.account_id = []
accountList.value = []
snapshotRecordApi.getAccountList().then(
(r) => {
if (isArray(r)) {
for (const item of r) {
accountList.value.push({
value: item.id,
label: item.name,
})
}
}
}
)
}
// 新需求:数据重跑
const msgLogList = ref([])
const confirmSearch = function() {
if (queryForm.account_id.length < 1) {
ElMessage({
message: `至少选择一个集团`,
type: 'error'
})
return
}
if (queryForm.plaza_id.length < 1) {
ElMessage({
message: `至少选择一个门店`,
type: 'error'
})
return
}
msgLogList.value = []
const rawData = toRaw(queryForm)
const params = {
mallIds:queryForm.plaza_id.join(','),
startDate: formatDate(rawData.startDate),
endDate: formatDate(rawData.endDate),
}
dayAnalysisRerunApi.getResult(params).then(
(r) => {
console.log('getResult', r)
if (r.msg_code==200) {
msgLogList.value.push({time:moment().format('YYYY-MM-DD HH:mm:ss')})
}
}
)
}
const __main = function() {
getAccountList()
}
__main()
return {
accountList,
plazaList,
queryForm,
onAccountChange,
confirmSearch,
msgLogList,
}
}
}
</script>
<style lang="less" scoped>
.result-wrapper-2 {
width: 50%;
min-width: 600px;
border-radius: 4px;
margin: 20px auto 0;
position: relative;
overflow: auto;
}
.card-container {
display: flex;
justify-content: center;
/deep/.ant-card-body {
height: 370px;
}
}
.data-return-form {
/deep/.ant-form-item {
margin-bottom: 10px;
}
}
</style>