'use strict';

/**
 *
 *
 * @author Mai
 * @date
 * @version
 */
// 变更令状态
const status = {
    uncheck: 1,     // 待上报
    checking: 2,    // 审批中
    checked: 3,     // 审批完成
    checkNo: 4,     // 审批终止
    back: 5,        // 重新上报
    backnew: 6,     // 退回
};
const statusButton = [];
statusButton[status.uncheck] = '上报';
statusButton[status.checking] = '审批';
statusButton[status.checked] = '';
statusButton[status.checkNo] = '';
statusButton[status.back] = '重新上报';
statusButton[status.backnew] = '审批';

const statusButtonClass = [];
statusButtonClass[status.uncheck] = 'btn-primary';
statusButtonClass[status.checking] = 'btn-success';
statusButtonClass[status.checked] = '';
statusButtonClass[status.checkNo] = '';
statusButtonClass[status.back] = 'btn-warning';
statusButtonClass[status.backnew] = 'btn-success';

const statusString = [];
statusString[status.uncheck] = '';
statusString[status.checking] = '审批中';
statusString[status.checked] = '完成';
statusString[status.checkNo] = '终止';
statusString[status.back] = '退回';
statusString[status.backnew] = '退回';

const statusClass = [];
statusClass[status.uncheck] = '';
statusClass[status.checking] = 'text-warning';
statusClass[status.checked] = 'text-success';
statusClass[status.checkNo] = 'text-danger';
statusClass[status.back] = 'text-warning';
statusClass[status.backnew] = 'text-warning';

/* ------------------------------------------------------- */

// 变更令审批人状态
const auditStatus = {
    uncheck: 1,     // 待审批
    checking: 2,    // 审批中或者原报人待上报
    checked: 3,     // 审批通过或者原报人上报完成
    checkNo: 4,     // 审批终止
    back: 5,       // 退回到原报人重新上报
    backnew: 6,    // 退回到上一个审批人
};

const auditStatusString = [];
auditStatusString[auditStatus.uncheck] = '待上报';
auditStatusString[auditStatus.checking] = '审批中';
auditStatusString[auditStatus.checked] = '审批通过';
auditStatusString[auditStatus.checkNo] = '审批终止';
auditStatusString[auditStatus.back] = '退回';
auditStatusString[auditStatus.backnew] = '审批退回';

const auditStatusClass = [];
auditStatusClass[auditStatus.uncheck] = '';
auditStatusClass[auditStatus.checking] = 'text-warning';
auditStatusClass[auditStatus.checked] = 'text-success';
auditStatusClass[auditStatus.checkNo] = 'text-danger';
auditStatusClass[auditStatus.back] = 'text-warning';
auditStatusClass[auditStatus.backnew] = 'text-warning';

/* ------------------------------------------------------- */

const filter = {
    status: {
        pending: 1,
        uncheck: 5,
        checking: 2,
        checked: 3,
        checkNo: 4,
    },
    statusString: [],
};
filter.statusString[filter.status.pending] = '待处理';
filter.statusString[filter.status.uncheck] = '待上报';
filter.statusString[filter.status.checking] = '进行中';
filter.statusString[filter.status.checked] = '已完成';
filter.statusString[filter.status.checkNo] = '终止';

module.exports = {
    flow: {
        status,
        statusString,
        statusButton,
        statusButtonClass,
        statusClass,
        auditStatus,
        auditStatusString,
        auditStatusClass,
    },
    filter,
};
