bug修改

master
LAPTOP-S9HJSOEB\昊天 7 months ago
parent a0252bb5d5
commit 86b2da5273

@ -3,7 +3,7 @@ import request from '@/config/axios'
// 盘点状态 VO
export interface StockVO {
id: number // id
lotnum: string // 盘点批次好
batchNumber: string // 盘点批次好
orderNum: string // 工单任务号
checkNum: string // 盘点任务号
code: string // 扫描条码

@ -80,4 +80,11 @@ export const StreetApi = {
getRfidListByStreetId: async (streetId) => {
return await request.get({ url: `/logistics/street/rfid/list-by-street-id?streetId=` + streetId })
},
// ==================== 子表Rfid ====================
// 获得Rfid列表
getShelfCodeListByStreetId: async (streetId) => {
return await request.get({ url: `/logistics/street/shelfCode/list-by-street-id?streetId=` + streetId })
},
}

@ -3,7 +3,7 @@
<video style="width: 100%;height: 100%;object-fit:fill;" ref="video" muted autoplay="true" > </video>
<ptz v-if="ptzShow" :cameraId="cameraId" />
<ptz v-if="ptzShow" @childTriggerParent="startVideo" :cameraId="cameraId" />
</div>
</template>
@ -125,7 +125,6 @@ export default {
const changeResolution = (e) => {
resolution.value = e.target.options[e.target.selectedIndex].text
}
const start_play =async () => {
// const urlIp = ref("")
const resCamera = await CameraApi.getCamera(props.cameraId)

@ -99,7 +99,9 @@
</div>
<div class="direction-item">
<Icon
:icon="centerIcon"
@click="refresh"
alt="Center"
/>
@ -151,12 +153,13 @@ import {CameraControlApi} from '@/api/cameraControl/camera'
const { result_code, base_url, request_timeout } = config
export default {
props: {
cameraId: {
default: 2
}
},
setup(props) {
setup(props, { emit }) {
console.log(props.cameraId)
//
const zoomSubIcon = ref('ep:zoom-out') //
@ -169,7 +172,7 @@ export default {
const upIcon = ref('ep:arrow-up') //
const rightUpIcon = ref('ep:top-right') //
const leftIcon = ref('ep:arrow-left') //
const centerIcon = ref('ep:aim') //
const centerIcon = ref('ep:refresh') //
const rightIcon = ref('ep:arrow-right') //
const leftDownIcon = ref('ep:bottom-left') //
const downIcon = ref('ep:arrow-down') //
@ -192,6 +195,11 @@ export default {
down: 'ep:arrow-down-active',
rightDown: 'ep:bottom-right-active'
}
const refresh = () =>{
// 使 $emit
emit('childTriggerParent') // this
}
//
const handleControl = (action, state) => {
@ -227,6 +235,7 @@ export default {
leftIcon,
centerIcon,
rightIcon,
refresh,
leftDownIcon,
downIcon,
rightDownIcon,

@ -1,196 +1,188 @@
<template>
<div class="ptz-control">
<el-card style="max-width: 480px">
<el-row :gutter="10" justify="center">
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="zoomSubIcon"
alt="Zoom In"
@mousedown="handleControl('zoomSub', 'start')"
@mouseup="handleControl('zoomSub', 'stop')"
@mouseleave="handleControl('zoomSub', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<span class="direction-item">变倍</span>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="zoomAddIcon"
alt="Zoom Out"
@mousedown="handleControl('zoomAdd', 'start')"
@mouseup="handleControl('zoomAdd', 'stop')"
@mouseleave="handleControl('zoomAdd', 'stop')"
/>
</div>
</el-col>
</el-row>
<el-row :gutter="10" justify="center">
<el-col :span="8" class="direction-item">
<div class="direction-item">
<Icon
:icon="focusSubIcon"
alt="Focus In"
@mousedown="handleControl('focusSub', 'start')"
@mouseup="handleControl('focusSub', 'stop')"
@mouseleave="handleControl('focusSub', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<span class="direction-item">变焦</span>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="focusAddIcon"
alt="Focus Out"
@mousedown="handleControl('focusAdd', 'start')"
@mouseup="handleControl('focusAdd', 'stop')"
@mouseleave="handleControl('focusAdd', 'stop')"
/>
</div>
</el-col>
</el-row>
<el-row :gutter="10" justify="center">
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="irisSubIcon"
alt="Iris Open"
@mousedown="handleControl('irisSub', 'start')"
@mouseup="handleControl('irisSub', 'stop')"
@mouseleave="handleControl('irisSub', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<span class="direction-item">光圈</span>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="irisAddIcon"
alt="Iris Close"
@mousedown="handleControl('irisAdd', 'start')"
@mouseup="handleControl('irisAdd', 'stop')"
@mouseleave="handleControl('irisAdd', 'stop')"
/>
</div>
</el-col>
</el-row>
<el-row :gutter="10" justify="center">
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="leftUpIcon"
alt="Left Up"
@mousedown="handleControl('leftUp', 'start')"
@mouseup="handleControl('leftUp', 'stop')"
@mouseleave="handleControl('leftUp', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="upIcon"
alt="Up"
@mousedown="handleControl('up', 'start')"
@mouseup="handleControl('up', 'stop')"
@mouseleave="handleControl('up', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="rightUpIcon"
alt="Right Up"
@mousedown="handleControl('rightUp', 'start')"
@mouseup="handleControl('rightUp', 'stop')"
@mouseleave="handleControl('rightUp', 'stop')"
/>
</div>
</el-col>
</el-row>
<el-row :gutter="10" justify="center">
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="leftIcon"
alt="Left"
@mousedown="handleControl('left', 'start')"
@mouseup="handleControl('left', 'stop')"
@mouseleave="handleControl('left', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="centerIcon"
alt="Center"
/>
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="rightIcon"
alt="Right"
@mousedown="handleControl('right', 'start')"
@mouseup="handleControl('right', 'stop')"
@mouseleave="handleControl('right', 'stop')"
/>
</div>
</el-col>
</el-row>
<el-row :gutter="10" justify="center">
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="leftDownIcon"
alt="Left Down"
@mousedown="handleControl('leftDown', 'start')"
@mouseup="handleControl('leftDown', 'stop')"
@mouseleave="handleControl('leftDown', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="downIcon"
alt="Down"
@mousedown="handleControl('down', 'start')"
@mouseup="handleControl('down', 'stop')"
@mouseleave="handleControl('down', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="rightDownIcon"
alt="Right Down"
@mousedown="handleControl('rightDown', 'start')"
@mouseup="handleControl('rightDown', 'stop')"
@mouseleave="handleControl('rightDown', 'stop')"
/>
</div>
</el-col>
</el-row>
<el-row :gutter="10" justify="center">
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="zoomSubIcon"
alt="Zoom In"
@mousedown="handleControl('zoomSub', 'start')"
@mouseup="handleControl('zoomSub', 'stop')"
@mouseleave="handleControl('zoomSub', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<span class="direction-item">变倍</span>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="zoomAddIcon"
alt="Zoom Out"
@mousedown="handleControl('zoomAdd', 'start')"
@mouseup="handleControl('zoomAdd', 'stop')"
@mouseleave="handleControl('zoomAdd', 'stop')"
/>
</div>
</el-col>
</el-row>
<el-row :gutter="10" justify="center">
<el-col :span="8" class="direction-item">
<div class="direction-item">
<Icon
:icon="focusSubIcon"
alt="Focus In"
@mousedown="handleControl('focusSub', 'start')"
@mouseup="handleControl('focusSub', 'stop')"
@mouseleave="handleControl('focusSub', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<span class="direction-item">变焦</span>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="focusAddIcon"
alt="Focus Out"
@mousedown="handleControl('focusAdd', 'start')"
@mouseup="handleControl('focusAdd', 'stop')"
@mouseleave="handleControl('focusAdd', 'stop')"
/>
</div>
</el-col>
</el-row>
<el-row :gutter="10" justify="center">
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="irisSubIcon"
alt="Iris Open"
@mousedown="handleControl('irisSub', 'start')"
@mouseup="handleControl('irisSub', 'stop')"
@mouseleave="handleControl('irisSub', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<span class="direction-item">光圈</span>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="irisAddIcon"
alt="Iris Close"
@mousedown="handleControl('irisAdd', 'start')"
@mouseup="handleControl('irisAdd', 'stop')"
@mouseleave="handleControl('irisAdd', 'stop')"
/>
</div>
</el-col>
</el-row>
<el-row :gutter="10" justify="center">
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="leftUpIcon"
alt="Left Up"
@mousedown="handleControl('leftUp', 'start')"
@mouseup="handleControl('leftUp', 'stop')"
@mouseleave="handleControl('leftUp', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="upIcon"
alt="Up"
@mousedown="handleControl('up', 'start')"
@mouseup="handleControl('up', 'stop')"
@mouseleave="handleControl('up', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="rightUpIcon"
alt="Right Up"
@mousedown="handleControl('rightUp', 'start')"
@mouseup="handleControl('rightUp', 'stop')"
@mouseleave="handleControl('rightUp', 'stop')"
/>
</div>
</el-col>
</el-row>
<el-row :gutter="10" justify="center">
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="leftIcon"
alt="Left"
@mousedown="handleControl('left', 'start')"
@mouseup="handleControl('left', 'stop')"
@mouseleave="handleControl('left', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon :icon="centerIcon" @click="refresh" alt="Center" title="刷新" />
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="rightIcon"
alt="Right"
@mousedown="handleControl('right', 'start')"
@mouseup="handleControl('right', 'stop')"
@mouseleave="handleControl('right', 'stop')"
/>
</div>
</el-col>
</el-row>
<el-row :gutter="10" justify="center">
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="leftDownIcon"
alt="Left Down"
@mousedown="handleControl('leftDown', 'start')"
@mouseup="handleControl('leftDown', 'stop')"
@mouseleave="handleControl('leftDown', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="downIcon"
alt="Down"
@mousedown="handleControl('down', 'start')"
@mouseup="handleControl('down', 'stop')"
@mouseleave="handleControl('down', 'stop')"
/>
</div>
</el-col>
<el-col :span="8">
<div class="direction-item">
<Icon
:icon="rightDownIcon"
alt="Right Down"
@mousedown="handleControl('rightDown', 'start')"
@mouseup="handleControl('rightDown', 'stop')"
@mouseleave="handleControl('rightDown', 'stop')"
/>
</div>
</el-col>
</el-row>
</el-card>
</div>
</template>
@ -198,7 +190,7 @@
<script>
import axios from 'axios' // axios
import { config } from '@/config/axios/config'
import {CameraControlApi} from '@/api/cameraControl/camera'
import { CameraControlApi } from '@/api/cameraControl/camera'
const { result_code, base_url, request_timeout } = config
export default {
@ -207,7 +199,7 @@ export default {
default: 2
}
},
setup(props) {
setup(props, { emit }) {
console.log(props.cameraId)
//
const zoomSubIcon = ref('ep:zoom-out') //
@ -220,12 +212,17 @@ export default {
const upIcon = ref('ep:arrow-up') //
const rightUpIcon = ref('ep:top-right') //
const leftIcon = ref('ep:arrow-left') //
const centerIcon = ref('ep:aim') //
const centerIcon = ref('ep:refresh') //
const rightIcon = ref('ep:arrow-right') //
const leftDownIcon = ref('ep:bottom-left') //
const downIcon = ref('ep:arrow-down') //
const rightDownIcon = ref('ep:bottom-right') //
const refresh = () => {
console.log("刷新");
// 使 $emit
emit('childTriggerParent')
}
const activeIcons = {
zoomSub: 'ep:zoom-out-active',
zoomAdd: 'ep:zoom-in-active',
@ -255,9 +252,8 @@ export default {
} else if (state === 'stop') {
eval(`${iconRef}.value = '${eval(iconRef).value.replace('-active', '')}'`)
}
const data ={"id":props.cameraId}
CameraControlApi.cameraControl(`/camera/control/${action}/${state}`,data)
const data = { id: props.cameraId }
CameraControlApi.cameraControl(`/camera/control/${action}/${state}`, data)
}
const close = () => {

@ -339,9 +339,10 @@ const sse = ()=>{
//
eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log(data);
realTimeLogs.value.push(data.message)
console.log(event.data);
realTimeLogs.value.push(event.data)
};
//

@ -94,20 +94,22 @@ const getList = async () => {
}
}
const toPtz = (row: CameraIOVO) => {
const toPtz = async (row: CameraIOVO) => {
formData.value.ptzId = row.ptzId
const req = formData.value as unknown as CameraIOVO
CameraIoApi.callPtz(req) // Promise
getList()
await CameraIoApi.callPtz(req) // Promise
await getList()
}
const addRouters = (id: number) => {
const req = formData.value as unknown as CameraIOVO
CameraIoApi.createCameraIo(req) // Promise
getList()
const addRouters = async () => { // 使 id
try {
const req = formData.value as unknown as CameraIOVO
await CameraIoApi.createCameraIo(req) // Promise
await getList() // createCameraIo getList
} catch (error) {
console.error('创建相机IO失败:', error)
message.error('创建失败') //
}
}
// cameraId
watch(
() => props.cameraId,
@ -129,11 +131,11 @@ const showModelDel = async (id: number) => {
}
}
const overwritePtz = (ptzId: number) => {
const overwritePtz =async (ptzId: number) => {
formData.value.ptzId = ptzId
const req = formData.value as unknown as CameraIOVO
CameraIoApi.overwritePtz(req) // Promise
getList()
await CameraIoApi.overwritePtz(req) // Promise
await getList()
}
onMounted(() => {

@ -11,7 +11,7 @@
highlight-current
class="camera-tree"
/>
<ptz v-if="cameraId" :cameraId="cameraId" />
<ptz @childTriggerParent="reVideo" v-if="cameraId" :cameraId="cameraId" />
</el-col>
<el-col :span="19">
<div class="container">
@ -43,7 +43,7 @@
</div>
<Camera v-if="getCameraId((rowIndex - 1) * topNum + colIndex)!== 0"
:cameraId="getCameraId((rowIndex-1)*topNum +colIndex)" :ptzShow="false" />
:cameraId="getCameraId((rowIndex-1)*topNum +colIndex)" ref="camera" :ptzShow="false" />
</el-col>
</el-row>
</el-col>
@ -54,6 +54,7 @@
<script setup lang="ts">
import Camera from '@/components/camera/camera.vue'
import { ref } from 'vue';
import ptz from '@/components/camera/ptzNotFlow.vue'
import { CameraApi, CameraVO } from '@/api/logistics/camera'
import { el, ta } from 'element-plus/es/locale'
@ -71,7 +72,9 @@ const cameraIndex = ref()
//
const clickCamera = ref(false)
const CameraMap = ref<Map<number, number | undefined>>()
const reVideo = async () => {
}
/** 查询列表 */
const getTree = async () => {
try {

@ -24,15 +24,25 @@
/>
</el-select>
</el-form-item>
<el-form-item label="盘点批次号" prop="lotnum">
<el-form-item label="盘点批次号" prop="batchNumber">
<el-input
v-model="queryParams.lotnum"
v-model="queryParams.batchNumber"
placeholder="请输入盘点批次号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="任务工单号" prop="taskId">
<el-input
v-model="queryParams.taskId"
placeholder="请输入任务工单号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="层" prop="row">
<el-input
v-model="queryParams.row"
@ -135,13 +145,15 @@
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="盘点批次号" align="center" prop="lotnum" />
<el-table-column label="盘点批次号" align="center" prop="batchNumber" />
<el-table-column label="工单号" align="center" prop="taskId" />
<el-table-column label="位置" align="center" prop="row" >
<template #default="scope">
<space>{{ scope.row.streetName+"-"+ getDirectionName(scope.row.direction)+ scope.row.row+'层-'+scope.row.column+'列' }}</space>
</template>
</el-table-column>
<el-table-column
v-for="(column, index) in columns"
:key="index"
:label="column.remark"
@ -171,9 +183,9 @@
<el-table-column label="时间" align="center"
:formatter="dateFormatter" prop="createTime"/>
<el-table-column label="盘点图片" align="center" prop="pic">
<el-table-column label="盘点图片" align="center" prop="pic" min-width="150">
<template #default="scope">
<div v-if="scope.row.urlResources">
<div v-if="scope.row.urlResources" class="image-cell-container">
<el-image
v-for="(pic, index) in scope.row.urlResources"
:key="index"
@ -198,9 +210,9 @@
link
type="success"
@click="getDialogVisible(scope.row.streetName,scope.row.direction,scope.row.row, scope.row.column,scope.row.id)"
v-hasPermi="['logistics:check-log:success']"
v-hasPermi="['logistics:check-log:delete']"
>
操作
操作
</el-button>
<el-button
@ -259,7 +271,7 @@ const total = ref(0) // 列表的总页数
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
lotnum: undefined,
batchNumber: undefined,
row: undefined,
column: undefined,
streetId: undefined,
@ -401,6 +413,15 @@ onMounted(() => {
})
</script>
<style scoped>
.image-cell-container {
overflow-x: auto;
white-space: nowrap;
}
.image-cell-container::-webkit-scrollbar {
height: 6px;
}
.image__error .image-slot {
font-size: 30px;
}

@ -136,10 +136,11 @@
</el-table-column> -->
<el-table-column label="位置" align="center" prop="row" >
<template #default="scope">
<space >{{ scope.row.srmNumber+"-"+ (scope.row.toDirection?"左侧-":"右侧-")+ scope.row.toRow+'层-'+scope.row.toColumn+'列' }}</space>
<space >{{ position(scope.row)}}</space>
</template>
</el-table-column>
<el-table-column label="图片" align="center" prop="pics" min-width="150">
<template #default="scope">
@ -161,11 +162,23 @@
</div>
</template>
</el-table-column>
<el-table-column label="时间" align="center" prop="row" min-width="30">
<template #default="scope">
<span v-if="scope.row.endTime">
{{ formatTimeDiff(scope.row.startTime, scope.row.endTime) }}
</span>
<span v-else>
未结束
</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
v-if="scope.row.videoPath1 && scope.row.videoPath1.trim() !== '' &&
scope.row.videoPath2 && scope.row.videoPath2.trim() !== ''"
scope.row.videoPath2 && scope.row.videoPath2.trim() !== '' &&
scope.row.endTime"
link
type="primary"
@click="videoPlay(scope.row.videoPath1,scope.row.videoPath2)"
@ -281,6 +294,34 @@ const videoPlay = (video1: string, video2: string) => {
})
})
}
/**
* 计算两个时间之间的差值并格式化为 分钟:
* @param startTime 开始时间
* @param endTime 结束时间
* @returns 格式化后的时间差字符串
*/
const formatTimeDiff = (startTime: string, endTime: string): string => {
const start = new Date(startTime).getTime();
const end = new Date(endTime).getTime();
const diffMs = end - start; //
if (diffMs <= 0) return '0:00';
const totalSeconds = Math.floor(diffMs / 1000);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
};
/**
* 计算位置string
*/
const position = (row): string => {
const from =row.fromSide==2?"库外": row.srmNumber+"-"+ (row.fromDirection?"左侧-":"右侧-")+ row.fromRow+'层-'+row.fromColumn+'列' +(row.fromSeparation==2?"深货位":"")
const to = row.toSide==2?"库外":row.srmNumber+"-"+ (row.toDirection?"左侧-":"右侧-")+ row.toRow+'层-'+row.toColumn+'列' +(row.toSeparation==2?"深货位":"")
return from+"->"+to;
};
/** 查询列表 */
const getList = async () => {
loading.value = true
@ -365,7 +406,6 @@ onMounted(() => {
</script>
<style scoped>
.image-cell-container {
display: flex;
overflow-x: auto;
white-space: nowrap;
}

@ -207,7 +207,7 @@ interface ButtonVo {
id?: number; //
streetId?: number;
orderNum?: string;
lotnum?: string;
batchNumber?: string;
checkNum?: string;
code?: string;
category?: string;

@ -103,7 +103,7 @@ export default {
},
{
label: '批次号',
value: response.lotnum || '-'
value: response.batchNumber || '-'
},
{
label: '盘点结果',

@ -83,6 +83,9 @@
<el-tab-pane label="RFID" name="rfids">
<RfidForm ref="RfidFormRef" :street-id="formData.id" />
</el-tab-pane>
<el-tab-pane label="货架号" name="shelfCode">
<ShelfCodeForm ref="shelfCodeRef" :street-id="formData.id" />
</el-tab-pane>
</el-tabs>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
@ -96,6 +99,7 @@ import { StreetApi, StreetVO } from '@/api/logistics/street'
import { CameraApi, CameraVO } from '@/api/logistics/camera'
import SensorGunForm from './components/SensorGunForm.vue'
import LightSourceForm from './components/LightSourceForm.vue'
import ShelfCodeForm from './components/ShelfCodeForm.vue'
import RfidForm from './components/RfidForm.vue'
/** 巷道 表单 */
defineOptions({ name: 'StreetForm' })
@ -128,6 +132,7 @@ const formRef = ref() // 表单 Ref
const subTabsName = ref('sensorGun')
const sensorGunFormRef = ref()
const lightSourceFormRef = ref()
const shelfCodeRef = ref()
const RfidFormRef = ref()
/** 打开弹窗 */
const open = async (type: string, id?: number) => {

@ -0,0 +1,121 @@
<template>
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
v-loading="formLoading"
label-width="0px"
:inline-message="true"
>
<el-table :data="formData" class="-mt-10px">
<el-table-column label="序号" type="index" width="100" />
<el-table-column label="左右" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.direction`" :rules="formRules.direction" class="mb-0px!">
<el-select v-model="row.direction" placeholder="请选择左右">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.DIRECTION)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="深浅" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.separation`" :rules="formRules.separation" class="mb-0px!">
<el-select v-model="row.separation" placeholder="请选择深浅">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.SIDE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="货架号" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.shelfCode`" :rules="formRules.shelfCode" class="mb-0px!">
<el-input v-model="row.shelfCode" placeholder="请输入货架号" />
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="60">
<template #default="{ $index }">
<el-button @click="handleDelete($index)" link></el-button>
</template>
</el-table-column>
</el-table>
</el-form>
<el-row justify="center" class="mt-3">
<el-button @click="handleAdd" round>+ 添加货架号</el-button>
</el-row>
</template>
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { StreetApi } from '@/api/logistics/street'
const props = defineProps<{
streetId: undefined // id
}>()
const formLoading = ref(false) //
const formData = ref([])
const formRules = reactive({
})
const formRef = ref() // Ref
/** 监听主表的关联字段的变化,加载对应的子表数据 */
watch(
() => props.streetId,
async (val) => {
// 1.
formData.value = []
// 2. val
if (!val) {
return;
}
try {
formLoading.value = true
formData.value = await StreetApi.getShelfCodeListByStreetId(val)
} finally {
formLoading.value = false
}
},
{ immediate: true }
)
/** 新增按钮操作 */
const handleAdd = () => {
const row = {
id: undefined,
streetId: undefined,
direction: undefined,
separation: undefined,
shelfCode: undefined,
}
row.streetId = props.streetId
formData.value.push(row)
}
/** 删除按钮操作 */
const handleDelete = (index) => {
formData.value.splice(index, 1)
}
/** 表单校验 */
const validate = () => {
return formRef.value.validate()
}
/** 表单值 */
const getData = () => {
return formData.value
}
defineExpose({ validate, getData })
</script>

@ -55,15 +55,14 @@
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="巷道id" align="center" prop="plcId" />
<el-table-column label="巷道标识符" align="center" prop="plcId" />
<el-table-column label="巷道ip" align="center" prop="plcIp" />
<el-table-column label="巷道端口" align="center" prop="plcPort" />
<el-table-column label="左货架类型" align="center" prop="leftType">
<!--<el-table-column label="左货架类型" align="center" prop="leftType">
<template #default="scope">
<dict-tag :type="DICT_TYPE.SHELVES_TYPE" :value="scope.row.leftType" />
</template>
</el-table-column>
<el-table-column label="左货架列数量" align="center" prop="leftColumn" />
<el-table-column label="左货架列数量" align="center" prop="leftColumn" />
<el-table-column label="左货架行数量" align="center" prop="leftRow" />
<el-table-column label="右货架类型" align="center" prop="rightType">
<template #default="scope">
@ -80,7 +79,7 @@
prop="updateTime"
:formatter="dateFormatter"
width="180px"
/>
/> -->
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button

Loading…
Cancel
Save