|
@@ -19,17 +19,29 @@
|
|
|
placeholder="输入名称搜索"
|
|
|
v-model:value="keyword"
|
|
|
allow-clear
|
|
|
- style="width: 264px"
|
|
|
+ style="width: 244px"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div class="table-layout" v-if="filterScenes.length">
|
|
|
- <Table
|
|
|
- :row-key="(record) => record.modelId"
|
|
|
- :columns="cloumns"
|
|
|
- :rowSelection="rowSelection"
|
|
|
- :data-source="filterScenes"
|
|
|
- :pagination="false"
|
|
|
- />
|
|
|
+ <div class="table-layout" v-if="origin.length">
|
|
|
+ <Tabs v-model:activeKey="type">
|
|
|
+ <TabPane v-for="current in types" :key="current" :tab="current">
|
|
|
+ <Table
|
|
|
+ v-if="typeFilterScenes[current].length"
|
|
|
+ :row-key="(record: Scene) => record.modelId"
|
|
|
+ :columns="cloumns"
|
|
|
+ :rowSelection="rowSelection"
|
|
|
+ :data-source="typeFilterScenes[current]"
|
|
|
+ :pagination="false"
|
|
|
+ />
|
|
|
+ <div style="padding: 1px" v-else>
|
|
|
+ <Empty
|
|
|
+ description="暂无搜索结果"
|
|
|
+ :image="Empty.PRESENTED_IMAGE_SIMPLE"
|
|
|
+ className="ant-empty ant-empty-normal"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </TabPane>
|
|
|
+ </Tabs>
|
|
|
</div>
|
|
|
<div style="padding: 1px" v-else>
|
|
|
<Empty
|
|
@@ -47,7 +59,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { Modal, Input, Table, Empty } from "ant-design-vue";
|
|
|
+import { Modal, Input, Table, Empty, Tabs, TabPane } from "ant-design-vue";
|
|
|
import { computed, nextTick, ref, watch, watchEffect } from "vue";
|
|
|
import { scenes, save, SceneTypeDesc } from "@/store";
|
|
|
import { asyncTimeout, createLoadPack } from "@/utils";
|
|
@@ -69,15 +81,29 @@ const Search = Input.Search;
|
|
|
const selectIds = computed(() => fuseModels.value.map((item) => item.modelId));
|
|
|
const visible = ref(false);
|
|
|
const keyword = ref("");
|
|
|
-const filterScenes = computed(() =>
|
|
|
- scenes.value
|
|
|
- .filter((item) => item.name && item.modelId && item.name.includes(keyword.value))
|
|
|
- .map((scene) => ({
|
|
|
- ...scene,
|
|
|
- createTime: scene.createTime.substr(0, 16),
|
|
|
- type: SceneTypeDesc[scene.type],
|
|
|
- }))
|
|
|
+const origin = computed(() =>
|
|
|
+ scenes.value.map((scene) => ({
|
|
|
+ ...scene,
|
|
|
+ createTime: scene.createTime.substr(0, 16),
|
|
|
+ type: SceneTypeDesc[scene.type],
|
|
|
+ }))
|
|
|
);
|
|
|
+
|
|
|
+const typeFilterScenes = computed(() => {
|
|
|
+ const typeScenes: any = {};
|
|
|
+ for (const type of types.value) {
|
|
|
+ typeScenes[type] = origin.value
|
|
|
+ .filter((item) => item.name && item.modelId && item.name.includes(keyword.value))
|
|
|
+ .filter((item) => item.type === type);
|
|
|
+ }
|
|
|
+ return typeScenes;
|
|
|
+});
|
|
|
+
|
|
|
+const types = computed(() => [
|
|
|
+ ...new Set(origin.value.map((item) => item.type)).values(),
|
|
|
+]);
|
|
|
+const type = ref(types.value[0]);
|
|
|
+
|
|
|
const selects = ref<Key[]>(selectIds.value);
|
|
|
const rowSelection: any = ref({
|
|
|
selectedRowKeys: selects,
|