diff --git a/src/components/Common/CommonComponent/index.js b/src/components/Common/CommonComponent/index.js
index 0bbd31a..1e08915 100644
--- a/src/components/Common/CommonComponent/index.js
+++ b/src/components/Common/CommonComponent/index.js
@@ -307,12 +307,33 @@ export default class CommonComponent extends Component {
this.onBlurText(event, 500);
};
- onBlurText = (event, timeout = 0) => {
+ onBlurText = async (event, timeout = 0) => {
const currentValue = event?.target?.value;
if (currentValue == this.lastValue) {
this.props.app.globalFun?.onSetMask(false);
return;
}
+
+ const { name, record, onQuickFieldUpdate, showConfig } = this.props;
+ if (onQuickFieldUpdate && showConfig) {
+ const { sName } = showConfig;
+ const changeValue = { [sName]: currentValue };
+ console.log('changeValue', changeValue);
+ console.log('name', name);
+ console.log('sName', sName);
+ console.log('record.sId', record.sId);
+ try {
+ const quickHandled = await onQuickFieldUpdate(name, sName, changeValue, record.sId, showConfig);
+ if (quickHandled) {
+ this.lastValue = currentValue;
+ this.props.app.globalFun?.onSetMask(false);
+ return;
+ }
+ } catch (error) {
+ console.error('onQuickFieldUpdate error:', error);
+ }
+ }
+
if (this.onExecInstructSet('blur')) {
this.lastValue = currentValue;
return;
diff --git a/src/components/Common/CommonHooks/useCommonBase.js b/src/components/Common/CommonHooks/useCommonBase.js
index 789cbee..d3d8b15 100644
--- a/src/components/Common/CommonHooks/useCommonBase.js
+++ b/src/components/Common/CommonHooks/useCommonBase.js
@@ -2156,7 +2156,7 @@ const useCommonBase = props => {
});
return;
}
-
+
Modal.confirm({
title: "温馨提示:",
content:
{handleGetMsg(msg)}
,
@@ -2425,6 +2425,72 @@ const useCommonBase = props => {
return result;
};
+ // 处理特定字段的快速更新
+ const handleQuickFieldUpdate = async (name, sFieldName, changeValue, sId, tableConfig) => {
+ // 定义需要快速处理的字段列表
+ const quickFields = [
+ 'dLockUpFei', 'dMadeUpFei', 'iLaminatingPaper', 'dLabelQty',
+ 'dAdvanceReportQty', 'dAdvanceLockUpFei', 'dAdvanceMadeUpFei', 'iAdvanceLaminatingPaper'
+ ];
+
+ console.log('处理特定字段的快速更新', sFieldName);
+
+ // 检查是否是需要快速处理的字段
+ if (!quickFields.includes(sFieldName)) return false;
+
+ // 显示loading状态
+ props.app.globalFun.onSetMask(true);
+
+ try {
+ // 获取表格配置和数据
+ const { [`${name}Data`]: tableData } = state;
+ const iIndex = tableData.findIndex(item => item.sId === sId);
+ if (iIndex === -1) return false;
+
+ const record = tableData[iIndex];
+
+ // 从 tableConfig 中提取 procedure 配置
+ let procedureConfig = null;
+ if (tableConfig && tableConfig.sOnChangeInstruct) {
+ try {
+ const onChangeInstruct = commonUtils.convertStrToObj(tableConfig.sOnChangeInstruct, {});
+ if (onChangeInstruct.blur && Array.isArray(onChangeInstruct.blur)) {
+ // 查找 procedure 操作
+ const procedureOp = onChangeInstruct.blur.find(op => op.opr === 'procedure');
+ if (procedureOp && procedureOp.config) {
+ procedureConfig = procedureOp.config;
+ }
+ }
+ } catch (error) {
+ console.error('解析 sOnChangeInstruct 失败:', error);
+ }
+ }
+
+ // 如果找到 procedure 配置,调用存储过程
+ if (procedureConfig) {
+ await handleProcedureCall({
+ btnConfig: {
+ sButtonParam: JSON.stringify(procedureConfig)
+ },
+ tableData: [record],
+ sValue: changeValue
+ });
+
+ // 刷新表格
+ handleSaveState({ refreshTableList: [name] });
+ }
+
+ return true;
+ } catch (error) {
+ console.error('快速字段更新失败:', error);
+ message.error('处理失败,请重试');
+ return false;
+ } finally {
+ // 关闭loading状态
+ props.app.globalFun.onSetMask(false);
+ }
+ };
+
// 执行指令集
const handleExecInstructSet = params => {
const {
@@ -2690,6 +2756,7 @@ const useCommonBase = props => {
handleSqlDropDownNewRecord,
onChange: handleMasterChange, // 主表数据变化
onDataChange: handleTableChange, // 表格数据变化
+ onQuickFieldUpdate: handleQuickFieldUpdate, // 快速字段更新
onGetDataSet: handleGetDataSet,
onGetTreeDataSet: handleGetTreeDataSet, // 获取树型数据
onSaveState: handleSaveState,
diff --git a/src/components/Common/CommonViewTable/index.js b/src/components/Common/CommonViewTable/index.js
index 9784790..fc9e63d 100644
--- a/src/components/Common/CommonViewTable/index.js
+++ b/src/components/Common/CommonViewTable/index.js
@@ -506,6 +506,7 @@ class CommonViewTableRc extends Component {
.handleSqlDropDownNewRecord,
getFloatNum: this.props.getFloatNum,
onChange: this.props.onDataChange,
+ onQuickFieldUpdate: this.props.onQuickFieldUpdate,
showConfig: child,
slaveConfig: this.props[`${tableName}Config`],
formItemLayout,