收款单原币金额为0,本币可以编辑且单据保存

This commit is contained in:
mzr 2025-03-11 10:10:16 +08:00
parent 3d59acb1bd
commit 7e331018c0
9 changed files with 3300 additions and 0 deletions

View File

@ -0,0 +1,47 @@
/*2eGyj/tqvBzCjYfe/jCZpWDRVkX2FFnRx0MwuorADYI=*/
/**
* 表头区域
*/
export const formId = 'head';
/**
* 表体区域
*/
export const tableId = 'bodys';
export const leftarea = 'left';
/**
* 默认交易类型
*/
export const tradeType = 'D2';
/**
* 单据类型
*/
export const billType = 'F2';
export const pkItem = 'pkItem';
export const headId = 'headId';
/**
* 默认模板节点标识
*/
export const nodekey = 'card';
/**
* 单页应用缓存,命名规范为"领域名.模块名.节点名.自定义名"
*/
export const dataSource = 'fi.arap.gatheringbill.20060GBM';
/**
* 单页应用缓存主键名字
*/
export const pkname = 'pk_gatherbill';
/**
* 列表联查页面pageId
*/
export const linkPageId = '20060GBM_LIST_LINK';
/*2eGyj/tqvBzCjYfe/jCZpWDRVkX2FFnRx0MwuorADYI=*/

View File

@ -0,0 +1,333 @@
/*DncIqBreQz6WZRX+v7OzgStt3NXSdJfpHrVzjLeRcYA=*/
import { ajax, getBusinessInfo, promptBox, toast } from 'nc-lightapp-front';
import { currentTypeAfterFormEvents } from '../../../../public/components/pubUtils/currentTypeAfterEvent';
import { autoAddLineKeys } from '../../../../public/components/pubUtils/billPubInfo';
import {
checknoDisplayAfterEvent,
checktypeAfterEvent
} from '../../../../public/components/pubUtils/specialFieldAfterEvent.js';
import { getColvalues, getRowIds } from '../../../../public/components/pubUtils/billPubUtil';
import { formulamsgHint, renderData, headAfterEventRenderData, bodyAfterEventRenderData, errorDeal } from '../../../../public/components/afterEventPub/afterEventPubDeal';
import { moneyAndRateFields } from '../../../../public/components/pubUtils/specialFieldAfterEvent.js';
import { isExistsTopBill } from '../../../../public/components/pubUtils/billPubUtil.js';
export default function afterEvent(props, moduleId, key, value, changedrows, i, record, g) {
if (changedrows instanceof Array) {
if (changedrows[0].newvalue.value == changedrows[0].oldvalue.value) {
return;
}
}
let pagecode = this.getPagecode();
let index = 0;
if (moduleId == this.formId) {
index = 0;
} else if (moduleId == this.tableId) {
index = i;
}
//表头编辑后事件
if (moduleId == this.formId) {
let data = null
switch (key) {
case 'pk_org_v':
if (value.value == null || value.value == '') {
if (this.props.getUrlParam('type') === 'transfer') {
//转单不允许清空财务组织
promptBox({
color: 'warning',
title: this.state.json['gatheringbill-000021'] /* 国际化处理: 确认修改*/,
content: this.state.json['gatheringbill-000080'] /* 国际化处理: 来源于上游的单据不允许清空财务组织!*/,
beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/,
noCancelBtn: true,
beSureBtnClick: () => {
this.props.form.setFormItemsValue(this.formId, { pk_org_v: changedrows });
},
closeByClickBackDrop: false
});
} else {
promptBox({
color: 'warning',
title: this.state.json['gatheringbill-000021'] /* 国际化处理: 确认修改*/,
content: this.state.json['gatheringbill-000022'] /* 国际化处理: 确定​修改组织,这样会清空您录入的信息?*/,
beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/,
cancelBtnName: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/,
beSureBtnClick: () => {
this.props.form.EmptyAllFormValue(this.formId);
this.props.cardTable.setTableData(this.tableId, { rows: [] });
this.initAdd(true);
},
cancelBtnClick: () => {
this.props.form.setFormItemsValue(this.formId, { pk_org_v: changedrows });
},
closeByClickBackDrop: false
});
}
} else if (changedrows.value != null && changedrows.value != '') {
//切换组织
promptBox({
color: 'warning',
title: this.state.json['gatheringbill-000021'] /* 国际化处理: 确认修改*/,
content: this.state.json['gatheringbill-000022'] /* 国际化处理: 确定​修改组织,这样会清空您录入的信息?*/,
beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/,
cancelBtnName: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/,
beSureBtnClick: () => {
ajax({
url: '/nccloud/arap/gatheringbill/cardheadafteredit.do',
data: {
pageId: pagecode,
event: this.props.createHeadAfterEventData(pagecode, this.formId, this.tableId, moduleId, key, value),
uiState: this.props.getUrlParam('status')
},
async: false,
success: (res) => {
//渲染数据
renderData(this, res);
//编辑公式提示
formulamsgHint(this, res);
},
error: (res) => {
errorDeal(this, res, changedrows, key);
}
});
},
cancelBtnClick: () => {
this.props.form.setFormItemsValue(this.formId, { pk_org_v: changedrows });
},
closeByClickBackDrop: false
});
} else {
data = {
pageId: pagecode,
event: this.props.createHeadAfterEventData(pagecode, this.formId, this.tableId, moduleId, key, value),
uiState: this.props.getUrlParam('status')
}
headFieldAfterRequest.call(this, data, key, changedrows)
}
break;
case 'customer':
data = {
pageId: pagecode,
formEvent: props.createFormAfterEventData(pagecode, this.formId, this.tableId, key, value),
colValues: getColvalues(this.props, this.tableId, ['pk_org','pk_org_v', 'payaccount', 'pk_currtype', 'customer', 'buysellflag',
'objtype', "direction", "pk_billtype", "top_billtype", "pk_payterm", "pk_psndoc", "pk_deptid", "pk_deptid_v"].concat(moneyAndRateFields)),
rowids: getRowIds(this.props, this.tableId),
uiState: this.props.getUrlParam('status')
};
headFieldAfterRequest.call(this, data, key, changedrows)
break;
case 'pk_deptid_v':
data = {
pageId: pagecode,
formEvent: props.createFormAfterEventData(pagecode, this.formId, this.tableId, key, value),
colValues: getColvalues(this.props, this.tableId, ['pk_org','pk_org_v', 'pk_deptid', 'pk_deptid_v', 'pk_currtype', 'customer', 'taxtype', 'buysellflag', 'objtype', "direction"]),
rowids: getRowIds(this.props, this.tableId),
uiState: this.props.getUrlParam('status')
};
headFieldAfterRequest.call(this, data, key, changedrows)
break;
case 'pk_psndoc':
data = {
pageId: pagecode,
formEvent: props.createFormAfterEventData(pagecode, this.formId, this.tableId, key, value),
colValues: getColvalues(this.props, this.tableId, ['pk_org', 'pk_org_v','pk_psndoc', 'pk_deptid', 'pk_deptid_v', 'isrefused', 'prepay', 'isdiscount', 'objtype', 'direction', 'agentreceivelocal']),
rowids: getRowIds(this.props, this.tableId),
uiState: this.props.getUrlParam('status')
};
headFieldAfterRequest.call(this, data, key, changedrows)
break;
case 'pk_currtype':
data = {
pageId: pagecode,
formEvent: props.createFormAfterEventData(pagecode, this.formId, this.tableId, key, value),
colValues: getColvalues(this.props, this.tableId, ["pk_org",'pk_org_v',"pk_group","pk_currtype","pk_billtype","billdate","rate","grouprate","globalrate",
"buysellflag","taxprice","local_taxprice","taxrate","occupationmny","money_bal","local_money_bal",
"globalcrebit","globalnotax_cre","globaltax_cre","groupcrebit","groupnotax_cre","grouptax_cre",
"local_money_cr","local_notax_cr","local_tax_cr","money_cr","notax_cr","quantity_cr","direction","settlecurr","settlemoney"]),
rowids: getRowIds(this.props, this.tableId),
uiState: this.props.getUrlParam('status')
}
headFieldAfterRequest.call(this, data, key, changedrows)
//币种事件发送完要判断汇率
currentTypeAfterFormEvents(this.formId, props, key);
break;
case 'subjcode':
data = {
pageId: pagecode,
event: this.props.createHeadAfterEventData(pagecode, this.formId, this.tableId, moduleId, key, value),
uiState: this.props.getUrlParam('status')
}
headFieldAfterRequest.call(this, data, key, changedrows)
this.props.form.setFormItemsValue(this.formId, { 'subjcode': { value: value.refpk, display: value.dispname } });
break;
default:
data = {
pageId: pagecode,
event: this.props.createHeadAfterEventData(pagecode, this.formId, this.tableId, moduleId, key, value),
uiState: this.props.getUrlParam('status')
}
headFieldAfterRequest.call(this, data, key, changedrows)
break;
}
}
//表体编辑后事件
if (moduleId == this.tableId) {
//票据类型
if (key == 'checktype') {
checktypeAfterEvent(this.props, this.tableId, key, value, i);
}
//非元数据字段,票据号
if (key == 'checkno_display') {
checknoDisplayAfterEvent(this.props, this.tableId, key, value, i);
key = 'checkno';
}
//科目字段特殊拼接1121\应收票据
if(key == "subjcode"){
this.props.cardTable.setValByKeyAndIndex(this.tableId, i, 'subjcode', { value: value.refpk, display: value.dispname })
}
ajax({
url: '/nccloud/arap/gatheringbill/cardbodyafteredit.do',
data: {
rowindex: 0,
editindex: index,
pageId: pagecode,
tableId:this.tableId,
changedrows: changedrows,
body: props.cardTable.getDataByIndex(this.tableId, index),
formEvent: props.createFormAfterEventData(pagecode, this.formId, this.tableId, key, value),
uiState: this.props.getUrlParam('status')
},
async: false,
success: (res) => {
//渲染数据
bodyAfterEventRenderData(this, res);
if (this.props.getUrlParam('type') == 'transfer') {
this.synTransferData();
}
//表体改变表头税率编辑性
if (i == 0 && key == 'pk_currtype') {
currentTypeAfterFormEvents(this.formId, props, 'pk_currtype');
}
//编辑公式提示
formulamsgHint(this, res);
},
error: (res) => {
let str = res.message;
if (str.substring(0,16) == 'convertException') {
promptBox({
color: 'warning',
title: this.state.json['gatheringbill-000000'] /* 国际化处理: 折算误差*/,
content: str.substring(16, str.length),
closeByClickBackDrop: false,
beSureBtnClick: () => {
afterTableEvent(this, props, i, pagecode, moduleId, key, changedrows, 'sure', index, value);
},
cancelBtnClick: () => {
afterTableEvent(this, props, i, pagecode, moduleId, key, changedrows, 'cancel', index, value);
}
});
} else {
this.props.cardTable.setValByKeyAndRowId(this.tableId, i, key, changedrows);
toast({ color: 'danger', content: str});;
}
}
});
//自动增行
autoAddline.call(this, moduleId, pagecode, key, i)
}
}
function afterTableEvent(that, props, i, pagecode, moduleId, key, changedrows, isCalculateConvert, index, value) {
ajax({
url: '/nccloud/arap/gatheringbill/cardbodyafteredit.do',
data: {
rowindex: 0,
editindex: index,
pageId: pagecode,
changedrows: changedrows,
tableId:that.tableId,
body: props.cardTable.getDataByIndex(that.tableId, index),
formEvent: props.createFormAfterEventData(pagecode, that.formId, that.tableId, key, value),
uiState: that.props.getUrlParam('status'),
isCalculateConvert: isCalculateConvert
},
async: false,
success: (res) => {
//渲染数据
bodyAfterEventRenderData(that, res);
if (that.props.getUrlParam('type') == 'transfer') {
that.synTransferData();
}
//表体改变表头税率编辑性
if (i == 0 && key == 'pk_currtype') {
currentTypeAfterFormEvents(that.formId, props, 'pk_currtype');
}
//编辑公式提示
formulamsgHint(that, res);
}
});
}
export function headFieldAfterRequest(requestData, key, changedrows) {
ajax({
url: '/nccloud/arap/gatheringbill/cardheadafteredit.do',
data: requestData,
async: false,
success: (res) => {
//渲染数据
headAfterEventRenderData(this, res);
if (key == 'pk_org_v') {
let pk_org = this.props.form.getFormItemsValue(this.formId, 'pk_org_v').value;
if (pk_org) {
this.props.resMetaAfterPkorgEdit();
this.state.buttonfalg = true;
} else {
this.state.buttonfalg = null;
}
this.toggleShow();
}
if (this.props.getUrlParam('type') == 'transfer') {
this.synTransferData();
}
//编辑公式提示
formulamsgHint(this, res);
},
error: (res) => {
errorDeal(this, res, changedrows, key);
}
});
}
export function autoAddline(moduleId, pagecode, key, i) {
//自动增行
let allRowsNumber = this.props.cardTable.getNumberOfRows(this.tableId);
if (moduleId == this.tableId && allRowsNumber == i + 1 && autoAddLineKeys.indexOf(key) != -1 && !isExistsTopBill(this)) {
let data = this.props.createMasterChildData(pagecode, this.formId, this.tableId);
//清空cardData的表体
data.body[this.tableId].rows = [];
ajax({
url: '/nccloud/arap/gatheringbill/addline.do',
data: data,
async: false,
success: (res) => {
if (res.data) {
if (res.data.head) {
this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] });
}
if (res.data.body) {
this.props.cardTable.addRow(this.tableId, allRowsNumber, res.data.body[this.tableId].rows[0].values, false);
}
}
}
});
}
}
/*DncIqBreQz6WZRX+v7OzgStt3NXSdJfpHrVzjLeRcYA=*/

View File

@ -0,0 +1,707 @@
/*q2LCmxM8POvl78IL0LiydqEO8dlmkDpbQUH9Mtm5EjY=*/
import { ajax, base, toast, cacheTools, createPage, print, cardCache, promptBox } from 'nc-lightapp-front';
import { headButton, bodyButton } from '../../../../public/components/pubUtils/buttonName.js';
import {
calculateHeadMoney,
delLine,
copyLine,
pasteLine,
pasteToEndLine,
generate
} from '../../../../public/components/pubUtils/billPubUtil.js';
import { getTransferInfo } from '../../../../public/components/pubUtils/transferButtonUtil.js';
import { imageScan, imageView } from 'sscrp/rppub/components/image';
import { tableId, formId, billType, dataSource, pkname } from '../constants';
import { cardBodyControl } from '../../../../public/components/pubUtils/buttonvisible.js';
import initTemplate from './initTemplate';
import { BodyVerify, WholeVerify } from '../../../../public/components/pubUtils/arapVerifyCheck';
import arapLinkReport from '../../../../public/components/arapBillLinkReport.js';
import linkvouchar from '../../../../public/components/linkvouchar.js';
import madeBill from '../../../../public/components/madeBill.js';
import { copyBill } from '../../../../public/components/pubUtils/CopyBill/arapCopyBill';
import { loginContext, getContext, loginContextKeys } from '../../../../public/components/arapInitInfo/loginContext';
import { moduleEnable, IMAG, SSCIVM } from '../../../../public/components/moduleEnable.js';
import {throwSagaErrorAgency} from '../../../../public/components/pubUtils/MicroServiceSocket.js';
let { getDefData, setDefData, updateCache, deleteCacheById } = cardCache;
export default function (props, id) {
let code = getContext(loginContextKeys.transtype);
let pagecode = this.getPagecode();
this.dataInSaga.butncode=id;
switch (id) {
case headButton.Refund://退款
ajax({
url: '/nccloud/arap/arappub/refund.do',
data:Object.assign( {
pk_bill: this.props.getUrlParam('id'),
pageId: this.getPagecode(),
billType: this.billType
},this.dataInSaga),
success: (result) => {
toast({ color: 'success', title: "退款成功" });
refreshBill.call(this, result)
}
});
break;
case headButton.CancelRefund://取消退款
ajax({
url: '/nccloud/arap/arappub/cancelrefund.do',
data:Object.assign( {
pk_bill: this.props.getUrlParam('id'),
pageId: this.getPagecode(),
billType: this.billType
},this.dataInSaga),
success: (result) => {
toast({ color: 'success', title: "取消退款成功" });
refreshBill.call(this, result)
}
});
break;
case headButton.Generate://生成
generate(this)
break;
case headButton.Commit: //提交
this.Info.tipUrl = '/nccloud/arap/arappub/commit.do';
this.commitAndUncommit();
break;
case headButton.Uncommit: //收回
this.Info.tipUrl = '/nccloud/arap/arappub/uncommit.do';
this.commitAndUncommit();
break;
case headButton.LinkAprv: //审批详情
this.setState({ showApproveDetail: true });
break;
case headButton.Save: //保存
this.saveBill('/nccloud/arap/arappub/save.do');
break;
case headButton.TempSave: //暂存
let org = this.props.form.getFormItemsValue(formId, 'pk_org_v').value;
if (!org) {
toast({
color: 'warning',
content: this.state.json['gatheringbill-000025']
}); /* 国际化处理: 财务组织为空,不能操作单据!*/
return;
}
this.saveBill('/nccloud/arap/arappub/tempsave.do');
break;
case headButton.SaveAndCommit:
this.saveBill('/nccloud/arap/arappub/saveandcommit.do');
break;
case headButton.Add:
pagecode = getDefData('sessionTradeType', dataSource);
if (code) {
pagecode = code;
} else if (!pagecode) {
pagecode = this.getPagecode();
}
//缓存中的交易类型和链接中交易类型不一样的话,重新加载模板
if (pagecode != this.getPagecode()) {
props.setUrlParam({ status: 'add', pagecode: pagecode });
initTemplate.call(this, this.props);
} else {
props.setUrlParam({ status: 'add', pagecode: pagecode });
}
this.initAdd();
break;
case headButton.Edit:
cardBillEdit.call(this)
break;
case headButton.Copy:
copyBill(this, this.getPagecode());
break;
case headButton.Delete:
promptBox({
color: 'warning',
title: this.state.json['gatheringbill-000005'] /* 国际化处理: 删除*/,
content: this.state.json['gatheringbill-000006'] /* 国际化处理: ​确定要删除吗?*/,
noFooter: false,
noCancelBtn: false,
beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/,
cancelBtnName: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/,
beSureBtnClick: this.delConfirm
});
break;
case headButton.Cancel:
promptBox({
color: 'warning',
title: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/,
content: this.state.json['gatheringbill-000003'] /* 国际化处理: ​确定要取消吗?*/,
noFooter: false,
noCancelBtn: false,
beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/,
cancelBtnName: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/,
beSureBtnClick: this.cancel
});
break;
case headButton.Pausetrans: //挂起操作
this.pause('/nccloud/arap/arappub/pause.do');
break;
case headButton.Cancelpause: //取消挂起操作
this.pause('/nccloud/arap/arappub/cancelpause.do');
break;
//预收付
case headButton.PrePay:
let prePayDatas = this.props.cardTable.getCheckedRows(this.tableId);
if (prePayDatas.length == 0) {
toast({ color: 'warning', content: this.state.json['gatheringbill-000028'] }); /* 国际化处理: 请选择表体行!*/
return;
}
let prePayDatasObj = [];
prePayDatas.forEach((val) => {
prePayDatasObj.push(val.data.values.pk_gatheritem.value);
});
let prePayDatasdata = {
pk_items: prePayDatasObj,
pk_bill: this.props.getUrlParam('id'),
ts: this.props.form.getFormItemsValue(this.formId, 'ts').value,
pageId: this.getPagecode(),
billType: this.billType
};
ajax({
url: '/nccloud/arap/arappub/prepay.do',
data:Object.assign(prePayDatasdata,this.dataInSaga) ,
success: (res) => {
toast({ color: 'success', content: this.state.json['gatheringbill-000029'] }); /* 国际化处理: 预收付成功*/
if (res.data) {
if (res.data.head) {
this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] });
}
if (res.data.body) {
this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]);
}
}
let newCardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId);
updateCache(pkname, this.props.getUrlParam('id'), newCardData, this.formId, dataSource);
this.onSelected();
}
});
break;
case headButton.RedBack: //红冲操作
let writebackData = {
pk_bill: this.props.getUrlParam('id'),
ts: this.props.form.getFormItemsValue(this.formId, 'ts').value,
pageId: this.getPagecode(),
billType: this.billType,
tradeType: this.getPagecode()
};
ajax({
url: '/nccloud/arap/arappub/redback.do',
data:Object.assign(writebackData,this.dataInSaga),
success: (res) => {
this.props.beforeUpdatePage(); //打开开关
if (res.data.head) {
this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] });
}
if (res.data.body) {
this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]);
// this.props.cardTable.updateDataByRowId(this.tableId, res.data.body[this.tableId])
}
props.setUrlParam({ status: 'add', id: this.props.getUrlParam('id'), type: 'redBack' });
this.state.buttonfalg = true;
this.props.cardTable.setStatus(this.tableId, 'edit');
this.props.form.setFormStatus(this.formId, 'edit');
this.props.form.setFormItemsDisabled(this.formId, { pk_org_v: true });
this.props.updatePage(this.formId, this.tableId); //关闭开关
this.toggleShow('',res);
this.props.button.setButtonVisible([headButton.TempSave], false);
}
});
break;
case headButton.LinkConfer: //联查协同单据
ajax({
url: '/nccloud/arap/arappub/linkconfer.do',
async: false,
data:Object.assign({
pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value,
billType: this.billType
},this.dataInSaga),
success: (res) => {
let data = res.data;
if (data) {
props.openTo(data.url, data.condition);
}
}
});
break;
case headButton.LinkTbb: //联查计划预算
ajax({
url: '/nccloud/arap/arappub/linktbb.do',
data:Object.assign({
pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value,
billType: this.billType
},this.dataInSaga),
success: (res) => {
if (res.success) {
this.Info.tbbLinkSourceData = res.data;
this.setState({
isTbbLinkshow: true
});
}
}
});
break;
case headButton.LinkBal: //联查余额表
arapLinkReport(
this.props,
this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value,
this.billType,
this.props.form.getFormItemsValue(this.formId, 'objtype').value
);
break;
case headButton.MadeBill: //制单
let madeData = [
{
pk_bill: props.form.getFormItemsValue(formId, 'pk_gatherbill').value,
billType: this.billType,
tradeType: props.form.getFormItemsValue(formId, 'pk_tradetype').value
}
];
madeBill(this, props, madeData, '', props.getSearchParam('c'));
break;
case headButton.LinkVouchar: //联查凭证
linkvouchar(
this,
props,
this.props.form.getAllFormValue(this.formId),
this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value,
this.props.getSearchParam('c')
);
break;
case headButton.LinkDeal: //联查处理情况
ajax({
url: '/nccloud/arap/arappub/linkdeal.do',
data:Object.assign({
pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value,
billType: this.billType
},this.dataInSaga),
success: (res) => {
if (res.success) {
//打开处理情况模态框
let data = res.data;
this.Info.combinedExaminationData = data;
this.handleCombined();
}
}
});
break;
case headButton.LinkSettleInfo: //联查结算信息
ajax({
url: '/nccloud/arap/arappub/linksettleinfo.do',
data: Object.assign({
pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value,
billType: this.billType
},this.dataInSaga) ,
success: (res) => {
let { success, data } = res;
if (success) {
props.openTo('/nccloud/resources/cmp/settlementmanagement/settlement/main/index.html#/card', {
status: 'browse',
srcid: props.form.getFormItemsValue(formId, 'pk_gatherbill').value,
src: '2006',
appcode: '360704SM',
pagecode: '360704SM_C01'
});
}
}
});
break;
case headButton.ConnectSettleInfo: //关联结算信息
ajax({
url: '/nccloud/arap/arappub/validatecmp.do',
async: false,
data: null,
success: (res) => {
if (res.success) {
pagecode = getDefData('sessionTradeType', dataSource);
if (code) {
pagecode = code;
} else if (!pagecode) {
pagecode = this.getPagecode();
}
props.openTo('/nccloud/resources/cmp/settlementmanagement/settlepublic/list/index.html', {
appcode: '360704SM',
pagecode: '360704SMP_L01',
callbackappcode: props.getSearchParam('c'),
callbackpagecode: pagecode,
src: 0,
callback: '/nccloud/resources/arap/gatheringbill/gatheringbill/main/index.html#/card'
});
}
}
});
break;
case headButton.LinkInformer: //到账通知
ajax({
url: '/nccloud/arap/arappub/linkinformer.do',
data: Object.assign({
pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value,
billType: this.billType
},this.dataInSaga),
success: (res) => {
if (res.success && res.data) {
let length = res.data.length;
if (length == 1) {
props.openTo('/nccloud/resources/cmp/informer/LinkBill/card/index.html', {
appcode: '36070AISC',
pagecode: '36070AILLINK',
status: 'browse',
id: res.data
});
} else {
props.openTo('/nccloud/resources/cmp/informer/LinkBill/list/index.html', {
appcode: '36070AISC',
pagecode: '36070AICLINK',
status: 'browse',
ids: res.data
});
}
}
}
});
break;
case headButton.BillLinkQuery: //联查单据
this.setState({ showBillTrack: true });
break;
case headButton.Refresh: //刷新
ajax({
url: '/nccloud/arap/arappub/cardRefresh.do',
data: Object.assign({
pk_bill: this.props.getUrlParam('id'),
pageId: this.getPagecode(),
billType: this.billType
},this.dataInSaga),
success: (res) => {
if (res.data) {
toast({ color: 'success', title: this.state.json['gatheringbill-000078'] }); /* 国际化处理: 刷新成功*/
updateCache(pkname, this.props.getUrlParam('id'), res.data, this.formId, dataSource);
if (res.data.head) {
this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] });
}
if (res.data.body) {
this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]);
}
} else {
this.props.form.EmptyAllFormValue(this.formId);
this.props.cardTable.setTableData(this.tableId, { rows: [] });
}
this.toggleShow('',res);
throwSagaErrorAgency.call(this,res)
},
error: (res) => {
this.props.form.EmptyAllFormValue(this.formId);
this.props.cardTable.setTableData(this.tableId, { rows: [] });
deleteCacheById(pkname, this.props.getUrlParam('id'), dataSource);
this.toggleShow();
let str = res.message;
toast({ color: 'danger', content: str });
}
});
break;
//表体肩部的按钮操作
case bodyButton.AddLine:
if (this.props.form.getFormItemsValue(this.formId, 'pk_org_v').value != null) {
let rowNum = props.cardTable.getNumberOfRows(this.tableId);
ajax({
url: '/nccloud/arap/gatheringbill/addline.do',
data: this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId),
success: (res) => {
if (res.data) {
if (res.data.head) {
this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] });
}
if (res.data.body) {
this.props.cardTable.addRow(
this.tableId,
rowNum,
res.data.body[this.tableId].rows[0].values
);
}
}
}
});
}
break;
case headButton.BodyVerify: //按表体核销
BodyVerify(props, this.formId, this.tableId, 'pk_gatherbill', 'pk_gatheritem', this);
break;
case headButton.WholeVerify: //按整单核销
WholeVerify(props, this.formId, this.tableId, 'pk_gatherbill', this);
break;
case headButton.ReceiptCheck: //影像查看pk_tradetype
if (!moduleEnable(this, IMAG)) { //校验关联模块是否启用
return;
}
if (props.getUrlParam('status') == 'add') {
toast({ color: 'warning', content: this.state.json['gatheringbill-000030'] }); /* 国际化处理: 单据未暂存!*/
return;
}
// let pk_tradetype = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value
// let showData = props.createMasterChildData(pk_tradetype, formId, tableId);
// let openShowbillid = props.getUrlParam('id');
// imageView(showData, openShowbillid, pk_tradetype, 'iweb');
var billInfoMap = {};
//基础字段 单据pk,单据类型,交易类型,单据的组织
billInfoMap.pk_billid = props.getUrlParam('id');
billInfoMap.pk_billtype = this.props.form.getFormItemsValue(this.formId, 'pk_billtype').value;
billInfoMap.pk_tradetype = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value;
billInfoMap.pk_org = this.props.form.getFormItemsValue(this.formId, 'pk_org').value;
imageView(billInfoMap, 'iweb');
break;
case headButton.ReceiptScan: //影像扫描
if (!moduleEnable(this, IMAG)) { //校验关联模块是否启用
return;
}
if (props.getUrlParam('status') == 'add') {
toast({
color: 'warning',
content: this.state.json['gatheringbill-000031']
}); /* 国际化处理: 请先 <暂存> 单据再扫描影像!*/
return;
}
let tradetype = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value;
let allData = props.createMasterChildData(tradetype, formId, tableId);
// let openbillid = props.getUrlParam('id');
// imageScan(allData, openbillid, tradetype, 'iweb');
var billInfoMap = {};
//基础字段 单据pk,单据类型,交易类型,单据的组织
billInfoMap.pk_billid = props.getUrlParam('id');
billInfoMap.pk_billtype = allData.head.head.rows[0].values.pk_billtype.value;
billInfoMap.pk_tradetype = allData.head.head.rows[0].values.pk_tradetype.value;
billInfoMap.pk_org = allData.head.head.rows[0].values.pk_org.value;
//影像所需 FieldMap
billInfoMap.BillType = allData.head.head.rows[0].values.pk_tradetype.value;
billInfoMap.BillDate = allData.head.head.rows[0].values.creationtime.value;
billInfoMap.Busi_Serial_No = allData.head.head.rows[0].values.pk_gatherbill.value;
billInfoMap.pk_billtype = allData.head.head.rows[0].values.pk_billtype.value;
billInfoMap.OrgNo = allData.head.head.rows[0].values.pk_org.value;
billInfoMap.BillCode = allData.head.head.rows[0].values.billno.value;
billInfoMap.OrgName = allData.head.head.rows[0].values.pk_org_v.display;
billInfoMap.Cash = allData.head.head.rows[0].values.money.value;
imageScan(billInfoMap, 'iweb');
break;
case headButton.AttachManage:
let flag = props.getUrlParam('status');
if (flag == 'add' || props.getUrlParam('type') == 'copy' || props.getUrlParam('type') == 'redBack') {
toast({ color: 'warning', content: this.state.json['gatheringbill-000032'] }); /* 国际化处理: 请保存后再进行上传附件!*/
return;
}
this.setState({
showUploader: true,
target: null
});
break;
case 'Print': //打印
this.onPrint();
break;
case headButton.Output: //打印输出
this.printOutput();
break;
case headButton.OfficalPrint: //正式打印
this.officalPrintOutput();
break;
case headButton.CancelPrint: //取消正式打印
this.cancelPrintOutput();
break;
case headButton.ExportData: //导出
if(this.state.forceRender){
this.setState({forceRender: false})
}
let outbillid = props.getUrlParam('id');
let pk_bills = [];
pk_bills.push(outbillid);
this.Info.selectedPKS = pk_bills; //传递主键数组,之前nc需要导出的加主键
this.props.modal.show('exportFileModal'); //不需要导出的只执行这行代码
break;
//下面是肩部按钮
case bodyButton.DelLine: //删除行
delLine(this);
//删行之后控制肩部按钮
this.onSelected();
break;
case bodyButton.CopyLine: //复制行
if (copyLine(this, dataSource)) {
this.setState(
{
buttonfalg: false
},
() => {
cardBodyControl(props, this.state.buttonfalg, this);
}
);
}
break;
case bodyButton.PasteLine: //粘贴行
pasteLine(this);
break;
case bodyButton.PasteToEndLine: //粘贴行到末尾
pasteToEndLine(this, dataSource);
break;
case bodyButton.CancelLine: //行取消
this.setState(
{
buttonfalg: true
},
() => {
cardBodyControl(props, this.state.buttonfalg, this);
}
);
//取消之后控制肩部按钮
this.onSelected();
break;
default:
let transferInfo = getTransferInfo(this, id);
if (transferInfo) {
ajax({
url: '/nccloud/arap/arappub/queryrelatedapp.do',
data: {
billType: transferInfo.src_billtype
},
success: (res) => {
if (res) {
//将业务流程放入缓存
setDefData(
transferInfo.src_billtype + transferInfo.transtypes[0],
'transfer.dataSource',
transferInfo.busitypes
);
let dest_tradetype = getDefData('sessionTradeType', dataSource);
if (code) {
dest_tradetype = code;
} else if (!dest_tradetype) {
dest_tradetype = this.getPagecode();
}
let url = '/' + transferInfo.src_billtype;
props.pushTo(url, {
src_appcode: res.data.appcode, //来源小应用编码
src_tradetype: transferInfo.transtypes[0], //来源交易类型
dest_billtype: this.billType, //目的单据类型
dest_tradetype: dest_tradetype //目的交易类型
});
}
}
});
}
break;
}
}
export function refreshBill(res) {
let that = this
if (res.data) {
updateCache(pkname, that.props.getUrlParam('id'), res.data, that.formId, dataSource);
if (res.data.head) {
that.props.form.setAllFormValue({ [that.formId]: res.data.head[that.formId] });
}
if (res.data.body) {
that.props.cardTable.setTableData(that.tableId, res.data.body[that.tableId]);
}
} else {
that.props.form.EmptyAllFormValue(that.formId);
that.props.cardTable.setTableData(that.tableId, { rows: [] });
}
that.toggleShow('',res);
}
export function cardBillEdit(){
this.props.cardTable.selectAllRows(this.tableId, false);
let sceneType = 0;
let scene = this.props.getUrlParam('scene');
//获取单据编号
let djbh = this.props.form.getFormItemsValue(this.formId, 'billno').value;
let canEdit = true;
//来源于审批中心
if (scene == 'approve' || scene == 'approvesce') {
sceneType = 1;
//判断单据是否是当前用户待审批
ajax({
url: '/nccloud/riart/message/list.do',
async: false,
data: {
billno: djbh,
isread: 'N'
},
success: (result) => {
if (result.data) {
if (result.data.total < 1) {
toast({
content: this.state.json['gatheringbill-000026'],
color: 'warning'
}); /* 国际化处理: 当前单据已审批,不可进行修改操作!*/
canEdit = false;
}
}
}
});
}
//来源于我的作业
if (scene == 'zycl') {
sceneType = 2;
//判断单据是否是当前用户待处理
ajax({
url: '/nccloud/ssctp/sscbd/SSCTaskHandlePendingNumAction.do',
async: false,
data: {
billno: djbh
},
success: (result) => {
if (result.data) {
if (result.data.total < 1) {
toast({
content: this.state.json['gatheringbill-000027'],
color: 'warning'
}); /* 国际化处理: 当前单据已处理,不可进行修改操作!*/
canEdit = false;
}
}
}
});
}
if (!canEdit) {
return;
}
let editData = {
pk_bill: this.props.getUrlParam('id'),
billType: this.billType,
sence: sceneType
};
ajax({
url: '/nccloud/arap/arappub/edit.do',
data: editData,
success: (res) => {
if (res.success) {
this.props.setUrlParam({ status: 'edit' });
this.state.buttonfalg = true;
this.props.cardTable.setStatus(this.tableId, 'edit');
this.props.form.setFormStatus(this.formId, 'edit');
this.props.resMetaAfterPkorgEdit();
if(res.data && res.data.head){
this.props.form.setFormItemsDisabled(this.formId, res.data.head);
this.headBack = res.data.headBack
}
if(res.data && res.data.body){
this.props.cardTable.setColEditableByKey(this.tableId, res.data.body, true)
this.bodyBack = res.data.body
}
if(this.headBack && !res.data){
this.props.form.setFormItemsDisabled(this.formId, this.headBack);
this.props.cardTable.setColEditableByKey(this.tableId, this.bodyBack, false)
}
this.props.form.setFormItemsDisabled(this.formId, { pk_org: true });
this.toggleShow('',res);
}
}
});
}
/*q2LCmxM8POvl78IL0LiydqEO8dlmkDpbQUH9Mtm5EjY=*/

View File

@ -0,0 +1,9 @@
/*5pvMnolyoe65qServnBDiMmMgcFfD43ix8UG2eBl8gI=*/
import buttonClick from './buttonClick';
import initTemplate from './initTemplate';
import afterEvent from './afterEvent';
import pageInfoClick from './pageInfoClick';
import transferButtonClick from './transferButtonClick';
export { buttonClick, afterEvent, initTemplate, pageInfoClick, transferButtonClick };
/*5pvMnolyoe65qServnBDiMmMgcFfD43ix8UG2eBl8gI=*/

View File

@ -0,0 +1,164 @@
/*pmFWCFu5nhKkBzYmrkBakU94XhcN/7MP6yCIMRM7Oek=*/
import { base, ajax, cacheTools, cardCache, toast, excelImportconfig } from 'nc-lightapp-front';
let { NCPopconfirm } = base;
import tableButtonClick from './tableButtonClick';
import { tableId, formId, billType, tradeType, dataSource } from '../constants';
import { buttonVisible, getButtonsKey, getInnerButtonkey, cardBodyAndInnerButtonVisible } from '../../../../public/components/pubUtils/buttonvisible.js';
import { loginContext, getContext, loginContextKeys } from '../../../../public/components/arapInitInfo/loginContext';
import {OperationColumn} from '../../../../public/components/pubUtils/arapConstant';
let { setDefData, getDefData } = cardCache;
export default function (props,callback) {
const that = this;
//从地址栏获取页面编码
let appcode = this.props.getSearchParam('c');
let pagecode = that.getPagecode();
if (this.props.getUrlParam('srcbilltype')) {
//处理外系统推单,改变appcode、pagecode
dealOutToGather.call(this, props, appcode, pagecode)
}else {
init(that, props, appcode, pagecode,callback);
}
}
function init(that, props, appcode, pagecode,callback) {
let excelimportconfig = excelImportconfig(props, "arap", billType,true,"",{"appcode":appcode,"pagecode":that.getExportPageCode()});
let tradetype = pagecode
props.createUIDom(
{
pagecode: pagecode,//页面id
appcode: appcode,//注册按钮的id
reqDataQueryallbtns: {
rqUrl: '/arap/arappub/queryallbtns.do',
rqJson: `{\n \"pagecode\": \"${pagecode}\",\n \"appcode\": \"${appcode}\"\n,\n \"billtype\": \"${billType}\"\n,\n \"tradetype\": \"${tradetype}\"\n}`,
rqCode: 'button'
},
reqDataQuerypage: {
rqUrl: '/arap/arappub/querypage.do',
rqJson: `{\n \"pagecode\": \"${pagecode}\",\n \"appcode\": \"${appcode}\"\n}`,
rqCode: 'template'
}
},
function (data) {
if (data) {
if(!data.template[tableId]){
return;
}
if (data.template) {
let meta = data.template;
meta = modifierMeta(that, props, meta);
props.meta.setMeta(meta);
}
if (data.button && data.button.button) {
let button = data.button.button;
let pullBillInfoVOAry = data.button.pullbillinfo;
getButtonsKey(button, that.Info.allButtonsKey);//保存所有头部和肩部按钮
that.Info.pullBillInfoVOAry = pullBillInfoVOAry;
props.button.setButtons(button);
props.button.setUploadConfig("ImportData", excelimportconfig);
}
if(callback){
callback();
}
if (data.context) {
// 初始化上下文变量
loginContext(data.context);
if(getContext(loginContextKeys.transtype)){
if (that.refs.tradetypeBtn) {
that.refs.tradetypeBtn.setVisible(false);
}
}
}
}
}//,
//false//请求模板不走缓存
)
}
function modifierMeta(that, props, meta) {
let status = props.getUrlParam('status');
meta[formId].status = status;
meta[tableId].status = status;
//添加操作列
meta[tableId].items.push({
label: that.state.json['gatheringbill-000007'],/* 国际化处理: 操作*/
itemtype: 'customer',
attrcode: 'opr',
width: OperationColumn,
visible: true,
fixed: 'right',
render: (text, record, index) => {
let trueBtn = cardBodyAndInnerButtonVisible(that, that.state.buttonfalg, record.expandRowStatus);
return props.button.createOprationButton(trueBtn, {
area: "card_inner",
buttonLimit: 3,
onButtonClick: (props, key) => tableButtonClick(that, props, key, text, record, index)
});
}
});
return meta;
}
//处理外系统推收款单
export function dealOutToGather(props, appcode, pagecode) {
let url = "";
let data = {};
let srcbilltype = this.props.getUrlParam('srcbilltype')
//销售订单推收款单
if (srcbilltype == '30') {//销售订单订单收款
url = "/nccloud/arap/gatheringbill/saleordertogather.do",
data = {
pk_bill: this.props.getUrlParam('csaleorderid'),
pageId: pagecode
}
} else if (srcbilltype == 'FCT2') {//收款合同收款
url = "/nccloud/arap/gatheringbill/fct2togatherbill.do",
data = {
pk_bills: cacheTools.get('fct2ToF2Pks'),
pageId: pagecode
}
} else if (srcbilltype == '35') {//客户费用单推收款单
url = "/nccloud/arap/gatheringbill/arsubtogatherbill.do",
data = {
pk_bills: cacheTools.get('arsubToF2Pks'),
pageId: pagecode
}
} else if (srcbilltype == 'Z3') {//销售合同推收款单
url = "/nccloud/arap/gatheringbill/cttogatherbill.do",
data = {
pk_bills: cacheTools.get('CtToF2Pks'),
pageId: pagecode
}
}else if(srcbilltype == '36H1'){ //资金收票登记推收款单
url = "/nccloud/arap/gatheringbill/cmH1togatherbill.do",
data = {
pk_bills: cacheTools.get('H1ToF2Pks'),
pageId: pagecode
}
}
ajax({
url: url,
data: data,
success: (res) => {
if (res.data) {
pagecode = res.data.head[this.formId].rows[0].values.pk_tradetype.value;
this.data = res.data
init(this, props, appcode, pagecode, this.initShow)
} else {
this.props.form.EmptyAllFormValue(this.formId);
this.props.cardTable.setTableData(this.tableId, { rows: [] });
toast({ color: 'danger', content: this.state.json['gatheringbill-000033'] });/* 国际化处理: 数据异常,请重新操作!*/
}
}
})
}
/*pmFWCFu5nhKkBzYmrkBakU94XhcN/7MP6yCIMRM7Oek=*/

View File

@ -0,0 +1,67 @@
/*j07c8riwYnz20MYibuDbtFEGG3gwYuu5zMz1TEQetJM=*/
import { ajax, cardCache } from 'nc-lightapp-front';
import { formId, billType, dataSource, pkname } from '../constants';
import initTemplate from './initTemplate';
import {throwSagaErrorAgency} from '../../../../public/components/pubUtils/MicroServiceSocket.js';
let { getCacheById, updateCache, setDefData } = cardCache;
export default function (props, pk) {
if(!pk){//如果刷新了浏览器那么pk将不会存在如果pk不存在return
return;
}
let cardData = getCacheById(pk, dataSource);
let tradeType = this.getPagecode();
if (cardData) {
if(!props.getUrlParam("scene")){
let pagecode = cardData.head[this.formId].rows[0].values.pk_tradetype.value;
props.setUrlParam({id:pk,pagecode:pagecode})
//点击上一张下一张单据时,要将单据的交易类型放入缓存(和切换交易类型一致),下次点击新增自制时,取缓存中的交易类型
setDefData('sessionTradeType', dataSource, pagecode);
if(tradeType !=pagecode){
initTemplate.call(this, this.props);
}
} else{
props.setUrlParam({id:pk})
}
props.form.setAllFormValue({ [this.formId]: cardData.head[this.formId] });
props.cardTable.setTableData(this.tableId, cardData.body[this.tableId],null, null, true);
this.toggleShow('',cardData);
throwSagaErrorAgency.call(this,cardData)
} else {
let data = {
pk_bill: pk
};
ajax({
url: '/nccloud/arap/gatheringbill/cardquery.do',
data: data,
success: (res) => {
if (res.data) {
if (res.data.head) {
this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] });
}
if (res.data.body) {
this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId],null, null, true);
}
updateCache(pkname, pk, res.data, this.formId, dataSource);
if(!props.getUrlParam("scene")){
let pagecode = res.data.head[formId].rows[0].values.pk_tradetype.value;
props.setUrlParam({id:pk,pagecode:pagecode})
setDefData('sessionTradeType', dataSource, pagecode);
if(tradeType !=pagecode){
initTemplate.call(this, this.props);
}
}else{
props.setUrlParam({id:pk})
}
this.toggleShow('',res);
throwSagaErrorAgency.call(this,res)
} else {
this.props.form.EmptyAllFormValue(this.formId);
this.props.cardTable.setTableData(this.tableId, { rows: [] });
}
}
});
}
}
/*j07c8riwYnz20MYibuDbtFEGG3gwYuu5zMz1TEQetJM=*/

View File

@ -0,0 +1,75 @@
/*0GI1xcoeligdpMeXoHBphvFV/InrTFFpynAq7re5K1A=*/
import { ajax, base, toast, cardCache } from 'nc-lightapp-front';
import { tableId, dataSource, formId } from '../constants';
import { innerButton } from '../../../../public/components/pubUtils/buttonName.js';
import { copyInner, resetBodyPk, clearTopInfos, calculateHeadMoney, deleteInner, pasteInner } from '../../../../public/components/pubUtils/billPubUtil.js';
import { cardBodyControl } from '../../../../public/components/pubUtils/buttonvisible.js';
import { modifyChecknoItemtype } from '../../../../public/components/pubUtils/specialFieldAfterEvent.js';
let { getDefData, setDefData } = cardCache;
export default function (that, props, key, text, record, index) {
switch (key) {
// 表格操修改
case innerButton.open_browse:
props.cardTable.toggleRowView(tableId, record);
break;
case innerButton.Close_browse:
props.cardTable.toggleRowView(tableId, record);
break;
case innerButton.open_edit:
let ishideAdd = false
let cardData = that.props.createMasterChildData(that.getPagecode(), that.formId, that.tableId);
if(cardData && cardData.body && cardData.body[that.tableId] && cardData.body[that.tableId].rows){
let bodyrows= cardData.body[that.tableId].rows;
for(let i=0;i<bodyrows.length;i++){
let top_billid = bodyrows[i].values.top_billid.value
let top_itemid = bodyrows[i].values.top_itemid.value
if( top_billid || top_itemid ){
ishideAdd = true
break
}
}
}
that.setState({hideAdd: ishideAdd})
//动态修改票据号字段类型
modifyChecknoItemtype(props, that.tableId, record.values.pk_org_v.value, record.values.checktype.value)
props.cardTable.openModel(tableId, 'edit', record, index);
break;
case innerButton.Copy_inner:
copyInner(record, dataSource,that);
that.setState({
buttonfalg: false
}, () => {
cardBodyControl(props, that.state.buttonfalg);
})
break;
case innerButton.Insert_inner:
let data = props.createMasterChildData(that.getPagecode(), formId, tableId);
//清空cardData的表体
data.body[tableId].rows = [];
ajax({
url: '/nccloud/arap/gatheringbill/addline.do',
data: data,
success: (res) => {
if (res.data && res.data.body) {
props.cardTable.addRow(tableId, index + 1, res.data.body[tableId].rows[0].values);
} else {
props.cardTable.addRow(tableId);
}
}
});
break;
case innerButton.Delete_inner:
deleteInner(that, props, tableId, index);
//删行之后控制肩部按钮
that.onSelected();
break;
case innerButton.Paste_inner:
pasteInner(that, props, dataSource, tableId, index)
break;
default:
break;
}
};
/*0GI1xcoeligdpMeXoHBphvFV/InrTFFpynAq7re5K1A=*/

View File

@ -0,0 +1,176 @@
/*Zqktha8lwfXAWZRCgtFOTBGsch2yo65lKMwOc6Hai+A=*/
import { ajax, base, toast, cardCache, promptBox } from 'nc-lightapp-front';
import { tableId, formId, leftarea, dataSource, pkname } from '../constants';
import buttonClick from './buttonClick';
import {toggleBtnStatus,throwSagaErrorAgency} from '../../../../public/components/pubUtils/MicroServiceSocket.js';
let { setDefData, getDefData, addCache, deleteCacheById, getCacheById, updateCache } = cardCache;
export default function transferButtonClick(props, id) {
let that = this
let amount = props.transferTable.getTransformFormAmount(leftarea)
if (amount == 1) {
buttonClick.call(this, props, id);
return
}
switch (id) {
case 'Cancel':
{
promptBox({
color: 'warning',
title: this.state.json['gatheringbill-000034'], /* 国际化处理: 请注意*/
content: this.state.json['gatheringbill-000035'],/* 国际化处理: 是否取消?*/
beSureBtnName: this.state.json['gatheringbill-000036'],/* 国际化处理: 是*/
cancelBtnName: this.state.json['gatheringbill-000037'],/* 国际化处理: 否*/
beSureBtnClick: () => {
if(this.props.getUrlParam('id')){
this.props.setUrlParam({ status: 'browse' });
let id = this.props.getUrlParam('id');
let cardData = getCacheById(id, dataSource);
if (cardData) {
this.props.beforeUpdatePage();//打开开关
this.props.form.EmptyAllFormValue(this.formId);
this.props.cardTable.setTableData(this.tableId, { rows: [] });
this.props.form.setAllFormValue({ [this.formId]: cardData.head[this.formId] });
this.props.cardTable.setTableData(this.tableId, cardData.body[this.tableId]);
this.props.cardTable.setStatus(this.tableId, 'browse');
this.props.form.setFormStatus(this.formId, 'browse');
this.props.updatePage(this.formId, this.tableId);//关闭开关
this.toggleShow();
}
}else {
props.transferTable.setTransformFormStatus(leftarea, {
status: false,
onChange: (current, next) => {
// toast({ color: 'success', content: '取消成功' });
}
})
}
}
})
}
break;
case 'Delete':
promptBox({
color: 'warning',
title: this.state.json['gatheringbill-000005'] /* 国际化处理: 删除*/,
content: this.state.json['gatheringbill-000006'] /* 国际化处理: ​确定要删除吗?*/,
noFooter: false,
noCancelBtn: false,
beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/,
cancelBtnName: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/,
beSureBtnClick: () => {
ajax({
url: '/nccloud/arap/arappub/delete.do',
data: [{
pk_bill: this.props.getUrlParam('id'),
ts: this.props.form.getFormItemsValue(this.formId, 'ts').value,
billType: this.billType
}],
success: function (res) {
if (props.transferTable.getTransformFormAmount(leftarea) == 1) {
history.go(-1);
} else {
deleteCacheById(pkname, props.getUrlParam('id'), dataSource);
props.transferTable.setTransformFormStatus(leftarea, {
status: false,
onChange: (current, next) => {
toast({ color: 'success', content: that.state.json['gatheringbill-000017'] });/* 国际化处理: 删除成功*/
}
})
}
}
})
}
});
break;
case 'Copy':
ajax({
url: '/nccloud/arap/arappub/copy.do',
data: {
pk_bill: props.getUrlParam('id'),
ts: this.props.form.getFormItemsValue(this.formId, 'ts').value,
pageId: this.getPagecode(),
billType: this.billType,
tradeType: this.getPagecode(),
},
success: (res) => {
if (res.data) {
if (res.data.head) {
this.props.form.EmptyAllFormValue(this.formId);
this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] });
}
if (res.data.body) {
this.props.cardTable.setTableData(this.tableId, { rows: [] });
this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]);
}
}
this.props.setUrlParam({ status: 'add' })
this.props.addUrlParam({ operFlag: 'copy' })
this.state.buttonfalg = true;
props.resMetaAfterPkorgEdit();
this.props.form.setFormItemsDisabled(this.formId, { 'pk_org_v': false });
this.toggleShow()
}
});
break;
default:
buttonClick.call(this, props, id);
break;
}
}
export function setValue(props, res) {
this.props.beforeUpdatePage();//打开开关
if(res){
toggleBtnStatus.call(this,res,'card_head');
}
if (res.data.head && res.data.head[formId]) {
props.form.setAllFormValue({ [formId]: res.data.head[formId] });
}
if (res.data.body && res.data.body[tableId]) {
props.cardTable.updateDataByRowId(this.tableId, res.data.body[this.tableId]);
}
let pk_gatherbill = this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value
let newCardData = this.props.createMasterChildData(
this.getPagecode(),
this.formId,
this.tableId
);
let pkvalues = [];
let amount = this.props.cardTable.getNumberOfRows(this.tableId) * 1
for(var i =0 ; i< amount; i++){
pkvalues.push(this.props.cardTable.getValByKeyAndIndex(this.tableId, i, 'top_itemid').value);
}
/**
* 保存转单上游选中表体pks到转单的dataSource中
*/
props.transferTable.savePk(props.getUrlParam("dataSource"), pkvalues);
/**
* 将新增单据数据保存到dataSource
*/
if (props.getUrlParam('status') == 'add') {
addCache(pk_gatherbill, newCardData, formId, dataSource)
}else {
updateCache(pkname, pk_gatherbill, newCardData, formId, dataSource);
}
this.props.updatePage(this.formId, this.tableId);//关闭开关
this.props.transferTable.setTransformFormStatus(leftarea, {
status: true
/* onChange: (current, next, currentIndex) => {
this.transferIndex = currentIndex + 1;
this.Info.isNeedSelect = true
props.transferTable.setTransferListValueByIndex(
leftarea,
newCardData,
currentIndex
)
} */
})
throwSagaErrorAgency.call(this,res)
}
/*Zqktha8lwfXAWZRCgtFOTBGsch2yo65lKMwOc6Hai+A=*/

File diff suppressed because it is too large Load Diff