From 9d7f402fe2f147b8108833a64e6182f52ea160c4 Mon Sep 17 00:00:00 2001 From: hwh <332078369@qq.com> Date: 星期五, 13 九月 2024 09:49:27 +0800 Subject: [PATCH] 默认分页20行 --- Web/src/views/device/sortPallet/index.vue | 300 +++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 177 insertions(+), 123 deletions(-) diff --git a/Web/src/views/device/sortPallet/index.vue b/Web/src/views/device/sortPallet/index.vue index 92f969e..f88de32 100644 --- a/Web/src/views/device/sortPallet/index.vue +++ b/Web/src/views/device/sortPallet/index.vue @@ -1,6 +1,6 @@ <template> <el-container> - <el-cloum> + <el-col> <el-row :span="1"> <div class="card-page"> <el-button @@ -14,159 +14,205 @@ </el-button> </div> </el-row> - <el-row :span="2"> + <el-row :span="1"> <div class="card-container"> <el-card class="other-box-card" v-for="deviceInfo in devicePointData" :key="deviceInfo.id"> <div slot="header" class="linefix"> - <span>{{ deviceInfo.name }}</span> - <div :class="['lineStatus', { 'device-status-0': deviceInfo.status === 0 }, { 'device-status-1': deviceInfo.status === 1 }]"></div> + <span>{{ deviceInfo.text }}</span> + <div :class="['lineStatus', 'device-status-0']"></div> + <!-- <div :class="['lineStatus', { 'device-status-0': deviceInfo.status === 0 }, { 'device-status-1': deviceInfo.status === 1 }]"></div> --> </div> <div class="otherValuefix" > <el-form label-position="left" label-width="90px"> <el-form-item label="WMS鏄庣粏鍗曞彿"> - <el-input></el-input> + <el-input v-model="deviceInfo.orderNo" readonly></el-input> </el-form-item> <el-form-item label="浠诲姟鍙�"> - <el-input v-model="deviceInfo.taskNumber"></el-input> + <el-input v-model="deviceInfo.taskNo"></el-input> + </el-form-item> + <el-form-item label="鎵规鍙�"> + <el-input v-model="deviceInfo.lotNo" readonly></el-input> </el-form-item> <el-form-item label="鐗╂枡缂栫爜"> - <el-input></el-input> + <el-input v-model="deviceInfo.skuNo" readonly></el-input> </el-form-item> <el-form-item label="鐗╂枡鍚嶇О"> - <el-input></el-input> + <el-input v-model="deviceInfo.skuName" readonly></el-input> </el-form-item> - <el-form-item label="鍖呰鍚嶇О"> - <el-input></el-input> + <el-form-item label="鍒嗘嫞绾跨紪鍙�"> + <el-input v-model="deviceInfo.lineNo" readonly></el-input> </el-form-item> - <el-form-item label="鐘舵��"> - <el-input></el-input> + <el-form-item label="缁戝畾鐘舵��"> + <el-input :value="deviceInfo.status === '0' ? '鏈粦瀹�' : '宸茬粦瀹�'" readonly></el-input> </el-form-item> <el-form-item label="鎶撶鍝佺"> - <el-input></el-input> - </el-form-item> - <el-form-item label="DB璁板綍绠辨暟"> - <el-input></el-input> + <el-input v-model="deviceInfo.pzNo" readonly></el-input> </el-form-item> <el-form-item label="鎵樼洏鍙�"> - <el-input></el-input> + <el-input readonly></el-input> </el-form-item> - <el-form-item label="鐮佸灈绠辨暟"> - <el-input></el-input> + <el-form-item label="鎻掔爜鏁伴噺"> + <el-input readonly></el-input> + </el-form-item> + <el-form-item label="鎵樼洏涓婄鏁伴噺"> + <el-input readonly></el-input> </el-form-item> <el-form-item label="WMS涓嬪彂鏁伴噺"> - <el-input></el-input> + <el-input v-model="deviceInfo.qty" readonly></el-input> </el-form-item> </el-form> </div> - <div class="otherButtonfix"> + <div v-if="!deviceInfo.text.includes('鎷嗗灈')" class="otherButtonfix"> <el-form label-position="left"> <el-form-item> - <el-button type="primary">缁戝畾</el-button> - <el-button>缁撴壒</el-button> + <el-button type="primary" @click="openBindDialog(deviceInfo.id)">缁戝畾</el-button> + <el-button @click="closeBindDialog(deviceInfo.lotNo)">缁撴壒</el-button> </el-form-item> </el-form> </div> </el-card> </div> </el-row> - </el-cloum> - </el-container> + </el-col> + + <!-- 缁戝畾浠诲姟寮规 --> + <el-dialog v-model="bindDialogVisible" title="閫夋嫨鏁版嵁"> + <el-table + :data="bindData" + highlight-current-row + @row-click="handleRowClick" + > + <el-table-column prop="orderNo" label="WMS涓嬪彂鍗曞彿" show-overflow-tooltip="" /> + <el-table-column prop="taskNo" label="浠诲姟鍙�" show-overflow-tooltip="" /> + <el-table-column prop="lotNo" label="鎵规鍙�" show-overflow-tooltip="" /> + <el-table-column prop="skuNo" label="鐗╂枡缂栫爜" show-overflow-tooltip="" /> + <el-table-column prop="skuName" label="鐗╂枡鍚嶇О" show-overflow-tooltip="" /> + <el-table-column prop="boxType" label="瑙勬牸" show-overflow-tooltip="" /> + <el-table-column prop="qty" label="鎬荤鏁�/璁″垝绠辨暟/棰勪及绠辨暟" show-overflow-tooltip="" /> + </el-table> + <div slot="footer" class="dialog-footer"> + <el-button @click="bindDialogVisible = false">鍙栨秷</el-button> + <el-button type="primary" @click="confirmBinding">纭</el-button> + </div> + </el-dialog> + </el-container> </template> - <script lang="ts" setup> - import { ref } from 'vue'; +<script lang="ts" setup> +import { ref } from 'vue'; +import { GetWcsPackPlcList,GetWcsPackStationPlcList,BindTaskForPLC,CloseTaskForPLC } from '/@/api/wcs/wcsDevice'; +import { pageWcsOderTask } from '/@/api/device/wcsOderTask'; +import { ElMessageBox,ElMessage } from 'element-plus'; - const deviceList=[ - { - id: 1, - name: '1鍙锋満鍣ㄤ汉' - }, - { - id: 2, - name: '2鍙锋満鍣ㄤ汉' - }, - { - id: 3, - name: '3鍙锋満鍣ㄤ汉' - }, - ]; +//璁惧鏁版嵁 +const deviceList=ref<any>([]); +//璁惧瀵瑰簲宸ヤ綅鏁版嵁 +const devicePointData = ref<any>([]); +//閫変腑璁惧ID +const selectedDeviceId=ref<any>(); +//閫変腑宸ヤ綅ID +const selectedStationId=ref<any>(); - const devicePointList=[ - { - id: 1, - deviceId:1, - name: '1鍙锋満鍣ㄤ汉 1宸ヤ綅', - taskNumber: 'T000001', - taskType: '', - plc: '', - wcs: '', - status: 0 - }, - { - id: 2, - deviceId:1, - name: '1鍙锋満鍣ㄤ汉 2宸ヤ綅', - taskNumber: '', - taskType: '', - plc: '', - wcs: '', - status: 1 - }, - { - id: 3, - deviceId:1, - name: '1鍙锋満鍣ㄤ汉 3宸ヤ綅', - taskNumber: '', - taskType: '', - plc: '', - wcs: '', - status: 1 - }, - { - id: 4, - deviceId:2, - name: '2鍙锋満鍣ㄤ汉 1宸ヤ綅', - taskNumber: 'T000001', - taskType: '', - plc: '', - wcs: '', - status: 0 - }, - { - id: 5, - deviceId:2, - name: '2鍙锋満鍣ㄤ汉 2宸ヤ綅', - taskNumber: '', - taskType: '', - plc: '', - wcs: '', - status: 1 - }, - { - id: 6, - deviceId:3, - name: '3鍙锋満鍣ㄤ汉 1宸ヤ綅', - taskNumber: 'T000001', - taskType: '', - plc: '', - wcs: '', - status: 0 - } - ]; +const bindDialogVisible = ref(false); +const bindData = ref<any>([]); +const selectedRow = ref<any>(null); +const queryParams = ref<any>({}); +const tableParams = ref({ + page: 1, + pageSize: 20, + total: 0, +}); - //杈撻�佺嚎鏁版嵁 - let devicePointFirst= devicePointList.filter(device => device.deviceId === deviceList[0].id) - let devicePointData = ref(devicePointFirst); - let selectedDeviceId = ref(deviceList[0].id); +//鑾峰彇璁惧瀵瑰簲鐨勫伐浣嶆暟鎹� +const fetchStationData = async (plcId: any) => { + const res2 = await GetWcsPackStationPlcList({ plcId }); + devicePointData.value = res2.data.result; +}; +// 鑾峰彇璁惧鏁版嵁 +const fetchPLCDeviceData = async () => { + var res = await GetWcsPackPlcList(); + deviceList.value = res.data.result; - //鍒囨崲灞傚钩闈� - function chooseDevice(id) { - selectedDeviceId.value = id; - devicePointData.value = devicePointList.filter(device => device.deviceId === id); + if (deviceList.value.length > 0) { + selectedDeviceId.value = deviceList.value[0].id; + await fetchStationData(selectedDeviceId.value); } - </script> - - <style scoped> +}; +fetchPLCDeviceData(); + +//鍒囨崲璁惧 +function chooseDevice(id) { + selectedDeviceId.value = id; + fetchStationData(selectedDeviceId.value); +} + +const handleQuery = async () => { + var res = await pageWcsOderTask(Object.assign(queryParams.value, tableParams.value)); + bindData.value = res.data.result?.items ?? []; + tableParams.value.total = res.data.result?.total; + }; +//鎵撳紑缁戝畾寮规 +function openBindDialog(id) { + selectedStationId.value=null; + selectedRow.value=null; + + selectedStationId.value=id; + bindDialogVisible.value = true; + + handleQuery(); +} +//鐐瑰嚮琛屾椂璁剧疆閫変腑琛� +function handleRowClick(row) { + selectedRow.value = row; +} + +//纭缁戝畾鎿嶄綔 +function confirmBinding() { + if (selectedRow.value) { + //鎵嬪姩缁戝畾浠诲姟鍒癙LC + bindTaskForPLC(selectedStationId.value,selectedRow.value.id); + + bindDialogVisible.value = false; + } else { + ElMessage.error('璇烽�夋嫨瑕佺粦瀹氱殑浠诲姟锛�'); + } +} +const bindTaskForPLC = async (deviceId: any,oderTaskId:any) => { + const res = await BindTaskForPLC({ deviceId,oderTaskId }); + if(res.status==200){ + ElMessage.success('缁戝畾鎴愬姛锛�'); + // 鍒锋柊 + fetchStationData(selectedDeviceId.value); + } +} +//缁撴壒鎿嶄綔 +function closeBindDialog(lotNo){ + if(lotNo==''){ + ElMessage.error('璇ュ伐浣嶆湭缁戝畾浠诲姟锛�'); + return; + } + ElMessageBox.confirm(`纭畾瀵硅鎵规浠诲姟缁撴壒鍚�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }) + .then(async () => { + closeTaskForPLC(lotNo); + }) + .catch(() => {}); +} +const closeTaskForPLC = async (lotNo: string) => { + const res = await CloseTaskForPLC({ lotNo }); + if(res.status==200){ + ElMessage.success('缁撴壒鎴愬姛锛�'); + // 鍒锋柊 + fetchStationData(selectedDeviceId.value); + } +} + +</script> + +<style scoped> .card-page { width: 100%; height: 50px; @@ -181,13 +227,13 @@ height: 30px; } .card-container { - display: grid; - grid-template-columns: repeat(6, 1fr); - gap: 10px; + display: grid; + grid-template-columns: repeat(6, 1fr); + gap: 10px; } - .other-box-card { - box-sizing: border-box; - background: linear-gradient(135deg, #66ccff, #3399ff); + .other-box-card { + box-sizing: border-box; + background: linear-gradient(135deg, #66ccff, #3399ff); } .lineStatus{ position: absolute; @@ -208,13 +254,13 @@ } .otherValuefix{ width: 100%; - height: 550px; + height: 540px; padding: 10px; border-bottom: 1px solid rgb(197, 195, 195); } .otherButtonfix{ width: 100%; - height: 100px; + height: 60px; display: flex; align-items: center; justify-content: center; @@ -226,5 +272,13 @@ .device-status-1{ background-color: red; } - </style> + .dialog-footer { + display: flex; + justify-content: flex-end; + margin-top: 20px; + } + .divDisplay{ + display:none + } +</style> \ No newline at end of file -- Gitblit v1.8.0