<template>
	<div class="app-list-content">
		<cl-crud class="liu-crud-wrap" @load="onLoad">
			<!-- 权限 -->
			<template #slot-auth="{scope}">
				<el-button type="text" size="mini" @click="authFn">权限</el-button>
			</template>
		</cl-crud>
	</div>
</template>

<script>
export default {
	data() {
		return {
			// cl-crud
			app: null
		};
	},
	mounted() {},
	methods: {
		authFn() {},
		// crud
		onLoad({ ctx, app }) {
			this.app = app;
			let applyHost = () => {
				return this.$service.sassAuth.packageList();
			};
			ctx.service({
				page: applyHost
			})
				.set('table', {
					columns: [
						{
							prop: 'id',
							label: 'ID',
							align: 'center'
						},
						{
							prop: 'name',
							label: '名称',
							align: 'center'
						},
						{
							prop: 'price',
							label: '价格',
							align: 'center'
						},
						{
							prop: 'num',
							label: '花店数量',
							align: 'center'
						}
					],
					// 操作列
					op: {
						visible: true, // 是否显示
						// 同 element-ui Table-column Attributes
						props: {
							width: 100,
							align: 'center',
							fixed: 'right',
							label: '操作'
						},
						// 布局，请移步 `layout`
						layout: ['slot-auth']
					}
				})
				.set('layout', [
					['slot-tabs'],
					['flex1', 'refresh-btn'],
					['data-table'],
					['flex1', 'pagination']
				])
				.done();
			app.refresh();
		}
	}
};
</script>
