GetStrLength.js 759 Bytes
Newer Older
wangcong committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
import util from 'lodash'
/**
 * 仅仅支持传递参数的实际值为String类型的长度获取 其余情况一律返回0
 * 注:对于直接双击选中的字段 如果其实际类型不是String 将会返回0
 */
export default {
    execute: function () {
        let obj = arguments[0][0];
        if (util.isEmpty(obj)) {
            return 0;
        }
        if (obj instanceof BillDataNode) {
            let o = obj.getResult().Value;
            return util.isEmpty(o) ? 0 : util.isString(o) ? o.length : 0;
        } else {
            return util.isEmpty(obj.StaticValue) ? 0 : util.isString(obj.StaticValue) ? obj.StaticValue.length : 0;
        }
    },
    getResultType: function () {
        return FMR.ConstDataTypes.General;
    }
}