export default {
  name: 'kettleMon',
  data() {
    return {
      currentPage: 1,
      pageSize: 15,
      search: '',
      tableDataLen: '',
      dialogKettleFormVisible: false,
      tableData: [{
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '异常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '异常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }, {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      },
      {
        minitorName: '皮试医嘱监控',
        minitorGroup: 'kettlejobgroup5',
        executTime: '0 * * * * ?',
        database: 'EMR,HIS',
        executStatus: '正常',
        fileName: 'kettle/HTSNS.DAILY_PROJECT/HTSNS.DAILY_PROJECT.kjb'
      }
      ],
      kettleForm: {
        minitorName: '',
        minitorGroup: '',
        executTime: '',
        database: '',
        executStatus: '',
        fileName: ''
      },
      formLabelWidth: '114px',
      minitorGroupList: [],
      databaseList: [],
      executTimeList: []
    }
  },
  computed: {
    table_data() {
      const search = this.search
      // 搜索功能
      if (search) {
        const list = this.tableData.filter(data => !search || data.minitorName.toLowerCase().includes(search.toLowerCase()))
        const fenye = list.slice((this.currentPage - 1) * this.pageSize, this.currentPage * this.pageSize)
        this.tableDataLen = fenye.length
        // 获取查询的结果，把数组长度赋值给 分页组件中的total
        // this.tableData_length = fenye.length
        return fenye
      } else {
        // 分页功能
        // 所有数据的长度  赋值给分页组件中的total
        // this.tableData_length = this.tableData.length
        const fenye = this.tableData.slice((this.currentPage - 1) * this.pageSize, this.currentPage * this.pageSize)
        this.tableDataLen = this.tableData.length
        if (fenye.length < this.pageSize) {
          for (var i = fenye.length; i < this.pageSize; i++) {
            fenye.push({ minitorName: '', minitorGroup: '', executTime: '', database: '', executStatus: '', fileName: '' })
          }
        }
        return fenye
      }
    }
  },
  watch: {
    colorPicker: function() {
      console.log(122222)
      console.log(this.colorPicker)
    }
  },
  methods: {
    kettleRetrievalChange(e) {
      this.$forceUpdate()
    },
    formatter(row, column) {
      return row.address
    },
    filterTag(value, row) {
      return row.tag === value
    },
    filterHandler(value, row, column) {
      const property = column['property']
      return row[property] === value
    },
    handleCurrentChange(val) {
      this.currentPage = val
      console.log(`当前页: ${val}`)
    },
    handleSizeChange(val) {
      this.pageSize = val
      console.log(`每页 ${val} 条`)
    },
    kettleModifyItemEvent(row) {
      this.dialogKettleFormVisible = true
      this.kettleForm.minitorName = row.minitorName
      this.kettleForm.minitorGroup = row.minitorGroup
      this.kettleForm.executTime = row.executTime
      this.kettleForm.database = row.database
      this.kettleForm.executStatus = row.executStatus
      this.kettleForm.fileName = row.fileName
    },
    modifyKettleFromSureBtn() {

    },
    retrievalBtnEvent() {

    }
  }
}
