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 (