236 lines
9.4 KiB
Vue
236 lines
9.4 KiB
Vue
<template>
|
|
<div class="layout-padding">
|
|
<div class="layout-padding-auto layout-padding-view">
|
|
<DraggableDepTree ref="draggableDepTreeRef" placeholder="请输入部门名称" :show-expand="true"
|
|
@getSelectNode="handleGetSelectNode" switch-inactive-text="包含" switch-active-text="不包含"
|
|
:defaultTreeWidth="20" :nodeClickable="false">
|
|
<template #default>
|
|
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
|
<el-row>
|
|
<el-form-item style="width: 400px" label="时间" prop="createTimeList">
|
|
<el-date-picker v-model="state.queryForm.createTimeList"
|
|
value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" />
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn")
|
|
}}</el-button>
|
|
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
|
|
</el-form-item>
|
|
</el-row>
|
|
</el-form>
|
|
<el-row>
|
|
<div class="mb8" style="width: 100%">
|
|
<right-toolbar :search="false" v-model:showSearch="showSearch"
|
|
:export="'hard_hardTotal_export_dept'" @exportExcel="exportExcel" class="ml10 mr20"
|
|
style="float: right" @queryTable="getDataList"></right-toolbar>
|
|
</div>
|
|
</el-row>
|
|
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
|
height="70vh" :header-cell-style="tableStyle.headerCellStyle" :summary-method="getSummaries"
|
|
show-summary @selection-change="selectionChangHandle" @sort-change="sortChangeHandle">
|
|
<el-table-column type="selection" width="40" align="center" />
|
|
<el-table-column type="index" label="#" width="80" />
|
|
<el-table-column prop="deptName" min-width="150" label="部门" />
|
|
<el-table-column prop="walletPrice" label="批量充值金额" align="center" min-width="110">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.walletPrice != 0 }">{{ displayPrice(row.walletPrice)
|
|
}}</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="walletCount" label="批量充值次数" align="center" min-width="110">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.walletCount != 0 }">{{ row.walletCount }}次</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="walletReducePrice" label="批量扣减金额" align="center" min-width="110">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.walletReducePrice != 0 }">{{
|
|
displayPrice(row.walletReducePrice) }}</div>
|
|
</template>
|
|
</el-table-column>
|
|
<!-- start 批量退换食堂 start -->
|
|
<el-table-column prop="walletReturnCanteenCount" label="批量退还各自食堂次数" align="center"
|
|
min-width="170">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.walletReturnCanteenCount != 0 }">{{
|
|
row.walletReturnCanteenCount }}次</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="walletReturnCanteenPrice" label="批量退还各自食堂金额" align="center"
|
|
min-width="170">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.walletReturnCanteenPrice != 0 }">{{
|
|
displayPrice(row.walletReturnCanteenPrice) }}</div>
|
|
</template>
|
|
</el-table-column>
|
|
<!-- end 批量退换食堂 end -->
|
|
<el-table-column prop="walletReduceCount" label="批量扣减次数" align="center" min-width="110">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.walletReduceCount != 0 }">{{ row.walletReduceCount
|
|
}}次</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="walletOncePrice" label="单次充值金额" align="center" min-width="110">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.walletOncePrice != 0 }">{{
|
|
displayPrice(row.walletOncePrice) }}</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="walletOnceCount" label="单次充值次数" align="center" min-width="110">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.walletOnceCount != 0 }">{{ row.walletOnceCount }}次
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="walletOnceReducePrice" label="单次扣减金额" align="center" min-width="110">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.walletOnceReducePrice != 0 }">{{
|
|
displayPrice(row.walletOnceReducePrice) }}</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="walletOnceReduceCount" label="单次扣减次数" align="center" min-width="110">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.walletOnceReduceCount != 0 }">{{
|
|
row.walletOnceReduceCount }}次</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="orderPayPrice" label="流水金额" align="center" min-width="90">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-primary': row.orderPayPrice != 0 }">{{
|
|
displayPrice(row.orderPayPrice) }}</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="orderPayCount" label="流水次数" align="center" min-width="90">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-primary': row.orderPayCount != 0 }">{{ row.orderPayCount }}次</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="orderRefundPrice" label="退款金额" align="center" min-width="90">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-danger': row.orderRefundPrice != 0 }">
|
|
{{ displayPrice(row.orderRefundPrice) }}
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="orderRefundCont" label="退款次数" align="center" min-width="90">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-danger': row.orderRefundCont != 0 }">
|
|
{{ row.orderRefundCont }}次
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="orderProfitPrice" label="消费净金额" align="center" min-width="120">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.orderProfitPrice != 0 }">
|
|
{{ displayPrice(row.orderProfitPrice) }}
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="orderProfitCont" label="消费净次数" align="center" min-width="120">
|
|
<template #default="{ row }">
|
|
<div :class="{ 'color-success': row.orderProfitCont != 0 }">
|
|
{{ row.orderProfitCont }}次
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column v-if="false" label="操作" width="300"> </el-table-column>
|
|
</el-table>
|
|
</template>
|
|
</DraggableDepTree>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts" name="hard-dept-total">
|
|
import { BasicTableProps, useTable } from "/@/hooks/table"
|
|
import { displayPrice } from "/@/utils/formatMoney"
|
|
import { useDict } from "/@/hooks/dict"
|
|
import * as hardTotalApi from "/@/api/hard/hard-total"
|
|
|
|
// 搜索变量
|
|
const queryRef = ref()
|
|
const showSearch = ref(true)
|
|
// 多选变量
|
|
const selectObjs = ref([]) as any
|
|
const multiple = ref(true)
|
|
const draggableDepTreeRef = ref() // 树组件ref引用
|
|
|
|
// 表格变量
|
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
|
isPage: false,
|
|
queryForm: {},
|
|
pageList: hardTotalApi.pageListDept,
|
|
})
|
|
|
|
// table hook
|
|
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, postDownBlobFile, tableStyle } = useTable(state)
|
|
|
|
// 导出excel
|
|
const exportExcel = () => {
|
|
postDownBlobFile("/hard/hard-total/export-dept", Object.assign(state.queryForm), "部门交易记录导出.xlsx")
|
|
}
|
|
|
|
const getSummaries = (param: any) => {
|
|
const { columns, data } = param
|
|
const totalColumns = [
|
|
"walletPrice",
|
|
"walletCount",
|
|
"orderPayPrice",
|
|
"orderPayCount",
|
|
"orderRefundPrice",
|
|
"orderRefundCont",
|
|
"walletReducePrice",
|
|
"walletReduceCount",
|
|
"walletOncePrice",
|
|
"walletOnceCount",
|
|
"walletOnceReducePrice",
|
|
"walletOnceReduceCount",
|
|
"orderProfitPrice",
|
|
"orderProfitCont",
|
|
"walletReturnCanteenCount",
|
|
"walletReturnCanteenPrice"
|
|
]
|
|
const totalRow = Array.from({ length: columns.length })
|
|
columns.forEach((i: any, index: number) => {
|
|
if (totalColumns.includes(i.property)) {
|
|
const total = data
|
|
.filter((v: any) => v[i.property] != null)
|
|
.map((v: any) => Number(v[i.property]))
|
|
.reduce((pren: number, next: number) => pren + next, 0)
|
|
if (i.property.includes("Price")) {
|
|
totalRow[index] = displayPrice(total)
|
|
} else {
|
|
totalRow[index] = total + "次"
|
|
}
|
|
}
|
|
})
|
|
return totalRow
|
|
}
|
|
|
|
// 多选事件
|
|
const selectionChangHandle = (objs: { id: string }[]) => {
|
|
selectObjs.value = objs.map(({ id }) => id)
|
|
multiple.value = !objs.length
|
|
}
|
|
|
|
// 清空搜索条件
|
|
const resetQuery = () => {
|
|
// 清空搜索条件
|
|
queryRef.value?.resetFields()
|
|
// 清空多选
|
|
selectObjs.value = []
|
|
state.queryForm.deptId = ""
|
|
state.queryForm.deptIds = []
|
|
draggableDepTreeRef.value.resetData()
|
|
getDataList()
|
|
}
|
|
|
|
// 树节点选择时
|
|
const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepTree: any) => {
|
|
state.queryForm.deptId = curClickedNode.id
|
|
state.queryForm.deptIds = checkedTreeNodes.map((item: any) => item.id)
|
|
state.queryForm.isInclude = !isDeepTree
|
|
getDataList()
|
|
}
|
|
</script>
|