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

机构导入和人员导入

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