完成导入账号功能
parent
4f3d028beb
commit
26e43ae624
|
@ -15,6 +15,7 @@
|
||||||
"echarts": "^5.3.3",
|
"echarts": "^5.3.3",
|
||||||
"element-plus": "^2.2.6",
|
"element-plus": "^2.2.6",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
|
"spark-md5": "^3.0.2",
|
||||||
"vue": "^3.0.0",
|
"vue": "^3.0.0",
|
||||||
"vue-router": "^4.0.0-0",
|
"vue-router": "^4.0.0-0",
|
||||||
"vuex": "^4.0.2",
|
"vuex": "^4.0.2",
|
||||||
|
@ -12665,6 +12666,11 @@
|
||||||
"resolved": "https://registry.npmmirror.com/sourcemap-codec/download/sourcemap-codec-1.4.8.tgz",
|
"resolved": "https://registry.npmmirror.com/sourcemap-codec/download/sourcemap-codec-1.4.8.tgz",
|
||||||
"integrity": "sha1-6oBL2UhXQC5pktBaOO8a41qatMQ="
|
"integrity": "sha1-6oBL2UhXQC5pktBaOO8a41qatMQ="
|
||||||
},
|
},
|
||||||
|
"node_modules/spark-md5": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/spark-md5/-/spark-md5-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw=="
|
||||||
|
},
|
||||||
"node_modules/spdx-correct": {
|
"node_modules/spdx-correct": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmmirror.com/spdx-correct/download/spdx-correct-3.1.1.tgz",
|
"resolved": "https://registry.npmmirror.com/spdx-correct/download/spdx-correct-3.1.1.tgz",
|
||||||
|
@ -25999,6 +26005,11 @@
|
||||||
"resolved": "https://registry.npmmirror.com/sourcemap-codec/download/sourcemap-codec-1.4.8.tgz",
|
"resolved": "https://registry.npmmirror.com/sourcemap-codec/download/sourcemap-codec-1.4.8.tgz",
|
||||||
"integrity": "sha1-6oBL2UhXQC5pktBaOO8a41qatMQ="
|
"integrity": "sha1-6oBL2UhXQC5pktBaOO8a41qatMQ="
|
||||||
},
|
},
|
||||||
|
"spark-md5": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/spark-md5/-/spark-md5-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw=="
|
||||||
|
},
|
||||||
"spdx-correct": {
|
"spdx-correct": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmmirror.com/spdx-correct/download/spdx-correct-3.1.1.tgz",
|
"resolved": "https://registry.npmmirror.com/spdx-correct/download/spdx-correct-3.1.1.tgz",
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
"echarts": "^5.3.3",
|
"echarts": "^5.3.3",
|
||||||
"element-plus": "^2.2.6",
|
"element-plus": "^2.2.6",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
|
"spark-md5": "^3.0.2",
|
||||||
"vue": "^3.0.0",
|
"vue": "^3.0.0",
|
||||||
"vue-router": "^4.0.0-0",
|
"vue-router": "^4.0.0-0",
|
||||||
"vuex": "^4.0.2",
|
"vuex": "^4.0.2",
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
</div>
|
</div>
|
||||||
<template #tip>
|
<template #tip>
|
||||||
<div class="el-upload__tip">
|
<div class="el-upload__tip">
|
||||||
<el-link href="https://element.eleme.io" type="primary">下载模板</el-link>
|
<el-link href="https://www.hammer-hfut.tk/api/public/账户导入模板.xlsx" type="primary">下载模板</el-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
@ -95,7 +95,6 @@ import {UploadFilled} from '@element-plus/icons'
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import router from "../router";
|
import router from "../router";
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
import md5 from 'blueimp-md5'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Home',
|
name: 'Home',
|
||||||
|
@ -126,8 +125,14 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
customUpload(options) {
|
customUpload(options) {
|
||||||
|
const that = this
|
||||||
let param = new FormData()
|
let param = new FormData()
|
||||||
param.append('fileDigest', md5(options.file))
|
const fileReader = new FileReader()
|
||||||
|
fileReader.readAsBinaryString(options.file);
|
||||||
|
fileReader.onload = e => {
|
||||||
|
console.log(e.target.result)
|
||||||
|
let SparkMD5 = require('spark-md5')
|
||||||
|
param.append('fileDigest', SparkMD5.hashBinary(e.target.result))
|
||||||
param.append('uploadFile', options.file)
|
param.append('uploadFile', options.file)
|
||||||
request({
|
request({
|
||||||
url: '/staff/import',
|
url: '/staff/import',
|
||||||
|
@ -139,7 +144,13 @@ export default {
|
||||||
}
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
|
ElMessage({
|
||||||
|
message: '导入成功',
|
||||||
|
type: 'success',
|
||||||
})
|
})
|
||||||
|
that.uploadDialogVisible = false
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getStaffFullname() {
|
getStaffFullname() {
|
||||||
if (this.$store && this.$store.state.staff)
|
if (this.$store && this.$store.state.staff)
|
||||||
|
|
Loading…
Reference in New Issue