From d8eda80eaf2f328ed43dc4f5c783b7dee5a4092c Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期六, 12 十月 2024 17:39:39 +0800 Subject: [PATCH] 1. 新增巡查计划功能(待完成); 2. 完成任务的各场景下的分别移除和添加; --- src/views/fysp/task/components/CompMonitorObj.vue | 44 +++++++++++++++++++++++++++++++------------- 1 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/views/fysp/task/components/CompMonitorObj.vue b/src/views/fysp/task/components/CompMonitorObj.vue index 9093a2b..327787e 100644 --- a/src/views/fysp/task/components/CompMonitorObj.vue +++ b/src/views/fysp/task/components/CompMonitorObj.vue @@ -1,14 +1,14 @@ <template> <div> - <el-segmented :model-value="tabName" :options="tabs" @change="tabChange" /> + <el-segmented :model-value="activeName" :options="activeTabs" @change="tabChange" /> </div> <el-space wrap> <ItemMonitorObj v-for="obj in activeData" :key="obj.movid" :item="obj"> <template #default="{ item }"> <!-- <slot :item="item"></slot> --> - <el-button v-if="showDelete" size="small" type="danger" @click="deleteMov(item)" - >绉婚櫎</el-button - > + <el-button v-if="showBtn" size="small" type="danger" @click="itemClick(item)">{{ + btnName + }}</el-button> </template> </ItemMonitorObj> </el-space> @@ -26,12 +26,17 @@ type: String, default: defaultTabName }, + tabOptions: Array, showData: Array, // 鏄惁娣诲姞榛樿鐨勫叏閮ㄩ�夐」 allOption: Boolean, - showDelete: Boolean + showBtn: Boolean, + btnName: { + type: String, + default: '绉婚櫎' + } }, - emits: ['update:tabName', 'update:showData', 'deleteItem'], + emits: ['update:tabName', 'update:showData', 'itemClick'], data() { return { activeName: defaultTabName, @@ -41,11 +46,18 @@ computed: { activeData() { const list = this.data.filter((v) => { - // return this.activeName == defaultTabName || v.sceneType == this.activeName; - return this.tabName == defaultTabName || v.sceneType == this.tabName; + return this.activeName == defaultTabName || v.sceneType == this.activeName; + // return this.tabName == defaultTabName || v.sceneType == this.tabName; }); this.$emit('update:showData', list); return list; + }, + activeTabs() { + if (this.tabOptions) { + return this.tabOptions; + } else { + return this.tabs; + } } }, watch: { @@ -60,11 +72,16 @@ tabs: { handler(nV, oV) { if (nV != oV && nV.length > 0) { - // this.activeName = nV[0]; - this.tabChange(nV); + this.activeName = nV[0]; + this.tabChange(nV[0]); } }, immediate: true + }, + tabName(nV, oV) { + if (nV != oV) { + this.activeName = nV; + } } }, methods: { @@ -73,13 +90,14 @@ dataList.forEach((d) => { if (list.indexOf(d.sceneType) == -1) list.push(d.sceneType); }); - this.tabs = list; + this.tabs = list.sort(); }, tabChange(tabName) { + this.activeName = tabName; this.$emit('update:tabName', tabName); }, - deleteMov(item) { - this.$emit('deleteItem', item); + itemClick(item) { + this.$emit('itemClick', item); } } }; -- Gitblit v1.9.3