/**
 * 前端公式 获取多选基础数据指定字段的值
 * GetMultiBaseDataFieldValues
 * @author fengjiansheng
 * @date 2021-11-15
 */
import FormulaConstants from "@/formula/FormulaConstants";
export default {
    execute: function () {
        if (arguments && arguments[0] && arguments[0].length > 1 && arguments[1]) {
            if (arguments[0][0]) {
                let baseDataList = FormulaConstants.getFormulaParamValue(arguments[0][0])
                let baseDataField = FormulaConstants.getFormulaParamValue(arguments[0][1])
                let separator = arguments[0].length === 2 ? ',' : FormulaConstants.getFormulaParamValue(arguments[0][2])
                let res =[]
                baseDataList.forEach(e=>{
                    res.push(e[baseDataField])
                })
                return res.toString().replaceAll(',', separator)
            }
        }
    },
    getResultType: function () {
        return 6
    }
}
