智能柜管理
This commit is contained in:
1 parent
b7b222e842
commit
7c3e244eb7
4 files changed
+100
-196
No files matched your search
@@ -1,117 +0,0 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="设备编号" prop="hardId">
|
||||
<el-input v-model="form.hardId" placeholder="请输入设备编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="设备 IMEI 号(15 位)" prop="imei">
|
||||
<el-input v-model="form.imei" placeholder="请输入设备 IMEI 号(15 位)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="货柜数量" prop="cabinetNum">
|
||||
<el-input v-model="form.cabinetNum" placeholder="请输入货柜数量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="每个货柜中摄像头数量" prop="cabinetCameraNum">
|
||||
<el-input v-model="form.cabinetCameraNum" placeholder="请输入每个货柜中摄像头数量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="每个货柜中称重单元数量" prop="cabinetWeightUnitNum">
|
||||
<el-input v-model="form.cabinetWeightUnitNum" placeholder="请输入每个货柜中称重单元数量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="1:通电;2:断电" prop="powerStatus">
|
||||
<el-input v-model="form.powerStatus" placeholder="请输入1:通电;2:断电" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="在线状态。1:在线;2:离线" prop="netStatus">
|
||||
<el-input v-model="form.netStatus" placeholder="请输入在线状态。1:在线;2:离线" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="售卖状态。1:在售;2:停售" prop="saleStatus">
|
||||
<el-input v-model="form.saleStatus" placeholder="请输入售卖状态。1:在售;2:停售" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item
|
||||
label="sim 信号强度。大于-95 表示信号强度好;-95 到-105 表示信号强度中等;小于-105 表示信号差;"
|
||||
prop="signalIntensity"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.signalIntensity"
|
||||
placeholder="请输入sim 信号强度。大于-95 表示信号强度好;-95 到-105 表示信号强度中等;小于-105 表示信号差;"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item
|
||||
label="信噪比,体现信道传输质量的参数。大于 15 表示质量好;15 到 0 表示质量中等;小于等于 0 表示质量差;"
|
||||
prop="signalRatio"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.signalRatio"
|
||||
placeholder="请输入信噪比,体现信道传输质量的参数。大于 15 表示质量好;15 到 0 表示质量中等;小于等于 0 表示质量差;"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="sim 信号值更新时间。yyyy-MM-dd HH:mm:ss" prop="signalTime">
|
||||
<el-input v-model="form.signalTime" placeholder="请输入sim 信号值更新时间。yyyy-MM-dd HH:mm:ss" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="货柜列表JSON" prop="cabinetList">
|
||||
<el-input v-model="form.cabinetList" placeholder="请输入货柜列表JSON" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="上次重启时间" prop="restartTime">
|
||||
<el-input v-model="form.restartTime" placeholder="请输入上次重启时间" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="HardDoorManagerDialog">
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: "",
|
||||
hardId: "",
|
||||
imei: "",
|
||||
cabinetNum: "",
|
||||
cabinetCameraNum: "",
|
||||
cabinetWeightUnitNum: "",
|
||||
powerStatus: "",
|
||||
netStatus: "",
|
||||
saleStatus: "",
|
||||
signalIntensity: "",
|
||||
signalRatio: "",
|
||||
signalTime: "",
|
||||
cabinetList: "",
|
||||
restartTime: "",
|
||||
})
|
||||
</script>
|
||||
@@ -97,17 +97,11 @@ const emit = defineEmits(["refreshCabinet"])
|
||||
const { yes_no_type, hard_ks_sku_type } = useDict("yes_no_type", "hard_ks_sku_type")
|
||||
const queryRef = ref()
|
||||
const visible = ref(false)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: hardSpu.pageJoin,
|
||||
})
|
||||
const curCabinetItem = reactive<{
|
||||
hardId: string
|
||||
cabinetItem: any
|
||||
floorIndex: number | undefined
|
||||
indexNo: number | undefined
|
||||
}>({ hardId: "", cabinetItem: {}, floorIndex: undefined, indexNo: undefined })
|
||||
const curCabinetItemId = ref<string>("")
|
||||
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state)
|
||||
|
||||
@@ -115,33 +109,21 @@ const resetQuery = () => {
|
||||
queryRef.value?.resetFields()
|
||||
getDataList()
|
||||
}
|
||||
const resetCurCabinetItem = () => {
|
||||
curCabinetItem.hardId = ""
|
||||
curCabinetItem.cabinetItem = {}
|
||||
curCabinetItem.floorIndex = undefined
|
||||
curCabinetItem.indexNo = undefined
|
||||
}
|
||||
|
||||
const openDialog = (hardId: string, cabinetItem: any, floorIndex: number, indexNo: number) => {
|
||||
if (!hardId) return useMessage().error("设备id不存在")
|
||||
const openDialog = (cabinetItemId: string) => {
|
||||
if (!cabinetItemId) return useMessage().error("绑定id不存在")
|
||||
resetQuery()
|
||||
resetCurCabinetItem()
|
||||
|
||||
curCabinetItem.hardId = hardId
|
||||
curCabinetItem.cabinetItem = cabinetItem
|
||||
curCabinetItem.floorIndex = floorIndex
|
||||
curCabinetItem.indexNo = indexNo
|
||||
|
||||
curCabinetItemId.value = cabinetItemId
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
// 点击上架
|
||||
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 (!row.id) return useMessage().error("商品id不存在")
|
||||
const res = await hardSpu.putaway({ id: curCabinetItemId.value, hardSpuId: row.id })
|
||||
if (res.code == 0) {
|
||||
useMessage().success("上架成功")
|
||||
// emit("refreshCabinet", row, curPos)
|
||||
emit("refreshCabinet")
|
||||
visible.value = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div v-loading="loading" class="layout-padding-auto layout-padding-view" style="overflow: scroll !important">
|
||||
<div v-loading="loading" class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view" style="overflow: scroll !important">
|
||||
<el-descriptions :column="3" title="经营信息" border>
|
||||
<template #extra>
|
||||
<el-tooltip class="item" effect="dark" content="刷新" placement="top">
|
||||
@@ -12,20 +12,21 @@
|
||||
<el-descriptions-item label="本年交易金额:">{{ displayPrice(0) }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions :column="4" title="智能柜设置" border>
|
||||
<el-descriptions :column="3" title="智能柜设置" border>
|
||||
<template #extra>
|
||||
<div class="flex justify-center items-center">
|
||||
<el-button icon="Edit" type="primary" @click="doBind">修改</el-button>
|
||||
<el-button icon="Edit" type="primary" @click="changeInfo">修改</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions-item label="商户名称:">{{}}</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="设备IMEI卡号:">{{ state.deviceDetail.imei }}</el-descriptions-item>
|
||||
<el-descriptions-item label="货柜数量:">{{ state.deviceDetail.cabinetNum }}</el-descriptions-item>
|
||||
<el-descriptions-item label="单个货柜摄像头数量:">{{ state.deviceDetail.cabinetCameraNum }}</el-descriptions-item>
|
||||
<el-descriptions-item label="单个货柜称重单元数量:">{{ state.deviceDetail.cabinetWeightUnitNum }}</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>
|
||||
|
||||
<el-descriptions :column="3" title="运行信息" border>
|
||||
@@ -34,12 +35,38 @@
|
||||
<el-button icon="Edit" type="primary" @click="doVolumeSetting">音量设置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions-item label="销售状态:">{{ state.deviceDetail.saleStatus }}</el-descriptions-item>
|
||||
<el-descriptions-item label="设备状态:">{{}}</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-item label="售卖状态:">
|
||||
<el-tag v-if="state.deviceDetail.saleStatus == 1" type="primary">在售</el-tag>
|
||||
<el-tag v-if="state.deviceDetail.saleStatus == 2" type="danger">停售</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="电源状态:">
|
||||
<el-tag v-if="state.deviceDetail.powerStatus == 1" type="primary">通电</el-tag>
|
||||
<el-tag v-if="state.deviceDetail.powerStatus == 2" type="danger">断电</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="在线状态:">
|
||||
<el-tag v-if="state.deviceDetail.netStatus == 1" type="primary">在线</el-tag>
|
||||
<el-tag v-if="state.deviceDetail.netStatus == 2" type="danger">离线</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="媒体音量:">
|
||||
<div class="color-danger">{{ state.deviceDetail.mediaVolume }}</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="系统音量:">
|
||||
<div class="color-danger">{{ state.deviceDetail.systemVolume }}</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
{{ state.deviceDetail.signalIntensity }}
|
||||
<template #label>
|
||||
SIM信号强度<tip content="大于-95 表示信号强度好;-95 到-105 表示信号强度中等;小于-105 表示信号差" />:
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
{{ state.deviceDetail.signalRatio }}
|
||||
<template #label>
|
||||
信噪比<tip content="用于体现信道传输质量的参数。大于 15 表示质量好;15 到 0 表示质量中等;小于等于 0 表示质量差" />:
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="SIM信号值更新时间:">{{ state.deviceDetail.signalTime }}</el-descriptions-item>
|
||||
<el-descriptions-item label="上次重启时间:">{{ state.deviceDetail.restartTime }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions :column="0" title="货柜商品" border>
|
||||
@@ -65,27 +92,22 @@
|
||||
<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(v, floorIndex, indexNo)"
|
||||
@click="clickPutaway(v.id)"
|
||||
>
|
||||
<div v-if="item.spuId && item.spuDetail" class="relative">
|
||||
<el-icon
|
||||
@click.stop="deleteGoods(floorIndex, index)"
|
||||
class="absolute right-[-8px] top-[-8px] text-xl text-blue-600 z-50"
|
||||
>
|
||||
<div v-if="v.spuId && v.spuDetail" class="relative">
|
||||
<el-icon @click.stop="deleteGoods(v)" class="absolute right-[-8px] top-[-8px] text-xl text-blue-600 z-50">
|
||||
<CircleClose />
|
||||
</el-icon>
|
||||
<preview-image width="86px" height="86px" :src="item.pic" @click.stop />
|
||||
<preview-image width="86px" height="86px" :src="v.spuDetail.pic" @click.stop />
|
||||
</div>
|
||||
<span v-else>点击上架</span>
|
||||
</div>
|
||||
<div class="h-10">{{ item.name }}</div>
|
||||
<div class="h-10">{{ v.spuDetail?.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="111">111</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
@@ -96,7 +118,7 @@
|
||||
<volume-setting ref="volumeSettingRef" @refreshVolume="refreshVolume" />
|
||||
|
||||
<!-- 商品上架 -->
|
||||
<goods-putaway ref="goodsPutawayRef" @refreshDoor="refreshCabinet" />
|
||||
<goods-putaway ref="goodsPutawayRef" @refreshCabinet="refreshCabinet" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -106,7 +128,7 @@ import { useMessage } from "/@/hooks/message"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import * as hardDoorManager from "/@/api/hard/hard-door-manager"
|
||||
import { ElMessageBox } from "element-plus"
|
||||
import { getByCabinetNo } from "/@/api/hard/hard-spu"
|
||||
import { getByCabinetNo, unPutaway } from "/@/api/hard/hard-spu"
|
||||
|
||||
const InfoSetting = defineAsyncComponent(() => import("./info-setting.vue"))
|
||||
const VolumeSetting = defineAsyncComponent(() => import("./volume-setting.vue"))
|
||||
@@ -121,6 +143,7 @@ const state = reactive<any>({
|
||||
hardId: "",
|
||||
deviceDetail: {},
|
||||
cabinetData: [],
|
||||
curActivedTabIndex: 0,
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
@@ -152,6 +175,16 @@ const getCabinet = async (cabinetIndex: number = 0) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 修改基本信息
|
||||
const changeInfo = async () => {
|
||||
if (infoSettingRef.value) {
|
||||
infoSettingRef.value.openDialog(state.hardId)
|
||||
}
|
||||
}
|
||||
const refreshInfo = () => {
|
||||
doRefresh()
|
||||
}
|
||||
|
||||
// 音量设置
|
||||
const doVolumeSetting = async () => {
|
||||
if (volumeSettingRef.value) {
|
||||
@@ -165,44 +198,50 @@ const refreshVolume = (data: { hardId: string; mediaVolume: number; systemVolume
|
||||
|
||||
// 点击柜门tab
|
||||
const tabClick = async (tab: any) => {
|
||||
// curActive = tab.index
|
||||
state.curActivedTabIndex = tab.index
|
||||
await getCabinet(tab.index)
|
||||
}
|
||||
|
||||
// 点击上架
|
||||
const clickPutaway = (cabinetItemId: any) => {
|
||||
if (goodsPutawayRef.value) {
|
||||
goodsPutawayRef.value.openDialog(cabinetItemId)
|
||||
}
|
||||
}
|
||||
const refreshCabinet = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
await getCabinet(state.curActivedTabIndex)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const doRefresh = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
await getDetail()
|
||||
await getCabinet()
|
||||
await getCabinet(state.curActivedTabIndex)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
// ========================================================================================
|
||||
// 绑定信息
|
||||
const doBind = async () => {
|
||||
if (infoSettingRef.value) {
|
||||
infoSettingRef.value.openDialog(state.deviceDetail.hardId)
|
||||
}
|
||||
}
|
||||
// 基本信息
|
||||
const refreshInfo = () => {}
|
||||
|
||||
// 点击上架
|
||||
const clickPutaway = (cabinetItem: any, floorIndex: number, indexNo: number) => {
|
||||
if (goodsPutawayRef.value) {
|
||||
goodsPutawayRef.value.openDialog(state.hardId, cabinetItem, floorIndex, indexNo)
|
||||
}
|
||||
}
|
||||
const refreshCabinet = (row: any, curPos: { hardId: string; floorIndex: number; posIndex: number }) => {
|
||||
state.doorGoods[curPos.floorIndex][curPos.posIndex] = row
|
||||
}
|
||||
|
||||
// 删除商品
|
||||
const deleteGoods = async (floorIndex: number, posIndex: number) => {
|
||||
ElMessageBox.confirm("确定删除吗?", "删除", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }).then(async () => {
|
||||
state.doorGoods[floorIndex][posIndex] = {}
|
||||
})
|
||||
// 下架商品
|
||||
const deleteGoods = async (v: any) => {
|
||||
if (!v.id) return useMessage().error("绑定id不存在")
|
||||
if (!v.spuId) return useMessage().error("商品id不存在")
|
||||
ElMessageBox.confirm("确定下架吗?", "商品下架", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }).then(
|
||||
async () => {
|
||||
loading.value = true
|
||||
const res = await unPutaway({ id: v.id, hardSpuId: v.spuId }).finally(() => (loading.value = false))
|
||||
if (res.code == 0) {
|
||||
useMessage().success("下架成功")
|
||||
return getCabinet(state.curActivedTabIndex)
|
||||
}
|
||||
useMessage().error(res.msg || "下架失败")
|
||||
},
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<el-dialog title="智能柜设置" v-model="visible" :close-on-click-modal="true" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="120px" v-loading="loading">
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="150px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="设备IMEI卡号:" prop="imei">
|
||||
<el-input v-model="form.imei" placeholder="请输入设备IMEI卡号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="柜子层数:" prop="doorCount">
|
||||
<el-input v-model="form.doorCount" placeholder="请输入柜子层数" />
|
||||
</el-form-item>
|
||||
|
||||
Reference in new issue
Block a user