mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-23 20:44:58 +08:00
导出修改
This commit is contained in:
parent
6e27f4e6fe
commit
a4a4a5b911
|
@ -1,13 +1,13 @@
|
|||
import * as XLSX from "xlsx"
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { dateFormater } from '@/utils/date-util'
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
import {dateFormater} from '@/utils/date-util'
|
||||
import {downBlobFile} from "@/utils/file-util";
|
||||
|
||||
export const tableRemoveRow = (params: any, callback: (res: boolean) => void) => {
|
||||
if (!params.data) params.data = []
|
||||
if (Array.isArray(params.data)) {
|
||||
if (params.data.length < 1) {
|
||||
ElMessageBox.alert('请至少选择一条数据进行删除', '系统提醒', { type: 'warning', draggable: true })
|
||||
ElMessageBox.alert('请至少选择一条数据进行删除', '系统提醒', {type: 'warning', draggable: true})
|
||||
return callback(false)
|
||||
}
|
||||
ElMessageBox.confirm(
|
||||
|
@ -47,23 +47,24 @@ export const exportData = (fileName: string, data: Array<any>) => {
|
|||
deptId: "",
|
||||
phone: "",
|
||||
username: ""
|
||||
}, "users.xlsx")
|
||||
}, "users.xlsx")
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fileName
|
||||
* @param data
|
||||
*
|
||||
* @param fileName
|
||||
* @param data
|
||||
* @param sheetNameKey data中的键名 对应表页名称
|
||||
* @param sheetDataKey data中的键名 对应表数据
|
||||
*/
|
||||
export const exportMultiData = (fileName: string, data: Array<any>) => {
|
||||
export const exportMultiData = (fileName: string, data: Array<any>, title: Array<string>) => {
|
||||
if (data.length < 1) return
|
||||
const wb = XLSX.utils.book_new();
|
||||
const sheet = XLSX.utils.sheet_add_aoa(XLSX.utils.json_to_sheet(data), [title], {origin: "A1"})
|
||||
XLSX.utils.book_append_sheet(
|
||||
wb,
|
||||
XLSX.utils.json_to_sheet(data),
|
||||
"Sheet1"
|
||||
wb,
|
||||
sheet,
|
||||
"Sheet1"
|
||||
)
|
||||
XLSX.writeFile(wb, fileName + '.xls'); // 导出Excel
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
<div class="button-part" style="justify-content: space-between;">
|
||||
<el-button icon="Delete" @click="removeData()">删除</el-button>
|
||||
<TableAbility @searchBtn="isSearch = !isSearch" @refreshBtn="init"
|
||||
@downloadBtn="exportMultiData('日志数据', tableData)"></TableAbility>
|
||||
@downloadBtn="exportTable(tableData)"></TableAbility>
|
||||
</div>
|
||||
<div class="table-part">
|
||||
<el-table ref="tableRef" v-loading="loading" :data="tableData" height="100%" border show-overflow-tooltip
|
||||
|
@ -112,8 +112,10 @@ function getList() {
|
|||
}
|
||||
|
||||
function search() {
|
||||
queryParams.value.timeStr = [dateFormater("yyyy-MM-dd", queryParams.value.time[0]),
|
||||
if (queryParams.value.time) {
|
||||
queryParams.value.timeStr = [dateFormater("yyyy-MM-dd", queryParams.value.time[0]),
|
||||
dateFormater("yyyy-MM-dd", queryParams.value.time[1])]
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -159,6 +161,12 @@ const paginationChange = (page: number, s: number) => {
|
|||
getList()
|
||||
}
|
||||
|
||||
function exportTable(data: any) {
|
||||
const header = ["id", "日志类型", "标题", "创建者", "创建时间", "更新时间",
|
||||
"远程地址", "客户端", "请求地址", "请求方法", "参数", "持续时间", "异常", "服务端", "删除状态", "医院id"]
|
||||
exportMultiData('日志数据', data, header)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<el-button icon="Delete" @click="removeData()">删除</el-button>-->
|
||||
</div>
|
||||
<TableAbility @searchBtn="isSearch = !isSearch" @refreshBtn="queryData()"
|
||||
@downloadBtn="exportData('患者信息', tableData)"></TableAbility>
|
||||
@downloadBtn="exportMultiData('患者信息', tableData, [])"></TableAbility>
|
||||
</div>
|
||||
<div class="table-part">
|
||||
<el-table ref="tableRef" v-loading="loading" :data="tableData" height="100%" border show-overflow-tooltip
|
||||
|
@ -65,7 +65,7 @@
|
|||
<script lang='ts' setup>
|
||||
import {ref, onMounted} from 'vue'
|
||||
import {useRouter} from 'vue-router'
|
||||
import {exportData, tableRemoveRow} from '@/utils/table-util'
|
||||
import {exportData, exportMultiData, tableRemoveRow} from '@/utils/table-util'
|
||||
import CommonPagination from '@/components/common-pagination.vue'
|
||||
import * as patientApi from "@/api/patient";
|
||||
import PatientsForm from "@/views/patients-manage/form/patients-form.vue";
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<TableAbility :isDownload="tableData && tableData.length > 0" @searchBtn="isSearch = !isSearch"
|
||||
@refreshBtn="queryData(queryParams)"
|
||||
|
||||
@downloadBtn="exportMultiData('电子病史', tableData)">
|
||||
@downloadBtn="exportMultiData('电子病史', tableData, [])">
|
||||
</TableAbility>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -60,14 +60,14 @@
|
|||
|
||||
<script lang='ts' setup>
|
||||
import {onMounted, ref} from 'vue'
|
||||
import {dateFormater} from '@/utils/date-util'
|
||||
import {exportData, tableRemoveRow} from '@/utils/table-util'
|
||||
import {tableRemoveRow} from '@/utils/table-util'
|
||||
import CommonPagination from '@/components/common-pagination.vue'
|
||||
import RoleForm from './form/role-form.vue'
|
||||
import ImportDialog from '@/components/import-dialog.vue'
|
||||
import EmpowerDialog from './form/empower-dialog.vue'
|
||||
import * as roleApi from "@/api/role";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {downBlobFile} from "@/utils/file-util";
|
||||
|
||||
const tableRef = ref()
|
||||
const RoleFormRef = ref()
|
||||
|
@ -170,6 +170,14 @@ const paginationChange = (page: number, s: number) => {
|
|||
const importSuccessEvent = () => {
|
||||
init();
|
||||
}
|
||||
|
||||
const exportData = (fileName: string, data: Array<any>) => {
|
||||
downBlobFile("/admin/role/export", {
|
||||
deptId: "",
|
||||
phone: "",
|
||||
username: ""
|
||||
}, "users.xlsx")
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<el-button icon="Delete" @click="removeData()">删除</el-button>
|
||||
</div>
|
||||
<TableAbility @searchBtn="isSearch = !isSearch" @refreshBtn="refresh"
|
||||
@downloadBtn="exportData('医生数据', tableData)"></TableAbility>
|
||||
@downloadBtn="exportData( tableData)"></TableAbility>
|
||||
</div>
|
||||
<div class="table-part">
|
||||
<el-table ref="tableRef" v-loading="loading" :data="tableData" height="100%" border show-overflow-tooltip
|
||||
|
@ -65,7 +65,7 @@
|
|||
|
||||
<script lang='ts' setup>
|
||||
import {onMounted, ref} from 'vue'
|
||||
import {exportData, tableRemoveRow} from '@/utils/table-util'
|
||||
import {exportMultiData, tableRemoveRow} from '@/utils/table-util'
|
||||
import CommonPagination from '@/components/common-pagination.vue'
|
||||
import HospitalForm from './form/hospital-form.vue'
|
||||
import {dateFormater} from '@/utils/date-util'
|
||||
|
@ -166,6 +166,11 @@ const paginationChange = (page: number, s: number) => {
|
|||
size = s;
|
||||
getList();
|
||||
}
|
||||
|
||||
function exportData(data: any) {
|
||||
const header = ["id", "医院名称", "医院编码", "省编码", "市编码", "状态", "开始时间", "结束时间", "域名"]
|
||||
exportMultiData('医院信息', data, header)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped></style>
|
||||
|
|
Loading…
Reference in New Issue
Block a user