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