朱思禹提交:完成批量导入功能

init
Administrator 4 years ago
parent 677444c0fe
commit 80e74fdd42

@ -1,30 +1,34 @@
<template>
<div class="app-style" ref="app">
<Menu @onLoad="menuOnLoad" @menuChange="menuChanged"/>
<div class="content-style">
<div style="width: 100%;background-color: white;height: 100%">
<component :is="getCom" v-bind="getParams"/>
<a-config-provider :locale="locale">
<div class="app-style" ref="app">
<Menu @onLoad="menuOnLoad" @menuChange="menuChanged"/>
<div class="content-style">
<div style="width: 100%;background-color: white;height: 100%">
<component :is="getCom" v-bind="getParams"/>
</div>
</div>
<div v-if="!is_loaded_data" class="spin-container-style">
<a-spin>
<a-icon slot="indicator" type="loading" style="font-size: 2rem" spin />
</a-spin>
</div>
<modal-panel></modal-panel>
</div>
<div v-if="!is_loaded_data" class="spin-container-style">
<a-spin>
<a-icon slot="indicator" type="loading" style="font-size: 2rem" spin />
</a-spin>
</div>
<modal-panel></modal-panel>
</div>
</a-config-provider>
</template>
<script>
import {Spin,Icon} from 'ant-design-vue'
import {Spin,Icon,ConfigProvider} from 'ant-design-vue'
import Menu from './menu/Menu'
import PageConfig from './pageConfig'
import ModalPanel from '../../components/common/modal/ModalPanel';
import OfficeMenuConfig from "../../utils/officeMenuConfig"
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN';
export default {
name: 'App',
data:function(){
return{
locale: zhCN,
is_loaded_data:false,
selectedMenu:null,
contentUrl:"",
@ -35,7 +39,8 @@ export default {
ASpin:Spin,
AIcon:Icon,
Menu,
ModalPanel
ModalPanel,
AConfigProvider:ConfigProvider
},
methods:{
menuOnLoad:function (ary) {

@ -12,7 +12,7 @@
{{ person.person_name }}
</a-select-option>
</a-select>
<a-button class="left-top-add-btn-style" type="primary">批量导入</a-button>
<a-button class="left-top-add-btn-style" type="primary" @click="importData"></a-button>
</div>
</div>
<div class="table-container-style">
@ -38,19 +38,34 @@
</a-table>
</div>
<a-pagination :current="pageNumber" :pageSize="pageSize" :hideOnSinglePage="true" :total="totalRow" class="pagination-style" @change="pageChange"/>
<ModalPanel addChildType="slot" modalTitle="批量导入" :show="showImportPanel" :OKButton="false" @callback="panelCallback">
<a-spin :spinning="isUploading" tip="正在上传,请稍候...">
<div class="import-container-style">
<div style="font-size: 0.875rem;color: #31a8fa;margin-bottom: 0.5rem">请选择导入数据的文件</div>
<a-upload accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
:beforeUpload="beforeUpload" :withCredentials="true" :fileList="fileList">
<a-button> <a-icon type="upload" /> 上传文件 </a-button>
</a-upload>
<a-button type="link" style="color: #31a8fa" @click="downloadTemplate" class="down-style">下载模板</a-button>
<div ref="tip" class="tip-style"></div>
</div>
</a-spin>
</ModalPanel>
</div>
<edit-and-view-form v-else-if="formData !== null && formData !== undefined" :pageType="editPageType" :dataNumType="data_num_type" :dataInfo="formData" :showOperateList="true"
@back="returnBack" :form_id="purview_id" @submitSuccess="onSubmitSuccess" :businessType="4" :person-info="personInfo"/>
</template>
<script>
import {Button,Table,Pagination,Select,Spin} from 'ant-design-vue'
import {Button,Table,Pagination,Select,Spin,Upload,Icon} from 'ant-design-vue'
import InterfaceConfig from './interfaceConfig'
import EditAndViewForm from '../formCommon/EditAndViewForm'
import CommonOperate from '../utils/commonOperate'
import debounce from 'lodash/debounce'
import CommonInterfaceConfig from '../../../commonInterface/interfaceConfig'
import ShowAttachment from '../../../components/common/showAttachment/ShowAttachment'
import ModalPanel from "../../../components/common/modal/ModalPanel"
import axios from 'axios'
export default {
name: "TeacherInfoList",
props:["purview_id","purview_name","data_num_type",],
@ -71,10 +86,14 @@
searchValue:undefined,
personData:[],
fetching: false,
personInfo:{}
personInfo:{},
showImportPanel:false,
fileList:[],
isUploading:false
}
},
components:{
ModalPanel,
AButton:Button,
ATable:Table,
EditAndViewForm,
@ -82,7 +101,9 @@
ASelect:Select,
ASpin:Spin,
ASelectOption:Select.Option,
ShowAttachment
ShowAttachment,
AUpload:Upload,
AIcon:Icon
},
computed:{
getColumns:function () {
@ -116,7 +137,6 @@
ary.push({title:"最新修改时间",dataIndex:"last_modify_time",fixed:'right',align:'center',width:160})
ary.push({title:"操作",scopedSlots:{customRender:"operate"},fixed:'right',align:'center'})
}
return ary
}
},
@ -124,6 +144,56 @@
this.getListData()
},
methods:{
beforeUpload:function(file){
this.isUploading = true;
this.$refs.tip.innerText = "";
let fd = new FormData()//
fd.append('file', file)//file
let url = this.BaseConfig.url_path_action + "/intellioa/java/teacher/importTeacherFormTemplate?org_id=" + this.BaseConfig.person_info_my.bureau_id
+ "&system_id=10&form_id="+this.purview_id+"&dept_id="+this.BaseConfig.person_info_my.dep_id + "&person_id=" + this.BaseConfig.userInfo.person_id_cookie;
axios({
method: 'post',
url: url,
data: fd,
headers: {
'Content-Type':'multipart/form-data;boundary=' + new Date().getTime(),
},
}).then((rsp) => {
this.isUploading = false;
if (rsp.data.success === true){
this.fileList = [{
uid:file.uid,
name:file.name,
status: 'done',
}]
this.$toast("上传成功");
this.pageNumber = 1;
this.getListData();
}else{
this.$refs.tip.innerText = rsp.data.info
}
console.log(rsp)
}).catch((error) => {
this.isUploading = false;
this.$refs.tip.innerText = error;
})
return false
},
downloadTemplate:function(){
// let url = this.BaseConfig.url_path_action + "/intellioa/java/teacher/downloadTeacherFormTemplate?org_id=" + this.BaseConfig.person_info_my.bureau_id
// + "&system_id=10&form_id="+this.purview_id;
let url = "http://10.10.14.199/dsideal_yy/ypt/intellioa/java/teacher/downloadTeacherFormTemplate?org_id=" + this.BaseConfig.person_info_my.bureau_id
+ "&system_id=10&form_id="+this.purview_id;
window.location.href = url;
},
panelCallback:function(){
this.showImportPanel = false;
},
importData:function(){
this.fileList = [];
this.showImportPanel = true;
},
getBadgeCount:function(value){
let ary = JSON.parse(value);
return ary.length > 1?ary.length:0;
@ -301,4 +371,22 @@
color:#31a8fa;
cursor:pointer;
}
.import-container-style{
height: 8rem;
position: relative;
.down-style{
position: absolute;
top: 2rem;
left: 6.5rem;
}
.tip-style{
position: absolute;
bottom:0;
right: 0;
width: 100%;
text-align: right;
color: red;
line-height: 1rem;
}
}
</style>

Loading…
Cancel
Save