This commit is contained in:
dzc committed 2025-04-11 15:26:07 +08:00
commit fa45796edd
2 files changed
+41 -40

No files matched your search

@@ -21,10 +21,7 @@
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
@selection-change="selectionChangHandle"
@sort-change="sortChangeHandle"
>
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="80" />
<el-table-column prop="name" width="120" label="商品名" />
<el-table-column prop="pic" width="120" label="商品图片">
@@ -76,15 +73,14 @@
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template #default="{ row }">
<el-button text type="primary" @click="confirmPutaway">点击上架</el-button>
<el-button text type="primary" @click="confirmPutaway(row)">点击上架</el-button>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
<template #footer>
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="onConfirm" :disabled="loading">确认上架</el-button>
<el-button @click="visible = false">关闭</el-button>
</template>
</el-dialog>
</template>
@@ -96,45 +92,45 @@ import { useDict } from "/@/hooks/dict"
import { displayPrice } from "/@/utils/formatMoney"
import { useMessage } from "/@/hooks/message"
const emit = defineEmits(["refreshDoor"])
const { yes_no_type, hard_ks_sku_type } = useDict("yes_no_type", "hard_ks_sku_type")
const queryRef = ref()
const selectObjs = ref([]) as any
const multiple = ref(false)
const visible = ref(false)
const loading = ref(false)
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {},
pageList: hardSpu.pageJoin,
})
const curPos = reactive<{
hardId: string
floorIndex: number | undefined
posIndex: number | undefined
}>({ hardId: "", floorIndex: undefined, posIndex: undefined })
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, tableStyle } = useTable(state)
// 多选事件
const selectionChangHandle = (objs: { id: string }[]) => {
selectObjs.value = objs.map(({ id }) => id)
multiple.value = !objs.length
}
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state)
const resetQuery = () => {
// 清空搜索条件
queryRef.value?.resetFields()
// 清空多选
selectObjs.value = []
getDataList()
}
const openDialog = async (id: string) => {
if (!id) return useMessage().error("设备id不存在")
visible.value = true
const openDialog = (hardId: string, floorIndex: number, posIndex: number) => {
if (!hardId) return useMessage().error("设备id不存在")
resetQuery()
curPos.hardId = hardId
curPos.floorIndex = floorIndex
curPos.posIndex = posIndex
visible.value = true
}
// 确认上架
const confirmPutaway = async () => {}
// 确认选择
const onConfirm = async () => {}
const confirmPutaway = (row: any) => {
emit("refreshDoor", row, curPos)
visible.value = false
}
defineExpose({
openDialog,
+19 -14
View File
@@ -52,18 +52,19 @@
<el-tabs type="border-card">
<el-tab-pane label="114514-1">
<div v-for="(item, index) in new Array(6).fill('某层')" :key="index">
<div v-for="(floorItem, floorIndex) in state.doorGoods" :key="floorIndex">
<el-divider />
<div class="text-black flex items-center">
<div class="text-center w-24 text-lg font-bold">第 {{ index + 1 }} 层:</div>
<div class="text-center w-24 text-lg font-bold">第 {{ floorIndex + 1 }} 层:</div>
<div class="flex flex-wrap">
<div
class="bg-blue-50 w-20 h-20 border border-black mx-4 my-2 flex items-center justify-center cursor-pointer rounded"
v-for="(item, index) in new Array(10).fill('某品')"
:key="index"
@click="clickPutaway"
>
点击上架
<div class="flex flex-col items-center justify-start" v-for="(item, posIndex) in floorItem" :key="posIndex">
<div
class="bg-blue-50 w-20 h-20 border border-black mx-4 my-1 flex items-center justify-center cursor-pointer rounded-lg"
@click="clickPutaway(floorIndex, posIndex)"
>
<span>点击上架</span>
</div>
<div class="h-10">{{ item.name }}</div>
</div>
</div>
</div>
@@ -80,17 +81,17 @@
<volume-setting ref="volumeSettingRef" @refreshVolume="refreshVolume" />
<!-- 商品上架 -->
<goods-putaway ref="goodsPutawayRef" />
<goods-putaway ref="goodsPutawayRef" @refreshDoor="refreshDoor" />
</div>
</template>
<script setup lang="ts" name="systemHardDoorManager">
<script setup lang="ts" name="hardDoorManager">
import { onMounted, ref } from "vue"
import { useMessage } from "/@/hooks/message"
import { displayPrice } from "/@/utils/formatMoney"
import * as hardDoorManager from "/@/api/hard/hard-door-manager"
const InfoSetting = defineAsyncComponent(() => import("./volume-setting.vue"))
const InfoSetting = defineAsyncComponent(() => import("./info-setting.vue"))
const VolumeSetting = defineAsyncComponent(() => import("./volume-setting.vue"))
const GoodsPutaway = defineAsyncComponent(() => import("./goods-putaway.vue"))
@@ -101,6 +102,7 @@ const state = reactive<any>({
mediaVolume: "",
systemVolume: "",
queryForm: {},
doorGoods: new Array(6).fill([]).map(() => new Array(10).fill({})),
})
const infoSettingRef = ref()
const volumeSettingRef = ref()
@@ -145,11 +147,14 @@ const refreshVolume = (data: { hardId: string; mediaVolume: number; systemVolume
}
// 点击上架
const clickPutaway = () => {
const clickPutaway = (floorIndex: number, posIndex: number) => {
if (goodsPutawayRef.value) {
goodsPutawayRef.value.openDialog(doorSettingData.value.hardId)
goodsPutawayRef.value.openDialog(doorSettingData.value.hardId, floorIndex, posIndex)
}
}
const refreshDoor = (row: any, curPos: { hardId: string; floorIndex: number; posIndex: number }) => {
state.doorGoods[curPos.floorIndex][curPos.posIndex] = row
}
const doRefresh = async () => {
try {