From ccc970e575ef3f3e5c67af8da210263f4ac549f9 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 10 四月 2026 16:44:55 +0800
Subject: [PATCH] 2026.4.10
---
src/views/inspection/check/components/CompDeviceShowTest.vue | 277 ++++++++++++++++++++++++++++---------------------------
1 files changed, 140 insertions(+), 137 deletions(-)
diff --git a/src/views/inspection/check/components/CompDeviceShowTest.vue b/src/views/inspection/check/components/CompDeviceShowTest.vue
index 1daa0e4..112a4ab 100644
--- a/src/views/inspection/check/components/CompDeviceShowTest.vue
+++ b/src/views/inspection/check/components/CompDeviceShowTest.vue
@@ -5,21 +5,10 @@
<!-- 璁惧绫诲瀷 -->
<el-row>
<el-col>
- <el-tabs
- class="child_select"
- placeholder="璁惧绫诲瀷"
- v-model="currSelect.topDeviceTypeId"
- >
- <el-tab-pane
- v-for="item in deviceTopTypes"
- :key="item.id"
- :name="item.id"
- >
+ <el-tabs class="child_select" placeholder="璁惧绫诲瀷" v-model="currSelect.topDeviceTypeId">
+ <el-tab-pane v-for="item in deviceTopTypes" :key="item.id" :name="item.id">
<template #label>
- <el-badge
- :value="item.count"
- :type="item.count == 0 ? 'danger' : 'primary'"
- >
+ <el-badge :value="item.count" :type="item.count == 0 ? 'danger' : 'primary'">
<span class="custom-tabs-label">
<span>{{ item.label }}</span>
</span>
@@ -37,22 +26,42 @@
class="collapse-item-class"
>
<template #title>
- <div
- style="display: flex; width: 100%; justify-content: space-between"
- >
+ <div style="display: flex; width: 100%; justify-content: space-between">
<div style="">
- <el-descriptions style="" :column="3" size="small" border>
+ <el-descriptions style="" :column="4" size="small" border>
<el-descriptions-item
- width="64px"
- :label="
- currSelect.topDeviceTypeId == 0 ? '绔欑偣鍚嶇О' : '璁惧鍚嶇О'
- "
- :span="3"
+ :label="currSelect.topDeviceTypeId == 0 ? '绔欑偣鍚嶇О' : '璁惧鍚嶇О'"
>{{ item.name || '鏃�' }}</el-descriptions-item
>
+ <el-descriptions-item label="鍝佺墝鍨嬪彿">{{
+ item.brandModel || '鏃�'
+ }}</el-descriptions-item>
<el-descriptions-item label="渚涘簲鍟�">{{
item.supplier || '鏃�'
}}</el-descriptions-item>
+ <el-descriptions-item :rowspan="3">
+ <div style="display: flex">
+ <div class="image-container">
+ <div
+ class="block-div"
+ @click="onClickPic($event)"
+ v-for="(status, index) in item._statusList"
+ :key="index"
+ >
+ <el-image
+ v-if="index == 0"
+ fit="cover"
+ class="pic-style"
+ :src="status._picUrl"
+ :preview-src-list="Array.of(status._picUrl)"
+ />
+ <span class="abstract_pic_text" v-if="index == 0">{{
+ `鏈�鏂扮姸鎬� ${status.dlCreateTime.slice(0, 10)}`
+ }}</span>
+ </div>
+ </div>
+ </div>
+ </el-descriptions-item>
<el-descriptions-item label="杩愮淮鍟�">{{
item.maintainer || '鏃�'
}}</el-descriptions-item>
@@ -76,9 +85,6 @@
<el-descriptions-item label="杩愮淮鑱旂郴鏂瑰紡">{{
item.maintainTel || '鏃�'
}}</el-descriptions-item>
- <el-descriptions-item label="鍝佺墝鍨嬪彿">{{
- item.brandModel || '鏃�'
- }}</el-descriptions-item>
<el-descriptions-item label="杩愯鐘舵��">
<el-select
v-model="item.runningStatus"
@@ -96,12 +102,11 @@
<el-descriptions-item label="绫诲瀷">
{{ item._typename || '鏃�' }}
</el-descriptions-item>
+
</el-descriptions>
</div>
- <div style="display: flex">
- <!-- <div class="sub-title">{{ item.name }}</div> -->
- <!-- 鍥剧墖 -->
+ <!-- <div style="display: flex">
<div class="image-container">
<div
class="block-div"
@@ -121,7 +126,7 @@
}}</span>
</div>
</div>
- </div>
+ </div> -->
</div>
</template>
<!-- 璇︾粏鍐呭寮�濮� -->
@@ -168,19 +173,19 @@
</template>
<script>
-import deviceApi from '@/api/fysp/deviceApi';
-import { $fysp } from '@/api/index';
-import { toLabel } from '@/enum/device/device';
+import deviceApi from '@/api/fysp/deviceApi'
+import { $fysp } from '@/api/index'
+import { toLabel } from '@/enum/device/device'
export default {
- components: { },
+ components: {},
watch: {
// 閫夋嫨鏀瑰彉鐩戝惉
currSelect: {
handler(newObj, oldObj) {
- this.getList();
+ this.getList()
},
- deep: true
- }
+ deep: true,
+ },
},
data() {
return {
@@ -192,7 +197,7 @@
// 琛ㄥ崟璇︽儏鐐瑰嚮鎸夐挳鐨勫浘鏍�
isDetail: false,
currSelect: {
- topDeviceTypeId: 0
+ topDeviceTypeId: 0,
},
// 鎺у埗琛ㄥ崟鏄惁鍙互缂栬緫
isDisabled: true,
@@ -202,29 +207,29 @@
deviceTopTypes: [
{ id: 0, label: '鐩戞帶璁惧' },
{ id: 1, label: '娌荤悊璁惧' },
- { id: 2, label: '鐢熶骇璁惧' }
+ { id: 2, label: '鐢熶骇璁惧' },
],
// 杩愯鐘舵��
runStatusArray: [
{ key: 0, value: '鏈仈缃�' },
{ key: 1, value: '涓婄嚎涓�' },
{ key: 2, value: '涓嬬嚎' },
- { key: 3, value: '鎷嗛櫎' }
+ { key: 3, value: '鎷嗛櫎' },
],
// 缁存姢棰戠巼鐘舵��
maintainFrequencysArray: [
{ key: 1, value: '姣忔湀涓�娆�' },
{ key: 2, value: '姣忓搴︿竴娆�' },
{ key: 3, value: '姣忓崐骞翠竴娆�' },
- { key: 4, value: '姣忓勾涓�娆�' }
+ { key: 4, value: '姣忓勾涓�娆�' },
],
// 绉熻祦鏂瑰紡
ownershipArray: [
{ key: 0, value: '璐拱' },
- { key: 1, value: '绉熻祦' }
+ { key: 1, value: '绉熻祦' },
],
- scene: {}
- };
+ scene: {},
+ }
},
props: {},
@@ -234,169 +239,167 @@
getTabsCount() {
this.deviceTopTypes.forEach((item) => {
deviceApi.fetchDevices(this.scene.guid, item.id).then((result) => {
- item.count = result.data.length;
- });
- });
+ item.count = result.data.length
+ })
+ })
},
// 鑾峰彇杩愯鐘舵�佸搴旂殑value
getRunStatusValueByRunStatusKey(status) {
var runningStatusValueArray = this.runStatusArray.filter((runStatus) => {
- return runStatus.key == status;
- });
+ return runStatus.key == status
+ })
if (runningStatusValueArray.length > 0) {
- return runningStatusValueArray[0].value;
+ return runningStatusValueArray[0].value
}
},
// 灞曠ず琛ㄥ崟鐨勮鎯呯殑鐐瑰嚮浜嬩欢
showDetail(item) {
- item._isDetail = !item._isDetail;
+ item._isDetail = !item._isDetail
},
init(scene) {
// 鐖剁粍浠朵富鍔ㄨ皟鐢ㄥ垵濮嬪寲瀛愮粍浠剁殑鏂规硶
- this.scene = scene;
+ this.scene = scene
- this.getList();
- this.getTabsCount();
+ this.getList()
+ this.getTabsCount()
},
// 閲嶇疆灞曠ず鐨勬暟鎹�
initList() {
- this.formInfo = [];
- this.isEmpty = false;
+ this.formInfo = []
+ this.isEmpty = false
},
// 鏍囧噯鍖栧睘鎬у悕
convertKeys(obj) {
// 灏嗕竴涓猨s瀵硅薄涓墍鏈塪i锛寃i锛宲i寮�澶寸殑灞炴�у叏閮ㄦ敼鎴愬幓鎺夎繖浜涘墠缂�骞朵笖閲嶆柊鍙樹负椹煎嘲寮忓懡鍚�
- const newObj = {};
+ const newObj = {}
for (const key in obj) {
- let newKey = key;
+ let newKey = key
if (key.startsWith('di')) {
- newKey = key.substring(2);
+ newKey = key.substring(2)
} else if (key.startsWith('wi')) {
- newKey = key.substring(2);
+ newKey = key.substring(2)
} else if (key.startsWith('pi')) {
- newKey = key.substring(2);
+ newKey = key.substring(2)
}
- newKey = newKey.charAt(0).toLowerCase() + newKey.slice(1);
- newObj[newKey] = obj[key];
+ newKey = newKey.charAt(0).toLowerCase() + newKey.slice(1)
+ newObj[newKey] = obj[key]
}
- return newObj;
+ return newObj
},
// 鏂板瀛楁
initFormData(data) {
- data._isDetail = false;
+ data._isDetail = false
},
getList() {
- deviceApi
- .fetchDevices(this.scene.guid, this.currSelect.topDeviceTypeId)
- .then((result) => {
- this.initList();
- if (result.data == null || result.data.length <= 0) {
- this.isEmpty = true;
- return;
+ deviceApi.fetchDevices(this.scene.guid, this.currSelect.topDeviceTypeId).then((result) => {
+ this.initList()
+ if (result.data == null || result.data.length <= 0) {
+ this.isEmpty = true
+ return
+ }
+ // 鏍囧噯鍖栧睘鎬у悕
+ for (let index = 0; index < result.data.length; index++) {
+ var element = this.convertKeys(result.data[index])
+ this.initFormData(element)
+ // 鑾峰彇璁惧鐘舵�佷俊鎭�
+ let data = {
+ deviceId: element.id,
+ sceneId: element.sceneGuid,
+ deviceTypeId: this.currSelect.topDeviceTypeId,
}
- // 鏍囧噯鍖栧睘鎬у悕
- for (let index = 0; index < result.data.length; index++) {
- var element = this.convertKeys(result.data[index]);
- this.initFormData(element);
- // 鑾峰彇璁惧鐘舵�佷俊鎭�
- let data = {
- deviceId: element.id,
- sceneId: element.sceneGuid,
- deviceTypeId: this.currSelect.topDeviceTypeId
- };
- deviceApi.fetchDeviceStatus(data).then((status) => {
- var statusData = status.data;
- var imgPaths = [];
- if (statusData) {
- if (statusData.length == 0) {
- this.formInfo.push(element);
- return;
- }
- element = this.convertKeys(result.data[index]);
- element = this.setDeviceType(element);
- element._picUrls = imgPaths;
- for (let index = 0; index < statusData.length; index++) {
- const statusItem = statusData[index];
- // 璁惧瀵硅薄娣诲姞涓�涓睘鎬у垪琛ㄥ睘鎬х敤鏉ヤ繚瀛樿澶囩姸鎬�
- this.saveStatus(element, statusItem);
- element.dlLocation = statusItem.dlLocation;
- this.formInfo.push(element);
- }
+ deviceApi.fetchDeviceStatus(data).then((status) => {
+ var statusData = status.data
+ var imgPaths = []
+ if (statusData) {
+ if (statusData.length == 0) {
+ this.formInfo.push(element)
+ return
}
- });
- }
- });
+ element = this.convertKeys(result.data[index])
+ element = this.setDeviceType(element)
+ element._picUrls = imgPaths
+ for (let index = 0; index < statusData.length; index++) {
+ const statusItem = statusData[index]
+ // 璁惧瀵硅薄娣诲姞涓�涓睘鎬у垪琛ㄥ睘鎬х敤鏉ヤ繚瀛樿澶囩姸鎬�
+ this.saveStatus(element, statusItem)
+ element.dlLocation = statusItem.dlLocation
+ this.formInfo.push(element)
+ }
+ }
+ })
+ }
+ })
},
setDeviceType(element) {
- var type = [];
+ var type = []
type = toLabel(element.sceneTypeId, this.currSelect.topDeviceTypeId, [
element.typeId,
- element.subtypeId
- ]);
- element._typename = type.join('-');
- return element;
+ element.subtypeId,
+ ])
+ element._typename = type.join('-')
+ return element
},
// 淇濆瓨鐘舵�佷俊鎭�
saveStatus(device, status) {
- var _picUrl = $fysp.imgUrl + status.dlPicUrl;
- status._picUrl = _picUrl;
- status._paths = _picUrl.split(';');
- device._picUrls.push(_picUrl);
+ var _picUrl = $fysp.imgUrl + status.dlPicUrl
+ status._picUrl = _picUrl
+ status._paths = _picUrl.split(';')
+ device._picUrls.push(_picUrl)
if ('_statusList' in device) {
- device._statusList.push(status);
+ device._statusList.push(status)
} else {
- device._statusList = Array.of(status);
+ device._statusList = Array.of(status)
}
// 鎺掑簭
device._statusList.sort(function (x, y) {
- return new Date(x.dlCreateTime) - new Date(y.dlCreateTime); // 闄嶅簭锛屽崌搴忓垯鍙嶄箣
- });
+ return new Date(x.dlCreateTime) - new Date(y.dlCreateTime) // 闄嶅簭锛屽崌搴忓垯鍙嶄箣
+ })
},
submit() {},
cancel() {},
modifyObjectKeys(obj) {
- const newObj = {};
+ const newObj = {}
for (const key in obj) {
// 璺宠繃浠� 'dl' 鎴� '_' 寮�澶寸殑灞炴��
if (key.startsWith('dl') || key.startsWith('_')) {
- newObj[key] = obj[key];
- continue;
+ newObj[key] = obj[key]
+ continue
}
// 鏍规嵁 topDeviceTypeId 娣诲姞鍓嶇紑
- let prefix = '';
+ let prefix = ''
switch (this.currSelect.topDeviceTypeId) {
case 0:
- prefix = 'di';
- break;
+ prefix = 'di'
+ break
case 1:
- prefix = 'pi';
- break;
+ prefix = 'pi'
+ break
case 2:
- prefix = 'wi';
- break;
+ prefix = 'wi'
+ break
default:
// 濡傛灉 topDeviceTypeId 涓嶆槸 0, 1, 鎴� 2锛屼笉娣诲姞鍓嶇紑
- newObj[key] = obj[key];
- continue;
+ newObj[key] = obj[key]
+ continue
}
// 娣诲姞鍓嶇紑骞惰浆鎹负椹煎嘲寮忓懡鍚�
- const newKey = `${prefix}${key.charAt(0).toUpperCase() + key.slice(1)}`;
- newObj[newKey] = obj[key];
+ const newKey = `${prefix}${key.charAt(0).toUpperCase() + key.slice(1)}`
+ newObj[newKey] = obj[key]
}
- return newObj;
+ return newObj
},
// 鐢熸垚鎺ュ彛鍙傛暟
generateQuery(obj) {
// 闇�瑕佹牴鎹満鏅被鍨嬬‘瀹氭帴鍙e弬鏁扮殑灞炴�у悕
- var query = this.modifyObjectKeys(obj);
- return query;
+ var query = this.modifyObjectKeys(obj)
+ return query
},
onClickPic(e, item) {
- e.stopPropagation();
- }
- }
-};
+ e.stopPropagation()
+ },
+ },
+}
</script>
<style scoped>
--
Gitblit v1.9.3