|
@@ -1,153 +1,130 @@
|
|
|
<template>
|
|
|
<RightFillPano>
|
|
|
<template #header>
|
|
|
- <ui-group borderBottom>
|
|
|
- <template #header>
|
|
|
- <ui-button @click="editTagging = createTagging()">
|
|
|
- <ui-icon type="add" />
|
|
|
- 新增
|
|
|
- </ui-button>
|
|
|
- </template>
|
|
|
- </ui-group>
|
|
|
+ <div class="tabs" :class="{ disabled: isEdit }">
|
|
|
+ <span
|
|
|
+ v-for="tab in tabs"
|
|
|
+ :key="tab.key"
|
|
|
+ :class="{ active: tab.key === current }"
|
|
|
+ @click="current = tab.key"
|
|
|
+ >
|
|
|
+ {{ tab.text }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
- <ui-group title="标签列表" class="tagging-list">
|
|
|
- <template #header>
|
|
|
- <StyleTypeSelect v-model:value="type" all count />
|
|
|
- </template>
|
|
|
- <template #icon>
|
|
|
- <ui-icon
|
|
|
- ctrl
|
|
|
- :class="{ active: showSearch }"
|
|
|
- type="search"
|
|
|
- @click="showSearch = !showSearch"
|
|
|
- style="margin-right: 20px"
|
|
|
- />
|
|
|
- <ui-icon
|
|
|
- ctrl
|
|
|
- :type="custom.showTaggings ? 'eye-s' : 'eye-n'"
|
|
|
- @click="custom.showTaggings = !custom.showTaggings"
|
|
|
- />
|
|
|
- </template>
|
|
|
- <ui-group-option v-if="showSearch">
|
|
|
- <ui-input type="text" width="100%" placeholder="搜索" v-model="keyword">
|
|
|
- <template #preIcon>
|
|
|
- <ui-icon type="search" />
|
|
|
- </template>
|
|
|
- </ui-input>
|
|
|
- </ui-group-option>
|
|
|
- <TagingSign
|
|
|
- v-for="tagging in filterTaggings"
|
|
|
- :key="tagging.id"
|
|
|
- :tagging="tagging"
|
|
|
- :selected="selectTagging === tagging"
|
|
|
- @edit="editTagging = tagging"
|
|
|
- @delete="deleteTagging(tagging)"
|
|
|
- @select="(selected) => (selectTagging = selected ? tagging : null)"
|
|
|
- @fixed="fixedTagging(tagging)"
|
|
|
- />
|
|
|
- </ui-group>
|
|
|
+
|
|
|
+ <Hot ref="quiskObj" v-if="current === 'tagging'" />
|
|
|
+ <Monitor ref="quiskObj" v-if="current === 'monitor'" />
|
|
|
</RightFillPano>
|
|
|
|
|
|
- <Edit
|
|
|
- v-if="editTagging"
|
|
|
- :data="editTagging"
|
|
|
- @quit="editTagging = null"
|
|
|
- @save="saveHandler"
|
|
|
- />
|
|
|
+ <Teleport to=".laser-layer">
|
|
|
+ <div class="quisks" v-if="!isEdit">
|
|
|
+ <div class="quisk-item fun-ctrl" @click="quiskAdd('tagging')">
|
|
|
+ <ui-icon type="a-guide_s" />
|
|
|
+ <span>标签</span>
|
|
|
+ </div>
|
|
|
+ <!-- <div class="quisk-item fun-ctrl" @click="quiskAdd('monitor')">
|
|
|
+ <ui-icon type="a-animation_s" />
|
|
|
+ <span>监控</span>
|
|
|
+ </div> -->
|
|
|
+ </div>
|
|
|
+ </Teleport>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import Edit from "./edit.vue";
|
|
|
-import TagingSign from "./sign.vue";
|
|
|
-import StyleTypeSelect from "./style-type-select.vue";
|
|
|
+import { isEdit, monitors, taggings } from "@/store";
|
|
|
+import Hot from "./hot/index.vue";
|
|
|
+import Monitor from "./monitor/index.vue";
|
|
|
import { RightFillPano } from "@/layout";
|
|
|
-import { useViewStack } from "@/hook";
|
|
|
-import { computed, ref, watchEffect } from "vue";
|
|
|
-import { router, RoutesName } from "@/router";
|
|
|
-import { custom } from "@/env";
|
|
|
-import {
|
|
|
- taggings,
|
|
|
- getTaggingStyle,
|
|
|
- Tagging,
|
|
|
- autoSaveTaggings,
|
|
|
- createTagging,
|
|
|
- getTaggingPositions,
|
|
|
- taggingPositions,
|
|
|
- isOld,
|
|
|
- save,
|
|
|
- getTagging,
|
|
|
- TaggingStyle,
|
|
|
-} from "@/store";
|
|
|
-import { taggingsGroup } from "@/sdk";
|
|
|
+import { nextTick, reactive, ref, watchEffect } from "vue";
|
|
|
|
|
|
-const showSearch = ref(false);
|
|
|
-const type = ref<TaggingStyle["typeId"]>(-1);
|
|
|
-const keyword = ref("");
|
|
|
-const filterTaggings = computed(() =>
|
|
|
- taggings.value.filter((tagging) => {
|
|
|
- if (!tagging.title.includes(keyword.value)) return false;
|
|
|
- if (type.value === -1) return true;
|
|
|
- const style = getTaggingStyle(tagging.styleId);
|
|
|
- return style?.typeId === type.value;
|
|
|
- })
|
|
|
-);
|
|
|
+const current = ref("tagging");
|
|
|
+const tabs = reactive([
|
|
|
+ { key: "tagging", text: "标签()" },
|
|
|
+ { key: "monitor", text: "监控()" },
|
|
|
+]);
|
|
|
+watchEffect(() => {
|
|
|
+ tabs[0].text = `标签(${taggings.value.length})`;
|
|
|
+ tabs[1].text = `监控(${monitors.value.length})`;
|
|
|
+});
|
|
|
+const quiskObj = ref<any>();
|
|
|
+const quiskAdd = async (key: string) => {
|
|
|
+ current.value = key;
|
|
|
+ await nextTick();
|
|
|
+ quiskObj.value.add();
|
|
|
+};
|
|
|
+</script>
|
|
|
|
|
|
-const editTagging = ref<Tagging | null>(null);
|
|
|
-const saveHandler = (tagging: Tagging) => {
|
|
|
- if (!editTagging.value) return;
|
|
|
- if (!getTagging(editTagging.value.id)) {
|
|
|
- taggings.value.push(tagging);
|
|
|
- const style = getTaggingStyle(tagging.styleId);
|
|
|
- if (style) {
|
|
|
- style.lastUse = 1;
|
|
|
- }
|
|
|
- } else {
|
|
|
- Object.assign(editTagging.value, tagging);
|
|
|
- }
|
|
|
+<style lang="scss" scoped>
|
|
|
+.tabs {
|
|
|
+ height: 60px;
|
|
|
+ border-bottom: 1px solid rgba(255, 255, 255, 0.16);
|
|
|
+ display: flex;
|
|
|
+ margin: -20px;
|
|
|
+ margin-bottom: 20px;
|
|
|
|
|
|
- editTagging.value = null;
|
|
|
-};
|
|
|
+ > span {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ position: relative;
|
|
|
+ transition: color 0.3s ease;
|
|
|
+ cursor: pointer;
|
|
|
+ font-size: 16px;
|
|
|
|
|
|
-const deleteTagging = (tagging: Tagging) => {
|
|
|
- const index = taggings.value.indexOf(tagging);
|
|
|
- const positions = getTaggingPositions(tagging);
|
|
|
- taggingPositions.value = taggingPositions.value.filter(
|
|
|
- (position) => !positions.includes(position)
|
|
|
- );
|
|
|
- taggings.value.splice(index, 1);
|
|
|
-};
|
|
|
+ &::after {
|
|
|
+ content: "";
|
|
|
+ transition: height 0.3s ease;
|
|
|
+ position: absolute;
|
|
|
+ background-color: #00c8af;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ height: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ &:hover,
|
|
|
+ &.active {
|
|
|
+ color: #00c8af;
|
|
|
+ }
|
|
|
|
|
|
-const fixedTagging = async (tagging: Tagging) => {
|
|
|
- if (isOld.value) {
|
|
|
- await save();
|
|
|
+ &.active::after {
|
|
|
+ height: 3px;
|
|
|
+ }
|
|
|
}
|
|
|
- router.push({ name: RoutesName.taggingPosition, params: { id: tagging.id } });
|
|
|
-};
|
|
|
+}
|
|
|
|
|
|
-const selectTagging = ref<Tagging | null>(null);
|
|
|
-useViewStack(() => {
|
|
|
- const stopAuth = autoSaveTaggings();
|
|
|
- const stop = watchEffect((onCleanup) => {
|
|
|
- taggingsGroup.changeCanMove(true);
|
|
|
- taggingsGroup.showDelete(true);
|
|
|
- onCleanup(() => {
|
|
|
- taggingsGroup.changeCanMove(false);
|
|
|
- taggingsGroup.showDelete(false);
|
|
|
- });
|
|
|
- });
|
|
|
- return () => {
|
|
|
- stop();
|
|
|
- stopAuth();
|
|
|
- };
|
|
|
-});
|
|
|
-</script>
|
|
|
+.quisks {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 20px;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
|
|
|
-<style scoped>
|
|
|
-.active {
|
|
|
- color: var(--color-main-normal) !important;
|
|
|
-}
|
|
|
+ .quisk-item {
|
|
|
+ width: 80px;
|
|
|
+ height: 80px;
|
|
|
+ border-radius: 10px;
|
|
|
+ background: rgba(27, 27, 28, 0.8);
|
|
|
+ color: #ffffff;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
|
|
|
-.tagging-list {
|
|
|
- padding-bottom: 30px;
|
|
|
+ &:not(:last-child) {
|
|
|
+ margin-right: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ span {
|
|
|
+ margin-top: 6px;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ .icon {
|
|
|
+ font-size: 22px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|