<template>
	<el-container>
		<!-- <el-header>
			<div class="left-panel">
				<el-button type="primary" icon="el-icon-plus" @click="add"></el-button>
				<el-button type="danger" plain icon="el-icon-delete" :disabled="selection.length==0" @click="batch_del"></el-button>
				<el-button type="primary" plain :disabled="selection.length!=1" @click="permission">权限设置</el-button>
			</div>
			<div class="right-panel">
				<div class="right-panel-search">
					<el-input v-model="search.keyword" placeholder="姓名/手机号" clearable @click="upsearch"></el-input>
					<el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
				</div>
			</div>
		</el-header> -->
		<el-main class="nopadding">
			<scTable ref="table" :apiObj="apiObj" row-key="id" fit stripe @resetQuery="resetQuery">
				<el-table-column label="#" type="index" width="50"></el-table-column>
				<el-table-column label="事件种类" prop="cate_name"></el-table-column>
				<el-table-column label="发生区域" prop="area_name">
				</el-table-column>
                <el-table-column label="人员类型" prop="peope_type">
                    <template #default="scope">
                        <span v-if="scope.row.peope_type=='employee'">企业员工</span>
                        <span v-if="scope.row.peope_type=='remployee'">相关方</span>
                        <span v-if="scope.row.peope_type=='visitor'">访客</span>
                    </template>
                </el-table-column>
				<el-table-column label="当事人" prop="people_name"></el-table-column>
				<el-table-column label="发生时间" prop="create_time"></el-table-column>
                <el-table-column label="是否已处理">
                    <template #default="scope">
                        <el-icon v-if="scope.row.handle_user" color="green"><CircleCheckFilled /></el-icon>
                        <el-icon v-else color="red"><CircleCloseFilled /></el-icon>
                    </template>
                </el-table-column>
				<el-table-column label="操作" fixed="right" align="right">
					<template #default="scope">
						<el-button-group>
							<el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
							<!-- <el-button text type="warning" size="small" @click="table_edit(scope.row, scope.$index)">编辑</el-button> -->
							<!-- <el-popconfirm title="确定删除吗？" @confirm="table_del(scope.row, scope.$index)">
								<template #reference>
									<el-button text type="danger" size="small">删除</el-button>
								</template>
							</el-popconfirm> -->
						</el-button-group>
					</template>
				</el-table-column>

			</scTable>
		</el-main>
	</el-container>
    </template>
    <script>
    import { CircleCheckFilled, CircleCloseFilled } from '@element-plus/icons-vue'
	export default {
		name: 'event',
		components: {
            CircleCheckFilled,
            CircleCloseFilled
		},
		data() {
			return {
				dialog: {
					save: false,
					permission: false
				},
				apiObj: this.$API.ecm.event.list,
				query: {},
				selection: [],
				search: {
					keyword: null
				}
			}
		},
		methods: {
			//查看
			table_show(row){
				this.dialog.save = true
				this.$nextTick(() => {
					this.$refs.saveDialog.open('show').setData(row)
				})
			},
			//搜索
			upsearch(){

			},
			//本地更新数据
			handleSaveSuccess(data, mode){
				if(mode=='add'){
					this.$refs.table.refresh()
				}else if(mode=='edit'){
					this.$refs.table.refresh()
				}
			},
			resetQuery(){
				this.query = {}
			}
		}
	}
    </script>