// 获取子表某列最大值或最小值
export default {
    execute: function () {
        console.log("进入：获取子表某列最大值或最小值");
        let limitValue = '';
        if (arguments && arguments[0] && arguments[0][0] && arguments[1]) {
            let table = arguments[0][0].FieldTableCode, field = arguments[0][0].FieldCode, valType = 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 && (limitValue == '' || (valType == 'min' && limitValue > _val) || (valType == 'max' && limitValue < _val))) {
                            limitValue = _val
                        }
                    }
                }
            }
        }
        return limitValue
    },
    getResultType: function () {
        return FMR.ConstDataTypes.General;
    }
}