From c4f8cc1f88a83de4784b5fc90496ff79d377e321 Mon Sep 17 00:00:00 2001 From: hwh <332078369@qq.com> Date: 星期五, 06 九月 2024 16:51:35 +0800 Subject: [PATCH] 设备监控设置 --- Web/src/views/device/deviceMonitor/index.vue | 73 ++++++++++++++++++++---------------- 1 files changed, 41 insertions(+), 32 deletions(-) diff --git a/Web/src/views/device/deviceMonitor/index.vue b/Web/src/views/device/deviceMonitor/index.vue index 66a81a1..03e945c 100644 --- a/Web/src/views/device/deviceMonitor/index.vue +++ b/Web/src/views/device/deviceMonitor/index.vue @@ -4,16 +4,14 @@ <el-card class="box-card"> <div slot="header" class="linefix"> <span>杈撻�佺嚎</span> - <div - :class="['lineStatus', { 'device-status-0': stationValue.status === true }, { 'device-status-1': stationValue.status === false }]"> - </div> + <div :class="['lineStatus', stationValue.status ? 'device-status-0' : 'device-status-1']"></div> </div> <div class="choosefix"> <el-select v-model="lineValue" placeholder="璇烽�夋嫨" @change="handleLineChange('item', $event)"> - <el-option v-for="item in lineOptions" :key="item.value" :label="item.label" - :value="item.value"></el-option> + <el-option v-for="item in lineOptions" :key="item.id" :label="item.text" + :value="item.id"></el-option> </el-select> - <el-select v-model="stationValue" placeholder="璇烽�夋嫨" style="margin-top: 10px;" + <el-select v-model="stationValue" placeholder="璇烽�夋嫨" style="margin-top: 10px;" filterable value-key="stationNum"> <el-option v-for="item in listStationsData" :key="item.id" :label="item.stationNum" :value="item"> @@ -27,8 +25,9 @@ </el-form-item> <el-form-item label="浠诲姟绫诲瀷"> <el-select clearable v-model="stationValue.taskType" placeholder="璇烽�夋嫨浠诲姟绫诲瀷"> - <el-option v-for="(item,index) in dl('TaskTypeEnum')" :key="index" :value="Number(item.value)" :label="`${item.name} [${item.value}]`"></el-option> - </el-select> + <el-option v-for="(item, index) in dl('TaskTypeEnum')" :key="index" + :value="Number(item.value)" :label="`${item.name} [${item.value}]`"></el-option> + </el-select> </el-form-item> <el-form-item label="璧峰宸ヤ綅"> <el-input v-model="stationValue.startLocatNo"></el-input> @@ -54,7 +53,7 @@ <el-form label-position="left" label-width="80px"> <el-form-item> <el-button>鍐欏叆</el-button> - <el-button>璁剧疆</el-button> + <el-button @click="openDialog">璁剧疆</el-button> </el-form-item> </el-form> </div> @@ -77,8 +76,7 @@ <el-form-item label="浠诲姟绫诲瀷"> <el-select clearable="" v-model="deviceInfo.taskType" placeholder="璇烽�夋嫨鐘舵��"> <el-option v-for="(item, index) in dl('TaskTypeEnum')" :key="index" - :value="Number(item.value)" - :label="`${item.name} [${item.value}] `" /> + :value="Number(item.value)" :label="`${item.name} [${item.value}] `" /> </el-select> </el-form-item> <el-form-item label="璧峰宸ヤ綅"> @@ -102,13 +100,13 @@ <el-form label-position="left"> <el-form-item> <el-button>鍐欏叆</el-button> - <el-button>璁剧疆</el-button> </el-form-item> </el-form> </div> </el-card> </div> </el-main> + <setting ref="settingDialogRef" :title="title" v-model:listStationsData="listStationsData" v-model:stationValue="stationValue" /> </el-container> </template> @@ -116,51 +114,56 @@ import { ref, reactive } from 'vue'; import { listWcsDevice } from '/@/api/wcs/wcsDevice'; import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; -import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; +import { listWcsPlc } from '/@/api/wcs/wcsPlc'; + +import setting from '/@/views/device/deviceMonitor/component/setting.vue' const stations = ref<any>([]); const listStationsData = ref<any>([]); const listStackingMachineData = ref<any>([]); - +const lineOptions = ref<any>([]); const lineValue = ref(1); +const title = ref<string>(''); const stationValue = ref<any>({ taskNo: '', taskType: '', - startLocatNo:'', + startLocatNo: '', endLocatNo: '', plc: '', wcs: '', status: false }); - +const settingDialogRef = ref(); +// 鎵撳紑鎵撳嵃椤甸潰 +const openDialog = async () => { + settingDialogRef.value.openDialog(stationValue); +} // 鏌ヨ鎿嶄綔 const handleQuery = async () => { + var listplc = await listWcsPlc({ type: 1 }); + lineOptions.value = listplc.data.result; + lineValue.value = listplc.data.result[0].id; var res = await listWcsDevice(); listStackingMachineData.value = res.data.result.filter(s => s.type == 0); - const listConveyorLineData = res.data.result.filter(s => s.type == 1 || s.type == 4); - stations.value = { - 1: listConveyorLineData.filter(s => s.text == '1灞傛墭鐩樿緭閫佺嚎'), - 2: listConveyorLineData.filter(s => s.text == '2灞傛墭鐩樿緭閫佺嚎'), - 3: listConveyorLineData.filter(s => s.text == '3灞傛墭鐩樿緭閫佺嚎') - } - if (stations.value[1].length > 0) { - listStationsData.value = stations.value[1]; + const listConveyorLineData = res.data.result.filter(s => s.type == 1); + listplc.data.result.forEach(s => { + stations.value[s.id] = listConveyorLineData.filter(c => c.plcId === s.id) + }); + if (stations.value[lineValue.value].length > 0) { + listStationsData.value = stations.value[lineValue.value]; stationValue.value = listStationsData.value[0]; } + title.value = listStationsData.value[0].text; }; + handleQuery(); const handleLineChange = (field: string, value: number) => { listStationsData.value = stations.value[value]; - stationValue.value = {}; + title.value = lineOptions.value.filter(s => s.id == value)[0].text; + if (listStationsData.value.length > 0) + stationValue.value = listStationsData.value[0]; }; - - -const lineOptions = [ - { value: 1, label: '涓�妤艰緭閫佺嚎' }, - { value: 2, label: '浜屾ゼ杈撻�佺嚎' }, - { value: 3, label: '涓夋ゼ杈撻�佺嚎' } -]; </script> @@ -173,6 +176,12 @@ margin-bottom: 10px; } +.el-button { + background-color: #fff; + border-color: #fff; + color: #000000; +} + .linefix { border-bottom: 1px solid rgb(197, 195, 195); display: flex; -- Gitblit v1.8.0