<template>
  <div>
    <div class="kettle_content">
      <div class="kettle_monitor_content">
        <div class="kettle_retrieval">
          <el-input
            v-model="search"
            class="kettle_retrieval_input"
            size="mini"
            placeholder="搜索名称"
            @input="kettleRetrievalChange($event)"/>
          <el-button class="kettle_retrieval_btn" @click="retrievalBtnEvent">检索</el-button>
        </div>

        <el-table ref="filterTable" :data="table_data" stripe style="width: calc(100%);">
          <el-table-column class-name="minitor_name" prop="minitorName" label="名称" min-width="10%" />
          <el-table-column class-name="minitor_group" prop="minitorGroup" label="分组" min-width="12%"/>
          <el-table-column class-name="execut_time" prop="executTime" label="执行时间" min-width="11%" />
          <el-table-column class-name="database" prop="database" label="数据库" min-width="7%" />
          <el-table-column class-name="execut_status" prop="executStatus" label="执行状态" min-width="6%" >
            <template slot-scope="scope">
              <div v-if="scope.row.executStatus == '' || scope.row.executStatus == ' ' || scope.row.executStatus == null"/>
              <div v-else>
                <div :class="scope.row.executStatus === '正常' ? 'columNormal' : 'columCancelled'">
                  <i/>
                  <span>{{ scope.row.executStatus }}</span>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column class-name="file_name" prop="fileName" label="文件名" min-width="15%"/>
          <el-table-column class-name="operation" prop="operation" label="操作" min-width="9%" >
            <template slot-scope="scope">
              <el-button class="kettle_btn_modify" @click="kettleModifyItemEvent(scope.row)">修改</el-button>
              <el-dialog :modal-append-to-body="false" :visible.sync="dialogKettleFormVisible" title="修改" class="kettle_form_dialog">
                <el-form :model="kettleForm">
                  <el-form-item :label-width="formLabelWidth" label="名称：" required>
                    <el-input v-model="kettleForm.minitorName" autocomplete="off"/>
                  </el-form-item>
                  <el-form-item :label-width="formLabelWidth" label="分组：" required>
                    <el-select v-model="kettleForm.minitorGroup" >
                      <el-option v-for="item in minitorGroupList" :key="item" :value="setProjectValueClass(item)" :class="setProjectTypeClass(item)">
                        <span>{{ item.typeDesc }}</span>
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item :label-width="formLabelWidth" label="执行时间：" required>
                    <el-select v-model="kettleForm.executTime" >
                      <el-option v-for="item in executTimeList" :key="item" :value="setProjectValueClass(item)" :class="setProjectTypeClass(item)">
                        <span>{{ item.typeDesc }}</span>
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item :label-width="formLabelWidth" label="数据库：" required>
                    <el-select v-model="kettleForm.database" >
                      <el-option v-for="item in databaseList" :key="item" :value="setProjectValueClass(item)" :class="setProjectTypeClass(item)">
                        <span>{{ item.typeDesc }}</span>
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item :label-width="formLabelWidth" label="运行状态：" required>
                    <el-input :disabled="true" v-model="kettleForm.executStatus" autocomplete="off"/>
                  </el-form-item>
                  <el-form-item :label-width="formLabelWidth" label="文件名：" required>
                    <el-input v-model="kettleForm.fileName" autocomplete="off" placeholder="请输入项目名称"/>
                  </el-form-item>

                </el-form>
                <div slot="footer" class="dialog-footer">
                  <el-button class="kettle_modify_cancel" @click="dialogKettleFormVisible = false">取 消</el-button>
                  <el-button type="primary" @click="modifyKettleFromSureBtn">确 定</el-button>
                </div>
              </el-dialog>
              <el-button class="kettle_btn_log">日志</el-button>
            </template>
            <!--<router-link class="colum_btn_log" tag="li">日志</router-link>-->
          </el-table-column>
        </el-table>
        <div class="device_pagination">
          <el-pagination
            :current-page="currentPage"
            :page-size="pageSize"
            :total="tableDataLen"
            :page-sizes="[10, 15, 20]"
            background
            layout="slot,total, prev, pager, next,sizes, jumper"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange">
            <span>第{{ (currentPage-1)*pageSize+1 }}-{{ currentPage*pageSize>tableDataLen? tableDataLen:currentPage*pageSize }}项，</span>
          </el-pagination>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import kettleMon from './kettle-monitor.js'
import './../../common/common.css'
export default kettleMon
</script>
 <style>
   @import "./kettle-monitor.css"
 </style>

