机构加导入
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -101,3 +101,17 @@ export async function infoOrganization(organizationId) {
|
|||||||
}
|
}
|
||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入机构
|
||||||
|
* @param file excel文件
|
||||||
|
*/
|
||||||
|
export async function importOrganization(file) {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('file', file);
|
||||||
|
const res = await request.post('/institution/organization/import', formData);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
<!-- 导入弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
width="520px"
|
||||||
|
title="导入机构"
|
||||||
|
:visible="visible"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
>
|
||||||
|
<el-upload
|
||||||
|
drag
|
||||||
|
action=""
|
||||||
|
class="ele-block"
|
||||||
|
v-loading="loading"
|
||||||
|
accept=".xls,.xlsx"
|
||||||
|
:show-file-list="false"
|
||||||
|
:before-upload="doUpload"
|
||||||
|
>
|
||||||
|
<i class="el-icon-upload"></i>
|
||||||
|
<div class="el-upload__text">将文件拖到此处, 或 <em>点击上传</em></div>
|
||||||
|
<template v-slot:tip>
|
||||||
|
<div class="el-upload__tip ele-text-center">
|
||||||
|
<span>只能上传xls、xlsx文件, </span>
|
||||||
|
<el-link
|
||||||
|
download
|
||||||
|
:href="url"
|
||||||
|
type="primary"
|
||||||
|
:underline="false"
|
||||||
|
style="vertical-align: baseline"
|
||||||
|
>
|
||||||
|
下载模板
|
||||||
|
</el-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-upload>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { importOrganization } from '@/api/institution/organization';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
// 是否打开弹窗
|
||||||
|
visible: Boolean
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 导入请求状态
|
||||||
|
loading: false,
|
||||||
|
// 导入模板下载地址
|
||||||
|
url: '/temp/organization.xlsx'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/* 上传 */
|
||||||
|
doUpload(file) {
|
||||||
|
if (
|
||||||
|
![
|
||||||
|
'application/vnd.ms-excel',
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||||
|
].includes(file.type)
|
||||||
|
) {
|
||||||
|
this.$message.error('只能选择 excel 文件');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (file.size / 1024 / 1024 > 5) {
|
||||||
|
this.$message.error('大小不能超过 5MB');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.loading = true;
|
||||||
|
importOrganization(file)
|
||||||
|
.then((msg) => {
|
||||||
|
this.loading = false;
|
||||||
|
this.$message.success(msg);
|
||||||
|
this.updateVisible(false);
|
||||||
|
this.$emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.loading = false;
|
||||||
|
this.$message.error(e.message);
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
/* 更新visible */
|
||||||
|
updateVisible(value) {
|
||||||
|
this.$emit('update:visible', value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.ele-block {
|
||||||
|
:deep(.el-upload),
|
||||||
|
:deep(.el-upload-dragger) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="ele-body">
|
<div class="ele-body">
|
||||||
<el-card shadow="never" v-loading="loading">
|
<el-card shadow="never" v-loading="loading">
|
||||||
<ele-split-layout
|
<ele-split-layout
|
||||||
width="266px"
|
width="330px"
|
||||||
allow-collapse
|
allow-collapse
|
||||||
:right-style="{ overflow: 'hidden' }"
|
:right-style="{ overflow: 'hidden' }"
|
||||||
>
|
>
|
||||||
@@ -39,6 +39,15 @@
|
|||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
class="ele-btn-icon"
|
||||||
|
icon="el-icon-download"
|
||||||
|
@click="openImport"
|
||||||
|
>
|
||||||
|
导入
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</ele-toolbar>
|
</ele-toolbar>
|
||||||
<div class="ele-border-lighter sys-organization-list">
|
<div class="ele-border-lighter sys-organization-list">
|
||||||
@@ -71,12 +80,15 @@
|
|||||||
:organization-list="data"
|
:organization-list="data"
|
||||||
@done="query"
|
@done="query"
|
||||||
/>
|
/>
|
||||||
|
<!-- 导入弹窗 -->
|
||||||
|
<org-import :visible.sync="showImport" @done="query" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import OrgUserList from './components/org-user-list.vue';
|
import OrgUserList from './components/org-user-list.vue';
|
||||||
import OrgEdit from './components/org-edit.vue';
|
import OrgEdit from './components/org-edit.vue';
|
||||||
|
import OrgImport from './components/org-import.vue';
|
||||||
import {
|
import {
|
||||||
listOrganizations,
|
listOrganizations,
|
||||||
removeOrganization
|
removeOrganization
|
||||||
@@ -84,7 +96,7 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'InstitutionOrganization',
|
name: 'InstitutionOrganization',
|
||||||
components: { OrgUserList, OrgEdit },
|
components: { OrgUserList, OrgEdit, OrgImport },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 加载状态
|
// 加载状态
|
||||||
@@ -95,6 +107,7 @@
|
|||||||
current: null,
|
current: null,
|
||||||
// 是否显示表单弹窗
|
// 是否显示表单弹窗
|
||||||
showEdit: false,
|
showEdit: false,
|
||||||
|
showImport: false,
|
||||||
// 编辑回显数据
|
// 编辑回显数据
|
||||||
editData: null,
|
editData: null,
|
||||||
// 上级id
|
// 上级id
|
||||||
@@ -141,6 +154,10 @@
|
|||||||
this.editData = item;
|
this.editData = item;
|
||||||
this.showEdit = true;
|
this.showEdit = true;
|
||||||
},
|
},
|
||||||
|
/* 打开导入弹窗 */
|
||||||
|
openImport() {
|
||||||
|
this.showImport = true;
|
||||||
|
},
|
||||||
/* 删除 */
|
/* 删除 */
|
||||||
remove() {
|
remove() {
|
||||||
this.$confirm('确定要删除选中的机构吗?', '提示', {
|
this.$confirm('确定要删除选中的机构吗?', '提示', {
|
||||||
|
|||||||
@@ -102,7 +102,7 @@
|
|||||||
updateActivityBlacklist,
|
updateActivityBlacklist,
|
||||||
importActivityBlacklist
|
importActivityBlacklist
|
||||||
} from '@/api/sylive/activity';
|
} from '@/api/sylive/activity';
|
||||||
import { API_BASE_URL } from '@/config/setting';
|
|
||||||
export default {
|
export default {
|
||||||
components: {},
|
components: {},
|
||||||
props: {
|
props: {
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
isUpdate: false,
|
isUpdate: false,
|
||||||
// 导入请求状态
|
// 导入请求状态
|
||||||
// 导入模板下载地址
|
// 导入模板下载地址
|
||||||
url: API_BASE_URL.replace('api', '') + 'temp/blacklist.xlsx'
|
url: '/temp/blacklist.xlsx'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { importGroupsCustomer } from '@/api/sylive/groups-customer';
|
import { importGroupsCustomer } from '@/api/sylive/groups-customer';
|
||||||
import { API_BASE_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@@ -49,7 +48,7 @@
|
|||||||
// 导入请求状态
|
// 导入请求状态
|
||||||
loading: false,
|
loading: false,
|
||||||
// 导入模板下载地址
|
// 导入模板下载地址
|
||||||
url: API_BASE_URL.replace('api', '') + 'temp/customer.xlsx'
|
url: '/temp/customer.xlsx'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { importGroupsExchange } from '@/api/sylive/groups-exchange';
|
import { importGroupsExchange } from '@/api/sylive/groups-exchange';
|
||||||
import { API_BASE_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@@ -49,7 +48,7 @@
|
|||||||
// 导入请求状态
|
// 导入请求状态
|
||||||
loading: false,
|
loading: false,
|
||||||
// 导入模板下载地址
|
// 导入模板下载地址
|
||||||
url: API_BASE_URL.replace('api', '') + 'temp/exchange.xlsx'
|
url: '/temp/exchange.xlsx'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { importGroupsOrder } from '@/api/sylive/groups-order';
|
import { importGroupsOrder } from '@/api/sylive/groups-order';
|
||||||
import { API_BASE_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@@ -49,7 +48,7 @@
|
|||||||
// 导入请求状态
|
// 导入请求状态
|
||||||
loading: false,
|
loading: false,
|
||||||
// 导入模板下载地址
|
// 导入模板下载地址
|
||||||
url: API_BASE_URL.replace('api', '') + 'temp/order.xlsx'
|
url: '/temp/order.xlsx'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
Reference in New Issue
Block a user