<template>
	<el-dialog
		:before-close="beforeClose"
		title="操作结果"
		v-model="resultVisible"
		width="40%"
	>
		<div class="sale-page-table-body">
			<el-table
				:data="tableInfo"
				:header-cell-class-name="headerRigthMethod"
				border
				class="table-box"
				height="300"
				id="tableInfo-table1"
			>
				<el-table-column label="序号" prop="date" width="50">
					<template #default="scope">
						<span>{{ scope.$index + 1 }}</span>
					</template>
				</el-table-column>
				<el-table-column
					label="审批流编码"
					prop="orderNo"
					width="200"
				></el-table-column>
				<el-table-column label="指令" prop="a" width="110">
					<template #default>
						<span>
							{{ ACTIONType[actionType] }}
						</span>
					</template>
				</el-table-column>
				<el-table-column label="结果" width="80">
					<template #default="scope">
						<span :style="{ 'txt-Red': scope.row.isSuccess }">{{
							scope.row.isSuccess ? '成功' : '失败'
						}}</span>
					</template>
				</el-table-column>
				<el-table-column label="信息" prop="msg">
					<template #default="scope">
						<span class="txt-Red">{{ scope.row.msg }}</span>
					</template>
				</el-table-column>
			</el-table>
		</div>
		<template #footer>
			<span class="dialog-footer">
				<span class="f-12 ext-black-light" style="margin-right: 25px">
					共{{
						tableInfo && tableInfo.length > 0
							? tableInfo.length
							: 0
					}}条
				</span>
				<el-button
					@click="handelhtmlToExcel('tableInfo-table1', '操作结果')"
					size="small"
					>导 出</el-button
				>
				<el-button @click="beforeClose" size="small" type="primary"
					>关 闭</el-button
				>
			</span>
		</template>
	</el-dialog>
</template>

<script setup>
import { toRefs } from 'vue';
const props = defineProps({
	beforeClose: {
		type: Function,
	},
	handelhtmlToExcel: {
		type: Function,
	},
	resultVisible: {
		type: Boolean,
	},
	tableInfo: {
		type: Array,
	},
	actionType: {
		type: String,
	},
});
const emits = defineEmits(['handelhtmlToExcel', 'beforeClose']);
const ACTIONType = {
	submit: '提交',
	revoke: '撤销',
	audit: '审核',
	noAudit: '反审',
};

const { resultVisible } = toRefs(props);
const handelhtmlToExcel = (type, title) => {
	emits('handelhtmlToExcel', type, title);
};

const beforeClose = () => {
	emits('beforeClose');
};
</script>

<style lang="scss" scoped></style>
