77ebf04d
梁保满
个人版
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<template>
<div>
<back-box>
<template slot="title">
<span>数据同步</span>
</template>
</back-box>
<div class="page-content">
<div class="down-item">
<p class="h-title">从U盘上传</p>
<p class="txt">
本功能帮助无法上网的授课端软件,将本地数据同步到云平台。
</p>
|
9865dde4
梁保满
数据同步
|
14
15
|
<el-upload class="upload-demo" ref="upload" :action="url" :multiple="false" :with-credentials="true" :limit="1"
:on-change="change" :on-success="upSuccess" :on-error="upError">
|
77ebf04d
梁保满
个人版
|
16
17
18
19
20
21
22
23
24
|
<div class="btn-box">
<i class="fa fa-cloud-upload"></i>
<el-button type="primary" round>选择文件</el-button>
</div>
</el-upload>
</div>
<div class="down-item">
<p class="h-title">数据导出至U盘</p>
|
9865dde4
梁保满
数据同步
|
25
|
<p class="txt txt2">本功能将云平台的数据导出到U盘。</p>
|
77ebf04d
梁保满
个人版
|
26
|
<div class="btn-box btn-box2" v-loading="downLoading">
|
9865dde4
梁保满
数据同步
|
27
28
29
|
<p class="p1">
<el-checkbox-group v-model="type">
<el-checkbox :label="0">班级信息</el-checkbox>
|
8ad80958
梁保满
教师学生管理,设备状态
|
30
|
<el-checkbox :label="1">备题组卷数据</el-checkbox>
|
9865dde4
梁保满
数据同步
|
31
32
33
34
35
36
37
38
39
40
|
<el-checkbox :label="2">报表数据</el-checkbox>
</el-checkbox-group>
</p>
<p class="p1">
<el-radio-group v-model="dateType">
<el-radio :label="0">全部</el-radio>
<el-radio :label="1">最近一个月</el-radio>
</el-radio-group>
</p>
<el-button type="primary" round @click="downloadFile">文件下载</el-button>
|
77ebf04d
梁保满
个人版
|
41
42
43
|
</div>
</div>
</div>
|
f45b3c05
LH_PC
云平台新UI界面
|
44
|
<el-dialog :append-to-body="true" :close-on-click-modal="false" title="" :visible.sync="dialogVisible" width="300" center>
|
77ebf04d
梁保满
个人版
|
45
46
|
<el-result icon="success" title="上传成功"> </el-result>
<el-descriptions title="" :column="1">
|
9865dde4
梁保满
数据同步
|
47
48
49
|
<el-descriptions-item label="导入答题卡数量">{{ tipData.paperNum }}</el-descriptions-item>
<el-descriptions-item label="导入随堂问报表数量">{{ tipData.periodNum }}</el-descriptions-item>
<el-descriptions-item label="导入即时测报表数量">{{ tipData.examNum }}</el-descriptions-item>
|
77ebf04d
梁保满
个人版
|
50
51
|
</el-descriptions>
<span slot="footer" class="dialog-footer">
|
9865dde4
梁保满
数据同步
|
52
|
<el-button type="primary" @click="dialogVisible = false">确 定</el-button>
|
77ebf04d
梁保满
个人版
|
53
54
55
56
57
58
59
60
61
62
|
</span>
</el-dialog>
</div>
</template>
<script>
import { formatDate } from "@/utils";
export default {
data() {
return {
|
9865dde4
梁保满
数据同步
|
63
|
role: "",
|
77ebf04d
梁保满
个人版
|
64
65
66
67
68
69
70
71
72
|
downLoading: false,
url: "/api_html/teaching/importData",
file: {},
dialogVisible: false,
tipData: {
paperNum: 0,
periodNum: 0,
examNum: 0,
},
|
9865dde4
梁保满
数据同步
|
73
74
|
type: [0, 1, 2],
dateType: 0
|
77ebf04d
梁保满
个人版
|
75
76
|
};
},
|
9865dde4
梁保满
数据同步
|
77
78
79
80
81
82
83
84
|
created() {
this.role =
this.$store.getters.info.showRole ||
this.$store.getters.info.permissions[0].role;
if (this.role == "ROLE_PERSONAL") {
this.url = "/api_html/personal/importData"
}
},
|
77ebf04d
梁保满
个人版
|
85
86
87
88
|
methods: {
async downloadFile() {
if (this.downLoading) return;
this.downLoading = true;
|
9865dde4
梁保满
数据同步
|
89
90
91
92
93
94
95
96
97
98
99
100
|
let query = {}
if (this.type.length == 3 || this.type.length == 0) {
query.type = []
} else {
query.type = this.type
}
if (this.dateType == 1) {
let times = new Date().getTime() - 30 * 24 * 60 * 60 * 1000
query.exportData = formatDate(times, "yyyy-MM-dd");
query.exportData = query.exportData.replaceAll("-", "")
}
|
9865dde4
梁保满
数据同步
|
101
|
const exportData = this.role == "ROLE_PERSONAL" ? this.$request.pExportData : this.$request.exportData
|
8ad80958
梁保满
教师学生管理,设备状态
|
102
|
const data = await exportData({ ...query });
|
77ebf04d
梁保满
个人版
|
103
|
this.downLoading = false;
|
77ebf04d
梁保满
个人版
|
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
|
if (data) {
let blob = new Blob([data], { type: "application/octet-stream" });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
document.body.appendChild(link);
link.download =
this.$store.getters.info.name +
formatDate(new Date(), "yyyy_MM_dd_hh_mm_ss") +
"文件.json";
link.href = url;
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
} else {
this.$message.error("下载失败,请重试");
}
},
async submitUpload() {
this.$refs.upload.submit();
// const formData = new FormData()
// formData.append('id',this.componentId)
// formData.append('file',new File(this.file.raw))
// let {status,info} = await uploadExcel(formData);
// if(status===0){
// this.$message.success(info);
// this.$emit("upSuccess")
// } else {
// this.$message.error(info);
// }
},
upSuccess(res) {
if (res && res.status == 0) {
this.tipData = res.data
this.dialogVisible = true
} else {
this.$message.error(res.info);
}
},
upError(res) {
debugger;
if (res && res.status == 0) {
this.$message.error("上传失败");
} else {
this.$message.error(res.message);
}
},
change(file) {
this.file = file;
},
},
};
</script>
<style lang="scss" scoped>
.page-content {
padding: 50px;
display: flex;
justify-content: center;
|
9865dde4
梁保满
数据同步
|
163
|
|
77ebf04d
梁保满
个人版
|
164
|
.down-item {
|
6bca489d
LH_PC
云平台二期UI
|
165
|
width: 450px;
|
9865dde4
梁保满
数据同步
|
166
|
height: 330px;
|
77ebf04d
梁保满
个人版
|
167
168
169
170
|
border-radius: 20px;
margin: 20px;
background: #f8f8f8;
box-shadow: 2px 2px 5px #ccc;
|
9865dde4
梁保满
数据同步
|
171
|
|
77ebf04d
梁保满
个人版
|
172
173
174
175
176
|
.h-title {
font-size: 16px;
color: #667ffd;
padding: 16px 0 16px 12px;
}
|
9865dde4
梁保满
数据同步
|
177
|
|
77ebf04d
梁保满
个人版
|
178
179
180
181
182
183
184
185
|
.txt {
height: 80px;
padding: 0 20px;
font-size: 16px;
color: #7f7f7f;
line-height: 24px;
text-align: center;
}
|
9865dde4
梁保满
数据同步
|
186
187
188
189
190
191
192
193
|
.txt2 {
height: 60px;
}
.p1 {
margin-bottom: 30px;
}
|
77ebf04d
梁保满
个人版
|
194
|
}
|
9865dde4
梁保满
数据同步
|
195
|
|
77ebf04d
梁保满
个人版
|
196
|
.upload-demo {
|
9865dde4
梁保满
数据同步
|
197
198
199
|
padding: 0 20px 20px;
:deep(.el-upload--text) {
|
77ebf04d
梁保满
个人版
|
200
201
202
|
display: block;
}
}
|
9865dde4
梁保满
数据同步
|
203
|
|
77ebf04d
梁保满
个人版
|
204
205
206
|
:deep(.el-upload) {
margin: 0 auto;
}
|
9865dde4
梁保满
数据同步
|
207
|
|
77ebf04d
梁保满
个人版
|
208
209
210
211
212
213
|
.btn-box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding-bottom: 10px;
|
9865dde4
梁保满
数据同步
|
214
|
|
77ebf04d
梁保满
个人版
|
215
216
217
218
219
220
221
|
.fa {
font-size: 80px;
color: #aeaeae;
padding-bottom: 10px;
cursor: pointer;
}
}
|
9865dde4
梁保满
数据同步
|
222
|
|
77ebf04d
梁保满
个人版
|
223
224
225
226
227
|
.btn-box {
width: 100%;
}
}
</style>
|