|
@@ -0,0 +1,133 @@
|
|
|
+<template>
|
|
|
+<div class="layout_container">
|
|
|
+<header>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="dateValue"
|
|
|
+ type="datetimerange"
|
|
|
+ value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ start-placeholder="开始时间"
|
|
|
+ end-placeholder="结束时间"
|
|
|
+ :default-time="defaultTime2"
|
|
|
+ />
|
|
|
+ <el-select v-model="type" style="width: 200px; margin-left: 5px">
|
|
|
+ <el-option label="执行科室核算汇总" value="1"></el-option>
|
|
|
+ <el-option label="申请科室核算汇总" value="2"></el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-button type="primary" icon="Search" @click="queryData" style="margin-left: 5px">查询</el-button>
|
|
|
+ <el-button type="primary" icon="Download" @click="exportData" style="margin-left: 5px">导出</el-button>
|
|
|
+</header>
|
|
|
+<div class="layout_main">
|
|
|
+ <div class="layout_container">
|
|
|
+ <div class="layout_main layout_el-table">
|
|
|
+ <el-table :data="returnData.data" :span-method="objectSpanMethod" :row-style="rowStyle"
|
|
|
+ height="100%" highlight-current-row border stripe>
|
|
|
+ <el-table-column type="index" label="序号" align="center"></el-table-column>
|
|
|
+ <template v-for="col in returnData.headList">
|
|
|
+ <el-table-column :prop="col.name" :label="col.display" :width="col.width" :align="col.align"
|
|
|
+ show-overflow-tooltip>
|
|
|
+ </el-table-column>
|
|
|
+ </template>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+</div>
|
|
|
+</template>
|
|
|
+<script setup name="InpatientDeptAccountingReport">
|
|
|
+import {reactive, ref} from 'vue'
|
|
|
+import {
|
|
|
+ exportInpatientDeptAccountingReport,
|
|
|
+ selectInpatientDeptAccountingReport
|
|
|
+} from "@/api/reports/all-statistics-report";
|
|
|
+import {ElMessage} from "element-plus";
|
|
|
+
|
|
|
+const dateValue = ref('')
|
|
|
+const type = ref("1")
|
|
|
+const now = new Date()
|
|
|
+const defaultTime2 = [
|
|
|
+ new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0),
|
|
|
+ new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59),
|
|
|
+]
|
|
|
+const queryTerm = reactive({
|
|
|
+ startTime: defaultTime2[0],
|
|
|
+ endTime: defaultTime2[1],
|
|
|
+ type: type.value,
|
|
|
+ exportName: '',
|
|
|
+});
|
|
|
+const returnData = ref({
|
|
|
+ headList: [],
|
|
|
+ data: []
|
|
|
+});
|
|
|
+// 查询
|
|
|
+const queryData = async () => {
|
|
|
+ if (!dateValue.value) {
|
|
|
+ ElMessage({
|
|
|
+ message: '请选择查询时间!',
|
|
|
+ type: 'warning',
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ queryTerm.startTime = dateValue.value[0]
|
|
|
+ queryTerm.endTime = dateValue.value[1]
|
|
|
+ queryTerm.type = type.value
|
|
|
+ selectInpatientDeptAccountingReport(queryTerm)
|
|
|
+ .then((res) => {
|
|
|
+ returnData.value.headList = res.headList
|
|
|
+ returnData.value.data = res.dataList
|
|
|
+ });
|
|
|
+};
|
|
|
+// 导出
|
|
|
+const exportData = () => {
|
|
|
+ if (returnData.value.data.length <= 0) {
|
|
|
+ ElMessage({
|
|
|
+ message: '没有可以导出的数据!',
|
|
|
+ type: 'warning',
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let t
|
|
|
+ if(type.value === "1") {
|
|
|
+ t = "泰和医院住院执行科室核算收入报表"
|
|
|
+ } else {
|
|
|
+ t = "泰和医院住院申请科室核算收入报表"
|
|
|
+ }
|
|
|
+ // 导出excel表格标题
|
|
|
+ queryTerm.exportName = t;
|
|
|
+ exportInpatientDeptAccountingReport(queryTerm)
|
|
|
+}
|
|
|
+// 单元格合并
|
|
|
+const objectSpanMethod = (data) => {
|
|
|
+ if(data.columnIndex === 1){
|
|
|
+ // 当前列为0的时候不进行操作单元格
|
|
|
+ const name = data.row[data.column.property];
|
|
|
+ const preRow = returnData.value.data[data.rowIndex - 1];
|
|
|
+ const preValue = preRow ? preRow[data.column.property] : null;
|
|
|
+ // 当前行的数据对象的name 是否和 上一行列的 name 是否相等 相等就不合并单元格
|
|
|
+ if (name === preValue) {
|
|
|
+ return {rowspan: 0, colspan: 0}; // 不生成单元格
|
|
|
+ } else {
|
|
|
+ let rowspan = 1;
|
|
|
+ for (let i = data.rowIndex + 1; i < returnData.value.data.length; i++) {
|
|
|
+ const nextRow = returnData.value.data[i];
|
|
|
+ const nextValue = nextRow[data.column.property];
|
|
|
+ if (nextValue === name) {
|
|
|
+ rowspan++;
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {rowspan, colspan: 1};
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+const rowStyle = (data) => {
|
|
|
+ if (data.row.flm === "小计:") {
|
|
|
+ return 'color: #d7073b;font-weight: 700;';
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|