feat: 耗材报损

This commit is contained in:
wwz
2025-04-15 10:41:12 +08:00
parent c093c618b2
commit 0d495c20ef
5 changed files with 120 additions and 85 deletions

View File

@@ -8,7 +8,7 @@ const Api = {
return request<any>({ return request<any>({
url: `${baseURL}/in`, url: `${baseURL}/in`,
method: "post", method: "post",
data data,
}); });
}, },
//出库 //出库
@@ -16,7 +16,7 @@ const Api = {
return request<any>({ return request<any>({
url: `${baseURL}/out`, url: `${baseURL}/out`,
method: "post", method: "post",
data data,
}); });
}, },
// 库存盘点记录 // 库存盘点记录
@@ -24,7 +24,7 @@ const Api = {
return request<any>({ return request<any>({
url: `${baseURL}/checkRecord`, url: `${baseURL}/checkRecord`,
method: "get", method: "get",
params params,
}); });
}, },
//库存盘点 //库存盘点
@@ -32,7 +32,7 @@ const Api = {
return request<any>({ return request<any>({
url: `${baseURL}/check`, url: `${baseURL}/check`,
method: "post", method: "post",
data data,
}); });
}, },
//耗材报损 //耗材报损
@@ -41,7 +41,7 @@ const Api = {
return request<any>({ return request<any>({
url: `${baseURL}/reportDamage`, url: `${baseURL}/reportDamage`,
method: "post", method: "post",
data data,
}); });
}, },
//耗材库存变动记录 //耗材库存变动记录
@@ -49,11 +49,17 @@ const Api = {
return request<any>({ return request<any>({
url: `${baseURL}/flow`, url: `${baseURL}/flow`,
method: "get", method: "get",
params params,
});
},
//耗材库存变动记录
reportinglosses(data: any) {
return request<any>({
url: `${baseURL}/reportDamage`,
method: "POST",
data,
}); });
}, },
}; };
export default Api; export default Api;

View File

@@ -77,11 +77,11 @@ const contentConfig: IContentConfig = {
name: "damage-out", name: "damage-out",
auth: "", auth: "",
}, },
// { {
// text: "报损", text: "报损",
// name: "reportinglosses", name: "reportinglosses",
// auth: "", auth: "",
// }, },
], ],
defaultToolbar: ["refresh", "filter", "search"], defaultToolbar: ["refresh", "filter", "search"],
cols: [ cols: [

View File

@@ -64,7 +64,9 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
"> ">
<el-button type="primary" link @click="refAddHaocaiOpen(scope.row)" v-if="!isSyncStatus()">编辑</el-button> <el-button v-if="!isSyncStatus()" type="primary" link @click="refAddHaocaiOpen(scope.row)">
编辑
</el-button>
<el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, 'consumables')"> <el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, 'consumables')">
耗材盘点 耗材盘点
</el-button> </el-button>
@@ -127,14 +129,13 @@ if (conName) {
} }
if (isSyncStatus()) { if (isSyncStatus()) {
contentConfig.toolbar[0].hidden = true contentConfig.toolbar[0].hidden = true;
contentConfig.toolbar[1].hidden = false contentConfig.toolbar[1].hidden = false;
} else { } else {
contentConfig.toolbar[0].hidden = false contentConfig.toolbar[0].hidden = false;
contentConfig.toolbar[1].hidden = true contentConfig.toolbar[1].hidden = true;
} }
//统计数据 //统计数据
const gongjiData = reactive({ totalRow: 0 }); const gongjiData = reactive({ totalRow: 0 });
function getTongji(params: IObject | undefined) { function getTongji(params: IObject | undefined) {
@@ -204,9 +205,9 @@ async function handleEditClick(row: IObject) {
// 其他工具栏 // 其他工具栏
async function handleToolbarClick(name: string) { async function handleToolbarClick(name: string) {
console.log(name); console.log(name);
if (name === 'sync') { if (name === "sync") {
let res = await UserAPI.sync() let res = await UserAPI.sync();
ElMessage.success('操作成功,数据正在后台同步中...') ElMessage.success("操作成功,数据正在后台同步中...");
return; return;
} }
if (name === "category") { if (name === "category") {
@@ -225,6 +226,10 @@ async function handleToolbarClick(name: string) {
router.push({ path: "/inventory/operation_in", query: { type: "out" } }); router.push({ path: "/inventory/operation_in", query: { type: "out" } });
return; return;
} }
if (name == "reportinglosses") {
router.push({ path: "/inventory/operation_in", query: { type: "reportinglosses" } });
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: { inOutItem: name } }); router.push({ path: "/inventory/libraryrecords", query: { inOutItem: name } });
return; return;

View File

@@ -5,60 +5,65 @@
<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 value="in">入库</el-radio> <el-radio v-if="type == 'reportinglosses'" value="reportinglosses">报损</el-radio>
<el-radio value="out">出库</el-radio> <div v-else>
<el-radio value="in">入库</el-radio>
<el-radio value="out">出库</el-radio>
</div>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row> <div v-if="type != 'reportinglosses'">
<el-col v-if="type == 'in'" :span="8"> <el-row>
<el-form-item label="供应商"> <el-col v-if="type == 'in'" :span="8">
<el-select v-model="queryForm.vendorId" placeholder="请选择供应商" clearable style="width: 220px" <el-form-item label="供应商">
@change="changeTypeEnum"> <el-select v-model="queryForm.vendorId" placeholder="请选择供应商" clearable style="width: 220px"
<el-option v-for="item in purveyorList" :key="item.id" :label="item.name" :value="item.id" /> @change="changeTypeEnum">
</el-select> <el-option v-for="item in purveyorList" :key="item.id" :label="item.name" :value="item.id" />
{{ queryForm.waitAmount }} </el-select>
</el-form-item> {{ queryForm.waitAmount }}
</el-col> </el-form-item>
<el-col :span="8"> </el-col>
<el-form-item label="出入库时间" prop="inOutDate"> <el-col :span="8">
<el-date-picker v-model="queryForm.inOutDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" <el-form-item label="出入库时间" prop="inOutDate">
placeholder="选择日期" style="width: 220px" disabled="false" /> <el-date-picker v-model="queryForm.inOutDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
</el-form-item> placeholder="选择日期" style="width: 220px" disabled="false" />
</el-col> </el-form-item>
</el-row> </el-col>
<el-row> </el-row>
<el-col :span="8"> <el-row>
<el-form-item label="应付金额"> <el-col :span="8">
<el-input v-model="queryForm.amountPayable" placeholder="请输入应收金额" style="width: 220px" /> <el-form-item label="应付金额">
</el-form-item> <el-input v-model="queryForm.amountPayable" placeholder="请输入应收金额" style="width: 220px" />
</el-col> </el-form-item>
<el-col :span="8"> </el-col>
<el-form-item label="实付金额"> <el-col :span="8">
<el-input v-model="queryForm.actualPaymentAmount" placeholder="请输入实收金额" style="width: 220px" /> <el-form-item label="实付金额">
</el-form-item> <el-input v-model="queryForm.actualPaymentAmount" placeholder="请输入实收金额" style="width: 220px" />
</el-col> </el-form-item>
</el-row> </el-col>
<el-row> </el-row>
<el-col :span="8"> <el-row>
<el-form-item label="付款时间"> <el-col :span="8">
<el-date-picker v-model="queryForm.paymentDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" <el-form-item label="付款时间">
placeholder="选择日期" style="width: 220px" /> <el-date-picker v-model="queryForm.paymentDate" type="date" format="YYYY-MM-DD"
</el-form-item> value-format="YYYY-MM-DD" placeholder="选择日期" style="width: 220px" />
</el-col> </el-form-item>
<!-- <el-col :span="8"> </el-col>
<!-- <el-col :span="8">
<el-form-item label="批号"> <el-form-item label="批号">
<el-input v-model="queryForm.batchNo" placeholder="请输入批号" style="width: 220px" /> <el-input v-model="queryForm.batchNo" placeholder="请输入批号" style="width: 220px" />
</el-form-item> </el-form-item>
</el-col> --> </el-col> -->
</el-row> </el-row>
<el-row> <!-- <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="备注"> <el-form-item label="备注">
<el-input v-model="queryForm.remark" placeholder="请输入备注" style="width: 220px" /> <el-input v-model="queryForm.remark" placeholder="请输入备注" style="width: 220px" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row> -->
</div>
<el-form-item label="选择耗材"> <el-form-item label="选择耗材">
<div /> <div />
<el-button type="primary" @click="showHaocai">选择耗材</el-button> <el-button type="primary" @click="showHaocai">选择耗材</el-button>
@@ -84,7 +89,7 @@
{{ scope.row.consGroupName }} {{ scope.row.consGroupName }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="进价"> <el-table-column>
<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" />
<div class="tips" style="font-size: 16px"> <div class="tips" style="font-size: 16px">
@@ -117,16 +122,27 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="小计"> <!-- <el-table-column v-if="type == 'reportinglosses'" label="报损数量">
<template v-slot="scope"> <template v-slot="scope">
<el-input :value="xiaoji(scope.row)" readonly style="width: 100px" /> {{ scope.row.number }}
<div class="tips" style="font-size: 16px">
入库前
{{ returnStockNumber(scope.row, scope.row.number) }}
{{ scope.row.unit }}
</div>
</template>
</el-table-column> -->
<el-table-column v-if="type == 'reportinglosses'" label="上传图片">
<template v-slot="scope">
<MultiImageUpload v-model="scope.row.imgUrls" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注"> <!-- <el-table-column label="备注">
<template v-slot="scope"> <template v-slot="scope">
<el-input v-model="textarea" stype="textarea" placeholder="" /> <el-input v-model="textarea" stype="textarea" placeholder="" />
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column label="操作" width="80"> <el-table-column label="操作" width="80">
<template v-slot="scope"> <template v-slot="scope">
<el-button link @click="tableData.list.splice(scope.$index, 1)">删除</el-button> <el-button link @click="tableData.list.splice(scope.$index, 1)">删除</el-button>
@@ -164,6 +180,8 @@ import vendorApi from "@/api/product/vendor";
import stockApi from "@/api/product/stock"; import stockApi from "@/api/product/stock";
import dayjs from "dayjs"; import dayjs from "dayjs";
import goodsList from "./components/goods-list.vue"; import goodsList from "./components/goods-list.vue";
import MultiImageUpload from "@/components/Upload/MultiImageUpload.vue";
import ConsumableList from "./components/consumableList.vue"; import ConsumableList from "./components/consumableList.vue";
import { formatDecimal } from "@/utils/tools.js"; import { formatDecimal } from "@/utils/tools.js";
export default { export default {
@@ -371,21 +389,26 @@ export default {
unitName: v.conUnit, unitName: v.conUnit,
inOutNumber, inOutNumber,
subTotal: this.xiaoji(v), subTotal: this.xiaoji(v),
imgUrls: v.imgUrls,
number: v.number,
}; };
}); });
if (this.type == "in") { if (this.type == "in") {
await stockApi.in({ ...this.queryForm, bodyList }); await stockApi.in({ ...this.queryForm, bodyList });
} else { } else if (this.type == "out") {
await stockApi.out({ ...this.queryForm, bodyList }); await stockApi.out({ ...this.queryForm, bodyList });
} else if (this.type == "reportinglosses") {
await stockApi.reportinglosses(bodyList);
} }
this.queryFormLoading = false; this.queryFormLoading = false;
const title = this.type == "in" ? "入库" : "出库"; // const title = this.type == "in" ? "入库" : "出库";
ElMessage({ ElMessage({
message: title + "提交成功", // message: title + "提交成功",
message: "提交成功",
type: "success", type: "success",
}); });
this.$router.push("/inventory/consumables"); this.$router.push("/inventory/consumables");
// this.showResult = true this.showResult = true;
// this.$refs.shopList.reset()//清除选项 // this.$refs.shopList.reset()//清除选项
// this.$refs.ConsumableList.reset()//清除选项 // this.$refs.ConsumableList.reset()//清除选项
} catch (error) { } catch (error) {
@@ -406,6 +429,7 @@ export default {
item.unit = item.defaultUnit || item.conUnit; item.unit = item.defaultUnit || item.conUnit;
item.originPrice = item.price; item.originPrice = item.price;
item.price = this.returnPrice(item, item.price); item.price = this.returnPrice(item, item.price);
item.imgUrls = item.imgUrls ? item.imgUrls : [];
return item; return item;
}); });
this.tableData.list = [...this.tableData.list, ...arr]; this.tableData.list = [...this.tableData.list, ...arr];

View File

@@ -19,7 +19,7 @@
<span v-if="scope.row.type == 2">耗材新增</span> <span v-if="scope.row.type == 2">耗材新增</span>
<span v-if="scope.row.type == 3">耗材编辑</span> --> <span v-if="scope.row.type == 3">耗材编辑</span> -->
<div v-for="(item, index) in matchedProducts(scope.row.content)" :key="index"> <div v-for="(item, index) in matchedProducts(scope.row.content)" :key="index">
<span v-for="i in item.map" :key="i.id" style="color: #6161f7" @click="handleContentClick(scope, i)"> <span v-for="i in item.map" :key="i.id" style="color: #6161f7" @click="handleContentClick(item, i)">
{{ i.name }}, {{ i.name }},
</span> </span>
</div> </div>
@@ -38,7 +38,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
"> ">
<div v-if="scope.row.isRead == 1"> <div v-if="scope.row.isRead != 1">
<el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, '')"> <el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, '')">
设为已读 设为已读
</el-button> </el-button>
@@ -98,14 +98,14 @@ async function handleEditClick(row: IObject) {
editModalRef.value?.setFormData({ ...row }); editModalRef.value?.setFormData({ ...row });
} }
// 其他工具栏 // 其他工具栏
function handleToolbarClick(name: string) { async function handleToolbarClick(name: string) {
if (name === "mark_all_read") { if (name === "mark_all_read") {
Api.edit({ await Api.edit({
noticeIdList: [], noticeIdList: [],
}); });
} }
if (name == "Clear_Read") { if (name == "Clear_Read") {
Api.syncNoticeclear(); await Api.syncNoticeclear();
} }
contentRef.value?.fetchPageData(); contentRef.value?.fetchPageData();
} }
@@ -132,13 +132,13 @@ async function handleOperatClick(data: IOperatData) {
} }
// Handle content click // Handle content click
function handleContentClick(scope: any, item: any) { function handleContentClick(scope: any, item: any) {
if (scope.type == "spec" || scope.type == "product") { if (scope.type == "product") {
router.push({ router.push({
path: "/product/addgoods", path: "/product/addgoods",
query: { goods_id: item.id }, query: { goods_id: item.id },
}); });
} }
if (scope.type == "consInfo" || scope.type == "consGroup") { if (scope.type == "consInfo") {
router.push({ router.push({
path: "/inventory/consumables", path: "/inventory/consumables",
query: { conName: item.name }, query: { conName: item.name },