|
@@ -1,23 +1,31 @@
|
|
|
<template>
|
|
|
<div class="table-select">
|
|
|
- <span class="title">{{$i18n.t(`gather.select_material`)}}</span>
|
|
|
- <div class="close-btn"><i class="iconfont icon-close" @click="$emit('cancle')"></i></div>
|
|
|
+ <span class="title">{{ $i18n.t(`gather.select_material`) }}</span>
|
|
|
+ <div class="close-btn">
|
|
|
+ <i class="iconfont icon-close" @click="$emit('cancle')"></i>
|
|
|
+ </div>
|
|
|
|
|
|
<div class="material-tab">
|
|
|
- <a class="material-tab-item" @click.prevent="currentMaterialType = 'pano'">
|
|
|
- <span class="text" :class="{ active: currentMaterialType === 'pano' }">{{$i18n.t(`gather.panorama`)}}</span>
|
|
|
+ <a
|
|
|
+ class="material-tab-item"
|
|
|
+ @click.prevent="currentMaterialType = 'pano'"
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ class="text"
|
|
|
+ :class="{ active: currentMaterialType === 'pano' }"
|
|
|
+ >{{ $i18n.t(`gather.panorama`) }}</span
|
|
|
+ >
|
|
|
<div v-if="currentMaterialType === 'pano'" class="bottom-line"></div>
|
|
|
</a>
|
|
|
<a class="material-tab-item" @click.prevent="currentMaterialType = '3D'">
|
|
|
- <span class="text" :class="{ active: currentMaterialType === '3D' }">{{$i18n.t(`gather.scene`)}}</span>
|
|
|
+ <span class="text" :class="{ active: currentMaterialType === '3D' }">{{
|
|
|
+ $i18n.t(`gather.scene`)
|
|
|
+ }}</span>
|
|
|
<div v-if="currentMaterialType === '3D'" class="bottom-line"></div>
|
|
|
</a>
|
|
|
</div>
|
|
|
-
|
|
|
- <div
|
|
|
- class="filter"
|
|
|
- :class="{active: isSearchKeyInputActive}"
|
|
|
- >
|
|
|
+
|
|
|
+ <div class="filter" :class="{ active: isSearchKeyInputActive }">
|
|
|
<input
|
|
|
type="text"
|
|
|
:placeholder="$i18n.t(`gather.keywords`)"
|
|
@@ -25,19 +33,28 @@
|
|
|
@focus="isSearchKeyInputActive = true"
|
|
|
@blur="isSearchKeyInputActive = false"
|
|
|
/>
|
|
|
- <i v-if="!searchKey" class="iconfont icon-editor_search search-icon"/>
|
|
|
- <i v-if="searchKey" @click="searchKey=''" class="iconfont icon-toast_red clear-icon"></i>
|
|
|
+ <i v-if="!searchKey" class="iconfont icon-editor_search search-icon" />
|
|
|
+ <i
|
|
|
+ v-if="searchKey"
|
|
|
+ @click="searchKey = ''"
|
|
|
+ class="iconfont icon-toast_red clear-icon"
|
|
|
+ ></i>
|
|
|
</div>
|
|
|
|
|
|
<div class="table table-pano" v-show="currentMaterialType === 'pano'">
|
|
|
- <div
|
|
|
- v-show="panoList.length !== 0"
|
|
|
- class="table-body"
|
|
|
- >
|
|
|
+ <div v-show="panoList.length !== 0" class="table-body">
|
|
|
+ 测试数据-- {{
|
|
|
+ panoList.map((i) => {
|
|
|
+ let t = {};
|
|
|
+ t["id"] = i.id;
|
|
|
+ t["sceneTitle"] = i.sceneTitle;
|
|
|
+ return t;
|
|
|
+ })
|
|
|
+ }}
|
|
|
<div
|
|
|
class="table-body-row"
|
|
|
- v-for="(item,i) in panoList"
|
|
|
- :key="i"
|
|
|
+ v-for="(item) in panoList"
|
|
|
+ :key="`${item.id}`"
|
|
|
@click="onClickRow"
|
|
|
>
|
|
|
<span class="table-data">
|
|
@@ -45,17 +62,19 @@
|
|
|
class="checkbox"
|
|
|
:isLightTheme="false"
|
|
|
:isMultiSelection="false"
|
|
|
- :isCheckedInitial="select.some(i => i.id === item.id)"
|
|
|
- @change="v => selectItem(item, v)"
|
|
|
+ :isCheckedInitial="select.some((i) => i.id === item.id)"
|
|
|
+ @change="(v) => selectItem(item, v)"
|
|
|
/>
|
|
|
</span>
|
|
|
<span class="table-data">
|
|
|
<div class="list-img">
|
|
|
- <img :src="item.icon + $imgsuffix" alt="">
|
|
|
+ <img :src="item.icon + $imgsuffix" alt="" />
|
|
|
</div>
|
|
|
</span>
|
|
|
<span class="table-data">
|
|
|
- <span class="name ellipsis" v-title="item.sceneTitle">{{item.sceneTitle}}</span>
|
|
|
+ <span class="name ellipsis" v-title="item.sceneTitle">{{
|
|
|
+ item.sceneTitle
|
|
|
+ }}</span>
|
|
|
</span>
|
|
|
</div>
|
|
|
<!-- <div class="no-more-data">
|
|
@@ -65,25 +84,28 @@
|
|
|
<!-- 无数据时的提示 -->
|
|
|
<div v-show="!(panoList.length !== 0)" class="no-data">
|
|
|
<div v-if="latestUsedSearchKey">
|
|
|
- <img :src="require('@/assets/images/default/empty_search_dark.png')" alt="">
|
|
|
- <span>{{$i18n.t(`gather.no_search_result`)}}</span>
|
|
|
+ <img
|
|
|
+ :src="require('@/assets/images/default/empty_search_dark.png')"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ <span>{{ $i18n.t(`gather.no_search_result`) }}</span>
|
|
|
</div>
|
|
|
<div v-if="!latestUsedSearchKey">
|
|
|
- <img :src="require('@/assets/images/default/empty_dark.png')" alt="">
|
|
|
- <span>{{$i18n.t(`gather.no_material_result`)}}</span>
|
|
|
+ <img
|
|
|
+ :src="require('@/assets/images/default/empty_dark.png')"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ <span>{{ $i18n.t(`gather.no_material_result`) }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="table table-3D" v-show="currentMaterialType === '3D'">
|
|
|
- <div
|
|
|
- v-show="scene3DList.length !== 0"
|
|
|
- class="table-body"
|
|
|
- >
|
|
|
+ <div v-show="scene3DList.length !== 0" class="table-body">
|
|
|
<div
|
|
|
class="table-body-row"
|
|
|
- v-for="(item,i) in scene3DList"
|
|
|
- :key="i"
|
|
|
+ v-for="(item) in scene3DList"
|
|
|
+ :key="`${item.id}`"
|
|
|
@click="onClickRow"
|
|
|
>
|
|
|
<span class="table-data">
|
|
@@ -91,17 +113,19 @@
|
|
|
class="checkbox"
|
|
|
:isLightTheme="false"
|
|
|
:isMultiSelection="false"
|
|
|
- :isCheckedInitial="select.some(i => i.id === item.id)"
|
|
|
- @change="v => selectItem(item, v)"
|
|
|
+ :isCheckedInitial="select.some((i) => i.id === item.id)"
|
|
|
+ @change="(v) => selectItem(item, v)"
|
|
|
/>
|
|
|
</span>
|
|
|
<span class="table-data">
|
|
|
<div class="list-img">
|
|
|
- <img :src="item.icon + $imgsuffix" alt="">
|
|
|
+ <img :src="item.icon + $imgsuffix" alt="" />
|
|
|
</div>
|
|
|
</span>
|
|
|
<span class="table-data">
|
|
|
- <span class="name ellipsis" v-title="item.sceneTitle">{{item.sceneTitle}}</span>
|
|
|
+ <span class="name ellipsis" v-title="item.sceneTitle">{{
|
|
|
+ item.sceneTitle
|
|
|
+ }}</span>
|
|
|
</span>
|
|
|
</div>
|
|
|
<!-- <div class="no-more-data">
|
|
@@ -111,21 +135,33 @@
|
|
|
<!-- 无数据时的提示 -->
|
|
|
<div v-show="!(scene3DList.length !== 0)" class="no-data">
|
|
|
<div v-if="latestUsedSearchKey">
|
|
|
- <img :src="require('@/assets/images/default/empty_search_dark.png')" alt="">
|
|
|
- <span>{{$i18n.t(`gather.no_search_result`)}}</span>
|
|
|
+ <img
|
|
|
+ :src="require('@/assets/images/default/empty_search_dark.png')"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ <span>{{ $i18n.t(`gather.no_search_result`) }}</span>
|
|
|
</div>
|
|
|
<div v-if="!latestUsedSearchKey">
|
|
|
- <img :src="require('@/assets/images/default/empty_dark.png')" alt="">
|
|
|
- <span>{{$i18n.t(`gather.no_material_result`)}}</span>
|
|
|
+ <img
|
|
|
+ :src="require('@/assets/images/default/empty_dark.png')"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ <span>{{ $i18n.t(`gather.no_material_result`) }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="btns">
|
|
|
<div>
|
|
|
- <button class="ui-button deepcancel" @click="$emit('cancle')">{{$i18n.t(`gather.cancel`)}}</button>
|
|
|
- <button class="ui-button submit" :class="{disable: !select.length}" @click="onClickComfirm">
|
|
|
- {{$i18n.t(`gather.comfirm`)}}
|
|
|
+ <button class="ui-button deepcancel" @click="$emit('cancle')">
|
|
|
+ {{ $i18n.t(`gather.cancel`) }}
|
|
|
+ </button>
|
|
|
+ <button
|
|
|
+ class="ui-button submit"
|
|
|
+ :class="{ disable: !select.length }"
|
|
|
+ @click="onClickComfirm"
|
|
|
+ >
|
|
|
+ {{ $i18n.t(`gather.comfirm`) }}
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -134,98 +170,111 @@
|
|
|
|
|
|
<script>
|
|
|
import { mapGetters } from "vuex";
|
|
|
-import { debounce } from "@/utils/other.js"
|
|
|
+import { debounce } from "@/utils/other.js";
|
|
|
import RadioOrCheckbox from "@/components/shared/RadioOrCheckbox.vue";
|
|
|
|
|
|
export default {
|
|
|
- props:{
|
|
|
+ props: {
|
|
|
primaryKey: {
|
|
|
- default: 'id'
|
|
|
+ default: "id",
|
|
|
},
|
|
|
isMultiSelection: {
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
- components:{
|
|
|
+ components: {
|
|
|
RadioOrCheckbox,
|
|
|
},
|
|
|
- computed:{
|
|
|
- ...mapGetters([
|
|
|
- 'info',
|
|
|
- ]),
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["info"]),
|
|
|
panoList() {
|
|
|
- return this.info.scenes.filter((item) => {
|
|
|
- return item.type === 'pano'
|
|
|
- }).filter((item) => {
|
|
|
- if (this.searchKey) {
|
|
|
- return item.sceneTitle.includes(this.searchKey)
|
|
|
- } else {
|
|
|
- return item
|
|
|
- }
|
|
|
- })
|
|
|
+ return this.info.scenes
|
|
|
+ .filter((item) => {
|
|
|
+ return item.type === "pano";
|
|
|
+ })
|
|
|
+ .filter((item) => {
|
|
|
+ if (this.searchKey) {
|
|
|
+ return item.sceneTitle.includes(this.searchKey);
|
|
|
+ } else {
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
scene3DList() {
|
|
|
- return this.info.scenes.filter((item) => {
|
|
|
- return item.type === '4dkk'
|
|
|
- }).filter((item) => {
|
|
|
- if (this.searchKey) {
|
|
|
- return item.sceneTitle.includes(this.searchKey)
|
|
|
- } else {
|
|
|
- return item
|
|
|
+ return this.info.scenes
|
|
|
+ .filter((item) => {
|
|
|
+ return item.type === "4dkk";
|
|
|
+ })
|
|
|
+ .filter((item) => {
|
|
|
+ if (this.searchKey) {
|
|
|
+ return item.sceneTitle.includes(this.searchKey);
|
|
|
+ } else {
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ searchKey: {
|
|
|
+ handler(val, old) {
|
|
|
+ if (val && old !== val) {
|
|
|
+ console.log("need update");
|
|
|
+ // this.$forceUpdate();
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
+ },
|
|
|
+ },
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
select: [],
|
|
|
isSearchKeyInputActive: false,
|
|
|
- searchKey:'', // 搜索关键词
|
|
|
- latestUsedSearchKey: '',
|
|
|
- currentMaterialType: 'pano',
|
|
|
- }
|
|
|
+ searchKey: "", // 搜索关键词
|
|
|
+ latestUsedSearchKey: "",
|
|
|
+ currentMaterialType: "pano",
|
|
|
+ };
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
selectItem(item, v) {
|
|
|
- item.materialType = this.currentMaterialType // 三维场景数据没有type字段来表明自己是三维场景。所以统一加一个字段。
|
|
|
+ item.materialType = this.currentMaterialType; // 三维场景数据没有type字段来表明自己是三维场景。所以统一加一个字段。
|
|
|
if (this.isMultiSelection) {
|
|
|
if (v) {
|
|
|
- this.select.push(item)
|
|
|
+ this.select.push(item);
|
|
|
} else {
|
|
|
const toDeleteIdx = this.select.findIndex((eachSelect) => {
|
|
|
- return eachSelect.id === item.id
|
|
|
- })
|
|
|
+ return eachSelect.id === item.id;
|
|
|
+ });
|
|
|
if (toDeleteIdx >= 0) {
|
|
|
- this.select.splice(toDeleteIdx, 1)
|
|
|
+ this.select.splice(toDeleteIdx, 1);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
if (v) {
|
|
|
- this.select = [item]
|
|
|
+ this.select = [item];
|
|
|
} else {
|
|
|
- this.select = []
|
|
|
+ this.select = [];
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
onClickRow(e) {
|
|
|
- const checkboxNodeList = e.currentTarget.getElementsByClassName('selection-click-target')
|
|
|
+ const checkboxNodeList = e.currentTarget.getElementsByClassName(
|
|
|
+ "selection-click-target"
|
|
|
+ );
|
|
|
if (checkboxNodeList && checkboxNodeList[0]) {
|
|
|
- checkboxNodeList[0].click()
|
|
|
+ checkboxNodeList[0].click();
|
|
|
}
|
|
|
},
|
|
|
- onClickComfirm: debounce(function() {
|
|
|
- this.$emit('submit', this.select)
|
|
|
+ onClickComfirm: debounce(function () {
|
|
|
+ this.$emit("submit", this.select);
|
|
|
}, 250),
|
|
|
},
|
|
|
- mounted() {
|
|
|
- }
|
|
|
-}
|
|
|
+ mounted() {},
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
-.ellipsis{
|
|
|
+.ellipsis {
|
|
|
text-overflow: ellipsis;
|
|
|
overflow: hidden;
|
|
|
white-space: nowrap;
|
|
@@ -241,7 +290,7 @@ export default {
|
|
|
transform: translateX(-50%) translateY(-50%);
|
|
|
width: 600px;
|
|
|
height: 730px;
|
|
|
- background: #1A1B1D;
|
|
|
+ background: #1a1b1d;
|
|
|
border-radius: 4px;
|
|
|
border: 1px solid #404040;
|
|
|
padding: 26px;
|
|
@@ -285,7 +334,7 @@ export default {
|
|
|
bottom: -4px;
|
|
|
width: 16px;
|
|
|
height: 2px;
|
|
|
- background: #0076F6;
|
|
|
+ background: #0076f6;
|
|
|
border-radius: 1px;
|
|
|
}
|
|
|
}
|
|
@@ -341,11 +390,14 @@ export default {
|
|
|
.table {
|
|
|
margin-top: 20px;
|
|
|
// border: @table-border-size solid #404040;
|
|
|
- background: #1A1B1D;
|
|
|
+ background: #1a1b1d;
|
|
|
width: 100%;
|
|
|
height: @table-height;
|
|
|
> .table-body {
|
|
|
- height: calc(@table-height - @table-head-row-height - @table-border-size - @table-border-size);
|
|
|
+ height: calc(
|
|
|
+ @table-height - @table-head-row-height - @table-border-size -
|
|
|
+ @table-border-size
|
|
|
+ );
|
|
|
overflow: auto;
|
|
|
display: inline-block;
|
|
|
width: 100%;
|
|
@@ -358,8 +410,8 @@ export default {
|
|
|
background: #252526;
|
|
|
}
|
|
|
> .table-data {
|
|
|
- font-size:14px;
|
|
|
- line-height:50px;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 50px;
|
|
|
height: 100%;
|
|
|
color: #fff;
|
|
|
> .list-img {
|
|
@@ -399,7 +451,10 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
> .no-data {
|
|
|
- height: calc(@table-height - @table-head-row-height - @table-border-size - @table-border-size);
|
|
|
+ height: calc(
|
|
|
+ @table-height - @table-head-row-height - @table-border-size -
|
|
|
+ @table-border-size
|
|
|
+ );
|
|
|
width: 100%;
|
|
|
position: relative;
|
|
|
> div {
|
|
@@ -484,14 +539,14 @@ export default {
|
|
|
top: 50%;
|
|
|
transform: translate(-50%, -50%);
|
|
|
border-radius: 50%;
|
|
|
- background: #0076F6;
|
|
|
+ background: #0076f6;
|
|
|
pointer-events: none;
|
|
|
opacity: 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.checkbox > input:checked ~ .for-outer-circle {
|
|
|
- border: 1px solid #0076F6;
|
|
|
+ border: 1px solid #0076f6;
|
|
|
}
|
|
|
|
|
|
.checkbox > input:checked ~ .for-inner-circle {
|
|
@@ -512,4 +567,4 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|