fix: MyEvent事件移除
This commit is contained in:
@@ -1,16 +1,15 @@
|
|||||||
|
class MyEvent {
|
||||||
class MyEvent{
|
static list = []
|
||||||
static list = []
|
add(name, call) {
|
||||||
add(name,call){
|
MyEvent.list.push({ name, call })
|
||||||
MyEvent.list.push({name,call})
|
}
|
||||||
}
|
remove(name, call) {
|
||||||
remove(name,call){
|
MyEvent.list = MyEvent.list.filter(item => item.name != name && item.call != call)
|
||||||
MyEvent.list.filter(item=>item.name!=name&&item.call!=call)
|
}
|
||||||
}
|
emit(name, data) {
|
||||||
emit(name,data){
|
MyEvent.list.forEach(item => {
|
||||||
MyEvent.list.forEach(item => {
|
if (item.name == name) item.call(data)
|
||||||
if(item.name == name)item.call(data)
|
})
|
||||||
});
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
export default new MyEvent()
|
export default new MyEvent()
|
||||||
@@ -24,21 +24,31 @@
|
|||||||
bordered: false,
|
bordered: false,
|
||||||
showQuickJumper: true,
|
showQuickJumper: true,
|
||||||
showSizeChanger: false,
|
showSizeChanger: false,
|
||||||
size:'small'
|
size: 'small'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template #bodyCell="{ column, text, record, index }">
|
<template #bodyCell="{ column, text, record, index }">
|
||||||
<div class="operate_list" v-if="column?.Operations">
|
<div class="operate_list" v-if="column?.Operations">
|
||||||
<div
|
<div
|
||||||
class="operate_item"
|
class="operate_item"
|
||||||
:class="{ 'operate_item_hidden': !(record.process ==='SERIES_DESIGN' || record.process ==='SINGLE_DESIGN') }"
|
:class="{
|
||||||
|
operate_item_hidden: !(
|
||||||
|
record.process === 'SERIES_DESIGN' ||
|
||||||
|
record.process === 'SINGLE_DESIGN'
|
||||||
|
)
|
||||||
|
}"
|
||||||
@click="turnToDetail(record)"
|
@click="turnToDetail(record)"
|
||||||
>
|
>
|
||||||
{{ $t('HistoryPage.Detail') }}
|
{{ $t('HistoryPage.Detail') }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="operate_item"
|
class="operate_item"
|
||||||
:class="{ 'operate_item_hidden': !(record.process ==='SERIES_DESIGN' || record.process ==='SINGLE_DESIGN') }"
|
:class="{
|
||||||
|
operate_item_hidden: !(
|
||||||
|
record.process === 'SERIES_DESIGN' ||
|
||||||
|
record.process === 'SINGLE_DESIGN'
|
||||||
|
)
|
||||||
|
}"
|
||||||
@click="renameCollection(record, index)"
|
@click="renameCollection(record, index)"
|
||||||
>
|
>
|
||||||
{{ $t('HistoryPage.Edit') }}
|
{{ $t('HistoryPage.Edit') }}
|
||||||
@@ -91,7 +101,7 @@ import TableSearchBar from '@/component/common/TableSearchBar.vue'
|
|||||||
import projectSetting from '@/component/home/newProject/setting.vue'
|
import projectSetting from '@/component/home/newProject/setting.vue'
|
||||||
import { useStore } from 'vuex'
|
import { useStore } from 'vuex'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import MyEvent from "@/tool/myEvents";
|
import MyEvent from '@/tool/myEvents'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
@@ -250,8 +260,8 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
MyEvent.add('remChange',this.setPageSize)
|
MyEvent.add('remChange', this.setPageSize)
|
||||||
this.setPageSize();
|
this.setPageSize()
|
||||||
await this.getHistoryList()
|
await this.getHistoryList()
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.calcScrollHeight()
|
this.calcScrollHeight()
|
||||||
@@ -260,24 +270,24 @@ export default defineComponent({
|
|||||||
this.getClass()
|
this.getClass()
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
MyEvent.remove('remChange',this.setPageSize)
|
MyEvent.remove('remChange', this.setPageSize)
|
||||||
if (this.resizeObserver) {
|
if (this.resizeObserver) {
|
||||||
this.resizeObserver.disconnect()
|
this.resizeObserver.disconnect()
|
||||||
this.resizeObserver = null
|
this.resizeObserver = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setPageSize(rem){
|
setPageSize(rem) {
|
||||||
const historyTable = this.$refs.historyTable
|
const historyTable = this.$refs.historyTable
|
||||||
const height = historyTable.offsetHeight;
|
const height = historyTable.offsetHeight
|
||||||
const size = Math.trunc((height - 110) / 54);
|
const size = Math.trunc((height - 110) / 54)
|
||||||
this.pageSize = size || 1
|
this.pageSize = size || 1
|
||||||
if(rem){
|
if (rem) {
|
||||||
this.currentPage = 1
|
this.currentPage = 1
|
||||||
this.getHistoryList()
|
this.getHistoryList()
|
||||||
}
|
}
|
||||||
console.log("==========size:"+size+" rem:"+rem+" height:"+height)
|
console.log('==========size:' + size + ' rem:' + rem + ' height:' + height)
|
||||||
},
|
},
|
||||||
getClass() {
|
getClass() {
|
||||||
let data = {
|
let data = {
|
||||||
classificationIdList: [],
|
classificationIdList: [],
|
||||||
@@ -438,10 +448,10 @@ export default defineComponent({
|
|||||||
renameCollection(record: any, index: number) {
|
renameCollection(record: any, index: number) {
|
||||||
// let searchLabel: any = this.$refs.searchLabel
|
// let searchLabel: any = this.$refs.searchLabel
|
||||||
// searchLabel.init(record, index)
|
// searchLabel.init(record, index)
|
||||||
this.$refs.projectSetting.init(record,'edit')
|
this.$refs.projectSetting.init(record, 'edit')
|
||||||
},
|
},
|
||||||
handleConfirmEdit({ data }) {
|
handleConfirmEdit({ data }) {
|
||||||
// router.push(`/home?history=${data.id}`)
|
// router.push(`/home?history=${data.id}`)
|
||||||
this.getHistoryList()
|
this.getHistoryList()
|
||||||
},
|
},
|
||||||
retrieveHome(record: any) {
|
retrieveHome(record: any) {
|
||||||
@@ -640,30 +650,32 @@ export default defineComponent({
|
|||||||
padding: 3rem 0 0;
|
padding: 3rem 0 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
.history_table_content {
|
.history_table_content {
|
||||||
margin-top: 2.6rem;
|
margin-top: 2.6rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
// height: calc(100% - 4rem);
|
// height: calc(100% - 4rem);
|
||||||
// padding-bottom: 3rem;
|
// padding-bottom: 3rem;
|
||||||
|
|
||||||
:deep(.ant-table-wrapper) {
|
:deep(.ant-table-wrapper) {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
.ant-spin-nested-loading {
|
.ant-spin-nested-loading {
|
||||||
&,
|
&,
|
||||||
.ant-spin-container {
|
.ant-spin-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
.ant-table{
|
.ant-table {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
.ant-table-container,.ant-table-content,table{
|
// .ant-table-container,
|
||||||
// height: 100%;
|
// .ant-table-content,
|
||||||
}
|
// table {
|
||||||
}
|
// height: 100%;
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -686,11 +698,11 @@ export default defineComponent({
|
|||||||
width: 0 !important;
|
width: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
:deep(.ant-table-content) {
|
// :deep(.ant-table-content) {
|
||||||
// max-height: v-bind(historyTableHeight);
|
// max-height: v-bind(historyTableHeight);
|
||||||
// overflow-y: v-bind(scrolled);
|
// overflow-y: v-bind(scrolled);
|
||||||
}
|
// }
|
||||||
|
|
||||||
:deep(.ant-table-thead > tr > th) {
|
:deep(.ant-table-thead > tr > th) {
|
||||||
// background: #ffffff;
|
// background: #ffffff;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
@@ -705,28 +717,28 @@ export default defineComponent({
|
|||||||
.ant-table-pagination-right {
|
.ant-table-pagination-right {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
:deep(.ant-pagination-prev),
|
:deep(.ant-pagination-prev),
|
||||||
:deep(.ant-pagination-next),
|
:deep(.ant-pagination-next),
|
||||||
:deep(.ant-pagination-jump-prev),
|
:deep(.ant-pagination-jump-prev),
|
||||||
:deep(.ant-pagination-jump-next),
|
:deep(.ant-pagination-jump-next),
|
||||||
:deep(.ant-pagination-item){
|
:deep(.ant-pagination-item) {
|
||||||
width: 4rem;
|
width: 4rem;
|
||||||
height: 4rem;
|
height: 4rem;
|
||||||
min-width: 4rem;
|
min-width: 4rem;
|
||||||
line-height: 4rem;
|
line-height: 4rem;
|
||||||
margin-right: .8rem;
|
margin-right: 0.8rem;
|
||||||
}
|
}
|
||||||
:deep(.ant-pagination-options-quick-jumper){
|
:deep(.ant-pagination-options-quick-jumper) {
|
||||||
height: 4rem;
|
height: 4rem;
|
||||||
line-height: 4rem;
|
line-height: 4rem;
|
||||||
margin-left: .8rem;
|
margin-left: 0.8rem;
|
||||||
font-size: 1.6rem;
|
font-size: 1.6rem;
|
||||||
> input{
|
> input {
|
||||||
width: 7rem;
|
width: 7rem;
|
||||||
height: 4rem;
|
height: 4rem;
|
||||||
font-size: 1.6rem;
|
font-size: 1.6rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.ant-table-pagination-right {
|
.ant-table-pagination-right {
|
||||||
padding-right: 3.5rem;
|
padding-right: 3.5rem;
|
||||||
}
|
}
|
||||||
@@ -764,7 +776,7 @@ export default defineComponent({
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #007ee5;
|
color: #007ee5;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&.operate_item_hidden {
|
&.operate_item_hidden {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user