提交 4f643bcd 编写于 作者: bo.dang's avatar bo.dang

机构导入和人员导入

上级 6c4f7781
......@@ -93,31 +93,50 @@
>
<p style="text-align: center;">{{detelMessage}}</p>
<span slot="footer" class="dialog-footer">
<el-button @click="confirmDelete">删 除</el-button>
<el-button type="primary" @click="hideDeleteFrom">取 消</el-button>
<el-button type="primary" @click="confirmDelete">删 除</el-button>
<el-button @click="hideDeleteFrom">取 消</el-button>
</span>
</el-dialog>
<el-dialog
title=""
:title="dialogTitle"
:visible.sync="dialogVisible"
width="500px"
:close-on-click-modal="false"
@close="handleErrorClose"
center
>
center>
<!--<el-table :data="dialogErrorData" align="center">-->
<!--<el-table-column property="rowNumber" label="行数" align="center"></el-table-column>-->
<!--<el-table-column property="wrongData" label="错误提示" align="center"></el-table-column>-->
<!--</el-table>-->
<div v-if="importSuccessFlag">
<span>本次成功导入{{importNum}}数据</span>
<div v-if="importSuccessFlag" style="text-align: center;">
<div>本次成功导入<span style="color: green;">&nbsp;{{importNum}}条&nbsp;</span>数据</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleErrorClose" style="margin-top: 20px;">关闭</el-button>
</span>
</div>
<div v-if="!importSuccessFlag">
<span>有{{importNum}}数据不符合格式要求,请修正后再次导入</span>
<span><a>下载错误数据</a></span>
<div v-if="!importSuccessFlag" style="text-align: center;">
<div><span style="color: red;">&nbsp;{{importNum}}条&nbsp;</span>数据不符合格式要求,请修正后再次导入</div>
<br>
<div>
<span>
<el-button @click="downloadFile" type="text" size="small" style="color: #449284 !important;">下载错误数据></el-button>
<!--<a @click="downloadFile">下载错误数据</a>-->
</span>
</div>
<div style="margin-top: 20px;">
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleErrorClose" style="float: left;margin-left: 130px;">取 消</el-button>
<el-upload
class="bg-uploader"
action="#"
:show-file-list="false"
:before-upload="beforeUploadOrg">
<el-button type="primary" size="small" style="margin-left: -100px;">重新导入</el-button>
</el-upload>
</span>
</div>
</div>
......@@ -132,7 +151,7 @@
@close="handleImportClose"
center>
<div style="float:left;width: 250px;height: 150px;">
<div style="float:left;width: 250px;">
<span>1.下载模板,填写信息</span>
<br>
<div>
......@@ -145,7 +164,7 @@
</div>
</div>
<div style="float:left;margin-left: 90px;width: 1px;height: 100px; background: #c8cbd2;"></div>
<div style="margin-left: 400px;">
<div style="margin-left: 400px;height: 130px;">
<span>2.上传填写好的文件</span>
<br>
<el-upload
......@@ -242,7 +261,9 @@ export default {
dialogImportVisible: false,
importMsg: "",
importSuccessFlag: false,
importNum: 0
importNum: 0,
dialogTitle: "",
errorFileUrl: ""
}
},
components: {
......@@ -500,6 +521,11 @@ export default {
// 批量导入
beforeUploadOrg(file) {
// 机构数已超10000,无法导入机构
if(vm.totalOrganization > 10000){
this.$message.warning('机构数已超10000,无法导入机构');
return;
}
let name = file.name;
let type = name.substring(name.lastIndexOf('.') + 1);
......@@ -521,24 +547,41 @@ export default {
uploadOrg(formData).then(res => {
closeLoading(vm);
if (res.code == "000000") {
if(res.data.successNum == 0 && res.data.wrongDataList.length > 0){
if(res.code == "224012"){
vm.$message({
type: 'error',
message: res.message
});
}
this.dialogVisible = true;
if (res.code == "000000") {
vm.dialogImportVisible = false;
this.dialogErrorData = res.data.wrongDataList;
}
else {
// 导入成功
if(res.data.failNum == 0){
this.$message({
type: 'success',
message: '导入成功!'
});
vm.dialogVisible = true;
vm.dialogTitle = "导入成功";
vm.importSuccessFlag = true;
vm.importNum = res.data.successNum;
vm.initRange();
vm.searchOrganization();
vm.$emit('refreshRenYuan');
}
else {
vm.dialogVisible = true;
vm.dialogTitle = "导入失败";
vm.importSuccessFlag = false;
vm.importNum = res.data.failNum;
vm.errorFileUrl = res.data.file;
// this.$message({
// type: 'success',
// message: '导入成功!'
// });
}
}
else {
this.$message({
......@@ -555,8 +598,7 @@ export default {
handleErrorClose() {
this.dialogVisible = false;
},
// 批量导入
batchImport(){
this.dialogImportVisible = true;
},
......@@ -565,23 +607,29 @@ export default {
this.dialogImportVisible = false;
},
// 下载模板1
download1(){
const url = "https://files.yunqueyi.com/template/import_hospital_by_detail.xlsx";
window.location.href = url;
},
// 下载模板2
download2(){
const url = "https://files.yunqueyi.com/template/import_hospital_by_id.xlsx";
window.location.href = url;
},
// 下载错误数据文件
downloadFile(){
window.location.href = vm.errorFileUrl;
}
}
}
</script>
<style >
.organization .el-dialog {
max-height: 90%;
overflow: scroll;
}
/*.organization .el-dialog {*/
/*max-height: 90%;*/
/*overflow: scroll;*/
/*}*/
</style>
<style lang="scss" scoped>
.organization {
......
......@@ -6,14 +6,14 @@
<i class="text" @click="dialogMemberFn()">添加人员</i>
</el-col>
<el-col class="add-organization" v-if="showImportFlag">
<el-upload
class="bg-uploader"
action="#"
:show-file-list="false"
:before-upload="beforeUploadDoc">
<!--<el-upload-->
<!--class="bg-uploader"-->
<!--action="#"-->
<!--:show-file-list="false"-->
<!--:before-upload="beforeUploadDoc">-->
<i class="el-icon-document-add"></i>
<i class="text">批量导入</i>
</el-upload>
<i class="text" @click="batchImport()">批量导入</i>
<!--</el-upload>-->
</el-col>
<el-col class="organization-search">
<el-form :inline="true" :model="formOrganization" class="demo-form-inline" >
......@@ -99,21 +99,97 @@
</span>
</el-dialog>
<!--<el-dialog-->
<!--title="导入错误提示"-->
<!--:visible.sync="dialogVisible"-->
<!--width="500px"-->
<!--:close-on-click-modal="false"-->
<!--@close="handleErrorClose"-->
<!--center-->
<!--&gt;-->
<!--<el-table :data="dialogErrorData" align="center">-->
<!--<el-table-column property="rowNumber" label="行数" align="center"></el-table-column>-->
<!--<el-table-column property="wrongData" label="错误提示" align="center"></el-table-column>-->
<!--</el-table>-->
<!--</el-dialog>-->
<el-dialog
title="导入错误提示"
:title="dialogTitle"
:visible.sync="dialogVisible"
width="500px"
:close-on-click-modal="false"
@close="handleErrorClose"
center
>
<el-table :data="dialogErrorData" align="center">
<el-table-column property="rowNumber" label="行数" align="center"></el-table-column>
<el-table-column property="wrongData" label="错误提示" align="center"></el-table-column>
</el-table>
center>
<!--<el-table :data="dialogErrorData" align="center">-->
<!--<el-table-column property="rowNumber" label="行数" align="center"></el-table-column>-->
<!--<el-table-column property="wrongData" label="错误提示" align="center"></el-table-column>-->
<!--</el-table>-->
<div v-if="importSuccessFlag" style="text-align: center;">
<div>本次成功导入<span style="color: green;">&nbsp;{{importNum}}条&nbsp;</span>数据</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleErrorClose" style="margin-top: 20px;">关闭</el-button>
</span>
</div>
<div v-if="!importSuccessFlag" style="text-align: center;">
<div><span style="color: red;">&nbsp;{{importNum}}条&nbsp;</span>数据不符合格式要求,请修正后再次导入</div>
<br>
<div>
<span>
<el-button @click="downloadFile" type="text" size="small" style="color: #449284 !important;">下载错误数据></el-button>
<!--<a @click="downloadFile">下载错误数据</a>-->
</span>
</div>
<div style="margin-top: 20px;">
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleErrorClose" style="float: left;margin-left: 130px;">取 消</el-button>
<el-upload
class="bg-uploader"
action="#"
:show-file-list="false"
:before-upload="beforeUploadDoc">
<el-button type="primary" size="small" style="margin-left: -100px;">重新导入</el-button>
</el-upload>
</span>
</div>
</div>
</el-dialog>
<el-dialog
title="批量导入"
:visible.sync="dialogImportVisible"
width="650px"
:close-on-click-modal="false"
@close="handleImportClose"
center>
<div style="float:left;width: 250px;">
<span>1.下载模板,填写信息</span>
<br>
<div>
<el-button type="primary" size="small" style="float:left; margin-top: 30px;" @click="download1">下载模板</el-button>
</div>
</div>
<div style="float:left;margin-left: 90px;width: 1px;height: 100px; background: #c8cbd2;"></div>
<div style="margin-left: 400px;height: 130px;">
<span>2.上传填写好的文件</span>
<br>
<el-upload
class="bg-uploader"
action="#"
:show-file-list="false"
:before-upload="beforeUploadDoc">
<el-button type="primary" size="small" style="margin-top: 30px;">上传文件</el-button>
</el-upload>
</div>
</el-dialog>
</div>
</template>
......@@ -203,7 +279,13 @@ export default {
detelMessage: '',
dialogVisible: false,
dialogErrorData: [],
showImportFlag: false
showImportFlag: false,
dialogImportVisible: false,
importMsg: "",
importSuccessFlag: false,
importNum: 0,
dialogTitle: "",
errorFileUrl: ""
}
},
created() {
......@@ -215,7 +297,8 @@ export default {
this.showImportFlag = true;
}
else {
this.showImportFlag = false;
// this.showImportFlag = false;
this.showImportFlag = true;
}
},
mounted() {
......@@ -340,6 +423,13 @@ export default {
beforeUploadDoc(file) {
// 人员数已超10000,无法导入机构
if(vm.totalPeople > 10000){
this.$message.warning('人员数已超10000,无法导入机构');
return;
}
let name = file.name;
let type = name.substring(name.lastIndexOf('.') + 1);
if (type !== 'xls' && type !== 'xlsx') {
......@@ -360,23 +450,41 @@ export default {
uploadDoc(formData).then(res => {
closeLoading(vm);
if (res.code == "000000") {
if(res.code == "224012"){
vm.$message({
type: 'error',
message: res.message
});
}
if(res.data.successNum == 0 && res.data.wrongDataList.length > 0){
if (res.code == "000000") {
vm.dialogImportVisible = false;
this.dialogVisible = true;
// 导入成功
if(res.data.failNum == 0){
this.dialogErrorData = res.data.wrongDataList;
}
else {
this.$message({
type: 'success',
message: '导入成功!'
});
vm.dialogVisible = true;
vm.dialogTitle = "导入成功";
vm.importSuccessFlag = true;
vm.importNum = res.data.successNum;
vm.initRange();
// vm.searchOrganization();
// vm.$emit('refreshRenYuan');
}
else {
vm.dialogVisible = true;
vm.dialogTitle = "导入失败";
vm.importSuccessFlag = false;
vm.importNum = res.data.failNum;
vm.errorFileUrl = res.data.file;
// this.$message({
// type: 'success',
// message: '导入成功!'
// });
}
}
else {
this.$message({
......@@ -384,6 +492,32 @@ export default {
message: res.message
});
}
// if (res.code == "000000") {
//
//
// if(res.data.successNum == 0 && res.data.wrongDataList.length > 0){
//
// this.dialogVisible = true;
//
// this.dialogErrorData = res.data.wrongDataList;
// }
// else {
// this.$message({
// type: 'success',
// message: '导入成功!'
// });
// vm.initRange();
// }
//
// }
// else {
// this.$message({
// type: 'error',
// message: res.message
// });
// }
// vm.setDialog(res);
});
// };
......@@ -393,6 +527,25 @@ export default {
handleErrorClose() {
this.dialogVisible = false;
},
// 批量导入
batchImport(){
this.dialogImportVisible = true;
},
handleImportClose(){
this.dialogImportVisible = false;
},
// 下载模板
download1(){
const url = "https://files.yunqueyi.com/template/import_people_by_name_mobile.xlsx";
window.location.href = url;
},
// 下载错误数据文件
downloadFile(){
window.location.href = vm.errorFileUrl;
}
}
}
</script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册