<template>
	<el-container class="mainBox">
		<el-main class="nopadding">
			<div class="searchMain">
				<scSearch ref="scSearch" :searchList="searchList" @fetchSelectData="getSelectData"></scSearch>

				<div class="searchItem searchBtn">
					<el-button :size="size" type="primary" @click="save">保存配置</el-button>
				</div>
			</div>
			<scTable ref="table" :apiObj="list.apiObj" :column="list.column" stripe :size="size" highlightCurrentRow :hideDo="true" :hidePagination="true">
				<el-table-column width="200" label="机房名称" prop="name"></el-table-column>
				<el-table-column width="200" label="机房代码" prop="code"></el-table-column>
				<el-table-column width="200" label="机房城市" prop="city"></el-table-column>
				<el-table-column label="操作" fixed="right" align="center" width="160">
					<template #default="scope">
						<el-dropdown>
							<el-button class="noBorderBtn" icon="el-icon-more" :size="size"></el-button>
							<template #dropdown>
								<el-dropdown-menu>
									<el-dropdown-item @click="table_del(scope.row, 'delete')" icon="sc-icon-Delete">删除配置</el-dropdown-item>
								</el-dropdown-menu>
							</template>
						</el-dropdown>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>
</template>

<script>
export default {
	name: "computerRoom",
	data(){
		return{
			size:'small',
			list:{
				apiObj: this.$API.setup.room.list,
				column:[]
			},
			params: {},
			searchList:[
				{name:'机房名称',type:'text',code:'name', placeholder:"请输入机房名称",show:true},
				{name:'机房代码',type:'text',code:'code', placeholder:"请输入机房代码",show:true},
				{name:'机房城市',type:'text',code:'city', placeholder:"请输入机房城市",show:true},
			],
		}
	},
	mounted() {

	},
	methods:{
		getSelectData(item){
			let {params} = item;
			this.params = params;
		},
		async save() {
			const res = await this.$API.setup.room.add.post(this.params);
			if(res.code == 200){
				this.$refs.table.refresh();
			}
		},
		table_del(){

		}
	}
}
</script>

<style scoped lang="scss">

</style>
