fix: MyEvent事件移除

This commit is contained in:
zhangyh
2025-10-22 16:21:59 +08:00
parent 6602945ebd
commit 569ffd2bf3
2 changed files with 85 additions and 74 deletions

View File

@@ -1,16 +1,15 @@
class MyEvent {
static list = []
add(name, call) {
MyEvent.list.push({ name, call })
}
remove(name, call) {
MyEvent.list.filter(item=>item.name!=name&&item.call!=call)
MyEvent.list = MyEvent.list.filter(item => item.name != name && item.call != call)
}
emit(name, data) {
MyEvent.list.forEach(item => {
if (item.name == name) item.call(data)
});
})
}
}
export default new MyEvent()

View File

@@ -31,14 +31,24 @@
<div class="operate_list" v-if="column?.Operations">
<div
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)"
>
{{ $t('HistoryPage.Detail') }}
</div>
<div
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)"
>
{{ $t('HistoryPage.Edit') }}
@@ -91,7 +101,7 @@ import TableSearchBar from '@/component/common/TableSearchBar.vue'
import projectSetting from '@/component/home/newProject/setting.vue'
import { useStore } from 'vuex'
import router from '@/router'
import MyEvent from "@/tool/myEvents";
import MyEvent from '@/tool/myEvents'
export default defineComponent({
components: {
@@ -251,7 +261,7 @@ export default defineComponent({
},
async mounted() {
MyEvent.add('remChange', this.setPageSize)
this.setPageSize();
this.setPageSize()
await this.getHistoryList()
this.$nextTick(() => {
this.calcScrollHeight()
@@ -269,14 +279,14 @@ export default defineComponent({
methods: {
setPageSize(rem) {
const historyTable = this.$refs.historyTable
const height = historyTable.offsetHeight;
const size = Math.trunc((height - 110) / 54);
const height = historyTable.offsetHeight
const size = Math.trunc((height - 110) / 54)
this.pageSize = size || 1
if (rem) {
this.currentPage = 1
this.getHistoryList()
}
console.log("==========size:"+size+" rem:"+rem+" height:"+height)
console.log('==========size:' + size + ' rem:' + rem + ' height:' + height)
},
getClass() {
let data = {
@@ -660,9 +670,11 @@ export default defineComponent({
height: 100%;
.ant-table {
flex: 1;
.ant-table-container,.ant-table-content,table{
// .ant-table-container,
// .ant-table-content,
// table {
// height: 100%;
}
// }
}
}
}
@@ -686,10 +698,10 @@ export default defineComponent({
width: 0 !important;
}
}
:deep(.ant-table-content) {
// :deep(.ant-table-content) {
// max-height: v-bind(historyTableHeight);
// overflow-y: v-bind(scrolled);
}
// }
:deep(.ant-table-thead > tr > th) {
// background: #ffffff;
@@ -714,12 +726,12 @@ export default defineComponent({
height: 4rem;
min-width: 4rem;
line-height: 4rem;
margin-right: .8rem;
margin-right: 0.8rem;
}
:deep(.ant-pagination-options-quick-jumper) {
height: 4rem;
line-height: 4rem;
margin-left: .8rem;
margin-left: 0.8rem;
font-size: 1.6rem;
> input {
width: 7rem;