export default {
    data() {
        return {
            showDialog: false,
            selectedRows: [],
            isEdit: false,
            index: -1,
        };
    },
    computed: {
        isFlgChecked() {
            return this.model.rmbbut.flg === 'X';
        },
        showSelection() {
            const dectyp = this.model.pblmod.dectyp;
            return this.isFlgChecked && dectyp === "D";
        },
        showSta() {
            let showSta = false;
            const dectyp = this.model.pblmod.dectyp;
            switch (dectyp) {
                case "A":
                    break;
                case "M":
                case "D":
                case "I":
                    showSta = true;
            }
            return showSta;
        },
        showButton() {
            let showButton = false;
            const dectyp = this.model.pblmod.dectyp;
            switch (dectyp) {
                case "A":
                case "M":
                    showButton = true;
                    break;
                case "D":
                case "I":
            }
            return showButton;
        },
    },
    methods: {
        isButtonDisabled(row) {
            return row.sta === '8' && row.listopertype === '1' || row.sta === 'D' || row.sta === 'G' || !this.isFlgChecked;
        },
        showDeleteButton(row) {
            return !(row.hasOwnProperty('sta') && row.sta);
        },
        rowSelectable(row, index) {
            const opertype = this.model.recgrp.ads.opertype;
            if (opertype === '2') {
                return row.sta !== 'D' && row.sta !== 'G';
            } else {
                return false;
            }
        },
        toggleShow() {
            this.showDialog = !this.showDialog;
        },
        handleEdit(index, row) {
            this.isEdit = true;
            this.index = index;
            this.formData = {...row};
            this.toggleShow()
        },
    }
};