|
|
|
@ -164,7 +164,68 @@ const forEachGetFormModel = (list: FormList[], obj: any) => { |
|
|
|
|
|
|
|
// 表单组件值改变事件 tProp为子表格相关 |
|
|
|
provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) => { |
|
|
|
// console.log("监听表单--constControlChange-->",key, value, data, tProp,type,attribute) |
|
|
|
console.log("表单组件值改变事件----------1--------->",key) |
|
|
|
console.log("表单组件值改变事件----------2--------->",value) |
|
|
|
console.log("表单组件值改变事件----------3--------->",data) |
|
|
|
console.log("表单组件值改变事件----------4--------->",tProp) |
|
|
|
console.log("表单组件值改变事件----------5--------->",type) |
|
|
|
console.log("表单组件值改变事件----------6--------->",attribute) |
|
|
|
// console.log("表单组件值改变事件----------1--------->",key, value, data, tProp, type, attribute) |
|
|
|
let fieldVal = {} |
|
|
|
validate((valid: boolean, fields: any) => { |
|
|
|
// console.log("监听表单--constControlChange----------1--------->",valid,fields,type) |
|
|
|
for(let i in fields){ |
|
|
|
fieldVal[i]=fields[i].toString() |
|
|
|
} |
|
|
|
//判断是否进行计算 |
|
|
|
if(type == "digitpage"){ |
|
|
|
let sendInfo = { |
|
|
|
"fieldKey":key, |
|
|
|
"mathsFornula":props.formData.config, |
|
|
|
"keyVal":fieldVal |
|
|
|
} |
|
|
|
console.log("sendInfoe-->",sendInfo) |
|
|
|
currencyFormApiSubmit("/systemapi/maths/mathematicalCalculations",sendInfo) |
|
|
|
.then((data:any)=>{ |
|
|
|
// console.log("结果-->",data) |
|
|
|
let formatRes: any = data.data |
|
|
|
// 比较适用通用表单,保存在服务端 |
|
|
|
const afterResponse = props.formData.events?.afterResponse |
|
|
|
|
|
|
|
if (typeof afterResponse === 'string' && afterResponse) { |
|
|
|
formatRes = formatResult(result, afterResponse) |
|
|
|
} else if (typeof afterResponse === 'function') { |
|
|
|
formatRes = afterResponse(result) ?? result |
|
|
|
} |
|
|
|
// 比较适用于导出vue文件 |
|
|
|
if (typeof props.afterResponse === 'string' && props.afterResponse) { |
|
|
|
formatRes = formatResult(result, props.afterResponse) |
|
|
|
} else if (typeof props.afterResponse === 'function') { |
|
|
|
formatRes = props.afterResponse(result) ?? result |
|
|
|
} |
|
|
|
if (formatRes === false) { |
|
|
|
return |
|
|
|
} |
|
|
|
// console.log("停止数据请求--->",formatRes) |
|
|
|
setValue(formatRes.result || formatRes) |
|
|
|
nextTick(() => { |
|
|
|
// 将dict保存,可用于从接口中设置表单组件options。 |
|
|
|
if (formatRes.dict && Object.keys(formatRes.dict).length) { |
|
|
|
resultDict.value = formatRes.dict |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// console.log("监听表单-1-constControlChange-->",props.formData) |
|
|
|
// console.log("监听表单-2-constControlChange-->",key) |
|
|
|
// console.log("监听表单-3-constControlChange-->", value) |
|
|
|
// console.log("监听表单-4-constControlChange-->",data) |
|
|
|
// console.log("监听表单-5-constControlChange-->",type) |
|
|
|
// console.log("监听表单-6-constControlChange-->",attribute) |
|
|
|
|
|
|
|
if (typeof props.changeKeyVal === 'function') { |
|
|
|
props.changeKeyVal(key, value,type,attribute) |
|
|
|
} |
|
|
|
@ -188,6 +249,8 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) |
|
|
|
// 当表格和弹性内的字段和外面字段冲突时,可通过tProps区分 |
|
|
|
emits('change', { key, value, model: model.value, data, tProp }) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
const dictForm = computed(() => { |
|
|
|
const storage = window.localStorage.getItem('akFormDict') |
|
|
|
@ -514,9 +577,9 @@ const submit = (params = {}) => { |
|
|
|
if (valid) { |
|
|
|
|
|
|
|
const formatParams = Object.assign({}, fields, params) |
|
|
|
// console.log("params--->",params) |
|
|
|
// console.log("fields--->",fields) |
|
|
|
// console.log("formatParams-Object-->",formatParams) |
|
|
|
console.log("params--->",params) |
|
|
|
console.log("fields--->",fields) |
|
|
|
console.log("formatParams-Object-->",formatParams) |
|
|
|
|
|
|
|
let submitParams |
|
|
|
const beforeSubmit = props.formData.events?.beforeSubmit |
|
|
|
@ -535,14 +598,16 @@ const submit = (params = {}) => { |
|
|
|
if (submitParams === false) { |
|
|
|
return |
|
|
|
} |
|
|
|
// console.log("beforeSubmit--->",beforeSubmit) |
|
|
|
// console.log("props.beforeSubmit--->",props.beforeSubmit) |
|
|
|
console.log("beforeSubmit--->",beforeSubmit) |
|
|
|
console.log("props.beforeSubmit--->",props.beforeSubmit) |
|
|
|
// console.log("props.beforeSubmit--->",props.beforeSubmit) |
|
|
|
|
|
|
|
// loading.value = true |
|
|
|
console.log("apiUrl--->",apiUrl) |
|
|
|
console.log("submitParams--->",submitParams) |
|
|
|
console.log("formatParams--->",formatParams) |
|
|
|
|
|
|
|
debugger |
|
|
|
// 提交保存表单 |
|
|
|
currencyFormApiSubmit(apiUrl, submitParams ?? formatParams) |
|
|
|
.then((res: any) => { |
|
|
|
|