import { getComments } from "@/api/permission-selfhelp-manage";
export default {
    props: {
        applyOrdNo: [String, Number]
    },
    name: 'comments-table',
    // 页面数据绑定
    data() {
        return {
            processState: [{
                value: 'complete-agree',
                label: '同意'
            }, {
                value: 'complete-disagree',
                label: '不同意'
            }, {
                value: 'back',
                label: '退回'
            }, {
                value: 'recall',
                label: '撤回'
            }],
            tableData: []
        };
    },
    components: {},
    computed: {},
    created() {
        getComments(this.applyOrdNo)
        .then(res => {
            const result = res.data.content.map(element => {
                let index = this.processState.findIndex(cItem => cItem.value == element.approveState)
                if (index > -1) {
                    element.approveStateLabel = this.processState[index].label;
                }
                return element;
            });
            this.tableData = result;
        })
        .catch(error => {
            this.$message.error(error.response.data.message);
        });
    },
    mounted() {},
    methods: {},
}