import customSelect from '../control/CustomerSelect.vue'; export default { execute: function (bill, param) { if (param) { console.log('param', param) GMS.$hideContainer.addComponent(customSelect, {}, async function (c) { const getExtrCondition = async (filterFieldObj) => { let extrConditions = [] for (const key in filterFieldObj) { let extrConditionObj = { name: filterFieldObj[key] } let value = bill.getMasterData().getValue(key) extrConditionObj.values = await getExtrConditionObjValue(value), extrConditionObj.type = getExtrConditionObjType(value) extrConditions.push(extrConditionObj) } return extrConditions } const getExtrConditionObjType = (val) => { const type = typeof val const reg = new RegExp(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/) if (Object.prototype.toString.call(val) === '[object Object]') { const value = val.code const type = typeof value return type.toUpperCase() } else if (Object.prototype.toString.call(val) === '[object Date]') { return 'DATE' } else if (type === 'number' || type === 'boolean') { return type.toUpperCase() } else if (reg.test(val)) { return 'UUID' } else { return type.toUpperCase() } } const getExtrConditionObjValue = async (val) => { if (Object.prototype.toString.call(val) === '[object Object]') { if (val._type) { const tableName = val._type.split('.').length > 0 ? val._type.split('.')[1] : val._type const postData = { pagination: false, tableName: tableName, searchKey: "", queryDataStructure: "ALL", queryChildrenType: "ALL_CHILDREN_WITH_SELF", code: val.code, authType: "ACCESS", versionDate: "", expression: "", } const {data} = await GMS.$http.post(`/baseData/data/list`, postData) const node = data.rows[0] const value = node.objectcode? node.objectcode: val.code return value } else { return val.objectcode? val.objectcode: val.code } } else { return val } } c.bill = bill const actionParam = param.param c.field = actionParam.field c.baseDataFields = actionParam.field.baseDataFields c.templateName = actionParam.templateName c.tableName = actionParam.tableName c.extrCondition = await getExtrCondition(actionParam.field.filterField) c.isDrawer = true c.drawerShow = true c.actionParam = actionParam // let isSub = actionParam.tableName.split('.').length let isSub = false c.isSub = isSub === 1 }) } else { GAMS.Common.messagePrompt('缺少参数'); } }, }