HasContainSubString.js 1.14 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
/**
 * 校验公式 检测基础数据Code中是否包含有另外一个String
 * 公式说明 此公式判断字符串包含关系 以支撑部分需要进行两个基础数据校验的需求
 *         弥补HasHasContainExpandFields函数在某些方面的不足
 *         使用本函数之前仍要搭配使用字段code判空校验 以避免重复执行该函数
 * @author fengjiansheng
 * @data 2021-09-16
 */
export default {
    execute: function () {
        if (arguments && arguments[0] && arguments[0].length > 1 && arguments[1]) {
            // TODO 后续可拓展更严谨的判断  eg.是否开头包含等..
            if (arguments[0][0] && arguments[0][0].getResult() && arguments[0][0].getResult().Value) {
                let stringTemp1 = arguments[0][0].getResult().Value
                let stringTemp2 = arguments[0][1].getResult().Value
                return stringTemp1.indexOf(stringTemp2) > -1
            }
        } else {
            console.error("HasContainSubString:公式配置错误,参数个数不匹配")
            return false
        }
    },
    getResultType: function () {
        return FMR.ConstDataTypes.Bool
    }
}