2020-01-08 22:19:46 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="pop-elementset"
|
|
|
|
|
|
:style="{opacity:(eventfixedVal.shezhi==1),left:(eventfixedVal.shezhi==1 ? event_positionx : -2000)+'px',top:(event_positiony)+'px'}"
|
|
|
|
|
|
>
|
2020-02-17 18:20:14 +08:00
|
|
|
|
<!--<div class="pop-top-btns">
|
2020-01-17 16:06:35 +08:00
|
|
|
|
<button type="button" @click="shezhiControl('ok')" class="nz-btn nz-btn-size-alien nz-btn-size-small nz-btn-style-light nz-btn-min-width-35" id="element-set-ok">
|
|
|
|
|
|
<span class="pop-top-btn-icon"><i class="nz-icon nz-icon-edit"></i></span>
|
|
|
|
|
|
<span class="pop-top-btn-txt">{{$t('overall.save')}}</span>
|
2020-01-08 22:19:46 +08:00
|
|
|
|
</button>
|
2020-01-17 16:06:35 +08:00
|
|
|
|
<button type="button" @click="shezhiControl('cancel')" class="nz-btn nz-btn-size-alien nz-btn-size-small nz-btn-style-light nz-btn-min-width-35" id="element-set-esc">
|
|
|
|
|
|
<span class="pop-top-btn-icon"><i class="el-icon-close"></i></span>
|
|
|
|
|
|
<span class="pop-top-btn-txt">{{$t('overall.esc')}}</span>
|
2020-01-08 22:19:46 +08:00
|
|
|
|
</button>
|
2020-02-17 18:20:14 +08:00
|
|
|
|
</div>-->
|
2020-01-17 16:06:35 +08:00
|
|
|
|
<div class="pop-title">{{$t('overall.select')}}</div>
|
2020-01-08 22:19:46 +08:00
|
|
|
|
<div class="pop-box elementset-labels">
|
|
|
|
|
|
<el-scrollbar style="height: 100%;">
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="(item,index) in dropColRes"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
class="elementset-label"
|
|
|
|
|
|
:class="index==0 || index == 1 ? 'elementset-label-disabled' : ''"
|
|
|
|
|
|
:title="item.visibility == 'disabled' ? other.inDevelopment : ''"
|
|
|
|
|
|
@click="addcol(item,index)"
|
2020-01-13 18:48:25 +08:00
|
|
|
|
:id="'element-set-el-'+index"
|
2020-01-08 22:19:46 +08:00
|
|
|
|
>
|
|
|
|
|
|
<i class="el-icon-check" v-if="index==0||index==1||item.visibility=='disabled'"></i>
|
|
|
|
|
|
<i v-else class="el-icon-check" v-show="item.show"></i>
|
|
|
|
|
|
<span>{{item.label}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-scrollbar>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="elementset-bottom-btns">
|
2020-02-17 18:20:14 +08:00
|
|
|
|
<button v-if="isCancel" type="button" @click="dropAll(false)" class="nz-btn nz-btn-size-small nz-btn-style-light nz-btn-min-width-35 is-cancel">
|
|
|
|
|
|
<span class="top-tool-btn-txt">{{$t('overall.clear')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button v-if="!isCancel" type="button" @click="dropAll(true)" class="nz-btn nz-btn-size-small nz-btn-style-light nz-btn-min-width-35">
|
2020-01-08 22:19:46 +08:00
|
|
|
|
<span class="top-tool-btn-txt">{{$t('overall.all')}}</span>
|
|
|
|
|
|
</button>
|
2020-02-17 18:20:14 +08:00
|
|
|
|
<div>
|
|
|
|
|
|
<button type="button" @click="shezhiControl('cancel')" class="nz-btn nz-btn-size-small nz-btn-style-light nz-btn-min-width-35">
|
|
|
|
|
|
<span class="top-tool-btn-txt">{{$t('overall.esc')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button type="button" @click="shezhiControl('ok')" class="nz-btn nz-btn-size-small nz-btn-style-normal nz-btn-min-width-35">
|
|
|
|
|
|
<span class="top-tool-btn-txt">{{$t('overall.save')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!--<button type="button" @click="dropAll(false)" class="nz-btn nz-btn-size-normal nz-btn-style-light">
|
2020-01-08 22:19:46 +08:00
|
|
|
|
<span class="top-tool-btn-txt">{{$t('overall.cancel')}}</span>
|
2020-02-17 18:20:14 +08:00
|
|
|
|
</button>-->
|
2020-01-08 22:19:46 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
export default {
|
2020-03-24 19:22:24 +08:00
|
|
|
|
props: ["dropCol","tableTitle","path"],
|
2020-01-08 22:19:46 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2020-01-09 14:57:44 +08:00
|
|
|
|
other: this.$t("overall.other"),
|
2020-01-08 22:19:46 +08:00
|
|
|
|
event_positiony: 0,
|
|
|
|
|
|
event_positionx: 0,
|
|
|
|
|
|
eventfixedVal: {},
|
2020-01-16 15:48:49 +08:00
|
|
|
|
dropColRes: JSON.parse(JSON.stringify(this.dropCol)),
|
|
|
|
|
|
titles: JSON.parse(JSON.stringify(this.tableTitle))
|
2020-01-08 22:19:46 +08:00
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted() {},
|
2020-01-16 15:48:49 +08:00
|
|
|
|
created() {
|
|
|
|
|
|
let localStorageTitle=JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path));
|
|
|
|
|
|
if(localStorageTitle){
|
|
|
|
|
|
for(let title of this.titles){
|
|
|
|
|
|
for(let lsTitle of localStorageTitle){
|
|
|
|
|
|
if(lsTitle.prop === title.prop){
|
|
|
|
|
|
lsTitle.label=title.label;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
localStorage.setItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path,JSON.stringify(localStorageTitle))
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
2020-01-08 22:19:46 +08:00
|
|
|
|
watch: {
|
|
|
|
|
|
dropCol: {
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler(data) {
|
|
|
|
|
|
this.dropColRes = JSON.parse(JSON.stringify(data));
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
position: {
|
|
|
|
|
|
//监听设置icon的显示位置
|
|
|
|
|
|
handler(data) {
|
|
|
|
|
|
this.event_positiony = data.positiony;
|
|
|
|
|
|
this.event_positionx = data.positionx;
|
|
|
|
|
|
},
|
|
|
|
|
|
immediate: true
|
|
|
|
|
|
},
|
|
|
|
|
|
eventfixed: {
|
|
|
|
|
|
handler(data) {
|
|
|
|
|
|
if (data)
|
|
|
|
|
|
this.eventfixedVal = data;
|
|
|
|
|
|
},
|
|
|
|
|
|
immediate: true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
//悬浮点击空白隐藏
|
|
|
|
|
|
elementsetHide() {
|
|
|
|
|
|
this.eventfixedVal.shezhi = 0;
|
2020-03-24 19:22:24 +08:00
|
|
|
|
this.$emit('close');
|
2020-01-08 22:19:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
//点击全选all或者cancel按钮
|
|
|
|
|
|
dropAll(state) {
|
|
|
|
|
|
for (let index = 0; index < this.dropColRes.length; index++) {
|
|
|
|
|
|
if (index == 0 || index == 1) {
|
|
|
|
|
|
this.dropColRes[index].show = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.dropColRes[index].show = state;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
//下拉选项选择
|
|
|
|
|
|
addcol(val, index) {
|
|
|
|
|
|
if (index == 0 || index == 1) {
|
|
|
|
|
|
this.dropColRes[index].show = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.dropColRes[index].show = !this.dropColRes[index].show;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
//点击第二个cancel
|
|
|
|
|
|
shezhiControl(t) {
|
|
|
|
|
|
if (t == "ok") {
|
|
|
|
|
|
this.$emit("tablelable", JSON.parse(JSON.stringify(this.dropColRes)));
|
|
|
|
|
|
localStorage.setItem(
|
2020-03-24 19:22:24 +08:00
|
|
|
|
"nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + ((typeof this.path != 'undefined') ? this.path : this.$route.path),
|
2020-01-08 22:19:46 +08:00
|
|
|
|
JSON.stringify(this.tablelable)
|
|
|
|
|
|
);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.dropColRes = JSON.parse(JSON.stringify(this.tablelable));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.elementsetHide();
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
eventfixed() {
|
|
|
|
|
|
return this.$store.state.eventfixed;
|
|
|
|
|
|
},
|
|
|
|
|
|
position() {
|
|
|
|
|
|
return this.$store.state.position;
|
|
|
|
|
|
},
|
|
|
|
|
|
tablelable() {
|
|
|
|
|
|
return this.$store.state.tablelable;
|
|
|
|
|
|
},
|
2020-02-17 18:20:14 +08:00
|
|
|
|
//点击all是否是全部取消选中,true为是
|
|
|
|
|
|
isCancel() {
|
|
|
|
|
|
let isCancel = true;
|
|
|
|
|
|
for (let i = 0; i < this.dropColRes.length; i++) {
|
|
|
|
|
|
if (!this.dropColRes[i].show) {
|
|
|
|
|
|
isCancel = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return isCancel;
|
|
|
|
|
|
}
|
2020-01-08 22:19:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.pop-elementset {
|
2020-01-17 16:06:35 +08:00
|
|
|
|
padding: 0 12px 12px 12px;
|
2020-01-08 22:19:46 +08:00
|
|
|
|
border: 1px solid #EBEEF5;
|
2020-01-17 16:06:35 +08:00
|
|
|
|
box-shadow: $pop-box-shadow;
|
2020-01-08 22:19:46 +08:00
|
|
|
|
position: fixed;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 10px;
|
|
|
|
|
|
width: 200px;
|
|
|
|
|
|
color: #606266;
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
z-index: 999;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.elementset-labels {
|
2020-02-17 18:20:14 +08:00
|
|
|
|
margin-top: 12px;
|
2020-01-08 22:19:46 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 300px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.elementset-labels i {
|
|
|
|
|
|
color: #04b330;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
left: 5px;
|
|
|
|
|
|
top: 6px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.elementset-label {
|
|
|
|
|
|
padding: 2px 0 2px 25px;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
cursor: default;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.elementset-label-disabled {
|
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
background: #f1f3f4;
|
|
|
|
|
|
opacity: 0.7;
|
|
|
|
|
|
}
|
|
|
|
|
|
.elementset-bottom-btns {
|
|
|
|
|
|
margin-top: 7px;
|
2020-02-17 18:20:14 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
2020-01-08 22:19:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
.unshow {
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|