<template>
	<div class="knowledge-knowledge-ProcessRecord-container">
		<el-dialog title="审核记录" v-model="state.isShowDialog" draggable>
			<el-table :data="state.tableData">
				<el-table-column prop="date" label="审核人" width="180" />
				<el-table-column prop="name" label="审核状态" width="180" />
				<el-table-column prop="name" label="审核时间" width="180">
                    <template #default="{row}">
                        {{ formatDate(row.creationTime,'YYYY-mm-dd HH:MM:SS') }}
                    </template>
                </el-table-column>
				<el-table-column prop="address" label="备注" />
			</el-table>
			<template #footer>
				<span class="dialog-footer">
					<el-button @click="state.isShowDialog = false" class="default-button">关 闭</el-button>
				</span>
			</template>
		</el-dialog>
	</div>
</template>

<script setup lang="ts" name="knowledgeProcessRecord">
import { reactive } from 'vue';
import { formatDate } from '/@/utils/formatTime';
import { KnowledgeGetworkflow } from '/@/api/knowledge';

// 定义变量内容
const state = reactive<any>({
	isShowDialog: false,
    tableData:[]
});
// 打开弹窗
const openDialog = (row: any) => {
	KnowledgeGetworkflowFn(row.workflowId);
	state.isShowDialog = true;
};
// 关闭弹窗
const closeDialog = () => {
	state.isShowDialog = false;
};
// 查询规范详情
const KnowledgeGetworkflowFn = async (id: string) => {
	try {
		state.loading = true;
		const res: any = await KnowledgeGetworkflow(id);
		state.tableData = res.result?.traces ?? [];
		state.loading = false;
	} catch (error) {
		state.loading = false;
	}
};
// 暴露变量
defineExpose({
	openDialog,
	closeDialog,
});
</script>
