diff --git a/src/uapbd/material/material_base/card/event/buttonClick.js b/src/uapbd/material/material_base/card/event/buttonClick.js index ee82b897..e2d8e1bb 100644 --- a/src/uapbd/material/material_base/card/event/buttonClick.js +++ b/src/uapbd/material/material_base/card/event/buttonClick.js @@ -15,6 +15,7 @@ const {NCTooltip} = base; export default function (props, id) { let _this = this; let {initImages, initImagesrc, initImgList, curPageIndex} = this.state; + let pks = []; switch (id) { case 'Add': ajax({ @@ -655,17 +656,35 @@ export default function (props, id) { enctype: 1 }); break; - case 'pushtoqms': + case 'dldztomes': pk = this.props.form.getFormItemsValue(formid, 'pk_material'); + pks.push(pk.value) ajax({ - url: "/nccloud/uapbd/material/pushtoqms.do", + url: "/nccloud/uapbd/material/pushtodldzmes.do", data: { - pk_material: pk.value + pks: pks }, success: (res) => { this.onButtonClick(props, 'Refresh'); toast({ - content: "推送启源qms成功", + content: "推送成功", + color: 'success' + });/* 国际化处理: 操作成功*/ + } + }) + break; + case 'pushtoqms': + pk = this.props.form.getFormItemsValue(formid, 'pk_material'); + pks.push(pk.value) + ajax({ + url: "/nccloud/uapbd/material/pushtoqms.do", + data: { + pks: pks + }, + success: (res) => { + this.onButtonClick(props, 'Refresh'); + toast({ + content: "推送成功", color: 'success' });/* 国际化处理: 操作成功*/ } @@ -673,15 +692,16 @@ export default function (props, id) { break; case 'pushtojmqy': pk = this.props.form.getFormItemsValue(formid, 'pk_material'); + pks.push(pk.value) ajax({ url: "/nccloud/uapbd/material/pushtojmqy.do", data: { - pks: pk.value + pks: pks }, success: (res) => { this.onButtonClick(props, 'Refresh'); toast({ - content: "推送启源成功", + content: "推送成功", color: 'success' });/* 国际化处理: 操作成功*/ } diff --git a/src/uapbd/material/material_base/main/index.js b/src/uapbd/material/material_base/main/index.js index 5664da62..3586b288 100644 --- a/src/uapbd/material/material_base/main/index.js +++ b/src/uapbd/material/material_base/main/index.js @@ -8,26 +8,39 @@ * @LastEditTime: 2023-11-01 09:58:57 */ -import React, { Component } from 'react'; -import ReactDOM from 'react-dom'; -import { createPage, ajax, base,high,toast,print,getBusinessInfo,cardCache,promptBox,deepClone,output,formDownload,crossTabData } from 'nc-lightapp-front'; -const { NCTooltip } = base; -import Utils from '../../../public/utils'; +import React, {Component} from 'react'; +import { + ajax, + base, + cardCache, + createPage, + crossTabData, + deepClone, + formDownload, + getBusinessInfo, + high, + output, + print, + promptBox, + toast +} from 'nc-lightapp-front'; import AssignStepModal from '../excomponents/assign/AssignStepModal'; import AssignModal from '../excomponents/assign/AssignModal'; import excelImportconfig from 'uap/common/components/excelImportconfig'; import ExcelOutput from 'uap/common/components/ExcelOutput'; import NCUploader from 'uap/common/components/NCUploader'; -import OrgDoc from '../excomponents/OrgDoc'; +import OrgDoc from '../excomponents/OrgDoc'; import MarOrg from '../excomponents/MarOrg'; import AssignStatus from '../excomponents/AssignStatus'; import './index.less'; import Batcheditmodal from '../excomponents/batchEdit/BatchEditModal'; import Batcheditstepmodal from '../excomponents/batchEdit/BatchEditStepModal'; -let {setDefData, getDefData } = cardCache; +const {NCTooltip} = base; + +let {setDefData, getDefData} = cardCache; const {PrintOutput} = high; -const {NCButton,NCDiv,NCUpload} = base; +const {NCButton, NCDiv, NCUpload} = base; let pagecode = '10140MAG_base_list'; let pagecodeValues = {}; let node_type; @@ -35,122 +48,123 @@ const tableid = 'material'; const searchid = 'material_search'; let appid = '0001Z0100000000019GO'; const urls = { - "exporturl":"/nccloud/uapbd/material/export.do", - "searchQuery" : "/nccloud/uapbd/material/query.do", - "queryTemp" : "/platform/templet/querypage.do", - "mergerequest" : "/nccloud/platform/pub/mergerequest.do", - "addMaterial" : "/nccloud/uapbd/material/addMaterial.do", - "queryJurisdiction":"/nccloud/uapbd/material/queryJurisdiction.do", - "deleteMaterial" : "/nccloud/uapbd/material/deleteMaterial.do", - "enableMaterial" : "/nccloud/uapbd/material/enableMaterial.do", - "disableMaterial" : "/nccloud/uapbd/material/disableMaterial.do", - "upgradeMaterial":"/nccloud/uapbd/material/upgradeMaterial.do", - "print" : "/nccloud/uapbd/material/printMaterial.do", - "upgrade" : "/nccloud/uapbd/material/upgrade.do", - "batchUpdate" : "/nccloud/uapbd/material/batchUpdate.do", - "batchUpdateWizard" : "/nccloud/uapbd/material/batchUpdateWizard.do", - "editMaterial" : "/nccloud/uapbd/material/editMaterial.do", - "queryPermOrg" : "/uapbd/material/queryPermOrg.do", - "checkMaterialDataPermission" : "/uapbd/material/checkMaterialDataPermission.do", - "qryIsAddMaterialAction" : "/nccloud/uapbd/material/qryIsAddMaterialAction.do" + "exporturl": "/nccloud/uapbd/material/export.do", + "searchQuery": "/nccloud/uapbd/material/query.do", + "queryTemp": "/platform/templet/querypage.do", + "mergerequest": "/nccloud/platform/pub/mergerequest.do", + "addMaterial": "/nccloud/uapbd/material/addMaterial.do", + "queryJurisdiction": "/nccloud/uapbd/material/queryJurisdiction.do", + "deleteMaterial": "/nccloud/uapbd/material/deleteMaterial.do", + "enableMaterial": "/nccloud/uapbd/material/enableMaterial.do", + "disableMaterial": "/nccloud/uapbd/material/disableMaterial.do", + "upgradeMaterial": "/nccloud/uapbd/material/upgradeMaterial.do", + "print": "/nccloud/uapbd/material/printMaterial.do", + "upgrade": "/nccloud/uapbd/material/upgrade.do", + "batchUpdate": "/nccloud/uapbd/material/batchUpdate.do", + "batchUpdateWizard": "/nccloud/uapbd/material/batchUpdateWizard.do", + "editMaterial": "/nccloud/uapbd/material/editMaterial.do", + "queryPermOrg": "/uapbd/material/queryPermOrg.do", + "checkMaterialDataPermission": "/uapbd/material/checkMaterialDataPermission.do", + "qryIsAddMaterialAction": "/nccloud/uapbd/material/qryIsAddMaterialAction.do" }; const EditTabConfig = { - mdId : 'c7dc0ccd-8872-4eee-8882-160e8f49dfad', - tableRelation : { - "base_info" : ['material'], - "fi_info" : ['fi_base'], - "pu_info" : ['pu_base'], - "stock_info" : ['stock_base','stock_freeasst','stock_check','stock_atp','stock_realusableamount'], - "sale_info" : ['sale_base'], - "prod_info" : ['prod_base','producecost','costvalutasst'], - "cost_info" : ['cost_base'], - "plan_info" : ['plan_base','plan_marasst'], - "pfc_info" : ['pfc_base'], - "pfcc_info" : ['pfcc_base'], - "materialwarh_info":['materialwarh_info'] + mdId: 'c7dc0ccd-8872-4eee-8882-160e8f49dfad', + tableRelation: { + "base_info": ['material'], + "fi_info": ['fi_base'], + "pu_info": ['pu_base'], + "stock_info": ['stock_base', 'stock_freeasst', 'stock_check', 'stock_atp', 'stock_realusableamount'], + "sale_info": ['sale_base'], + "prod_info": ['prod_base', 'producecost', 'costvalutasst'], + "cost_info": ['cost_base'], + "plan_info": ['plan_base', 'plan_marasst'], + "pfc_info": ['pfc_base'], + "pfcc_info": ['pfcc_base'], + "materialwarh_info": ['materialwarh_info'] }, - specialItems : { - "fi_info" : 'pk_org', - "pu_info" : 'pk_org', - "stock_info" : 'pk_org', - "sale_info" : 'pk_org', - "prod_info" : 'pk_org', - "cost_info" : 'pk_org', - "plan_info" : 'pk_org', - "pfc_info" : 'pk_org', - "pfcc_info" : 'pk_org', - "materialwarh_info":'pk_org' + specialItems: { + "fi_info": 'pk_org', + "pu_info": 'pk_org', + "stock_info": 'pk_org', + "sale_info": 'pk_org', + "prod_info": 'pk_org', + "cost_info": 'pk_org', + "plan_info": 'pk_org', + "pfc_info": 'pk_org', + "pfcc_info": 'pk_org', + "materialwarh_info": 'pk_org' } }; -const EMPTYFUNC = () => {}; +const EMPTYFUNC = () => { +}; /** * 有权限的组织pk */ let permOrg = []; let BatchUpdateWizardConfig = { - mdId : 'c7dc0ccd-8872-4eee-8882-160e8f49dfad', - searchid:'search4assign', - tablepagecode:'assign', - tableid:'material4assign', - queryTable:'/nccloud/uapbd/material/queryMaterialForbatchUpdateWizard.do', - pkName:'pk_material', - nodeType : '', - tableRelation : { - "base_info" : ['materialForm','base'], - "fi_info" : ['fi_base'], - "pu_info" : ['pu_base'], - "stock_info" : ['stock_base','stock_freeasst','stock_check','stock_atp','stock_realusableamount'], - "sale_info" : ['sale_base'], - "prod_info" : ['prod_base','producecost','costvalutasst'], - "cost_info" : ['cost_base'], - "plan_info" : ['plan_base','plan_marasst'], - "pfc_info" : ['pfc_base'], - "pfcc_info" : ['pfcc_base'], - "materialwarh_info":['materialwarh_info'] + mdId: 'c7dc0ccd-8872-4eee-8882-160e8f49dfad', + searchid: 'search4assign', + tablepagecode: 'assign', + tableid: 'material4assign', + queryTable: '/nccloud/uapbd/material/queryMaterialForbatchUpdateWizard.do', + pkName: 'pk_material', + nodeType: '', + tableRelation: { + "base_info": ['materialForm', 'base'], + "fi_info": ['fi_base'], + "pu_info": ['pu_base'], + "stock_info": ['stock_base', 'stock_freeasst', 'stock_check', 'stock_atp', 'stock_realusableamount'], + "sale_info": ['sale_base'], + "prod_info": ['prod_base', 'producecost', 'costvalutasst'], + "cost_info": ['cost_base'], + "plan_info": ['plan_base', 'plan_marasst'], + "pfc_info": ['pfc_base'], + "pfcc_info": ['pfcc_base'], + "materialwarh_info": ['materialwarh_info'] }, - specialItems : { - "base_info" : 'pk_org', - "fi_info" : 'pk_org', - "pu_info" : 'pk_org', - "stock_info" : 'pk_org', - "sale_info" : 'pk_org', - "prod_info" : 'pk_org', - "cost_info" : 'pk_org', - "plan_info" : 'pk_org', - "pfc_info" : 'pk_org', - "pfcc_info" : 'pk_org', - "materialwarh_info":'pk_org' + specialItems: { + "base_info": 'pk_org', + "fi_info": 'pk_org', + "pu_info": 'pk_org', + "stock_info": 'pk_org', + "sale_info": 'pk_org', + "prod_info": 'pk_org', + "cost_info": 'pk_org', + "plan_info": 'pk_org', + "pfc_info": 'pk_org', + "pfcc_info": 'pk_org', + "materialwarh_info": 'pk_org' } }; /** * 将返回数据更新到页面 - * @param {*} allData - * @param {*} reDataRows + * @param {*} allData + * @param {*} reDataRows */ -function filterResult(allData,reDataRows){ - if(!reDataRows) { +function filterResult(allData, reDataRows) { + if (!reDataRows) { return; } - if(allData.rows){ - allData.rows.forEach((item,index) => { - reDataRows.forEach((it,i) => { - if(it.values['pk_material'].value === item.values['pk_material'].value){ + if (allData.rows) { + allData.rows.forEach((item, index) => { + reDataRows.forEach((it, i) => { + if (it.values['pk_material'].value === item.values['pk_material'].value) { it.values.accessory = allData.rows[index].values.accessory; allData.rows[index] = it; } }); }); } - } +} class Material extends Component { constructor(props) { super(props); - props.use.search('material_search','materialqry','search4assign'); - props.use.table('material','marorg_material','material4assign','fi_list','pfc_list','pu_list','sale_list','stock_list','plan_list','prod_list','cost_list','pfccinfo_list'); - props.use.editTable('marorg','materialpfcsub_orgbrowse','materialbindle_orgbrowse','materialwarh_orgbrowse','materialrepl_orgbrowse','materialcostmode_orgbrowse','profitcostlist_orgbrowse'); + props.use.search('material_search', 'materialqry', 'search4assign'); + props.use.table('material', 'marorg_material', 'material4assign', 'fi_list', 'pfc_list', 'pu_list', 'sale_list', 'stock_list', 'plan_list', 'prod_list', 'cost_list', 'pfccinfo_list'); + props.use.editTable('marorg', 'materialpfcsub_orgbrowse', 'materialbindle_orgbrowse', 'materialwarh_orgbrowse', 'materialrepl_orgbrowse', 'materialcostmode_orgbrowse', 'profitcostlist_orgbrowse'); this.config = props.config; appid = this.config.appid; pagecode = this.config.pagecode; @@ -168,55 +182,63 @@ class Material extends Component { console.log(info.file, info.fileList); } if (info.file.status === 'done') { - if(info.file.response.data){ - toast({content:info.file.response.data,color:"danger",title:"出错啦"}); - }else{ - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000176'),color:"success"}); + if (info.file.response.data) { + toast({content: info.file.response.data, color: "danger", title: "出错啦"}); + } else { + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000176'), + color: "success" + }); } console.log(`${info.file.name} file uploaded successfully`); // props.modal.close('importImagesModel'); - } - else if (info.file.status === 'error') { + } else if (info.file.status === 'error') { console.log(`${info.file.name} file upload failed.`); } }, - accept:'application/zip', - showUploadList:false, + accept: 'application/zip', + showUploadList: false, // multiple:true, // directory: true, // mergeFiles:true, - data:{ + data: { pk_group: getBusinessInfo().groupId, - bill_type:node_type + bill_type: node_type } }; this.state = { - checkflag : getDefData('checkflag',this.config.datasource)?true:false, - oids : [], - refreshdata:[], - exportIds : [], - billType:this.props.config.billType, - pagecode_card:this.props.config.pagecode_card, - appcode:this.props.config.appcode, - showUploader:false, - uploaderDir:'', - assignStepModal : false, - assignModal : false, - importparams:{}, - context : {}, + checkflag: getDefData('checkflag', this.config.datasource) ? true : false, + oids: [], + refreshdata: [], + exportIds: [], + billType: this.props.config.billType, + pagecode_card: this.props.config.pagecode_card, + appcode: this.props.config.appcode, + showUploader: false, + uploaderDir: '', + assignStepModal: false, + assignModal: false, + importparams: {}, + context: {}, forceRender: true } //创建实例 this.crossTabData = new crossTabData(); - this.initTemplate(this.props,this.modifierMeta.bind(this,this.tableInnerButtonClick),()=>{ + this.initTemplate(this.props, this.modifierMeta.bind(this, this.tableInnerButtonClick), () => { setTimeout(() => { this.updateButtonDisable(); - if(this.config.node_type==='GROUP_NODE'){ + if (this.config.node_type === 'GROUP_NODE') { let businessInfo = getBusinessInfo(); - this.props.search.setSearchValByField(searchid,'pk_org',{value:businessInfo.groupId,display:businessInfo.groupName}); - }else{ - if(this.state.context && this.state.context.pk_org && this.state.context.org_Name){ - this.props.search.setSearchValByField(searchid,'pk_org_assign',{value:this.state.context.pk_org,display:this.state.context.org_Name}); + this.props.search.setSearchValByField(searchid, 'pk_org', { + value: businessInfo.groupId, + display: businessInfo.groupName + }); + } else { + if (this.state.context && this.state.context.pk_org && this.state.context.org_Name) { + this.props.search.setSearchValByField(searchid, 'pk_org_assign', { + value: this.state.context.pk_org, + display: this.state.context.org_Name + }); } } // 如果从卡片页返回列表 则给oids赋值 否则打印输出拿不到数据 @@ -229,10 +251,13 @@ class Material extends Component { } //获取并初始化模板 - initTemplate = (props,modifierMeta,callback) => { + initTemplate = (props, modifierMeta, callback) => { let count = 0; let AppCode = props.getAppCode(); - let data,res;console.log(data);console.log(res);console.log(props.meta.getMeta()); + let data, res; + console.log(data); + console.log(res); + console.log(props.meta.getMeta()); let handleMetaTemplete = () => { if (data.button) { let button = data.button; @@ -260,26 +285,86 @@ class Material extends Component { setDefData('searchVal', this.props.config.datasource, searchVal); this.queryData(); }); - let stockimportconfig = excelImportconfig(props, 'uapbd', 'materialstock', true, '', { appcode: '10140MAG', pagecode: 'stock_import', isbatch: 'Y', nodetype: props.config.billType }, () => { }); + let stockimportconfig = excelImportconfig(props, 'uapbd', 'materialstock', true, '', { + appcode: '10140MAG', + pagecode: 'stock_import', + isbatch: 'Y', + nodetype: props.config.billType + }, () => { + }); props.button.setUploadConfig("importstock", stockimportconfig); - let saleimportconfig = excelImportconfig(props, 'uapbd', 'materialsale', true, '', { appcode: '10140MAG', pagecode: 'sale_import', isbatch: 'Y', nodetype: props.config.billType }, () => { }); + let saleimportconfig = excelImportconfig(props, 'uapbd', 'materialsale', true, '', { + appcode: '10140MAG', + pagecode: 'sale_import', + isbatch: 'Y', + nodetype: props.config.billType + }, () => { + }); props.button.setUploadConfig("importsale", saleimportconfig); - let fiimportconfig = excelImportconfig(props, 'uapbd', 'materialfi', true, '', { appcode: '10140MAG', pagecode: 'fi_import', isbatch: 'Y', nodetype: props.config.billType }, () => { }); + let fiimportconfig = excelImportconfig(props, 'uapbd', 'materialfi', true, '', { + appcode: '10140MAG', + pagecode: 'fi_import', + isbatch: 'Y', + nodetype: props.config.billType + }, () => { + }); props.button.setUploadConfig("importfi", fiimportconfig); - let puimportconfig = excelImportconfig(props, 'uapbd', 'materialpu', true, '', { appcode: '10140MAG', pagecode: 'pu_import', isbatch: 'Y', nodetype: props.config.billType }, () => { }); + let puimportconfig = excelImportconfig(props, 'uapbd', 'materialpu', true, '', { + appcode: '10140MAG', + pagecode: 'pu_import', + isbatch: 'Y', + nodetype: props.config.billType + }, () => { + }); props.button.setUploadConfig("importpu", puimportconfig); - let prodimportconfig = excelImportconfig(props, 'uapbd', 'materialprod', true, '', { appcode: '10140MAG', pagecode: 'prod_import', isbatch: 'Y', nodetype: props.config.billType }, () => { }); + let prodimportconfig = excelImportconfig(props, 'uapbd', 'materialprod', true, '', { + appcode: '10140MAG', + pagecode: 'prod_import', + isbatch: 'Y', + nodetype: props.config.billType + }, () => { + }); props.button.setUploadConfig("importprod", prodimportconfig); - let costimportconfig = excelImportconfig(props, 'uapbd', 'materialcost', true, '', { appcode: '10140MAG', pagecode: 'cost_import', isbatch: 'Y', nodetype: props.config.billType }, () => { }); + let costimportconfig = excelImportconfig(props, 'uapbd', 'materialcost', true, '', { + appcode: '10140MAG', + pagecode: 'cost_import', + isbatch: 'Y', + nodetype: props.config.billType + }, () => { + }); props.button.setUploadConfig("importcost", costimportconfig); - let planimportconfig = excelImportconfig(props, 'uapbd', 'materialplan', true, '', { appcode: '10140MAG', pagecode: 'plan_import', isbatch: 'Y', nodetype: props.config.billType }, () => { }); + let planimportconfig = excelImportconfig(props, 'uapbd', 'materialplan', true, '', { + appcode: '10140MAG', + pagecode: 'plan_import', + isbatch: 'Y', + nodetype: props.config.billType + }, () => { + }); props.button.setUploadConfig("importplan", planimportconfig); - let pfcimportconfig = excelImportconfig(props, 'uapbd', 'materialpfc', true, '', { appcode: '10140MAG', pagecode: 'pfc_import', isbatch: 'Y', nodetype: props.config.billType }, () => { }); + let pfcimportconfig = excelImportconfig(props, 'uapbd', 'materialpfc', true, '', { + appcode: '10140MAG', + pagecode: 'pfc_import', + isbatch: 'Y', + nodetype: props.config.billType + }, () => { + }); props.button.setUploadConfig("importpfc", pfcimportconfig); - let pfccimportconfig = excelImportconfig(props, 'uapbd', 'materialpfcc', true, '', { appcode: '10140MAG', pagecode: 'cost_import', isbatch: 'Y', nodetype: props.config.billType }, () => { }); + let pfccimportconfig = excelImportconfig(props, 'uapbd', 'materialpfcc', true, '', { + appcode: '10140MAG', + pagecode: 'cost_import', + isbatch: 'Y', + nodetype: props.config.billType + }, () => { + }); props.button.setUploadConfig("importpfcc", pfccimportconfig); - let import_assignconfig = excelImportconfig(props, 'uapbd', 'import_assign', true, '', { appcode: '10140MAG', pagecode: 'import_assign', isbatch: 'Y', nodetype: props.config.billType }, () => { }); + let import_assignconfig = excelImportconfig(props, 'uapbd', 'import_assign', true, '', { + appcode: '10140MAG', + pagecode: 'import_assign', + isbatch: 'Y', + nodetype: props.config.billType + }, () => { + }); props.button.setUploadConfig("import_assign", import_assignconfig); props.button.setUploadConfig("import", excelimportconfig); @@ -290,14 +375,14 @@ class Material extends Component { props.button.setButtons(button); //物料节点加载时发送的请求,判定是否可直接录入,若可直接录入则显示导入按钮 - props.button.setButtonsVisible({ import: false, export: false }); + props.button.setButtonsVisible({import: false, export: false}); ajax({ url: urls['qryIsAddMaterialAction'], loading: false, data: {}, success: (res2) => { if (res2.data) { - props.button.setButtonsVisible({ import: true, export: true }); + props.button.setButtonsVisible({import: true, export: true}); } } }); @@ -305,7 +390,8 @@ class Material extends Component { let meta = data.template; meta = modifierMeta.call(this, props, meta); props.meta.setMeta(meta, () => { - var cb = callback || function () { }; + var cb = callback || function () { + }; cb(); }); @@ -357,7 +443,7 @@ class Material extends Component { meta['stock_audit'] = res.data.stock_template.stock_audit; meta['materialwarh_orgbrowse'] = res.data.stock_template.materialwarh; meta['materialwarh_info'] = res.data.materialwarh_info.materialwarh_info; - + //将计划信息卡片模板放入meta中 meta['materialplan'] = res.data.plan_template.materialplan; meta['plan_base'] = res.data.plan_template.plan_base; @@ -394,7 +480,7 @@ class Material extends Component { meta['base'] = res.data.basecard_template.base; meta['materialForm'] = res.data.basecard_template.material; - + //组合原NC也去的单据模板关联关系 if (!meta['formrelation']) { meta['formrelation'] = {}; @@ -458,7 +544,7 @@ class Material extends Component { meta['cost_list'].pagination = true; meta['pfccinfo_list'].pagination = true; props.meta.setMeta(meta); - } + } let reqData = [ { rqUrl: urls['queryTemp'], @@ -575,7 +661,7 @@ class Material extends Component { rqCode: 'permOrg' } ]; - if(props.config.node_type === 'GROUP_NODE'){ + if (props.config.node_type === 'GROUP_NODE') { reqData.push({ rqUrl: urls['queryTemp'], rqJson: `{\n \"pagecode\": \"10140MORG_marorg_m\"\n}`, @@ -589,85 +675,85 @@ class Material extends Component { } props.createUIDom({ - pagecode : pagecode - }, - (data1)=>{ - console.log(666666) - data = data1; - handleMetaTemplete(); - ajax({ - url : urls['mergerequest'], - data : reqData, - loading: false, - success : (res1) => { - res = res1; - if(data && data.context){ - this.state.context = data.context; - this.setState(this.state); + pagecode: pagecode + }, + (data1) => { + console.log(666666) + data = data1; + handleMetaTemplete(); + ajax({ + url: urls['mergerequest'], + data: reqData, + loading: false, + success: (res1) => { + res = res1; + if (data && data.context) { + this.state.context = data.context; + this.setState(this.state); + } + handleMetaTempleteOther(); } - handleMetaTempleteOther(); - } + }); }); - }); } - modifierMeta = (tableInnerButtonClick,props,meta) => { + modifierMeta = (tableInnerButtonClick, props, meta) => { let businessInfo = getBusinessInfo(); - let AppCode =props.getAppCode(); + let AppCode = props.getAppCode(); let opr = { attrcode: 'opr', - key : 'opr', + key: 'opr', label: props.MutiInit.getIntl("10140MATERIAL") && props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000060'),/* 国际化处理: 操作*/ visible: true, - className:'table-opr', - width:200, + className: 'table-opr', + width: 200, itemtype: 'customer', - fixed:'right', + fixed: 'right', render(text, record, index) { console.log(record); let oprbtn = []; let pk_org = record.pk_org.value; - if(permOrg.indexOf(pk_org) !== -1){ + if (permOrg.indexOf(pk_org) !== -1) { oprbtn.push('EditOpr'); oprbtn.push('DeleteOpr'); } oprbtn.push('CopyOpr'); - if(permOrg.indexOf(pk_org) !== -1){ - if(record.enablestate.value === '2'){ + if (permOrg.indexOf(pk_org) !== -1) { + if (record.enablestate.value === '2') { oprbtn.push('DisableOpr'); - }else{ + } else { oprbtn.push('EnableOpr'); } oprbtn.push('CreateVersionOpr'); } - if(record.pk_material_pf && record.pk_material_pf.value){ + if (record.pk_material_pf && record.pk_material_pf.value) { oprbtn.push('AssociateOpr'); } - if(record.pk_group.value !== record.pk_org.value){ + if (record.pk_group.value !== record.pk_org.value) { oprbtn.push('UpgradeOpr'); } oprbtn.push('FileOpr'); return props.button.createOprationButton( oprbtn, { - area:'list_opr', - buttonLimit:3, - onButtonClick : tableInnerButtonClick.bind(this,record,index) + area: 'list_opr', + buttonLimit: 3, + onButtonClick: tableInnerButtonClick.bind(this, record, index) } ); } }; - meta[tableid].items.forEach((item,index)=>{ - if(item.attrcode === 'code'){ + meta[tableid].items.forEach((item, index) => { + if (item.attrcode === 'code') { item.render = (text, record) => { return ( { - this.props.pushTo('/card',{ - pagecode:this.props.config.pagecodecard, - status:'browse', - id : record['pk_material'].value + this.props.pushTo('/card', { + pagecode: this.props.config.pagecodecard, + status: 'browse', + id: record['pk_material'].value }); }} > @@ -676,58 +762,59 @@ class Material extends Component { ); }; } - if(item.attrcode === 'accessory'){ - item.customize={ - 'pk_billtypecode':'material' - } + if (item.attrcode === 'accessory') { + item.customize = { + 'pk_billtypecode': 'material' + } ; } }); meta[tableid].items.push(opr); - meta['material_search'].items.map((item,index)=>{ - if(item.attrcode === 'pk_org_assign'){ + meta['material_search'].items.map((item, index) => { + if (item.attrcode === 'pk_org_assign') { meta['material_search'].items[index].itemtype = 'refer'; meta['material_search'].items[index].refcode = 'uapbd/refer/org/BusinessUnitTreeRef/index'; meta['material_search'].items[index].queryCondition = { - AppCode : AppCode, - TreeRefActionExt:'nccloud.web.refer.sqlbuilder.PrimaryOrgSQLBuilder' + AppCode: AppCode, + TreeRefActionExt: 'nccloud.web.refer.sqlbuilder.PrimaryOrgSQLBuilder' } - }else if(item.attrcode === 'pk_marbasclass'){ + } else if (item.attrcode === 'pk_marbasclass') { meta['material_search'].items[index].isMultiSelectedEnabled = true; meta['material_search'].items[index].isShowDisabledData = true; - if(!(node_type==='GROUP_NODE')){ + if (!(node_type === 'GROUP_NODE')) { meta['material_search'].items[index].isShowUnit = true; } - }else if(item.attrcode === 'pk_brand' || item.attrcode === 'prodarea' || item.attrcode === 'pk_prodline' || item.attrcode === 'creator' || item.attrcode === 'modifier' || item.attrcode === 'delperson'){ + } else if (item.attrcode === 'pk_brand' || item.attrcode === 'prodarea' || item.attrcode === 'pk_prodline' || item.attrcode === 'creator' || item.attrcode === 'modifier' || item.attrcode === 'delperson') { meta['material_search'].items[index].isShowDisabledData = true; } - if(item.attrcode === 'pk_org' && node_type==='ORG_NODE'){ + if (item.attrcode === 'pk_org' && node_type === 'ORG_NODE') { meta['material_search'].items[index].refcode = 'uapbd/refer/org/BusinessUnitAndGroupTreeRef/index'; meta['material_search'].items[index].queryCondition = { - AppCode : AppCode, - TreeRefActionExt:'nccloud.web.uapbd.material.action.PrimaryGroupAndOrgSQLBuilder' + AppCode: AppCode, + TreeRefActionExt: 'nccloud.web.uapbd.material.action.PrimaryGroupAndOrgSQLBuilder' } - }else if(item.attrcode === 'pk_org' && node_type==='GROUP_NODE'){ + } else if (item.attrcode === 'pk_org' && node_type === 'GROUP_NODE') { meta['material_search'].items[index].refcode = 'uapbd/refer/org/BusinessUnitAndGroupTreeRef/index'; meta['material_search'].items[index].queryCondition = { - pk_group : businessInfo.groupId, - AppCode : AppCode, - TreeRefActionExt:'nccloud.web.uapbd.material.action.BusinessUnitAndGroupTreeRefExt' - }} + pk_group: businessInfo.groupId, + AppCode: AppCode, + TreeRefActionExt: 'nccloud.web.uapbd.material.action.BusinessUnitAndGroupTreeRefExt' + } + } }); - meta['materialqry'].items.forEach((item,index)=>{ - if(item.attrcode === 'pk_marbasclass'){ + meta['materialqry'].items.forEach((item, index) => { + if (item.attrcode === 'pk_marbasclass') { meta['materialqry'].items[index].isMultiSelectedEnabled = true; meta['materialqry'].items[index].isShowDisabledData = true; meta['materialqry'].items[index].isShowUnit = true; - }else if(item.attrcode === 'pk_org' && node_type==='GROUP_NODE'){ + } else if (item.attrcode === 'pk_org' && node_type === 'GROUP_NODE') { meta['materialqry'].items[index].refcode = 'uapbd/refer/org/BusinessUnitTreeRef/index'; - meta['materialqry'].items[index].isShowDisabledData=true; + meta['materialqry'].items[index].isShowDisabledData = true; meta['materialqry'].items[index].queryCondition = { - AppCode : AppCode, - OrgTypes:'BUSINESSUNIT00000000', - TreeRefActionExt:'nccloud.web.refer.sqlbuilder.PrimaryOrgMultiOrgtypeSQLBuilder' + AppCode: AppCode, + OrgTypes: 'BUSINESSUNIT00000000', + TreeRefActionExt: 'nccloud.web.refer.sqlbuilder.PrimaryOrgMultiOrgtypeSQLBuilder' } //uapbd/refer/org/GroupDefaultTreeRef/index } @@ -735,18 +822,18 @@ class Material extends Component { return meta; } - tableInnerButtonClick = (record,index,props, id) => { + tableInnerButtonClick = (record, index, props, id) => { let pageInfo1 = this.props.table.getTablePageInfo(tableid); - switch(id){ + switch (id) { case 'EditOpr': ajax({ - url : urls['editMaterial'], - data : {pk:record.pk_material.value}, - success : (res) => { - this.props.pushTo('/card',{ - pagecode:this.props.config.pagecodecard, - status:'edit', - id : record.pk_material.value + url: urls['editMaterial'], + data: {pk: record.pk_material.value}, + success: (res) => { + this.props.pushTo('/card', { + pagecode: this.props.config.pagecodecard, + status: 'edit', + id: record.pk_material.value }); } }) @@ -754,50 +841,53 @@ class Material extends Component { case 'DeleteOpr': let dataArr = [{ status: '1', - values : { - pk_material : record.pk_material, - ts : record.ts, - code : record.code, - name : record.name + values: { + pk_material: record.pk_material, + ts: record.ts, + code: record.code, + name: record.name } }]; - props.modal.show('deleteModal',{ - content : this.getDeleteModalContext(dataArr,[index]), - customBtns : this.getDelcustomBtns(dataArr,[index]) + props.modal.show('deleteModal', { + content: this.getDeleteModalContext(dataArr, [index]), + customBtns: this.getDelcustomBtns(dataArr, [index]) }); break; case 'CopyOpr': ajax({ - url : urls['addMaterial'], - data : {node_type:node_type}, - success : (res) => { - this.props.pushTo('/card',{ - pagecode:this.props.config.pagecodecard, - status:'copy', - id : record.pk_material.value + url: urls['addMaterial'], + data: {node_type: node_type}, + success: (res) => { + this.props.pushTo('/card', { + pagecode: this.props.config.pagecodecard, + status: 'copy', + id: record.pk_material.value }) } }); break; case 'UpgradeOpr': - if(record.pk_org.value === record.pk_group.value){ - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000026'),color:'warning'});/* 国际化处理: 待升级物料全部为集团数据,不需升级。*/ + if (record.pk_org.value === record.pk_group.value) { + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000026'), + color: 'warning' + });/* 国际化处理: 待升级物料全部为集团数据,不需升级。*/ break; } ajax({ - url : urls['upgrade'], - data : { - pk_material : record.pk_material.value, - ts : record.ts.value, + url: urls['upgrade'], + data: { + pk_material: record.pk_material.value, + ts: record.ts.value, isSure: false, - node_type : this.config.node_type + node_type: this.config.node_type }, - success : (res)=>{ - let {success,data} = res; - if(data && data.result){ - if(data.result === 'error'){ - toast({content:data.msg,color:'error'}); - }else if(data.result === 'tip'){ + success: (res) => { + let {success, data} = res; + if (data && data.result) { + if (data.result === 'error') { + toast({content: data.msg, color: 'error'}); + } else if (data.result === 'tip') { promptBox({ color: 'warning', // 提示类别默认"success", "success"/"info"/"warning"/"danger",非必输 title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000027'), // 提示标题, 默认不同类别下分别为:"已成功"/"帮助信息"/"请注意"/"出错啦",非必输/* 国际化处理: 确认升级*/ @@ -808,24 +898,30 @@ class Material extends Component { cancelBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017'), // 取消按钮名称, 默认为"取消",非必输/* 国际化处理: 取消*/ beSureBtnClick: () => { ajax({ - url : urls['upgrade'], - data : { - pk_material : record.pk_material.value, - ts : record.ts.value, + url: urls['upgrade'], + data: { + pk_material: record.pk_material.value, + ts: record.ts.value, isSure: true, - node_type : this.config.node_type + node_type: this.config.node_type }, - success : (res) => { - this.onButtonClick(props,'Refresh'); - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000028'),color:'success'});/* 国际化处理: 操作成功*/ + success: (res) => { + this.onButtonClick(props, 'Refresh'); + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000028'), + color: 'success' + });/* 国际化处理: 操作成功*/ } }) } }); } - }else{ - this.onButtonClick(props,'Refresh'); - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000028'),color:'success'});/* 国际化处理: 操作成功*/ + } else { + this.onButtonClick(props, 'Refresh'); + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000028'), + color: 'success' + });/* 国际化处理: 操作成功*/ } } }); @@ -841,13 +937,13 @@ class Material extends Component { cancelBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017'), // 取消按钮名称, 默认为"取消",非必输/* 国际化处理: 取消*/ beSureBtnClick: () => { ajax({ - url : urls['addMaterial'], - data : {node_type:this.config.node_type}, - success : (res) => { - props.pushTo('/card',{ - pagecode:this.props.config.pagecodecard, - status:'create', - id : record.pk_material.value + url: urls['addMaterial'], + data: {node_type: this.config.node_type}, + success: (res) => { + props.pushTo('/card', { + pagecode: this.props.config.pagecodecard, + status: 'create', + id: record.pk_material.value }); } }); @@ -856,13 +952,13 @@ class Material extends Component { break; case 'AssociateOpr': let pk_material_pf = record.pk_material_pf; - if(pk_material_pf && pk_material_pf.value){ - this.props.openTo('/uapbd/material/material_pf/approve/index.html',{ - id:pk_material_pf.value, - status:'browse', - appcode:'10140MPFA', - pagecode : '10140MPFA_approve', - ismaterial:true + if (pk_material_pf && pk_material_pf.value) { + this.props.openTo('/uapbd/material/material_pf/approve/index.html', { + id: pk_material_pf.value, + status: 'browse', + appcode: '10140MPFA', + pagecode: '10140MPFA_approve', + ismaterial: true }); } break; @@ -877,29 +973,32 @@ class Material extends Component { cancelBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017'), // 取消按钮名称, 默认为"取消",非必输/* 国际化处理: 取消*/ beSureBtnClick: () => { let enable_data = { - pageid:pagecode, + pageid: pagecode, model: { areaType: 'table', pageinfo: null, rows: [{ status: '1', - values : { - pk_material : record.pk_material, - ts : record.ts + values: { + pk_material: record.pk_material, + ts: record.ts } }] } }; ajax({ url: urls['enableMaterial'], - data:enable_data, + data: enable_data, success: (res) => { //此处使用箭头函数,如果不使用箭头函数,一定要bind(this) - let { success, data } = res; + let {success, data} = res; if (success) { - this.queryData({ pageInfo: { ...pageInfo1 }, isRefresh: false }); + this.queryData({pageInfo: {...pageInfo1}, isRefresh: false}); } this.updateButtonDisable(); - toast({ content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000022'), color: 'success' });/* 国际化处理: 启用成功*/ + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000022'), + color: 'success' + });/* 国际化处理: 启用成功*/ } }); } @@ -916,32 +1015,35 @@ class Material extends Component { cancelBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017'), // 取消按钮名称, 默认为"取消",非必输/* 国际化处理: 取消*/ beSureBtnClick: () => { let disable_data = { - pageid:pagecode, + pageid: pagecode, model: { areaType: 'table', pageinfo: null, rows: [{ status: '1', - values : { - pk_material : record.pk_material, - ts : record.ts + values: { + pk_material: record.pk_material, + ts: record.ts } }] } }; ajax({ url: urls['disableMaterial'], - data:disable_data, + data: disable_data, success: (res) => { - let { success, data } = res; + let {success, data} = res; if (success) { - this.queryData({ pageInfo: { ...pageInfo1 }, isRefresh: false }); + this.queryData({pageInfo: {...pageInfo1}, isRefresh: false}); } this.updateButtonDisable(); if (data.error) { - toast({ content: data.error, color: 'warning' }); + toast({content: data.error, color: 'warning'}); } else { - toast({ content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000025'), color: 'success' });/* 国际化处理: 停用成功*/ + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000025'), + color: 'success' + });/* 国际化处理: 停用成功*/ } } }); @@ -950,26 +1052,26 @@ class Material extends Component { break; case 'FileOpr': this.setState({ - showUploader:true, - uploaderDir : record.pk_material.value + showUploader: true, + uploaderDir: record.pk_material.value }); break; } - + } componentDidMount = () => { //监听全局搜索事件 this.crossTabData.on('message', this.handler) } - + componentWillUnmount() { //卸载事件 this.crossTabData.destroy('message', this.handler) } handler = (data) => { - const { pagecode, appcode } = this.config; + const {pagecode, appcode} = this.config; let gridId = tableid; ajax({ url: "/nccloud/uapbd/material/querysearchpks.do", @@ -979,15 +1081,15 @@ class Material extends Component { pagecode: pagecode, appcode: appcode }, - success:(res)=>{ - if(res && res.data) { - if(res.data[gridId] && res.data[gridId]['allpks']) { + success: (res) => { + if (res && res.data) { + if (res.data[gridId] && res.data[gridId]['allpks']) { this.setState({oids: res.data[gridId].allpks}); } this.props.table.setAllTableData(gridId, res.data[gridId]); } else { - this.setState({oids:[]}); - this.props.table.setAllTableData(gridId, { rows: [] }); + this.setState({oids: []}); + this.props.table.setAllTableData(gridId, {rows: []}); } } }) @@ -996,63 +1098,68 @@ class Material extends Component { /** * 点击查询 */ - clickSearchBtn = (props,data) =>{ + clickSearchBtn = (props, data) => { let searchVal = this.props.search.getQueryInfo(searchid); - if(!searchVal || !searchVal.querycondition) { + if (!searchVal || !searchVal.querycondition) { return; } - setDefData('searchVal',this.props.config.datasource,searchVal); - let pageInfo=this.props.table.getTablePageInfo(tableid); + setDefData('searchVal', this.props.config.datasource, searchVal); + let pageInfo = this.props.table.getTablePageInfo(tableid); // let pageInfo = { // pageIndex : 0, // pageSize : 10 // }; - if(pageInfo){//测试提出查询要回到第一页 + if (pageInfo) {//测试提出查询要回到第一页 pageInfo.pageIndex = 0; } - this.queryData({pageInfo,isSearch:true}); + this.queryData({pageInfo, isSearch: true}); } - queryData = ({pageInfo,isDelete=false,isRefresh = false,isSearch = false,isToTop=true}) => { - let searchdata = getDefData('searchVal',this.props.config.datasource); - if(!searchdata || !searchdata.querycondition){ + queryData = ({pageInfo, isDelete = false, isRefresh = false, isSearch = false, isToTop = true}) => { + let searchdata = getDefData('searchVal', this.props.config.datasource); + if (!searchdata || !searchdata.querycondition) { let searchVal = this.props.search.getQueryInfo(searchid); - if(!searchVal || !searchVal.querycondition){ + if (!searchVal || !searchVal.querycondition) { return; - }else{ - setDefData('searchVal',this.props.config.datasource,searchVal); + } else { + setDefData('searchVal', this.props.config.datasource, searchVal); searchdata = searchVal; } } - if(!pageInfo){ - pageInfo =this.props.table.getTablePageInfo(tableid); + if (!pageInfo) { + pageInfo = this.props.table.getTablePageInfo(tableid); } searchdata.pageCode = pagecode; searchdata.pageInfo = pageInfo; - searchdata.custcondition = {conditions:[{ - field:'node_type',value:{firstvalue:this.config.node_type} - },{ - field:'isShowDisable',value:{firstvalue:this.state.checkflag?'1':'0'} - }]}; + searchdata.custcondition = { + conditions: [{ + field: 'node_type', value: {firstvalue: this.config.node_type} + }, { + field: 'isShowDisable', value: {firstvalue: this.state.checkflag ? '1' : '0'} + }] + }; ajax({ url: urls['searchQuery'], - data:searchdata, - success : (res)=>{ + data: searchdata, + success: (res) => { if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) { this.props.dealFormulamsg( res.formulamsg, //参数一:返回的公式对象 { //参数二:界面使用的表格类型 - [tableid]:"simpleTable" + [tableid]: "simpleTable" } ); } - let {sucess,data} = res; - isRefresh && toast({color:'success',title:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000147')});/* 国际化处理: 刷新成功!*/ - if(data&&data[tableid]){ - if(isToTop){ - this.setState({oids:data[tableid].allpks},this.props.table.setAllTableData(tableid,data[tableid])); - }else{ - this.setState({ oids: data[tableid].allpks }, () => { + let {sucess, data} = res; + isRefresh && toast({ + color: 'success', + title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000147') + });/* 国际化处理: 刷新成功!*/ + if (data && data[tableid]) { + if (isToTop) { + this.setState({oids: data[tableid].allpks}, this.props.table.setAllTableData(tableid, data[tableid])); + } else { + this.setState({oids: data[tableid].allpks}, () => { let checkedRows = this.props.table.getCheckedRows(tableid); let checkedIndex = []; checkedRows.forEach(item => { @@ -1063,20 +1170,29 @@ class Material extends Component { }); } let sum = data[tableid].allpks ? data[tableid].allpks.length : 0; - if(sum === 0){ - isSearch && toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000062'),color:'warning'});/* 国际化处理: 未查询到符合条件的数据!,请注意!*/ - }else{ - isSearch && toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000064',{sum:sum}),color:'success'});/* 国际化处理: 查询成功,共,条数据。,已成功!*/ - } - }else{ - isSearch && toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000062'),color:'warning'});/* 国际化处理: 未查询到符合条件的数据!,请注意!*/ - this.setState({oids:[]},this.props.table.setAllTableData(tableid,{ - allpks:[], - areacode : 'material', - rows:[], - pageInfo : { - pageIndex : 0, - pageSize : pageInfo.pageSize + if (sum === 0) { + isSearch && toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000062'), + color: 'warning' + });/* 国际化处理: 未查询到符合条件的数据!,请注意!*/ + } else { + isSearch && toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000064', {sum: sum}), + color: 'success' + });/* 国际化处理: 查询成功,共,条数据。,已成功!*/ + } + } else { + isSearch && toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000062'), + color: 'warning' + });/* 国际化处理: 未查询到符合条件的数据!,请注意!*/ + this.setState({oids: []}, this.props.table.setAllTableData(tableid, { + allpks: [], + areacode: 'material', + rows: [], + pageInfo: { + pageIndex: 0, + pageSize: pageInfo.pageSize } })); } @@ -1088,53 +1204,57 @@ class Material extends Component { /** * 编辑后事件 */ - onAfterEvent = () => {} + onAfterEvent = () => { + } - onSelected = (props, moduleId, record,index,status) => { - this.props.setUrlParam({'id':record.pk_material.value}) + onSelected = (props, moduleId, record, index, status) => { + this.props.setUrlParam({'id': record.pk_material.value}) this.updateButtonDisable(); } - onSelectedAll = (props, moduleId, status,length) => { - this.props.setUrlParam({'id':null}) + onSelectedAll = (props, moduleId, status, length) => { + this.props.setUrlParam({'id': null}) this.updateButtonDisable(); } /** * 行选择变动事件 */ - selectedChangeFn = (props, moduleId,newVal,oldVal) => { + selectedChangeFn = (props, moduleId, newVal, oldVal) => { let rows = this.props.table.getCheckedRows(moduleId); - if(rows && rows.length>0){ - this.props.setUrlParam({'id':rows[0].data.values.pk_material.value }) + if (rows && rows.length > 0) { + this.props.setUrlParam({'id': rows[0].data.values.pk_material.value}) - }else{ - this.props.setUrlParam({'id':null}) + } else { + this.props.setUrlParam({'id': null}) } this.updateButtonDisable(); } hasPerm = (orgs) => { - for(let i=0;i { - let pageInfo1=this.props.table.getTablePageInfo(tableid); - switch(id){ + onButtonClick = (props, id, showToast = true, isToTop = true) => { + let pageInfo1 = this.props.table.getTablePageInfo(tableid); + switch (id) { case 'Add': ajax({ - url : urls['addMaterial'], - data : {node_type:this.config.node_type}, - success : (res) => { - props.pushTo('/card',{ - pagecode:this.props.config.pagecodecard, - status:'add', + url: urls['addMaterial'], + data: {node_type: this.config.node_type}, + success: (res) => { + props.pushTo('/card', { + pagecode: this.props.config.pagecodecard, + status: 'add', id: this.props.getUrlParam("id") }) } @@ -1142,84 +1262,88 @@ class Material extends Component { break; case 'Delete': let rows = props.table.getCheckedRows(tableid); - if(!rows || rows.length === 0){ - toast({content:请选择数据,color:'warning'});/* 国际化处理: 请选择数据,请选择数据*/ - return + if (!rows || rows.length === 0) { + toast({content: 请选择数据, color: 'warning'});/* 国际化处理: 请选择数据,请选择数据*/ + return } let pk_orgs = []; - rows.forEach(row=>{pk_orgs.push(row.data.values.pk_org.value)}); - if(this.hasPerm(pk_orgs)){ - props.modal.show('deleteModal',{ - content : this.getDeleteModalContext(), - customBtns : this.getDelcustomBtns() + rows.forEach(row => { + pk_orgs.push(row.data.values.pk_org.value) + }); + if (this.hasPerm(pk_orgs)) { + props.modal.show('deleteModal', { + content: this.getDeleteModalContext(), + customBtns: this.getDelcustomBtns() }); } break; case 'BatchUpdate': rows = props.table.getCheckedRows(tableid); - if(!rows || rows.length === 0){ - toast({content:请选择数据,color:'warning'});/* 国际化处理: 请选择数据,请选择数据*/ - return + if (!rows || rows.length === 0) { + toast({content: 请选择数据, color: 'warning'});/* 国际化处理: 请选择数据,请选择数据*/ + return } let orgs = []; let pks = []; - rows.forEach(item=>{ + rows.forEach(item => { orgs.push(item.data.values.pk_org.value); pks.push(item.data.values.pk_material.value); }); - - this.Batcheditmodal.show(pks,orgs,permOrg); + + this.Batcheditmodal.show(pks, orgs, permOrg); // rows = props.table.getCheckedRows(tableid); // if(!rows || rows.length === 0){ // toast({content:请选择数据,color:'warning'});/* 国际化处理: 请选择数据,请选择数据*/ // return // } - - + + // if(!this.hasPerm(orgs)){ // return; // } - - break; + + break; case 'BatchUpdateWizard': this.Batcheditstepmodal.show(); break; case 'BatchUpdateRuleTeam': - if(this.props.config.node_type === 'ORG_NODE'){ - this.props.openTo('/uapbd/material/batchupdaterule_org/main/index.html',{ - appcode : '10140BURO', - pagecode : '10140BURO_LIST' + if (this.props.config.node_type === 'ORG_NODE') { + this.props.openTo('/uapbd/material/batchupdaterule_org/main/index.html', { + appcode: '10140BURO', + pagecode: '10140BURO_LIST' }); - }else{ - this.props.openTo('/uapbd/material/batchupdaterule_grp/main/index.html',{ - appcode : '10140BURG', - pagecode : '10140BURG_LIST' + } else { + this.props.openTo('/uapbd/material/batchupdaterule_grp/main/index.html', { + appcode: '10140BURG', + pagecode: '10140BURG_LIST' }); } break; case 'Enable': rows = props.table.getCheckedRows(tableid); - if(!rows || rows.length === 0){ - toast({content:请选择数据,color:'warning'});/* 国际化处理: 请选择数据,请选择数据*/ - return + if (!rows || rows.length === 0) { + toast({content: 请选择数据, color: 'warning'});/* 国际化处理: 请选择数据,请选择数据*/ + return } pk_orgs = []; - rows.forEach(row=>{pk_orgs.push(row.data.values.pk_org.value)}); - if(!this.hasPerm(pk_orgs)){ + rows.forEach(row => { + pk_orgs.push(row.data.values.pk_org.value) + }); + if (!this.hasPerm(pk_orgs)) { break; } promptBox({ - color: 'warning', // 提示类别默认"success", "success"/"info"/"warning"/"danger",非必输 - title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000018'), // 提示标题, 默认不同类别下分别为:"已成功"/"帮助信息"/"请注意"/"出错啦",非必输/* 国际化处理: 确认启用*/ - content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000019'), // 提示内容,非必输/* 国际化处理: 是否确认要启用数据?*/ - noFooter: false, // 是否显示底部按钮(确定、取消),默认显示(false),非必输 - noCancelBtn: false, // 是否显示取消按钮,,默认显示(false),非必输 - beSureBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000016'), // 确定按钮名称, 默认为"确定",非必输/* 国际化处理: 确定*/ - cancelBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017'), // 取消按钮名称, 默认为"取消",非必输/* 国际化处理: 取消*/ - beSureBtnClick: () => { - let selectedData=this.props.table.getCheckedRows(tableid); - let _enable_dataArr=[]; + color: 'warning', // 提示类别默认"success", "success"/"info"/"warning"/"danger",非必输 + title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000018'), // 提示标题, 默认不同类别下分别为:"已成功"/"帮助信息"/"请注意"/"出错啦",非必输/* 国际化处理: 确认启用*/ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000019'), // 提示内容,非必输/* 国际化处理: 是否确认要启用数据?*/ + noFooter: false, // 是否显示底部按钮(确定、取消),默认显示(false),非必输 + noCancelBtn: false, // 是否显示取消按钮,,默认显示(false),非必输 + beSureBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000016'), // 确定按钮名称, 默认为"确定",非必输/* 国际化处理: 确定*/ + cancelBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017'), // 取消按钮名称, 默认为"取消",非必输/* 国际化处理: 取消*/ + beSureBtnClick: () => { + let selectedData = this.props.table.getCheckedRows(tableid); + let _enable_dataArr = []; selectedData.forEach((val) => { let _enable_Obj = { status: '2', @@ -1232,13 +1356,13 @@ class Material extends Component { } } }; - _enable_Obj.rowid=val.data.rowId; - _enable_Obj.values.ts.value=val.data.values.ts.value; - _enable_Obj.values.pk_material.value=val.data.values.pk_material.value; + _enable_Obj.rowid = val.data.rowId; + _enable_Obj.values.ts.value = val.data.values.ts.value; + _enable_Obj.values.pk_material.value = val.data.values.pk_material.value; _enable_dataArr.push(_enable_Obj); }); let enable_data = { - pageid:pagecode, + pageid: pagecode, model: { areaType: 'table', pageinfo: null, @@ -1247,12 +1371,12 @@ class Material extends Component { }; ajax({ url: urls['enableMaterial'], - data:enable_data, + data: enable_data, success: (res) => { //此处使用箭头函数,如果不使用箭头函数,一定要bind(this) - let { success,data} = res; + let {success, data} = res; console.log(data); if (success) { - this.queryData({pageInfo: {...pageInfo1},isRefresh:false}); + this.queryData({pageInfo: {...pageInfo1}, isRefresh: false}); // Utils.handleTableReData({ // tableid : tableid, // props : this.props, @@ -1267,34 +1391,39 @@ class Material extends Component { // }); } this.updateButtonDisable(); - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000022'),color:'success'});/* 国际化处理: 启用成功*/ + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000022'), + color: 'success' + });/* 国际化处理: 启用成功*/ } }); - } - }); + } + }); break; case 'Disable': rows = props.table.getCheckedRows(tableid); - if(!rows || rows.length === 0){ - toast({content:请选择数据,color:'warning'});/* 国际化处理: 请选择数据,请选择数据*/ - return + if (!rows || rows.length === 0) { + toast({content: 请选择数据, color: 'warning'});/* 国际化处理: 请选择数据,请选择数据*/ + return } pk_orgs = []; - rows.forEach(row=>{pk_orgs.push(row.data.values.pk_org.value)}); - if(!this.hasPerm(pk_orgs)){ + rows.forEach(row => { + pk_orgs.push(row.data.values.pk_org.value) + }); + if (!this.hasPerm(pk_orgs)) { break; } promptBox({ - color: 'warning', // 提示类别默认"success", "success"/"info"/"warning"/"danger",非必输 - title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000023'), // 提示标题, 默认不同类别下分别为:"已成功"/"帮助信息"/"请注意"/"出错啦",非必输/* 国际化处理: 确认停用*/ - content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000024'), // 提示内容,非必输/* 国际化处理: 是否确认要停用数据?*/ - noFooter: false, // 是否显示底部按钮(确定、取消),默认显示(false),非必输 - noCancelBtn: false, // 是否显示取消按钮,,默认显示(false),非必输 - beSureBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000016'), // 确定按钮名称, 默认为"确定",非必输/* 国际化处理: 确定*/ - cancelBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017'), // 取消按钮名称, 默认为"取消",非必输/* 国际化处理: 取消*/ - beSureBtnClick: () => { - let _disable_selectedData=this.props.table.getCheckedRows(tableid); - let _disable_dataArr=[]; + color: 'warning', // 提示类别默认"success", "success"/"info"/"warning"/"danger",非必输 + title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000023'), // 提示标题, 默认不同类别下分别为:"已成功"/"帮助信息"/"请注意"/"出错啦",非必输/* 国际化处理: 确认停用*/ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000024'), // 提示内容,非必输/* 国际化处理: 是否确认要停用数据?*/ + noFooter: false, // 是否显示底部按钮(确定、取消),默认显示(false),非必输 + noCancelBtn: false, // 是否显示取消按钮,,默认显示(false),非必输 + beSureBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000016'), // 确定按钮名称, 默认为"确定",非必输/* 国际化处理: 确定*/ + cancelBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017'), // 取消按钮名称, 默认为"取消",非必输/* 国际化处理: 取消*/ + beSureBtnClick: () => { + let _disable_selectedData = this.props.table.getCheckedRows(tableid); + let _disable_dataArr = []; _disable_selectedData.forEach((val) => { let _disable_Obj = { status: '2', @@ -1307,13 +1436,13 @@ class Material extends Component { } } }; - _disable_Obj.rowid=val.data.rowId; - _disable_Obj.values.ts.value=val.data.values.ts.value; - _disable_Obj.values.pk_material.value=val.data.values.pk_material.value; + _disable_Obj.rowid = val.data.rowId; + _disable_Obj.values.ts.value = val.data.values.ts.value; + _disable_Obj.values.pk_material.value = val.data.values.pk_material.value; _disable_dataArr.push(_disable_Obj); }); let disable_data = { - pageid:pagecode, + pageid: pagecode, model: { areaType: 'table', pageinfo: null, @@ -1322,12 +1451,12 @@ class Material extends Component { }; ajax({ url: urls['disableMaterial'], - data:disable_data, + data: disable_data, success: (res) => { - let { success,data} = res; + let {success, data} = res; console.log(data); if (success) { - this.queryData({pageInfo: {...pageInfo1},isRefresh:false}); + this.queryData({pageInfo: {...pageInfo1}, isRefresh: false}); // Utils.handleTableReData({ // tableid : tableid, // props : this.props, @@ -1345,33 +1474,36 @@ class Material extends Component { // }); } this.updateButtonDisable(); - if(data.error){ - toast({content:data.error,color:'warning'}); - }else{ - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000025'),color:'success'});/* 国际化处理: 停用成功*/ + if (data.error) { + toast({content: data.error, color: 'warning'}); + } else { + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000025'), + color: 'success' + });/* 国际化处理: 停用成功*/ } - + } }); - } - }); + } + }); break; case 'Upgrade': rows = props.table.getCheckedRows(tableid); - if(!rows || rows.length === 0){ - toast({content:请选择数据,color:'warning'});/* 国际化处理: 请选择数据,请选择数据*/ - return + if (!rows || rows.length === 0) { + toast({content: 请选择数据, color: 'warning'});/* 国际化处理: 请选择数据,请选择数据*/ + return } promptBox({ - color: 'warning', // 提示类别默认"success", "success"/"info"/"warning"/"danger",非必输 - title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000027'), // 提示标题, 默认不同类别下分别为:"已成功"/"帮助信息"/"请注意"/"出错啦",非必输/* 国际化处理: 确认升级*/ - content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000172'), // 提示内容,非必输/* 国际化处理: 升级时会同步升级选中物料的所有版本的数据!是否升级?*/ - noFooter: false, // 是否显示底部按钮(确定、取消),默认显示(false),非必输 - noCancelBtn: false, // 是否显示取消按钮,,默认显示(false),非必输 - beSureBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000016'), // 确定按钮名称, 默认为"确定",非必输/* 国际化处理: 确定*/ - cancelBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017'), // 取消按钮名称, 默认为"取消",非必输/* 国际化处理: 取消*/ - beSureBtnClick: () => { - let _dataArr=[]; + color: 'warning', // 提示类别默认"success", "success"/"info"/"warning"/"danger",非必输 + title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000027'), // 提示标题, 默认不同类别下分别为:"已成功"/"帮助信息"/"请注意"/"出错啦",非必输/* 国际化处理: 确认升级*/ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000172'), // 提示内容,非必输/* 国际化处理: 升级时会同步升级选中物料的所有版本的数据!是否升级?*/ + noFooter: false, // 是否显示底部按钮(确定、取消),默认显示(false),非必输 + noCancelBtn: false, // 是否显示取消按钮,,默认显示(false),非必输 + beSureBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000016'), // 确定按钮名称, 默认为"确定",非必输/* 国际化处理: 确定*/ + cancelBtnName: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017'), // 取消按钮名称, 默认为"取消",非必输/* 国际化处理: 取消*/ + beSureBtnClick: () => { + let _dataArr = []; rows.forEach((val) => { let _Obj = { values: { @@ -1383,13 +1515,13 @@ class Material extends Component { } } }; - _Obj.rowid=val.data.rowId; - _Obj.values.ts.value=val.data.values.ts.value; - _Obj.values.pk_material.value=val.data.values.pk_material.value; + _Obj.rowid = val.data.rowId; + _Obj.values.ts.value = val.data.values.ts.value; + _Obj.values.pk_material.value = val.data.values.pk_material.value; _dataArr.push(_Obj); }); let disable_data = { - pageid:pagecode, + pageid: pagecode, model: { areaType: 'table', pageinfo: null, @@ -1398,74 +1530,82 @@ class Material extends Component { }; ajax({ url: urls['upgradeMaterial'], - data:disable_data, + data: disable_data, success: (res) => { - let { success,data} = res; + let {success, data} = res; if (success) { console.log(data); } - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000173'),color:'success'});/* 国际化处理: 升级成功*/ - let pageInfo=this.props.table.getTablePageInfo(tableid); - this.queryData({pageInfo,isRefresh:true}); + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000173'), + color: 'success' + });/* 国际化处理: 升级成功*/ + let pageInfo = this.props.table.getTablePageInfo(tableid); + this.queryData({pageInfo, isRefresh: true}); } }); - } - }); + } + }); break; case 'Refresh': let searchVal = this.props.search.getQueryInfo(searchid); - if(!searchVal || !searchVal.querycondition) { + if (!searchVal || !searchVal.querycondition) { return; } - setDefData('searchVal',this.props.config.datasource,searchVal); - let pageInfo=this.props.table.getTablePageInfo(tableid); + setDefData('searchVal', this.props.config.datasource, searchVal); + let pageInfo = this.props.table.getTablePageInfo(tableid); // let pageInfo = { // pageIndex : 0, // pageSize : 10 // }; // this.queryData({pageInfo: {...pageInfo, pageIndex: 0},isRefresh:true}); - if(showToast){ - this.queryData({pageInfo: {...pageInfo, pageIndex: 0},isRefresh:showToast,isToTop:isToTop}); - }else{ - this.queryData({pageInfo: {...pageInfo},isRefresh:showToast,isToTop:isToTop}); + if (showToast) { + this.queryData({pageInfo: {...pageInfo, pageIndex: 0}, isRefresh: showToast, isToTop: isToTop}); + } else { + this.queryData({pageInfo: {...pageInfo}, isRefresh: showToast, isToTop: isToTop}); } - + break; case 'Copy': rows = props.table.getCheckedRows(tableid); - if(!rows || rows.length !== 1){ - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000067'),color:'warning'});/* 国际化处理: 请选择一条数据进行复制*/ - return + if (!rows || rows.length !== 1) { + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000067'), + color: 'warning' + });/* 国际化处理: 请选择一条数据进行复制*/ + return } ajax({ - url : urls['addMaterial'], - data : {node_type:this.config.node_type}, - success : (res) => { - props.pushTo('card',{ - pagecode:this.props.config.pagecodecard, - status:'copy', - id : rows[0].data.values['pk_material'].value + url: urls['addMaterial'], + data: {node_type: this.config.node_type}, + success: (res) => { + props.pushTo('card', { + pagecode: this.props.config.pagecodecard, + status: 'copy', + id: rows[0].data.values['pk_material'].value }) } }); break; case 'Assign'://快速分配 rows = props.table.getCheckedRows(tableid); - if(!rows || rows.length === 0){ - toast({content:请选择数据,color:'warning'});/* 国际化处理: 请选择数据,请选择数据*/ - return + if (!rows || rows.length === 0) { + toast({content: 请选择数据, color: 'warning'});/* 国际化处理: 请选择数据,请选择数据*/ + return } pk_orgs = []; - rows.forEach(row=>{pk_orgs.push(row.data.values.pk_org.value)}); + rows.forEach(row => { + pk_orgs.push(row.data.values.pk_org.value) + }); ajax({ - url : urls['queryJurisdiction'], - data : {}, - success : (res) => { - if(res.data){ + url: urls['queryJurisdiction'], + data: {}, + success: (res) => { + if (res.data) { // do nothing - - }else{ - if(!this.hasPerm(pk_orgs)){ + + } else { + if (!this.hasPerm(pk_orgs)) { return; } } @@ -1473,10 +1613,12 @@ class Material extends Component { rows.forEach((val) => { ids.push(val.data.values.pk_material.value); }); - this.setState({assignModal:true},()=>{this.assignModal.show(ids,false);}); + this.setState({assignModal: true}, () => { + this.assignModal.show(ids, false); + }); } }); - + //this.assignModal.show(ids,false); break; case 'AssignWizard': @@ -1493,7 +1635,7 @@ class Material extends Component { // data : {}, // success : (res) => { // if(res.data){ - + // }else{ // if(!this.hasPerm(pk_orgs)){ // return; @@ -1502,26 +1644,30 @@ class Material extends Component { // this.setState({assignStepModal:true},()=>{this.assignStepModal.show('assign');}); // } // }); - this.setState({assignStepModal:true},()=>{this.assignStepModal.show('assign');}); - + this.setState({assignStepModal: true}, () => { + this.assignStepModal.show('assign'); + }); + break; case 'CancelAssign': rows = props.table.getCheckedRows(tableid); - if(!rows || rows.length === 0){ - toast({content:请选择数据,color:'warning'});/* 国际化处理: 请选择数据,请选择数据*/ - return + if (!rows || rows.length === 0) { + toast({content: 请选择数据, color: 'warning'});/* 国际化处理: 请选择数据,请选择数据*/ + return } pk_orgs = []; - rows.forEach(row=>{pk_orgs.push(row.data.values.pk_org.value)}); + rows.forEach(row => { + pk_orgs.push(row.data.values.pk_org.value) + }); ajax({ - url : urls['queryJurisdiction'], - data : {}, - success : (res) => { - if(res.data){ + url: urls['queryJurisdiction'], + data: {}, + success: (res) => { + if (res.data) { // do nothing - - }else{ - if(!this.hasPerm(pk_orgs)){ + + } else { + if (!this.hasPerm(pk_orgs)) { return; } } @@ -1529,28 +1675,35 @@ class Material extends Component { rows.forEach((val) => { ids.push(val.data.values.pk_material.value); }); - this.setState({assignModal:true},()=>{this.assignModal.show(ids,true);}); + this.setState({assignModal: true}, () => { + this.assignModal.show(ids, true); + }); } }); - - + + //this.assignModal.show(ids,true); break; case 'AssignStatus': rows = props.table.getCheckedRows(tableid); - if(!rows || rows.length === 0){ - toast({content:请选择数据,color:'warning'});/* 国际化处理: 请选择数据,请选择数据*/ - return - }else if(rows.length > 1){ - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000068'),color:'warning'});/* 国际化处理: 请选择一条数据*/ - return + if (!rows || rows.length === 0) { + toast({content: 请选择数据, color: 'warning'});/* 国际化处理: 请选择数据,请选择数据*/ + return + } else if (rows.length > 1) { + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000068'), + color: 'warning' + });/* 国际化处理: 请选择一条数据*/ + return } - this.props.modal.show('assignstatusModal',{ + this.props.modal.show('assignstatusModal', { title: [this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000048'), /* 国际化处理: 已分配组织查询*/,/* 国际化处理: 已分配组织查询*/ - - - ], - content : this.getAssignStatus(rows[0].data.values['pk_material'].value) + + + ], + content: this.getAssignStatus(rows[0].data.values['pk_material'].value) }); break; case 'OrgBrowse': @@ -1560,217 +1713,313 @@ class Material extends Component { props.modal.show('marOrgModal'); break; case 'Print': - let checkdata =props.table.getCheckedRows(tableid) - if(this.state.oids.length === 0){ - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000069'),color:'warning'});/* 国际化处理: 无可打印数据*/ + let checkdata = props.table.getCheckedRows(tableid) + if (this.state.oids.length === 0) { + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000069'), + color: 'warning' + });/* 国际化处理: 无可打印数据*/ return; } - if(checkdata.length>160000){ - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000160'),color:'warning'});/* 国际化处理: 打印的数据不能大于16000条*/ + if (checkdata.length > 160000) { + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000160'), + color: 'warning' + });/* 国际化处理: 打印的数据不能大于16000条*/ return; } - if(checkdata.length<=0&&this.state.oids.length > 16000){ - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000160'),color:'warning'});/* 国际化处理: 打印的数据不能大于16000条*/ + if (checkdata.length <= 0 && this.state.oids.length > 16000) { + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000160'), + color: 'warning' + });/* 国际化处理: 打印的数据不能大于16000条*/ return; } let pk_materials = []; - checkdata.forEach(row=>{pk_materials.push(row.data.values.pk_material.value)}); + checkdata.forEach(row => { + pk_materials.push(row.data.values.pk_material.value) + }); var tableorder = this.props.table.getSortParam(tableid); print('pdf', - urls['print'], - { - funcode : this.config.print.funcode, - appcode : this.config.appcode, - nodekey : this.config.print.nodekey, - //userjson:`{order:${tableorder && tableorder.sortParam[0].order},field:${tableorder && tableorder.sortParam[0].field}}`, - oids : pk_materials.length>0?pk_materials:this.state.oids - }); + urls['print'], + { + funcode: this.config.print.funcode, + appcode: this.config.appcode, + nodekey: this.config.print.nodekey, + //userjson:`{order:${tableorder && tableorder.sortParam[0].order},field:${tableorder && tableorder.sortParam[0].field}}`, + oids: pk_materials.length > 0 ? pk_materials : this.state.oids + }); break; case 'Output': - let checkdatas =props.table.getCheckedRows(tableid) + let checkdatas = props.table.getCheckedRows(tableid) let allpk_materials = []; - checkdatas.forEach(row=>{allpk_materials.push(row.data.values.pk_material.value)}); - if(this.state.oids.length === 0){ - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000070'),color:'warning'});/* 国际化处理: 无可输出的数据*/ + checkdatas.forEach(row => { + allpk_materials.push(row.data.values.pk_material.value) + }); + if (this.state.oids.length === 0) { + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000070'), + color: 'warning' + });/* 国际化处理: 无可输出的数据*/ return; } - + var outorder = this.props.table.getSortParam(tableid); let data = { - funcode:this.config.print.funcode, - appcode:this.config.appcode, //小应用编码 - nodekey:this.config.print.nodekey, //模板节点标识 - // userjson:`{order:${outorder && outorder.sortParam[0].order},field:${outorder && outorder.sortParam[0].field}}`, - oids:allpk_materials.length>0?allpk_materials:this.state.oids, // 功能节点的数据主键 oids含有多个元素(['1001A41000000000A9LR','1001A410000000009JDD'])时为批量打印 + funcode: this.config.print.funcode, + appcode: this.config.appcode, //小应用编码 + nodekey: this.config.print.nodekey, //模板节点标识 + // userjson:`{order:${outorder && outorder.sortParam[0].order},field:${outorder && outorder.sortParam[0].field}}`, + oids: allpk_materials.length > 0 ? allpk_materials : this.state.oids, // 功能节点的数据主键 oids含有多个元素(['1001A41000000000A9LR','1001A410000000009JDD'])时为批量打印 outputType: 'output' } - this.setState(this.state,() => { - output({data: data,url:urls['print']}) + this.setState(this.state, () => { + output({data: data, url: urls['print']}) }); break; case 'File': rows = props.table.getCheckedRows(tableid); - if(!rows || rows.length !== 1){ - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000071'),color:'warning'});/* 国际化处理: 请选择一条数据进行操作*/ - return + if (!rows || rows.length !== 1) { + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000071'), + color: 'warning' + });/* 国际化处理: 请选择一条数据进行操作*/ + return } pk_orgs = []; - rows.forEach(row=>{pk_orgs.push(row.data.values.pk_org.value)}); - if(!this.hasPerm(pk_orgs)){ + rows.forEach(row => { + pk_orgs.push(row.data.values.pk_org.value) + }); + if (!this.hasPerm(pk_orgs)) { break; } this.setState({ - showUploader:true, - uploaderDir : rows[0].data.values['pk_material'].value + showUploader: true, + uploaderDir: rows[0].data.values['pk_material'].value }); break; case 'export'://导出模板前需清空exportIds this.setState({ - exportIds : [], - billType:this.props.config.billType, - appcode:this.props.config.appcode, - pagecode_card:this.props.config.pagecode_card, + exportIds: [], + billType: this.props.config.billType, + appcode: this.props.config.appcode, + pagecode_card: this.props.config.pagecode_card, forceRender: false - },()=>{ + }, () => { this.props.modal.show('exportFileModal'); }); break; case 'export_assign'://导出模板前需清空exportIds this.setState({ - importparams:{type:'stock'}, - billType:'import_assign', - appcode:'10140MAG', - pagecode_card:'import_assign', + importparams: {type: 'stock'}, + billType: 'import_assign', + appcode: '10140MAG', + pagecode_card: 'import_assign', forceRender: false - },()=>{ + }, () => { this.props.modal.show('exportFileModal'); }); break; case 'exportstock'://导出模板前需清空exportIds this.setState({ - importparams:{type:'stock'}, - billType:'materialstock', - appcode:'10140MAG', - pagecode_card:'stock_import', + importparams: {type: 'stock'}, + billType: 'materialstock', + appcode: '10140MAG', + pagecode_card: 'stock_import', forceRender: false - },()=>{ + }, () => { this.props.modal.show('exportFileModal'); }); break; case 'exportcost'://导出模板前需清空exportIds this.setState({ - importparams:{type:'cost'}, - billType:'materialcost', - appcode:'10140MAG', - pagecode_card:'cost_import', + importparams: {type: 'cost'}, + billType: 'materialcost', + appcode: '10140MAG', + pagecode_card: 'cost_import', forceRender: false - },()=>{ + }, () => { this.props.modal.show('exportFileModal'); }); break; case 'exportsale'://导出模板前需清空exportIds this.setState({ - importparams:{type:'sale'}, - billType:'materialsale', - appcode:'10140MAG', - pagecode_card:'sale_import', + importparams: {type: 'sale'}, + billType: 'materialsale', + appcode: '10140MAG', + pagecode_card: 'sale_import', forceRender: false - },()=>{ + }, () => { this.props.modal.show('exportFileModal'); }); break; case 'exportfi'://导出模板前需清空exportIds this.setState({ - importparams:{type:'fi'}, - billType:'materialfi', - appcode:'10140MAG', - pagecode_card:'fi_import' - },()=>{ + importparams: {type: 'fi'}, + billType: 'materialfi', + appcode: '10140MAG', + pagecode_card: 'fi_import' + }, () => { this.props.modal.show('exportFileModal'); }); break; case 'exportpu'://导出模板前需清空exportIds this.setState({ - importparams:{type:'pu'}, - billType:'materialpu', - appcode:'10140MAG', - pagecode_card:'pu_import' - },()=>{ + importparams: {type: 'pu'}, + billType: 'materialpu', + appcode: '10140MAG', + pagecode_card: 'pu_import' + }, () => { this.props.modal.show('exportFileModal'); }); break; case 'exportplan'://导出模板前需清空exportIds this.setState({ - importparams:{type:'plan'}, - billType:'materialplan', - appcode:'10140MAG', - pagecode_card:'plan_import' - },()=>{ + importparams: {type: 'plan'}, + billType: 'materialplan', + appcode: '10140MAG', + pagecode_card: 'plan_import' + }, () => { this.props.modal.show('exportFileModal'); }); break; case 'exportprod'://导出模板前需清空exportIds this.setState({ - importparams:{type:'prod'}, - billType:'materialprod', - appcode:'10140MAG', - pagecode_card:'prod_import' - },()=>{ + importparams: {type: 'prod'}, + billType: 'materialprod', + appcode: '10140MAG', + pagecode_card: 'prod_import' + }, () => { this.props.modal.show('exportFileModal'); }); break; case 'exportpfc'://导出模板前需清空exportIds this.setState({ - importparams:{type:'pfc'}, - billType:'materialpfc', - appcode:'10140MAG', - pagecode_card:'pfc_import' - },()=>{ + importparams: {type: 'pfc'}, + billType: 'materialpfc', + appcode: '10140MAG', + pagecode_card: 'pfc_import' + }, () => { this.props.modal.show('exportFileModal'); }); break; - case 'exportpfcc'://导出模板前需清空exportIds + case 'exportpfcc'://导出模板前需清空exportIds this.setState({ - importparams:{type:'pfcc'}, - billType:'materialpfcc', - appcode:'10140MAG', - pagecode_card:'cost_import' - },()=>{ + importparams: {type: 'pfcc'}, + billType: 'materialpfcc', + appcode: '10140MAG', + pagecode_card: 'cost_import' + }, () => { this.props.modal.show('exportFileModal'); }); break; case 'exportData'://导出数据前需将界面上数据的主键填充到exportIds - if(this.state.oids.length === 0){ - toast({content : '无可导出的数据',color : 'warning'}); + if (this.state.oids.length === 0) { + toast({content: '无可导出的数据', color: 'warning'}); return; } - this.setState({exportIds : deepClone(this.state.oids), forceRender: false},()=>{ + this.setState({exportIds: deepClone(this.state.oids), forceRender: false}, () => { this.props.modal.show('exportFileModal'); }); break; case 'exportimages': - let imageDatas =props.table.getCheckedRows(tableid) + let imageDatas = props.table.getCheckedRows(tableid) let allpks = []; - imageDatas.forEach(row=>{allpks.push(row.data.values.pk_material.value)}); - if(this.state.oids.length === 0){ - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000070'),color:'warning'});/* 国际化处理: 无可输出的数据*/ + imageDatas.forEach(row => { + allpks.push(row.data.values.pk_material.value) + }); + if (this.state.oids.length === 0) { + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000070'), + color: 'warning' + });/* 国际化处理: 无可输出的数据*/ return; } - + let idata = { - node_type:node_type, - pks:allpks.length>0?allpks:this.state.oids + node_type: node_type, + pks: allpks.length > 0 ? allpks : this.state.oids } formDownload({ params: idata, url: "/nccloud/uapbd/material/materialImagesexport.do", enctype: 2, callback: this.props.afterDownload || EMPTYFUNC - }); + }); break; // case 'importimages': // props.modal.show('importImagesModel'); // break; + case 'dldztomes': + rows = props.table.getCheckedRows(tableid); + if (!rows || rows.length === 0) { + toast({content: '请选择数据', color: 'warning'});/* 国际化处理: 请选择数据,请选择数据*/ + return + } + pks = []; + rows.forEach(row => { + pks.push(row.data.values.pk_material.value) + }); + ajax({ + url: "/nccloud/uapbd/material/pushtodldzmes.do", + data: { + pks: pks + }, + success: (res) => { + toast({ + content: "推送成功", + color: 'success' + }); + // this.onButtonClick(props, 'Refresh'); + } + }) + break; + case 'pushtoqms': + rows = props.table.getCheckedRows(tableid); + if (!rows || rows.length === 0) { + toast({content: '请选择数据', color: 'warning'});/* 国际化处理: 请选择数据,请选择数据*/ + return + } + pks = []; + rows.forEach(row => { + pks.push(row.data.values.pk_material.value) + }); + ajax({ + url: "/nccloud/uapbd/material/pushtoqms.do", + data: { + pks: pks + }, + success: (res) => { + toast({ + content: "推送成功", + color: 'success' + }); + } + }) + break; + case 'pushtojmqy': + rows = props.table.getCheckedRows(tableid); + if (!rows || rows.length === 0) { + toast({content: '请选择数据', color: 'warning'});/* 国际化处理: 请选择数据,请选择数据*/ + return + } + pks = []; + rows.forEach(row => { + pks.push(row.data.values.pk_material.value) + }); + ajax({ + url: "/nccloud/uapbd/material/pushtojmqy.do", + data: { + pks: pks + }, + success: (res) => { + toast({ + content: "推送成功", + color: 'success' + }); + } + }) + break; default: break; } @@ -1778,31 +2027,70 @@ class Material extends Component { getAssignStatus = (pk_material) => { - let AssignStatusConfig = {pk_material:pk_material}; + let AssignStatusConfig = {pk_material: pk_material}; return ( - + ); } - getDeleteModalContext = (dataArr,indexArr) => { - let newModalTitle={fontWeight: 'normal !important',paddingLeft: 38,lineHeight: '21px',fontSize: 18,marginTop: 5,display: 'flex'}; - let newModalBody={marginBottom: 15,padding: '8px 47px 0 85px',width: '100%',fontSize: 13,height: '-webkit-max-content',height: '-moz-max-content',height: 'max-content',lineHeight: '21px',color: '#555555'}; - + getDeleteModalContext = (dataArr, indexArr) => { + let newModalTitle = { + fontWeight: 'normal !important', + paddingLeft: 38, + lineHeight: '21px', + fontSize: 18, + marginTop: 5, + display: 'flex' + }; + let newModalBody = { + marginBottom: 15, + padding: '8px 47px 0 85px', + width: '100%', + fontSize: 13, + height: '-webkit-max-content', + height: '-moz-max-content', + height: 'max-content', + lineHeight: '21px', + color: '#555555' + }; + return ( [ -

{this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000056')/* 国际化处理: 删除*/}

, -
{this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000053')/* 国际化处理: 删除可能等待很长的时间,可以点击'后台删除'按钮,调用后台任务执行。*/}
, - +

{this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000056')/* 国际化处理: 删除*/} +

, +
{this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000053')/* 国际化处理: 删除可能等待很长的时间,可以点击'后台删除'按钮,调用后台任务执行。*/}
, + ] ) } - getDelcustomBtns = (dataArr,indexArr)=>{ - let newuModalFooter={height: 45,paddingLeft: 0,backgroundColor: '#fff',borderTop: '1px solid #d0d0d0',marginTop: 5,marginBottom:-7,display:'flex',flexDirection:'row-reverse',alignItems:'flex-end'}; + getDelcustomBtns = (dataArr, indexArr) => { + let newuModalFooter = { + height: 45, + paddingLeft: 0, + backgroundColor: '#fff', + borderTop: '1px solid #d0d0d0', + marginTop: 5, + marginBottom: -7, + display: 'flex', + flexDirection: 'row-reverse', + alignItems: 'flex-end' + }; return (
- {this.props.modal.close("deleteModal");this.onDelForBrowse(false,dataArr,indexArr)}}>{this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000056')/* 国际化处理: 删除*/} - {this.props.modal.close("deleteModal");this.onDelForBrowse(true,dataArr,indexArr)}}>{this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000030')/* 国际化处理: 后台删除*/} - {this.props.modal.close("deleteModal");} }>{this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017')/* 国际化处理: 取消*/} + { + this.props.modal.close("deleteModal"); + this.onDelForBrowse(false, dataArr, indexArr) + }}>{this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000056')/* 国际化处理: 删除*/} + { + this.props.modal.close("deleteModal"); + this.onDelForBrowse(true, dataArr, indexArr) + }}>{this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000030')/* 国际化处理: 后台删除*/} + { + this.props.modal.close("deleteModal"); + }}>{this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000017')/* 国际化处理: 取消*/}
); } @@ -1810,11 +2098,11 @@ class Material extends Component { /** * 确认删除 */ - onDelForBrowse(isBackDelete,dataArr,indexArr){ - if(!dataArr){ - let selectedData=this.props.table.getCheckedRows(tableid); - indexArr=[]; - dataArr=[]; + onDelForBrowse(isBackDelete, dataArr, indexArr) { + if (!dataArr) { + let selectedData = this.props.table.getCheckedRows(tableid); + indexArr = []; + dataArr = []; selectedData.forEach((val) => { let delObj = { status: '3', @@ -1825,51 +2113,57 @@ class Material extends Component { pk_material: { display: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000021'),/* 国际化处理: 主键*/ }, - name : { - display : this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000072')/* 国际化处理: 物料名称*/ + name: { + display: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000072')/* 国际化处理: 物料名称*/ }, - code : { - display : this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000073')/* 国际化处理: 物料编码*/ + code: { + display: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000073')/* 国际化处理: 物料编码*/ } } }; - delObj.rowId=val.data.rowId; - delObj.values.ts.value=val.data.values.ts.value; - delObj.values.pk_material.value=val.data.values.pk_material.value; + delObj.rowId = val.data.rowId; + delObj.values.ts.value = val.data.values.ts.value; + delObj.values.pk_material.value = val.data.values.pk_material.value; dataArr.push(delObj); indexArr.push(val.index); }); } - let data = { - pageid:pagecode, - model: { - areaType: 'table', - pageinfo: null, - rows: dataArr + let data = { + pageid: pagecode, + model: { + areaType: 'table', + pageinfo: null, + rows: dataArr }, - userjson : `{\"isBackDelete\":\"${isBackDelete?'1':'0'}\"}` - }; - ajax({ - url: urls['deleteMaterial'], - data, - success: (res) => { //此处使用箭头函数,如果不使用箭头函数,一定要bind(this) - let { success, data } = res; - if (success) { - if(isBackDelete){ - toast({title:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000174'),color:'success'});/* 国际化处理: 已添加后台任务*/ - this.queryData({isDelete:true}); - }else{ + userjson: `{\"isBackDelete\":\"${isBackDelete ? '1' : '0'}\"}` + }; + ajax({ + url: urls['deleteMaterial'], + data, + success: (res) => { //此处使用箭头函数,如果不使用箭头函数,一定要bind(this) + let {success, data} = res; + if (success) { + if (isBackDelete) { + toast({ + title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-0000174'), + color: 'success' + });/* 国际化处理: 已添加后台任务*/ + this.queryData({isDelete: true}); + } else { this.props.table.deleteTableRowsByIndex(tableid, indexArr); - dataArr.forEach(item=>{ - this.props.table.deleteCacheId(tableid,item.values.pk_material.value); + dataArr.forEach(item => { + this.props.table.deleteCacheId(tableid, item.values.pk_material.value); }); - toast({content:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000029'),color:'success'});/* 国际化处理: 删除成功*/ - this.queryData({isDelete:true}); + toast({ + content: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000029'), + color: 'success' + });/* 国际化处理: 删除成功*/ + this.queryData({isDelete: true}); } - } - } - }); - } + } + } + }); + } createOrgDoc = () => { return ( @@ -1888,67 +2182,67 @@ class Material extends Component { */ onCheckShowDisable = (value) => { this.setState({ - checkflag : value - },()=>{ - setDefData('checkflag',this.props.config.datasource,value); - this.queryData({isSearch:true}); + checkflag: value + }, () => { + setDefData('checkflag', this.props.config.datasource, value); + this.queryData({isSearch: true}); }); } updateButtonDisable = () => { let rows = this.props.table.getCheckedRows(tableid); let length = rows && rows.length > 0 ? rows.length : 0; - if(length === 0){ + if (length === 0) { this.props.button.setDisabled({ - Delete : true, - AssignStatus : true, - Assign:true, - CancelAssign:true, - BatchUpdate : true, - Enable:true, - Disable:true, - Upgrade:true + Delete: true, + AssignStatus: true, + Assign: true, + CancelAssign: true, + BatchUpdate: true, + Enable: true, + Disable: true, + Upgrade: true }); - }else if(length === 1){ + } else if (length === 1) { let Disable = false; let Enable = false; - if(rows[0].data.values.enablestate.value === '2'){ + if (rows[0].data.values.enablestate.value === '2') { Enable = true; - }else{ + } else { Disable = true; } this.props.button.setDisabled({ - Delete : false, - Assign:false, - CancelAssign:false, - AssignStatus : false, - BatchUpdate : false, - Upgrade:false, - Enable:Enable, - Disable:Disable + Delete: false, + Assign: false, + CancelAssign: false, + AssignStatus: false, + BatchUpdate: false, + Upgrade: false, + Enable: Enable, + Disable: Disable }); - }else if(length > 1){ + } else if (length > 1) { this.props.button.setDisabled({ - Delete : false, - Assign:false, - CancelAssign:false, - AssignStatus : true, - BatchUpdate : false, - Upgrade:false, - Enable:false, - Disable:false + Delete: false, + Assign: false, + CancelAssign: false, + AssignStatus: true, + BatchUpdate: false, + Upgrade: false, + Enable: false, + Disable: false }); } let tableData = this.props.table.getAllTableData(tableid); - if(tableData && tableData.rows && tableData.rows.length > 0){ + if (tableData && tableData.rows && tableData.rows.length > 0) { this.props.button.setDisabled({ - Print : false, - Output:false, + Print: false, + Output: false, }); - }else{ + } else { this.props.button.setDisabled({ - Print : true, - Output:true, + Print: true, + Output: true, }); } } @@ -1956,25 +2250,25 @@ class Material extends Component { /** * 双击行事件 */ - onRowDoubleClick = (record,index) => { + onRowDoubleClick = (record, index) => { //record(行数据) ,index(当前index) - this.props.pushTo('/card',{ - pagecode:this.props.config.pagecodecard, - status:'browse', - id : record['pk_material'].value + this.props.pushTo('/card', { + pagecode: this.props.config.pagecodecard, + status: 'browse', + id: record['pk_material'].value }); } - handlePageInfoChange = (props,config,pks) =>{ + handlePageInfoChange = (props, config, pks) => { this.queryData({}); } - render (){ - let { button, table, search,modal,BillHeadInfo} = this.props; + render() { + let {button, table, search, modal, BillHeadInfo} = this.props; const {createBillHeadInfo} = BillHeadInfo; //新加 返回图标和按钮 let {NCCreateSearch} = search; - let {createSimpleTable } = table; - let { createButtonApp } = button; + let {createSimpleTable} = table; + let {createButtonApp} = button; let {createModal} = modal; let {NCCheckbox} = base; return ( @@ -1983,135 +2277,154 @@ class Material extends Component {
{createBillHeadInfo({ - title:this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get(this.props.config.title), - initShowBackBtn:false - })} + title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get(this.props.config.title), + initShowBackBtn: false + })}
-
- {this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000074')/* 国际化处理: 显示停用*/} +
+ {this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000074')/* 国际化处理: 显示停用*/}
-
+
{this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000075')/* 国际化处理: 显示已分配*/}
{createButtonApp({ - area: 'list_head', - buttonLimit: 3, - onButtonClick: this.onButtonClick, - popContainer: document.querySelector('.header-button-area') - - })} + area: 'list_head', + buttonLimit: 3, + onButtonClick: this.onButtonClick, + popContainer: document.querySelector('.header-button-area') + + })}
{/* 查询区 */}
- {NCCreateSearch( - searchid,//模块id - { - clickSearchBtn: this.clickSearchBtn,// 点击按钮事件 - showAdvBtn: true, // 显示高级按钮 - //clickPlanEve:this.clickPlanEve, - //addAdvBody:()=>{}, - //onAfterEvent: this.onAfterEvent.bind(this), //编辑后事件 - // searchBtnName :'' // 查询按钮名称,默认查询 - // showAdvSearchPlanBtn :false, //高级面板中是否显示保存方案按钮 ;默认显示 - // replaceAdvBtnEve:()=>{}, // 业务组替换高级面板 (fun) - // replaceAdvBody: this.replaceAdvBody, // 业务组替换高级面板中的body (fun),return Dom - //addAdvTabs: this.addAdvTabs, // 添加高级查询区自定义页签 (fun), return Dom - // addAdvBody: ()=>{}, // 添加高级查询区自定义查询条件Dom (fun) , return Dom - oid:'1009Z01000000005855D' //查询模板的oid,用于查询查询方案 - } - )} + {NCCreateSearch( + searchid,//模块id + { + clickSearchBtn: this.clickSearchBtn,// 点击按钮事件 + showAdvBtn: true, // 显示高级按钮 + //clickPlanEve:this.clickPlanEve, + //addAdvBody:()=>{}, + //onAfterEvent: this.onAfterEvent.bind(this), //编辑后事件 + // searchBtnName :'' // 查询按钮名称,默认查询 + // showAdvSearchPlanBtn :false, //高级面板中是否显示保存方案按钮 ;默认显示 + // replaceAdvBtnEve:()=>{}, // 业务组替换高级面板 (fun) + // replaceAdvBody: this.replaceAdvBody, // 业务组替换高级面板中的body (fun),return Dom + //addAdvTabs: this.addAdvTabs, // 添加高级查询区自定义页签 (fun), return Dom + // addAdvBody: ()=>{}, // 添加高级查询区自定义查询条件Dom (fun) , return Dom + oid: '1009Z01000000005855D' //查询模板的oid,用于查询查询方案 + } + )}
{/* 列表区 */}
{createSimpleTable(tableid, { - dataSource: this.config.datasource, - pkname: 'pk_material', - showIndex : true, - showCheck : true, - handlePageInfoChange: this.handlePageInfoChange, // 分页器操作的回调函数 - onRowDoubleClick : this.onRowDoubleClick, - //tableModelConfirm: tableModelConfirmFn, // 弹窗确认事件回调 - //onAfterEvent: this.onAfterEvent.bind(this), // 弹窗控件的编辑后事件 - //onSelected: onSelectedFn, // 左侧选择列单个选择框回调 - //onSelectedAll: onSelectedAllFn, // 左侧选择列全选回调 - selectedChange: this.selectedChangeFn, // 选择框有变动的钩子函数 - onSelectedAll:this.onSelectedAll, - onSelected:this.onSelected - //params: 'test', // 自定义传参 + dataSource: this.config.datasource, + pkname: 'pk_material', + showIndex: true, + showCheck: true, + handlePageInfoChange: this.handlePageInfoChange, // 分页器操作的回调函数 + onRowDoubleClick: this.onRowDoubleClick, + //tableModelConfirm: tableModelConfirmFn, // 弹窗确认事件回调 + //onAfterEvent: this.onAfterEvent.bind(this), // 弹窗控件的编辑后事件 + //onSelected: onSelectedFn, // 左侧选择列单个选择框回调 + //onSelectedAll: onSelectedAllFn, // 左侧选择列全选回调 + selectedChange: this.selectedChangeFn, // 选择框有变动的钩子函数 + onSelectedAll: this.onSelectedAll, + onSelected: this.onSelected + //params: 'test', // 自定义传参 } )}
- {this.state.assignStepModal && this.assignStepModal = assignStepModal} closeEvnt={()=>{this.setState({assignStepModal:false});}} {...this.props}/>} - {this.state.assignModal && this.assignModal = assignModal} closeEvnt={()=>{this.setState({assignModal:false});}} {...this.props}/>} - {this.Batcheditmodal=item}} {...this.props} tableConfig={EditTabConfig} url={urls['batchUpdate']} onFinish={(res)=>{this.onButtonClick(this.props,'Refresh', false,false)}}/> - {this.Batcheditstepmodal=item}} {...this.props} tableConfig={BatchUpdateWizardConfig} url={urls['batchUpdateWizard']} onFinish={(res)=>{this.onButtonClick(this.props,'Refresh', false)}}/> + {this.state.assignStepModal && + this.assignStepModal = assignStepModal} + closeEvnt={() => { + this.setState({assignStepModal: false}); + }} {...this.props}/>} + {this.state.assignModal && + this.assignModal = assignModal} closeEvnt={() => { + this.setState({assignModal: false}); + }} {...this.props}/>} + { + this.Batcheditmodal = item + }} {...this.props} tableConfig={EditTabConfig} url={urls['batchUpdate']} onFinish={(res) => { + this.onButtonClick(this.props, 'Refresh', false, false) + }}/> + { + this.Batcheditstepmodal = item + }} {...this.props} tableConfig={BatchUpdateWizardConfig} url={urls['batchUpdateWizard']} + onFinish={(res) => { + this.onButtonClick(this.props, 'Refresh', false) + }}/> - {createModal('orgBrowseModal',{ - title : this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000045'), //标题/* 国际化处理: 物料按组织查看*/ - content : this.createOrgDoc(), - hasCloseBtn:true, - size : 'xlg', - noFooter : true + {createModal('orgBrowseModal', { + title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000045'), //标题/* 国际化处理: 物料按组织查看*/ + content: this.createOrgDoc(), + hasCloseBtn: true, + size: 'xlg', + noFooter: true })} - {createModal('marOrgModal',{ - title : this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000047'),/* 国际化处理: 查看组织级物料*/ - content : this.createMarOrg(), - hasCloseBtn:true, - size : 'xlg', - noFooter : true + {createModal('marOrgModal', { + title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000047'),/* 国际化处理: 查看组织级物料*/ + content: this.createMarOrg(), + hasCloseBtn: true, + size: 'xlg', + noFooter: true })} - {createModal('assignstatusModal',{ - content : '', - hasCloseBtn:true, - size : 'xlg', - noFooter : true + {createModal('assignstatusModal', { + content: '', + hasCloseBtn: true, + size: 'xlg', + noFooter: true })} - {createModal('deleteModal',{ - title : this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000046'), //标题/* 国际化处理: 确认删除*/ - content : '', - className:'junior', //内容 - noFooter : false, - showCustomBtns:true + {createModal('deleteModal', { + title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000046'), //标题/* 国际化处理: 确认删除*/ + content: '', + className: 'junior', //内容 + noFooter: false, + showCustomBtns: true })} - {createModal('modal',{ - title : this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000050'),/* 国际化处理: 提示*/ - size : 'xlg', + {createModal('modal', { + title: this.props.MutiInit.getIntl("10140MATERIAL") && this.props.MutiInit.getIntl("10140MATERIAL").get('10140MATERIAL-000050'),/* 国际化处理: 提示*/ + size: 'xlg', })} - {this.state.showUploader && {this.setState({showUploader:false})}} // 关闭功能 + onHide={() => { + this.setState({showUploader: false}) + }} // 关闭功能 //beforeUpload={this.beforeUpload} - /> + /> }