<template>
    <div class="g-main">
        <div>
            <div class="m-search">
                <el-form :inline="true" :model="formData" ref="ref_searchform" :label-width="'100px'">
                    <div>
                        <el-form-item label="事件类型" prop="agencyId">
                            <el-cascader class="u-item-width-normal"
                                size="small"
                                ref="myCascader"
                                v-model.trim="formData.agencyId"
                                :options="orgOptions"
                                :props="orgOptionProps"
                                :show-all-levels="false"
                                @change="handleChangeAgency"
                                clearable></el-cascader>
                        </el-form-item>
                        <el-form-item label="工单编号" prop="eventContent">
                            <el-input v-model.trim="formData.eventContent" class="u-item-width-normal" size="small" clearable
                                placeholder="请输入">
                            </el-input>
                        </el-form-item>
                        <el-form-item label="报件人电话" prop="eventContent">
                            <el-input v-model.trim="formData.eventContent" class="u-item-width-normal" size="small" clearable
                                placeholder="请输入">
                            </el-input>
                        </el-form-item>
                        <el-form-item label="事件描述" prop="eventContent">
                            <el-input v-model.trim="formData.eventContent" class="u-item-width-normal" size="small" clearable
                                placeholder="请输入">
                            </el-input>
                        </el-form-item>
                        <el-form-item label="派件状态" prop="firstIdList">
                            <el-cascader ref="cascaderEvent" v-model.trim="eventTypeCheck" :options="cateOptions" collapse-tags
                                :show-all-levels="false" :props="optionProps" clearable class="u-item-width-normal" @change="handleEventType" />
                            <!-- <template slot-scope="{ node, data }">
                  <div @click="cascaderClick(node, data)">
                    <span>{{ data.name }}</span>
                  </div>
                </template>
              </el-cascader> -->
                        </el-form-item>
                        <el-form-item label="指派部门" prop="agencyId">
                            <el-cascader class="u-item-width-normal"
                                size="small"
                                ref="myCascader"
                                v-model.trim="formData.agencyId"
                                :options="orgOptions"
                                :props="orgOptionProps"
                                :show-all-levels="false"
                                @change="handleChangeAgency"
                                clearable></el-cascader>
                        </el-form-item>
                        <el-form-item label="办结时限" prop="startTime">
                            <el-date-picker v-model.trim="formData.startTime" :picker-options="startPickerOptions"
                                class="u-item-width-daterange" size="small" type="date" value-format="yyyy-MM-dd HH:mm:ss"
                                value="yyyy-MM-dd" placeholder="开始时间">
                            </el-date-picker>
                            <span class="u-data-tag">至</span>
                            <el-date-picker v-model.trim="formData.endTime" :picker-options="endPickerOptions"
                                class="u-item-width-daterange u-data-tag" size="small" type="date"
                                value-format="yyyy-MM-dd HH:mm:ss" value="yyyy-MM-dd" placeholder="结束时间">
                            </el-date-picker>
                        </el-form-item>
                        <el-row>
                            <el-col :span="24" align="right">
                                <el-button style="margin-left: 30px" size="small" type="primary "
                                    @click="handleSearch">查询</el-button>
                                <el-button style="margin-left: 10px" size="small" class="diy-button--white"
                                    @click="resetSearch">重置</el-button>
                            </el-col>
                        </el-row>
                    </div>
                </el-form>
            </div>

            <div class="m-table">
                <div class="div_btn">

                    <el-button @click="handleExport" class="diy-button--white" size="small">导出</el-button>

                    <el-dropdown size="small" split-button type="primary" style="margin: 0 10px; height: 30px"
                        @command="(command) => handleMarkDiffcult(command)">
                        导入
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item command="1">下载模板</el-dropdown-item>
                            <el-dropdown-item command="2">上传导入</el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </div>

                <el-table :data="tableData" border class="m-table-item" style="width: 100%"
                    @selection-change="handleSelectionChange" :height="maxTableHeight">
                    <el-table-column label="" fixed="left" type="selection" align="center" width="50" />
                    <!-- <el-table-column label="序号" fixed="left" type="index" align="center" width="50" /> -->

                    <el-table-column prop="gridName" align="center" label="工单编号" :show-overflow-tooltip="true">
                    </el-table-column>
                    <el-table-column prop="categoryName" label="事件类别" min-width="140" align="center"
                        :show-overflow-tooltip="true" />
                    <!-- <template slot-scope="scope">
              {{ scope.row.firstName + '-' + scope.row.secondName }}
            </template>
          </el-table-column> -->
                    <el-table-column prop="eventContent" label="事件描述" align="center" :show-overflow-tooltip="true">
                    </el-table-column>
                    <el-table-column prop="eventContent" label="报件人" align="center" :show-overflow-tooltip="true">
                    </el-table-column>
                    <el-table-column prop="mobile" align="center" width="110" label="联系电话" :show-overflow-tooltip="true">
                        <template slot-scope="scope">
                            <el-button
                                v-if="scope.row.reportUserId !== null && scope.row.reportUserId !== ''"
                                @click="handleLook(scope.row)"
                                type="text"
                                size="small"
                            >
                                {{ scope.row.mobile }}
                            </el-button>
                            <span v-else>
                                {{ scope.row.mobile }}
                            </span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="mobile" align="center" width="110" label="办理状态" :show-overflow-tooltip="true">
                    </el-table-column>
                    <el-table-column prop="mobile" align="center" width="110" label="指定部门" :show-overflow-tooltip="true">
                    </el-table-column>
                    <el-table-column prop="mobile" align="center" width="110" label="办结时间" :show-overflow-tooltip="true">
                    </el-table-column>
                    <el-table-column fixed="right" label="操作" align="center" width="200px">
                        <template slot-scope="scope">
                            <el-button v-if="scope.row.status === 'processing' && !scope.row.operationId
                                " @click="handleDispose(scope.row)" type="text" size="small" class="">查看</el-button>

                            <el-button v-else-if="scope.row.status === 'closed_case' &&
                                !scope.row.satisfactionName &&
                                user.id === scope.row.createdUserId
                                " @click="handleWatch(scope.row)" type="text" size="small" class="">{{scope.row.paijian === 0 ? '派件' : '查看'}}</el-button>
                        </template>
                    </el-table-column>
                </el-table>

                <div>
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page.sync="pageNo" :page-sizes="[20, 50, 100, 200]" :page-size="parseInt(pageSize)"
                        layout="sizes, prev, pager, next, total" :total="total">
                    </el-pagination>
                </div>
            </div>
        </div>
        <div v-if="pageType == 'dispose' || pageType == 'info' || pageType == 'add'">
            <event-info ref="eleEditForm" :pageType="pageType" :eventId="eventId" :eventDetailData="eventDetailData"
                @handleClose="handleClose" @handleOk="handleOk" @dialogOk="handleEditSuccess" />
        </div>
    </div>
</template>

<script>


export default {
    data() {
        return{
            formData: {
                agencyId: "",
                gridId:"",
                sourceType: "",
                eventContent: "",
                name: "",
                mobile: "",
                startTime: "",
                endTime: "",
                status: "",
                firstIdList: [],
                secondIdList: [],
                openFlag:''
            },
            tableData:{
                
            }
    }
        }
      

}
</script>

<style lang="scss" scoped>
@import "@/assets/scss/modules/management/list-main.scss";

.m-search {
    .u-item-width-normal {
        width: 200px;
    }
}

::v-deep .el-dropdown__caret-button {
    height: 30px;
}

::v-deep .el-image-viewer__close {
    top: 129px;
    right: 129px;
    width: 40px;
    height: 40px;
    font-size: 40px;
    color: #fff;
}
</style>
