智能柜管理修改
This commit is contained in:
1 parent
2012f8a945
commit
e78104823d
2 files changed
+79
-71
No files matched your search
@@ -73,7 +73,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="150">
|
||||
<template #default="{ row }">
|
||||
<el-button text type="primary" @click="confirmPutaway(row)">点击上架</el-button>
|
||||
<el-button text type="primary" @click="clickPutaway(row)">点击上架</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -92,7 +92,7 @@ import { useDict } from "/@/hooks/dict"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
|
||||
const emit = defineEmits(["refreshDoor"])
|
||||
const emit = defineEmits(["refreshCabinet"])
|
||||
|
||||
const { yes_no_type, hard_ks_sku_type } = useDict("yes_no_type", "hard_ks_sku_type")
|
||||
const queryRef = ref()
|
||||
@@ -102,11 +102,12 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: hardSpu.pageJoin,
|
||||
})
|
||||
const curPos = reactive<{
|
||||
const curCabinetItem = reactive<{
|
||||
hardId: string
|
||||
cabinetItem: any
|
||||
floorIndex: number | undefined
|
||||
posIndex: number | undefined
|
||||
}>({ hardId: "", floorIndex: undefined, posIndex: undefined })
|
||||
indexNo: number | undefined
|
||||
}>({ hardId: "", cabinetItem: {}, floorIndex: undefined, indexNo: undefined })
|
||||
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state)
|
||||
|
||||
@@ -114,22 +115,37 @@ const resetQuery = () => {
|
||||
queryRef.value?.resetFields()
|
||||
getDataList()
|
||||
}
|
||||
const resetCurCabinetItem = () => {
|
||||
curCabinetItem.hardId = ""
|
||||
curCabinetItem.cabinetItem = {}
|
||||
curCabinetItem.floorIndex = undefined
|
||||
curCabinetItem.indexNo = undefined
|
||||
}
|
||||
|
||||
const openDialog = (hardId: string, floorIndex: number, posIndex: number) => {
|
||||
const openDialog = (hardId: string, cabinetItem: any, floorIndex: number, indexNo: number) => {
|
||||
if (!hardId) return useMessage().error("设备id不存在")
|
||||
resetQuery()
|
||||
resetCurCabinetItem()
|
||||
|
||||
curPos.hardId = hardId
|
||||
curPos.floorIndex = floorIndex
|
||||
curPos.posIndex = posIndex
|
||||
curCabinetItem.hardId = hardId
|
||||
curCabinetItem.cabinetItem = cabinetItem
|
||||
curCabinetItem.floorIndex = floorIndex
|
||||
curCabinetItem.indexNo = indexNo
|
||||
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
// 确认上架
|
||||
const confirmPutaway = (row: any) => {
|
||||
emit("refreshDoor", row, curPos)
|
||||
visible.value = false
|
||||
// 点击上架
|
||||
const clickPutaway = async (row: any) => {
|
||||
if (!row.id || !curCabinetItem.cabinetItem.id) return useMessage().error("设备id不存在")
|
||||
const res = await hardSpu.putaway({ id: curCabinetItem.cabinetItem.id, hardSpuId: row.id })
|
||||
if (res.code == 0) {
|
||||
useMessage().success("上架成功")
|
||||
// emit("refreshCabinet", row, curPos)
|
||||
visible.value = false
|
||||
return
|
||||
}
|
||||
useMessage().error("上架失败")
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions-item label="商户名称:">{{}}</el-descriptions-item>
|
||||
<el-descriptions-item label="设备编号:">{{ doorSettingData.deviceCode }}</el-descriptions-item>
|
||||
<el-descriptions-item label="设备名称:">{{ doorSettingData.hardName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="机器编号:">{{ doorSettingData.imei }}</el-descriptions-item>
|
||||
<el-descriptions-item label="设备编号:">{{ state.deviceDetail.deviceCode }}</el-descriptions-item>
|
||||
<el-descriptions-item label="设备名称:">{{ state.deviceDetail.hardName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="机器编号:">{{ state.deviceDetail.imei }}</el-descriptions-item>
|
||||
<el-descriptions-item label="外部设备编号:">{{}}</el-descriptions-item>
|
||||
<el-descriptions-item label="SIM卡号:">{{ doorSettingData.simSn }}</el-descriptions-item>
|
||||
<el-descriptions-item label="柜子层数:">{{ doorSettingData.doorCount }}</el-descriptions-item>
|
||||
<el-descriptions-item label="SIM卡号:">{{ state.deviceDetail.simSn }}</el-descriptions-item>
|
||||
<el-descriptions-item label="柜子层数:">{{ state.deviceDetail.doorCount }}</el-descriptions-item>
|
||||
<el-descriptions-item label="地址:">{{}}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
@@ -34,12 +34,12 @@
|
||||
<el-button icon="Edit" type="primary" @click="doVolumeSetting">音量设置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions-item label="销售状态:">{{ doorSettingData.saleStatus }}</el-descriptions-item>
|
||||
<el-descriptions-item label="销售状态:">{{ state.deviceDetail.saleStatus }}</el-descriptions-item>
|
||||
<el-descriptions-item label="设备状态:">{{}}</el-descriptions-item>
|
||||
<el-descriptions-item label="电源状态:">{{ doorSettingData.powerStatus }}</el-descriptions-item>
|
||||
<el-descriptions-item label="网络状态:">{{ doorSettingData.netStatus }}</el-descriptions-item>
|
||||
<el-descriptions-item label="媒体音量:">{{ doorSettingData.mediaVolume }}</el-descriptions-item>
|
||||
<el-descriptions-item label="系统音量:">{{ doorSettingData.systemVolume }}</el-descriptions-item>
|
||||
<el-descriptions-item label="电源状态:">{{ state.deviceDetail.powerStatus }}</el-descriptions-item>
|
||||
<el-descriptions-item label="网络状态:">{{ state.deviceDetail.netStatus }}</el-descriptions-item>
|
||||
<el-descriptions-item label="媒体音量:">{{ state.deviceDetail.mediaVolume }}</el-descriptions-item>
|
||||
<el-descriptions-item label="系统音量:">{{ state.deviceDetail.systemVolume }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions :column="0" title="货柜商品" border>
|
||||
@@ -52,24 +52,24 @@
|
||||
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane
|
||||
v-if="doorSettingData.cabinetList?.length"
|
||||
:label="doorSettingData.deviceCode + '-' + item.cabinetNo"
|
||||
v-for="(item, index) in doorSettingData.cabinetList"
|
||||
v-if="state.deviceDetail.cabinetList?.length"
|
||||
:label="state.deviceDetail.deviceCode + '-' + item.cabinetNo"
|
||||
v-for="(item, index) in state.deviceDetail.cabinetList"
|
||||
:key="index"
|
||||
>
|
||||
<div v-for="(floorItem, floorIndex) in state.doorGoods" :key="floorIndex">
|
||||
<div v-for="(floorItem, floorIndex) in state.cabinetData" :key="floorIndex">
|
||||
<el-divider />
|
||||
<div class="text-black flex items-center">
|
||||
<div class="text-center w-24 text-lg font-bold">第 {{ floorIndex + 1 }} 层:</div>
|
||||
<div class="flex flex-wrap">
|
||||
<div class="flex flex-col items-center justify-start" v-for="(item, posIndex) in floorItem" :key="posIndex">
|
||||
<div class="flex flex-col items-center justify-start" v-for="(v, indexNo) in floorItem[floorIndex + 1]" :key="indexNo">
|
||||
<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)"
|
||||
@click="clickPutaway(v, floorIndex, indexNo)"
|
||||
>
|
||||
<div v-if="item.pic" class="relative">
|
||||
<div v-if="item.spuId && item.spuDetail" class="relative">
|
||||
<el-icon
|
||||
@click.stop="deleteGoods(floorIndex, posIndex)"
|
||||
@click.stop="deleteGoods(floorIndex, index)"
|
||||
class="absolute right-[-8px] top-[-8px] text-xl text-blue-600 z-50"
|
||||
>
|
||||
<CircleClose />
|
||||
@@ -94,7 +94,7 @@
|
||||
<volume-setting ref="volumeSettingRef" @refreshVolume="refreshVolume" />
|
||||
|
||||
<!-- 商品上架 -->
|
||||
<goods-putaway ref="goodsPutawayRef" @refreshDoor="refreshDoor" />
|
||||
<goods-putaway ref="goodsPutawayRef" @refreshDoor="refreshCabinet" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -112,18 +112,14 @@ const GoodsPutaway = defineAsyncComponent(() => import("./goods-putaway.vue"))
|
||||
|
||||
const { query } = useRoute()
|
||||
const loading = ref(false)
|
||||
const doorSettingData = ref<any>({})
|
||||
const cabinetData = ref<any>([])
|
||||
const currentCabinet = ref(0)
|
||||
const state = reactive<any>({
|
||||
mediaVolume: "",
|
||||
systemVolume: "",
|
||||
queryForm: {},
|
||||
doorGoods: new Array(6).fill([]).map(() => new Array(10).fill({})),
|
||||
})
|
||||
const infoSettingRef = ref()
|
||||
const volumeSettingRef = ref()
|
||||
const goodsPutawayRef = ref()
|
||||
const state = reactive<any>({
|
||||
hardId: "",
|
||||
deviceDetail: {},
|
||||
cabinetData: [],
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getDetail()
|
||||
@@ -134,58 +130,54 @@ onMounted(async () => {
|
||||
const getDetail = async () => {
|
||||
const id = query.id as unknown as any
|
||||
if (!id) return useMessage().error("设备id不存在")
|
||||
state.queryForm.orderId = id
|
||||
|
||||
const { data: orderData } = await hardDoorManager.getByHardId({ hardId: id })
|
||||
if (orderData) {
|
||||
doorSettingData.value = { ...orderData, cabinetList: JSON.parse(orderData.cabinetList) }
|
||||
}
|
||||
if (!doorSettingData.value.hardId) {
|
||||
doorSettingData.value.hardId = id
|
||||
state.hardId = id
|
||||
const { data } = await hardDoorManager.getByHardId({ hardId: state.hardId })
|
||||
if (data) {
|
||||
state.deviceDetail = { ...data, cabinetList: JSON.parse(data.cabinetList) }
|
||||
}
|
||||
}
|
||||
|
||||
// 获取柜子物品
|
||||
const getCabinet = async (cabinetIndex: number = 0) => {
|
||||
console.log(doorSettingData.value.cabinetList)
|
||||
|
||||
if (!doorSettingData.value.hardId) return useMessage().error("设备id不存在")
|
||||
if (!doorSettingData.value.cabinetList?.length) return useMessage().error("设备空间不存在")
|
||||
if (!state.hardId) return useMessage().error("设备id不存在")
|
||||
if (!state.deviceDetail.cabinetList?.length) return useMessage().error("设备空间不存在")
|
||||
const { data } = await getByCabinetNo({
|
||||
hardId: doorSettingData.value.hardId,
|
||||
cabinetNo: doorSettingData.value.cabinetList[cabinetIndex].cabinetNo,
|
||||
hardId: state.hardId,
|
||||
cabinetNo: state.deviceDetail.cabinetList[cabinetIndex].cabinetNo,
|
||||
})
|
||||
if (data) {
|
||||
cabinetData.value = data
|
||||
state.cabinetData = data
|
||||
}
|
||||
}
|
||||
|
||||
// 音量设置
|
||||
const doVolumeSetting = async () => {
|
||||
if (volumeSettingRef.value) {
|
||||
volumeSettingRef.value.openDialog(state.deviceDetail.hardId, state.deviceDetail.mediaVolume, state.deviceDetail.systemVolume)
|
||||
}
|
||||
}
|
||||
const refreshVolume = (data: { hardId: string; mediaVolume: number; systemVolume: number }) => {
|
||||
state.deviceDetail.mediaVolume = data.mediaVolume
|
||||
state.deviceDetail.systemVolume = data.systemVolume
|
||||
}
|
||||
|
||||
// ========================================================================================
|
||||
// 绑定信息
|
||||
const doBind = async () => {
|
||||
if (infoSettingRef.value) {
|
||||
infoSettingRef.value.openDialog(doorSettingData.value.hardId)
|
||||
infoSettingRef.value.openDialog(state.deviceDetail.hardId)
|
||||
}
|
||||
}
|
||||
// 基本信息
|
||||
const refreshInfo = () => {}
|
||||
|
||||
// 音量设置
|
||||
const doVolumeSetting = async () => {
|
||||
if (volumeSettingRef.value) {
|
||||
volumeSettingRef.value.openDialog(doorSettingData.value.hardId, doorSettingData.value.mediaVolume, doorSettingData.value.systemVolume)
|
||||
}
|
||||
}
|
||||
const refreshVolume = (data: { hardId: string; mediaVolume: number; systemVolume: number }) => {
|
||||
doorSettingData.value.mediaVolume = data.mediaVolume
|
||||
doorSettingData.value.systemVolume = data.systemVolume
|
||||
}
|
||||
|
||||
// 点击上架
|
||||
const clickPutaway = (floorIndex: number, posIndex: number) => {
|
||||
const clickPutaway = (cabinetItem: any, floorIndex: number, indexNo: number) => {
|
||||
if (goodsPutawayRef.value) {
|
||||
goodsPutawayRef.value.openDialog(doorSettingData.value.hardId, floorIndex, posIndex)
|
||||
goodsPutawayRef.value.openDialog(state.hardId, cabinetItem, floorIndex, indexNo)
|
||||
}
|
||||
}
|
||||
const refreshDoor = (row: any, curPos: { hardId: string; floorIndex: number; posIndex: number }) => {
|
||||
const refreshCabinet = (row: any, curPos: { hardId: string; floorIndex: number; posIndex: number }) => {
|
||||
state.doorGoods[curPos.floorIndex][curPos.posIndex] = row
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user