提交 a48c7f48 编写于 作者: changdi.hao's avatar changdi.hao

测试上传exel

上级 60b91d40
...@@ -57,4 +57,26 @@ export const uploadShieldExcel = (data, projectId) => { ...@@ -57,4 +57,26 @@ export const uploadShieldExcel = (data, projectId) => {
data: data, data: data,
description: '上传excel文件', description: '上传excel文件',
}) })
} }
\ No newline at end of file export const uploadMateExcel = (data) => {
return fetch({
headers: {
token: localStorage.getItem("storageToken"),
},
url: getBaseUrl("portal/black/transferHospitalInfo"),
method: "post",
data: data,
description: "转换机构信息上传文件",
});
};
export const uploadBatchExcel = (data) => {
return fetch({
headers: {
token: localStorage.getItem("storageToken"),
},
url: getBaseUrl("portal/black/setHospitalBlackStatus/batch"),
method: "post",
data: data,
description: "屏蔽机构操作上传文件",
});
};
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</el-radio-group> </el-radio-group>
<!-- <el-button class="complete" type="primary" size="small" @click="complete">完成</el-button> --> <!-- <el-button class="complete" type="primary" size="small" @click="complete">完成</el-button> -->
<el-row :gutter="30" class="row" type="flex" style="margin-top: 10px"> <el-row :gutter="30" class="row" type="flex" style="margin-top: 10px">
<el-form :model="formInline" ref="formInline" label-width="75px" class="form-inline" style=";width:1000px;"> <el-form :model="formInline" ref="formInline" label-width="75px" class="form-inline" style="width:1000px;">
<el-col :span="6" v-if=" shieldType == 0"> <el-col :span="6" v-if=" shieldType == 0">
<el-form-item label="地区:"> <el-form-item label="地区:">
<el-cascader <el-cascader
...@@ -47,12 +47,16 @@ ...@@ -47,12 +47,16 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6" style="padding:0;text-align:right;padding-right:10px;"> <el-col :span="6" style="padding:0;text-align:right;">
<el-button type="primary" size="small" @click="searchList()">搜索</el-button> <el-button type="primary" size="small" @click="searchList()">搜索</el-button>
<el-button type="primary" size="small" @click="importOrder()" v-if="shieldType == 1">批量导入</el-button> <el-button type="primary" size="small" @click="importOrder()" v-if="shieldType == 1">批量导入</el-button>
</el-col> </el-col>
</el-form> </el-form>
</el-row> </el-row>
<el-row justify="end" class="row" type="flex" style="margin: 5px 0 10px;width:1000px;" v-if="shieldType == 0">
<el-button type="primary" size="small" @click="importMate()">机构匹配</el-button>
<el-button type="primary" size="small" @click="importBatch()">批量屏蔽</el-button>
</el-row>
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column v-if="shieldType == 0" prop="hospitalName" label="医院名称" align="center"></el-table-column> <el-table-column v-if="shieldType == 0" prop="hospitalName" label="医院名称" align="center"></el-table-column>
<el-table-column <el-table-column
...@@ -151,13 +155,103 @@ ...@@ -151,13 +155,103 @@
> >
</div> </div>
</el-dialog> </el-dialog>
<!-- 导入匹配机构名单 -->
<el-dialog
class="exportlogistics-dialog"
title="匹配机构导入"
:visible="isShowMate"
@close="isShowMate = false"
width="600px"
>
<el-form label-width="120px">
<el-form-item label="导入文档:">
<el-upload
class="upload-excel"
action="#"
accept=".xlsx"
multiple
:limit="1"
:show-file-list="true"
:before-upload="uploadMateFile"
>
<div class="upload-container">
<el-input
class="file-name"
v-model="mateFileData.fileName"
size="mini"
readonly
></el-input
>
<el-button type="primary" size="mini">选择文件</el-button>
</div>
</el-upload>
</el-form-item>
<el-form-item label="模板:">
<a class="import-url" :href="mateTmpUrl" style="color: #449284">
导入匹配机构模板.xlxs</a>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="cancelMateImport">取消</el-button>
<el-button
size="small"
:loading="isLoading"
type="primary"
@click="confirmMateImport"
>确认</el-button
>
</div>
</el-dialog>
<!-- 导入匹配机构名单 -->
<el-dialog
class="exportlogistics-dialog"
title="匹配机构导入"
:visible="isShowBatch"
@close="isShowBatch = false"
width="600px"
>
<el-form label-width="120px">
<el-form-item label="导入文档:">
<el-upload
class="upload-excel"
action="#"
accept=".xlsx"
multiple
:limit="1"
:show-file-list="true"
:before-upload="uploadBatchFile"
>
<div class="upload-container">
<el-input
class="file-name"
v-model="batchFileData.fileName"
size="mini"
readonly
></el-input
>
<el-button type="primary" size="mini">选择文件</el-button>
</div>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="cancelBatchImport">取消</el-button>
<el-button
size="small"
:loading="isLoading"
type="primary"
@click="confirmBatchImport"
>确认</el-button
>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import BreadCrumb from "../../components/breadcrumb.vue"; import BreadCrumb from "../../components/breadcrumb.vue";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils/utils";
import { uploadShieldExcel } from "@/utils/education/educationApi"; import { uploadShieldExcel, uploadMateExcel, uploadBatchExcel } from "@/utils/education/educationApi";
import * as commonUtil from "../../utils/utils"; import * as commonUtil from "../../utils/utils";
import * as operationData from "../../utils/operation"; import * as operationData from "../../utils/operation";
let vm = null; let vm = null;
...@@ -215,6 +309,17 @@ export default { ...@@ -215,6 +309,17 @@ export default {
shieldBlock: "", shieldBlock: "",
scopeRow: {}, scopeRow: {},
administrativeValue: "", administrativeValue: "",
isShowMate: false,
isShowBatch: false,
mateFileData: {
file: "",
fileName: "",
},
batchFileData: {
file: "",
fileName: "",
},
mateTmpUrl: 'https://files.yunqueyi.com/template/org_template.xlsx',
props: { props: {
lazy: true, lazy: true,
lazyLoad(node, resolve) { lazyLoad(node, resolve) {
...@@ -523,7 +628,112 @@ export default { ...@@ -523,7 +628,112 @@ export default {
console.log(`当前页: ${val}`); console.log(`当前页: ${val}`);
this.formInline.pageNo = val; this.formInline.pageNo = val;
this.search(); this.search();
} },
download() {
const downloadUrl = 'https://files.yunqueyi.com/template/org_template.xlsx';
setTimeout(() => {
window.open(downloadUrl);
}, 500);
},
importMate() {
this.isShowMate = true;
},
importBatch() {
this.isShowBatch = true
},
uploadMateFile(file) {
this.mateFileData.fileName = file.name;
const formData = new FormData();
formData.append("file",file)
this.mateFileData.file = formData;
},
// 确认导入
confirmMateImport() {
this.isLoading = true;
let parmas = {
file: this.mateFileData.file,
projectId: this.projectId
}
uploadMateExcel(parmas).then(res => {
if (res.code == '000000') {
if (res.data) {
this.isLoading = false;
this.isShowMate = false;
let a = document.createElement('a');
let href = res.data;
a.setAttribute('href',href);
a.click();
this.$message({
message: '导入成功,您上传的机构信息已匹配完成,请确认后进行批量屏蔽',
type: 'success'
});
} else {
this.isLoading = false;
this.$message.error(res.message);
}
} else {
this.isLoading = false;
this.$message.error(res.message);
}
}).catch(error => {
this.isLoading = false;
this.$message.error(error.message);
})
},
// 取消导入
cancelMateImport() {
this.mateFileData = {
file: "",
fileName: "",
};
this.isShowMate = false;
},
uploadBatchFile(file) {
this.batchFileData.fileName = file.name;
const formData = new FormData();
formData.append("file",file)
this.batchFileData.file = formData;
},
// 确认导入
confirmBatchImport() {
this.isLoading = true;
let parmas = {
file: this.batchFileData.file,
projectId: this.projectId
}
uploadBatchExcel(parmas).then(res => {
if (res.code == '000000') {
if (res.data) {
this.isLoading = false;
this.isShowMate = false;
let a = document.createElement('a');
let href = res.data;
a.setAttribute('href',href);
a.click();
this.$message({
message: '导入成功,您上传的机构信息已匹配完成,请确认后进行批量屏蔽',
type: 'success'
});
} else {
this.isLoading = false;
this.$message.error(res.message);
}
} else {
this.isLoading = false;
this.$message.error(res.message);
}
}).catch(error => {
this.isLoading = false;
this.$message.error(error.message);
})
},
cancelBatchImport() {
this.batchFileData = {
file: "",
fileName: "",
};
this.isShowBatch = false;
},
} }
}; };
</script> </script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册