mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 00:10:25 +08:00 
			
		
		
		
	fix: 子组件事件通知修复
This commit is contained in:
		@@ -128,7 +128,7 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<script lang="ts" setup>
 | 
			
		||||
import { watch, toRefs, reactive, ref, getCurrentInstance } from 'vue';
 | 
			
		||||
import { watch, toRefs, reactive, ref } from 'vue';
 | 
			
		||||
import { TYPE_LIST, CHARACTER_SET_NAME_LIST, COLLATION_SUFFIX_LIST } from './service.ts';
 | 
			
		||||
import { ElMessage } from 'element-plus';
 | 
			
		||||
import SqlExecBox from './component/SqlExecBox.ts';
 | 
			
		||||
@@ -152,11 +152,9 @@ const props = defineProps({
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
//定义事件
 | 
			
		||||
const emit = defineEmits(['update:visible', 'cancel', 'val-change'])
 | 
			
		||||
const emit = defineEmits(['update:visible', 'cancel', 'val-change', 'submit-sql'])
 | 
			
		||||
 | 
			
		||||
const formRef: any = ref();
 | 
			
		||||
const { proxy } = getCurrentInstance() as any;
 | 
			
		||||
 | 
			
		||||
const state = reactive({
 | 
			
		||||
    dialogVisible: false,
 | 
			
		||||
    btnloading: false,
 | 
			
		||||
@@ -339,8 +337,7 @@ const submit = async () => {
 | 
			
		||||
        dbId: props.dbId as any,
 | 
			
		||||
        db: props.db,
 | 
			
		||||
        runSuccessCallback: () => {
 | 
			
		||||
            proxy.$parent.openEditTable({ tableName: state.tableData.tableName });
 | 
			
		||||
            proxy.$parent.refreshTableInfo();
 | 
			
		||||
            emit('submit-sql', {tableName: state.tableData.tableName });
 | 
			
		||||
            // cancel();
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
@@ -245,7 +245,10 @@
 | 
			
		||||
        <db-edit @val-change="valChange" :title="dbEditDialog.title" v-model:visible="dbEditDialog.visible"
 | 
			
		||||
            v-model:db="dbEditDialog.data"></db-edit>
 | 
			
		||||
        <create-table :title="tableCreateDialog.title" :active-name="tableCreateDialog.activeName" :dbId="dbId" :db="db"
 | 
			
		||||
            :data="tableCreateDialog.data" v-model:visible="tableCreateDialog.visible"></create-table>
 | 
			
		||||
            :data="tableCreateDialog.data" v-model:visible="tableCreateDialog.visible"
 | 
			
		||||
                      @submit-sql="onSubmitSql"
 | 
			
		||||
        
 | 
			
		||||
        ></create-table>
 | 
			
		||||
    </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
@@ -584,10 +587,9 @@ const showTableInfo = async (row: any, db: string) => {
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// 给子组件调用,勿删
 | 
			
		||||
// eslint-disable-next-line no-unused-vars
 | 
			
		||||
const refreshTableInfo = async () => {
 | 
			
		||||
  state.tableInfoDialog.infos = await dbApi.tableInfos.request({ id: state.dbId, db: state.db });
 | 
			
		||||
const onSubmitSql = async (row: {tableName: string}) => {
 | 
			
		||||
    await openEditTable(row)
 | 
			
		||||
    state.tableInfoDialog.infos = await dbApi.tableInfos.request({ id: state.dbId, db: state.db });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const closeTableInfo = () => {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user