备料申请源码

This commit is contained in:
李正@用友 2025-05-19 17:27:41 +08:00
parent 1f113fd637
commit fed95c72e8
47 changed files with 6765 additions and 2 deletions

View File

@ -1,9 +1,10 @@
{
"buildEntryPath": [
"./src/sscivm/invoiceApplication/*/*/index.js"
"./src/mmpac/mmpac/pmo/*/index.js",
"./src/mmpac/mmpac/pickm/*/index.js"
],
"proxyJson": false,
"proxy": "http://127.0.0.1:9080/",
"proxy": "http://127.0.0.1:8080/",
"buildWithoutHTML": [
"uap/refer",
"uapbd/refer"

View File

@ -0,0 +1,143 @@
import { ajax } from 'nc-lightapp-front';
import { URL,Field,Field_detail, bodyCustAndSupFild, ReqPickmCardInfo,bodyfixAssts } from '../../constance';
import {
createExtBodyAfterEventData,
processExtBillCardBodyEditResult
} from '../../../../../mmpub/mmpub/pub/tool/afterEditUtil';
import { marAsstUtils } from '../../../../../mmpub/mmpub/pub/tool';
import { processCardTableAutoAddRow } from '../../../../../mmpub/mmpub/pub/tool/autoAddRowUtil';
import {setRowDefaultValue} from '../btnClicks';
const { pageId,card_head,card_tail,card_body_detail,card_body_sum,headActionEdit,bodyAction_detail,bodyAction_sum,pk_head,pk_body_detail,pk_body_sum} = ReqPickmCardInfo;
/**
* 备料申请卡片表体编辑后事件
* @author maqna
*/
let bodyids = [card_body_detail, card_body_sum];
export default function bodyAfterEvent (props, moduleId, key, value, changedrows,index,record) {
// 初始化自定义参数
let userobject = {};
//触发后台编辑后
let afterEditFile = [
'cmaterialvid', 'cdeliverorgvid','nreqnum','nreqastnum','castunitid',
'vchangerate',
];
// let bd = data.card.bodys[card_body_detail];
// data.card.bodys=[bd]
let _this = this;
if(key == Field_detail.cmaterialvid){//物料
//如果物料值为空,清空相应字段
let clearItems = [
'vchangerate','castunitid','cbffileid',
'vbfree1', 'vbfree2', 'vbfree3', 'vbfree4', 'vbfree5', 'vbfree6', 'vbfree7', 'vbfree8', 'vbfree9', 'vbfree10'
];
this.props.cardTable.setEditableByIndex(card_body_detail, index, 'cbffileid', true);
checkFieldsUtil(props, moduleId, index , clearItems );
//当选择的物料是一条的时候进行判断,如果新旧值相同则不需要进行调用
if (changedrows.length == 1) {
if (changedrows && changedrows[0].newvalue.value == changedrows[0].oldvalue.value) {
return;
}
}
//所用物料是多条时,手动清空发料仓库
if(changedrows.length >= 1){
props.cardTable.setValByKeyAndIndex(moduleId, index, 'coutstockid', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, index, 'coutstockid.name', {
value: null,
display: null
});
}
}else if(key == Field_detail.cdeliverorgvid){//发料组织
if (changedrows && changedrows[0].newvalue.value == changedrows[0].oldvalue.value) {
return;
}
props.cardTable.setValByKeyAndIndex(moduleId, index, 'coutstockid', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, index, 'coutstockid.name', {
value: null,
display: null
});
}else if(key == Field_detail.coutstockid){//发料仓库
if (changedrows && changedrows[0].newvalue.value == changedrows[0].oldvalue.value) {
return;
}
}
else if (bodyfixAssts.includes(key)||key.startsWith('vbfree')) {
marAsstUtils.afterEdit.call(this, props, props.getAppCode(), pageId, moduleId, key,Field_detail.cmaterialvid, record, index,'mmpac.mm_reqpickm_b',bodyCustAndSupFild);
}
let data = createExtBodyAfterEventData(
props,
pageId,
card_head,
bodyids,
moduleId,
key,
changedrows,
index,
userobject,
'vrowno'
);
/**
* 编辑后事件请求: 有编辑后事件的字段
* @param {*} props
* @param {*} url
* @param {*} aggvo
*/
// if(afterEditFile.includes(key)){
ajax({
url: URL.bodyDetailAfterEdit,
data: data,
method: 'POST',
async: false, //同步
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
//参数一:返回的公式对象 参数二:界面使用的表格类型
_this.props.dealFormulamsg(res.formulamsg, {
[card_body_detail]: 'cardTable',
[card_body_sum]: 'cardTable'
});
}
if (res.data.extbillcard) {
_this.props.beforeUpdatePage();
let data = res.data.extbillcard;
if (data.head) {
_this.props.form.setAllFormValue({ card_head: data.head[card_head] });
}
processExtBillCardBodyEditResult(_this.props, moduleId, data,index);
_this.props.updatePage(card_head, bodyids);
}
}
})
//}
processCardTableAutoAddRow(_this.props, moduleId, index, {
isMuli: changedrows.length > 1 ? true : false,
crownoField:'vrowno',
defaultValue:setRowDefaultValue.call(this, props)
});
}
function checkFieldsUtil(props, moduleId, index, clearItems){
for (let item = 0; item < clearItems.length; item++) {
props.cardTable.setValByKeyAndIndex(moduleId, index, clearItems[item], {
value: null,
display: null,
scale: '-1'
});
}
}

View File

@ -0,0 +1,100 @@
import { ajax } from 'nc-lightapp-front';
import { URL,Field,Field_detail, CardButton_body_detail, ReqPickmCardInfo, Field_sum } from '../../constance';
import {
createExtBodyAfterEventData,
processExtBillCardBodyEditResult
} from '../../../../../mmpub/mmpub/pub/tool/afterEditUtil';
const { pageId,card_head,card_tail,card_body_detail,card_body_sum,headActionEdit,bodyAction_detail,bodyAction_sum,pk_head,pk_body_detail,pk_body_sum} = ReqPickmCardInfo;
/**
* 备料申请卡片表体编辑后事件
* @author maqna
*/
let bodyids = [card_body_detail, card_body_sum];
export default function bodyAfterEvent (props, moduleId, key, value, changedrows,index,record) {
// 初始化自定义参数
let userobject = {};
//触发后台编辑后
let afterEditFile = [
'nstocknum', 'nstockastnum','csupplyorgvid'
];
let data = createExtBodyAfterEventData(
props,
pageId,
card_head,
bodyids,
moduleId,
key,
changedrows,
index,
userobject,
'vrowno'
);
let _this = this;
if(key == Field_sum.csupplyorgvid){//供应组织
if (changedrows && changedrows[0].newvalue.value == changedrows[0].oldvalue.value) {
return;
}
//编辑供应组织后,清空供应仓库
props.cardTable.setValByKeyAndIndex(moduleId, index, 'cinstockid', {
value: null,
display: null
});
return;
}
/**
* 编辑后事件请求: 有编辑后事件的字段
* @param {*} props
* @param {*} url
* @param {*} aggvo
*/
if(afterEditFile.includes(key)){
if (changedrows && changedrows[0].newvalue.value == changedrows[0].oldvalue.value) {
return;
}
ajax({
url: URL.bodySumAfterEdit,
data: data,
method: 'POST',
async: false, //同步
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
//参数一:返回的公式对象 参数二:界面使用的表格类型
_this.props.dealFormulamsg(res.formulamsg, {
[card_body_detail]: 'cardTable',
[card_body_sum]: 'cardTable'
});
}
if (res.data.extbillcard) {
_this.props.beforeUpdatePage();
let data = res.data.extbillcard;
if (data.head) {
_this.props.form.setAllFormValue({ card_head: data.head[card_head] });
}
processExtBillCardBodyEditResult(_this.props, moduleId, data,index);
_this.props.updatePage(card_head, bodyids);
}
}
})
}
}
function checkFieldsUtil(props, moduleId, key, value, changedrows, index, record, clearItems){
//如果物料值为空,清空相应字段值
if (value.length == 0 || !value.values) {
for (let item = 0; item < clearItems.length; item++) {
props.cardTable.setValByKeyAndIndex(moduleId, index, clearItems[item], {
value: null,
display: null,
scale: '-1'
});
}
return;
}
return true;
}

View File

@ -0,0 +1,67 @@
import { URL, STATUS, ReqPickmCache, ReqPickmCardInfo, CardButton, CardButton_body_detail_detail } from '../../constance';
const cardPageUISet = function(status){
//debugger;
switch(status){
case STATUS.browse:
cardPageUISetBrowse.call(this);
break;
case STATUS.edit:
cardPageUISetEdit.call(this);
break;
case STATUS.add:
cardPageUISetEdit.call(this);
break;
default:
break;
}
}
const cardPageUISetBrowse = function(){
this.props.BillHeadInfo.setBillHeadInfoVisible({
showBackBtn: true,
showBillCode: true,
billCode: this.props.form.getFormItemsValue( ReqPickmCardInfo.card_head , ReqPickmCardInfo.pk_head).value //修改单据号
});
this.props.button.setButtonVisible(CardButton.BrowseBtns,true);
this.props.button.setButtonVisible([...CardButton.EditBtns],false);
this.props.cardPagination.setCardPaginationVisible('cardPaginationBtn', true);
}
const cardPageUISetEdit = function(){
this.props.BillHeadInfo.setBillHeadInfoVisible({
showBackBtn: false,
showBillCode: true,
billCode: this.props.form.getFormItemsValue( ReqPickmCardInfo.card_head , ReqPickmCardInfo.pk_head).value //修改单据号
});
this.props.button.setButtonVisible([...CardButton.BrowseBtns],false);
this.props.button.setButtonVisible([...CardButton.EditBtns],true);
this.props.cardPagination.setCardPaginationVisible('cardPaginationBtn', false);
// let selectedRows = this.props.cardTable.getCheckedRows(ReqPickmCardInfo.card_body);
// if(selectedRows.length==0){
// this.props.button.setDisabled({[CardButton_body_detail.DeleteLine]:true,[CardButton_body_detail.AddLine]:true});
// }
}
// const headButtonSet = function(fbillstatus){
// let Del=false; //
// let Edit=false; //
// let Recieve=false; //
// if(BillStatusEnum.ongoing.data!=fbillstatus){
// Edit=true;
// Del=true;
// Recieve=true;
// }
// let disableBtns={
// Del:Del, //
// Edit:Edit, //
// Recieve:Recieve, //
// }
// this.props.button.setDisabled(disableBtns);
// }
export {
cardPageUISetBrowse,
cardPageUISetEdit,
cardPageUISet,
//headButtonSet
}

View File

@ -0,0 +1,21 @@
import { URL, STATUS, ReqPickmCache, Field, ReqPickmCardInfo, CardButton } from '../../constance';
const {pageId,card_head,card_tail,card_body_detail,card_body_sum,headAction,bodyAction_detail,bodyAction_sum,pk_head,pk_body_detail,pk_body_sum} = ReqPickmCardInfo;
import orgChangeEvent from './orgChangeEvent';
import bodyDetailAfterEvent from './bodyDetailAfterEvent';
import bodySumAfterEvent from './bodySumAfterEvent'
const afterEvent = function(props, moduleId, key, value, changedRow, index, record){
if(moduleId == card_head && (key == Field.pk_org ||key==Field.pk_org_v)){
orgChangeEvent.call(this,props, moduleId, key, value, changedRow,index, record);
}else if(moduleId == card_head){
//headAfterEvent.call(this, props, moduleId, key, value);
}else if(moduleId == card_body_detail){
bodyDetailAfterEvent.call(this,props, moduleId, key, value, changedRow,index, record);
}else if(moduleId == card_body_sum){
bodySumAfterEvent.call(this,props, moduleId, key, value, changedRow,index, record);
}
}
export {
afterEvent
}

View File

@ -0,0 +1,148 @@
import { ajax } from 'nc-lightapp-front';
import {showWarningDialog} from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
import { URL,Field,Field_detail, CardButton_body_detail, ReqPickmCardInfo } from '../../constance';
import {
processExtBillCardHeadEditResult
} from '../../../../../mmpub/mmpub/pub/tool/afterEditUtil';
import { RownoUtils } from '../../../../../mmpub/mmpub/pub/tool/cardTableTools';
import { buttonController } from '../viewController';
import { setRowDefaultValue } from '../btnClicks';
import { transtypeUtils } from '../../../../../mmpub/mmpub/pub/tool';
import {getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
const { pageId,card_head,card_tail,card_body_detail,card_body_sum,headActionEdit,bodyAction_detail,bodyAction_sum,pk_head,pk_body_detail,pk_body_sum} = ReqPickmCardInfo;
/**
* 备料申请卡片组织编辑后事件
* @author maqna
*/
let bodyids = [card_body_detail, card_body_sum];
export default function orgChangeEvent (props, moduleId, key, value, changedrows,index, record) {
let _this = this;
let aggvo = null;
if(value.value == null || value.value == '' || value instanceof Array || Object.keys(value).length === 0){
//清空组织时给出警告
showWarningDialog(
getLangByResId(this,'5008ReqPickmPUBMESSAGE-000012'),/* 国际化处理: 确认修改*/
getLangByResId(this,'5008ReqPickmPUBMESSAGE-000013'),/* 国际化处理: 清空组织,这样会清空您录入的信息?*/
{
beSureBtnClick: () => {
// 1、工厂为空时清空表单数据且表体不可编辑
props.form.EmptyAllFormValue(card_head);
setTimeout(() => {
//执行跳出堆栈
props.cardTable.setTableData(card_body_detail, { rows: [] });
props.cardTable.setTableData(card_body_sum, { rows: [] });
}, 0);
props.initMetaByPkorg(Field.pk_org_v);//如果无主组织,设置模板上其他字段的不可编辑性
//props.button.setButtonDisabled([ CardButton_body_detail.AddLine ], true);
buttonController.lineSelected.call(this, props);
},
cancelBtnClick: () => {
props.form.setFormItemsValue(card_head, {
[key]: { value: changedrows.value, display: changedrows.display }
});
}
}
)
} else {
//2、不为空时释放页面编辑性同时判断是否和旧值相等来判断是否清空数据
if (changedrows && value.value != changedrows.value && changedrows.value != null && changedrows.value != '') {
// 修改组织
showWarningDialog(
getLangByResId(this,'5008ReqPickmPUBMESSAGE-000012'),/* 国际化处理: 确认修改*/
getLangByResId(this,'5008ReqPickmPUBMESSAGE-000013'),/* 国际化处理: 清空组织,这样会清空您录入的信息?*/
{
beSureBtnClick: () => {
props.form.EmptyAllFormValue(card_head);
props.form.setFormItemsValue(card_head, {
[key]: { value: value.value, display: value.display }
});
props.cardTable.setTableData(card_body_detail, { rows: [] });
props.cardTable.setTableData(card_body_sum, { rows: [] });
aggvo = props.createHeadAfterEventData(
pageId,
card_head,
bodyids,
moduleId,
key,
value
);
getAfterData.call(this, props,moduleId, aggvo);
},
cancelBtnClick: () => {
props.form.setFormItemsValue(card_head, {
[key]: { value: changedrows.value, display: changedrows.display }
});
}
}
);
} else {
props.cardTable.setTableData(card_body_detail, { rows: [] });
props.cardTable.setTableData(card_body_sum, { rows: [] });
props.form.setFormItemsValue(card_head, {
[key]: { value: value.value, display: value.display }
});
//3、
aggvo = props.createHeadAfterEventData(
pageId,
card_head,
bodyids,
moduleId,
key,
value
);
getAfterData.call(this,props, moduleId, aggvo);
// props.resMetaAfterPkorgEdit(); //选择主组织以后,恢复其他字段的编辑性
// //发布小应用时,给交易类型赋值
// transtypeUtils.setValue.call(this, card_head, Field.crequesttype);
// // 组织不为空表体新增一行
// bodyAddRow.call(this,props,card_body_detail);
// RownoUtils.setRowNo(props,card_body_detail,Field_detail.vrowno);
}
}
}
//组织切换处理
function getAfterData(props,moduleId, aggvo) {
ajax({
url: URL.orgChangedEvent,
data: aggvo,
mode: 'normal',
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
props.dealFormulamsg(
res.formulamsg, //参数一:返回的公式对象
{
//参数二:界面使用的表格类型
[card_body_detail]: 'cardTable',
[card_body_sum]: 'cardTable'
}
);
}
if (res && res.data && res.data.data && res.data.data.extbillcard && res.data.data.extbillcard.head && res.data.data.extbillcard.head[card_head]) {
processExtBillCardHeadEditResult(props, card_head, bodyids, res.data.data);
props.resMetaAfterPkorgEdit();//选择主组织以后,恢复其他字段的编辑性
//发布小应用时,给交易类型赋值
transtypeUtils.setValue.call(this, card_head, Field.crequesttype,Field.vrequesttypecode);
// 组织不为空表体新增一行
bodyAddRow.call(this,props,card_body_detail);
RownoUtils.setRowNo(props,card_body_detail,Field_detail.vrowno);
//按钮控制
buttonController.lineSelected.call(this,props);
}
}
});
}
function bodyAddRow(props,tableId){
props.cardTable.addRow(tableId,
0,
//初始化值
setRowDefaultValue.call(this,props),
false
);
}

View File

@ -0,0 +1,149 @@
import { ajax } from 'nc-lightapp-front';
import { Field, Field_detail, ReqPickmCardInfo,URL } from '../../constance';
import {
processExtBillCardBodyEditResult4Batch,
createBodyAfterEventData4BatchMore
} from '../../../../../mmpub/mmpub/pub/tool/afterEditUtil';
const { card_head, card_body_detail, card_body_sum ,pageId} = ReqPickmCardInfo;
export default function batchEvents(obj) {
if (!obj) {
return;
}
let areaCode = obj.areaCode; //区域编码
let column = obj.column; //列信息
let newValue = obj.newValue; //变更的行信息
let queryValue = [];
let changedrows = obj.changedrows; //变更的信息仅包含newValue和OldValue
let currentIndex = obj.currentIndex; //当前行
let indexs = [];
let rows = [];
let attrcode = column.attrcode; //列code
let queryCondition; //统一过滤的过滤条件
let isManyCondition = null; //是否多个过滤条件
let pasteData = obj.pasteData; //粘贴的值
let sumrows = this.props.cardTable.getVisibleRows(card_body_sum);
if (sumrows && sumrows.length > 0) {
return;
}
//控制明细页签不可编辑字段
let bodyDisableFields = ['vrowno', 'fitemsource', 'fsupplytype', 'ddeliverdate', 'bmainmaterial', 'bcanreplace', 'vchangerate'];
if (bodyDisableFields.includes(attrcode)) {
return;
}
let pk_group = this.props.form.getFormItemsValue(card_head, Field.pk_group).value;
let pk_org = this.props.form.getFormItemsValue(card_head, Field.pk_org).value;
if (attrcode == Field_detail.cmaterialvid) {//物料
for (let i = 0; i < newValue.length; i++) {
if (newValue[i].values.csourcebillcode && newValue[i].values.csourcebillcode.value) {
continue;
}
newValue[i].queryCondition = {
pk_org: pk_org,
GridRefActionExt: URL.materialURL
};
queryValue.push(newValue[i]);
indexs[i] = currentIndex + i;
rows[i] = [i];
}
isManyCondition = true;
}
else if (attrcode == Field_detail.cdeliverorgvid) {//发料组织
for (let i = 0; i < newValue.length; i++) {
if (newValue[i].values.csourcebillcode && newValue[i].values.csourcebillcode.value) {
continue;
}
let pk_org = newValue[i].values.pk_org.value;
newValue[i].queryCondition = {
pk_group: pk_group
};
queryValue.push(newValue[i]);
indexs[i] = currentIndex + i;
rows[i] = [i];
}
isManyCondition = true;
}
else if (attrcode == Field_detail.coutstockid) {//发料仓库根据发料组织过滤
for (let i = 0; i < newValue.length; i++) {
if (!newValue[i].values.cdeliverorgid || !newValue[i].values.cdeliverorgid.value) {
continue;
}
let deliverorg = newValue[i].values.cdeliverorgid.value;
newValue[i].queryCondition = {
pk_org: deliverorg,
GridRefActionExt: 'nccloud.web.mmpac.reqpickm.ref.OutStockRefFilter'
};
queryValue.push(newValue[i]);
indexs[i] = currentIndex + i;
rows[i] = [i];
}
isManyCondition = true;
}
else if (attrcode == Field_detail.castunitid) {//辅单位
for (let i = 0; i < newValue.length; i++) {
if (!newValue[i].values.cmaterialvid || !newValue[i].values.cmaterialvid.value) {
continue;
}
let cmaterialvid = newValue[i].values.cmaterialvid.value;
newValue[i].queryCondition = {
cmaterialvid: cmaterialvid,
GridRefActionExt: 'nccloud.web.mmpub.pub.ref.MeasdocRefFilterUtils'
};
queryValue.push(newValue[i]);
indexs[i] = currentIndex + i;
rows[i] = [i];
}
isManyCondition = true;
}
else {
for (let i = 0; i < newValue.length; i++) {
queryValue.push(newValue[i]);
indexs[i] = currentIndex + i;
rows[i] = [i];
}
}
this.props.cardTable.updateAfterBatchChange({
areaCode,
column,
indexs,
queryValue,
changedrows,
pasteData,
queryCondition,
isManyCondition
}).then((res) => {
let props = res.props;
changedrows = res.changedrows;
indexs = res.indexs;
//执行业务的批量编辑后事件
// afterEvent(props, areaCode, attrcode, queryValue, changerows);
let data = createBodyAfterEventData4BatchMore(
this.props,
pageId,
card_head,
[card_body_detail,card_body_sum],
areaCode,
attrcode,
changedrows,
indexs
);
ajax({
url: URL.bodyDetailAfterEdit,
data: data,
async: false,
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
//参数一:返回的公式对象 参数二:界面使用的表格类型
this.props.dealFormulamsg(res.formulamsg, {
[card_body_detail]: 'cardTable',
[card_body_sum]: 'cardTable'
});
}
processExtBillCardBodyEditResult4Batch(props,card_body_detail, res.data, indexs);
this.forceUpdate();
}
});
});
}

View File

@ -0,0 +1,2 @@
import bodyDetailBatchEvent from './bodyDetailBatchEvent';
export { bodyDetailBatchEvent};

View File

@ -0,0 +1,68 @@
import { Field, Field_detail, ReqPickmCardInfo } from '../../constance';
const { card_head, card_body_detail, card_body_sum } = ReqPickmCardInfo;
/**
* 备料申请卡片表体编辑前事件
* @author maqna
*/
let bodyids = [card_body_detail, card_body_sum];
export default function bodyBeforeEvent(props, moduleId, key, value, index, record) {
let _this = this;
let flag = true;
let constance = {};
let pk_group = props.form.getFormItemsValue(card_head, Field.pk_group).value;
let pk_org = props.form.getFormItemsValue(card_head, Field.pk_org).value;
let meta = this.props.meta.getMeta();
if (key == Field_detail.cmaterialvid) {//物料
meta[card_body_detail].items.map((item) => {
if (item.attrcode == Field_detail.cmaterialvid) {//物料
props.cardTable.setQueryCondition(moduleId, {
[item.attrcode]: () => {
return {
pk_org: pk_org,
pk_group: pk_group
//GridRefActionExt: 'nccloud.web.mmpac.reqpickm.ref.MaterialRefFilter'
};
}
});
}
});
} else if (key == Field_detail.cdeliverorgvid) {//发料组织
meta[card_body_detail].items.map((item) => {
if (item.attrcode == Field_detail.cdeliverorgvid) {
props.cardTable.setQueryCondition(moduleId, {
[item.attrcode]: () => {
return {
pk_group: pk_group
};
}
});
}
});
} else if (key == Field_detail.coutstockid) {//发料仓库根据发料组织过滤
let deliverorg = props.cardTable.getValByKeyAndIndex(card_body_detail, index, Field_detail.cdeliverorgid).value;
// if(!deliverorg){//发料组织为空,发料仓库不可编辑
// flag=false;
// }else{
meta[card_body_detail].items.map((item) => {
if (item.attrcode == Field_detail.coutstockid) {
props.cardTable.setQueryCondition(moduleId, {
[item.attrcode]: () => {
return {
pk_org: deliverorg
// deliverorg: deliverorg,
// GridRefActionExt: 'nccloud.web.mmpac.reqpickm.ref.OutStockRefFilter'
};
}
});
}
});
//}
}
return flag;
}

View File

@ -0,0 +1,207 @@
import { URL, Field, Field_detail, ReqPickmCardInfo, bodyfixAssts, bodyCustAndSupFild } from '../../constance';
import vchangerateBeforeEvent from './vchangerateBeforeEvent';
import vfreeBeforeEvent from './vfreeBeforeEvent';
import { marAsstUtils } from '../../../../../mmpub/mmpub/pub/tool';
const { card_head, card_body_detail, card_body_sum } = ReqPickmCardInfo;
/**
* 备料申请卡片表体编辑前事件
* @author maqna
*/
let bodyids = [card_body_detail, card_body_sum];
export default async function bodyBeforeEvent(props, moduleId, key, value, index, record) {
let _this = this;
let flag = true;
let pageId = ReqPickmCardInfo.pageId;
let constance = {};
let pk_group = props.form.getFormItemsValue(card_head, Field.pk_group).value;
let pk_org = props.form.getFormItemsValue(card_head, Field.pk_org).value;
let meta = this.props.meta.getMeta();
//如果汇总表有数据,全部字段不可编辑
//let cmaterialvid = props.cardTable.getValByKeyAndIndex(card_body_sum, 0, 'cmaterialvid');
let sumrows = props.cardTable.getVisibleRows(card_body_sum);
if (sumrows && sumrows.length > 0) {
return false;
}
//控制明细页签不可编辑字段
let bodyDisableFields = [
'vmobillcode',
'csourcebillcode',
'vmatchcode',
'vprocessno',
'cfeedid',
'cwkid',
'bcanreplace',
'bmainmaterial',
'fsupplytype',
'nquotadosageastnum',
'nquotadosagenum',
'nunitquotaastnum',
'nunitquotanum',
'nrequireastnum',
'nrequirenum',
'nreserveastnum',
'nreservenum',
'cunitid',
'fitemsource',
'ddeliverdate'
];
if (bodyDisableFields.includes(key)) {
return false;
}
if (key == Field_detail.cmaterialvid) {//物料
let csourcebillcode = props.cardTable.getValByKeyAndIndex(card_body_detail, index, 'csourcebillcode');
if (csourcebillcode && csourcebillcode.value) {//来源备料计划时,物料不可修改
flag = false;
} else {
meta[card_body_detail].items.map((item) => {
if (item.attrcode == Field_detail.cmaterialvid) {//物料
props.cardTable.setQueryCondition(moduleId, {
[item.attrcode]: () => {
return {
pk_org: pk_org,
// isfeature: 'N',
// 过滤特征选配与可选类
matchmode: '2',
GridRefActionExt: 'nccloud.web.mmpub.pub.ref.MaterialRefSqlBuilder'
};
}
});
}
});
}
} else if (key == Field_detail.cdeliverorgvid) {//发料组织
let csourcebillcode = props.cardTable.getValByKeyAndIndex(card_body_detail, index, 'csourcebillcode');
if (csourcebillcode && csourcebillcode.value) {//来源备料计划时,发料组织不可修改
flag = false;
} else {
meta[card_body_detail].items.map((item) => {
if (item.attrcode == Field_detail.cdeliverorgvid) {
props.cardTable.setQueryCondition(moduleId, {
[item.attrcode]: () => {
return {
pk_group: pk_group
};
}
});
}
});
}
} else if (key == Field_detail.coutstockid) {//发料仓库根据发料组织过滤
let deliverorg = props.cardTable.getValByKeyAndIndex(card_body_detail, index, Field_detail.cdeliverorgid).value;
if (!deliverorg) {//发料组织为空,发料仓库不可编辑
flag = false;
} else {
meta[card_body_detail].items.map((item) => {
if (item.attrcode == Field_detail.coutstockid) {
props.cardTable.setQueryCondition(moduleId, {
[item.attrcode]: () => {
return {
pk_org: deliverorg,
GridRefActionExt: 'nccloud.web.mmpac.reqpickm.ref.OutStockRefFilter'
};
}
});
}
});
}
} else if (key == Field_detail.castunitid) {//辅单位
let cmaterialvid = props.cardTable.getValByKeyAndIndex(card_body_detail, index, Field_detail.cmaterialvid).value;
//物料为空直接返回false 不可编辑
if (!cmaterialvid) {
flag = false;
} else {
meta[card_body_detail].items.map((item) => {
if (item.attrcode == Field_detail.castunitid) {
//根据物料过滤单位
let cmaterialvid = props.cardTable.getValByKeyAndIndex(card_body_detail, index, Field_detail.cmaterialvid).value;
item.queryCondition = () => {
return {
cmaterialvid: cmaterialvid,
GridRefActionExt: 'nccloud.web.mmpub.pub.ref.MeasdocRefFilterUtils'
};
}
}
});
props.meta.setMeta(meta);
}
} else if (key == Field_detail.vchangerate) {//换算率
//换算率编辑前控制
let cmaterialvid = props.cardTable.getValByKeyAndIndex(card_body_detail, index, Field_detail.cmaterialvid).value;
//物料为空直接返回false 不可编辑
if (!cmaterialvid) {
flag = false;
}
//主单位
let cunitid = props.cardTable.getValByKeyAndIndex(card_body_detail, index, Field_detail.cunitid).value;
//单位
let castunitid = props.cardTable.getValByKeyAndIndex(card_body_detail, index, Field_detail.castunitid).value;
//主单位为空直接返回false 不可编辑
if (!cunitid) {
flag = false;
}
//主辅计量单位相同不允许修改换算率
if (cunitid == castunitid) {
flag = false;
} else {
// 主辅计量不同,根据是否固定换算率决定其编辑性 此处应该有远程调用查询
flag = vchangerateBeforeEvent.call(this, props, moduleId, key, cmaterialvid, castunitid);
}
} else if (key.startsWith('vbfree')) {//自由辅助属性
//辅助属性
let pk_org = props.form.getFormItemsValue(card_head, Field.pk_org).value;
let materialvid = props.cardTable.getValByKeyAndIndex(card_body_detail, index, Field_detail.cmaterialvid).value;
constance.key = key;
constance.params = {
key: key,
pk_org: pk_org,
cmaterialvid: materialvid,
prefix: 'vbfree'
};
flag = await vfreeBeforeEvent.call(this, props, constance);
if (flag) {
marAsstUtils.resetItem.call(this, props, props.getAppCode(), pageId, moduleId, key, record, 'mmpac.mm_reqpickm_b', 'pk_org', bodyCustAndSupFild);
}
} else if (bodyfixAssts.includes(key)) {//物料的4个固定辅助属性
let materialvid = props.cardTable.getValByKeyAndIndex(card_body_detail, index, Field_detail.cmaterialvid).value;
if (materialvid) {
marAsstUtils.resetItem.call(this, props, props.getAppCode(), pageId, moduleId, key, record, 'mmpac.mm_reqpickm_b', 'pk_org', bodyCustAndSupFild);
}
flag = true;
} else if (key == 'cbffileid') {
let pk_org = props.form.getFormItemsValue(card_head, Field.pk_org).value;
let materialvid = props.cardTable.getValByKeyAndIndex(card_body_detail, index, Field_detail.cmaterialvid).value;
meta[card_body_detail].items.map((item) => {
if (item.attrcode == key) {
props.cardTable.setQueryCondition(moduleId, {
[item.attrcode]: () => {
return {
cmaterialvid : materialvid,
pk_org: pk_org,
pk_group:window.parent.GETBUSINESSINFO().groupId,
};
}
});
}
});
let constance = {};
constance.key = 'cbffileid';
constance.params = {
key: 'cbffileid',
pk_org: pk_org,
cmaterialvid: materialvid,
prefix: 'vbfree'
};
let Cfgcodeflag = await vfreeBeforeEvent.call(this, props, constance);
this.props.cardTable.setEditableByIndex(card_body_detail, index, 'cbffileid', Cfgcodeflag);
}
return flag;
}

View File

@ -0,0 +1,111 @@
import { Field,Field_sum, ReqPickmCardInfo,bodyfixAssts } from '../../constance';
const { card_head,card_body_sum } = ReqPickmCardInfo;
/**
* 备料申请卡片汇总表体编辑前事件
* @author maqna
*/
export default async function bodyBeforeEvent (props, moduleId, key, value,index,record) {
let _this = this;
let flag = true;
let constance = {};
let pk_group = props.form.getFormItemsValue(card_head, Field.pk_group).value;
let pk_org = props.form.getFormItemsValue(card_head, Field.pk_org).value;
let meta = this.props.meta.getMeta();
if(key == Field_sum.csupplyorgvid ){//供应组织
meta[card_body_sum].items.map((item) => {
if(item.attrcode == Field_sum.csupplyorgvid){
props.cardTable.setQueryCondition(moduleId, {
[item.attrcode]: () => {
let cmaterialvid =props.cardTable.getValByKeyAndIndex(card_body_sum, index, Field_sum.cmaterialvid).value;
return {
pk_org: pk_org,//主组织
cmaterialvid: cmaterialvid,
GridRefActionExt: 'nccloud.web.mmpac.reqpickm.ref.SupplyOrgSqlBuilder'
};
}
});
}
});
}else if(key == Field_sum.cinstockid){//供应仓库根据供应组织过滤
let supplyorgid = props.cardTable.getValByKeyAndIndex(card_body_sum, index, 'csupplyorgid').value;
if(!supplyorgid){//供应组织为空,供应仓库不可编辑
flag=false;
}else{
meta[card_body_sum].items.map((item) => {
if(item.attrcode == Field_sum.cinstockid){
props.cardTable.setQueryCondition(moduleId, {
[item.attrcode]: () => {
return {
pk_org:supplyorgid,
GridRefActionExt: 'nccloud.web.mmpac.reqpickm.ref.OutStockRefFilter'
};
}
});
}
});
}
}else if(key == Field_sum.nstockastnum||key == Field_sum.nstocknum){//备料辅数量
//累计待转主数量+累计入库主数量>0,大于0不可编辑
let naccpendingnum =props.cardTable.getValByKeyAndIndex(card_body_sum, index, Field_sum.naccpendingnum).value;
let naccstockoutnum =props.cardTable.getValByKeyAndIndex(card_body_sum, index, Field_sum.naccstockoutnum).value;
if(isNull(naccpendingnum)){
naccpendingnum=0;
}
if(isNull(naccstockoutnum)){
naccstockoutnum=0;
}
let attr = Number(naccpendingnum) + Number(naccstockoutnum);
if(attr > 0){
flag = false;
}
}else if (key.startsWith('vfree')) {//自由辅助属性-不可编辑
//辅助属性
flag = false;
// let pk_org = props.form.getFormItemsValue(card_head, Field.pk_org).value;
// let materialvid = props.cardTable.getValByKeyAndIndex(card_body_sum, index, Field_sum.cmaterialvid).value;
// constance.key = key;
// constance.params = {
// key: key,
// pk_org: pk_org,
// cmaterialvid: materialvid,
// prefix:'vfree'
// };
// flag = await vfreeBeforeEvent.call(this,props, constance);
// if (flag) {
// marAsstUtils.resetItem.call(this, props, '', pageId, card_body_sum, key, record);
// }
}else if(bodyfixAssts.includes(key)){//物料的4个固定辅助属性-不可编辑
flag = false;
// marAsstUtils.resetItem.call(_this, props, '', pageId, card_body_sum, key, record);
// flag = true;
// let pk_org = props.form.getFormItemsValue(card_head, Field.pk_org).value;
// let materialvid = props.cardTable.getValByKeyAndIndex(card_body_sum, index, Field_sum.cmaterialvid).value;
// constance.key = key;
// constance.params = {
// key: key,
// pk_org: pk_org,
// cmaterialvid: materialvid
// };
// flag = await vfreeBeforeEvent.call(this,props, constance);
}else{
let item = meta[card_body_sum].items.find((item) => item.attrcode == key);
item.queryCondition = () => {
return {
pk_org: pk_org
};
}
}
return flag;
}
function isNull(value) {
if (value == undefined || value === '') {
return true;
}
return false;
}

View File

@ -0,0 +1,23 @@
import { Field } from '../../constance';
import { transtypeUtils } from '../../../../../mmpub/mmpub/pub/tool';
import vbillcodeBeforeEvent from './vbillcodeBeforeEvent';
/**
* 备料申请卡片表头编辑前事件
* @author maqna
*/
export default async function headBeforeEvent (props, moduleId, key, value,index,record) {
let flag = true;
if(key == Field.crequesttype){ //交易类型
//交易类型发布的节点,交易类型不可编辑
flag = transtypeUtils.beforeEdit.call(this, key, Field.crequesttype, Field.vrequesttypecode);
} else if(key == Field.vbillcode){
flag = await vbillcodeBeforeEvent.call(this, props, moduleId, key, value, index);
} else if(key == Field.vrequesttypecode){
flag=false;
}
return flag;
}

View File

@ -0,0 +1,19 @@
import {ReqPickmCardInfo } from '../../constance';
const {card_head,card_body_detail,card_body_sum} = ReqPickmCardInfo;
import bodyDetailBeforeEvent from './bodyDetailBeforeEvent';
import bodySumBeforeEvent from './bodySumBeforeEvent';
import headBeforeEvent from './headBeforeEvent';
const beforeEvent = function(props, moduleId, key, value, index, record){
if(moduleId == card_head){
return headBeforeEvent.call(this,props, moduleId, key, value,index,record);
}else if(moduleId == card_body_detail){
return bodyDetailBeforeEvent.call(this,props, moduleId, key, value,index,record);
}else if(moduleId == card_body_sum){
return bodySumBeforeEvent.call(this,props, moduleId, key, value,index,record);
}
}
export {
beforeEvent
}

View File

@ -0,0 +1,52 @@
/*
* @Author: zhangchangqing
* @PageInfo: 表头编辑前事件 单据号编辑前事件这类方法必须有返回值返回true为可编辑false为不可编辑
* @Date: 2018-05-03 14:54:12
* @Last Modified by: mikey.zhangchqf
* @Last Modified time: 2018-07-27 01:18:14
*/
import { ajax, base, toast } from 'nc-lightapp-front';
import { Field, ReqPickmCardInfo, billType, URL } from '../../constance';
let formId = ReqPickmCardInfo.card_head;
export default function beforeEvent(props, moduleId, key, value, data) {
return new Promise(function(resolve, reject) {
let pk_org = props.form.getFormItemsValue(formId, Field.pk_org);
if (!pk_org || !pk_org.value) {
resolve(false);
} else {
let data = {
key: key,
params: {
pk_org: pk_org.value,
billtype: billType
}
};
ajax({
url: URL.headBeforeEdit,
data: data,
success: (res) => {
if (res.data) {
let isedit = res.data.isedit;
if (isedit) {
resolve(isedit);
} else if (res.data.message) {
toast({
color: 'warning',
content: res.data.message
});
}
resolve(false);
}
},
error: (error) => {
toast({
color: 'warning',
content: error.message
});
resolve(false);
}
});
}
});
}

View File

@ -0,0 +1,41 @@
import { ajax, toast } from 'nc-lightapp-front';
import { URL} from '../../constance';
export default function beforeEvent(props, moduleId, key, matetil, castunitid) {
return new Promise(function(resolve, reject) {
//debugger;
let data = {
key: key,
params: {
cmaterialvid: matetil,
castunitid: castunitid
}
};
ajax({
url: URL.bodyDetailBeforeEdit,
data: data,
success: (res) => {
//debugger;
if (res.data) {
let isedit = res.data.isedit;
if (isedit) {
resolve(isedit);
} else if (res.data.message) {
toast({
color: 'warning',
content: res.data.message
});
}
resolve(false);
}
},
error: (error) => {
toast({
color: 'warning',
content: error.message
});
resolve(false);
}
});
});
}

View File

@ -0,0 +1,48 @@
/**
* 物料自由辅助属性编辑前处理需要物料的固定辅助属性库存状态启用
* 这类方法必须有返回值返回true为可编辑false为不可编辑
*/
import { ajax, toast } from 'nc-lightapp-front';
import { URL } from '../../constance';
export default function(props, constance) {
return new Promise(function(resolve, reject) {
let pk_org = constance && constance.params && constance.params.pk_org;
let materialvid = constance && constance.params && constance.params.cmaterialvid;
if (pk_org != null && materialvid != null) {
let data = {
key: constance.key,
params: constance.params
};
ajax({
url: URL.bodyDetailBeforeEdit,
data: data,
success: (res) => {
if (res.data) {
let isedit = res.data.isedit;
if (isedit) {
resolve(isedit);
} else {
if (res.data.message) {
toast({
color: 'warning',
content: res.data.message
});
}
resolve(false);
}
}
},
error: (error) => {
toast({
color: 'warning',
content: error.message
});
resolve(false);
}
});
} else {
resolve(false);
}
});
}

View File

@ -0,0 +1,55 @@
import { toast } from 'nc-lightapp-front';
import { Field, ReqPickmCardInfo} from '../../constance'
let { pageId,card_head, card_body_detail,card_body_sum} = ReqPickmCardInfo;
import PickmTable from '../../pickm'
import {getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
//所有的表体区域id
let bodyids = [ card_body_detail,card_body_sum];
export default async function buttonClick(props) {
let pk = props.form.getFormItemsValue(card_head,Field.pk_org).value;
if( pk == undefined || pk == ''){
toast({
color: 'danger',
content: getLangByResId(this, '5008ReqPickm-0000032') /* 国际化处理: 表头工厂为空,不可进行计算!*/
});
return;
}
//过滤明细表体空行
//props.cardTable.filterEmptyRows(card_body_detail, ['cmaterialvid'], 'include');
//将明细表体的数据删除
//props.cardTable.selectAllRows(card_body_detail,true);
//let detail_rows = props.cardTable.getCheckedRows(card_body_detail);
//let rowparam = [];
//if(detail_rows && detail_rows.length > 0){
// detail_rows.forEach( (item) => {
// rowparam.push(item.index)
// });
// props.cardTable.delRowsByIndex(card_body_detail,rowparam);//删除原有的明细表数据
//}
//props.cardTable.selectAllRows(card_body_detail,false);
let billvo = props.createExtCardDataSimple(
pageId,card_head,bodyids
);
billvo.bodys.card_body_detail.rows=[];
let getPickmCache = value => {
this.pickmCache = value;
};
this.pickmCache.billvo = billvo;
this.props.modal.show('PickmDlg',{
//size: 'xlg',
title: getLangByResId(this, '5008ReqPickm-0000040') /* 国际化处理: 计算参数*/,
userControl: true, //点 确定/取消 按钮后,是否自动关闭弹框.true:手动关。false:自动关,默认false
content: <PickmTable pickmCache={this.pickmCache} getPickmCache={getPickmCache} billType="55AC" props={this.props} />,
className: 'reqpickmModal-query',
closeModalEve: close.bind(this),
hideRightBtn: true,
hideLeftBtn: true
});
}
function close() {
this.props.modal.close('PickmDlg');
}

View File

@ -0,0 +1,16 @@
export default function getUrlParam(parm) {
//获取父地址中的参数
let appUrl = decodeURIComponent(window.parent.location.href).split('?');
if (appUrl && appUrl[1]){
    let appPrams = appUrl[1].split('&');
    if(appPrams && appPrams instanceof Array){
let parmObj={};
appPrams.forEach(item=>{
let key = item.split('=')[0];
let value = item.split('=')[1];
parmObj[key] = value;
})
return parmObj[parm];
    }
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,571 @@
import { ajax, toast, cardCache, cacheTools } from 'nc-lightapp-front';
import { URL, TransferInfo, STATUS, Field_detail, ReqPickmCache, ReqPickmCardInfo, CardButton, CardButton_body_detail, ListButton, Field, sagasField } from '../../constance'
let { pageId, card_head, card_body_detail, card_body_sum, headAction, bodyAction_detail, bodyAction_sum, pk_head } = ReqPickmCardInfo;
import {showSuccessInfo,showErrorInfo} from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
let { getDefData, updateCache, getNextId, deleteCacheById, getCacheById } = cardCache;
import { buttonController } from '../viewController';
import getParentURlParme from './getParentURlParme';
import orgChangeEvent from '../afterEvent/orgChangeEvent';
import {getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
const pageInfoClick = function (props, pk, refresh) {
//debugger;
let _this = this;
//控制明细表体收起或展开
//detail_OpenOrClose.call(this);
//推单标识
let channelType = _this.props.getUrlParam(TransferInfo.channelType);
if (channelType) {
arrange(_this, channelType);
} else {
let param = getParentURlParme('pageMsgType'); //用来判断是否是从审批中心进入该页面
let status = _this.props.getUrlParam('status');
if (!status) {
status = STATUS.browse;
}
if (status == STATUS.browse) {//浏览
if (pk) {
this.props.setUrlParam(pk); //动态修改地址栏中的id的值(路径中一定要是id否则会导致切换下一条的时候pk取不到)
}
//非新增页面获取对应数据
pk = this.props.getUrlParam('id');
if (pk == undefined) {
commonShow.call(this, pk);
} else {
let data = { creqpickmid: pk, pageid: pageId };
if (data.creqpickmid === 'undefined') {
this.setState({
vbillcode: '',
billId: ''
});
return;
}
if (param || this.MMPAC_REQPICKM_TYPE == 'Y') {
buttonController.setCardPaginationVisible(this.props, false); //设置翻页不显示
} else {
buttonController.setCardPaginationVisible(this.props, true); //设置翻页显示
}
//查看缓存,如果存在缓存则不需要重新查询数据
let cardData = getCacheById(pk, ReqPickmCache.dataSource);
if (cardData && !refresh) {
if (cardData.head) {
this.props.form.setAllFormValue({ [card_head]: cardData.head[card_head] });
}
let cards = cardData.bodys;
if(!cards){
cards = cardData.body //推单过来保存的时候存的是body
}
//备料申请明细页签
if (cards && cards[card_body_detail]) {
let detail_rows = cards[card_body_detail].rows;
let detail_nrows = [];
detail_rows.forEach((item, index) => {
item.rowId = null;
item.rowid = null;
item.key = null;
let sta = item.status;
if (sta != 2) {//过滤掉新增的数据
detail_nrows.push(item);
}
})
detail_nrows.forEach((item, index) => {
item.rowId = null;
item.rowid = null;
item.key = null;
let sta = item.status;
if (sta == 3) {
item.status = '0';
}
});
cards[card_body_detail].rows = detail_nrows;
this.props.cardTable.setTableData(
card_body_detail,
cards[card_body_detail],
null,
true,
true
);
} else {
this.props.cardTable.setTableData(card_body_detail, { rows: [] });
}
//备料申请汇总页签
if (cards && cards[card_body_sum]) {
cards[card_body_sum].rows.map((item, index) => {
item.rowId = null;
item.rowid = null;
item.key = null;
let sta = item.status;
if (sta == 3) {
item.status = '0';
}
});
this.props.cardTable.setTableData(
card_body_sum,
cards[card_body_sum],
null,
true,
true
);
} else {
this.props.cardTable.setTableData(card_body_sum, { rows: [] });
}
//设置按钮显示
let fbillstatus = this.props.form.getFormItemsValue(card_head, Field.fbillstatus);
let vbillcode = this.props.form.getFormItemsValue(card_head, Field.vbillcode);
let billId = this.props.form.getFormItemsValue(card_head, Field.creqpickmid);
//如果取缓存数据,需要将控制行按钮显示的数组重置
this.setState(
{
lineShowType: [],
lineShowType_s: [],
vbillcode: vbillcode.value,
billId: billId.value
},
() => {
setBtnShow(_this, fbillstatus.value);
buttonController.setBackButtonVisiable.call(this, this.props, param);
//buttonController.lineSelected.call(this,this.props);
});
//sagas从此从列表进入卡片saga提示信息
let sagaStatus = this.props.form.getFormItemsValue(card_head, sagasField.SAGA_STATUS);
let frozen = sagaStatus && sagaStatus.value == '1' ? true : false;
if (frozen) {
let billpk = this.props.form.getFormItemsValue(card_head, Field.creqpickmid).value;
let gtxid = this.props.form.getFormItemsValue(card_head, sagasField.SAGA_GTXID).value;
this.props.socket.showToast({
gtxid: gtxid,
billpk: billpk
});
}
} else {
let conditionData = {
pks: [pk],
pageid: pageId,
status: this.props.getUrlParam(STATUS.status)
};
ajax({
url: URL.queryCard,
data: conditionData,
method: 'POST',
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
this.props.dealFormulamsg(res.formulamsg);
}
if (conditionData === undefined) {
//订单编号
this.setState({
vbillcode: '',
billId: ''
});
return;
}
if (res.data) {
let data = res.data;
if (data.head) {
this.props.form.setAllFormValue({ [card_head]: data.head[card_head] });
_this.setState({
lineShowType: [],
lineShowType_s: [],
vbillcode: res.data.head[card_head].rows[0].values.vbillcode.value,
billId: res.data.head[card_head].rows[0].values.creqpickmid.value,
billtype: res.data.head[card_head].rows[0].values.crequesttype.value
});
let fbillstatus = res.data.head[card_head].rows[0].values.fbillstatus.value;
if (param) {
this.toggleShow();
} else {
setBtnShow(_this, fbillstatus);
buttonController.setBackButtonVisiable.call(this, this.props, param);
//buttonController.lineSelected.call(this,this.props);
}
}
let pkid = res.data.head[card_head].rows[0].values.creqpickmid.value;
updateCache(
Field.creqpickmid,
pkid,
res.data,
card_head,
ReqPickmCache.dataSource
);
if (data.bodys) {
if (data.bodys[card_body_detail]) {
//解决NCCLOUD-94561表体分页时点击翻页
this.props.cardTable.setTableData(
card_body_detail,
data.bodys[card_body_detail],
null,
true,
true
);
}
if (data.bodys[card_body_sum]) {
//解决NCCLOUD-94561表体分页时点击翻页
this.props.cardTable.setTableData(
card_body_sum,
data.bodys[card_body_sum],
null,
true,
true
);
}
}
buttonController.setUIState.call(this, this.props, STATUS.browse);
//sagas从此从列表进入卡片saga提示信息
let sagaStatus = this.props.form.getFormItemsValue(card_head, sagasField.SAGA_STATUS);
let frozen = sagaStatus && sagaStatus.value == '1' ? true : false;
if (frozen) {
let billpk = this.props.form.getFormItemsValue(card_head, Field.creqpickmid).value;
let gtxid = this.props.form.getFormItemsValue(card_head, sagasField.SAGA_GTXID).value;
this.props.socket.showToast({
gtxid: gtxid,
billpk: billpk
});
}
if (refresh) {
showSuccessInfo(getLangByResId(_this, '5008ReqPickmPUBMESSAGE-000017'))/* 国际化处理: 刷新成功!*/
}
} else {
if (refresh) {
showErrorInfo(getLangByResId(_this, '5008ReqPickm-0000018')); /* 国际化处理: 刷新失败!*/
}
}
},
error: (res) => {
showErrorInfo(res.message);
commonShow.call(this, pk);
}
});
}
}
} else if (status == STATUS.edit) {//修改
let conditionData = {
pks: [this.props.getUrlParam('id')],
pageid: pageId,
status: this.props.getUrlParam(STATUS.status)
};
ajax({
url: URL.editReqPickmCardURL,
data: conditionData,
method: 'POST',
success: (res) => {
buttonController.setCardPaginationVisible(this.props, false); //设置翻页不显示
//buttonController.setBackButtonVisiable.call(this, this.props, param);//设置返回按钮不显示
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
this.props.dealFormulamsg(res.formulamsg);
}
if (conditionData === undefined) {
//订单编号
this.setState({
vbillcode: '',
billId: ''
});
return;
}
let data = res.data;
if (data.head) {
this.props.form.setAllFormValue({ [card_head]: data.head[card_head] });
_this.setState({
vbillcode: res.data.head[card_head].rows[0].values.vbillcode.value,
billId: res.data.head[card_head].rows[0].values.creqpickmid.value
});
}
if (data.bodys) {
if (data.bodys[card_body_detail]) {
this.props.cardTable.setTableData(
card_body_detail,
data.bodys[card_body_detail],
null,
true,
true
);
}
if (data.bodys[card_body_sum]) {
this.props.cardTable.setTableData(
card_body_sum,
data.bodys[card_body_sum],
null,
true,
true
);
}
}
//修改组织的可编辑状态
this.props.form.setFormItemsDisabled(card_head, { [Field.pk_org]: true,[Field.pk_org_v]: true });
this.toggleShow();
}
})
} else {
//新增,分为复制新增和自制
let copy = this.props.getUrlParam('copy');
let comeType = this.props.getUrlParam('comeType'); //判断是否是从浏览页面点击按钮的新增
let copyType = this.props.getUrlParam('copyType'); //判断是否是从浏览页面点击按钮的复制
//复制
if (copy != undefined && copy) {
//从列表页复制的单据处理
let conditionData = {
pks: [this.props.getUrlParam('id')],
pageid: pageId,
status: this.props.getUrlParam(STATUS.status)
};
this.setState({
copy_billId: this.props.getUrlParam('id'),
vbillcode: '',
billId: ''
});
if (conditionData.pks == 'undefined') {
this.props.form.EmptyAllFormValue(card_head);
this.props.cardTable.setTableData(card_body_detail, { rows: [] });
this.props.cardTable.setTableData(card_body_sum, { rows: [] });
return;
}
//从卡片页点击复制按钮-将汇总表体
if (copyType != undefined && copyType) {
this.props.cardTable.setTableData(card_body_sum, { rows: [] });
}
ajax({
url: URL.copyURL,
data: conditionData,
method: 'POST',
success: (res) => {
if (conditionData === undefined) {
//订单编号
this.setState({
vbillcode: '',
billId: ''
});
return;
}
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
this.props.dealFormulamsg(res.formulamsg);
}
let data = res.data;
if (data.head) {
this.props.form.setAllFormValue({ [card_head]: data.head[card_head] });
}
if (data.bodys) {
if (data.bodys[card_body_detail]) {
this.props.cardTable.setTableData(
card_body_detail,
data.bodys[card_body_detail],
null,
true,
true
);
}
if (data.bodys[card_body_sum]) {
this.props.cardTable.setTableData(
card_body_sum,
data.bodys[card_body_sum],
null,
true,
true
);
}
buttonController.setUIState.call(this, this.props, STATUS.edit);
//修改组织的可编辑状态 不可编辑
this.props.resMetaAfterPkorgEdit();
this.props.form.setFormItemsDisabled(card_head, { [Field.pk_org]: true , [Field.pk_org_v]: true });
this.toggleShow();
}
},
error: (res) => {
showErrorInfo(res.message);
commonShow.call(this, pk);
this.props.resMetaAfterPkorgEdit(); //恢复主组织编辑性
}
});
}
//从浏览态点击新增
else if (comeType != undefined && comeType) {
this.props.form.EmptyAllFormValue(card_head);
this.props.cardTable.setTableData(card_body_detail, { rows: [] });
this.props.cardTable.setTableData(card_body_sum, { rows: [] });
//订单编号
this.setState({
vbillcode: '',
billId: ''
});
buttonController.setUIState.call(this, this.props, STATUS.add);
let pk_org = getDefData(Field.pk_org, ReqPickmCache.dataSource);
let org_Name = getDefData('pk_org_name', ReqPickmCache.dataSource);
if (pk_org) {
orgChangeEvent.call(
this,
this.props,
card_head,
Field.pk_org,
{ value: pk_org, display: org_Name },
null,
0,
{
refpk: pk_org,
refname: org_Name
}
);
this.props.form.setFormItemsDisabled(card_head, { pk_org: false ,pk_org_v: false});
} else {
//订单编号
this.setState({
copy_billId: this.props.getUrlParam('id')
});
this.props.cardTable.setTableData(card_body_detail, { rows: [] });
this.props.cardTable.setTableData(card_body_sum, { rows: [] });
//获取表体行数量
let rows_detail = this.props.cardTable.getNumberOfRows(card_body_detail);
let rows_sum = this.props.cardTable.getNumberOfRows(card_body_sum);
//删除表体行数
for (let ii = 0; ii < rows_detail; ii++) {
this.props.cardTable.delRowsByIndex(card_body_detail, 0);
}
for (let ii = 0; ii < rows_sum; ii++) {
this.props.cardTable.delRowsByIndex(card_body_sum, 0);
}
this.props.form.setFormItemsValue(card_head, {
[Field.pk_org]: { value: null, display: null },
[Field.pk_org_v]: { value: null, display: null }
});
//如果无主组织,则设置其它字段的不可编辑性
this.props.initMetaByPkorg(Field.pk_org_v);
}
//修改组织的可编辑状态
this.props.form.setFormItemsDisabled(card_head, { [Field.pk_org]: false,[Field.pk_org_v]: false });
this.toggleShow();
}
//从列表态点击新增
else {
//修改组织的可编辑状态
this.props.form.setFormItemsDisabled(card_head, { [Field.pk_org]: false,[Field.pk_org_v]: false });
this.toggleShow();
}
}
}
}
function arrange(_this, channelType) {
let hids;
let bids;
let url;
let srctype = _this.props.getUrlParam('type');//来源单据类型
if (channelType == TransferInfo.pickmarrange) {
hids = cacheTools.get('pickmToReqpcikmBIds'); //备料计划
url = TransferInfo.pickmtoReqPickmbillURL;
} else if (channelType == TransferInfo.putplanarrange) {
hids = cacheTools.get('putplanToReqpcikmHIds'); //投放计划表头
bids = cacheTools.get('putplanToReqpcikmBIds'); //投放计划表体
url = TransferInfo.putplantoReqPickmbillURL;
}
//let url = _this.props.getUrlParam('channelAddress');
// _this.setState({
// returnURL: '/' + url,
// appcode: appcode,
// returnType: ''
// });
if (hids) {
let data = {
pks: hids,
bids: bids,
pagecode: pageId,
channelType: channelType,
vsrctype: srctype
};
ajax({
method: 'POST',
url: url,
data: data,
success: (res) => {
_this.props.beforeUpdatePage();
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
_this.props.dealFormulamsg(res.formulamsg);
}
if (res.data) {
let array = new Array();
res.data.map((o) => {
let datass = {};
datass.head = o.head;
o.bodys[card_body_sum] = { areacode: 'card_body_sum', rows: [] }
datass.body = o.bodys;
datass.pageid = o.pageid;
array.push(datass);
});
_this.props.transferTable.setTransferListValue(TransferInfo.leftarea, array);
_this.props.form.setFormStatus(card_head, STATUS.edit);
_this.props.cardTable.setStatus(card_body_detail, STATUS.edit);
_this.props.cardTable.setStatus(card_body_sum, STATUS.edit);
}
_this.props.updatePage(card_head, [card_body_detail, card_body_sum]);
}
});
} else {
_this.props.transferTable.setTransferListValue(TransferInfo.leftarea, []);
}
}
function setBtnShow(_this, fbillstatus) {
//推单标识
let channelType = _this.props.getUrlParam(TransferInfo.channelType);
if (channelType) {
_this.props.button.setButtonVisible([CardButton.QuitTransferBill], true);
buttonController.setUIState.call(_this, _this.props, STATUS.browse);
buttonController.toggleShowTransfer.call(_this, _this.props, STATUS.browse);
} else {
// 转单的按钮-->退出转单
_this.props.button.setButtonVisible([CardButton.QuitTransferBill], false);
buttonController.setUIState.call(_this, _this.props, STATUS.browse);
buttonController.setCardButtonVisiable.call(_this, _this.props, STATUS.browse);
}
}
//空白页面控制使用 状态为浏览态 只显示返回按钮,新增按钮
function commonShow(pk) {
this.setState({
vbillcode: '',
copy_billId: ''
});
let showBackBtn = true;
//从复制的新增应用进入
if (this.MMPAC_REQPICKM_TYPE == 'Y') {
showBackBtn = false;
}
this.props.BillHeadInfo.setBillHeadInfoVisible({
showBackBtn: showBackBtn, //控制显示返回按钮: true为显示,false为隐藏 ---非必传
showBillCode: false, //控制显示单据号true为显示,false为隐藏 ---非必传
billCode: this.state.vbillcode //修改单据号---非必传
});
//buttonController.lineSelected.call(this,this.props);
buttonController.setUIState.call(this, this.props, STATUS.browse);
this.props.form.EmptyAllFormValue(card_head);
this.props.cardTable.setTableData(card_body_detail, { rows: [] });
//设置明细表体默认收起
//this.props.cardTable.toggleCardTable(card_body_detail, false);//控制收起展开
this.props.cardTable.setTableData(card_body_sum, { rows: [] });
buttonController.setCardPaginationVisible(this.props, false); //设置翻页不显示
buttonController.setBlankPageButtons.call(this);
}
//控制明细表体的收起展开
function detail_OpenOrClose() {
let status = this.props.getUrlParam('status');
//推单标识
let channelType = this.props.getUrlParam(TransferInfo.channelType);
//如果是拉单或者推单页面进入 ,则显示退出转单按钮
if (channelType) {
status = this.indexstatus[this.curindex];
}
if (status == STATUS.browse) {//浏览态默认收起
//设置明细表体默认收起
this.props.cardTable.toggleCardTable(card_body_detail, false);//控制收起
} else {
this.props.cardTable.toggleCardTable(card_body_detail, true);//控制展开
}
}
export {
pageInfoClick,
setBtnShow,
detail_OpenOrClose,
commonShow
}

View File

@ -0,0 +1,9 @@
import {pageInfoClick} from './pageInfoClick';
const pageInfoClickPage = function(props, pk, refresh) {
pageInfoClick.call(this,props,pk);
}
export {
pageInfoClickPage
}

View File

@ -0,0 +1,489 @@
//主子表卡片
import React, { Component } from 'react';
import { createPage, base, high, cardCache } from 'nc-lightapp-front';
const { BillTrack } = high;
import NCUploader from 'uap/common/components/NCUploader'
const { NCAffix, NCDiv } = base;
const { getCurrentLastId } = cardCache;
import { URL, STATUS, billType, ReqPickmCache, ReqPickmCardInfo, CardButton, Field, Field_detail, TransferInfo } from '../constance';
import initTemplate from './init/initTemplate';
import { RownoUtils } from '../../../../mmpub/mmpub/pub/tool/cardTableTools';
import { buttonClick } from './btnClicks';
import { pageInfoClickPage } from './btnClicks/pageInfoClickPage'
import { afterEvent } from './afterEvent';
import { bodyDetailBatchEvent } from './batchEvents';
import { beforeEvent } from './beforeEvent';
import { buttonController } from './viewController';
import { setRowDefaultValue } from './btnClicks';
import { initLang, getLangByResId } from '../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import inputChange from '../../../../mmpub/mmpub/pub/tool/rownoInputUtil';
const { pageId, card_head, card_tail, card_body_detail, card_body_sum, headAction, bodyAction_detail, bodyAction_sum, pk_head, pk_body_detail, pk_body_sum } = ReqPickmCardInfo;
class ReqpickmCard extends Component {
constructor(props) {
super(props);
props.use.form(card_head);
props.use.cardTable(card_body_detail, card_body_sum);
this.curindex = 0;
this.state = {
backVisible: true,
hideAdd: false,
hideDel: false,
copyRowDatas: null, //复制行数据
showTrack: false, //单据追溯
show: false, //审批详情
lineShowType: [], //通过数组的方式控制 列按钮显示 1-收起 0-展开
lineShowType_s: [], //通过数组的方式控制 列按钮显示 1-收起 0-展开,汇总页签
target: null, //附件管理弹出框目标位置
showUploader: false, //是否显示附件管理弹出框
refreshFlag: 0,
editable: false, //页面是否可以编辑
status: STATUS.browse, // 页面标志,默认浏览态
vbillcode: '',
creqpickmid: '',
//listdata: '', //转单后编辑数据缓存
currentindex: 0, //转单后编辑数据缓存
returnURL: null, //推单
appcode: null, //推单
returnType: null, //推单
pickm_hid: null,//推单
};
this.indexstatus = {};//推单,多单编辑状态索引
//备料计划缓存
this.pickmCache = {
pickmVO: null,
pickmTempVO: null,
billvo: null
};
this.MMPAC_REQPICKM_TYPE = 'N'; //判断是否是从新增小应用过来的
initLang(this, ['5008ReqPickm'], 'mmpac', initTemplate.bind(this, this.props));
}
// componentDidMount() {}
componentWillMount() {
//关闭浏览器
window.onbeforeunload = () => {
let statusd = this.props.cardTable.getStatus(card_body_detail);
let statuss = this.props.cardTable.getStatus(card_body_sum);
let statush = this.props.form.getFormStatus(card_head);
if (statusd == STATUS.edit || statuss == STATUS.edit || statush == STATUS.edit) {
return getLangByResId(this, '5008ReqPickm-000007');/* 当前单据未保存,您确认离开此页面?*/
}
}
}
//切换页面状态
toggleShow = () => {
//debugger;
let status = this.props.getUrlParam('status');
//推单标识
let channelType = this.props.getUrlParam(TransferInfo.channelType);
//如果是拉单或者推单页面进入 ,则显示退出转单按钮
if (channelType) {
status = this.indexstatus[this.curindex];
this.props.button.setButtonVisible([CardButton.QuitTransferBill], true);
this.props.BillHeadInfo.setBillHeadInfoVisible({
showBackBtn: true, //控制显示返回按钮: true为显示,false为隐藏 ---非必传
showBillCode: true, //控制显示单据号true为显示,false为隐藏 ---非必传
billCode: this.props.form.getFormItemsValue(ReqPickmCardInfo.card_head, Field.vbillcode).value //修改单据号
});
if (!status) {
status = 'add';
}
buttonController.setUIState.call(this, this.props, status);
buttonController.toggleShowTransfer.call(this, this.props, status);
} else {
this.props.button.setButtonVisible([CardButton.QuitTransferBill], false);
buttonController.setBackButtonVisiable.call(this, this.props);
if (!status) {
status = 'add';
}
buttonController.setUIState.call(this, this.props, status);
buttonController.setCardButtonVisiable.call(this, this.props, status);
}
};
// 附件管理关闭
onHideUploader = () => {
this.setState({
showUploader: false
});
};
//备料申请明细页签
getDetailBodyBtn = () => {
return (
<div className="table-head-btns">
{
this.props.button.createButtonApp({
area: bodyAction_detail,
onButtonClick: buttonClick.bind(this)
})
}
</div>
);
}
//备料申请汇总页签
getSumBodyBtn = () => {
return (
<div className="table-head-btns">
{
this.props.button.createButtonApp({
area: bodyAction_sum,
onButtonClick: buttonClick.bind(this)
})
}
</div>
);
}
cancelSureEvent() {
if (this.props.getUrlParam('status') === STATUS.add) {
let pk = getCurrentLastId(ReqPickmCache.dataSource);
this.getDataForCache(pk, () => {
//编辑态取消时,修正一下页面状态
this.props.pushTo('/card', {
status: STATUS.browse,
id: this.props.getUrlParam('id')
})
this.props.form.setFormStatus(card_head, STATUS.browse)
this.props.cardTable.setStatus(card_body_detail, STATUS.browse)
})
}
this.setState({
backVisible: true
})
}
getDataForCache(pk, callback) {
if (!pk) {
this.props.pushTo('/list', {})
return
}
if (callback && typeof callback == 'function') {
callback.call(this)
}
}
//侧拉展开中的删行
delLineForCardEdit = () => {
buttonController.lineSelected.bind(this)
};
//执行增行之前的判断:返回true就是可增行返回false就是不可
delLineForCardEditBefore = (props, moduleId, modelIndex, record) => {
return buttonController.modelRowEditBefore.call(this, props, moduleId, modelIndex, record);
}
//执行增行之前的判断
addLineForCardEditBefore = (props, moduleId, modelIndex, record) => {
return buttonController.modelRowEditBefore.call(this, props, moduleId, modelIndex, record);
}
//侧拉展开中的增行
addLineForCardEdit = (props, moduleId, modelIndex) => {
props.cardTable.setValByKeysAndIndex(
card_body_detail,
modelIndex + 1,
setRowDefaultValue.call(this, props)
);
RownoUtils.setRowNo(props, card_body_detail, 'vrowno');
};
//获取缓存
getDatasource = (transfer, channelType) => {
if (transfer) {
return;
} else {
if (channelType == TransferInfo.pickmarrange) {
return TransferInfo.channelTypeDataSource1;
}
}
}
//点击转单缩略图的钩子函数
onTransferSelect = (record, status, index, formStatus) => {
this.curindex = parseInt(index);
this.setState({
index: index
});
let isEdit = status ? 'browse' : 'edit';
if (this.indexstatus[index]) {
if (this.indexstatus[index] == 'browse') {
isEdit = 'browse';
} else if (this.indexstatus[index] == 'edit') {
isEdit = 'edit';
}
}
this.indexstatus[index] = isEdit;
this.props.beforeUpdatePage();
let head = record && record.head && record.head[card_head];
this.props.form.setAllFormValue({ [card_head]: head });
let card_detail = record && record.body && record.body[card_body_detail];
card_detail = card_detail != null ? card_detail : { rows: [] };
// let card_sum = record && record.body && record.body[card_body_sum].rows;
// card_sum = card_sum != null ? card_sum : { rows: [] };
this.props.cardTable.setTableData(card_body_detail, card_detail, null, true, true);
this.props.cardTable.setTableData(card_body_sum, record.body[card_body_sum], null, true, true);
this.props.form.setFormItemsDisabled(card_head, { ['pk_org']: true, ['pk_org_v']: true });
let billstatus = record.head.card_head.rows[0].values.fbillstatus.value;
this.state.vbillcode = record.head.card_head.rows[0].values.vbillcode.value;
let billId = record.head.card_head.rows[0].values['creqpickmid'].value;
this.setState({ billstatus: billstatus, billId: billId, status: isEdit });
this.props.updatePage(card_head, [card_body_detail, card_body_sum]);
buttonController.setUIState.call(this, this.props, isEdit);
this.toggleShow();
}
render() {
let { cardTable, form, button, modal, cardPagination, transferTable, socket } = this.props;
const { createBillHeadInfo } = this.props.BillHeadInfo;
const { createCardPagination } = cardPagination;
const { createTransferList } = transferTable;
let { createForm } = form;
let { createCardTable } = cardTable;
let { createButtonApp } = button;
let { createModal } = modal;
let status = this.props.getUrlParam(STATUS.status);
//转单
let transfer = this.props.getUrlParam(TransferInfo.type);
let channelType = this.props.getUrlParam(TransferInfo.channelType);
let transferDatasource = this.getDatasource(transfer, channelType);
if (transfer || channelType) {
return (
<div id="transferCard" className="nc-bill-transferList">
<NCAffix>
<NCDiv areaCode={NCDiv.config.HEADER} className='nc-bill-header-area'>
<div className='header-title-search-area'>
{createBillHeadInfo({
title: this.props.getSearchParam('n'),//getLangByResId(this, '5008ReqPickm-000001'), //标题/* 国际化处理: 备料申请单*/
billCode: '', //单据号
backBtnClick: buttonClick.bind(this, this.props, CardButton.Back)
})}
</div>
<div className="header-button-area">
{/*sagas*/}
{button.createErrorFlag({
headBtnAreaCode: headAction
})}
{createButtonApp({
area: headAction,//按钮注册中的按钮区域
onButtonClick: buttonClick.bind(this)
})}
<BillTrack
show={this.state.showTrack}
close={() => {
this.setState({ showTrack: false });
}}
pk={this.state.creqpickmid}
type={billType}
/>
</div>
</NCDiv>
</NCAffix>
<div className="nc-bill-transferList-content">
{/* 转单 */}
{createTransferList({
headcode: card_head,
bodycode: [card_body_detail, card_body_sum],
dataSource: transferDatasource,
transferListId: TransferInfo.leftarea, //转单列表id
onTransferItemSelected: (record, status, index, formStatus) => {
this.onTransferSelect(record, status, index, formStatus);
},
//手工选择左侧卡片
onTransferItemClick: (record, index, status, formStatus) => {
// 如果编辑过,则弹框提示,让用户选择是否继续
this.onTransferSelect(record, index, status, formStatus);
}
})}
<div className="transferList-content-right nc-bill-extCard-2">
<div className="nc-bill-form-area">
{createForm(card_head, {
onBeforeEvent: beforeEvent.bind(this),
onAfterEvent: afterEvent.bind(this)
})}
</div>
<div className="nc-bill-table-area">
{createCardTable(card_body_detail, {
tableHead: this.getDetailBodyBtn.bind(this),
hideModelSave: true,//整单保存是否显示
modelDelRowBefore: this.delLineForCardEditBefore,
modelDelRow: this.delLineForCardEdit,//侧拉窗口中的删行
modelAddRowBefore: this.addLineForCardEditBefore,
modelAddRow: this.addLineForCardEdit,//侧拉窗口中的增行
onBeforeEvent: beforeEvent.bind(this),
onAfterEvent: afterEvent.bind(this),
showIndex: true,
showCheck: true,
adaptionHeight: false,
inputChange: inputChange.bind(this, Field_detail.vrowno),
onSelected: buttonController.lineSelected.bind(this),
onSelectedAll: buttonController.lineSelected.bind(this),
onBatchSelected: buttonController.lineSelected.bind(this),
onBatchChange: bodyDetailBatchEvent.bind(this),
})}
</div>
<div className="nc-bill-tableTab-area">
{createCardTable(card_body_sum, {
tableHead: this.getSumBodyBtn.bind(this),
showIndex: true,
showCheck: true,
hideModelSave: true,
hideDel: true,
hideAdd: true,
adaptionHeight: true,
onBeforeEvent: beforeEvent.bind(this),
onAfterEvent: afterEvent.bind(this),
inputChange: inputChange.bind(this, Field_detail.vrowno),
onSelected: buttonController.lineSelected4Sum.bind(this),
onSelectedAll: buttonController.lineSelected4Sum.bind(this),
onBatchSelected: buttonController.lineSelected4Sum.bind(this),
})}
</div>
{createModal('PickmDlg')}
{/* 附件管理 */}
<div>{this.state.showUploader
&& <NCUploader billId={this.state.creqpickmid} onHide={this.onHideUploader} />}
</div>
{createModal('orgChange')}
{createModal('ResumeMessageDlg', {
className: 'iframe-modal',
size: 'xlg'
})}
{createModal('delModal')}
{createModal('MessageDlg')}
</div>
</div>
</div>
);
} else {
return (
<div className='nc-bill-extCard-2'>
{socket.connectMesg({
headBtnAreaCode: headAction, // 表头按钮区域ID
formAreaCode: card_head, // 表头Form区域ID
billtype: billType,
billpkname: Field.creqpickmid,
dataSource: ReqPickmCache.dataSource
})}
<div className="nc-bill-top-area">
<NCAffix>
<NCDiv areaCode={NCDiv.config.HEADER} className='nc-bill-header-area'>
<div className='header-title-search-area'>
{createBillHeadInfo({
title: this.props.getSearchParam('n'),// getLangByResId(this, '5008ReqPickm-000001'), //标题/* 国际化处理: 备料申请单*/
billCode: '', //单据号
backBtnClick: buttonClick.bind(this, this.props, CardButton.Back)
})}
</div>
<div className="header-button-area">
{/*sagas*/}
{this.props.button.createErrorFlag({
headBtnAreaCode: headAction
})}
{createButtonApp({
area: headAction,//按钮注册中的按钮区域
onButtonClick: buttonClick.bind(this)
})}
{createCardPagination({
handlePageInfoChange: pageInfoClickPage.bind(this),
dataSource: ReqPickmCache.dataSource
})}
{/* 单据追溯 */}
<BillTrack
show={this.state.showTrack}
close={() => {
this.setState({ showTrack: false });
}}
pk={this.state.creqpickmid}
type={billType}
/>
</div>
</NCDiv>
</NCAffix>
<div className="nc-bill-form-area">
{createForm(card_head, {
onBeforeEvent: beforeEvent.bind(this),
onAfterEvent: afterEvent.bind(this)
})}
</div>
</div>
<div className="nc-bill-bottom-area">
<div className="nc-bill-table-area">
{createCardTable(card_body_detail, {
tableHead: this.getDetailBodyBtn.bind(this),
hideModelSave: true,//整单保存是否显示
modelDelRowBefore: this.delLineForCardEditBefore,
modelDelRow: this.delLineForCardEdit,//侧拉窗口中的删行
modelAddRowBefore: this.addLineForCardEditBefore,
modelAddRow: this.addLineForCardEdit,//侧拉窗口中的增行
onBeforeEvent: beforeEvent.bind(this),
onAfterEvent: afterEvent.bind(this),
showIndex: true,
showCheck: true,
adaptionHeight: false,
inputChange: inputChange.bind(this, Field_detail.vrowno),
onSelected: buttonController.lineSelected.bind(this),
onSelectedAll: buttonController.lineSelected.bind(this),
onBatchChange: bodyDetailBatchEvent.bind(this),
onBatchSelected: buttonController.lineSelected.bind(this),
//onHeadAngleToggle: this.headAngleToggle//表头左侧的收起展开小三角
// modelAddRow: () => {
// RownoUtils.setRowNo(this.props,card_body_detail,Field_detail.vrowno)
// }
})}
</div>
<div className="nc-bill-tableTab-area">
{createCardTable(card_body_sum, {
tableHead: this.getSumBodyBtn.bind(this),
showIndex: true,
showCheck: true,
hideModelSave: true,
hideDel: true,
hideAdd: true,
adaptionHeight: true,
onBeforeEvent: beforeEvent.bind(this),
onAfterEvent: afterEvent.bind(this),
inputChange: inputChange.bind(this, Field_detail.vrowno),
onSelected: buttonController.lineSelected4Sum.bind(this),
onSelectedAll: buttonController.lineSelected4Sum.bind(this),
onBatchSelected: buttonController.lineSelected4Sum.bind(this),
})}
</div>
{createModal('PickmDlg')}
</div>
{/* 附件管理 */}
<div>{this.state.showUploader
&& <NCUploader billId={this.state.creqpickmid} onHide={this.onHideUploader} />}
</div>
{createModal('orgChange')}
{createModal('ResumeMessageDlg', {
className: 'iframe-modal',
size: 'xlg'
})}
{createModal('delModal')}
{createModal('MessageDlg')}
</div>
)
}
}
}
ReqpickmCard = createPage({
// initTemplate: [],
// mutiLangCode: '5008ReqPickm',
billinfo: {
billtype: 'extcard', //一主多子
pagecode: pageId,
headcode: card_head,
bodycode: [card_body_detail, card_body_sum]
},
orderOfHotKey: [card_head, card_body_detail, card_body_sum]
})(ReqpickmCard);
export default ReqpickmCard

View File

@ -0,0 +1,2 @@
import initTemplate from './initTemplate';
export { initTemplate };

View File

@ -0,0 +1,354 @@
import { cardCache,pageTo } from 'nc-lightapp-front';
import { URL, STATUS, Field, Field_detail, ReqPickmCardInfo, ReqPickmCache } from '../../constance';
import { pageInfoClick } from '../btnClicks/pageInfoClick';
import orgChangeEvent from '../afterEvent/orgChangeEvent';
import { buttonController } from '../viewController';
import { buttonClick } from '../btnClicks';
import { transtypeUtils } from '../../../../../mmpub/mmpub/pub/tool';
import { getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import { columnSortUtils } from '../../../../../mmpub/mmpub/pub/tool/columnSortUtils';
let { openAppByBilltype } = pageTo;
let { setDefData } = cardCache;
const { pageId, card_head, card_body_detail, card_body_sum, headAction, bodyAction_detail, bodyAction_sum } = ReqPickmCardInfo;
export default function () {
let _this = this;
this.props.createUIDom(
{
pagecode: pageId //卡片界面的code
},
data => {
if (data) {
if (data.template) {
let meta = data.template;
//发布的交易类型判断参数
if (data.context.paramMap && data.context.paramMap.transtype) {
transtypeUtils.init.call(this, data.context);
}
modifierMeta.call(this, this.props, meta)
let status = this.props.getUrlParam('status');
if (!status) {
status = STATUS.browse;
}
//是否是从新增小应用过来的
if (data.context.paramMap && data.context.paramMap.MMPAC_REQPICKM_TYPE) {
this.MMPAC_REQPICKM_TYPE = data.context.paramMap.MMPAC_REQPICKM_TYPE;
status = STATUS.add;
this.props.setUrlParam({ status: STATUS.add });
}
if (status == STATUS.add) {
this.props.meta.setMeta(meta, toggleShow.bind(_this, data));
} else {
this.props.meta.setMeta(meta, addDataSource.bind(_this, data));
}
}
if (data.button) {
let button = data.button;
this.props.button.hideButtonsByAreas([headAction, bodyAction_detail, bodyAction_sum]);
this.props.button.setButtons(button);
pageInfoClick.call(this);
//buttonController.setCardButtonVisiable.call(this,this.props,this.props.getUrlParam(STATUS.status));
}
//判断生产模式1-流程2-离散
let appcode = _this.props.getAppCode();
if (appcode.startsWith('5008')) {
setDefData('fprodmode', ReqPickmCache.dataSource, parseInt(1));
} else if (appcode.startsWith('5009')) {
setDefData('fprodmode', ReqPickmCache.dataSource, parseInt(2));
}
}
}
)
}
function modifierMeta(props, meta) {
//模板参照过滤设置
let status = props.getUrlParam(STATUS.status);
meta[card_head].status = status;
meta[card_body_detail].status = status;
meta[card_body_sum].status = status;
//编辑前 参照过滤
meta[card_head].items.map((item) => {
if (item.attrcode == Field.pk_org) {
item.queryCondition = () => {
//主组织权限过滤
return { GridRefActionExt: 'nccloud.web.mmpub.pub.ref.AppPermissionOrgRefFilter' }
};
} else if (item.attrcode == Field.pk_org_v) {
item.queryCondition = () => {
//主组织权限过滤
return { GridRefActionExt: 'nccloud.web.mmpub.pub.ref.AppPermissionOrgVidRefFilter' }
};
} else if (item.attrcode == Field.crequesttype) {//根据单据类型过滤交易类型
item.queryCondition = () => {
return {
parentbilltype: '55AC'
};
};
} else if (item.attrcode == Field.fbillstatus) {
//设置单据状态不可编辑
props.form.setFormItemsDisabled(card_head, {
[Field.fbillstatus]: true
});
}
// else if(item.attrcode == Field.vbillcode){
// //设置单据号不可编辑
// props.form.setFormItemsDisabled(card_head,{
// [Field.vbillcode]: true
// });
// }
else {
//根据pk_org 过滤其他字段
item.queryCondition = () => {
let data = this.props.form.getFormItemsValue(card_head, Field.pk_org).value; // 调用相应组件的取值API
return { pk_org: data }; // 根据pk_org过滤
};
}
})
//侧拉编辑
// meta['body_detail_edit'].items.find((e) => e.attrcode === Field_detail.cmaterialvid).isMultiSelectedEnabled = true;
//备料申请明细表体参照过滤
meta[card_body_detail].items.map((item) => {
if (item.attrcode == Field_detail.cmaterialvid) {//物料设置可多选
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
let data = this.props.form.getFormItemsValue(card_head, Field.pk_org).value; // 调用相应组件的取值API
return {
pk_org: data,
matchmode: 2,
GridRefActionExt: URL.materialURL
};
};
} else if (item.attrcode == 'cbffileid') {
item.queryCondition = () => {
item.queryCondition = () => {
let cmaterialvid = this.props.form.getFormItemsValue(card_head, 'cmaterialvid').value;
let condition = {};
condition.cmaterialvid = cmaterialvid;
condition.pk_group=window.parent.GETBUSINESSINFO().groupId;
return condition;
};
};
}
item.queryCondition = () => {
let data = this.props.form.getFormItemsValue(card_head, Field.pk_org).value; // 调用相应组件的取值API
return { pk_org: data, matchmode: 2, }; // 根据pk_org过滤
};
/* if (item.attrcode.startsWith('vbdef')) {
item.queryCondition = () => {
let data = this.props.form.getFormItemsValue(card_head, Field.pk_org).value; // 调用相应组件的取值API
return { pk_org: data }; // 根据pk_org过滤
};
}
else {
//根据pk_org 过滤其他字段
item.queryCondition = () => {
let data = this.props.form.getFormItemsValue(card_head, Field.pk_org).value; // 调用相应组件的取值API
return { pk_org: data }; // 根据pk_org过滤
};
} */
})
meta['body_detail_edit'].items.map((item) => {
if (item.attrcode == Field_detail.cmaterialvid) {//物料设置可多选
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
let data = this.props.form.getFormItemsValue(card_head, Field.pk_org).value; // 调用相应组件的取值API
return {
pk_org: data,
GridRefActionExt: URL.materialURL
};
};
}
item.queryCondition = () => {
let data = this.props.form.getFormItemsValue(card_head, Field.pk_org).value; // 调用相应组件的取值API
return { pk_org: data }; // 根据pk_org过滤
};
/* if (item.attrcode.startsWith('vbdef')) {
item.queryCondition = () => {
let data = this.props.form.getFormItemsValue(card_head, Field.pk_org).value; // 调用相应组件的取值API
return { pk_org: data }; // 根据pk_org过滤
};
}
else {
//根据pk_org 过滤其他字段
item.queryCondition = () => {
let data = this.props.form.getFormItemsValue(card_head, Field.pk_org).value; // 调用相应组件的取值API
return { pk_org: data }; // 根据pk_org过滤
};
} */
})
meta[card_body_sum].items.map((item) => {
//根据pk_org 过滤其他字段
item.queryCondition = () => {
let data = this.props.form.getFormItemsValue(card_head, Field.pk_org).value; // 调用相应组件的取值API
return { pk_org: data }; // 根据pk_org过滤
};
})
meta['body_sum_edit'].items.map((item) => {
//根据pk_org 过滤其他字段
item.queryCondition = () => {
let data = this.props.form.getFormItemsValue(card_head, Field.pk_org).value; // 调用相应组件的取值API
return { pk_org: data }; // 根据pk_org过滤
};
})
//明细表体超链接
meta[card_body_detail].items.items = meta[card_body_detail].items.map((item, key) => {
if (item.attrcode == 'vmobillcode') {
item.renderStatus = 'browse',
item.render = (text, record, index) => {
let cmoid = record && record.values.cmoid && record.values.cmoid.value;
let motype = record && record.values.vmotype && record.values.vmotype.value;
let mopagecode = '50080000_card';
let moappcode = '50080000';
if (motype == '55C2') {
mopagecode = '50090000_card';
moappcode = '50090000';
}
return (
<span className="code-detail-link"
onClick={() => {
props.openTo(null, {
pagecode: mopagecode,
// appcode: moappcode,
id: cmoid,
billtype: motype,
status: 'browse',
});
}}
>
{text && text.value}
</span>
);
};
return item;
}
if (item.attrcode == 'vpickmbillcode') {
item.renderStatus = 'browse',
item.render = (text, record, index) => {
let cpickmid = record && record.values.cpickmid && record.values.cpickmid.value;
return (
<span className="code-detail-link"
onClick={() => {
openAppByBilltype({
billpk: cpickmid,
billtype: '55A3',
type: 'open'
})
}}
>
{text && text.value}
</span>
);
};
return item;
}
});
//明细表体-添加操作列
let porCol = {
label: getLangByResId(this, '5008ReqPickm-0000042') /* 国际化处理: 操作 */,
attrcode: 'opr',
itemtype: 'customer', //默认必输
fixed: 'right', //锁定操作列
visible: true,
width: '200px',
render: (text, record, index) => {
let buttonAry = buttonController.setRowButtons.call(this, props, record, index);
return this.props.button.createOprationButton(buttonAry, {
area: ReqPickmCardInfo.cardBodyInnerAction,
buttonLimit: 3,
onButtonClick: (props, key) => buttonClick.call(this, props, key, record, index)
});
}
};
meta[card_body_detail].items.push(porCol);
//汇总表体-添加操作列
let porCol1 = {
label: getLangByResId(this, '5008ReqPickm-0000042') /* 国际化处理: 操作 */,
attrcode: 'opr',
itemtype: 'customer', //默认必输
fixed: 'right', //锁定操作列
visible: true,
width: '200px',
render: (text, record, index) => {
let buttonAry = [];
let rows = this.props.cardTable.getVisibleRows(card_body_sum);
//let cmaterialvid = this.props.cardTable.getValByKeyAndIndex(card_body_sum,0,'cmaterialvid');
let status = this.props.getUrlParam('status');
if (!status) {
status = STATUS.add;
}
//表体汇总表有数据-才显示展开按钮
let openorclose = '';
if (this.state.lineShowType_s[index] == 1) {
openorclose = 'CloseRow_Sum';
} else {
openorclose = 'OpenRow_Sum';
}
if (rows && rows.length > 0) {
if (status == STATUS.browse) {
buttonAry = [openorclose]
} else {
buttonAry = ['OpenRow_Sum']
}
}
return this.props.button.createOprationButton(buttonAry, {
area: 'body_sum_inner',
buttonLimit: 3,
onButtonClick: (props, key) => buttonClick.call(this, props, key, record, index)
});
}
};
meta[card_body_sum].items.push(porCol1);
// 行号排序处理
columnSortUtils.numberSort(meta, card_body_detail, 'vrowno');
columnSortUtils.numberSort(meta, card_body_sum, 'vrowno');
return meta;
}
function toggleShow(data) {
let status = this.props.getUrlParam('status');
if (!status) {
status = STATUS.add;
}
let copy = this.props.getUrlParam('copy');
if (status == STATUS.add && !copy) {
// 新增
let pk_org_v = data.context.pk_org_v;
let org_v_Name = data.context.org_v_Name;
// 缓存为了处理卡片的自制
addDataSource(data);
if (pk_org_v) {
orgChangeEvent.call(
this,
this.props,
card_head,
Field.pk_org_v,
{ value: pk_org_v, display: org_v_Name },
null,
{
refpk: pk_org_v,
refname: org_v_Name
},
null
);
this.props.form.setFormItemsDisabled(card_head, { pk_org: false, pk_org_v: false });
} else {
this.props.form.setFormItemsValue(card_head, {
[Field.pk_org]: { value: null, display: null },
[Field.pk_org_v]: { value: null, display: null }
});
this.props.initMetaByPkorg(Field.pk_org_v);
}
}
}
function addDataSource(data) {
// 缓存为了处理卡片的自制
setDefData(Field.pk_org, ReqPickmCache.dataSource, data.context.pk_org);
setDefData('pk_org_name', ReqPickmCache.dataSource, data.context.org_Name);
}

View File

@ -0,0 +1,354 @@
import { STATUS, Field, FbillStatus, ReqPickmCardInfo, CardButton, CardButton_body_detail, notEdit_modal_d, TransferInfo, sagasField } from '../../constance';
let { card_head, card_body_detail, card_body_sum,headAction } = ReqPickmCardInfo;
/**
* //根据单据的状态控制行按钮显示
* @param {*} props
* * @param {*} record
* * @param {*} index
*
*/
function setRowButtons(props, record, index) {
let fbillstatus = props.form.getFormItemsValue(card_head, Field.fbillstatus).value;
let state = props.getUrlParam('status');
if (!state) {
state = STATUS.add;
}
let buttonAry = [];
let openorclose = '';
if (this.state.lineShowType[index] == 1) {
openorclose = CardButton_body_detail.CloseRow;
} else {
openorclose = CardButton_body_detail.OpenRow;
}
if (state == STATUS.browse) {
buttonAry = [
openorclose
]
} else {
buttonAry = [
CardButton_body_detail.OpenRow,
//CardButton_body_detail.AddLine,
CardButton_body_detail.DelLine,
//CardButton_body_detail.CopyLine,
CardButton_body_detail.InsertLine,
CardButton_body_detail.PasteThis
]
let sumrows = props.cardTable.getVisibleRows(card_body_sum,false,true);
//表体汇总表有数据-按钮都不可用
if (sumrows && sumrows.length > 0) {
buttonAry = [
CardButton_body_detail.OpenRow,
CardButton_body_detail.PasteThis
]
} else {
buttonAry = [
CardButton_body_detail.OpenRow,
CardButton_body_detail.DelLine,
CardButton_body_detail.InsertLine,
CardButton_body_detail.PasteThis
]
}
}
return buttonAry;
}
/**
* 设置界面状态
* @param {*} props
* @param {*} status
*/
function setUIState(props, status) {
if (status === STATUS.browse) {
this.props.form.setFormStatus(card_head, status);
this.props.cardTable.setStatus(card_body_detail, status);
this.props.cardTable.setStatus(card_body_sum, status);
} else {
this.props.form.setFormStatus(card_head, STATUS.edit);
this.props.cardTable.setStatus(card_body_detail, STATUS.edit);
this.props.cardTable.setStatus(card_body_sum, STATUS.edit);
}
}
/**
* 设置返回按钮的可见性
* @param {*} props
*/
function setBackButtonVisiable(props, param) {
let status = props.getUrlParam('status');
if (!status) {
status = 'add';
}
if (status === STATUS.browse) {
if (!param && this.MMPAC_REQPICKM_TYPE == 'N') {
props.BillHeadInfo.setBillHeadInfoVisible({
showBackBtn: true, //控制显示返回按钮: true为显示,false为隐藏 ---非必传
showBillCode: true, //控制显示单据号true为显示,false为隐藏 ---非必传
//billCode: this.state.vbillcode //修改单据号---非必传
billCode: props.form.getFormItemsValue(ReqPickmCardInfo.card_head, Field.vbillcode).value //修改单据号
});
} else {
props.BillHeadInfo.setBillHeadInfoVisible({
showBackBtn: false, //控制显示返回按钮: true为显示,false为隐藏 ---非必传
showBillCode: true, //控制显示单据号true为显示,false为隐藏 ---非必传
billCode: props.form.getFormItemsValue(ReqPickmCardInfo.card_head, Field.vbillcode).value //修改单据号
});
}
} else if (status == 'add') {
props.BillHeadInfo.setBillHeadInfoVisible({
showBackBtn: false, //控制显示返回按钮: true为显示,false为隐藏 ---非必传
showBillCode: false, //控制显示单据号true为显示,false为隐藏 ---非必传
billCode: '' //修改单据号---非必传
});
} else if (status == STATUS.edit) {
props.BillHeadInfo.setBillHeadInfoVisible({
showBackBtn: false, //控制显示返回按钮: true为显示,false为隐藏 ---非必传
showBillCode: true, //控制显示单据号true为显示,false为隐藏 ---非必传
billCode: props.form.getFormItemsValue(ReqPickmCardInfo.card_head, Field.vbillcode).value //修改单据号
});
}
}
/**
* 转单界面显示按钮控制
* @param {*} props
* @param {*} type是否推单
*/
function toggleShowTransfer(props, type) {
//推单标识
let channelType = props.getUrlParam(TransferInfo.channelType);
let pk_head = props.form.getFormItemsValue(card_head, Field.creqpickmid);
pk_head = pk_head && pk_head.value;
let status = props.getUrlParam(STATUS.status); //拉单或是推单时参数没有status
status = status == null || channelType != null ? props.form.getFormStatus(card_head) : status;
// 转单已保存的显示为浏览态
status = channelType && pk_head ? STATUS.browse : channelType ? STATUS.edit : status;
// 转单已经保存过的数据点击修改触发
status = type == STATUS.edit ? STATUS.edit : status;
if (channelType != null) {
props.button.setButtonVisible([CardButton.QuitTransferBill], true);
} else {
props.button.setButtonVisible([CardButton.QuitTransferBill], false);
}
if (pk_head == null && status == STATUS.edit) {
//当页面为编辑态且主键为空时释放主组织的编辑性
props.form.setFormItemsDisabled(card_head, { 'pk_org': false,'pk_org_v': false });
}
//拉单推单
//浏览态
if (status === STATUS.browse) {
props.button.setButtonVisible([...CardButton.BrowseBtns, CardButton_body_detail.OpenRow, 'ReqPickmDelivery_s'], true);
props.button.setButtonVisible([CardButton.Add, CardButton.Copy], false);//新增和复制按钮不可用
props.button.setButtonVisible([...CardButton.EditBtns, ...CardButton_body_detail.EditBtns, ...CardButton_body_detail.CopyBtns, 'RestNo_s'], false);
let creqpickmid = props.form.getFormItemsValue(card_head, Field.creqpickmid);
if (!creqpickmid || !creqpickmid.value) {
//浏览态,界面没有值,只有新增按钮可以用
props.button.setButtonVisible([...CardButton.BrowseBtns, CardButton.QuitTransferBill], false);
props.button.setButtonVisible([CardButton.Add], true);
} else {
let fbillstatus = props.form.getFormItemsValue(card_head, Field.fbillstatus).value;
//自由
if (fbillstatus == FbillStatus.free) {
props.button.setButtonVisible([CardButton.ReqPickmUnFinish], false);//取消完成不可用
let selectrows = props.cardTable.getCheckedRows(card_body_sum);
//汇总表体没有选中行时,备料按钮不可用
if (!selectrows || selectrows.length == 0) {
props.button.setDisabled(['ReqPickmDelivery_s'], true);
}
}
//完成
else if (fbillstatus == FbillStatus.complete) {
props.button.setButtonVisible([CardButton.Edit, CardButton.Delete, CardButton.ReqPickmFinish, CardButton.ReqPickmDelivery, 'ReqPickmDelivery_s'], false);//修改,删除,备料,强制完成,汇总肩上备料按钮不可用
}
}
//编辑态
} else {
let sumrows = props.cardTable.getVisibleRows(card_body_sum,false,true);
if (sumrows && sumrows.length > 0) {
props.cardTable.setStatus(card_body_detail, 'browse', null);//设置表格状态
//props.cardTable.setModelEdit(card_body_detail,[...notEdit_modal_d],false);//设置侧拉框字段的可编辑性
} else {
props.cardTable.setStatus(card_body_detail, 'edit', null);//设置表格状态
//props.cardTable.setModelEdit(card_body_detail,[...notEdit_modal_d],true);//设置侧拉框字段的可编辑性
}
props.button.setButtonVisible([...CardButton.BrowseBtns, ...CardButton_body_detail.CopyBtns, 'ReqPickmDelivery_s'], false);
props.button.setButtonVisible([...CardButton.EditBtns, ...CardButton_body_detail.EditBtns, CardButton_body_detail.OpenRow], true);
props.cardPagination.setCardPaginationVisible('cardPaginationBtn', false);
headComputeAndSum.call(this, props);//设置表头按钮,计算-汇总-取消汇总的可见性
lineSelected.call(this, props);
}
}
/**
* //1.优先根据界面状态判断显示按钮显示
// 2.再根据单据状态控制按钮显示
* @param {*} props
* @param {*} status
*/
function setCardButtonVisiable(props, status, param) {
//sagas 每次刷新卡片按钮状态时
let sagaStatus = this.props.form.getFormItemsValue(card_head, sagasField.SAGA_STATUS)
let frozen = sagaStatus && sagaStatus.value == '1' ? true : false;
if (status == STATUS.browse && frozen) {
this.props.button.toggleErrorStatus(headAction, { isError: true });
} else {
this.props.button.toggleErrorStatus(headAction, { isError: false });
}
//浏览态
if (status === STATUS.browse) {
props.button.setButtonVisible([...CardButton.BrowseBtns, CardButton_body_detail.OpenRow, 'ReqPickmDelivery_s'], true);
props.button.setButtonVisible([...CardButton.EditBtns, ...CardButton_body_detail.EditBtns, ...CardButton_body_detail.CopyBtns, 'RestNo_s'], false);
let creqpickmid = props.form.getFormItemsValue(card_head, Field.creqpickmid);
if (!creqpickmid || !creqpickmid.value) {
//浏览态,界面没有值,只有新增按钮可以用
props.button.setButtonVisible([...CardButton.BrowseBtns], false);
props.button.setButtonVisible([CardButton.Add], true);
} else {
let isShowCardPage = true;
if (this.MMPAC_REQPICKM_TYPE == 'Y') {
isShowCardPage = false;
}
props.cardPagination.setCardPaginationVisible(props, isShowCardPage);
let fbillstatus = props.form.getFormItemsValue(card_head, Field.fbillstatus).value;
//自由
if (fbillstatus == FbillStatus.free) {
props.button.setButtonVisible([...CardButton.BrowseBtns], true);
props.button.setButtonVisible([CardButton.ReqPickmUnFinish], false);//取消完成不可用
let selectrows = props.cardTable.getCheckedRows(card_body_sum);
//汇总表体没有选中行时,备料按钮不可用
if (!selectrows || selectrows.length == 0) {
props.button.setDisabled(['ReqPickmDelivery_s'], true);
}
}
//完成
else if (fbillstatus == FbillStatus.complete) {
props.button.setButtonVisible([...CardButton.BrowseBtns], true);
props.button.setButtonVisible([CardButton.Edit, CardButton.Delete, CardButton.ReqPickmFinish, CardButton.ReqPickmDelivery, 'ReqPickmDelivery_s'], false);//修改,删除,备料,强制完成,汇总肩上备料按钮不可用
}
}
//编辑态
} else {
let sumrows = props.cardTable.getVisibleRows(card_body_sum,false,true);
if (sumrows && sumrows.length > 0) {
props.cardTable.setStatus(card_body_detail, 'browse', null);//设置表格状态
//props.cardTable.setModelEdit(card_body_detail,[...notEdit_modal_d],false);//设置侧拉框字段的可编辑性
} else {
props.cardTable.setStatus(card_body_detail, 'edit', null);//设置表格状态
//props.cardTable.setModelEdit(card_body_detail,[...notEdit_modal_d],true);//设置侧拉框字段的可编辑性
}
props.button.setButtonVisible([...CardButton.BrowseBtns, ...CardButton_body_detail.CopyBtns, 'ReqPickmDelivery_s'], false);
props.button.setButtonVisible([...CardButton.EditBtns, ...CardButton_body_detail.EditBtns, CardButton_body_detail.OpenRow], true);
props.cardPagination.setCardPaginationVisible('cardPaginationBtn', false);
headComputeAndSum.call(this, props);//设置表头按钮,计算-汇总-取消汇总的可见性
lineSelected.call(this, props);
}
}
/**
* 设置表头按钮计算-汇总-取消汇总的可见性
*/
function headComputeAndSum(props) {
let sumrows = props.cardTable.getVisibleRows(card_body_sum,false,true);
//表体汇总表有数据-计算+汇总不可见
if (sumrows && sumrows.length > 0) {
props.button.setButtonVisible([CardButton.ReqPickmCompute, CardButton.ReqPickmSum], false);
}
//表体汇总表无数据-取消汇总不可见
else {
props.button.setButtonVisible([CardButton.ReqPickmUnSum], false);
}
}
/**
* //根据勾选行控制肩部按钮
* @param {*} props
*
*/
function lineSelected4Sum(props) {
let selectrows = props.cardTable.getCheckedRows(card_body_sum);
//汇总表体有选中行时,备料按钮可用
if (selectrows.length > 0) {
props.button.setDisabled(['ReqPickmDelivery_s'], false);
} else {
props.button.setDisabled(['ReqPickmDelivery_s'], true);
}
}
/**
* //根据勾选行控制肩部按钮
* @param {*} props
*
*/
function lineSelected(props) {
let pk_org = props.form.getFormItemsValue(card_head, Field.pk_org);
let sumrows = props.cardTable.getVisibleRows(card_body_sum,false,true);
//表体汇总表有数据-按钮都不可用
if (sumrows && sumrows.length > 0) {
props.button.setDisabled([...CardButton_body_detail.EditBtns], true);
props.button.setButtonVisible(['RestNo_s'], true);
return;
} else {
props.button.setButtonVisible(['RestNo_s'], false);//汇总表体没数据,重排号不可见
}
if (pk_org && pk_org.value) {
props.button.setDisabled([...CardButton_body_detail.EditBtns, CardButton_body_detail.OpenRow], false);
} else {
props.button.setDisabled([...CardButton_body_detail.EditBtns, CardButton_body_detail.OpenRow], true);
props.button.setButtonVisible(['RestNo_s'], false);
return;
}
let rowsdata = props.cardTable.getCheckedRows(card_body_detail);
let rowsflag = true; //根据勾选行数控制肩部可用按钮
if (rowsdata.length > 0) {
rowsflag = false;
}
//表体明细有选中数据时,删行和复制行才可用
let disableArr = {
[CardButton_body_detail.DelLine]: rowsflag,//肩上删行
[CardButton_body_detail.CopyLine]: rowsflag//肩上复制行
};
props.button.setDisabled(disableArr);
}
/**
* //1.设置空白页面的按钮
* @param {*} props
* @param {*} fbillstatus
*/
function setBlankPageButtons() {
this.props.button.setButtonVisible([...CardButton.BrowseBtns, ...CardButton.EditBtns], false);
this.props.button.setButtonVisible([...CardButton_body_detail.EditBtns, ...CardButton_body_detail.CopyBtns, 'RestNo_s', 'ReqPickmDelivery_s'], false);
this.props.button.setButtonVisible([CardButton.Add], true);
}
function setCardPaginationVisible(props, showPage) {
// 设置卡片分页的显示隐藏
props.cardPagination.setCardPaginationVisible('cardPaginationBtn', showPage);
}
function modelRowEditBefore(props, moduleId, modelIndex, record) {
let pk_org = props.form.getFormItemsValue(card_head, Field.pk_org);
let sumrows = props.cardTable.getVisibleRows(card_body_sum,false,true);
let flag = true;
//表体汇总表有数据-按钮都不可用
if (sumrows && sumrows.length > 0) {
flag = false;
}
//组织没有值,增行、删行不可用
if (!pk_org && !pk_org.value) {
flag = false;
}
return flag;
}
export default {
setRowButtons,
setUIState,
setBackButtonVisiable,
setCardButtonVisiable,
setBlankPageButtons,
headComputeAndSum,
lineSelected,
lineSelected4Sum,
setCardPaginationVisible,
modelRowEditBefore,
toggleShowTransfer
}

View File

@ -0,0 +1,3 @@
import buttonController from './buttonController';
//import btnClickController from './btnClickControllor';
export { buttonController };

View File

@ -0,0 +1,306 @@
/**
* 备料申请维护
*/
//请求的URL
const URL = {
currentpage: '/nccloud/mmpac/reqpickm/queryPageByPks.do', //分页查询数据
queryList: '/nccloud/mmpac/reqpickm/queryReqpickmList.do', //列表态数据查询
queryCard: '/nccloud/mmpac/reqpickm/queryReqpickmCard.do', //卡片态数据查询
newSave: '/nccloud/mmpac/reqpickm/newSave.do', //卡片态下新增保存
editSave: '/nccloud/mmpac/reqpickm/editSave.do', //卡片态下修改保存
batchDelete: '/nccloud/mmpac/reqpickm/batchDelete.do', //删除
editReqPickmCardURL: '/nccloud/mmpac/reqpickm/edit.do', //修改
copyURL: '/nccloud/mmpac/reqpickm/copy.do', //复制
unSumURL: '/nccloud/mmpac/reqpickm/reqpickmUnSum.do', //取消汇总
reqpickmSum: '/nccloud/mmpac/reqpickm/reqpickmSum.do', //汇总
printURL: '/nccloud/mmpac/reqpickm/print.do', //打印
finishURL: '/nccloud/mmpac/reqpickm/finish.do', //强制完成
unFinishURL: '/nccloud/mmpac/reqpickm/unFinish.do', //取消完成
deliveryURL: '/nccloud/mmpac/reqpickm/delivery.do', //列表备料
deliveryCardURL: '/nccloud/mmpac/reqpickm/deliveryCard.do', //卡片备料
materialURL: 'nccloud.web.mmpub.pub.ref.MaterialRefSqlBuilder',
//编辑前事件
headBeforeEdit: '/nccloud/mmpac/reqpickm/headBeforeEdit.do',
bodyDetailBeforeEdit: '/nccloud/mmpac/reqpickm/bodyDetailBeforeEdit.do',
bodySumBeforeEdit: '',
//编辑后事件
orgChangedEvent: '/nccloud/mmpac/reqpickm/orgChangeEvent.do', //组织改变事件
headAfterEdit: '',
bodyDetailAfterEdit: '/nccloud/mmpac/reqpickm/bodyDetailAfterEdit.do',
bodySumAfterEdit: '/nccloud/mmpac/reqpickm/bodySumAfterEdit.do',
queryByCondURL: '/nccloud/mmpac/reqpickm/queryByCond.do'
}
//列表页签
const TabCode = {
Executing: { value: 0, code: 'executing', name: '5008ReqPickm-000002' },
All: { value: 1, code: 'all', name: '5008ReqPickm-000003' }
}
//页面状态
const STATUS = {
status: 'status', //状态标志
edit: 'edit', //编辑态
add: 'add', //新增态
browse: 'browse', //浏览
copy: 'copy'
}
const Field = {
creqpickmid: 'creqpickmid', //主键
pk_group: 'pk_group',
pk_org: 'pk_org',
pk_org_v: 'pk_org_v',
vbillcode: 'vbillcode',
crequesttype: 'crequesttype', //申请类型
vrequesttypecode: 'vrequesttypecode', //申请类型编码
fbillstatus: 'fbillstatus',
ts: 'ts'
}
const Field_detail = {
creqpickm_bid: 'creqpickm_bid', //主键
pk_group: 'pk_group',
pk_org: 'pk_org',
pk_org_v: 'pk_org_v',
vrowno: 'vrowno', //行号
cmaterialid: 'cmaterialid', //物料oid
cmaterialvid: 'cmaterialvid', //物料
cdeliverorgvid: 'cdeliverorgvid', //发料组织
cdeliverorgid: 'cdeliverorgid',
fsupplytype: 'fsupplytype',
bcandeliver: 'bcandeliver',
bmainmaterial: 'bmainmaterial',
ddeliverdate: 'ddeliverdate',
fitemsource: 'fitemsource', //
coutstockid: 'coutstockid', //发料仓库
nreqastnum: 'nreqastnum', //申请数量
nreqnum: 'nreqnum', //申请主数量
castunitid: 'castunitid', //辅单位
cunitid: 'cunitid', //主单位
vchangerate: 'vchangerate', //换算率
cbffileid: 'cbffileid', //特征码
ts: 'ts',
vbfree1: 'vbfree1', //自由辅助属性
vbfree2: 'vbfree2',
vbfree3: 'vbfree3',
vbfree4: 'vbfree4',
vbfree5: 'vbfree5',
vbfree6: 'vbfree6',
vbfree7: 'vbfree7',
vbfree8: 'vbfree8',
vbfree9: 'vbfree9',
vbfree10: 'vbfree10'
}
const Field_sum = {
creqpickm_bid: 'creqpickm_sid', //主键
pk_group: 'pk_group',
pk_org: 'pk_org',
pk_org_v: 'pk_org_v',
cmaterialvid: 'cmaterialvid', //物料
cdeliverorgvid: 'cdeliverorgvid', //发料组织
coutstockid: 'coutstockid', //发料仓库
nstocknum: 'nstocknum', //备料主数量
nstockastnum: 'nstockastnum', //备料辅数量
csupplyorgvid: 'csupplyorgvid', //供应组织
cinstockid: 'cinstockid', //供应仓库
naccpendingnum: 'naccpendingnum', //累计待转主数量
naccstockoutnum: 'naccstockoutnum', //累计入库主数量
ts: 'ts'
}
const billType = '55AC';
const FbillStatus = {
free: '1', //自由
complete: '2' //完成
}
//备料来源
const FitemsourceEnum = {
prepare: { code: 'prepare', name: '5008ReqPickm-0000052', data: '0' }, //备料
issue: { code: 'issue', name: '5008ReqPickm-0000053', data: '1' }, //领料
transfer: { code: 'transfer', name: '5008ReqPickm-0000054', data: '2' } //传输
}
//供应方式
const FsupplytypeEnum = {
generaldelivery: { code: 'generaldelivery', name: '5008ReqPickm-0000055', data: '0' }, //一般发料
rationdelivery: { code: 'rationdelivery', name: '5008ReqPickm-0000056', data: '1' } //定量发料
}
const ReqPickmCache = {
dataSource: 'mm.mmpac.reqpickm.data',
tabNum: 'tabNum', //页签对应的数据量
curTabCode: 'curTabCode', //当前页签
queryInfo: 'queryInfo', //查询信息
pageInfo: 'pageInfo', //分页信息
ReqPickmTransferCache: 'mm.mmpac.reqpickm.pickmtransfercache', //拉单缓存
}
//备料申请列表信息
const ReqPickmListInfo = {
pageId: '50080106_list',
headAction: 'list_head_action', //列表按钮
listInnerAction: 'list_inner', //列表操作列按钮区域
searchId: 'list_query', //区域编码
tableId: 'list_head',
pk_item: 'creqpickmid'
}
const ListButton = {
Add: 'Add',
Delete: 'Delete',
Edit: 'Edit',
Refresh: 'Refresh',
Copy: 'Copy',
ReqPickmDelivery: 'ReqPickmDelivery', //备料
ReqPickmFinish: 'ReqPickmFinish', //强制完成
ReqPickmUnFinish: 'ReqPickmUnFinish', //取消完成
File: 'File', //附件管理
BillLinkQuery: 'BillLinkQuery', //单据追溯
Print: 'Print', //打印
Output: 'Output', //输出
PrintDetail: 'PrintDetail' //打印明细
}
//备料申请卡片信息
const ReqPickmCardInfo = {
pageId: '50080106_card', //卡片态的pagecode
card_head: 'card_head', //区域编码
card_tail: 'tail', //表尾
card_body_detail: 'card_body_detail', //备料申请明细页签
card_body_sum: 'card_body_sum', //备料申请明细页签
headAction: 'card_head_action', //按钮
bodyAction_detail: 'body_detail_action',
bodyAction_sum: 'body_sum_action',
cardBodyInnerAction: 'body_detail_inner', //卡片明细表体操作按钮区域
pk_head: 'creqpickmid',
pk_body_detail: 'creqpickm_bid',
pk_body_sum: 'creqpickm_sid',
}
const TransferInfo = {
//转单的信息
transfer: 'transfer',
type: 'type', //用来判断是否是从转单页面进入
leftarea: 'leftarea', //左侧的列表区域
channelTypeDataSource1: 'mm.mmpac.pickm.datasource', //备料计划的缓存id
pickmarrange: 'pickmToReqpickm', //备料计划数组
putplanarrange: 'putplanToReqpickm', //投放计划数组
channelType: 'channelType', //推单
// config: {
// headAreaId: 'head_card',
// bodyAreaId: 'body_card',
// bodyPKfield: 'cmoid'
// },
comeType: 'comeType',
//推单-备料计划
pickmtoReqPickmbillURL: '/nccloud/mmpac/reqpickm/pickmToReqPickmQueryAction.do', // 备料计划推备料申请
//推单-投放计划
putplantoReqPickmbillURL: '/nccloud/mmpac/reqpickm/putplanToReqPickmQueryAction.do', // 投放计划推备料申请
}
const CardButton = {
Back: 'Back',
Add: 'Add',
Edit: 'Edit',
Delete: 'Delete',
Refresh: 'Refresh',
Copy: 'Copy',
ReqPickmDelivery: 'ReqPickmDelivery', //备料
drop_more: 'drop_more',
ReqPickmFinish: 'ReqPickmFinish', //强制完成
ReqPickmUnFinish: 'ReqPickmUnFinish', //取消完成
File: 'File', //附件管理
BillLinkQuery: 'BillLinkQuery', //单据追溯
Print: 'Print', //打印
Output: 'Output', //输出
PrintDetail: 'PrintDetail', //打印明细
Cancel: 'Cancel',
Save: 'Save',
ReqPickmCompute: 'ReqPickmCompute', //计算
ReqPickmSum: 'ReqPickmSum', //汇总
ReqPickmUnSum: 'ReqPickmUnSum', //取消汇总
QuitTransferBill: 'QuitTransferBill', //退出转单
BrowseBtns: ['Add', 'Edit', 'Delete', 'Refresh', 'Copy', 'ReqPickmDelivery', 'ReqPickmFinish',
'ReqPickmUnFinish', 'File', 'BillLinkQuery', 'File', 'Print', 'Output', 'PrintDetail', 'drop_more'
],
EditBtns: ['Save', 'Cancel', 'ReqPickmCompute', 'ReqPickmSum', 'ReqPickmUnSum']
}
const CardButton_body_detail = {
CloseRow: 'CloseRow', //收起
OpenRow: 'OpenRow', //展开
AddLine: 'AddLine', //增行
DelLine: 'DeleteLine', //删行
CopyLine: 'CopyLine', //复制行
InsertLine: 'InsertLine', //插行
ResetNo: 'ResetNo', //重排行号
PasteLast: 'PasteLast', //粘贴至末行
PasteCancel: 'PasteCancel', //复制行取消
PasteThis: 'PasteThis', //粘贴至此
EditBtns: ['AddLine', 'DeleteLine', 'CopyLine', 'InsertLine', 'ResetNo'], //编辑态可显示按钮
CopyBtns: ['PasteLast', 'PasteThis', 'PasteCancel'], //复制后显示的按钮
}
const CardButton_body_sum = {
// CloseRow: 'CloseRow',//收起
// OpenRow: 'OpenRow',//展开
ResetNo_s: 'ResetNo_s', //重排行号
ReqPickmDelivery_s: 'ReqPickmDelivery_s' //汇总表肩上备料
}
//表体物料的6个固定辅助属性
const bodyfixAssts = [
'cbvendorid',
'cbvendorvid',
'cbproductorid',
'cbprojectid',
'cbcustomerid',
'cbcustomervid',
//'cbqualitylevelid',
//'cbffileid'
];
const bodyCustAndSupFild = {
ccustomerid: 'cbcustomerid',
ccustomervid: 'cbcustomervid',
cvendorid: 'cbvendorid',
cvendorvid: 'cbvendorvid'
};
const sagasField = {
SAGA_FROZEN: 'saga_frozen', //冻结状态
SAGA_GTXID: 'saga_gtxid', //全局事务id
SAGA_BTXID: 'saga_btxid', //分支事务id
SAGA_STATUS: 'saga_status' //事务状态
};
//明细表体-侧拉编辑框不可编辑字段
const notEdit_modal_d = [
'creqpickm_bid', //主键
'pk_group',
'pk_org',
'pk_org_v',
'vrowno', //行号
'cmaterialid', //物料oid
'cmaterialvid', //物料
'cdeliverorgvid', //发料组织
'cdeliverorgid',
'fsupplytype',
'bcandeliver',
'bmainmaterial',
'ddeliverdate',
'fitemsource', //
'coutstockid', //发料仓库
'nreqastnum', //申请数量
'nreqnum', //申请主数量
'castunitid', //辅单位
'cunitid', //主单位
'vchangerate', //换算率
'cbffileid', //特征码
'vnote' //备注
];
export { URL, TabCode, STATUS, FbillStatus, ReqPickmCache, Field, Field_detail, Field_sum, billType, FitemsourceEnum, FsupplytypeEnum, ReqPickmListInfo, ReqPickmCardInfo, CardButton, CardButton_body_detail, CardButton_body_sum, ListButton, bodyfixAssts, TransferInfo, notEdit_modal_d, sagasField,bodyCustAndSupFild };

View File

@ -0,0 +1,743 @@
/**
* 列表态点击事件
*/
import { ajax, toast, cardCache, print, output, cacheTools } from 'nc-lightapp-front';
import { commonSearch } from './service';
import { URL, ReqPickmCache, Field, ReqPickmListInfo, TabCode, STATUS, ListButton } from '../../constance';
import { showWarningDialog, showErrorInfo, showBatchOprMessage ,showWarningInfo,showSuccessInfo} from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
import { buttonController } from '../viewController'
import { updateCacheDataForList, deleteCacheDataForList } from '../../../../../mmpub/mmpub/pub/cache';
const { searchId, tableId, pk_item, pageId } = ReqPickmListInfo;
let { setDefData, getDefData } = cardCache;
import { getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import {tableBeforeEdit} from '../../../../../mmpub/mmpub/pub/tool/listBeforeEditCardUtil';
const buttonClick = function (props, key, text, record, index) {
let rows = [];
switch (key) {
case ListButton.Add://新增
addBtnClick.call(this);
break;
case ListButton.Delete://删除
deleteBtnClick.call(this, props, record, index);
break;
case ListButton.Edit://修改
editBtnClick.call(this, props, record, index);
break;
case ListButton.Refresh://刷新
refreshBtnClick.call(this);
break;
case ListButton.Copy://复制
copyBtnClick.call(this, props, record, index);
break;
case ListButton.ReqPickmDelivery://备料
deliveryBtnClick.call(this, props, record, index);
break;
case ListButton.ReqPickmFinish://强制完成
finishBtnClick.call(this, this.props, record);
break;
case ListButton.ReqPickmUnFinish://取消完成
unFinishBtnClick.call(this, this.props, record);
break;
case ListButton.BillLinkQuery://单据追溯
billLinkQueryBtnClick.call(this, this.props, record, index);
break;
case ListButton.File: //附件管理
fileBtnClick.call(this, this.props, record, index);
break;
case ListButton.Print://打印
printBtnClick.call(this);
break;
case ListButton.PrintDetail://打印
printDetailBtnClick.call(this);
break;
case ListButton.Output: //输出
outputBtnClick.call(this);
break;
default:
break;
}
}
//备料
const deliveryBtnClick = function (props, record) {
let _this = this;
if (record && record.creqpickmid) {
if (record.fbillstatus && record.fbillstatus.value == 2) {
toast({
color: 'warning',
content: getLangByResId(this, '5008ReqPickm-0000029')/*国际化处理: 此备料申请是完成态,不能备料!*/
});
return;
} else if (record.fbillstatus && record.fbillstatus.value == 1) {
doDelivery.call(_this, props, record);
}
} else {
let rows = props.table.getCheckedRows(tableId);
if (rows.length <= 0) {
toast({
color: 'warning',
content: getLangByResId(this, '5008ReqPickm-0000027')/*国际化处理: 请选择需要备料的数据!*/
});
return;
} else if (rows.length == 1) {
let fbillstatus = rows[0].data.values.fbillstatus;
if (fbillstatus && fbillstatus.value == 2) {
toast({
color: 'warning',
content: getLangByResId(this, '5008ReqPickm-0000029')/*国际化处理: 此备料申请是完成态,不能备料!*/
});
return;
} else if (fbillstatus && fbillstatus.value == 1) {
doDelivery.call(_this, props, null, rows);
}
} else {
doDelivery.call(_this, props, null, rows);
}
}
}
const doDelivery = function (props, record, rows) {
// 获取备料表格行的行号
let pkarr = new Array();
let arrangeids = [];//用来存储所选择数据的id
let numberindex = null;
if (record && record.creqpickmid) {
numberindex = record.numberindex.value;
let data = {
id: record.creqpickmid.value,
ts: record.ts.value
};
pkarr.push(data.id);
arrangeids.push(data.id)
} else {
// 获取备料表格行的行号
let indexs = [];
rows.map((item) => {
indexs.push(item.index);
});
rows.map((item) => {
let data = {
id: item.data.values.creqpickmid.value,
ts: item.data.values.ts.value
};
pkarr.push(data.id);
arrangeids.push(data.id);
});
}
let data = {
pks: pkarr,
pageId: pageId,
iscard: false
};
ajax({
method: 'post',
url: URL.deliveryURL,
data: data,
success: (res) => {
//跳转
if (res.success && res.error == null) {
//let pushdata = res.data[0];
//将需要备料的数据id存放到dataSource,下游直接去取
cacheTools.set('reqpickmArrangeIds', arrangeids);
let fprodmode = getDefData('fprodmode', ReqPickmCache.dataSource);
if (fprodmode == 1) { //流程
props.openTo(null, {
appcode: '50080105',
pagecode: '5008010502',
type: '55AC'
});
} else { //离散
props.openTo(null, {
appcode: '50090105',
pagecode: '5009010502',
type: '55AC'
});
}
}
}
})
}
//强制完成
const finishBtnClick = function (props, record) {
let _this = this;
if (record && record.creqpickmid) {
doFinish.call(_this, props, record);
} else {
let rows = this.props.table.getCheckedRows(tableId);
// 如果没有选中行,则提示并返回,不进行任何操作
if (rows.length <= 0) {
toast({
color: 'warning',
content: getLangByResId(this, '5008ReqPickm-0000028')/*国际化处理: 请选择需要完成的数据!*/
});
return;
}
doFinish.call(_this, props, null, rows);
}
}
const doFinish = function (props, record, rows) {
// 获取待完成表格行的行号
let pkarr = new Array();
let finishRows = [];
let numberindex = null;
if (record && record.creqpickmid) {
numberindex = record.numberindex.value;
let data = {
id: record.creqpickmid.value,
ts: record.ts.value
};
pkarr.push(data.id);
finishRows.push(data);
} else {
// 获取操作表格行的行号
let indexs = [];
rows.map((item) => {
indexs.push(item.index);
});
rows.map((item) => {
let data = {
id: item.data.values.creqpickmid.value,
ts: item.data.values.ts.value
};
pkarr.push(data.id);
finishRows.push(data);
});
}
let data = {
finishAndUnFinishInfos: finishRows,
pageid: pageId,
iscard: false
};
ajax({
url: URL.finishURL,
data: data,
success: (res) => {
if (res.success) {
if (record && record.creqpickmid) {
updateCacheDataForList(props, tableId, Field.creqpickmid, res.data, numberindex - 1);
} else {
if (JSON.stringify(res.data.errorMessageMap || {}) != '{}') {
// 成功的index
let sucIndex = [];
rows.forEach((element, index) => {
if (!res.data.errorMessageMap[index]) {
sucIndex.push(element.index);
}
updateCacheDataForList(props, tableId, Field.creqpickmid, res.data);
});
} else {
updateCacheDataForList(props, tableId, Field.creqpickmid, res.data);
}
}
let tabCode = getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource)
let currentTab = tabCode && tabCode != null ? tabCode : TabCode.All.code;
buttonController.initButtons.call(this, props, currentTab);
showBatchOprMessage.call(this, null, res.data, {}, getLangByResId(this, '5008ReqPickm-0000034'));
} else {
toast({ content: getLangByResId(this, '5008ReqPickm-0000043')/*国际化处理: 强制完成失败!*/, color: 'error' });
}
},
error: (res) => {
showErrorInfo(res.message);
}
})
}
//取消完成
const unFinishBtnClick = function (props, record) {
let _this = this;
if (record && record.creqpickmid) {
doUnFinish.call(_this, props, record);
} else {
let rows = this.props.table.getCheckedRows(tableId);
// 如果没有选中行,则提示并返回,不进行任何操作
if (rows.length <= 0) {
toast({
color: 'warning',
content: getLangByResId(this, '5008ReqPickm-0000044')/* 国际化处理: '请选择需要取消完成的数据!'*/
});
return;
}
doUnFinish.call(_this, props, null, rows);
}
}
const doUnFinish = function (props, record, rows) {
// 获取待完成表格行的行号
let pkarr = new Array();
let unfinishRows = [];
let numberindex = null;
if (record && record.creqpickmid) {
numberindex = record.numberindex.value;
let data = {
id: record.creqpickmid.value,
ts: record.ts.value
};
pkarr.push(data.id);
unfinishRows.push(data);
} else {
// 获取操作表格行的行号
let indexs = [];
rows.map((item) => {
indexs.push(item.index);
});
rows.map((item) => {
let data = {
id: item.data.values.creqpickmid.value,
ts: item.data.values.ts.value
};
pkarr.push(data.id);
unfinishRows.push(data);
});
}
let data = {
finishAndUnFinishInfos: unfinishRows,
pageid: pageId,
iscard: false
};
ajax({
url: URL.unFinishURL,
data: data,
success: (res) => {
if (res.success) {
if (record && record.creqpickmid) {
updateCacheDataForList(props, tableId, Field.creqpickmid, res.data, numberindex - 1);
} else {
if (JSON.stringify(res.data.errorMessageMap || {}) != '{}') {
// 成功的index
let sucIndex = [];
rows.forEach((element, index) => {
if (!res.data.errorMessageMap[index]) {
sucIndex.push(element.index);
}
updateCacheDataForList(props, tableId, Field.creqpickmid, res.data);
});
} else {
updateCacheDataForList(props, tableId, Field.creqpickmid, res.data);
}
}
let tabCode = getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource)
let currentTab = tabCode && tabCode != null ? tabCode : TabCode.All.code;
buttonController.initButtons.call(this, props, currentTab);
showBatchOprMessage.call(this, null, res.data, {}, getLangByResId(this, '5008ReqPickm-0000035'));
} else {
toast({ content: getLangByResId(this, '5008ReqPickm-0000045')/* 国际化处理: 取消完成失败!*/, color: 'error' });
}
},
error: (res) => {
showErrorInfo(res.message);
}
})
}
//打印
const printBtnClick = function () {
let appcode = this.props.getAppCode();
let nodekey = '50080106_sum'
if (this.props.getAppCode().startsWith('5009')) {
nodekey = nodekey.replace('5008', '5009');
}
let pks = [];
let selrows = this.props.table.getCheckedRows(tableId);
if (selrows.length == 0) {
toast({
color: 'danger',
content: getLangByResId(this, '5008ReqPickm-0000046') /* 国际化处理: '请选择要打印的备料申请!'*/
});
return;
}
selrows.forEach((row) => {
let pk = row.data.values.creqpickmid.value;
if (pk) {
pks.push(pk);
}
});
print(
'pdf', //支持两类: 'html'为模板打印, 'pdf'为pdf打印
URL.printURL,
{
funcode: appcode,
nodekey: nodekey, //模板节点标识
oids: pks // 功能节点的数据主键 oids含有多个元素(['1001A41000000000A9LR','1001A410000000009JDD'])时为批量打印,
}
);
}
//打印明细
const printDetailBtnClick = function () {
let appcode = this.props.getAppCode();
let nodekey = '50080106_detail'
if (this.props.getAppCode().startsWith('5009')) {
nodekey = nodekey.replace('5008', '5009');
}
let pks = [];
let selrows = this.props.table.getCheckedRows(tableId);
if (selrows.length == 0) {
toast({
color: 'danger',
content: getLangByResId(this, '5008ReqPickm-0000046') /* 国际化处理: '请选择要打印的备料申请!'*/
});
return;
}
selrows.forEach((row) => {
let pk = row.data.values.creqpickmid.value;
if (pk) {
pks.push(pk);
}
});
print(
'pdf', //支持两类: 'html'为模板打印, 'pdf'为pdf打印
URL.printURL,
{
funcode: appcode,
nodekey: nodekey, //模板节点标识
oids: pks // 功能节点的数据主键 oids含有多个元素(['1001A41000000000A9LR','1001A410000000009JDD'])时为批量打印,
}
);
}
//输出
const outputBtnClick = function () {
let appcode = this.props.getAppCode();
let nodekey = '50080106_sum'
if (this.props.getAppCode().startsWith('5009')) {
nodekey = nodekey.replace('5008', '5009');
}
let pks = [];
let selrows = this.props.table.getCheckedRows(tableId);
if (selrows.length == 0) {
toast({
color: 'danger',
content: getLangByResId(this, '5008ReqPickm-0000046') /* 国际化处理: '请选择要打印的备料申请!'*/
});
return;
}
selrows.forEach((row) => {
let pk = row.data.values.creqpickmid.value;
if (pk) {
pks.push(pk);
}
});
output({
url: URL.printURL,
data: {
oids: pks,
nodekey: nodekey,
funcode: appcode,
outputType: 'output'
}
});
}
//单据追溯
const billLinkQueryBtnClick = function (props, record, index) {
let pk;
if (record) {
pk = record.creqpickmid.value;
} else {
pk = props.table.getCheckedRows(tableId)[0].data.values.creqpickmid.value;
}
this.setState({ creqpickmid: pk, showTrack: true });
}
//附件管理
const fileBtnClick = function (props, record, index) {
let pk;
let vbillcode;
if (record) {
pk = record.creqpickmid.value;
vbillcode = record.vbillcode.value;
} else {
pk = props.table.getCheckedRows(tableId)[0].data.values.creqpickmid.value;
vbillcode = props.table.getCheckedRows(tableId)[0].data.values.vbillcode.value;
}
let fileManage = {
creqpickmid: pk,
showUploader: true,
// target: event.target, //确定弹窗位置,不传则默认为正中央
vbillcode: vbillcode
};
this.setState(fileManage);
}
const addBtnClick = function () {
//清除表头表体数据
//clearData.call(this);
//设置默认值
//表头字段编辑性控制
//this.props.initMetaByPkorg(FIELD.pk_org_v);
this.props.pushTo('/card', {
status: STATUS.add
})
}
const deleteBtnClick = function (props, record, index) {
let rows;
if (record && record.creqpickmid) {
rows = [
{
index: index,
data: {
values: record
}
}
]
doDelete.call(this, this.props, record, rows)
} else {
rows = this.props.table.getCheckedRows(tableId);
// 如果没有选中行,则提示并返回,不进行任何操作
if (rows.length <= 0) {
toast({
color: 'warning',
content: getLangByResId(this, '5008ReqPickm-0000011')/* 国际化处理: 请选择需要删除的数据!*/
});
return;
}
showWarningDialog.call(this, getLangByResId(this, '5008ReqPickm-000009')/* 国际化处理: 删除*/,
getLangByResId(this, '5008ReqPickm-0000010')/* 国际化处理: 确定要删除吗?*/,
{ beSureBtnClick: doDelete.bind(this, this.props, null, rows) });
}
}
const doDelete = function (props, record, rows) {
// 获取待删除表格行的行号
let indexs = [];
rows.map((item) => {
indexs.push(item.index);
});
// 执行删除操作
let delRows = [];
rows.map((item) => {
let data = {
id: item.data.values[ReqPickmListInfo.pk_item].value,
ts: item.data.values.ts.value
};
delRows.push(data);
}); // 拼装json
let data = {
deleteInfos: delRows,
pageid: pageId,
iscard: false
};
ajax({
url: URL.batchDelete,
data: data,
success: (res) => {
if (res.data) {
if (JSON.stringify(res.data.errorMessageMap || {}) != '{}') {
// 成功的index
let sucIndex = [];
rows.forEach((element, index) => {
if (!res.data.errorMessageMap[index]) {
deleteCacheDataForList(props, tableId, element.data.values.creqpickmid.value);
sucIndex.push(element.index);
}
});
props.table.deleteTableRowsByIndex(tableId, sucIndex);
} else {
let succIndex = [];
rows.forEach((element, index) => {
deleteCacheDataForList(props, tableId, element.data.values.creqpickmid.value);
succIndex.push(element.index);
});
props.table.deleteTableRowsByIndex(tableId, succIndex);
}
let tabCode = getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource)
let currentTab = tabCode && tabCode != null ? tabCode : TabCode.All.code;
buttonController.initButtons.call(this, props, currentTab);
if (record && record.creqpickmid) {
showSuccessInfo(getLangByResId(this, '5008ReqPickm-0000039')); /* 国际化处理: 删除成功!*/
}
else{
showBatchOprMessage.call(this, null, res.data, {}, getLangByResId(this, '5008ReqPickm-000009'));
}
} else {
toast({ content: getLangByResId(this, '5008ReqPickm-0000047') /* 国际化处理: 删除失败!'*/, color: 'error' });
}
}
});
}
const editBtnClick = function (props, record, index) {
let canDoEdit = tableBeforeEdit.call(
this,
props,
this.props.getAppCode(),
pageId,
ReqPickmListInfo.tableId,
record.creqpickmid.value,
record.ts.value);
if(canDoEdit){
let rows;
if (record && record.creqpickmid) {
rows = [
{
index: index,
data: {
values: record
}
}
]
} else {
rows = this.props.table.getCheckedRows(tableId);
if (rows.length <= 0) {
toast({
color: 'warning',
content: getLangByResId(this, '5008ReqPickm-0000012')/* 国际化处理: 请选择需要修改的数据!*/
});
return;
} else if (rows.length > 1) {
toast({
color: 'warning',
content: getLangByResId(this, '5008ReqPickm-0000013')/* 国际化处理: 请最多选择一条数据进行修改!*/
});
return;
}
}
let conditionData = {
pks: [rows[0].data.values[ReqPickmListInfo.pk_item].value],
pageid: pageId,
status: props.getUrlParam(STATUS.status)
};
ajax({
url: URL.editReqPickmCardURL,
data: conditionData,
method: 'POST',
success: (res) => {
let data = {};
data[STATUS.status] = STATUS.edit;//修改数据状态
data[pk_item] = rows[0].data.values[ReqPickmListInfo.pk_item].value;
data.id = rows[0].data.values[ReqPickmListInfo.pk_item].value;
this.props.pushTo('/card', data);
}
});
}
}
const refreshBtnClick = function () {
searchBtnClick.call(this, true);
}
const copyBtnClick = function (props, record, index) {
let rows;
if (record && record.creqpickmid) {
rows = [
{
index: index,
data: {
values: record
}
}
]
} else {
rows = this.props.table.getCheckedRows(tableId);
if (rows.length <= 0) {
toast({
color: 'warning',
content: getLangByResId(this, '5008ReqPickm-0000019')/* 国际化处理: 请选择要复制的数据!*/
});
return;
} else if (rows.length > 1) {
toast({
color: 'warning',
content: getLangByResId(this, '5008ReqPickm-0000020')/* 国际化处理: 请最多选择一条数据进行复制!*/
});
return;
}
}
let data = {};
data[STATUS.status] = STATUS.add;//修改数据状态
data[pk_item] = rows[0].data.values[ReqPickmListInfo.pk_item].value;
data.id = rows[0].data.values[ReqPickmListInfo.pk_item].value;
data.copy = true;
this.props.pushTo('/card', data);
}
const searchBtnClick = function (isRefresh = false) {
let queryInfo;
if (true == isRefresh) {
queryInfo=getDefData(ReqPickmCache.queryInfo, ReqPickmCache.dataSource);
if(!queryInfo||!queryInfo.querycondition){
showWarningInfo(getLangByResId(this, '5008ReqPickm-0000071'));
return;
}
}
else {
let searchVal = this.props.search.getAllSearchData(searchId);//必输项为空时返回值为false
if (!searchVal) {
return;
}
//点击查询区域的查询按钮
queryInfo = this.props.search.getQueryInfo(searchId, true);
// 查询
// 将查询条件缓存
setDefData(ReqPickmCache.queryInfo, ReqPickmCache.dataSource, queryInfo);
}
//如果searchVal有值说明是点击查询进入没有值说明是点击翻页过来的需要从缓存中获取
let tabCode = getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource)
let currentTab = tabCode && tabCode != null ? tabCode : TabCode.All.code;
let pageInfo = this.props.table.getTablePageInfo(tableId);
commonSearch.call(this, currentTab, queryInfo, pageInfo, true, isRefresh);
}
const tabChange = function (tabCode) {
setDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource, tabCode);
let queryInfo = getDefData(ReqPickmCache.queryInfo, ReqPickmCache.dataSource);
//let queryInfo = this.props.search.getQueryInfo(searchId);
if (queryInfo && queryInfo.querycondition) {
let pageInfo = this.props.table.getTablePageInfo(tableId);
pageInfo.index = 0;
commonSearch.call(this, tabCode, queryInfo, pageInfo, false);
}
//页签切换重置按钮
buttonController.initButtons.call(this, this.props, tabCode);
}
//双击进入卡片态
const doubleClick = function (record) {
let data = {};
// let searchVal = this.props.search.getAllSearchData(searchId);
// cacheTools.set("searchParams", searchVal);
data[STATUS.status] = STATUS.browse;
data[pk_item] = record[pk_item].value;
data.id = record[pk_item].value;
this.props.pushTo('/card', data);
}
const pageInfoClick = function (props, config, pks) {
let pageInfo = this.props.table.getTablePageInfo(tableId);
setDefData(ReqPickmCache.pageInfo, ReqPickmCache.dataSource, pageInfo); //缓存分页信息
let _this = this;
let data = {
pks: pks,
pagecode: pageId
};
//得到数据渲染到页面
ajax({
url: URL.currentpage,
data: data,
success: function (res) {
let { success, data } = res;
if (success) {
if (data) {
_this.props.table.setAllTableData(tableId, data[tableId]);
} else {
_this.props.table.setAllTableData(tableId, { rows: [] });
}
buttonController.initButtons.call(_this,_this.props);
}
}
});
};
export {
buttonClick,
searchBtnClick,
tabChange,
doubleClick,
pageInfoClick
}

View File

@ -0,0 +1,70 @@
import { ajax,toast,cardCache } from 'nc-lightapp-front';
import {URL, TabCode, STATUS, ReqPickmCache, ReqPickmListInfo, ReqPickmCardInfo, ListButton} from '../../../constance'
const { pageId,headAction,searchId,tableId,pk_item}=ReqPickmListInfo;
let {setDefData,getDefData } = cardCache;
import {showHasQueryResultInfo,showRefreshInfo} from '../../../../../../mmpub/mmpub/pub/tool/messageUtil';
import { buttonController } from '../../viewController';
const commonSearch = function(tabCode, queryInfo, pageInfo,showSuccess,isRefresh){
setDefData(ReqPickmCache.curTabCode,ReqPickmCache.dataSource,tabCode);
let ReqPickmData = {
pageCode: pageId,
templetid: tableId,
isNeedOrgPeimission: true,
currentTab: tabCode,
queryInfo: {
...queryInfo,
pageInfo: pageInfo
}
};
ajax({
url: URL.queryList,
data: ReqPickmData,
success: (res) => {
if(res.data.currentGrid){
this.props.table.setAllTableData(tableId, res.data.currentGrid[tableId])
}else{
let tableData = {
allPks: [],
rows: []
}
this.props.table.setAllTableData(tableId, tableData);
//toast({ content: getLangByResId(this, '5008ReqPickm-000004') })
}
setDefData(ReqPickmCache.tabNum,ReqPickmCache.dataSource,res.data.tabNum);
this.setState({
executNum: res.data.tabNum.executing ? res.data.tabNum.executing : 0,
allNum: res.data.tabNum.all ? res.data.tabNum.all : 0
});
buttonController.initButtons.call(this, this.props, getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource))
if(showSuccess){
if(true==isRefresh){
showRefreshInfo();
}
else{
showHasQueryResultInfo();
}
}
// if(showSuccess&&res.data.currentGrid&&res.data.currentGrid[tableId]&&res.data.currentGrid[tableId].rows.length>0){
// toast({
// duration: 3, // 消失时间默认是3秒; 值为 infinity 时不消失,非必输
// color: 'success', // 提示类别,默认是 "success",非必输
// title: "已成功", // 提示标题, 默认不同类别下分别为:"已成功"/"帮助信息"/"请注意"/"出错啦",非必输
// content: getLangByResId(this, '5008ReqPickm-000008')/* 国际化处理: 查询成功*/, // 提示内容,非必输
// groupOperation: false, //批量操作默认值是false批量操作是true非批量操作是false,非必输
// TextArr: TextArr, //提示框按钮文字,第一个值是展按钮未展开时,第二个值是展开按钮展开时,第三个值是关闭,批量操作必输
// groupOperationMsg: groupOperationMsg, //数组的每一项,是批量操作之后数据处理结果的描述,非必输
// onExpand: null, // 点击展开按钮的回调函数,非必输
// onClose: onClose // 关闭按钮的回调函数,非必输
// });
//}
}
})
}
export {
commonSearch,//查询服务
}

View File

@ -0,0 +1,38 @@
import multiCorpRefHandler from '../../../../../mmpub/mmpub/pub/tool/MultiCorpRefHandler';
import { ReqPickmListInfo } from '../../constance';
const { searchId } = ReqPickmListInfo;
export default function afterEvent(field, val) {
//TODO
if (field === 'pk_org') {
let fields = [
'tab_detail.cmaterialvid','tab_detail.cmaterialid','tab_detail.cmaterialid.code',
'tab_sum.cmaterialid','tab_sum.cmaterialvid','tab_sum.cmaterialid.code',
'tab_sum.cfeedid','tab_sum.cfeedid.vfeedpointcode','tab_detail.cfeedid','tab_detail.cfeedid.vfeedpointcode',
'tab_detail.cwkid','tab_detail.cwkid.vwkcode','tab_sum.cwkid','tab_sum.cwkid.vwkcode',
'tab_detail.cbvendorid','tab_detail.cbprojectid','tab_detail.cbproductorid','tab_detail.cbcustomerid',
'tab_sum.cbvendorid','tab_sum.cbprojectid','tab_sum.cbproductorid','tab_sum.cbcustomerid',
'tab_detail.cdeptid','tab_detail.cdeptid.code','tab_sum.cdeptid','tab_sum.cdeptid.code',
'creator'
]
.concat(getDefFieldArray('vdef', 20))//表头自定义项
.concat(getDefFieldArray('tab_detail.vbfree', 10))//表体自定义项和自由辅助属性
.concat(getDefFieldArray('tab_detail.vbdef', 20))
.concat(getDefFieldArray('tab_sum.vfree', 10))
.concat(getDefFieldArray('tab_sum.vdef', 20));
multiCorpRefHandler.call(this,this.props, val, searchId, fields);
}else if(field === 'tab_detail.cdeliverorgid'){
multiCorpRefHandler.call(this,this.props, val, searchId, ['tab_detail.coutstockid']);
}else if(field === 'tab_sum.cdeliverorgid'){
multiCorpRefHandler.call(this,this.props, val, searchId, ['tab_sum.coutstockid']);
}
}
function getDefFieldArray(prefix, count) {
let fields = [];
for (let i = 1; i <= count; i++) {
fields.push(prefix + i);
}
return fields;
}

View File

@ -0,0 +1,200 @@
/**
* @PageInfo:备料申请单列表态页面
*
*/
import React, { Component } from 'react';
import { createPage, cardCache, base, high, createPageIcon } from 'nc-lightapp-front';
const { NCTabsControl, NCDiv } = base;
let { getDefData,setDefData } = cardCache;
const { BillTrack } = high;
import NCUploader from 'uap/common/components/NCUploader'
import initTemplate from './init/initTemplate';
import { buttonClick, searchBtnClick, tabChange, doubleClick, pageInfoClick } from './btnClicks';
import { TabCode, ListButton, ReqPickmCache, ReqPickmListInfo, Field, billType } from '../constance';
import { buttonController } from './viewController';
import search_afterEvent from './events/search_afterEvent'
const { pageId, searchId, tableId, headAction } = ReqPickmListInfo;
import { transtypeUtils } from '../../../../mmpub/mmpub/pub/tool';
import { initLang, getLangByResId } from '../../../../mmpub/mmpub/pub/tool/multiLangUtil';
class ReqpickmList extends Component {
constructor(props) {
super(props);
props.use.search(searchId);
props.use.table(tableId);
this.state = {
executNum: 0, //执行中单据数量
allNum: 0, //全部数量
curTabCode: TabCode.All.value,//默认页签
showModal: false, //模态框
showTrack: false, //单据追溯
target: null, //弹出上传控件位置
showUploader: false,
vbillcode: '', //备料申请单据号
creqpickmid: ''
};
this.selectedRowRecord = null; //选中的行
this.searchVal = null; //查询条件的缓存
initLang(this, ['5008ReqPickm'], 'mmpac', initTemplate.bind(this, this.props));
}
componentDidMount() { }
// 附件管理关闭
onHideUploader = () => {
this.setState({
showUploader: false
});
};
renderCompleteEvent = () => {
//发布的交易类型设置默认值
transtypeUtils.setQueryDefaultValue.call(this, this.props, searchId, Field.crequesttype);
let pk_org = this.props.search.getSearchValByField(searchId, Field.pk_org);
if (pk_org && pk_org.value && pk_org.value.firstvalue) {
let value = pk_org.value.firstvalue;
let arr = value.split(',');
arr = arr.map((item) => {
return { refpk: item };
});
search_afterEvent.call(this, Field.pk_org, arr);
}
};
getDefaultKey = () => {
let tabcode = TabCode.Executing.code;
let currentTab = getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource);
if (currentTab) {
tabcode = currentTab;
} else {
setDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource, tabcode);
}
if(tabcode==TabCode.All.code){
return TabCode.All.value;
}
else if(tabcode==TabCode.Executing.code){
return TabCode.Executing.value;
}
else {
return TabCode.All.value;
}
}
render() {
let { table, button, search, base, modal, socket, BillHeadInfo } = this.props;
let buttons = this.props.button.getButtons();
buttons = buttons.sort((a, b) => {
return b.btnorder - a.btnorder;
});
let _this = this;
let { createSimpleTable } = table; //引入表格区
let { NCCreateSearch } = search; //引入查询区
let { createModal } = modal
let { createButtonApp } = button;
const { createBillHeadInfo } = BillHeadInfo;
return (
<div className='nc-bill-list' >
{socket.connectMesg({
tableAreaCode: tableId,
billpkname: Field.creqpickmid,
billtype: billType
})}
<NCDiv areaCode={NCDiv.config.HEADER} className='nc-bill-header-area' >
<div className='header-title-search-area' >
{createBillHeadInfo({
title: this.props.getSearchParam('n'),//getLangByResId(this, '5008ReqPickm-000001'),
initShowBackBtn: false
})}
</div>
{/* 按钮区 */}
<div className="header-button-area" >
{
createButtonApp({
area: headAction,
buttonLimit: 3,
onButtonClick: buttonClick.bind(this),
popContainer: document.querySelector('.header-button-area')
})
}
</div>
</NCDiv>
{/* 查询展示区域 */}
<div className="nc-bill-search-area" >
{
NCCreateSearch(searchId, {
clickSearchBtn: searchBtnClick.bind(this),
onAfterEvent: search_afterEvent.bind(this),
renderCompleteEvent: this.renderCompleteEvent,
statusChangeEvent: this.renderCompleteEvent,
dataSource: ReqPickmCache.dataSource,
pkname: Field.creqpickmid
})
}
</div>
{/* 页签区域 */}
<div className="tab-definInfo-area">
<NCTabsControl defaultKey={this.getDefaultKey()}>
<div key={TabCode.Executing.value} clickFun={tabChange.bind(this, TabCode.Executing.code)}>
<h2> {getLangByResId(this, '5008ReqPickm-000002') + '(' + this.state.executNum + ')'} {/**执行中*/}</h2>
</div>
<div key={TabCode.All.value} clickFun={tabChange.bind(this, TabCode.All.code)}>
<h2> {getLangByResId(this, '5008ReqPickm-000003')} {/**全部*/}</h2>
</div>
</NCTabsControl>
</div>
{/* 列表区域 */}
<div className="nc-bill-table-area" >
{
createSimpleTable(tableId, {
handlePageInfoChange: pageInfoClick.bind(this),
dataSource: ReqPickmCache.dataSource,
pkname: Field.creqpickmid,
//tableModelConfirm: this.tableModelConfirm,
showIndex: true,
showCheck: true,
// onRowClick: onRowClick.bind(this),
onSelected: buttonController.initButtons.bind(this, this.props, getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource)),
onSelectedAll: buttonController.initButtons.bind(this, this.props, getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource)),
onBatchSelected:buttonController.initButtons.bind(this, this.props, getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource)),
onRowDoubleClick: doubleClick.bind(this),
componentInitFinished: buttonController.initButtons.bind(this, this.props, getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource))
})
}
</div>
{/* 单据追溯 */}
<BillTrack
show={this.state.showTrack}
close={() => {
this.setState({ showTrack: false });
}}
pk={this.state.creqpickmid}
type="55AC"
/>
{/* 附件管理 */}
{this.state.showUploader && (
<NCUploader
billId={this.state.creqpickmid}
onHide={this.onHideUploader}
billNo={this.state.vbillcode}
/>
)}
{createModal(ListButton.Delete)}
{createModal('MessageDlg')}
</div>
);
}
}
ReqpickmList = createPage({
// initTemplate: [],
// mutiLangCode: '5008ReqPickm',
billinfo: {
billtype: 'grid',
pagecode: pageId,
bodycode: tableId
}
})(ReqpickmList);
export default ReqpickmList;

View File

@ -0,0 +1,2 @@
import initTemplate from './initTemplate';
export { initTemplate };

View File

@ -0,0 +1,352 @@
import { ajax, cacheTools, toast, cardCache, getGlobalStorage, removeGlobalStorage } from 'nc-lightapp-front';
import { URL, TabCode, ReqPickmListInfo, ReqPickmCache, ListButton, Field, Field_detail, STATUS } from '../../constance';
import { buttonController } from '../viewController'
import { buttonClick } from '../btnClicks'
let { setDefData, getDefData } = cardCache;
const { pageId, searchId, tableId, pk_item, listInnerAction } = ReqPickmListInfo;
import { getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import { transtypeUtils, setPsndocShowLeavePower, setRefShowDisabledData } from '../../../../../mmpub/mmpub/pub/tool';
export default function () {
this.props.createUIDom(
{
pagecode: pageId //列表页面的id
},
(data) => {
if (data) {
//发布的交易类型设置
transtypeUtils.init.call(this, data.context);
if (data.template) {
let meta = data.template;
meta[tableId].pagination = true;//控制分页控件是否显示
//发布的交易类型设置
transtypeUtils.initQuery.call(this, this.props, meta, searchId, Field.crequesttype);
meta = modifierMeta.call(this, this.props, meta)
this.props.meta.setMeta(meta);
//initData.call(this);
let { hasCacheData } = this.props.table;
let searchVal = cacheTools.get('searchParams')
if (!hasCacheData(ReqPickmCache.dataSource)) {
//initData.call(this);
} else {
let tabNum = getDefData(ReqPickmCache.tabNum, ReqPickmCache.dataSource);
let curTabCod = getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource);
this.setState({
executNum: tabNum ? (tabNum.executing ? tabNum.executing : 0) : 0,
allNum: tabNum ? (tabNum.all ? tabNum.all : 0) : 0,
curTabCode: curTabCod ? (curTabCod == "executing" ? 0 : 1) : 1
});
}
}
if (data.button) {
let button = data.button;
this.props.button.setButtons(button);
this.props.button.setPopContent(
ListButton.Delete, getLangByResId(this, '5008ReqPickmPUBMESSAGE-000010')/* 国际化处理: 确认删除?*/
);
}
// 初始化按钮状态
buttonController.initButtons.call(this, this.props, getDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource));
//判断生产模式1-流程2-离散
let appcode = this.props.getAppCode();
if (appcode.startsWith('5008')) {
setDefData('fprodmode', ReqPickmCache.dataSource, parseInt(1));
} else if (appcode.startsWith('5009')) {
setDefData('fprodmode', ReqPickmCache.dataSource, parseInt(2));
}
//处理生产大屏数据穿透
process4dashboard.call(this);
}
}
)
}
function modifierMeta(props, meta) {
//查询区参照过滤
meta[searchId].items.map((item) => {
setPsndocShowLeavePower(item);
setRefShowDisabledData(item);
if (item.attrcode == Field.pk_org) {
//设置可多选
item.isMultiSelectedEnabled = true;
//主组织权限过滤
item.queryCondition = () => {
return { GridRefActionExt: 'nccloud.web.mmpub.pub.ref.AppPermissionOrgRefFilter' };
}
} else if (item.attrcode == Field.crequesttype) {//单据类型
//设置可多选
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
return {
parentbilltype: '55AC'
};
};
}
else if (item.attrcode == Field.fbillstatus) {//备料申请状态
//设置可多选
item.isMultiSelectedEnabled = true;
}
else if (item.attrcode == 'tab_detail.cmaterialid' || item.attrcode == 'tab_sum.cmaterialid') {//物料
//设置可多选
item.isMultiSelectedEnabled = true;
//显示业务单元
item.isShowUnit = true;
item.queryCondition = () => {
let pk_org = props.search.getSearchValByField(searchId, Field.pk_org);
let condition = {};
condition.pk_org = pk_org != null ? (pk_org.value.firstvalue.includes(',') ? null : pk_org.value.firstvalue) : null;
condition.GridRefActionExt = 'nccloud.web.mmpub.pub.ref.MaterialRefSqlBuilder';
condition.matchmode = 2;
return condition;
};
}
// 配置码
else if (item.attrcode == 'tab_sum.cffileid') {
debugger;
item.queryCondition = () => {
let cmaterialid = props.search.getSearchValByField(searchId, 'tab_sum.cmaterialid').value.firstvalue;
let condition = {};
condition.pk_group = window.parent.GETBUSINESSINFO().groupId;
condition.cmaterialid = cmaterialid;
return condition;
};
}
else if (item.attrcode == 'tab_detail.cbffileid') {
debugger;
item.queryCondition = () => {
let cmaterialid = props.search.getSearchValByField(searchId, 'tab_detail.cmaterialid').value.firstvalue;
let condition = {};
condition.pk_group = window.parent.GETBUSINESSINFO().groupId;
condition.cmaterialid = cmaterialid;
return condition;
};
}
else if (item.attrcode == 'tab_detail.cdeptvid' || item.attrcode == 'tab_detail.cdeptid' || item.attrcode == 'tab_detail.cdeptid.code'
|| item.attrcode == 'tab_sum.cdeptvid' || item.attrcode == 'tab_sum.cdeptid' || item.attrcode == 'tab_sum.cdeptid.code') {//部门
//显示业务单元
item.isShowUnit = true;
//根据pk_org 过滤其他字段
item.queryCondition = () => {
let pk_org = props.search.getSearchValByField(searchId, Field.pk_org);
let condition = {};
condition.pk_org =
pk_org && pk_org.value
? pk_org.value.firstvalue.includes(',') ? null : pk_org.value.firstvalue
: null;
condition.busifuncode = "fa";//制造场景
return condition;
};
} else if (item.attrcode == 'tab_sum.cdeliverorgid') { //汇总-发料组织
//设置可多选
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
return { GridRefActionExt: 'nccloud.web.mmpub.pub.ref.AppPermissionOrgRefFilter' };
}
} else if (item.attrcode == 'tab_sum.coutstockid') {//汇总-发料仓库
//设置可多选
item.isMultiSelectedEnabled = true;
item.isShowUnit = true;//显示业务单元
//根据发料组织过滤--如果要使用过滤必须使用oid进行过滤
item.queryCondition = () => {
let condition = {};
let cdeliverorgid = props.search.getSearchValByField(searchId, 'tab_sum.cdeliverorgid');
condition.pk_org =
cdeliverorgid && cdeliverorgid.value
? cdeliverorgid.value.firstvalue.includes(',') ? null : cdeliverorgid.value.firstvalue
: null;
return condition;
};
} else if (item.attrcode == 'tab_sum.cwkid') { //汇总-工作中心
item.isShowUnit = true;
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
let data = props.search.getSearchValByField(searchId, Field.pk_org);
data = data != null ? (data.value.firstvalue.includes(',') ? null : data.value.firstvalue) : null;
return { pk_org: data };
};
} else if (item.attrcode == 'tab_detail.cdeliverorgid') { //明细-发料组织
//设置可多选
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
return { GridRefActionExt: 'nccloud.web.mmpub.pub.ref.AppPermissionOrgRefFilter' };
}
} else if (item.attrcode == 'tab_detail.coutstockid') {//明细-发料仓库
//设置可多选
item.isMultiSelectedEnabled = true;
item.isShowUnit = true;//显示业务单元
//根据发料组织过滤--如果要使用过滤必须使用oid进行过滤
item.queryCondition = () => {
let condition = {};
let cdeliverorgid = props.search.getSearchValByField(searchId, 'tab_detail.cdeliverorgid');
condition.pk_org =
cdeliverorgid && cdeliverorgid.value
? cdeliverorgid.value.firstvalue.includes(',') ? null : cdeliverorgid.value.firstvalue
: null;
return condition;
};
} else if (item.attrcode == 'tab_detail.cwkid') { //明细-工作中心
item.isShowUnit = true;
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
let data = props.search.getSearchValByField(searchId, Field.pk_org);
data = data != null ? (data.value.firstvalue.includes(',') ? null : data.value.firstvalue) : null;
return { pk_org: data };
};
} else {
item.isShowUnit = true;
item.queryCondition = () => {
let data = props.search.getSearchValByField(searchId, 'pk_org');
data = data != null ? (data.value.firstvalue.includes(',') ? null : data.value.firstvalue) : null;
return { pk_org: data };
};
}
});
//模板table的订单编号列加超链接
meta[tableId].items = meta[tableId].items.map((item, key) => {
if (item.attrcode == Field.vbillcode) {
item.render = (text, record, index) => {
//取值前需先判断record是否为空避免没有数据的情况报错
let creqpickmid = record && record.creqpickmid && record.creqpickmid.value;
return (
<span className="code-detail-link"
onClick={() => {
this.props.pushTo('/card', {
status: STATUS.browse,
id: creqpickmid
});
}}
>
{record && record.vbillcode && record.vbillcode.value}
</span>
);
}
}
return item;
});
//添加表格操作列
let event = {
label: getLangByResId(this, '5008ReqPickm-0000042') /* 国际化处理: 操作 */,
attrcode: 'opr',
itemtype: 'customer',
fixed: 'right',
width: '200px',
visible: true,
render: (text, record, index) => {
let buttonAry = buttonController.getListOprRowButtons.call(this, record);
return this.props.button.createOprationButton(buttonAry, {
area: listInnerAction,
buttonLimit: 3,
ignoreHotkeyCode: buttonAry,
onButtonClick: (props, key) => buttonClick.call(this, props, key, text, record, index)
});
}
};
meta[tableId].items.push(event);
return meta;
}
function initData() {
//let queryInfo = this.props.search.getQueryInfo(searchId);
let queryInfo = getDefData(ReqPickmCache.queryInfo, ReqPickmCache.dataSource);
if (!queryInfo) {//查询条件没有值,直接返回
return;
}
let pageInfo = this.props.table.getTablePageInfo(tableId);
setDefData(ReqPickmCache.pageInfo, ReqPickmCache.dataSource, pageInfo);
let reqpickmData = {
currentTab: TabCode.All.code,
pageCode: pagecode,
templetid: tableId,
isNeedOrgPermission: true,
queryInfo: {
...queryInfo,
pageCode: pagecode,
pageInfo: pageInfo,
//oid: OID,  //查询模板id手工添加在界面模板json中放在查询区后期会修改
//querytype: 'simple' //查询类型simple和tree。
},
};
ajax({
url: URL.queryList,
data: reqpickmData,
success: (res) => {
if (res.data.currentGrid) {
//构建一下分页组件需要的数组
// let allPks = []
// res.data.currentGrid.list_table.rows.forEach(row => {
// allPks.push(row.values[pk_item].value)
// })
// res.data.allPks = allPks
this.props.table.setAllTableData(tableId, res.data.currentGrid[tableId]);
} else {
let tableData = {
allPks: [],
rows: []
}
this.props.table.setAllTableData(tableId, tableData);
toast({ content: getLangByResId(this, '5008ReqPickm-000004') })
}
setDefData(ReqPickmCache.tabNum, ReqPickmCache.dataSource, res.data.tabNum);
setDefData(ReqPickmCache.curTabCode, ReqPickmCache.dataSource, TabCode.All.code);
this.setState({
executNum: res.data.tabNum.executing ? res.data.tabNum.executing : 0,
allNum: res.data.tabNum.all ? res.data.tabNum.all : 0
});
}
})
// if(searchVal && searchVal != false){
// this.props.search.setSearchValue(searchId, searchVal)
// }
}
function checkButtons() {
}
function process4dashboard() {
let queryCriteria = getGlobalStorage('localStorage', 'QueryCriteria');
queryCriteria = JSON.parse(queryCriteria);
if (queryCriteria && queryCriteria.urlParam && queryCriteria.urlParam.condition) {
let condition = queryCriteria.urlParam.condition;
let pagecode = queryCriteria.urlParam.pagecode;
let pk_org = queryCriteria.urlParam.pk_org;
let dimension = queryCriteria.urlParam.dimension;
let pageInfo = this.props.table.getTablePageInfo(tableId); //分页信息
let paramdata = condition + '#' + pagecode + '#' + pk_org + '#' + dimension+'#'+pageInfo.pageSize+'#'+pageInfo.pageIndex;
ajax({
url: URL.queryByCondURL,
data: paramdata,
success: (res) => {
if (res.success) {
if (res.data) {
if(res.data.currentGrid){
this.props.table.setAllTableData(tableId, res.data.currentGrid[tableId])
}else{
let tableData = {
allPks: [],
rows: []
}
this.props.table.setAllTableData(tableId, tableData);
//toast({ content: getLangByResId(this, '5008ReqPickm-000004') })
}
let tabNum={
executNum: res.data.tabNum.executing ? res.data.tabNum.executing : 0,
allNum: res.data.tabNum.all ? res.data.tabNum.all : 0
}
setDefData(ReqPickmCache.tabNum,ReqPickmCache.dataSource,tabNum);
this.setState({
executNum: res.data.tabNum.executing ? res.data.tabNum.executing : 0,
allNum: res.data.tabNum.all ? res.data.tabNum.all : 0
});
buttonController.initButtons(this.props, condition);
}
}
removeGlobalStorage('localStorage', 'QueryCriteria');
}
});
}
}

View File

@ -0,0 +1,109 @@
import { ajax, toast, cardCache } from 'nc-lightapp-front';
import { URL, TabCode, FbillStatus,ListButton,STATUS, ReqPickmCache, ReqPickmListInfo } from './../../constance';
const { pageId, searchId, tableId, pk_item, headAction }= ReqPickmListInfo;
let { setDefData, getDefData } = cardCache;
function initButtons(props,tabCode){
let rows = props.table.getCheckedRows(tableId);
if ( tabCode == null || tabCode == '' || tabCode == undefined) {
rows.length = 0;
}
let Delete = true;
let Edit = true;
let Copy = true;
let ReqPickmDelivery = true;//备料
let ReqPickmFinish = true;//强制完成
let ReqPickmUnFinish = true;//取消完成
let File = true;//附件管理
let BillLinkQuery = true;//单据追溯
let Print = true;//打印
let Output = true;//输出
let PrintDetail = true;//打印明细
if(rows.length > 0){
BillLinkQuery = false;
File = false;
Print = false;
Output = false;
PrintDetail = false;
if(rows.length == 1){
rows.map((item) => {
let fbillstatus = item.data.values.fbillstatus.value; // 单据状态
if (fbillstatus == FbillStatus.free) {//自由
Copy = false;
Edit = false;
Delete = false;
ReqPickmDelivery = false;
ReqPickmFinish = false;
}else{
Copy = false;
ReqPickmUnFinish = false;
}
})
}else{
Delete = false;
ReqPickmDelivery = false;
ReqPickmFinish = false;
ReqPickmUnFinish = false;
}
}
let refresh=true;
let queryInfo=getDefData(ReqPickmCache.queryInfo, ReqPickmCache.dataSource);
if(queryInfo&&queryInfo.querycondition){
refresh=false;
}
let disableArr = {
[ListButton.Edit]: Edit,
[ListButton.Delete]: Delete,
[ListButton.Copy]: Copy,
[ListButton.ReqPickmDelivery]: ReqPickmDelivery,
[ListButton.ReqPickmFinish]: ReqPickmFinish,
[ListButton.ReqPickmUnFinish]: ReqPickmUnFinish,
[ListButton.File]: File,
[ListButton.BillLinkQuery]: BillLinkQuery,
[ListButton.Print]: Print,
[ListButton.Output]: Output,
[ListButton.PrintDetail]: PrintDetail,
[ListButton.Refresh]:refresh
}
props.button.setDisabled(disableArr);
}
function getListOprRowButtons(record){
let fbillstatus = record && record.fbillstatus && record.fbillstatus.value;
let buttonAry = [
ListButton.Copy,
//ListButton.ReqPickmDelivery,//备料
//ListButton.File,
//ListButton.BillLinkQuery,
//ListButton.Print,
//ListButton.Output
];
if(fbillstatus == FbillStatus.free){//自由
buttonAry = [
ListButton.Edit,
ListButton.Delete,
//ListButton.ReqPickmFinish,//强制完成
ListButton.Copy,
//ListButton.ReqPickmDelivery,//备料
//ListButton.File,
//ListButton.BillLinkQuery,
// ListButton.Print,
//ListButton.Output
];
}else if(fbillstatus == FbillStatus.complete){//完成
buttonAry = [
//ListButton.ReqPickmUnFinish,//取消完成
ListButton.Copy,
//ListButton.ReqPickmDelivery,//备料
//ListButton.File,
//ListButton.BillLinkQuery,
//ListButton.Print,
//ListButton.Output
];
}
return buttonAry;
}
export default { initButtons,getListOprRowButtons };

View File

@ -0,0 +1,27 @@
import buttonController from './buttonController';
export { buttonController };
/* [
{
"mm_wr":
{
"dbilldate": "1.624980148E12",
"pk_org": "0001A110000000007TTW"
},
"mm_wr_product":
{
"ngqualityastnum": "8.0",
"cbdeptid": "1001A11000000000008K",
"cbteamid": "2292412308984064",
"ngqualitynum": "10.0",
"cbsrcmesid": "2322976145051904",
"nbwrastnum": "18.0",
"cbshiftid": "2292466731176192",
"vbbatchcode": "OUT000000000000020210629000438",
"tbendtime": "1.624980148E12",
"cbmaterialvid": "1001A110000000003UWG",
"nbwrnum": "22.0"
}
}
] */

View File

@ -0,0 +1,4 @@
{
"dependModuleName": [ "uap/common/components/NCUploader" ],
"dependjs": [ "../../../../uap/common/components/NCUploader/index.js" ]
}

View File

@ -0,0 +1,6 @@
import {RenderRouter} from 'nc-lightapp-front'
import routes from './router'
(function main(routes, htmlTagid) {
RenderRouter(routes,htmlTagid)
})(routes,'app')

View File

@ -0,0 +1,24 @@
import { asyncComponent } from 'nc-lightapp-front'
const List = asyncComponent( () =>
import (/*webpackChunkName: "mmpac/mmpac/reqpickm/list/list"*/ /* webpackMode: "eager" */ '../list'))
const card = asyncComponent( () =>
import (/*webpackChunkName: "mmpac/mmpac/reqpickm/card/card"*/ /* webpackMode: "eager" */ '../card'))
const routes = [{
path: '/',
component: List,
exact: true
},
{
path: '/list',
component: List
},
{
path: '/card',
component: card
}
]
export default routes

View File

@ -0,0 +1,3 @@
import searchBtnClick from './searchBtnClick';
export { searchBtnClick };

View File

@ -0,0 +1,79 @@
import { ajax } from 'nc-lightapp-front';
import { STATUS,Field, ReqPickmCardInfo } from '../../constance';
import { showNoQueryResultInfo} from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
let { card_head, card_body_detail,card_body_sum,headAction,bodyAction_detail,bodyAction_sum,pk_head } = ReqPickmCardInfo;
export default function clickSearchBtn(props, searchVal) {
// let allSearchVal = props.search.getAllSearchData(this.searchId);
let queryInfo = this.props.search.getQueryInfo(this.searchId);
let conditions = queryInfo.querycondition.conditions;
let flag1 = true;
conditions.forEach(arr => {
if(arr.field == 'tab_pickm.pk_org'){ //工厂
flag1= false;
}
});
if(flag1){
let pk_org = props.props.form.getFormItemsValue(card_head, Field.pk_org).value;
conditions.push({field:'tab_pickm.pk_org',oprtype: "=",value:{firstvalue:pk_org}})
}
queryInfo.querycondition.conditions = conditions;
queryInfo.card = this.pickmCache.billvo;
queryInfo.billType = this.billType;
ajax({
url: '/nccloud/mmpac/reqpickm/computeQuery.do',
data: queryInfo,
success: (res) => {
if(res.data){
props.props.modal.close('PickmDlg');//查询成功之后,关闭备料计划查询弹窗
props.props.beforeUpdatePage();
let datas = res.data;
if(datas.head){
//pkCache = datas.head[card_head].rows[0].values[pk_head].value;
props.props.form.setAllFormValue({ [card_head]:datas.head[card_head]});
props.props.form.setFormStatus(card_head, STATUS.edit);
}
let cards = datas.bodys;
if (cards && cards[card_body_detail]) {
//props.props.cardTable.selectAllRows(card_body_detail,true);
let oldrows = props.props.cardTable.getAllRows(card_body_detail);
let rowparam = [];
oldrows.forEach( (item,index) => {
item.status = '3';
rowparam.push(index)
});
props.props.cardTable.delRowsByIndex(card_body_detail,rowparam);//删除汇总表数据
let detail_rows = cards[card_body_detail].rows;//明细表的数据
detail_rows.forEach( (row, index) => {
row.status = "2";//将行状态更新为新增态
});
let card_detail = props.props.cardTable.updateDiffDataByRowId(
card_body_detail,
cards[card_body_detail]
);
props.props.cardTable.setStatus(card_body_detail,STATUS.edit);
res.data.bodys[card_body_detail] = card_detail;
}
// if (cards && cards[card_body_sum]) {
// props.props.cardTable.setTableData(
// card_body_sum,
// cards[card_body_sum],
// null,
// true,
// true
// );
// props.props.cardTable.setStatus(card_body_sum,STATUS.edit);
// //res.data.bodys[card_body_sum] = card_sum;
// }
props.props.updatePage(card_head, [card_body_detail,card_body_sum]);
}
else{
showNoQueryResultInfo();
}
}
});
}

View File

@ -0,0 +1,10 @@
//备料计划
const Pickm_Const = {
tableId: 'compute_head', //表体区域
//appCode: '50080106',
pageId: '50080106_compute', //列表pagecode
searchId: 'compute_query',
//moduleId: '5008', //模块id
}
export default Pickm_Const;

View File

@ -0,0 +1,28 @@
import multiCorpRefHandler from '../../../../../mmpub/mmpub/pub/tool/MultiCorpRefHandler';
import Pickm_Const from '../const';
const { searchId } = Pickm_Const;
export default function afterEvent(field, val) {
//TODO
if (field === 'tab_pickm.pk_org') {
let fields = [
'tab_pickm.cmaterialid','tab_pickm.cdeptid','tab_pickm.cmaterialvid','tab_pickm.cdeptvid',
'tab_pickm.items.cbmaterialid','tab_pickm.items.cbmaterialvid','tab_pickm.items.cwkid'
]
.concat(getDefFieldArray('tab_pickm.vdef', 20))//自定义项
.concat(getDefFieldArray('tab_pickm.vfree', 10))//自由辅助属性
.concat(getDefFieldArray('tab_pickm.items.vbdef', 20))
.concat(getDefFieldArray('tab_pickm.items.vbfree', 10))
multiCorpRefHandler.call(this,this.props, val, searchId, fields);
}else if(field === 'tab_pickm.items.cdeliverorgid'){
multiCorpRefHandler.call(this,this.props, val, searchId, ['tab_pickm.items.coutstockid']);
}
}
function getDefFieldArray(prefix, count) {
let fields = [];
for (let i = 1; i <= count; i++) {
fields.push(prefix + i);
}
return fields;
}

View File

@ -0,0 +1,46 @@
import React, { Component } from 'react';
import { createPage } from 'nc-lightapp-front';
import Pickm_Const from './const';
import { searchBtnClick } from './btnClicks';
import { initTemplate } from './init';
import { renderCompleteEvent } from './init/queryAreaInit';
import search_afterEvent from './events/search_afterEvent';
import './index.less';
class PickmTable extends Component {
constructor(props){
super(props);
props.use.search(Pickm_Const.searchId);
this.props = props;
this.tableId = Pickm_Const.tableId;
this.pageId = Pickm_Const.pageId;
this.searchId = Pickm_Const.searchId;
this.pickmCache = props.pickmCache;
this.billType = props.billType;
this.setPickmCache(null);
initTemplate.call(this, this.props);
}
setPickmCache = (pickmvos) => {
let data = Object.assign({}, this.pickmCache, { pickmVO: pickmvos });
this.props.getPickmCache(data);
};
// 主渲染方法
render() {
let { search } = this.props;
let { NCCreateSearch } = search;
return (<div className="nc-bill-search-area">
{NCCreateSearch(this.searchId, {
clickSearchBtn: searchBtnClick.bind(this),
onAfterEvent: search_afterEvent.bind(this),
renderCompleteEvent: renderCompleteEvent.bind(this,this.searchId,'tab_pickm.pk_org'),//页面完成渲染之后的回调
statusChangeEvent: renderCompleteEvent.bind(this,this.searchId,'tab_pickm.pk_org')//4个状态simple-简单查询,查询方案-plan高级里的普通-normal高级里的高级-super
})}
</div>
);
}
}
PickmTable = createPage({})(PickmTable);
export default PickmTable;

View File

@ -0,0 +1,4 @@
.wui-modal .reqpickmModal-query .wui-modal-content {
height: 150px;
width: 1100px;
}

View File

@ -0,0 +1,3 @@
import initTemplate from './initTemplate';
export { initTemplate };

View File

@ -0,0 +1,110 @@
import Pickm_Const from '../const';
let tableId = Pickm_Const.tableId;
let pagecode = Pickm_Const.pageId;
//let appcode = Pickm_Const.appCode;
let searchId = Pickm_Const.searchId;
export default function(props) {
props.createUIDom(
{
//appcode: appcode,
pagecode: pagecode //卡片页面编码
},
callbackFun
);
function callbackFun(data) {
if (data) {
if (data.template) {
let meta = data.template;
// 处理参照过滤
meta = searchRefFilter(props, meta);
props.meta.setMeta(meta);
//设置查询区工厂的默认值
setQueryDefault(props,meta);
}
if (data.button) {
let button = data.button;
props.button.setButtons(button);
}
}
}
}
//为查询区赋默认值
function setQueryDefault(props, meta) {
let pk_org = props.props.form.getFormItemsValue('card_head', 'pk_org');
let data = [{
"field": 'tab_pickm.pk_org',
"value": { "firstvalue": pk_org.value},
"display": pk_org.display,
"oprtype": "="
}];
props.search.setSearchValue(searchId, data);
}
function searchRefFilter(props, meta) {
meta[searchId].items.map((item) => {
if (item.attrcode == 'tab_pickm.pk_org') { //工厂
//设置默认值
let pk_org = props.props.form.getFormItemsValue('card_head', 'pk_org');
item.initialvalue = {
display: pk_org.display,
value: pk_org.value
};
item.queryCondition = () => {
//主组织权限过滤
return { GridRefActionExt: 'nccloud.web.mmpub.pub.ref.AppPermissionOrgRefFilter' }
};
}else if(item.attrcode == 'tab_pickm.items.cdeliverorgid'){ //发料组织
//设置可多选
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
//主组织权限过滤
return { GridRefActionExt: 'nccloud.web.mmpub.pub.ref.AppPermissionOrgRefFilter' }
};
}else if(item.attrcode == 'tab_pickm.cmaterialid' || item.attrcode == 'tab_pickm.items.cbmaterialid'){ // 产品 物料
//设置可多选
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
let pk_org = props.props.form.getFormItemsValue('card_head', 'pk_org').value;
let condition = {};
condition.pk_org = pk_org;
condition.discountflag = 'N';//是否折扣
condition.fee = 'N';//是否费用
condition.GridRefActionExt = 'nccloud.web.mmpub.pub.ref.MaterialRefSqlBuilder';
return condition;
};
}else if(item.attrcode == 'tab_pickm.items.coutstockid'){ // 发料仓库
//显示业务单元
item.isShowUnit = true;
//设置可多选
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
let data = props.search.getSearchValByField(searchId, 'tab_pickm.items.cdeliverorgid');
data = data != null ? (data.value.firstvalue.includes(',') ? null : data.value.firstvalue) : null;
return { pk_org: data };
};
}else if(item.attrcode == 'tab_pickm.cdeptid'){ // 用料部门
//设置可多选
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
let pk_org = props.props.form.getFormItemsValue('card_head', 'pk_org').value;
return {
pk_org: pk_org,
busifuncode: 'fa'//制造场景
};
};
}else if(item.attrcode == 'tab_pickm.items.cwkid'){ // 工作中心
//设置可多选
item.isMultiSelectedEnabled = true;
item.queryCondition = () => {
let pk_org = props.props.form.getFormItemsValue('card_head', 'pk_org').value;
return {
pk_org: pk_org
};
};
}
})
return meta;
}

View File

@ -0,0 +1,57 @@
import multiCorpRefHandler from '../../../../../mmpub/mmpub/pub/tool/MultiCorpRefHandler';
import Pickm_Const from './../const';
/**
* 为查询区赋初始值
* @param {查询区id} moduleId
* @param {初始化的字段} orgfield
*/
function renderCompleteEvent(moduleId, orgfield) {
//为查询区设置默认值
let pk_org = this.props.props.form.getFormItemsValue('card_head', 'pk_org');
//查询区赋值
this.props.search.setSearchValByField(moduleId,orgfield,{
display: pk_org.display,
value: pk_org.value
});
// //预置方案赋值
// this.props.search.setSearchValByField(moduleId,orgfield,{
// display: pk_org.display,
// value: pk_org.value
// },'plan');
// //点高级-普通查询区赋值
// this.props.search.setSearchValByField(moduleId,orgfield,{
// display: pk_org.display,
// value: pk_org.value
// },'normal');
// //点高级-高级查询区赋值
// this.props.search.setSearchValByField(moduleId,orgfield,{
// display: pk_org.display,
// value: pk_org.value
// },'super');
//
let pk_org1 = this.props.search.getSearchValByField(moduleId, orgfield);
if (pk_org1 && pk_org1.value && pk_org1.value.firstvalue) {
let value = pk_org1.value.firstvalue;
let arr = value.split(',');
arr = arr.map((item) => {
return { refpk: item };
});
searchAfterEvent.call(this,orgfield, arr);
}
}
function searchAfterEvent(field,val){
//TODO
if (field === 'tab_pickm.pk_org') {
let fields = [
'tab_pickm.items.cbmaterialid','tab_pickm.items.cbmaterialvid','tab_pickm.items.cwkid',
'tab_pickm.cdeptid','tab_pickm.cdeptvid',
]
multiCorpRefHandler.call(this,this.props, val, Pickm_Const.searchId, fields);
}else if(field === 'tab_pickm.items.cdeliverorgid'){
multiCorpRefHandler.call(this,this.props, val, Pickm_Const.searchId, ['tab_pickm.items.coutstockid']);
}
}
export { renderCompleteEvent };