食堂售卖统计
This commit is contained in:
1 parent
5fe5b955c9
commit
e718cfff82
2 files changed
+171
No files matched your search
@@ -1,5 +1,20 @@
|
|||||||
import request from "/@/utils/request"
|
import request from "/@/utils/request"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 食堂统计
|
||||||
|
*/
|
||||||
|
export function canteenProudctTotal(query: any) {
|
||||||
|
return request({
|
||||||
|
url: "/hard/hard-canteen-total-log/proudct-total",
|
||||||
|
method: "post",
|
||||||
|
params: {
|
||||||
|
current: query.current,
|
||||||
|
size: query.size,
|
||||||
|
},
|
||||||
|
data: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function pageListDept(query?: any) {
|
export function pageListDept(query?: any) {
|
||||||
return request({
|
return request({
|
||||||
url: "/hard/hard-total/page-list-dept",
|
url: "/hard/hard-total/page-list-dept",
|
||||||
|
|||||||
@@ -0,0 +1,156 @@
|
|||||||
|
<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: 250px" label="用餐时间段" prop="hourType">
|
||||||
|
<dict-select v-model="state.queryForm.hourType" dict-code="daily_menu" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item style="width: 450px" label="创建时间" prop="createTimeList">
|
||||||
|
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD" type="daterange" />
|
||||||
|
</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="'wallet_walletTransaction_export'"
|
||||||
|
@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"
|
||||||
|
:header-cell-style="tableStyle.headerCellStyle"
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
:show-summary="true"
|
||||||
|
@selection-change="selectionChangHandle"
|
||||||
|
@sort-change="sortChangeHandle"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="80" align="center" />
|
||||||
|
<el-table-column type="index" label="#" width="50" />
|
||||||
|
<el-table-column label="用餐时间" align="center" prop="createTime" />
|
||||||
|
<el-table-column label="用餐时间段" align="center" prop="hourType">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<dict-tag :options="daily_menu" :value="row.hourType" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="售出商品数量" align="center" prop="payCount">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span class="color-success"> {{ row.payCount || 0 }}份 </span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column fixed="right" label="操作" width="200">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button icon="Tickets" text type="primary"> 菜品详情 </el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||||
|
</template>
|
||||||
|
</DraggableDepTree>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="hard-sb">
|
||||||
|
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||||
|
import * as hardTotalApi from "/@/api/hard/hard-total"
|
||||||
|
import { displayPrice } from "/@/utils/formatMoney"
|
||||||
|
import { useDict } from "/@/hooks/dict"
|
||||||
|
|
||||||
|
// 搜索变量
|
||||||
|
const queryRef = ref()
|
||||||
|
const showSearch = ref(true)
|
||||||
|
|
||||||
|
// 多选变量
|
||||||
|
const selectObjs = ref([]) as any
|
||||||
|
const multiple = ref(true)
|
||||||
|
const draggableDepTreeRef = ref() // 树组件ref引用
|
||||||
|
|
||||||
|
// 定义查询字典
|
||||||
|
const { daily_menu } = useDict("daily_menu")
|
||||||
|
|
||||||
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
|
queryForm: {},
|
||||||
|
pageList: hardTotalApi.canteenProudctTotal,
|
||||||
|
})
|
||||||
|
|
||||||
|
// table hook
|
||||||
|
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, postDownBlobFile, tableStyle } = useTable(state)
|
||||||
|
|
||||||
|
// 导出excel
|
||||||
|
const exportExcel = () => {
|
||||||
|
postDownBlobFile("/hard/hard-total/export-sb", Object.assign(state.queryForm), "设备交易记录.xlsx")
|
||||||
|
}
|
||||||
|
|
||||||
|
const getSummaries = (param: any) => {
|
||||||
|
const { columns, data } = param
|
||||||
|
const totalColumns = ["payCount"]
|
||||||
|
const totalRow = Array.from({ length: columns.length })
|
||||||
|
totalRow[0] = "合计"
|
||||||
|
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 resetQuery = () => {
|
||||||
|
// 清空搜索条件
|
||||||
|
queryRef.value?.resetFields()
|
||||||
|
// 清空多选
|
||||||
|
selectObjs.value = []
|
||||||
|
state.queryForm.deptId = ""
|
||||||
|
state.queryForm.userDeptIds = []
|
||||||
|
draggableDepTreeRef.value.resetData()
|
||||||
|
getDataList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选事件
|
||||||
|
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||||
|
selectObjs.value = objs.map(({ id }) => id)
|
||||||
|
multiple.value = !objs.length
|
||||||
|
}
|
||||||
|
|
||||||
|
// 树节点选择时
|
||||||
|
const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepTree: any) => {
|
||||||
|
state.queryForm.deptId = curClickedNode.id
|
||||||
|
state.queryForm.userDeptIds = checkedTreeNodes.map((item: any) => item.id)
|
||||||
|
state.queryForm.isInclude = !isDeepTree
|
||||||
|
getDataList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in new issue
Block a user