diff --git a/package.json b/package.json index 66eb30c..e398a5b 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "react-sortable-hoc": "^2.0.0", "react-to-print": "^3.0.5", "umi": "^4.4.11", - "weixin-js-sdk": "1.6.0" + "weixin-js-sdk": "1.6.0", + "xlsx": "^0.18.5" }, "devDependencies": { "@types/react": "^18.0.33", diff --git a/src/components/Common/CommonBillEvent.js b/src/components/Common/CommonBillEvent.js index 35fcdd6..9551ef3 100644 --- a/src/components/Common/CommonBillEvent.js +++ b/src/components/Common/CommonBillEvent.js @@ -2116,6 +2116,7 @@ export default (ChildComponent) => { const { sModelsId, masterData, app, masterConfig, slaveConfig, checkConfig, token, sModelsType, controlConfig, materialsConfig, processConfig, colorConfig, packConfig, slaveData, orderDetailConfig, } = this.props; + const FriendlyReminder = commonFunc.showLocalMessage(this.props, 'FriendlyReminder', '温馨提示'); const sSlaveIdArray = []; if (commonUtils.isNotEmptyArr(slaveData)) { slaveData.forEach((item) => { @@ -2240,13 +2241,12 @@ export default (ChildComponent) => { } } else if(returnData.code === -8){ Modal.info({ - title: '温馨提示:', + title: FriendlyReminder, content: (
{this.handleGetMsg(returnData.msg)}
), - okText: '确认', onOk() {}, }); this.props.onSaveState({ @@ -2384,7 +2384,7 @@ export default (ChildComponent) => { let iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'BtnCheck' || item.sControlName === 'BtnExamine' || item.sControlName === 'BtnSubmit'); /* 配置了表格允许为空 则不进行校验 */ if (slaveConfig && slaveConfig.bNotCanEmpty ) { - message.error(`${slaveConfig.sChinese || ''}${commonFunc.showMessage(app.commonConst, 'slaveNotNull')}`); // 从表不能为空! + message.error(`${slaveConfig.showName || ''}${commonFunc.showMessage(app.commonConst, 'slaveNotNull')}`); // 从表不能为空! this.props.onSaveState({ loading: false, }); @@ -2395,7 +2395,7 @@ export default (ChildComponent) => { bCheck = true; } if(bCheck) { - message.error(`${slaveConfig.sChinese || ''}${commonFunc.showMessage(app.commonConst, 'slaveNotNull')}`); // 从表不能为空! + message.error(`${slaveConfig.showName || ''}${commonFunc.showMessage(app.commonConst, 'slaveNotNull')}`); // 从表不能为空! this.props.onSaveState({ loading: false, }); @@ -6071,6 +6071,9 @@ export default (ChildComponent) => { /** 按钮操作事件 */ handleButtonClick = async (name) => { + + const FriendlyReminder = commonFunc.showLocalMessage(this.props, 'FriendlyReminder', '温馨提示'); + if (name === 'BtnOut') { this.handleOut(); } else if (name === 'BtnDesignFunction') { @@ -6329,13 +6332,12 @@ export default (ChildComponent) => { this.props.onSaveState({ ...allReturnMap, pageLoading:false, }); }else if (dataReturn.code === -8 || dataReturn.code === 2) { Modal.info({ - title: '温馨提示:', + title: FriendlyReminder, content: (
{this.handleGetMsg(dataReturn.msg)}
), - okText: '确认', onOk() {}, }); this.props.onSaveState({ ...allReturnMap, pageLoading:false, }); diff --git a/src/components/Common/CommonElementEvent.js b/src/components/Common/CommonElementEvent.js index 28600a9..a2cc6ca 100644 --- a/src/components/Common/CommonElementEvent.js +++ b/src/components/Common/CommonElementEvent.js @@ -2,6 +2,7 @@ /* eslint-disable array-callback-return,no-undef,prefer-destructuring */ import React, { Component } from 'react'; import { Modal, message } from 'antd-v4'; +import * as XLSX from 'xlsx'; import commonConfig from '../../utils/config'; import * as commonFunc from './commonFunc'; import * as commonBusiness from './commonBusiness'; /* 单据业务功能 */ @@ -4068,6 +4069,9 @@ export default (ChildComponent) => { } this.props.onSaveState({ masterData, masterConfig, customerInfoData, ...addState, contactData, enabled: sModelsType === 'system/sisformulaInfo' ? this.props.enabled : true, bUserModel: masterData.bUserModel, + }, () => { + this.masterChangeCb && this.masterChangeCb(); + this.masterChangeCb = null; }); }; handleChangeProductParteName = (sAllPartsName, sisproductclassifyProcessClassifyConfigNew) => { @@ -4640,6 +4644,78 @@ export default (ChildComponent) => { return newWin; } + // 导入模版功能 + handleImportExcel = () => { + const fileInput = document.createElement('input'); + fileInput.type = 'file'; + fileInput.accept = '.xlsx, .xls'; + fileInput.style.position = 'fixed'; + fileInput.style.left = '-9999px'; + document.body.appendChild(fileInput); + + fileInput.addEventListener('change', (e) => { + const file = e.target.files[0]; + if (file) { + if (!file) return; + + const reader = new FileReader(); + reader.readAsArrayBuffer(file); + reader.onload = (evt) => { + try { + const data = evt.target.result; + const workbook = XLSX.read(data, { type: 'binary' }); + const sColTitleName = []; + workbook.SheetNames.forEach((sheetName, i) => { + const sheet = workbook.Sheets[sheetName]; + const parsedData = XLSX.utils.sheet_to_json(sheet, { header: 1 }); + const [firstRow, ...restRows] = parsedData; + sColTitleName.push(firstRow.reduce((pre, item, index) => { + if (index === 0) { + pre.sName = item.replace('sName', ''); + } else if (item.endsWith('sName')) { + pre[`sName${index}`] = item.replace('sName', ''); + } else { + pre[`sValue${index}`] = item; + } + return pre; + }, { panelName: sheetName })); + }); + this.masterChangeCb = () => { + const addState = {}; + workbook.SheetNames.forEach((sheetName, i) => { + const sheet = workbook.Sheets[sheetName]; + const parsedData = XLSX.utils.sheet_to_json(sheet, { header: 1 }); + const [firstRow, ...restRows] = parsedData; + const tableName = `customizeParam${i || ''}`; + let { [`${tableName}Data`]: tableData = [], [`${tableName}DelData`]: tableDelData = [] } = this.props; + tableDelData = [...tableDelData, ...tableData.map(item => ({ ...item, handleType: 'del' }))]; + tableData = restRows.map(item => { + const columnKeys = Object.keys(sColTitleName[i]); + columnKeys.shift(); + return { ...this.handleTableAdd(tableName, true), ...item.reduce((pre, cur, index) => { + pre[columnKeys[index]] = cur; + return pre; + }, { sType: tableName }) }; + }); + addState[`${tableName}Data`] = tableData; + addState[`${tableName}DelData`] = tableDelData; + }); + this.props.onSaveState(addState); + }; + this.handleMasterChange('masterData', 'sColTitleName', { sColTitleName: JSON.stringify(sColTitleName) }, undefined, []); + } catch (error) { + console.log('=====err', error); + message.error('文件格式错误'); + } + }; + } + + document.body.removeChild(fileInput); + }); + + fileInput.click(); + } + /* 按钮点击功能 */ handleBtnClick = (e, btnName) => { if (btnName === 'BtnAccounts') { @@ -4648,8 +4724,10 @@ export default (ChildComponent) => { this.handleDesignFunction(); } else if (e === 'BtnResetpwd') { /* 管理员重置密码 */ this.handleResetPwd(); - } if (e === 'BtnOut') { + } else if (e === 'BtnOut') { this.handleOut(); + } else if (e === 'BtnImportExcel') { // 导入Excel模版 + this.handleImportExcel(); } // else if (e === 'BtnConfigCustomizeParam') { /* 生成变量设置 */ // const { masterData, customizeParamConfig } = this.props; diff --git a/src/components/Common/CommonListSelect/index.js b/src/components/Common/CommonListSelect/index.js index 57dad09..79ec03f 100644 --- a/src/components/Common/CommonListSelect/index.js +++ b/src/components/Common/CommonListSelect/index.js @@ -854,6 +854,9 @@ const CommonListComponent = Form.create({ }, }; const upInvoiceName = commonUtils.isNotEmptyArr(btnUploadApi) ? btnUploadApi[0].showName : '发票上传(金税)'; + + const BtnSure = commonFunc.showLocalMessage(this.props, 'BtnSure', '确定'); + const BtnCancel = commonFunc.showLocalMessage(this.props, 'BtnCancel', '取消'); return (
@@ -953,8 +956,8 @@ const CommonListComponent = Form.create({ )) :
- - + +
} diff --git a/src/components/Common/CommonListSelectFlex/index.js b/src/components/Common/CommonListSelectFlex/index.js index ada1c5b..1d544ab 100644 --- a/src/components/Common/CommonListSelectFlex/index.js +++ b/src/components/Common/CommonListSelectFlex/index.js @@ -500,6 +500,9 @@ const CommonListComponent = Form.create({ const tableBelone = commonUtils.isNotEmptyObject(app.currentPane) && commonUtils.isNotEmptyObject(app.currentPane.name) && app.currentPane.bEdit ? 'none' : 'list'; const sProcessParams = commonFunc.showMessage(app.commonConst, 'sProcessParams');/* 选择工艺参数标题 */ const displayLeft = (sModelsType !== 'search/sisColor' && sModelsType !== 'search/commonPopup'); + + const BtnSure = commonFunc.showLocalMessage(this.props, 'BtnSure', '确定'); + const BtnCancel = commonFunc.showLocalMessage(this.props, 'BtnCancel', '取消'); return (
@@ -533,8 +536,8 @@ const CommonListComponent = Form.create({
- - + +
{ diff --git a/src/components/Common/CommonNewBillEvent.js b/src/components/Common/CommonNewBillEvent.js index ff56ea5..e36929e 100644 --- a/src/components/Common/CommonNewBillEvent.js +++ b/src/components/Common/CommonNewBillEvent.js @@ -4167,6 +4167,7 @@ export default (ChildComponent) => { }; /** 按钮操作事件 */ handleButtonClick = async (name, bBtncalcComfim) => { + const FriendlyReminder = commonFunc.showLocalMessage(this.props, 'FriendlyReminder', '温馨提示'); if (name === 'BtnOut') { this.handleOut(); } else if (name === 'BtnDesignFunction') { @@ -4426,14 +4427,12 @@ export default (ChildComponent) => { } else if (dataReturn.code === -7) { const _this = this; Modal.confirm({ - title: "温馨提示:", + title: FriendlyReminder, content: (
{this.handleGetMsg(dataReturn.msg)}
), - okText: "确认", - cancelText: "取消", onOk() { _this.handleButtonClick(name, true); }, diff --git a/src/components/Common/CommonSubBillEvent.js b/src/components/Common/CommonSubBillEvent.js index f3c6287..4c99c2e 100644 --- a/src/components/Common/CommonSubBillEvent.js +++ b/src/components/Common/CommonSubBillEvent.js @@ -1912,6 +1912,8 @@ export default (ChildComponent) => { sModelsId, masterData, app, masterConfig, slaveConfig, checkConfig, token, sModelsType, controlConfig, materialsConfig, processConfig, colorConfig, packConfig, slaveData, orderDetailConfig, slaveChildConfig, formRoute, slave0Config, } = this.props; + const FriendlyReminder = commonFunc.showLocalMessage(this.props, 'FriendlyReminder', '温馨提示'); + const sSlaveIdArray = []; if (commonUtils.isNotEmptyArr(slaveData)) { slaveData.forEach((item) => { @@ -2041,13 +2043,12 @@ export default (ChildComponent) => { } }else if(returnData.code === -8){ Modal.info({ - title: '温馨提示:', + title: FriendlyReminder, content: (
{this.handleGetMsg(returnData.msg)}
), - okText: '确认', onOk() {}, }); this.props.onSaveState({ @@ -2191,7 +2192,7 @@ export default (ChildComponent) => { if (sModelsType !== 'commonBill/onlyMaster' && !sModelsType.includes('sales/salesInvoice') && !sModelsType.includes('purchase/purchaseInvoice') && !sModelsType.includes('purchase/outsideInvoice') && sModelsType !== 'cashier/financialTransfer' && sModelsType !== 'cashier/financialAdjustment' && !sModelsType.includes('cashier/receipt') && !sModelsType.includes('cashier/payment') && !sModelsType.includes('purchase/purchaseEnquiry')) { if (slaveConfig && slaveConfig.bNotCanEmpty && commonUtils.isEmptyArr(slaveData)) { - message.error(`${slaveConfig.sChinese || ''}${commonFunc.showMessage(app.commonConst, 'slaveNotNull')}`); // 从表不能为空! + message.error(`${slaveConfig.showName || ''}${commonFunc.showMessage(app.commonConst, 'slaveNotNull')}`); // 从表不能为空! // if (bGroupDataByDefineNo) { // commonUtils.isEmptyArr(slaveData) && message.error('按批次汇总失败,请检查批次号等数据!'); // } else { diff --git a/src/components/Common/SlaveMemo.js b/src/components/Common/SlaveMemo.js index 8c7dce6..c047963 100644 --- a/src/components/Common/SlaveMemo.js +++ b/src/components/Common/SlaveMemo.js @@ -10,6 +10,7 @@ import * as commonUtils from '../../utils/utils'; import ShowType from './CommonComponent';/* 通用方法 */ import AntdDraggableModal from '../Common/AntdDraggableModal'; import moment from 'moment'; +import * as commonFunc from "@/components/Common/commonFunc"; const { TextArea } = Input; const FormItem = Form.Item; @@ -153,7 +154,7 @@ export default class SlaveMemo extends Component { let bVisibleMemo; let sMemoField; let btnName = ''; - const title = '详细'; + const title = commonFunc.showLocalMessage(this.props, 'sDetailTitle', '详细'); let bEnabledTextArea = false; /* 多行文本默认可输入 非编辑状态多行文本禁止输入 */ let bNoMemo = false; if (commonUtils.isNotEmptyObject(sCurrMemoProps)) { diff --git a/src/components/Common/ToolBar/ToolBarNew.js b/src/components/Common/ToolBar/ToolBarNew.js index bcdfbd8..c97234a 100644 --- a/src/components/Common/ToolBar/ToolBarNew.js +++ b/src/components/Common/ToolBar/ToolBarNew.js @@ -1521,6 +1521,11 @@ class ToolBarComponent extends Component { message.error(sErrorInfo); return; } + const bCancel = commonFunc.showLocalMessage(this.props, 'bCancel', '确定要取消'); + + const bInvalid = commonFunc.showLocalMessage(this.props, 'bInvalid', '确定要作废'); + + const bInvalidCancel = commonFunc.showLocalMessage(this.props, 'bInvalidCancel', '确定要作废'); /* 新增 */ if (key === "BtnAdd") { @@ -2028,13 +2033,13 @@ class ToolBarComponent extends Component { /* 作废、取消作废 */ if (key === "BtnBsOperation.BtnInvalid") { obj = { - title: "确定要作废", + title: bInvalid, handleType: "toVoid", }; this.props.onChangeInvalid(obj); } else if (key === "BtnBsOperation.BtnCancelInvalid") { obj = { - title: "确定取消作废", + title: bInvalidCancel, handleType: "cancel", }; this.props.onChangeInvalid(obj); @@ -2044,13 +2049,13 @@ class ToolBarComponent extends Component { } } else if (key === "BtnInvalid") { obj = { - title: "确定要作废", + title: bInvalid, handleType: "toVoid", }; this.props.onChangeInvalid(obj); } else if (key === "BtnCancelInvalid") { obj = { - title: "确定取消作废", + title: bInvalidCancel, handleType: "cancel", }; this.props.onChangeInvalid(obj); @@ -2129,7 +2134,7 @@ class ToolBarComponent extends Component { } else if (key === "BtnCancel") { /* 取消 */ obj = { - title: "确定要取消", + title: bCancel, }; this.props.onCancel(obj); } else if (key.indexOf("BtnPrint") > -1 && commonUtils.isNotEmptyStr(e.item.props["data-sactiveid"])) { diff --git a/src/components/Common/commonFunc.js b/src/components/Common/commonFunc.js index 77cdc66..d48be0c 100644 --- a/src/components/Common/commonFunc.js +++ b/src/components/Common/commonFunc.js @@ -566,9 +566,9 @@ export function getFilterConditon(sAssignField, allTableData) { } export function showLocalMessage(props, sName, sChineseName) { let sTitle = ''; - if(commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) && commonUtils.isNotEmptyArr(props.app.gdsformconst)) { - const gdsformconst = props.app.gdsformconst; - sTitle = this.showMessage(gdsformconst, sName) + if(commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) && commonUtils.isNotEmptyArr(props.app.commonConst)) { + const gdsformconst = props.app.commonConst; + sTitle = showMessage(gdsformconst, sName) } else { sTitle = sChineseName; } diff --git a/src/components/CommonElementEvent/ProcessInfo.js b/src/components/CommonElementEvent/ProcessInfo.js index 6fa00a8..222a66e 100644 --- a/src/components/CommonElementEvent/ProcessInfo.js +++ b/src/components/CommonElementEvent/ProcessInfo.js @@ -91,7 +91,7 @@ const ProcessComponent = Form.create({ const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabAssort'); /* 配套工序 */ if (iIndexProcess > -1) { bAssort = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible; - tabAssort = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese; + tabAssort = props.masterConfig.gdsconfigformslave[iIndexProcess].showName; } } let bOutside = commonUtils.isNotEmptyObject(outsideConfig); /* 發外公式 */ @@ -99,7 +99,7 @@ const ProcessComponent = Form.create({ const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabOutSide'); /* 發外公式 */ if (iIndexProcess > -1) { bOutside = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible; - tabOutside = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese; + tabOutside = props.masterConfig.gdsconfigformslave[iIndexProcess].showName; } } let bProcessstyle = commonUtils.isNotEmptyObject(processstyleConfig); /* 工序规格 */ @@ -108,7 +108,7 @@ const ProcessComponent = Form.create({ const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabProcessStyle'); /* 工序规格 */ if (iIndexProcess > -1) { bProcessstyle = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible; - tabProcessstyle = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese; + tabProcessstyle = props.masterConfig.gdsconfigformslave[iIndexProcess].showName; } } const bProcesssApsRule = false; /* APS规则定义 */ @@ -126,7 +126,7 @@ const ProcessComponent = Form.create({ const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabProcessParam'); /* 工单参数 */ if (iIndexProcess > -1) { bOrderParam = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible; - tabOrderParam = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese; + tabOrderParam = props.masterConfig.gdsconfigformslave[iIndexProcess].showName; } } let bOfferParam = true; /* 报价参数 */ @@ -135,7 +135,7 @@ const ProcessComponent = Form.create({ const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabQuoParam'); /* 报价参数 */ if (iIndexProcess > -1) { bOfferParam = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible; - tabOfferParam = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese; + tabOfferParam = props.masterConfig.gdsconfigformslave[iIndexProcess].showName; } } @@ -145,7 +145,7 @@ const ProcessComponent = Form.create({ const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabReportParam'); if (iIndexProcess > -1) { bReportParam = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible; - tabReportParam = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese; + tabReportParam = props.masterConfig.gdsconfigformslave[iIndexProcess].showName; } } @@ -155,7 +155,7 @@ const ProcessComponent = Form.create({ const iIndex = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabNormParam'); if (iIndex > -1) { bNormParam = props.masterConfig.gdsconfigformslave[iIndex].bVisible; - tabNormParam = props.masterConfig.gdsconfigformslave[iIndex].sChinese; + tabNormParam = props.masterConfig.gdsconfigformslave[iIndex].showName; } } @@ -165,7 +165,7 @@ const ProcessComponent = Form.create({ const iIndex = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabTestParam'); if (iIndex > -1) { bTestParam = props.masterConfig.gdsconfigformslave[iIndex].bVisible; - tabTestParam = props.masterConfig.gdsconfigformslave[iIndex].sChinese; + tabTestParam = props.masterConfig.gdsconfigformslave[iIndex].showName; } } let defalutKey = '3'; diff --git a/src/components/Manufacture/WorkOrderPack/WorkOrderPackTableTree.js b/src/components/Manufacture/WorkOrderPack/WorkOrderPackTableTree.js index cae75e6..ec8c947 100644 --- a/src/components/Manufacture/WorkOrderPack/WorkOrderPackTableTree.js +++ b/src/components/Manufacture/WorkOrderPack/WorkOrderPackTableTree.js @@ -8768,6 +8768,7 @@ const WorkOrderComponent = Form.create({ } } const autoHeight = `calc( 100vh - 92px )`; + const chooseCombinePartsName = commonFunc.showLocalMessage(props, 'chooseCombinePartsName', '选择合版部件名称'); return ( @@ -9104,7 +9105,7 @@ const WorkOrderComponent = Form.create({ combinePartsChooseVisible ? ), - okText: '确认', onOk() {}, }); bResult = false;