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