耗材列表盘点

This commit is contained in:
duan
2024-08-17 16:05:41 +08:00
parent ce546e09b2
commit 44e15448d9
6 changed files with 315 additions and 230 deletions

View File

@@ -29,6 +29,11 @@
<el-option :label="item.label" :value="item.value" v-for="item in typeEnums" :key="item.label" />
</el-select>
</div>
<div style="width: 300px;">
<el-select clearable v-model="query.sort" placeholder="排序">
<el-option label="按数量排序" value="balance,desc" />
</el-select>
</div>
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</div>
@@ -48,17 +53,13 @@
<div class="head-container" id="table_drag">
<el-table ref="table" :data="tableData.data" v-loading="tableData.loading" row-key="id">
<!-- <el-table-column prop="id" label="ID" width="50px" /> -->
<el-table-column label="耗材名称" prop="conName" />
<el-table-column label="耗材代码" prop="conCode" />
<el-table-column label="分类名称" prop="conTypeName" />
<el-table-column label="单位" prop="conUnit" />
<el-table-column label="创建时间" prop="createTime" width="200">
<template v-slot="scope">
{{ dayjs(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
</template>
</el-table-column>
<el-table-column label="耗材名称" prop="conName" align="center" />
<!-- <el-table-column label="耗材代码" prop="conCode" /> -->
<el-table-column label="分类名称" prop="conTypeName" align="center" />
<el-table-column label="单位" prop="conUnit" align="center" />
<el-table-column label="现有库存">
<el-table-column label="现有库存" align="center">
<template v-slot="scope">
<span :class="[computedClass(scope.row.balance)]"> {{ scope.row.balance }}</span>
</template>
@@ -80,30 +81,41 @@
<!-- <el-table-column label="正负号标识" prop="bizType" /> -->
<!-- <el-table-column label="耗材id" prop="consId" /> -->
<!-- <el-table-column label="创建时间" prop="createTime"></el-table-column> -->
<el-table-column label="所属商品" width="320" align="center">
<!-- <el-table-column label="所属商品" width="320" align="center">
<template v-slot="scope">
<!-- <el-button v-for="(item) in scope.row.product" @click="toGoods(item)" :key="item.productId" type="text">{{
item.productName }}</el-button> -->
<el-button v-for="(item) in scope.row.product" @click="toGoods(item)" :key="item.productId" type="text">{{
item.productName }}</el-button>
{{ scope.row.productId }}
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="所属商品" width="320" align="center">
<template v-slot="scope">
<el-button v-for="(item) in scope.row.product" @click="toGoods(item)" :key="item.productId" type="text">{{
item.productName }}</el-button>
</template>
</el-table-column>
<!-- <el-table-column label="最近入库量" prop="lasterInStock" /> -->
<el-table-column label="库存数量" prop="stockNumber">
<el-table-column label="库存数量" align="center" prop="stockNumber">
<template v-slot="scope">
{{ (scope.row.balance).toFixed(2) }}
<!-- {{ (scope.row.stockNumber - scope.row.stockConsume).toFixed(2) }} -->
</template>
</el-table-column>
<el-table-column label="预警值" prop="conWarning" />
<el-table-column label="预警值" align="center" prop="conWarning" />
<!-- <el-table-column label="单位耗材值" prop="surplusStock" /> -->
<!-- <el-table-column label="排序" prop="sort" sortable /> -->
<el-table-column label="更新时间" prop="updateTime" width="200">
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
<!-- <template v-slot="scope">
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
{{ dayjs(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
</template> -->
</el-table-column>
<!-- <el-table-column label="更新时间" prop="updateTime" width="200"> -->
<!-- <template v-slot="scope">
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
</template> -->
<!-- </el-table-column> -->
<el-table-column label="操作" width="250" fixed="right">
<template v-slot="scope">
<el-button type="text" @click="editorHandle(scope.row)">编辑</el-button>
@@ -528,6 +540,15 @@ export default {
this.$message({ type: "error", message: "至少保留一种耗材" });
}
},
toGoods(data) {
this.$router.push({
path: '/product/product',
query: {
productId: data.productId
}
})
},
//添加耗材弹窗增加
ruleFormsAdd() {
console.log('add')
@@ -612,9 +633,24 @@ export default {
shopId: localStorage.getItem("shopId")
});
this.tableData.loading = false;
this.tableData.data = res.content;
// this.tableData.data = res.content;
this.tableData.total = res.totalElements;
this.tableData.data = res.content.map(v => {
const productIds = v.productId ? v.productId.split(',') : []
return {
...v,
product: productIds.map((str, index) => {
const startIndex = str.indexOf('_')
const productId = str.slice(0, startIndex)
const productName = str.slice(startIndex + 1, str.length)
return {
productId,
productName: productName + `${(index == productIds.length - 1) ? '' : ','}`
}
})
}
});
} catch (error) {
console.log(error);
}