出入库记录

This commit is contained in:
weiwei committed 2025-02-20 08:57:27 +08:00
1 parent 1e848b86fb
commit 0ddf792e63
9 files changed
+992 -455

No files matched your search

@@ -60,12 +60,7 @@
</div>
</el-row>
<el-form-item label="" prop="supermarketUnitEntityList">
<el-table
:data="supermarketUnitEntityList"
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
>
<el-table :data="supermarketUnitEntityList" border :cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle">
<!-- <el-table-column type="selection" width="40" align="center" fixed /> -->
<el-table-column type="index" label="#" width="50" />
<el-table-column prop="barCode" label="条码" show-overflow-tooltip />
@@ -120,9 +115,6 @@
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
const supermarketUnitEntityList = defineModel<any>("supermarketUnitEntityList", { default: [] })
const props = defineProps<{
defaultSpuUnit: any
}>()
const formDialogRef = ref()
// 搜索变量
@@ -150,36 +142,36 @@ const tableStyle = {
}
// 根据基础信息的部分填写项自动生成一条默认包装单位
watch(
() => props.defaultSpuUnit,
(newValue, oldValue) => {
console.log(newValue, oldValue)
// watch(
// () => props.defaultSpuUnit,
// (newValue, oldValue) => {
// console.log(newValue, oldValue)
const defaultSpuUnitIndex = supermarketUnitEntityList.value.findIndex((item: any) => {
return (
item.barCode == oldValue.barCode &&
item.unit == oldValue.unit &&
item.packageNum == oldValue.packageNum &&
item.retailPrice == oldValue.retailPrice &&
item.purchasePrice == oldValue.purchasePrice &&
item.promotionPrice == oldValue.promotionPrice &&
item.costPrice == oldValue.costPrice
)
})
console.log(defaultSpuUnitIndex)
// const defaultSpuUnitIndex = supermarketUnitEntityList.value.findIndex((item: any) => {
// return (
// item.barCode == oldValue.barCode &&
// item.unit == oldValue.unit &&
// item.packageNum == oldValue.packageNum &&
// item.retailPrice == oldValue.retailPrice &&
// item.purchasePrice == oldValue.purchasePrice &&
// item.promotionPrice == oldValue.promotionPrice &&
// item.costPrice == oldValue.costPrice
// )
// })
// console.log(defaultSpuUnitIndex)
if (defaultSpuUnitIndex !== -1) {
supermarketUnitEntityList.value[defaultSpuUnitIndex] = newValue
} else {
supermarketUnitEntityList.value.push(newValue)
}
console.log(supermarketUnitEntityList.value)
},
{
deep: true,
immediate: true,
},
)
// if (defaultSpuUnitIndex !== -1) {
// supermarketUnitEntityList.value[defaultSpuUnitIndex] = newValue
// } else {
// supermarketUnitEntityList.value.push(newValue)
// }
// console.log(supermarketUnitEntityList.value)
// },
// {
// deep: true,
// immediate: true,
// },
// )
const getDataList = (formData: any) => {
console.log(formData)
@@ -27,12 +27,7 @@
<el-col :span="12" class="mb20">
<el-form-item label="货商" prop="supplierId">
<el-select v-model="form.supplierId" placeholder="请选择货商">
<el-option
v-for="item in supplierOptions"
:key="item?.id"
:label="item?.typeName"
:value="item?.id"
/>
<el-option v-for="item in supplierOptions" :key="item?.id" :label="item?.typeName" :value="item?.id" />
</el-select>
</el-form-item>
</el-col>
@@ -53,12 +48,7 @@
<el-col :span="12" class="mb20">
<el-form-item label="商品性质" prop="productNature">
<el-select v-model="form.productNature" placeholder="请选择商品性质">
<el-option
:value="item.value"
:label="item.label"
v-for="(item, index) in supermarket_nature"
:key="index"
></el-option>
<el-option :value="item.value" :label="item.label" v-for="(item, index) in supermarket_nature" :key="index"></el-option>
</el-select>
</el-form-item>
</el-col>
@@ -118,9 +108,7 @@
<el-col :span="24" class="mb20">
<el-form-item label="商品状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio :label="item.value" v-for="(item, index) in status" border :key="index"
>{{ item.label }}
</el-radio>
<el-radio :label="item.value" v-for="(item, index) in status" border :key="index">{{ item.label }} </el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@@ -157,10 +145,7 @@
</el-row>
</el-tab-pane>
<el-tab-pane label="包装单位" name="包装单位" style="overflow-y: auto; height: 60vh">
<supermarketUnit
v-model:supermarketUnitEntityList="form.smErpUnitEntityList"
:defaultSpuUnit="defaultSpuUnit"
/>
<supermarketUnit v-model:supermarketUnitEntityList="form.smErpUnitEntityList" />
</el-tab-pane>
<el-tab-pane label="辅助条码" name="辅助条码" style="overflow-y: auto; height: 60vh">
<supermarketAuxiliaryCode v-model:supermarketAuxiliaryCodeEntityList="form.smErpAuxiliaryCodeEntityList" />
@@ -173,9 +158,7 @@
<el-button @click="visible = false">取消</el-button>
<el-button v-if="currentTabPaneIndex != 0" type="primary" @click="currentTabPaneIndex--">上一步</el-button>
<el-button v-if="currentTabPaneIndex != 2" type="primary" @click="currentTabPaneIndex++">下一步</el-button>
<el-button v-if="currentTabPaneIndex == 2" type="primary" @click="onSubmit" :disabled="loading">
确 认
</el-button>
<el-button v-if="currentTabPaneIndex == 2" type="primary" @click="onSubmit" :disabled="loading"> 确 认 </el-button>
</span>
</template>
</el-dialog>
@@ -184,13 +167,7 @@
<script setup lang="ts">
import { useDict } from "/@/hooks/dict"
import { useMessage } from "/@/hooks/message"
import {
getObj,
addObj,
putObj,
getSupermarketCategory,
getSupermarketBrand,
} from "/@/api/supermarketerp/supermarketSpu"
import { getObj, addObj, putObj, getSupermarketCategory, getSupermarketBrand } from "/@/api/supermarketerp/supermarketSpu"
import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
import { rule } from "/@/utils/validate"
import supermarketAuxiliaryCode from "./components/supermarketAuxiliaryCode/index.vue"
@@ -272,18 +249,18 @@ const categoryOptions = ref<any>([]) // 商品分类的下拉选项
const brandOptions = ref<any>([]) // 超市品牌的下拉选项
const supplierOptions = ref<any>([]) // 货商的下拉选项
// 默认包装单位
const defaultSpuUnit = computed(() => ({
flag: "default",
barCode: form.barcode,
unit: form.unit,
packageNum: form.packageNum,
retailPrice: form.retailPrice,
purchasePrice: form.purchasePrice,
promotionPrice: form.promotionPrice,
costPrice: form.costPrice,
spec: form.spec,
status: "0",
}))
// const defaultSpuUnit = computed(() => ({
// flag: "default",
// barCode: form.barcode,
// unit: form.unit,
// packageNum: form.packageNum,
// retailPrice: form.retailPrice,
// purchasePrice: form.purchasePrice,
// promotionPrice: form.promotionPrice,
// costPrice: form.costPrice,
// spec: form.spec,
// status: "0",
// }))
// 打开弹窗
const openDialog = async (id: string) => {
@@ -345,8 +322,7 @@ const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => {})
if (!valid) useMessage().warning("基础信息必填项未填写完整")
if (!form.smErpUnitEntityList || form.smErpUnitEntityList.length <= 0) useMessage().warning("请添加包装单位")
if (!form.smErpAuxiliaryCodeEntityList || form.smErpAuxiliaryCodeEntityList.length <= 0)
useMessage().warning("请添加辅助条码")
if (!form.smErpAuxiliaryCodeEntityList || form.smErpAuxiliaryCodeEntityList.length <= 0) useMessage().warning("请添加辅助条码")
if (!valid) return false
try {