fix: 耗材列表增加统计

This commit is contained in:
2025-03-13 10:19:57 +08:00
parent 9295b58587
commit dc5dc45893
4 changed files with 367 additions and 102 deletions

View File

@@ -5,9 +5,11 @@
<page-search
ref="searchRef"
:search-config="searchConfig"
@query-click="handleQueryClick"
@query-click="newHandleQueryClick"
@reset-click="handleResetClick"
/>
<!-- 统计 -->
<data-tongji :data="gongjiData"></data-tongji>
<!-- 列表 -->
<page-content
ref="contentRef"
@@ -92,15 +94,15 @@
<script setup lang="ts">
import addHaocai from "./components/add-haocai.vue";
import dataTongji from "./components/DataStatistics.vue";
import addConsTakin from "./components/addConsTakin.vue";
import orderApi, { type getListResponse, OrderInfoVo } from "@/api/order/order";
import consApi from "@/api/product/cons";
import type { IObject, IOperatData } from "@/components/CURD/types";
import usePage from "@/components/CURD/usePage";
import contentConfig from "./config/content";
import editModalConfig from "./config/edit";
import searchConfig from "./config/search";
import { returnOptionsLabel } from "./config/config";
const router = useRouter();
const {
searchRef,
@@ -113,6 +115,26 @@ const {
handleSearchClick,
handleFilterChange,
} = usePage();
//统计数据
const gongjiData = reactive({ totalRow: 0 });
function getTongji(params: IObject | undefined) {
consApi.statistics(params).then((res) => {
Object.assign(gongjiData, res);
});
}
function newHandleQueryClick(e: IObject | undefined) {
const filterParams = contentRef.value?.getFilterParams();
contentRef.value?.fetchPageData({ ...e, ...filterParams }, true);
getTongji(e);
}
watch(
() => contentRef.value?.pagination.total,
(newval) => {
gongjiData.totalRow = newval as number;
}
);
//耗材盘点
const refAddHaocaiTakin = ref();
@@ -123,14 +145,15 @@ function refAddHaocaiTakinShow(item: any) {
function refresh() {
console.log("refresh");
contentRef.value?.fetchPageData();
getTongji(undefined);
}
const refAddHaocai = ref();
function refAddHaocaiOpen(item) {
function refAddHaocaiOpen(item: any) {
refAddHaocai.value.open(item);
}
// 新增
async function handleAddClick() {
refAddHaocaiOpen();
refAddHaocaiOpen(undefined);
}
// 编辑
async function handleEditClick(row: IObject) {
@@ -184,29 +207,9 @@ function returnStateType(status: string) {
}
}
const route = useRouter();
// 结账
function toPayOrder(order: getListResponse) {
route.push({
path: "/tool/index",
query: {
id: order.id,
},
});
}
//详情
const refDetail = ref();
function showdetail(row: OrderInfoVo) {
refDetail.value.show(row);
}
function toGoods(id: number) {
router.push({
path: "/product/index",
query: {
id,
},
});
}
onMounted(() => {
getTongji({});
});
</script>
<style scoped lang="scss">