From 20cdb83586daabfb15fc056c4c97eb8e7ccaf928 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 20 三月 2026 17:07:16 +0800
Subject: [PATCH] 2026.3.20
---
src/views/inspection/task/components/CompMonitorObjEdit.vue | 355 +++++++++++++++++++++++++++--------------------------------
1 files changed, 163 insertions(+), 192 deletions(-)
diff --git a/src/views/inspection/task/components/CompMonitorObjEdit.vue b/src/views/inspection/task/components/CompMonitorObjEdit.vue
index 01de63a..44d70a3 100644
--- a/src/views/inspection/task/components/CompMonitorObjEdit.vue
+++ b/src/views/inspection/task/components/CompMonitorObjEdit.vue
@@ -1,9 +1,6 @@
<template>
<el-row gutter="20">
- <el-col
- :span="16"
- style="border-right: 1px solid var(--el-color-info-light-7)"
- >
+ <el-col :span="16" style="border-right: 1px solid var(--el-color-info-light-7)">
<div>
<el-text>宸查�夊満鏅�</el-text>
<el-text type="info" size="small">{{ statisticText }}</el-text>
@@ -22,48 +19,38 @@
</el-col>
<el-col :span="8">
<!-- <el-affix :offset="140"> -->
- <div>
- <el-text>鍙�夊満鏅�</el-text>
- </div>
- <el-divider />
- <el-scrollbar class="scrollbar-flex-content" always >
- <!-- <el-segmented v-model="curSceneType" :options="sceneTypeOptions" /> -->
- <el-tabs v-model="curSceneType">
- <el-tab-pane
- v-for="item in sceneTypeOptions"
- :key="item"
- :label="item"
- :name="item"
- ></el-tab-pane>
- </el-tabs>
- </el-scrollbar>
- <FYInfoSearch
- placeholder="璇疯緭鍏ュ満鏅悕绉板叧閿瓧"
- :data="showSceneList"
- :on-search="searchScene"
- :total="total"
- scroll-height="60vh"
- :page-show="false"
- >
- <template #default="{ row }">
- <ItemScene :item="row">
- <el-button-group>
- <el-button
- size="small"
- type="primary"
- @click="openInsertDialog(row)"
- >鎻掑叆</el-button
- >
- <el-button
- size="small"
- type="primary"
- @click="openAddDialog(row)"
- >鏂板</el-button
- >
- </el-button-group>
- </ItemScene>
- </template>
- </FYInfoSearch>
+ <div>
+ <el-text>鍙�夊満鏅�</el-text>
+ </div>
+ <el-divider />
+ <el-scrollbar class="scrollbar-flex-content" always>
+ <!-- <el-segmented v-model="curSceneType" :options="sceneTypeOptions" /> -->
+ <el-tabs v-model="curSceneType">
+ <el-tab-pane
+ v-for="item in sceneTypeOptions"
+ :key="item"
+ :label="item"
+ :name="item"
+ ></el-tab-pane>
+ </el-tabs>
+ </el-scrollbar>
+ <FYInfoSearch
+ placeholder="璇疯緭鍏ュ満鏅悕绉板叧閿瓧"
+ :data="showSceneList"
+ :on-search="searchScene"
+ :total="total"
+ scroll-height="60vh"
+ :page-show="false"
+ >
+ <template #default="{ row }">
+ <ItemScene :item="row">
+ <el-button-group>
+ <el-button size="small" type="primary" @click="openInsertDialog(row)">鎻掑叆</el-button>
+ <el-button size="small" type="primary" @click="openAddDialog(row)">鏂板</el-button>
+ </el-button-group>
+ </ItemScene>
+ </template>
+ </FYInfoSearch>
<!-- </el-affix> -->
</el-col>
</el-row>
@@ -72,19 +59,12 @@
<div v-if="valibleIndex.length > 0">浠ヤ笅涓哄彲閫夌殑绌轰綑缂栧彿</div>
<div v-else>鏃犲彲閫夌殑绌轰綑缂栧彿</div>
<el-radio-group v-model="selectedIndex" size="default">
- <el-radio-button
- v-for="item in valibleIndex"
- :key="item"
- :label="item"
- :value="item"
- />
+ <el-radio-button v-for="item in valibleIndex" :key="item" :label="item" :value="item" />
</el-radio-group>
<template #footer>
<div class="dialog-footer">
<el-button @click="insertDialog = false">鍙栨秷</el-button>
- <el-button :disabled="!selectedIndex" type="primary" @click="insertMov">
- 纭
- </el-button>
+ <el-button :disabled="!selectedIndex" type="primary" @click="insertMov"> 纭 </el-button>
</div>
</template>
</el-dialog>
@@ -100,14 +80,14 @@
</template>
<script>
-import { useCloned } from '@vueuse/core';
-import CompMonitorObj from './CompMonitorObj.vue';
-import taskApi from '@/api/fysp/taskApi';
-import sceneApi from '@/api/fysp/sceneApi';
-import { ElMessage, ElNotification, ElMessageBox } from 'element-plus';
+import { useCloned } from '@vueuse/core'
+import CompMonitorObj from './CompMonitorObj.vue'
+import taskApi from '@/api/fysp/taskApi'
+import sceneApi from '@/api/fysp/sceneApi'
+import { ElMessage, ElNotification, ElMessageBox } from 'element-plus'
-const MODE_CREATE = 'create';
-const MODE_UPDATE = 'update';
+const MODE_CREATE = 'create'
+const MODE_UPDATE = 'update'
export default {
components: { CompMonitorObj },
@@ -115,18 +95,18 @@
// 缂栬緫妯″紡锛屾柊澧瀋reate鎴栨洿鏂皍pdate
mode: {
type: String,
- default: MODE_CREATE
+ default: MODE_CREATE,
},
create: Boolean,
// 宸℃煡鎬讳换鍔�
task: {
type: Object,
default: () => {
- return {};
- }
+ return {}
+ },
},
// 鐩戠鍦烘櫙闆嗗悎
- objList: Array
+ objList: Array,
},
data() {
return {
@@ -157,19 +137,19 @@
// 鍒犻櫎鐨勭洃绠″満鏅�
deleteObj: [],
// 鏇存柊鐨勫満鏅熀鏈俊鎭紙鏇存柊鍦烘櫙鐨勭紪鍙凤級
- updateScene: []
- };
+ updateScene: [],
+ }
},
emits: ['uploadSuccess', 'uploadFail'],
watch: {
objList: {
handler(nV, oV) {
if (nV != oV) {
- this.curMonitorObjList = useCloned(nV).cloned.value;
+ this.curMonitorObjList = useCloned(nV).cloned.value
}
},
- immediate: true
- }
+ immediate: true,
+ },
// task: {
// handler(nV, oV) {
// if (nV != oV) {
@@ -191,158 +171,149 @@
districtname: this.task.districtname,
towncode: this.task.towncode,
townname: this.task.townname,
- online: true
- };
+ online: true,
+ scensetypeid: '5',
+ }
},
// 褰撳墠鍦烘櫙绫诲瀷涓嬬殑灞曠ず鍦烘櫙
showSceneList() {
return this.sceneList.filter((v) => {
const index = this.curMonitorObjList.findIndex((o) => {
- return o.sguid == v.guid;
- });
- return index == -1 && v.type == this.curSceneType;
- });
+ return o.sguid == v.guid
+ })
+ return index == -1 && v.type == this.curSceneType
+ })
},
sceneTypeOptions() {
- const list = [];
+ const list = []
this.sceneList.forEach((d) => {
- if (list.indexOf(d.type) == -1) list.push(d.type);
- });
- return list;
+ if (list.indexOf(d.type) == -1) list.push(d.type)
+ })
+ return list
},
// 褰撳墠鍦烘櫙绫诲瀷涓嬬殑鍙彃鍏ョ紪鍙�
valibleIndex() {
// 鍘熷垪琛ㄥ凡缁忔寜鐓х紪鍙烽『搴忔帓鍒�
- let index = 1;
- const indexList = [];
+ let index = 1
+ const indexList = []
this.showMonitorObjList.forEach((l) => {
while (l.displayid > index) {
- indexList.push(index);
- index++;
+ indexList.push(index)
+ index++
}
- index++;
- });
+ index++
+ })
if (this.showMonitorObjList.length == 0 && indexList.length == 0) {
- indexList.push(1);
+ indexList.push(1)
}
- return indexList;
+ return indexList
},
lastIndex() {
- const len = this.showMonitorObjList.length;
+ const len = this.showMonitorObjList.length
if (len > 0) {
- return this.showMonitorObjList[len - 1].displayid + 1;
+ return this.showMonitorObjList[len - 1].displayid + 1
} else {
- return 1;
+ return 1
}
},
isEdit() {
// 鏂板缓鐩戠鎬讳换鍔℃ā寮�
if (this.create) {
- return this.curMonitorObjList.length > 0;
+ return this.curMonitorObjList.length > 0
}
// 鏇存柊鐩戠鎬讳换鍔℃ā寮�
else {
- return (
- this.insertObj.length > 0 ||
- this.deleteObj.length > 0 ||
- this.updateObj.length > 0
- );
+ return this.insertObj.length > 0 || this.deleteObj.length > 0 || this.updateObj.length > 0
}
},
statisticText() {
- const total = this.curMonitorObjList.length;
- const map = new Map();
+ const total = this.curMonitorObjList.length
+ const map = new Map()
this.curMonitorObjList.forEach((e) => {
- const d = e.scene;
+ const d = e.scene
if (!map.has(d.type)) {
- map.set(d.type, { num: 0 });
+ map.set(d.type, { num: 0 })
}
- map.get(d.type).num++;
- });
+ map.get(d.type).num++
+ })
- let res = `锛堟�昏${total}涓猔;
+ let res = `锛堟�昏${total}涓猔
for (const [key, value] of map) {
- res += `锛�${key}${value.num}涓猔;
+ res += `锛�${key}${value.num}涓猔
}
- res += '锛�';
- return res;
- }
+ res += '锛�'
+ return res
+ },
},
methods: {
// 鏌ヨ
searchScene({ text, page, pageSize }) {
- this.area.sceneName = text;
+ this.area.sceneName = text
return sceneApi.searchScene(this.area, 1, 10000).then((res) => {
if (res.success) {
// 鏌ヨ缁撴灉
- this.sceneList = res.data;
+ this.sceneList = res.data
// 鎬绘暟鎹噺
- this.total = res.head.totalCount;
+ this.total = res.head.totalCount
}
- });
+ })
},
deleteMov(item) {
- if (
- !(
- item.extension1 == null ||
- item.extension1 == undefined ||
- item.extension1 == '0'
- )
- ) {
+ if (!(item.extension1 == null || item.extension1 == undefined || item.extension1 == '0')) {
ElMessage({
message: '宸茬洃绠″満鏅棤娉曠Щ闄�',
- type: 'error'
- });
- return;
+ type: 'error',
+ })
+ return
}
- const i = this.curMonitorObjList.indexOf(item);
- this.curMonitorObjList.splice(i, 1);
- const i1 = this.insertObj.indexOf(item);
- this.insertObj.splice(i1, 1);
- const i2 = this.updateObj.indexOf(item);
- this.updateObj.splice(i2, 1);
+ const i = this.curMonitorObjList.indexOf(item)
+ this.curMonitorObjList.splice(i, 1)
+ const i1 = this.insertObj.indexOf(item)
+ this.insertObj.splice(i1, 1)
+ const i2 = this.updateObj.indexOf(item)
+ this.updateObj.splice(i2, 1)
const i3 = this.updateScene.findIndex((s) => {
- return s.guid == item.sguid;
- });
- this.updateScene.splice(i3, 1);
+ return s.guid == item.sguid
+ })
+ this.updateScene.splice(i3, 1)
- this.deleteObj.push(item);
+ this.deleteObj.push(item)
},
openInsertDialog(item) {
- this.insertDialog = true;
- this.selectedScene = item;
- this.monitorTimes = 1;
+ this.insertDialog = true
+ this.selectedScene = item
+ this.monitorTimes = 1
},
openAddDialog(item) {
- this.addDialog = true;
- this.selectedScene = item;
- this.monitorTimes = 1;
+ this.addDialog = true
+ this.selectedScene = item
+ this.monitorTimes = 1
},
insertMov() {
// 1. 鍒涘缓鏂板満鏅�
- let mov = this.createMov(this.selectedIndex, this.selectedScene);
+ let mov = this.createMov(this.selectedIndex, this.selectedScene)
// 2. 鏌ユ壘绗竴涓紪鍙峰ぇ浜庢彃鍏ョ紪鍙风殑鍊硷紝灏嗘柊鐩戠瀵硅薄鎻掑叆鍏朵箣鍓�
const insertAtIndex = this.curMonitorObjList.findIndex((v) => {
- return v.displayid > this.selectedIndex;
- });
- this.curMonitorObjList.splice(insertAtIndex, 0, mov);
- this.selectedIndex = undefined;
- this.insertDialog = false;
+ return v.displayid > this.selectedIndex
+ })
+ this.curMonitorObjList.splice(insertAtIndex, 0, mov)
+ this.selectedIndex = undefined
+ this.insertDialog = false
},
addMov() {
// 1. 鍒涘缓鏂板満鏅�
- let mov = this.createMov(this.lastIndex, this.selectedScene);
+ let mov = this.createMov(this.lastIndex, this.selectedScene)
// 2. 娣诲姞鑷虫湯灏�
- this.curMonitorObjList.push(mov);
- this.addDialog = false;
+ this.curMonitorObjList.push(mov)
+ this.addDialog = false
},
// 鍒涘缓涓�涓柊鐨勭洃绠″璞�
createMov(displayid, scene) {
// 1. 鏌ユ壘璇ュ満鏅槸鍚︿箣鍓嶅凡琚垹闄�
const index = this.deleteObj.findIndex((v) => {
- return v.sguid == scene.guid;
- });
- let mov;
+ return v.sguid == scene.guid
+ })
+ let mov
// 2. 鑻ユ槸鍏ㄦ柊鐨勫満鏅紝鍒欐柊鐢熸垚涓�涓洃绠″璞★紝鍚﹀垯鍙洿鏂扮紪鍙�
if (index == -1) {
mov = {
@@ -354,27 +325,27 @@
monitornum: this.monitorTimes,
displayid: displayid,
sceneTypeId: scene.typeid,
- sceneType: scene.type
- };
- this.insertObj.push(mov);
+ sceneType: scene.type,
+ }
+ this.insertObj.push(mov)
} else {
- mov = this.deleteObj[index];
- mov.displayid = displayid;
- this.updateObj.push(mov);
- this.deleteObj.splice(index, 1);
+ mov = this.deleteObj[index]
+ mov.displayid = displayid
+ this.updateObj.push(mov)
+ this.deleteObj.splice(index, 1)
}
// 3. 鍚屾鏇存柊鍦烘櫙鍩烘湰淇℃伅涓殑缂栧彿
- scene._index = displayid;
- this.updateScene.push(scene);
+ scene._index = displayid
+ this.updateScene.push(scene)
- return mov;
+ return mov
},
// 淇濆瓨淇敼
saveEdit() {
if (this.create) {
- this.createTask();
+ this.createTask()
} else {
- this.updateTask();
+ this.updateTask()
}
},
createTask() {
@@ -386,13 +357,13 @@
title: `宸℃煡鎬讳换鍔″垱寤哄畬鎴恅,
message: `鏂板鍦烘櫙${res}涓猔,
type: 'success',
- position: 'bottom-left'
- });
- this.$emit('uploadSuccess');
+ position: 'bottom-left',
+ })
+ this.$emit('uploadSuccess')
})
- .catch((err) => this.$emit('uploadFail', err));
+ .catch((err) => this.$emit('uploadFail', err))
}
- this.updateSceneList();
+ this.updateSceneList()
},
updateTask() {
// new Promise((resolve, reject)=>{
@@ -405,10 +376,10 @@
title: `宸℃煡浠诲姟鏂板瀹屾垚`,
message: `鏂板鍦烘櫙${res}涓猔,
type: 'success',
- position: 'bottom-left'
- });
- this.insertObj = [];
- });
+ position: 'bottom-left',
+ })
+ this.insertObj = []
+ })
}
if (this.updateObj.length > 0) {
const p2 = taskApi.updateMonitorObject(this.updateObj).then((res) => {
@@ -416,10 +387,10 @@
title: `宸℃煡浠诲姟鏇存柊瀹屾垚`,
message: `鏇存柊鍦烘櫙${res}涓猔,
type: 'success',
- position: 'bottom-left'
- });
- this.updateObj = [];
- });
+ position: 'bottom-left',
+ })
+ this.updateObj = []
+ })
}
if (this.deleteObj.length > 0) {
const p3 = taskApi.deleteMonitorObject(this.deleteObj).then((res) => {
@@ -427,12 +398,12 @@
title: `宸℃煡浠诲姟鍒犻櫎瀹屾垚`,
message: `鍒犻櫎鍦烘櫙${res}涓猔,
type: 'success',
- position: 'bottom-left'
- });
- this.deleteObj = [];
- });
+ position: 'bottom-left',
+ })
+ this.deleteObj = []
+ })
}
- this.updateSceneList();
+ this.updateSceneList()
// return Promise.all([p1, p2, p3]).finally(() => {
// this.saveLoading = false;
// });
@@ -440,26 +411,26 @@
updateSceneList() {
if (this.updateScene.length > 0) {
this.updateScene.forEach((s) => {
- s.index = s._index;
- });
+ s.index = s._index
+ })
sceneApi.updateSceneList(this.updateScene).then((res) => {
ElNotification({
title: `鍦烘櫙缂栧彿鏇存柊瀹屾垚`,
message: `鏇存柊鍦烘櫙${res}涓猔,
type: 'success',
- position: 'bottom-left'
- });
- this.updateScene = [];
- });
+ position: 'bottom-left',
+ })
+ this.updateScene = []
+ })
}
- }
+ },
},
mounted() {
setTimeout(() => {
- this.searchScene({ text: '' });
- }, 1000);
- }
-};
+ this.searchScene({ text: '' })
+ }, 1000)
+ },
+}
</script>
<style scoped>
--
Gitblit v1.9.3