<template>
	<el-row>
		<el-col :span="24">
			<el-table :data="state.getList" style="width: 100%">

				<el-table-column prop="doctors.userName" label="主治医生" align="center" />
				<el-table-column prop="oneDoctors.userName" label="申请医生" align="center" />
				<el-table-column prop="createTime" label="申请时间" align="center" />
				<el-table-column prop="purpose" label="申请目的" align="center" />
				<el-table-column prop="hex" label="密钥" align="center" />
				<el-table-column prop="status" label="申请状态" align="center" />
				<el-table-column fixed="right" label="操作"  align="center">
					<template #default="scope">
						<el-button

							link
							type="primary"
							size="small"
							@click.prevent="update(scope.row,'同意授权')"
						>
							同意授权
						</el-button>
						<el-button
							link
							type="primary"
							size="small"
							@click.prevent="update(scope.row,'拒绝授权')"
						>
							拒绝授权
						</el-button>

					</template>
				</el-table-column>

			</el-table>
		</el-col>
	</el-row>
</template>
<script setup lang="ts">

const state = reactive({
	getList:[]
})
function init() {
	frontRequest.get("/api/audit/list",{params:{limit:999}}).then(res =>{
		state.getList = res.data
	})
}

onMounted(()=>{
	init()
})

function update(data:any,status:string) {
	console.log(data)
	data.status = status
	frontRequest.put("/api/audit",data).then(res =>{
		state.getList = res.data

		init()
	})
}

</script>
<style scoped>

</style>
<route lang="json">
{
"meta": {
"layout": "front"
}
}
</route>
