增加导入优化导出
This commit is contained in:
parent
bb6c776515
commit
6dd9d35ce3
@ -219,6 +219,21 @@ export default {
|
|||||||
post: async function (params) {
|
post: async function (params) {
|
||||||
return await http.post(this.url,params);
|
return await http.post(this.url,params);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
template:{
|
||||||
|
url: `${config.API_URL}/company.import.template`,
|
||||||
|
name: "公司资料导入模版",
|
||||||
|
responseType: 'arraybuffer',
|
||||||
|
get: async function (params) {
|
||||||
|
return await http.get(this.url,params);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
import:{
|
||||||
|
url: `${config.API_URL}/organization.import`,
|
||||||
|
name: "公司资料导入",
|
||||||
|
post: async function (params) {
|
||||||
|
return await http.post(this.url,params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dept: {
|
dept: {
|
||||||
|
|||||||
13
src/assets/icons/UploadExcel.vue
Normal file
13
src/assets/icons/UploadExcel.vue
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<template>
|
||||||
|
<svg t="1721009243835" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3722" width="200" height="200"><path d="M909.0048 936.1152H101.12a74.752 74.752 0 0 1-74.6752-74.6752V184.1152A74.752 74.752 0 0 1 101.12 109.44H451.584a74.752 74.752 0 0 1 74.6752 74.6752 21.4016 21.4016 0 0 1-21.3248 21.3248 21.4016 21.4016 0 0 1-21.3504-21.3248c0-17.7152-14.2848-32-32-32H101.12c-17.7152 0-32 14.2848-32 32V861.44c0 17.7152 14.2848 32 32 32h807.8848c11.7504 0 21.3504 9.6 21.3504 21.3504a21.248 21.248 0 0 1-21.3504 21.3248z" fill="#1367C1" p-id="3723"></path><path d="M909.0048 936.1152a21.4016 21.4016 0 0 1-21.3248-21.3248c0-11.7504 9.6-21.3504 21.3248-21.3504 17.7152 0 32-14.2848 32-32V422.656c0-17.7152-14.2848-32-32-32h-631.04c-17.7152 0-32 14.2848-32 32V709.12a21.4016 21.4016 0 0 1-21.3248 21.3504 21.4016 21.4016 0 0 1-21.3504-21.3504V422.656a74.752 74.752 0 0 1 74.6752-74.6752h631.04a74.752 74.752 0 0 1 74.6752 74.6752V861.44a74.752 74.752 0 0 1-74.6752 74.6752zM748.8 280.576h-190.08a74.752 74.752 0 0 1-74.6752-74.6752V194.816c0-11.7504 9.6-21.3504 21.3248-21.3504 11.7504 0 21.3504 9.6 21.3504 21.3504v11.0848c0 17.7152 14.2848 32 32 32h190.08c11.7248 0 21.3248 9.6 21.3248 21.3248a21.4016 21.4016 0 0 1-21.3248 21.3504z" fill="#1367C1" p-id="3724"></path><path d="M171.52 936.1408h-16.8448a21.4016 21.4016 0 0 1-21.3248-21.3504c0-11.7248 9.6-21.3248 21.3248-21.3248h16.8704c17.6896 0 32-14.3104 32-32v-179.84c0-11.7504 9.6-21.3504 21.3248-21.3504 11.7248 0 21.3248 9.6 21.3248 21.3504v179.84a74.88 74.88 0 0 1-74.6496 74.6496z m666.88-545.28a21.4016 21.4016 0 0 1-21.3248-21.3504v-56.7552c0-17.6896-14.2848-32-32-32h-96.4096a21.4016 21.4016 0 0 1-21.3504-21.3248c0-11.7248 9.6-21.3248 21.3504-21.3248h96.4096a74.752 74.752 0 0 1 74.6752 74.6496v56.7552a21.4016 21.4016 0 0 1-21.3248 21.3248z" fill="#1367C1" p-id="3725"></path><path d="M615.168 818.5856a24.3456 24.3456 0 0 1-24.2688-24.2688v-257.536c0-13.3632 10.9312-24.2688 24.2688-24.2688a24.32 24.32 0 0 1 24.2688 24.2688v257.536a24.32 24.32 0 0 1-24.2688 24.2688z" fill="#A7C0F1" p-id="3726"></path><path d="M719.0784 664.96a24.8576 24.8576 0 0 1-17.2288-7.04l-103.9104-103.8848a24.1664 24.1664 0 1 1 34.2272-34.2272l104.1408 103.8848a24.1664 24.1664 0 0 1-17.2288 41.2672z" fill="#A7C0F1" p-id="3727"></path><path d="M511.0784 664.8832a24.8576 24.8576 0 0 1-17.2288-7.04 24.1664 24.1664 0 0 1 0-34.2272l104.1408-104.1152a24.1664 24.1664 0 1 1 34.2016 34.2272l-104.1152 104.1152a22.912 22.912 0 0 1-16.9984 7.04z" fill="#A7C0F1" p-id="3728"></path></svg>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "UploadExcel"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -9,6 +9,7 @@ export { default as FileExcel } from './FileExcel.vue'
|
|||||||
export { default as FilePpt } from './FilePpt.vue'
|
export { default as FilePpt } from './FilePpt.vue'
|
||||||
export { default as Organization } from './Organization.vue'
|
export { default as Organization } from './Organization.vue'
|
||||||
export { default as Upload } from './Upload.vue'
|
export { default as Upload } from './Upload.vue'
|
||||||
|
export { default as UploadExcel } from './UploadExcel.vue'
|
||||||
export { default as Download } from './Download.vue'
|
export { default as Download } from './Download.vue'
|
||||||
export { default as Bell } from './Bell.vue'
|
export { default as Bell } from './Bell.vue'
|
||||||
export { default as Full } from './Full.vue'
|
export { default as Full } from './Full.vue'
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
:visible="show"
|
:visible="show"
|
||||||
>
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button :size="size" icon="sc-icon-Download" @click="exportClick">下载</el-button>
|
<el-button :size="size" icon="sc-icon-Download" @click="exportClick">下载 {{show}}</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #default>
|
<template #default>
|
||||||
<div v-for="item in list" :key="item">
|
<div v-for="item in list" :key="item">
|
||||||
@ -66,6 +66,7 @@ export default {
|
|||||||
this.list[2] = item;
|
this.list[2] = item;
|
||||||
}
|
}
|
||||||
this.$emit('updateShow', item);
|
this.$emit('updateShow', item);
|
||||||
|
|
||||||
if(res.data.status==1){
|
if(res.data.status==1){
|
||||||
this.down(res.data);
|
this.down(res.data);
|
||||||
}
|
}
|
||||||
|
|||||||
149
src/components/scImport/index.vue
Normal file
149
src/components/scImport/index.vue
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="titleMap[mode]" v-model="visible" :width="560" destroy-on-close draggable @closed="$emit('closed')">
|
||||||
|
<div class="importBody">
|
||||||
|
<el-upload
|
||||||
|
class="upload"
|
||||||
|
:action="oss.host"
|
||||||
|
:data="upload_data"
|
||||||
|
:show-file-list="false"
|
||||||
|
:on-success="handleSuccess"
|
||||||
|
:on-error="handleError"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
|
drag
|
||||||
|
multiple
|
||||||
|
>
|
||||||
|
<el-icon class="el-icon--upload"><sc-icon-UploadExcel /></el-icon>
|
||||||
|
<div class="el-upload__text">
|
||||||
|
<span class="laText">请将Excel拖到此处</span>
|
||||||
|
<span class="tipText">,或点击上传</span><em> Excel</em>
|
||||||
|
</div>
|
||||||
|
<template #tip>
|
||||||
|
<div class="el-upload__tip">
|
||||||
|
<span class="tip">如果数据导入中途业务出错,请不要刷新页面,修改后继续点击导入</span>
|
||||||
|
<span class="btn">
|
||||||
|
<slot></slot>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="importBox">
|
||||||
|
<div class="name">导入进度</div>
|
||||||
|
<el-progress class="exportPopover" :text-inside="true" :stroke-width="12" :percentage="67" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-upload>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="visible=false">取 消</el-button>
|
||||||
|
<el-button type="primary">确定导入</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "import",
|
||||||
|
emits: ['success', 'closed'],
|
||||||
|
data(){
|
||||||
|
return{
|
||||||
|
mode: "import",
|
||||||
|
titleMap: {
|
||||||
|
import: '批量导入公司组织'
|
||||||
|
},
|
||||||
|
visible: false,
|
||||||
|
|
||||||
|
oss:{
|
||||||
|
host:''
|
||||||
|
},
|
||||||
|
upload_data:{}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
open(mode='import'){
|
||||||
|
this.mode = mode;
|
||||||
|
this.visible = true;
|
||||||
|
|
||||||
|
return this
|
||||||
|
},
|
||||||
|
// 上传前
|
||||||
|
beforeUpload(file){
|
||||||
|
const text = file.name.split('.').pop();
|
||||||
|
if(!['xls','xlsx'].includes(text)){
|
||||||
|
this.$message.warning(`只能选择的excel文件类型`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return new Promise((resolve)=>{
|
||||||
|
setTimeout(async ()=>{
|
||||||
|
let params = {
|
||||||
|
dir:"user/file/"
|
||||||
|
}
|
||||||
|
const res = await this.$API.oss.ossGet.post(params);
|
||||||
|
this.oss = res.data;
|
||||||
|
this.upload_data = {
|
||||||
|
name: new Date().getTime() + file.name,
|
||||||
|
key: this.oss.dir +file.name,
|
||||||
|
policy: this.oss.policy,
|
||||||
|
OSSAccessKeyId: this.oss.accessid,
|
||||||
|
success_action_status: "200",
|
||||||
|
callback: this.oss.callback,
|
||||||
|
signature: this.oss.signature,
|
||||||
|
"Cache-Control": this.oss.cache_control,
|
||||||
|
};
|
||||||
|
resolve()
|
||||||
|
},100)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
// 上传成功
|
||||||
|
handleSuccess(file){
|
||||||
|
this.imageUrl = this.oss.host+'/'+file.data.filename;
|
||||||
|
this.$emit('parentParams',this.imageUrl);
|
||||||
|
},
|
||||||
|
// 上传失败
|
||||||
|
handleError(){
|
||||||
|
this.$message.warning('上传失败请重新上传');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.importBody{
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
.upload .el-icon--upload{
|
||||||
|
width: 54px;height: 54px;
|
||||||
|
}
|
||||||
|
.upload :deep(.el-upload__text){
|
||||||
|
.laText{
|
||||||
|
color: var(--el-color-dark);
|
||||||
|
}
|
||||||
|
.tipText{
|
||||||
|
color: var(--el-text-color-placeholder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.upload :deep(.el-upload__tip){
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 15px;color: var(--el-text-color-placeholder);
|
||||||
|
.btn{
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.importBox{
|
||||||
|
border: 1px solid var(--el-border-color);
|
||||||
|
padding: 10px 5px;
|
||||||
|
margin: 15px 0;
|
||||||
|
border-radius: 4px;
|
||||||
|
.name{margin-bottom: 8px;font-size: 13px;}
|
||||||
|
.exportPopover :deep(.el-progress-bar__innerText){
|
||||||
|
height: 100%;
|
||||||
|
display: flex;align-items: center;justify-content: flex-end;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -27,6 +27,7 @@ import scInput from "./components/scInput";
|
|||||||
import scVgInput from "./components/scInput/inputVague";
|
import scVgInput from "./components/scInput/inputVague";
|
||||||
import scSearch from "./components/scSearch";
|
import scSearch from "./components/scSearch";
|
||||||
import scExport from "./components/scExport";
|
import scExport from "./components/scExport";
|
||||||
|
import scImport from "./components/scImport";
|
||||||
|
|
||||||
import scStatusIndicator from './components/scMini/scStatusIndicator'
|
import scStatusIndicator from './components/scMini/scStatusIndicator'
|
||||||
import scTrend from './components/scMini/scTrend'
|
import scTrend from './components/scMini/scTrend'
|
||||||
@ -80,6 +81,7 @@ export default {
|
|||||||
app.component('scVgInput', scVgInput);
|
app.component('scVgInput', scVgInput);
|
||||||
app.component('scSearch', scSearch);
|
app.component('scSearch', scSearch);
|
||||||
app.component('scExport', scExport);
|
app.component('scExport', scExport);
|
||||||
|
app.component('scImport', scImport);
|
||||||
|
|
||||||
//注册全局指令
|
//注册全局指令
|
||||||
app.directive('auth', auth)
|
app.directive('auth', auth)
|
||||||
|
|||||||
@ -249,8 +249,8 @@ const http = {
|
|||||||
*/
|
*/
|
||||||
jsonp: function (url, name = 'jsonp') {
|
jsonp: function (url, name = 'jsonp') {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
var script = document.createElement('script')
|
const script = document.createElement('script');
|
||||||
var _id = `jsonp${Math.ceil(Math.random() * 1000000)}`
|
const _id = `jsonp${Math.ceil(Math.random() * 1000000)}`;
|
||||||
script.id = _id
|
script.id = _id
|
||||||
script.type = 'text/javascript'
|
script.type = 'text/javascript'
|
||||||
script.src = url
|
script.src = url
|
||||||
|
|||||||
@ -51,21 +51,20 @@
|
|||||||
|
|
||||||
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess" @closed="dialog.save=false"></save-dialog>
|
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess" @closed="dialog.save=false"></save-dialog>
|
||||||
<see-dialog v-if="dialog.show" ref="showDialog" @closed="dialog.show=false"></see-dialog>
|
<see-dialog v-if="dialog.show" ref="showDialog" @closed="dialog.show=false"></see-dialog>
|
||||||
<import-dialog v-if="dialog.import" ref="importDialog" @closed="dialog.import=false"></import-dialog>
|
<scImport v-if="dialog.import" ref="importDialog" @closed="dialog.import=false">
|
||||||
|
<div @click="importTemplate">下载导入模版</div>
|
||||||
|
</scImport>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import saveDialog from './save'
|
import saveDialog from './save'
|
||||||
import seeDialog from './see'
|
import seeDialog from './see'
|
||||||
import importDialog from './import'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'company',
|
|
||||||
components: {
|
components: {
|
||||||
saveDialog,
|
saveDialog,
|
||||||
seeDialog,
|
seeDialog,
|
||||||
importDialog
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -154,6 +153,13 @@ export default {
|
|||||||
this.$refs.importDialog.open()
|
this.$refs.importDialog.open()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
async importTemplate() {
|
||||||
|
const res = await this.$API.system.company.template.get();
|
||||||
|
if(res.code == 200){
|
||||||
|
console.log(res.data)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
//编辑
|
//编辑
|
||||||
table_edit(row){
|
table_edit(row){
|
||||||
this.dialog.save = true
|
this.dialog.save = true
|
||||||
@ -224,9 +230,9 @@ export default {
|
|||||||
}, 500);
|
}, 500);
|
||||||
},
|
},
|
||||||
// 下载导出
|
// 下载导出
|
||||||
exportChangeShow(e){
|
exportChangeShow(params){
|
||||||
if(e.type == 6){
|
if(params.type == 6){
|
||||||
this.exportShow = e.status==0?true:false
|
this.exportShow = params.status==0?true:false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async exportData() {
|
async exportData() {
|
||||||
|
|||||||
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import info from './info'
|
import info from './info'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
info,
|
info,
|
||||||
@ -73,9 +72,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 下载导出
|
// 下载导出
|
||||||
exportChangeShow(e){
|
exportChangeShow(params){
|
||||||
if(e.type == 8){
|
if(params.type == 8){
|
||||||
this.exportShow = e.status==0?true:false
|
this.exportShow = params.status==0?true:false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async exportData() {
|
async exportData() {
|
||||||
|
|||||||
@ -85,7 +85,6 @@
|
|||||||
import disRoleDialog from './role'
|
import disRoleDialog from './role'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'user',
|
|
||||||
components: {
|
components: {
|
||||||
saveDialog, rePwdDialog, disRoleDialog
|
saveDialog, rePwdDialog, disRoleDialog
|
||||||
},
|
},
|
||||||
@ -279,9 +278,9 @@
|
|||||||
}, 500);
|
}, 500);
|
||||||
},
|
},
|
||||||
// 下载导出
|
// 下载导出
|
||||||
exportChangeShow(e){
|
exportChangeShow(params){
|
||||||
if(e.type == 7){
|
if(params.type == 7){
|
||||||
this.exportShow = e.status==0?true:false
|
this.exportShow = params.status==0?true:false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async exportData() {
|
async exportData() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user