精密物料标志增加控制
This commit is contained in:
		
							parent
							
								
									45c1edf410
								
							
						
					
					
						commit
						0eca1cdd0f
					
				|  | @ -5,111 +5,118 @@ | ||||||
|  */ |  */ | ||||||
| const formid = 'materialstock'; | const formid = 'materialstock'; | ||||||
| const tableid = 'materialwarh'; | const tableid = 'materialwarh'; | ||||||
| import { output,ajax, base,toast,cardCache,promptBox,print } from 'nc-lightapp-front'; | import {ajax, cardCache, output, print, promptBox, toast} from 'nc-lightapp-front'; | ||||||
| let {setDefData, getDefData } = cardCache; |  | ||||||
| import updateModalButton from './updateModalButton' | import updateModalButton from './updateModalButton' | ||||||
| export function createStockCard(props,values, ensureCall){ | 
 | ||||||
|      | let {setDefData, getDefData} = cardCache; | ||||||
|     let { button,form} = props; | 
 | ||||||
|     let { createForm } = form; | export function createStockCard(props, values, ensureCall) { | ||||||
|     let { createButtonApp } = button; | 
 | ||||||
|     let getTableHead = () =>{ |     let {button, form} = props; | ||||||
|  |     let {createForm} = form; | ||||||
|  |     let {createButtonApp} = button; | ||||||
|  |     let getTableHead = () => { | ||||||
|         return ( |         return ( | ||||||
|             <div className="shoulder-definition-area"> |             <div className="shoulder-definition-area"> | ||||||
|                 <div className="definition-icons"> |                 <div className="definition-icons"> | ||||||
|                     {createButtonApp({ |                     {createButtonApp({ | ||||||
|                         area: 'materialwarh_table_head',//按钮注册中的按钮区域
 |                         area: 'materialwarh_table_head',//按钮注册中的按钮区域
 | ||||||
|                         onButtonClick: (props,id)=>{ |                         onButtonClick: (props, id) => { | ||||||
|                             if(id==='materialwarh_add'){ |                             if (id === 'materialwarh_add') { | ||||||
|                                 let pk_org =props.form.getFormItemsValue(formid,'pk_org').value; |                                 let pk_org = props.form.getFormItemsValue(formid, 'pk_org').value; | ||||||
|                                 let org_name =props.form.getFormItemsValue(formid,'pk_org').display; |                                 let org_name = props.form.getFormItemsValue(formid, 'pk_org').display; | ||||||
|                                 let pk_group =props.form.getFormItemsValue(formid,'pk_group').value; |                                 let pk_group = props.form.getFormItemsValue(formid, 'pk_group').value; | ||||||
|                                 let rows = props.cardTable.getAllRows(tableid); |                                 let rows = props.cardTable.getAllRows(tableid); | ||||||
|                                 let index = 0; |                                 let index = 0; | ||||||
|                                 if(rows){ |                                 if (rows) { | ||||||
|                                     index = rows.length; |                                     index = rows.length; | ||||||
|                                 } |                                 } | ||||||
|                                 if(pk_org!=pk_group){ |                                 if (pk_org != pk_group) { | ||||||
|                                     props.cardTable.addRow(tableid,index,{pk_org:{value:pk_org,display:org_name}}); |                                     props.cardTable.addRow(tableid, index, { | ||||||
|                                     props.cardTable.setEditableByIndex(tableid,index,'pk_org',false); |                                         pk_org: { | ||||||
|  |                                             value: pk_org, | ||||||
|  |                                             display: org_name | ||||||
|  |                                         } | ||||||
|  |                                     }); | ||||||
|  |                                     props.cardTable.setEditableByIndex(tableid, index, 'pk_org', false); | ||||||
|                                 } |                                 } | ||||||
|                                 if(pk_org==pk_group){ |                                 if (pk_org == pk_group) { | ||||||
|                                     props.cardTable.addRow(tableid,index,{});  |                                     props.cardTable.addRow(tableid, index, {}); | ||||||
|                                 } |                                 } | ||||||
|                                 //props.cardTable.addRow(tableid);
 |                                 //props.cardTable.addRow(tableid);
 | ||||||
|                             } |                             } | ||||||
|                             if(id==='materialwarh_delete'){ |                             if (id === 'materialwarh_delete') { | ||||||
|                                 let index =props.cardTable.getCurrentIndex(tableid); |                                 let index = props.cardTable.getCurrentIndex(tableid); | ||||||
|                                 props.cardTable.delRowsByIndex(tableid,index); |                                 props.cardTable.delRowsByIndex(tableid, index); | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     })} |                     })} | ||||||
|                 </div>	 |                 </div> | ||||||
|             </div> |             </div> | ||||||
|         ) |         ) | ||||||
|     } |     } | ||||||
|     return ( |     return ( | ||||||
|         <div style={{marginTop: 40}}> |         <div style={{marginTop: 40}}> | ||||||
|         <div> |             <div> | ||||||
|             <div className="nc-bill-header-area"> |                 <div className="nc-bill-header-area"> | ||||||
|                 <div className="header-title-search-area"></div> |                     <div className="header-title-search-area"></div> | ||||||
|                 <div className="header-button-area"> |                     <div className="header-button-area"> | ||||||
|                     {createButtonApp({ |                         {createButtonApp({ | ||||||
|                         area: 'stock_table_inner', |                             area: 'stock_table_inner', | ||||||
|                         buttonLimit: 3,  |                             buttonLimit: 3, | ||||||
|                          onButtonClick: onButtonClick4STOCK.bind(this, ensureCall),  |                             onButtonClick: onButtonClick4STOCK.bind(this, ensureCall), | ||||||
|                          popContainer: document.querySelector('.header-button-area') |                             popContainer: document.querySelector('.header-button-area') | ||||||
|          | 
 | ||||||
|  |                         })} | ||||||
|  |                     </div> | ||||||
|  |                 </div> | ||||||
|  |                 <div className="nc-bill-form-area"> | ||||||
|  |                     {createForm(formid, { | ||||||
|  |                         expandArr: ['stock_base', 'stock_freeasst', 'stock_check', 'stock_atp', 'stock_realusableamount', 'stock_audit'], | ||||||
|  |                         onAfterEvent: onAfterEvent4STOCK, | ||||||
|  |                         onBeforeEvent: onBeforeEvent4STOCK | ||||||
|  |                         //onAfterEvent: this.onAfterEvent.bind(this)
 | ||||||
|  |                     })} | ||||||
|  |                 </div> | ||||||
|  |                 <div className="nc-bill-table-area"> | ||||||
|  |                     {props.cardTable.createCardTable(tableid, {//列表区
 | ||||||
|  |                         tableHead: getTableHead, | ||||||
|  |                         onAfterEvent: afteredit, | ||||||
|  |                         cancelCustomRightMenu: true, | ||||||
|  |                         useFixedHeader: true, | ||||||
|  |                         showIndex: true				//显示序号
 | ||||||
|                     })} |                     })} | ||||||
|                 </div> |                 </div> | ||||||
|             </div> |             </div> | ||||||
|             <div className="nc-bill-form-area"> |  | ||||||
|                 {createForm(formid, { |  | ||||||
|                     expandArr : ['stock_base','stock_freeasst','stock_check','stock_atp','stock_realusableamount','stock_audit'], |  | ||||||
|                     onAfterEvent : onAfterEvent4STOCK, |  | ||||||
|                     onBeforeEvent : onBeforeEvent4STOCK |  | ||||||
|                     //onAfterEvent: this.onAfterEvent.bind(this)
 |  | ||||||
|                 })} |  | ||||||
|             </div> |  | ||||||
|             <div className="nc-bill-table-area"> |  | ||||||
|                 {props.cardTable.createCardTable(tableid, {//列表区
 |  | ||||||
|                     tableHead: getTableHead, |  | ||||||
|                     onAfterEvent:afteredit, |  | ||||||
|                     cancelCustomRightMenu:true, |  | ||||||
|                     useFixedHeader:true,     |  | ||||||
|                     showIndex:true				//显示序号
 |  | ||||||
|                 })} |  | ||||||
|             </div> |  | ||||||
|         </div> |  | ||||||
|         </div> |         </div> | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function afteredit(props, moduleId, key, value, changedrows, index, record,status)  { | function afteredit(props, moduleId, key, value, changedrows, index, record, status) { | ||||||
|     if(key=='pk_org'){ |     if (key == 'pk_org') { | ||||||
|         let _index = index; |         let _index = index; | ||||||
|         let meta = props.meta.getMeta(); |         let meta = props.meta.getMeta(); | ||||||
|         meta['materialwarh'].items.forEach((item,index)=>{ |         meta['materialwarh'].items.forEach((item, index) => { | ||||||
|             if(item.attrcode === 'pk_stordoc'){ |             if (item.attrcode === 'pk_stordoc') { | ||||||
|                 meta['materialwarh'].items[index].queryCondition={ |                 meta['materialwarh'].items[index].queryCondition = { | ||||||
|                     pk_org : props.cardTable.getValByKeyAndIndex(moduleId, _index, 'pk_org').value, |                     pk_org: props.cardTable.getValByKeyAndIndex(moduleId, _index, 'pk_org').value, | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|         props.meta.setMeta(meta); |         props.meta.setMeta(meta); | ||||||
|     } |     } | ||||||
|      | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function onBeforeEvent4STOCK(props, moduleId, key, value,data){ | function onBeforeEvent4STOCK(props, moduleId, key, value, data) { | ||||||
|     //props, moduleId(区域id), key(操作的键), value(当前值),data(当前表单所有值)
 |     //props, moduleId(区域id), key(操作的键), value(当前值),data(当前表单所有值)
 | ||||||
|     if(key === 'pk_stordoc'){ |     if (key === 'pk_stordoc') { | ||||||
|         let pk_org = props.form.getFormItemsValue(formid,'pk_org'); |         let pk_org = props.form.getFormItemsValue(formid, 'pk_org'); | ||||||
|         let meta = props.meta.getMeta(); |         let meta = props.meta.getMeta(); | ||||||
|         meta['stock_base'].items.forEach((item,index) => { |         meta['stock_base'].items.forEach((item, index) => { | ||||||
|             if(item.attrcode === 'pk_stordoc'){ |             if (item.attrcode === 'pk_stordoc') { | ||||||
|                 item.queryCondition={ |                 item.queryCondition = { | ||||||
|                     pk_org : pk_org.value |                     pk_org: pk_org.value | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|  | @ -119,100 +126,115 @@ function onBeforeEvent4STOCK(props, moduleId, key, value,data){ | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| function onAfterEvent4STOCK(props, moduleId, key, value,oldValue){ | function onAfterEvent4STOCK(props, moduleId, key, value, oldValue) { | ||||||
|     //props, moduleId(区域id), key(操作的键), value(当前值),oldValue(旧值)
 |     //props, moduleId(区域id), key(操作的键), value(当前值),oldValue(旧值)
 | ||||||
|     let meta = props.meta.getMeta(); |     let meta = props.meta.getMeta(); | ||||||
|     let pk = value.refpk; |     let pk = value.refpk; | ||||||
|     if(key === 'pk_org'){ |     if (key === 'pk_org') { | ||||||
|         meta['materialwarh'].items.forEach(item=>{ |         meta['materialwarh'].items.forEach(item => { | ||||||
|             if(item.attrcode === 'pk_stordoc'){ |             if (item.attrcode === 'pk_stordoc') { | ||||||
|                 item.queryCondition = { |                 item.queryCondition = { | ||||||
|                     pk_org :pk |                     pk_org: pk | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|         props.meta.setMeta(meta); |         props.meta.setMeta(meta); | ||||||
|     } |     } | ||||||
|     if(key === 'isretfreeofchk'){ |     if (key === 'isretfreeofchk') { | ||||||
|         if(value.value){ |         if (value.value) { | ||||||
|             props.form.setFormItemsDisabled(formid,{isretinstobychk:true}); |             props.form.setFormItemsDisabled(formid, {isretinstobychk: true}); | ||||||
|             props.form.setFormItemsValue(formid,{isretinstobychk:{value:false,display:null}}); |             props.form.setFormItemsValue(formid, {isretinstobychk: {value: false, display: null}}); | ||||||
|         }else{ |         } else { | ||||||
|             props.form.setFormItemsDisabled(formid,{isretinstobychk:false}); |             props.form.setFormItemsDisabled(formid, {isretinstobychk: false}); | ||||||
|         } |         } | ||||||
|     }else if(key === 'serialmanaflag'){//进行序列号管理
 |     } else if (key === 'serialmanaflag') {//进行序列号管理
 | ||||||
|         if(value.value){ |         if (value.value) { | ||||||
|             props.form.setFormItemsDisabled(formid,{issinglcheck:false}); |             props.form.setFormItemsDisabled(formid, {issinglcheck: false}); | ||||||
|             props.form.setFormItemsDisabled(formid, {sernumunit: false}) |             props.form.setFormItemsDisabled(formid, {sernumunit: false}) | ||||||
|         }else{ |         } else { | ||||||
|             props.form.setFormItemsDisabled(formid,{issinglcheck:true}); |             props.form.setFormItemsDisabled(formid, {issinglcheck: true}); | ||||||
|             props.form.setFormItemsValue(formid,{issinglcheck:{value:false,display:null}}); |             props.form.setFormItemsValue(formid, {issinglcheck: {value: false, display: null}}); | ||||||
|             props.form.setFormItemsDisabled(formid, {sernumunit: true}); |             props.form.setFormItemsDisabled(formid, {sernumunit: true}); | ||||||
|             props.form.setFormItemsValue(formid,{sernumunit:{value:null,display:null}}); |             props.form.setFormItemsValue(formid, {sernumunit: {value: null, display: null}}); | ||||||
|  |         } | ||||||
|  |     } else if (key === 'def3') { | ||||||
|  |         // 精密自定义字段控制 物料标志是def3,精密产品分类是def4
 | ||||||
|  |         // console.log('def3', value.values)
 | ||||||
|  |         let codeVal = value.values.code.value; | ||||||
|  |         if (codeVal != '1') { | ||||||
|  |             // 精密物料标志”如果不是“产品”,请将字段“产品分类”设置为空值
 | ||||||
|  |             props.form.setFormItemsDisabled(formid, {def4: true}); | ||||||
|  |             props.form.setFormItemsValue(formid, {def4: {value: null, display: null}}); | ||||||
|  |         } else { | ||||||
|  |             // “精密产品分类”这个控件默认为不可操作,只有控件“精密物料标志”为“产品”时,才允许修改
 | ||||||
|  |             props.form.setFormItemsDisabled(formid, {def4: false}) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function onButtonClick4STOCK(ensureCall, props,id) { | function onButtonClick4STOCK(ensureCall, props, id) { | ||||||
|     switch(id){ |     switch (id) { | ||||||
|         case 'stock_edit': |         case 'stock_edit': | ||||||
|             let node_typep = props.config.node_type; |             let node_typep = props.config.node_type; | ||||||
|             let pk_orgp =  props.form.getFormItemsValue(formid,'pk_org').value |             let pk_orgp = props.form.getFormItemsValue(formid, 'pk_org').value | ||||||
|             let pk_groupp =  props.form.getFormItemsValue(formid,'pk_group').value; |             let pk_groupp = props.form.getFormItemsValue(formid, 'pk_group').value; | ||||||
|             if(node_typep=='ORG_NODE'&&pk_orgp==pk_groupp){ |             if (node_typep == 'ORG_NODE' && pk_orgp == pk_groupp) { | ||||||
|                 toast({content:props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000013'),color:'warning'});/* 国际化处理: 组织节点只能维护当前节点有权限组织的数据!*/  |                 toast({ | ||||||
|              |                     content: props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000013'), | ||||||
|  |                     color: 'warning' | ||||||
|  |                 });/* 国际化处理: 组织节点只能维护当前节点有权限组织的数据!*/ | ||||||
|  | 
 | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|             props.form.setFormStatus(formid,'edit'); |             props.form.setFormStatus(formid, 'edit'); | ||||||
|             props.cardTable.setStatus(tableid,'edit'); |             props.cardTable.setStatus(tableid, 'edit'); | ||||||
|             updateModalButton.call(this,props,'stock','edit'); |             updateModalButton.call(this, props, 'stock', 'edit'); | ||||||
|             props.form.setFormItemsDisabled(formid,{pk_org:true}); |             props.form.setFormItemsDisabled(formid, {pk_org: true}); | ||||||
|             if(props.form.getFormItemsValue(formid,'isretfreeofchk').value){ |             if (props.form.getFormItemsValue(formid, 'isretfreeofchk').value) { | ||||||
|                 props.form.setFormItemsDisabled(formid,{isretinstobychk:true}); |                 props.form.setFormItemsDisabled(formid, {isretinstobychk: true}); | ||||||
|             }else{ |             } else { | ||||||
|                 props.form.setFormItemsDisabled(formid,{isretinstobychk:false}); |                 props.form.setFormItemsDisabled(formid, {isretinstobychk: false}); | ||||||
|             } |             } | ||||||
|             if(props.form.getFormItemsValue(formid,'serialmanaflag').value){ |             if (props.form.getFormItemsValue(formid, 'serialmanaflag').value) { | ||||||
|                 props.form.setFormItemsDisabled(formid,{issinglcheck:false}); |                 props.form.setFormItemsDisabled(formid, {issinglcheck: false}); | ||||||
|             }else{ |             } else { | ||||||
|                 props.form.setFormItemsDisabled(formid,{issinglcheck:true}); |                 props.form.setFormItemsDisabled(formid, {issinglcheck: true}); | ||||||
|             } |             } | ||||||
|             let pk_measdoc = props.form.getFormItemsValue('material','pk_measdoc'); |             let pk_measdoc = props.form.getFormItemsValue('material', 'pk_measdoc'); | ||||||
|             let cardTableData = props.editTable.getAllRows('materialconvert'); |             let cardTableData = props.editTable.getAllRows('materialconvert'); | ||||||
|             let meta = props.meta.getMeta(); |             let meta = props.meta.getMeta(); | ||||||
|             let arr = []; |             let arr = []; | ||||||
|             if(pk_measdoc && pk_measdoc.value){ |             if (pk_measdoc && pk_measdoc.value) { | ||||||
|                 arr.push(pk_measdoc.value); |                 arr.push(pk_measdoc.value); | ||||||
|             } |             } | ||||||
|             (cardTableData || []).forEach(element => { |             (cardTableData || []).forEach(element => { | ||||||
|                 arr.push(element.values['pk_measdoc'].value); |                 arr.push(element.values['pk_measdoc'].value); | ||||||
|             }); |             }); | ||||||
|              | 
 | ||||||
|             meta['stock_base'].items.forEach((item,index)=>{ |             meta['stock_base'].items.forEach((item, index) => { | ||||||
|                 if(item.attrcode === 'sernumunit'){ |                 if (item.attrcode === 'sernumunit') { | ||||||
|                     meta['stock_base'].items[index].queryCondition={ |                     meta['stock_base'].items[index].queryCondition = { | ||||||
|                         pk_measdoc : JSON.stringify(arr), |                         pk_measdoc: JSON.stringify(arr), | ||||||
|                         GridRefActionExt:'nccloud.web.uapbd.material.action.MeasdocDefaultGridRefExt' |                         GridRefActionExt: 'nccloud.web.uapbd.material.action.MeasdocDefaultGridRefExt' | ||||||
|                     } |                     } | ||||||
|                 }else if(item.attrcode === 'pk_marpuclass'){ |                 } else if (item.attrcode === 'pk_marpuclass') { | ||||||
|                     meta['stock_base'].items[index].queryCondition={ |                     meta['stock_base'].items[index].queryCondition = { | ||||||
|                         pk_org : props.form.getFormItemsValue(formid,'pk_org').value |                         pk_org: props.form.getFormItemsValue(formid, 'pk_org').value | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|             meta['materialwarh'].items.forEach(item=>{ |             meta['materialwarh'].items.forEach(item => { | ||||||
|                 if(item.attrcode === 'pk_org'){ |                 if (item.attrcode === 'pk_org') { | ||||||
|                     item.queryCondition = { |                     item.queryCondition = { | ||||||
|                         GridRefActionExt: 'nccloud.web.uapbd.material.action.PrimaryOrgSQLBuilderByOrgType', |                         GridRefActionExt: 'nccloud.web.uapbd.material.action.PrimaryOrgSQLBuilderByOrgType', | ||||||
|                         orgType:'orgtype9' |                         orgType: 'orgtype9' | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|             meta['materialwarh'].items.forEach(item=>{ |             meta['materialwarh'].items.forEach(item => { | ||||||
|                 if(item.attrcode === 'pk_stordoc'){ |                 if (item.attrcode === 'pk_stordoc') { | ||||||
|                     item.queryCondition = { |                     item.queryCondition = { | ||||||
|                         pk_org : props.form.getFormItemsValue(formid,'pk_org').value |                         pk_org: props.form.getFormItemsValue(formid, 'pk_org').value | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|  | @ -227,63 +249,69 @@ function onButtonClick4STOCK(ensureCall, props,id) { | ||||||
|                 noCancelBtn: false,             // 是否显示取消按钮,,默认显示(false),非必输
 |                 noCancelBtn: false,             // 是否显示取消按钮,,默认显示(false),非必输
 | ||||||
|                 beSureBtnName: props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000016')/* 国际化处理: 确定*/,          // 确定按钮名称, 默认为"确定",非必输
 |                 beSureBtnName: props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000016')/* 国际化处理: 确定*/,          // 确定按钮名称, 默认为"确定",非必输
 | ||||||
|                 cancelBtnName: props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017')/* 国际化处理: 取消*/,           // 取消按钮名称, 默认为"取消",非必输
 |                 cancelBtnName: props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017')/* 国际化处理: 取消*/,           // 取消按钮名称, 默认为"取消",非必输
 | ||||||
|                 focusBody:false, |                 focusBody: false, | ||||||
|                 beSureBtnClick: () => { |                 beSureBtnClick: () => { | ||||||
|                     props.form.cancel(formid); |                     props.form.cancel(formid); | ||||||
|                     updateModalButton.call(this,props,'stock','browse'); |                     updateModalButton.call(this, props, 'stock', 'browse'); | ||||||
|                     props.cardTable.resetTableData(tableid); |                     props.cardTable.resetTableData(tableid); | ||||||
|                     props.cardTable.setStatus(tableid,'browse'); |                     props.cardTable.setStatus(tableid, 'browse'); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|             break; |             break; | ||||||
|         case 'stock_save': |         case 'stock_save': | ||||||
|             let checked = props.cardTable.checkTableRequired(tableid)&&props.form.isCheckNow(formid); |             let checked = props.cardTable.checkTableRequired(tableid) && props.form.isCheckNow(formid); | ||||||
|             if(!checked){ |             if (!checked) { | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|             let CardData = props.createMasterChildData(props.config.pagecodeValues['stock'], formid, tableid); |             let CardData = props.createMasterChildData(props.config.pagecodeValues['stock'], formid, tableid); | ||||||
|             let reqData = { |             let reqData = { | ||||||
|                 pageid : props.config.pagecodeValues['stock'], |                 pageid: props.config.pagecodeValues['stock'], | ||||||
|                 head : CardData.head, |                 head: CardData.head, | ||||||
|                 bodys : CardData.body |                 bodys: CardData.body | ||||||
|             } |             } | ||||||
|             let saveFunction = () => { |             let saveFunction = () => { | ||||||
|                 ajax({ |                 ajax({ | ||||||
|                     url : '/nccloud/uapbd/material/saveMaterialstock.do', |                     url: '/nccloud/uapbd/material/saveMaterialstock.do', | ||||||
|                     data:reqData, |                     data: reqData, | ||||||
|                     success : (res) => { |                     success: (res) => { | ||||||
|                         let {success,data} = res; |                         let {success, data} = res; | ||||||
|                             if(success){ |                         if (success) { | ||||||
|                                 let _stock_table_data = props.cardTable.getAllRows('stock'); |                             let _stock_table_data = props.cardTable.getAllRows('stock'); | ||||||
|                                 _stock_table_data.forEach((item,index) => { |                             _stock_table_data.forEach((item, index) => { | ||||||
|                                     if(item.rowid === getDefData('cacheRowid',props.config.datasource).stock){ |                                 if (item.rowid === getDefData('cacheRowid', props.config.datasource).stock) { | ||||||
|                                         _stock_table_data[index] = data.head.materialstock.rows[0]; |                                     _stock_table_data[index] = data.head.materialstock.rows[0]; | ||||||
|                                         _stock_table_data[index].rowid = getDefData('cacheRowid',props.config.datasource).stock; |                                     _stock_table_data[index].rowid = getDefData('cacheRowid', props.config.datasource).stock; | ||||||
|                                     } |  | ||||||
|                                 }); |  | ||||||
|                                 props.button.setButtonsVisible({ stock_edit : true, stock_delete : true}); |  | ||||||
|                                 props.cardTable.updateTableData('stock',_stock_table_data); |  | ||||||
|                                 props.form.setAllFormValue({ |  | ||||||
|                                     'materialstock' : { |  | ||||||
|                                         areacode : "materialstock", |  | ||||||
|                                         rows : [{ |  | ||||||
|                                             status : "0", |  | ||||||
|                                             values : data.head.materialstock.rows[0].values |  | ||||||
|                                         }] |  | ||||||
|                                     } |  | ||||||
|                                 }); |  | ||||||
|                                 if(data.bodys.materialwarh){ |  | ||||||
|                                     props.cardTable.setTableData('materialwarh',data.bodys.materialwarh); |  | ||||||
|                                 } |                                 } | ||||||
|                                 this.querychildclick('stock', true); |                             }); | ||||||
|                                 props.modal.close('stockmodal'); |                             props.button.setButtonsVisible({stock_edit: true, stock_delete: true}); | ||||||
|                                 ensureCall && ensureCall("success"); |                             props.cardTable.updateTableData('stock', _stock_table_data); | ||||||
|                                 toast({title:props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000089'),color:'success'});/* 国际化处理: 保存成功*/ |                             props.form.setAllFormValue({ | ||||||
|  |                                 'materialstock': { | ||||||
|  |                                     areacode: "materialstock", | ||||||
|  |                                     rows: [{ | ||||||
|  |                                         status: "0", | ||||||
|  |                                         values: data.head.materialstock.rows[0].values | ||||||
|  |                                     }] | ||||||
|  |                                 } | ||||||
|  |                             }); | ||||||
|  |                             if (data.bodys.materialwarh) { | ||||||
|  |                                 props.cardTable.setTableData('materialwarh', data.bodys.materialwarh); | ||||||
|                             } |                             } | ||||||
|  |                             this.querychildclick('stock', true); | ||||||
|  |                             props.modal.close('stockmodal'); | ||||||
|  |                             ensureCall && ensureCall("success"); | ||||||
|  |                             toast({ | ||||||
|  |                                 title: props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000089'), | ||||||
|  |                                 color: 'success' | ||||||
|  |                             });/* 国际化处理: 保存成功*/ | ||||||
|  |                         } | ||||||
|                     } |                     } | ||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
|             props.validateToSave(reqData,saveFunction,{'materialstock':'form',"materialwarh":'cardTable'},'extcard'); |             props.validateToSave(reqData, saveFunction, { | ||||||
|  |                 'materialstock': 'form', | ||||||
|  |                 "materialwarh": 'cardTable' | ||||||
|  |             }, 'extcard'); | ||||||
|             break; |             break; | ||||||
|         case 'stock_delete': |         case 'stock_delete': | ||||||
|             promptBox({ |             promptBox({ | ||||||
|  | @ -296,16 +324,19 @@ function onButtonClick4STOCK(ensureCall, props,id) { | ||||||
|                 cancelBtnName: props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017')/* 国际化处理: 取消*/,           // 取消按钮名称, 默认为"取消",非必输
 |                 cancelBtnName: props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017')/* 国际化处理: 取消*/,           // 取消按钮名称, 默认为"取消",非必输
 | ||||||
|                 beSureBtnClick: () => { |                 beSureBtnClick: () => { | ||||||
|                     ajax({ |                     ajax({ | ||||||
|                         url : '/nccloud/uapbd/material/delMaterialstock.do', |                         url: '/nccloud/uapbd/material/delMaterialstock.do', | ||||||
|                         data : { |                         data: { | ||||||
|                             pk : [props.form.getFormItemsValue(formid,'pk_materialstock').value], |                             pk: [props.form.getFormItemsValue(formid, 'pk_materialstock').value], | ||||||
|                             ts : [props.form.getFormItemsValue(formid,'ts').value] |                             ts: [props.form.getFormItemsValue(formid, 'ts').value] | ||||||
|                         }, |                         }, | ||||||
|                         success:(res) => { |                         success: (res) => { | ||||||
|                             if(res.success){ |                             if (res.success) { | ||||||
|                                 toast({title:props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000029')/* 国际化处理: 删除成功*/,color:'success'}); |                                 toast({ | ||||||
|  |                                     title: props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000029')/* 国际化处理: 删除成功*/, | ||||||
|  |                                     color: 'success' | ||||||
|  |                                 }); | ||||||
|                                 this.querychildclick('stock', true); |                                 this.querychildclick('stock', true); | ||||||
|                                 props.cardTable.delRowByRowId('stock',getDefData('cacheRowid',props.config.datasource).stock); |                                 props.cardTable.delRowByRowId('stock', getDefData('cacheRowid', props.config.datasource).stock); | ||||||
|                                 props.modal.close('stockmodal'); |                                 props.modal.close('stockmodal'); | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|  | @ -314,85 +345,91 @@ function onButtonClick4STOCK(ensureCall, props,id) { | ||||||
|             }); |             }); | ||||||
|             break; |             break; | ||||||
|         case 'stock_refresh': |         case 'stock_refresh': | ||||||
|             let pk = props.form.getFormItemsValue(formid,'pk_materialstock'); |             let pk = props.form.getFormItemsValue(formid, 'pk_materialstock'); | ||||||
|             ajax({ |             ajax({ | ||||||
|                 url : '/nccloud/uapbd/material/queryMaterialstock.do', |                 url: '/nccloud/uapbd/material/queryMaterialstock.do', | ||||||
|                 data : { |                 data: { | ||||||
|                     pk : pk.value, |                     pk: pk.value, | ||||||
|                     pageid : props.config.pagecodeValues['stock'] |                     pageid: props.config.pagecodeValues['stock'] | ||||||
|                 }, |                 }, | ||||||
|                 success : (res) => { |                 success: (res) => { | ||||||
|                     if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) { |                     if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) { | ||||||
|                         props.dealFormulamsg( |                         props.dealFormulamsg( | ||||||
|                             res.formulamsg,  //参数一:返回的公式对象
 |                             res.formulamsg,  //参数一:返回的公式对象
 | ||||||
|                             {                //参数二:界面使用的表格类型
 |                             {                //参数二:界面使用的表格类型
 | ||||||
|                                 "materialstock":"form", |                                 "materialstock": "form", | ||||||
|                                 "materialwarh":"cardTable" |                                 "materialwarh": "cardTable" | ||||||
|                             } |                             } | ||||||
|                         ); |                         ); | ||||||
|                     } |                     } | ||||||
|                     let { success, data} = res; |                     let {success, data} = res; | ||||||
|                     if(success){ |                     if (success) { | ||||||
|                         let _stock_table_data = props.cardTable.getAllRows('stock'); |                         let _stock_table_data = props.cardTable.getAllRows('stock'); | ||||||
|                         _stock_table_data.forEach((item,index) => { |                         _stock_table_data.forEach((item, index) => { | ||||||
|                             if(item.rowid === getDefData('cacheRowid',props.config.datasource).stock){ |                             if (item.rowid === getDefData('cacheRowid', props.config.datasource).stock) { | ||||||
|                                 _stock_table_data[index] = data.head.materialstock.rows[0]; |                                 _stock_table_data[index] = data.head.materialstock.rows[0]; | ||||||
|                                 _stock_table_data[index].rowid = getDefData('cacheRowid',props.config.datasource).stock; |                                 _stock_table_data[index].rowid = getDefData('cacheRowid', props.config.datasource).stock; | ||||||
|                             } |                             } | ||||||
|                         }); |                         }); | ||||||
|                         props.cardTable.updateTableData('stock',_stock_table_data); |                         props.cardTable.updateTableData('stock', _stock_table_data); | ||||||
|                         props.form.setAllFormValue({ |                         props.form.setAllFormValue({ | ||||||
|                             'materialstock' : { |                             'materialstock': { | ||||||
|                                 areacode : "materialstock", |                                 areacode: "materialstock", | ||||||
|                                 rows : [{ |                                 rows: [{ | ||||||
|                                     status : "0", |                                     status: "0", | ||||||
|                                     values : data.head.materialstock.rows[0].values |                                     values: data.head.materialstock.rows[0].values | ||||||
|                                 }] |                                 }] | ||||||
|                             } |                             } | ||||||
|                         }); |                         }); | ||||||
|                         if(data.bodys.materialwarh){ |                         if (data.bodys.materialwarh) { | ||||||
|                             props.cardTable.setTableData('materialwarh',data.bodys.materialwarh); |                             props.cardTable.setTableData('materialwarh', data.bodys.materialwarh); | ||||||
|                         }else{ |                         } else { | ||||||
|                             props.cardTable.setTableData('materialwarh',{rows:[]}); |                             props.cardTable.setTableData('materialwarh', {rows: []}); | ||||||
|                         } |                         } | ||||||
|                         toast({title:props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000147'),color:'success'});/* 国际化处理: 刷新成功*/ |                         toast({ | ||||||
|  |                             title: props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000147'), | ||||||
|  |                             color: 'success' | ||||||
|  |                         });/* 国际化处理: 刷新成功*/ | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|             break; |             break; | ||||||
|         case 'stock_print': |         case 'stock_print': | ||||||
|             let _print_pk = props.form.getFormItemsValue(formid,'pk_materialstock'); |             let _print_pk = props.form.getFormItemsValue(formid, 'pk_materialstock'); | ||||||
|             if(!_print_pk || !_print_pk.value){ |             if (!_print_pk || !_print_pk.value) { | ||||||
|                 return  |                 return | ||||||
|             } |             } | ||||||
|             print('pdf', |             print('pdf', | ||||||
|                 props.config.printUrls['stock'], |                 props.config.printUrls['stock'], | ||||||
|                 { |                 { | ||||||
|                     funcode : props.config.printcard.stock.funcode, |                     funcode: props.config.printcard.stock.funcode, | ||||||
|                     nodekey : props.config.printcard.stock.nodekey, |                     nodekey: props.config.printcard.stock.nodekey, | ||||||
|                     oids : [_print_pk.value] |                     oids: [_print_pk.value] | ||||||
|                 }) |                 }) | ||||||
|             break; |             break; | ||||||
|         case 'stock_output': |         case 'stock_output': | ||||||
|             let _output_pk = props.form.getFormItemsValue(formid,'pk_materialstock'); |             let _output_pk = props.form.getFormItemsValue(formid, 'pk_materialstock'); | ||||||
|             if(!_output_pk || !_output_pk.value){ |             if (!_output_pk || !_output_pk.value) { | ||||||
|                 return |                 return | ||||||
|             } |             } | ||||||
|             this.state.printConfig.url = props.config.printUrls['stock']; |             this.state.printConfig.url = props.config.printUrls['stock']; | ||||||
|             this.state.printConfig.funcode = this.config.printcard.stock.funcode; |             this.state.printConfig.funcode = this.config.printcard.stock.funcode; | ||||||
|             this.state.printConfig.nodekey = this.config.printcard.stock.nodekey; |             this.state.printConfig.nodekey = this.config.printcard.stock.nodekey; | ||||||
|             this.state.oids = [_output_pk.value]; |             this.state.oids = [_output_pk.value]; | ||||||
|             output({data:  |             output({ | ||||||
|                 Object.assign({ |                 data: | ||||||
|                     funcode:this.config.printcard.stock.funcode, |                     Object.assign({ | ||||||
|                     nodekey:this.config.printcard.stock.nodekey, |                         funcode: this.config.printcard.stock.funcode, | ||||||
|                     oids: [_output_pk.value], |                         nodekey: this.config.printcard.stock.nodekey, | ||||||
|                     outputType: "output" |                         oids: [_output_pk.value], | ||||||
|                 },{}), url: props.config.printUrls['stock']}); |                         outputType: "output" | ||||||
|  |                     }, {}), url: props.config.printUrls['stock'] | ||||||
|  |             }); | ||||||
|             // this.setState(this.state,
 |             // this.setState(this.state,
 | ||||||
|             // this.refs.childPrintOutput.open());
 |             // this.refs.childPrintOutput.open());
 | ||||||
|             break; |             break; | ||||||
|          | 
 | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | 
 | ||||||
| /*IxBctcow1BIGrqKmGp+9GGJGCX49SVZe5YUdOj8ujRA=*/ | /*IxBctcow1BIGrqKmGp+9GGJGCX49SVZe5YUdOj8ujRA=*/ | ||||||
		Loading…
	
		Reference in New Issue