feat: 进销存更新

This commit is contained in:
wwz 2025-04-08 17:41:30 +08:00
parent 6fb991ff32
commit 86f68a5cdf
7 changed files with 96 additions and 75 deletions

View File

@ -11,41 +11,41 @@ const Api = {
params, params,
}); });
}, },
/** 全部*/ // /** 全部*/
getAllList(params: any) { // getAllList(params: any) {
return request<any>({ // return request<any>({
url: `${baseURL}/list`, // url: `${baseURL}/list`,
method: "get", // method: "get",
params, // params,
}); // });
}, // },
get(id: string | number) { // get(id: string | number) {
return request<any>({ // return request<any>({
url: `${baseURL}/` + id, // url: `${baseURL}/` + id,
method: "get", // method: "get",
}); // });
}, // },
add(data: any) { // add(data: any) {
return request<any>({ // return request<any>({
url: `${baseURL}`, // url: `${baseURL}`,
method: "post", // method: "post",
data, // data,
}); // });
}, // },
edit(data: any) { // edit(data: any) {
return request<any>({ // return request<any>({
url: `${baseURL}`, // url: `${baseURL}`,
method: "put", // method: "put",
data, // data,
}); // });
}, // },
delete(id: string | number) { // delete(id: string | number) {
return request<any>({ // return request<any>({
url: `${baseURL}/` + id, // url: `${baseURL}/` + id,
method: "delete", // method: "delete",
}); // });
}, // },
}; };
export default Api; export default Api;

View File

@ -168,7 +168,7 @@ const refAddHaocaiTakin = ref();
function refAddHaocaiTakinShow(item: any, type: string) { function refAddHaocaiTakinShow(item: any, type: string) {
console.log(item); console.log(item);
if (type === "manual-in") { if (type === "manual-in") {
router.push({ path: "/inventory/libraryrecords", query: { type: type, conId: item.id } }); router.push({ path: "/inventory/libraryrecords", query: { inOutType: type, conId: item.id } });
return; return;
} }
if (type === "delete") { if (type === "delete") {
@ -222,7 +222,7 @@ function handleToolbarClick(name: string) {
return; return;
} }
if (name == "damage-out" || name == "manual-out" || name == "manual-in") { if (name == "damage-out" || name == "manual-out" || name == "manual-in") {
router.push({ path: "/inventory/libraryrecords", query: { type: name } }); router.push({ path: "/inventory/libraryrecords", query: { inOutType: name } });
return; return;
} }
} }

View File

@ -1,6 +1,5 @@
import Api from "@/api/product/libraryrecords"; import Api from "@/api/product/libraryrecords";
import type { IContentConfig } from "@/components/CURD/types"; import type { IContentConfig } from "@/components/CURD/types";
import { log } from "console";
const contentConfig: IContentConfig = { const contentConfig: IContentConfig = {
pageName: "sys:user", pageName: "sys:user",
@ -15,7 +14,6 @@ const contentConfig: IContentConfig = {
pageSizes: [10, 20, 30, 50], pageSizes: [10, 20, 30, 50],
}, },
indexAction: function (params) { indexAction: function (params) {
console.log("params", params);
return Api.getList(params); return Api.getList(params);
}, },
deleteAction: function (id) { deleteAction: function (id) {
@ -56,6 +54,23 @@ const contentConfig: IContentConfig = {
align: "center", align: "center",
prop: "unitName", prop: "unitName",
}, },
{
label: "所属商品",
align: "center",
prop: "unitName",
},
{
label: "供应商",
align: "center",
prop: "unitName",
},
{
label: "变动原因",
align: "center",
prop: "inOutItem",
template: "custom",
slotName: "inOutItem",
},
{ {
label: "变动前的库存", label: "变动前的库存",
align: "center", align: "center",

View File

@ -36,7 +36,6 @@ const searchConfig: ISearchConfig = {
width: "200px", width: "200px",
}, },
}, },
initialValue: "",
options: [ options: [
{ {
label: "入库记录", label: "入库记录",
@ -51,6 +50,7 @@ const searchConfig: ISearchConfig = {
value: "damage-out", value: "damage-out",
}, },
], ],
initialValue: "",
}, },
], ],
}; };

View File

@ -19,6 +19,14 @@
@operat-click="handleOperatClick" @operat-click="handleOperatClick"
@filter-change="handleFilterChange" @filter-change="handleFilterChange"
> >
<template #inOutItem="scope">
<text v-if="scope.row.inOutItem == 'manual-in'">手动入库</text>
<text v-if="scope.row.inOutItem == 'manual-out'">手动出库</text>
<text v-if="scope.row.inOutItem == 'win-in'">盘盈入库</text>
<text v-if="scope.row.inOutItem == 'loss-out'">盘亏出库</text>
<text v-if="scope.row.inOutItem == 'order-in'">订单退款入库</text>
<text v-if="scope.row.inOutItem == 'order-out'">订单消费出库</text>
</template>
<template #status="scope"> <template #status="scope">
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'"> <el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }} {{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
@ -77,17 +85,15 @@ const {
handleFilterChange, handleFilterChange,
} = usePage(); } = usePage();
//
const route = useRoute(); const route = useRoute();
const Query = route.query || ""; const { inOutType, conId } = route.query;
if (inOutType || conId) {
onMounted(() => { contentConfig.indexActionData = { inOutType, conId };
if (Query.type) { if (inOutType) {
searchRef.value?.setQueryValue("inOutType", Query.type); searchConfig.formItems[1].initialValue = inOutType;
} }
if (Query.conId) { }
searchRef.value?.setQueryValue("conId", Query.conId);
}
});
// //
async function handleAddClick() { async function handleAddClick() {
@ -102,7 +108,6 @@ async function handleEditClick(row: IObject) {
console.log(row); console.log(row);
editModalRef.value?.setFormData({ ...row }); editModalRef.value?.setFormData({ ...row });
} }
1;
// //
function handleToolbarClick(name: string) { function handleToolbarClick(name: string) {
console.log(name); console.log(name);

View File

@ -1,16 +1,12 @@
<!-- 耗材列表 --> <!-- 耗材列表 -->
<template> <template>
<el-dialog title="选择耗材" v-model="dialogVisible"> <el-dialog v-model="dialogVisible" title="选择耗材">
<el-form :model="searchForm" inline> <el-form :model="searchForm" inline>
<el-form-item> <el-form-item>
<el-input <el-input v-model="searchForm.conTypeName" placeholder="耗材类型名称" @input="onInput" />
v-model="searchForm.conTypeName"
placeholder="耗材类型名称"
@input="onInput"
></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-input v-model="searchForm.conName" placeholder="耗材名称" @input="onInput"></el-input> <el-input v-model="searchForm.conName" placeholder="耗材名称" @input="onInput" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button> <el-button type="primary" @click="getTableData">查询</el-button>
@ -20,19 +16,20 @@
<div class="head-container"> <div class="head-container">
<el-table <el-table
ref="table" ref="table"
:data="tableData.list"
v-loading="tableData.loading" v-loading="tableData.loading"
@select="firstSelectChange" :data="tableData.list"
:row-key="getRowKey" :row-key="getRowKey"
@select="firstSelectChange"
@selection-change="onSelectionChange" @selection-change="onSelectionChange"
> >
<el-table-column type="selection" width="55" align="center"></el-table-column> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="耗材名称" prop="conName"></el-table-column> <el-table-column label="耗材名称" prop="conName" />
<el-table-column label="价格" prop="price"></el-table-column> <el-table-column label="所属分类" prop="consGroupName" />
<el-table-column label="耗材代码" prop="conCode"></el-table-column> <el-table-column label="价格" prop="price" />
<el-table-column label="耗材类型名称" prop="conTypeName"></el-table-column> <el-table-column label="耗材代码" prop="conCode" />
<el-table-column label="单位" prop="conUnit"></el-table-column> <el-table-column label="耗材类型名称" prop="conTypeName" />
<el-table-column label="最近入库量" prop="lasterInStock"></el-table-column> <el-table-column label="单位" prop="conUnit" />
<el-table-column label="最近入库量" prop="lasterInStock" />
<el-table-column label="库存数量" prop="stockNumber"> <el-table-column label="库存数量" prop="stockNumber">
<template v-slot="scope"> <template v-slot="scope">
{{ formatDecimal(scope.row.stockNumber, 2, true) }} {{ formatDecimal(scope.row.stockNumber, 2, true) }}
@ -49,10 +46,10 @@
:total="tableData.total" :total="tableData.total"
:current-page="tableData.page + 1" :current-page="tableData.page + 1"
:page-size="tableData.size" :page-size="tableData.size"
layout="total, sizes, prev, pager, next, jumper"
@current-change="paginationChange" @current-change="paginationChange"
@size-change="sizeChange" @size-change="sizeChange"
layout="total, sizes, prev, pager, next, jumper" />
></el-pagination>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
@ -204,4 +201,4 @@ export default {
margin-left: 10px; margin-left: 10px;
} }
} }
</style> </style>

View File

@ -11,8 +11,8 @@
<el-row> <el-row>
<el-form-item label="类型"> <el-form-item label="类型">
<el-radio-group :model-value="type" @change="tabChange"> <el-radio-group :model-value="type" @change="tabChange">
<el-radio-button value="in">入库</el-radio-button> <el-radio value="in">入库</el-radio>
<el-radio-button value="out">出库</el-radio-button> <el-radio value="out">出库</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-row> </el-row>
@ -45,6 +45,7 @@
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="选择日期" placeholder="选择日期"
style="width: 220px" style="width: 220px"
disabled="false"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -110,11 +111,9 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="head-container"> <div style="font-weight: bold; font-size: 16px; color: #666">
<el-button type="primary" plain> {{ tableData.list.length }}种耗材金额合计
{{ tableData.list.length }}种耗材金额合计 <span style="color: red">{{ amountPayable }}</span>
<span style="color: red">{{ amountPayable }}</span>
</el-button>
</div> </div>
<div class="head-container"> <div class="head-container">
<el-table :data="tableData.list"> <el-table :data="tableData.list">
@ -123,6 +122,11 @@
{{ scope.row.conName }} {{ scope.row.conName }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="所属分类">
<template v-slot="scope">
{{ scope.row.consGroupName }}
</template>
</el-table-column>
<el-table-column label="进价"> <el-table-column label="进价">
<template v-slot="scope"> <template v-slot="scope">
<el-input-number v-model="scope.row.price" :min="0" controls-position="right" /> <el-input-number v-model="scope.row.price" :min="0" controls-position="right" />