// 获取子表某列最大值或最小值
export default {
    execute: function () {
        console.log("进入：检查某字段是否有序");
        let preValue = '';
        let isOrdinal = 1
        if (arguments && arguments[0] && arguments[0][0] && arguments[1]) {
            let table = arguments[0][0].FieldTableCode, field = arguments[0][0].FieldCode, orderType = arguments[0][1].StaticValue, context = arguments[1];
            if (context.getTableType) {
                let _tn = context.getTableType(table);
                let _data = context.getSubData(_tn.title);
                if (_data instanceof Array) {
                    for (const iterator of _data) {
                        let _val = iterator.getValue(field)
                        if (!_val) {
                            continue
                        } else if (_val && (preValue == '' || (orderType == 'desc' && preValue > _val) || (orderType == 'asc' && preValue < _val))) {
                            preValue = _val
                        } else {
                            isOrdinal = -1
                            break
                        }
                    }
                }
            }
        }
        return isOrdinal
    },
    getResultType: function () {
        return FMR.ConstDataTypes.General;
    }
}