重写导入,添加历史数据功能

This commit is contained in:
xbx 2023-11-29 18:01:41 +08:00
parent 5de4da51ff
commit 58757f7943
8 changed files with 245 additions and 14 deletions

View File

@ -1,5 +1,5 @@
NODE_ENV=development NODE_ENV=development
VUE_APP_API_BASE_URL=http://localhost:8888/jeecg-boot VUE_APP_API_BASE_URL=http://82.157.76.162:8888/jeecg-boot
VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas
VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview

View File

@ -1,4 +1,4 @@
NODE_ENV=production NODE_ENV=production
VUE_APP_API_BASE_URL=http://localhost:8888/jeecg-boot VUE_APP_API_BASE_URL=http://82.157.76.162:8888/jeecg-boot
VUE_APP_CAS_BASE_URL=http://localhost:8888/cas VUE_APP_CAS_BASE_URL=http://82.157.76.162:8888/cas
VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview

View File

@ -297,6 +297,38 @@ export const JeecgListMixin = {
} }
}) })
}, },
// 重写导出方法
ExportData(fileName, TimestampData) {
console.log("传入的时间戳"+TimestampData)
if (!fileName || typeof fileName != "string") {
fileName = "导出文件"
}
let param = this.getQueryParams();
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
param['selections'] = this.selectedRowKeys.join(",")
}
param['timestamp'] = TimestampData
console.log("导出参数", param)
downFile(this.url.exportXlsUrl, param).then((data) => {
if (!data) {
this.$message.warning("文件下载失败")
return
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
} else {
let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
let link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', fileName + '.xls')
document.body.appendChild(link)
link.click()
document.body.removeChild(link); //下载完成移除元素
window.URL.revokeObjectURL(url); //释放掉blob对象
}
})
},
/* 导入 */ /* 导入 */
handleImportExcel(info){ handleImportExcel(info){
this.loading = true; this.loading = true;

View File

@ -5,7 +5,7 @@ import { constantRouterMap } from '@/config/router.config'
Vue.use(Router) Vue.use(Router)
export default new Router({ export default new Router({
mode: 'history', mode: 'hash',
base: process.env.BASE_URL, base: process.env.BASE_URL,
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap routes: constantRouterMap

View File

@ -11,7 +11,7 @@
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="5" :lg="7" :md="8" :sm="24"> <a-col :xl="5" :lg="7" :md="8" :sm="24">
<a-auto-complete v-model="queryParam.recipient" :dataSource="UserdataSource" style="width: 200px" <a-auto-complete v-model="queryParam.recipient" :dataSource="UserdataSource"
placeholder="请选择领用人" @select="onSelect" @search="onSearch" @change="onChange" /> placeholder="请选择领用人" @select="onSelect" @search="onSearch" @change="onChange" />
</a-col> </a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
@ -33,9 +33,24 @@
@change="handleImportExcel"> @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button> <a-button type="primary" icon="import">导入</a-button>
</a-upload> </a-upload>
<a-button type="primary" icon="zoom-in" @click="showHistoryModal">历史数据</a-button>
<a-modal v-model="historyModalVisible" title="历史数据" @ok="closeHistoryModal">
<div class="modal-content">
<!-- 在这里显示历史数据 -->
<div v-for="TimestampData in historyData" :key="TimestampData.id" class="container">
<div class="left">
<p style="font-size: 17px;">{{ TimestampData }}</p>
</div>
<div class="right">
<a-button type="primary" icon="download"
@click="ExportData('家具信息表', TimestampData)">导出</a-button>
</div>
</div>
</div>
</a-modal>
<!-- 高级查询区域 --> <!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal"
@handleSuperQuery="handleSuperQuery"></j-super-query> @handleSuperQuery="handleSuperQuery"></j-super-query> -->
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item> <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
@ -239,9 +254,12 @@ export default {
exportXlsUrl: "/rms/rmsFurniture/exportXls", exportXlsUrl: "/rms/rmsFurniture/exportXls",
importExcelUrl: "rms/rmsFurniture/importExcel", importExcelUrl: "rms/rmsFurniture/importExcel",
userUrl: "/sys/user/queryUserComponentData?column=createTime&order=desc&field=id,,username,realname,sex,phone,orgCodeTxt&pageNo=1&pageSize=100", userUrl: "/sys/user/queryUserComponentData?column=createTime&order=desc&field=id,,username,realname,sex,phone,orgCodeTxt&pageNo=1&pageSize=100",
timestampUrl: "/rms/rmsFurniture/getTimestamp",
}, },
UserList: {}, UserList: {},
historyModalVisible: false, //
historyData: [] //
} }
}, },
created() { created() {
@ -253,6 +271,17 @@ export default {
}, },
}, },
methods: { methods: {
showHistoryModal() {
getAction(this.url.timestampUrl).then(res => {
console.log(res)
this.historyData = res;
})
this.historyModalVisible = true; //
},
closeHistoryModal() {
this.historyModalVisible = false; //
},
// //
getUserInfo() { getUserInfo() {
getAction(this.url.userUrl).then(res => { getAction(this.url.userUrl).then(res => {
@ -279,4 +308,20 @@ export default {
</script> </script>
<style scoped> <style scoped>
@import '~@assets/less/common.less'; @import '~@assets/less/common.less';
.modal-content {
max-height: 400px; /* 设置最大高度,根据需要进行调整 */
overflow-y: auto; /* 添加垂直滚动条 */
}
.container {
display: flex;
align-items: center;
}
.left {
flex: 1;
}
.right {
margin-left: 10px;
}
</style> </style>

View File

@ -10,7 +10,7 @@
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="5" :lg="7" :md="8" :sm="24"> <a-col :xl="5" :lg="7" :md="8" :sm="24">
<a-auto-complete v-model="queryParam.recipient" :dataSource="UserdataSource" style="width: 200px" <a-auto-complete v-model="queryParam.recipient" :dataSource="UserdataSource"
placeholder="请选择领用人" @select="onSelect" @search="onSearch" @change="onChange" /> placeholder="请选择领用人" @select="onSelect" @search="onSearch" @change="onChange" />
</a-col> </a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
@ -25,11 +25,30 @@
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
<div class="table-operator"> <div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<!-- <a-button @click="AddDataInstrument()" type="primary" icon="plus">导数据</a-button> -->
<a-button type="primary" icon="download" @click="handleExportXls('仪器信息表')">导出</a-button> <a-button type="primary" icon="download" @click="handleExportXls('仪器信息表')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
@change="handleImportExcel"> @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button> <a-button type="primary" icon="import">导入</a-button>
</a-upload> </a-upload>
<a-button type="primary" icon="zoom-in" @click="showHistoryModal">历史数据</a-button>
<a-modal v-model="historyModalVisible" title="历史数据" @ok="closeHistoryModal">
<div class="modal-content">
<!-- 在这里显示历史数据 -->
<div v-for="TimestampData in historyData" :key="TimestampData.id" class="container">
<div class="left">
<p style="font-size: 17px;">{{ TimestampData }}</p>
</div>
<div class="right">
<a-button type="primary" icon="download"
@click="ExportData('仪器信息表', TimestampData)">导出</a-button>
</div>
</div>
</div>
</a-modal>
<!-- 高级查询区域 -->
<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal"
@handleSuperQuery="handleSuperQuery"></j-super-query> -->
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item> <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
@ -211,8 +230,11 @@ export default {
exportXlsUrl: "/rms/rmsInstrument/exportXls", exportXlsUrl: "/rms/rmsInstrument/exportXls",
importExcelUrl: "rms/rmsInstrument/importExcel", importExcelUrl: "rms/rmsInstrument/importExcel",
userUrl: "/sys/user/queryUserComponentData?column=createTime&order=desc&field=id,,username,realname,sex,phone,orgCodeTxt&pageNo=1&pageSize=100", userUrl: "/sys/user/queryUserComponentData?column=createTime&order=desc&field=id,,username,realname,sex,phone,orgCodeTxt&pageNo=1&pageSize=100",
timestampUrl: "/rms/rmsInstrument/getTimestamp",
}, },
UserList: {}, UserList: {},
historyModalVisible: false, //
historyData: [] //
} }
}, },
created() { created() {
@ -224,6 +246,53 @@ export default {
}, },
}, },
methods: { methods: {
// ExportInstrumentData(fileName, TimestampData) {
// console.log(TimestampData)
// if (!fileName || typeof fileName != "string") {
// fileName = ""
// }
// let param = this.getQueryParams();
// if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
// param['selections'] = this.selectedRowKeys.join(",")
// }
// param['timestamp'] = TimestampData.timestamp
// console.log("", param)
// downFile(this.url.exportXlsUrl, param).then((data) => {
// if (!data) {
// this.$message.warning("")
// return
// }
// if (typeof window.navigator.msSaveBlob !== 'undefined') {
// window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
// } else {
// let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
// let link = document.createElement('a')
// link.style.display = 'none'
// link.href = url
// link.setAttribute('download', fileName + '.xls')
// document.body.appendChild(link)
// link.click()
// document.body.removeChild(link); //
// window.URL.revokeObjectURL(url); //blob
// }
// })
// },
showHistoryModal() {
getAction(this.url.timestampUrl).then(res => {
console.log(res)
this.historyData = res;
})
this.historyModalVisible = true; //
},
closeHistoryModal() {
this.historyModalVisible = false; //
},
// AddDataInstrument() {
// getAction("/rms/rmsIntangible/addDataInstrument").then(res => {
// console.log(res)
// })
// },
// //
getUserInfo() { getUserInfo() {
getAction(this.url.userUrl).then(res => { getAction(this.url.userUrl).then(res => {
@ -250,4 +319,20 @@ export default {
</script> </script>
<style scoped> <style scoped>
@import '~@assets/less/common.less'; @import '~@assets/less/common.less';
.modal-content {
max-height: 400px; /* 设置最大高度,根据需要进行调整 */
overflow-y: auto; /* 添加垂直滚动条 */
}
.container {
display: flex;
align-items: center;
}
.left {
flex: 1;
}
.right {
margin-left: 10px;
}
</style> </style>

View File

@ -10,7 +10,7 @@
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="5" :lg="7" :md="8" :sm="24"> <a-col :xl="5" :lg="7" :md="8" :sm="24">
<a-auto-complete v-model="queryParam.recipient" :dataSource="UserdataSource" style="width: 200px" <a-auto-complete v-model="queryParam.recipient" :dataSource="UserdataSource"
placeholder="请选择领用人" @select="onSelect" @search="onSearch" @change="onChange" /> placeholder="请选择领用人" @select="onSelect" @search="onSearch" @change="onChange" />
</a-col> </a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
@ -34,9 +34,23 @@
@change="handleImportExcel"> @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button> <a-button type="primary" icon="import">导入</a-button>
</a-upload> </a-upload>
<a-button type="primary" icon="zoom-in" @click="showHistoryModal">历史数据</a-button>
<a-modal v-model="historyModalVisible" title="历史数据" @ok="closeHistoryModal">
<div class="modal-content">
<!-- 在这里显示历史数据 -->
<div v-for="TimestampData in historyData" :key="TimestampData.id" class="container">
<div class="left">
<p style="font-size: 17px;">{{ TimestampData }}</p>
</div>
<div class="right">
<a-button type="primary" icon="download" @click="ExportData('无形资产信息表', TimestampData)">导出</a-button>
</div>
</div>
</div>
</a-modal>
<!-- 高级查询区域 --> <!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal"
@handleSuperQuery="handleSuperQuery"></j-super-query> @handleSuperQuery="handleSuperQuery"></j-super-query> -->
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item> <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
@ -267,9 +281,12 @@ export default {
exportXlsUrl: "/rms/rmsIntangible/exportXls", exportXlsUrl: "/rms/rmsIntangible/exportXls",
importExcelUrl: "rms/rmsIntangible/importExcel", importExcelUrl: "rms/rmsIntangible/importExcel",
userUrl: "/sys/user/queryUserComponentData?column=createTime&order=desc&field=id,,username,realname,sex,phone,orgCodeTxt&pageNo=1&pageSize=100", userUrl: "/sys/user/queryUserComponentData?column=createTime&order=desc&field=id,,username,realname,sex,phone,orgCodeTxt&pageNo=1&pageSize=100",
timestampUrl: "/rms/rmsIntangible/getTimestamp",
}, },
UserList: {}, UserList: {},
historyModalVisible: false, //
historyData: [] //
} }
}, },
created() { created() {
@ -286,6 +303,16 @@ export default {
// console.log(res) // console.log(res)
// }); // });
// }, // },
showHistoryModal() {
getAction(this.url.timestampUrl).then(res => {
console.log(res)
this.historyData = res;
})
this.historyModalVisible = true; //
},
closeHistoryModal() {
this.historyModalVisible = false; //
},
// //
getUserInfo() { getUserInfo() {
getAction(this.url.userUrl).then(res => { getAction(this.url.userUrl).then(res => {
@ -316,4 +343,23 @@ export default {
</script> </script>
<style scoped> <style scoped>
@import '~@assets/less/common.less'; @import '~@assets/less/common.less';
</style>
.modal-content {
max-height: 400px;
/* 设置最大高度,根据需要进行调整 */
overflow-y: auto;
/* 添加垂直滚动条 */
}
.container {
display: flex;
align-items: center;
}
.left {
flex: 1;
}
.right {
margin-left: 10px;
}</style>

View File

@ -4,7 +4,7 @@
<div class="page"> <div class="page">
<a-row> <a-row>
<a-col :span="5" class="tree"> <a-col :span="5" class="tree">
<locationaTree ref="locationaTree" :height="500" @onSelect="onSelect" ></locationaTree> <locationaTree ref="locationaTree" :height="500" @onSelect="onSelect"></locationaTree>
</a-col> </a-col>
<a-col :span="19" class="table"> <a-col :span="19" class="table">
@ -70,7 +70,8 @@ export default {
{ {
title: '排序号', title: '排序号',
align: "center", align: "center",
dataIndex: 'sortNumber' dataIndex: 'sortNumber',
sorter: true
}, },
{ {
title: '操作', title: '操作',
@ -81,6 +82,10 @@ export default {
scopedSlots: { customRender: 'action' } scopedSlots: { customRender: 'action' }
} }
], ],
isorter: {
column: 'sortNumber',
order: 'asc'
},
url: { url: {
list: "/rms/rmsLocation/list", list: "/rms/rmsLocation/list",
delete: "/rms/rmsLocation/delete", delete: "/rms/rmsLocation/delete",
@ -99,6 +104,24 @@ export default {
}, },
}, },
methods: { methods: {
// JeecgListMixin.js
//
handleTableChange(pagination, filters, sorter) {
//
console.log(pagination)
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
// update-begin--Author:ciei  Date:20230504 for
if (sorter.order === undefined) {
this.isorter.column = 'sortNumber';
this.isorter.order = 'asc';
}
// update-end--Author:ciei  Date:20230504 for
}
this.ipagination = pagination;
this.loadData();
},
onSelect(selectedRowKeys) { onSelect(selectedRowKeys) {
// //
selectedRowKeys = selectedRowKeys.join(',') selectedRowKeys = selectedRowKeys.join(',')