<template>
  <div class="comp-content">
    <Dialog
      v-model="dialogVisible"
      diaTitle="应用信息"
      :width="500"
      :height="500"
      @close="closeFun"
      show-footer
    >
      <TableForm v-model:data="appInfo" ref="tableFormRef" tableName="APP_CENTER" showDisabled>
      </TableForm>
      <template #footer>
        <div>
          <el-button @click="closeFun">取消</el-button>
          <el-button type="primary" @click="closeFun">确定</el-button>
        </div>
      </template>
    </Dialog>
  </div>
</template>
<script lang="ts" setup>
import Dialog from '@/components/common/dialog/index.vue';
// import { ElMessage } from 'element-plus';
import { computed, onMounted, ref, watch } from 'vue';
import TableForm from '@/components/common/table/tableForm.vue';
import { appList } from './stencil';

const props = defineProps<{
  showDialog: boolean;
  nodeAttribute: any;
}>();

const dialogVisible = computed({
  get() {
    return props.showDialog;
  },
  set(val) {
    emits('update:showDialog', val);
  },
});
const emits = defineEmits(['update:showDialog']);

const closeFun = () => {
  emits('update:showDialog', false);
};

const appInfo = ref();
watch(
  () => props.showDialog,
  () => {
    if (props.showDialog) {
      appList.forEach((item: any) => {
        if (item.uuid === props.nodeAttribute.uuid) {
          appInfo.value = item;
        }
      });
    }
  }
);
onMounted(() => {});
</script>
