Commit a370a44351bc501a5de5c1f8629034015a3128dc
1 parent
fb596e37
commonsubbill按钮事件控制是否可以编辑
Showing
2 changed files
with
9 additions
and
5 deletions
src/mes/common/commonModelComponent/index.js
| ... | ... | @@ -256,6 +256,7 @@ const useCommonModelEvent = props => { |
| 256 | 256 | }; |
| 257 | 257 | |
| 258 | 258 | const [refreshCount, setRefreshCount] = useState(0); |
| 259 | + const [copyToInitialized, setCopyToInitialized] = useState(false); | |
| 259 | 260 | const sModelType = |
| 260 | 261 | Array.isArray(formData) && formData.length > 0 |
| 261 | 262 | ? (formData[0]?.sName || formData[0]?.sModelType || '') |
| ... | ... | @@ -985,17 +986,20 @@ const useCommonModelEvent = props => { |
| 985 | 986 | |
| 986 | 987 | } |
| 987 | 988 | |
| 988 | - if (!commonUtils.isEmptyObject(copyTo) && copyTo?.isTmpinfobysql) { | |
| 989 | + // 只有弹窗首次打开时才执行 copyTo 数据回填,防止后续刷新覆盖当前数据 | |
| 990 | + if (!copyToInitialized && !commonUtils.isEmptyObject(copyTo) && copyTo?.isTmpinfobysql) { | |
| 989 | 991 | tableList.forEach((item, index) => { |
| 990 | 992 | addState = { |
| 991 | 993 | ...addState, |
| 994 | + enabled: true, | |
| 992 | 995 | [`${tableList[index]}Data`]: index === 0 ? copyTo.masterData : copyTo['slave' + (index - 1 === 0 ? '' : index - 1) + 'Data'], |
| 993 | 996 | } |
| 994 | 997 | }) |
| 995 | - | |
| 998 | + setCopyToInitialized(true); | |
| 996 | 999 | } |
| 997 | 1000 | |
| 998 | 1001 | props.setTempRef({}, true); |
| 1002 | + | |
| 999 | 1003 | if (isWait) { |
| 1000 | 1004 | return addState; |
| 1001 | 1005 | } else { |
| ... | ... | @@ -1904,7 +1908,7 @@ const CommonModel = baseProps => { |
| 1904 | 1908 | }; |
| 1905 | 1909 | |
| 1906 | 1910 | const CommonModelComponent = props => { |
| 1907 | - const { tabConfig = [], level, modelStyle, app, bMesBill, enabled, masterData, sModelsType, formData } = props; | |
| 1911 | + const { tabConfig = [], level, modelStyle, app, bMesBill, bMesSubBill, enabled, masterData, sModelsType, formData } = props; | |
| 1908 | 1912 | const { userinfo } = app; |
| 1909 | 1913 | const sLanguage = userinfo.sLanguage; |
| 1910 | 1914 | const pageRoute = formData?.[0]?.sName |
| ... | ... | @@ -1944,7 +1948,7 @@ const CommonModelComponent = props => { |
| 1944 | 1948 | let componentProps = { |
| 1945 | 1949 | ...props, |
| 1946 | 1950 | showType, // 展示类型(表单/表格) |
| 1947 | - enabled: !bMesBill ? defaultEnabled : enabled, // 是否可编辑 | |
| 1951 | + enabled: !bMesSubBill ? defaultEnabled : enabled, // 是否可编辑 | |
| 1948 | 1952 | sTabName, // 标题名称 |
| 1949 | 1953 | sName: slaveChild ? 'slaveChild' : sName, // 配置对应的sGrd |
| 1950 | 1954 | bHideTitle, //隐藏标题 | ... | ... |
src/mes/common/commonOperationBarComponent/index.js
| ... | ... | @@ -813,7 +813,7 @@ const useCommonOperationBarComponentEvent = props => { |
| 813 | 813 | } catch (error) { |
| 814 | 814 | console.log("=====err", { tempData, str: sDefault, strNew, error }); |
| 815 | 815 | } |
| 816 | - } else if (props.bMesBill) { | |
| 816 | + } else if (props.bMesBill || props.bMesSubBill) { | |
| 817 | 817 | |
| 818 | 818 | const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); |
| 819 | 819 | let enabled = props.enabled | ... | ... |