93 lines
3.9 KiB
JavaScript
93 lines
3.9 KiB
JavaScript
|
/*JioT+qO4mP4R+mDgiabLRephl6ShZZnbmhIGdMpitGg=*/
|
|||
|
import {get} from 'lodash'
|
|||
|
import presetVar from '../presetVar'
|
|||
|
import requestApi from '../requestApi'
|
|||
|
/**
|
|||
|
* pk_org:申请组织,
|
|||
|
* pk_customer:客户,
|
|||
|
* gmf_zh:客户账户,
|
|||
|
* pk_customer_v:客户,
|
|||
|
* gmf_dz:购买方地址,
|
|||
|
* gmf_dh:购买方电话,
|
|||
|
* gmf_yh:购买方银行账号,
|
|||
|
* pk_supplier:供应商,
|
|||
|
* pk_supplier_v:供应商,
|
|||
|
* xsf_dz:销售方地址,
|
|||
|
* xsf_dh:销售方电话,
|
|||
|
* xsf_yh:销售方开户行,
|
|||
|
* xsf_zhh:销售方银行账号,
|
|||
|
* xsf_zh:销售方账号,
|
|||
|
* xsf_khh:销售方开户行
|
|||
|
* pk_freecustom: 散户
|
|||
|
*/
|
|||
|
const headKeys = ['pk_org', 'pk_customer', 'gmf_zh', 'pk_customer_v','gmf_dz','gmf_dh','gmf_yh','gmf_zhh',"pk_supplier","pk_supplier_v","xsf_dz","xsf_dh","xsf_yh","xsf_zhh","xsf_zh","xsf_khh","pk_freecustom"];
|
|||
|
/**
|
|||
|
* xmdj:单价
|
|||
|
* sl:税率
|
|||
|
* xmje:无税金额
|
|||
|
* se:税额
|
|||
|
* xmsl:数量
|
|||
|
* xmjshj:价税合计
|
|||
|
* pk_materiel:物料
|
|||
|
* zkje:折扣金额
|
|||
|
* fphxz:发票行性质
|
|||
|
* taxcode:税码
|
|||
|
*/
|
|||
|
const bodyKeys = ['xmdj', 'sl', 'xmje', 'se', 'xmsl', 'xmjshj', 'pk_materiel', 'zkje', 'fphxz', 'taxcode'];
|
|||
|
|
|||
|
export default function (moduleId, key, value, changedrows, index, record) {
|
|||
|
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]);
|
|||
|
if (moduleId == presetVar.bodyAreaId && key == 'zkje') {
|
|||
|
// 折扣金额编辑后可能增加折扣行
|
|||
|
let addRow = data.body[presetVar.bodyAreaId].rows.find(one => !one.rowid);
|
|||
|
addRow && this.props.cardTable.addRow(presetVar.bodyAreaId, index + 1, addRow.values, false);
|
|||
|
// 删除不要得折扣行
|
|||
|
const allRows = this.props.cardTable.getAllRows(presetVar.bodyAreaId);
|
|||
|
allRows.find((one)=>{
|
|||
|
const pk_ivappdetail = get(one, 'values.pk_ivappdetail.value');
|
|||
|
const rowid = get(one, 'rowid');
|
|||
|
if(one.status == '3' && (pk_ivappdetail == null || pk_ivappdetail == '')){
|
|||
|
this.props.cardTable.delRowByRowId(presetVar.bodyAreaId, rowid, null, true);
|
|||
|
return true;
|
|||
|
}else if(one.status == '3' && pk_ivappdetail){
|
|||
|
this.props.cardTable.delRowByRowId(presetVar.bodyAreaId, rowid, null, false);
|
|||
|
return true;
|
|||
|
}
|
|||
|
})
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
/*JioT+qO4mP4R+mDgiabLRephl6ShZZnbmhIGdMpitGg=*/
|