CheckSubTableField.js 1.22 KB
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 23 24 25 26 27 28 29 30 31
// 判断子表某字段是否为空前端公式
export default {
    execute: function () {
        console.log("进入:判断子表某字段是否为空前端公式");
        let isEmpty = false
        if (arguments && arguments[0] && arguments[0][0] && arguments[0][1] && arguments[1]) {
            let count = 0, _key = arguments[0][0].FieldCode, table = arguments[0][0].FieldTableCode, 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 _v = iterator.getValue(_key)
                        if (_v == undefined || _v == null || _v == '') {
                            isEmpty = true
                            break;
                        }
                    }
                    if (isEmpty) {
                        GAMS.Common.messagePrompt(arguments[0][1].StaticValue);
                    }
                }
            }

        }
        return isEmpty
    },
    getResultType: function () {
        return FMR.ConstDataTypes.General;
    }
}