fix: 重写耗材模块

This commit is contained in:
2025-03-07 18:53:31 +08:00
parent 73057865da
commit 739f4a1062
67 changed files with 3610 additions and 1563 deletions

View File

@@ -0,0 +1,186 @@
<template>
<div class="app-container">
<!-- 列表 -->
<!-- 搜索 -->
<page-search
ref="searchRef"
:search-config="searchConfig"
@query-click="handleQueryClick"
@reset-click="handleResetClick"
/>
<!-- 列表 -->
<page-content
ref="contentRef"
:content-config="contentConfig"
@add-click="handleAddClick"
@edit-click="handleEditClick"
@export-click="handleExportClick"
@search-click="handleSearchClick"
@toolbar-click="handleToolbarClick"
@operat-click="handleOperatClick"
@filter-change="handleFilterChange"
>
<template #status="scope">
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
</el-tag>
</template>
<template #goods="scope">
<div class="goods_info">
<div class="row" v-for="item in scope.row.productList" :key="item.id">
<el-image :src="item.productImg" class="cover" lazy></el-image>
<div class="info">
<div class="name">
<span :class="[item.isVip == 1 ? 'colorStyle' : '']">
{{ item.productName }}
</span>
<span class="refund" v-if="item.refundNumber">(退 - {{ item.refundNumber }})</span>
</div>
<div class="sku">{{ item.productSkuName }}</div>
</div>
</div>
</div>
</template>
<template #options="scope">
{{ returnOptionsLabel(scope.prop, scope.row[scope.prop]) }}
</template>
<template #state="scope">
<el-tag :type="returnStateType(scope.row[scope.prop])">
{{ returnOptionsLabel(scope.prop, scope.row[scope.prop]) }}
</el-tag>
</template>
<template #mobile="scope">
<el-text>{{ scope.row[scope.prop] }}</el-text>
<copy-button
v-if="scope.row[scope.prop]"
:text="scope.row[scope.prop]"
style="margin-left: 2px"
/>
</template>
<template #operate="scope">
<div>
<el-button @click="refAddHaocaiOpen(scope.row)" type="primary" link>编辑</el-button>
<el-button @click="refAddHaocaiTakinShow(scope.row)" link type="primary">
耗材盘点
</el-button>
</div>
</template>
</page-content>
<!-- 耗材添加编辑 -->
<add-haocai ref="refAddHaocai" @refresh="refresh"></add-haocai>
<!-- 耗材盘点 -->
<addConsTakin ref="refAddHaocaiTakin" @refresh="refresh"></addConsTakin>
</div>
</template>
<script setup lang="ts">
import addHaocai from "./components/add-haocai.vue";
import addConsTakin from "./components/addConsTakin.vue";
import orderApi, { type getListResponse, OrderInfoVo } from "@/api/order/order";
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,
contentRef,
editModalRef,
handleQueryClick,
handleResetClick,
handleSubmitClick,
handleExportClick,
handleSearchClick,
handleFilterChange,
} = usePage();
//耗材盘点
const refAddHaocaiTakin = ref();
function refAddHaocaiTakinShow(item: any) {
refAddHaocaiTakin.value.show(item);
}
function refresh() {
console.log("refresh");
contentRef.value?.fetchPageData();
}
const refAddHaocai = ref();
function refAddHaocaiOpen(item) {
refAddHaocai.value.open(item);
}
// 新增
async function handleAddClick() {
refAddHaocaiOpen();
}
// 编辑
async function handleEditClick(row: IObject) {
editModalRef.value?.handleDisabled(false);
editModalRef.value?.setModalVisible();
console.log({ ...row });
editModalRef.value?.setFormData({ ...row, url: [row.url] });
}
1;
// 其他工具栏
function handleToolbarClick(name: string) {
console.log(name);
if (name === "category") {
router.push({ path: "/inventory/classification" });
return;
}
if (name == "gongyinsahng") {
router.push({ path: "/inventory/supplier" });
return;
}
if (name == "ruku") {
router.push({ path: "/inventory/operation_in" });
return;
}
}
// 其他操作列
async function handleOperatClick(data: IOperatData) {
console.log(data);
if (data.name === "detail") {
return;
}
if (data.name === "printer") {
}
}
function returnStateType(status: string) {
if (status === "unpaid") {
return "warning";
}
if (status === "done") {
return "primary";
}
if (status === "cancelled") {
return "info";
}
if (status === "refund") {
return "danger";
}
}
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);
}
</script>
<style scoped lang="scss">
</style>