<template>
    <div class="eibs-tab">
        <c-col :span="24" style="text-align: right">
            <c-button
                size="small"
                type="primary"
                style="margin-left: 0"
                :disabled="buttonFlag"
                @click="Start"
                >Start</c-button
            >
            <c-button
                size="small"
                type="primary"
                style="margin-left: 0"
                :disabled="!buttonFlag"
                @click="Stop"
                >Stop</c-button
            >
        </c-col>

        <c-col :span="24" style="margin-top: 10px">
            <c-table
                :border="true"
                :list="data"
                ref="table"
                style="width:80%,text-align:center"
                height="500"
                :paginationShow="false"
            >
                <el-table-column
                    label="Execute"
                    width="auto"
                    type="selection"
                    prop="exeflg"
                ></el-table-column>
                <el-table-column
                    label="Handler"
                    width="auto"
                    prop="srvhdl"
                    sortable
                ></el-table-column>
                <el-table-column
                    label="Service"
                    width="auto"
                    prop="srv"
                ></el-table-column>
                <el-table-column
                    label="Stop"
                    width="auto"
                    prop="stpflg"
                ></el-table-column>
                <el-table-column
                    label="Succ."
                    width="auto"
                    prop="cntsuc"
                ></el-table-column>
                <el-table-column
                    label="Retry"
                    width="auto"
                    prop="cntret"
                ></el-table-column>
                <el-table-column
                    label="Errors"
                    width="auto"
                    prop="cnterr"
                ></el-table-column>
                <el-table-column
                    label="Threshold"
                    width="auto"
                    prop="trsconerr"
                ></el-table-column>
                <el-table-column
                    label="Consecutive Errors"
                    width="auto"
                    prop="cntconerr"
                ></el-table-column>
                <el-table-column
                    label="Lck"
                    width="auto"
                    prop="trnlckflg"
                ></el-table-column>
                <el-table-column
                    label="Period for count (in hours)"
                    width="auto"
                    prop="cnttim"
                ></el-table-column>
                <el-table-column
                    label="Configure"
                    width="auto"
                    prop=""
                ></el-table-column>
            </c-table>
        </c-col>
    </div>
</template>
<script>
import Api from "~/service/Api";
import commonProcess from "~/mixin/commonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Mgrtsk/Event";

export default {
    inject: ["root"],
    props: ["model", "codes"],
    mixins: [commonProcess],
    data() {
        return {
            data: [],
            buttonFlag:false,
        };
    },
    methods: { ...Event,
        Start() {
            this.buttonFlag = false;
            let rtnmsg = this.executeRule("wfetsk.tsklist.butstr");
            if (rtnmsg.respCode == SUCCESS) {
                //TODO 处理数据逻辑
            }
        },
        Stop() {
            this.buttonFlag = true;
            let rtnmsg = this.executeRule("wfetsk.tsklist.butstp");
            if (rtnmsg.respCode == SUCCESS) {
                //TODO 处理数据逻辑
            }
        },
    },
    created: function () {},
    watch: {
        "model.wfetsk.srsmod.srslst": function () {
            this.data = this.model.wfetsk.srsmod.srslst;
            this.$nextTick(() => {
                for (let i = 0; i < this.data.length; i++) {
                    if (this.data[i].exeflg == "Y") {
                        this.$refs.table.$refs.table.toggleRowSelection(
                            this.data[i],
                            true
                        );
                    }
                }
            });
        },
    },
};
</script>
<style>
</style>