ncpub-multipage-demo-develo.../src/sscivm/invoiceApplication/invoiceApl/confirm/common/valueChange.js

45 lines
1.9 KiB
JavaScript

/*JioT+qO4mP4R+mDgiabLRephl6ShZZnbmhIGdMpitGg=*/
import presetVar from '../presetVar'
import requestApi from '../requestApi'
const headKeys = ['pk_org', 'pk_customer', 'gmf_zh'];
const bodyKeys = ['xmdj', 'sl', 'xmje', 'se', 'xmsl', 'xmjshj', 'pk_materiel'];
export default function (moduleId, key, value, changedrows) {
let hasChange = false;
if ((moduleId == presetVar.formAreaId && headKeys.indexOf(key) > -1) ||
(moduleId == presetVar.bodyAreaId && bodyKeys.indexOf(key) > -1)) {
hasChange = true;
}
if (hasChange) {
// 取得表头数据
let headBodyData;
if (moduleId == presetVar.formAreaId) {
headBodyData = this.props.createHeadAfterEventData(presetVar.pagecode, presetVar.formAreaId, presetVar.bodyAreaId, moduleId, key, value);
} else {
headBodyData = this.props.createBodyAfterEventData(presetVar.pagecode, presetVar.formAreaId, presetVar.bodyAreaId, moduleId, key, changedrows)
}
headBodyData.templateid = this.props.meta.getMeta().pageid;
headBodyData.userjson = JSON.stringify({
appcode: this.props.getSearchParam('c'),
pagecode: this.props.getSearchParam('p'),
templateid: this.props.meta.getMeta().pageid,
checkrule: 'true'
});
// 组装发送数据
let sendData = {
...headBodyData,
checkrule: 'true',
templateid: this.props.meta.getMeta().pageid
}
requestApi.valueChange({
data: sendData,
success: (data) => {
data.head && data.head[presetVar.formAreaId] && this.props.form.setAllFormValue(data.head);
data.body && data.body[presetVar.bodyAreaId] && this.props.cardTable.updateDataByRowId(presetVar.bodyAreaId, data.body[presetVar.bodyAreaId]);
}
});
}
}
/*JioT+qO4mP4R+mDgiabLRephl6ShZZnbmhIGdMpitGg=*/