diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js index 5bf28ba..3abd622 100644 --- a/src/components/Common/CommonTable/index.js +++ b/src/components/Common/CommonTable/index.js @@ -4795,13 +4795,11 @@ class CommonTableRc extends React.Component { }} /> } - console.log(props?.parentProps?.sModelType, props, 'messsss'); - if (this.isPopupShow) { const enabled = this.getTableBtnState('BtnPopup', record); const setDownload = commonFunc.showMessage(props.app.commonConst, 'setPopup');/* 弹窗 */ - operatePopupModal = {enabled ? : }; + operatePopupModal = {enabled ? : }; } const tableBtnsConfig = typeof props.tableBtnsConfig === "function" @@ -4812,7 +4810,6 @@ class CommonTableRc extends React.Component { tableData: props.data }) : props.tableBtnsConfig || []; - console.log(tableBtnsConfig, typeof props.tableBtnsConfig === "function", 'tableBtnsConfig'); return (
{ const { sDefault, sName } = childConfig; - if (sDefault !== null) { - if (sDefault !== '' && sName && sDefault !== undefined && sDefault.indexOf(':') > -1 && sDefault.indexOf('.') > -1) { - const oldFieldName = sDefault.split(':')[1]; - const tableName = oldFieldName.split('.')[0]; - const oldTableFieldName = oldFieldName.split('.')[1]; - if (oldTableFieldName === 'sId' && newSid) { - returnData[sName] = newSid; - } else if (!commonUtils.isEmptyObject(allTableData[tableName])) { - if (oldFieldName.includes('+') || oldFieldName.includes('-') || oldFieldName.includes('*') || - oldFieldName.includes('/') || oldFieldName.includes('(') || oldFieldName.includes(')')) { - let sFormula = oldFieldName; - let sFormulaSplit = oldFieldName; - sFormulaSplit = sFormulaSplit.split('+').join('$'); - sFormulaSplit = sFormulaSplit.split('-').join('$'); - sFormulaSplit = sFormulaSplit.split('*').join('$'); - sFormulaSplit = sFormulaSplit.split('/').join('$'); - sFormulaSplit = sFormulaSplit.split('(').join('$'); - sFormulaSplit = sFormulaSplit.split(')').join('$'); - sFormulaSplit.split('$').forEach((oldFieldNameItem) => { - const oldFieldItem = oldFieldNameItem.trim(); - if (oldFieldItem.indexOf('.') > -1) { - const tableName = oldFieldItem.split('.')[0].trim(); - const oldTableFieldName = oldFieldItem.split('.')[1].trim(); - if (!commonUtils.isEmptyObject(allTableData[tableName]) && allTableData[tableName][oldTableFieldName] !== undefined) { - sFormula = sFormula.replace(oldFieldItem, allTableData[tableName][oldTableFieldName]); - } - } else { - const oldTableFieldName = oldFieldItem.trim(); - if (allTableData[tableName][oldTableFieldName] !== undefined) { - sFormula = sFormula.replace(oldTableFieldName, `(${allTableData[tableName][oldTableFieldName]})`); /* 加括号处理当值为负数时的异常 */ - } + if (typeof sDefault === 'string' && sDefault !== '' && sName && sDefault !== undefined && sDefault.indexOf(':') > -1 && sDefault.indexOf('.') > -1) { + const oldFieldName = sDefault.split(':')[1]; + const tableName = oldFieldName.split('.')[0]; + if (sDefault && sDefault.includes('Fx')) { /* 默认值支持自定义函数 */ + let result = ''; + const indexOf = tableName.indexOf('('); + const tbName = tableName.substring(indexOf + 1, tableName.length); + const fxName = oldFieldName.replace('Fx_', '').trim(); + const tableData = allTableData[tbName]; + const tbField1 = fxName.substring(fxName.indexOf('.') + 1, fxName.indexOf(',')).trim(); /* 第一个参数名称: master.[字段] */ + const tbField2 = fxName.substring(fxName.indexOf(',') + 1, fxName.indexOf(')')).trim(); /* 第二个参数名称: 格式YYYY-MM-DD */ + let tbFieldValue1 = ''; + if (!Array.isArray(tableData)) { + tbFieldValue1 = tableData[tbField1]; + } + if (sDefault.includes('getDate')) { + result = commonUtils.getDate(tbFieldValue1, tbField2); + } + returnData[sName] = result; + return returnData; + } + const oldTableFieldName = oldFieldName.split('.')[1]; + if (oldTableFieldName === 'sId' && newSid) { + returnData[sName] = newSid; + } else if (!commonUtils.isEmptyObject(allTableData[tableName])) { + if (oldFieldName.includes('+') || oldFieldName.includes('-') || oldFieldName.includes('*') || + oldFieldName.includes('/') || oldFieldName.includes('(') || oldFieldName.includes(')')) { + let sFormula = oldFieldName; + let sFormulaSplit = oldFieldName; + sFormulaSplit = sFormulaSplit.split('+').join('$'); + sFormulaSplit = sFormulaSplit.split('-').join('$'); + sFormulaSplit = sFormulaSplit.split('*').join('$'); + sFormulaSplit = sFormulaSplit.split('/').join('$'); + sFormulaSplit = sFormulaSplit.split('(').join('$'); + sFormulaSplit = sFormulaSplit.split(')').join('$'); + sFormulaSplit.split('$').forEach((oldFieldNameItem) => { + const oldFieldItem = oldFieldNameItem.trim(); + if (oldFieldItem.indexOf('.') > -1) { + const tableName = oldFieldItem.split('.')[0].trim(); + const oldTableFieldName = oldFieldItem.split('.')[1].trim(); + if (!commonUtils.isEmptyObject(allTableData[tableName]) && allTableData[tableName][oldTableFieldName] !== undefined) { + sFormula = sFormula.replace(oldFieldItem, allTableData[tableName][oldTableFieldName]); } - }); - returnData[sName] = oldTableFieldName.substring(0, 1) === '&' ? sFormula.split('+').join('') : commonUtils.convertFixNum(eval(sFormula), 6); - } else { - returnData[sName] = allTableData[tableName][oldTableFieldName]; - } + } else { + const oldTableFieldName = oldFieldItem.trim(); + if (allTableData[tableName][oldTableFieldName] !== undefined) { + sFormula = sFormula.replace(oldTableFieldName, `(${allTableData[tableName][oldTableFieldName]})`); /* 加括号处理当值为负数时的异常 */ + } + } + }); + returnData[sName] = oldTableFieldName.substring(0, 1) === '&' ? sFormula.split('+').join('') : commonUtils.convertFixNum(eval(sFormula), 6); + } else if (sDefault.split(',').length > 1 && sDefault.split(':').length > 1) { + sDefault.split(',').forEach(item => { + const oldFieldName = item.split(':')[1]; + const [tableName, oldTableFieldName] = oldFieldName.split('.'); + const newFieldName = item.split(':')[0]; + returnData[newFieldName] = allTableData[tableName][oldTableFieldName]; + }); + } else { + returnData[sName] = allTableData[tableName][oldTableFieldName]; } - } else if (sName && sDefault !== '' && sDefault !== undefined) { - if (sName.substring(0, 1) === 'b') { - returnData[sName] = commonUtils.converNumStrToBoolean(sDefault); - } else if (sName.substring(0, 1) === 't' && (sDefault === 'today' || sDefault === 'now')) { - if (sDefault === 'now') { - returnData[sName] = moment().format('YYYY-MM-DD HH:mm:ss'); - } else { - returnData[sName] = moment().format('YYYY-MM-DD'); - } - } else if (sName.substring(0, 1) === 'i') { - returnData[sName] = parseInt(sDefault); - } else if (sName.substring(0, 1) === 'd') { - returnData[sName] = parseFloat(sDefault); - } else if (sDefault === '&+') { - returnData[sName] = ''; + } + } else if (sName && sDefault !== '' && sDefault !== undefined) { + if (sName.substring(0, 1) === 'b') { + returnData[sName] = commonUtils.converNumStrToBoolean(sDefault); + } else if (sName.substring(0, 1) === 't' && (sDefault === 'today' || sDefault === 'now')) { + if (sDefault === 'now') { + returnData[sName] = moment().format('YYYY-MM-DD HH:mm:ss'); } else { - returnData[sName] = sDefault; + returnData[sName] = moment().format('YYYY-MM-DD'); } + } else if (sName.substring(0, 1) === 'i') { + returnData[sName] = parseInt(sDefault); + } else if (sName.substring(0, 1) === 'd') { + returnData[sName] = parseFloat(sDefault); + } else if (sDefault === '&+') { + returnData[sName] = ''; + } else { + returnData[sName] = sDefault; + } + } else if (sName) { + const value = handleDefaultSName(childConfig); + if (value) { + returnData[sName] = value; } } }); } return returnData; } - +/** + * 处理用户信息 + */ +const handleDefaultSName = (itemConfig) => { + const { sControlName, sDefault, sName } = itemConfig || {}; + const key = sControlName?.split('-')?.[1]; + if (!key || sDefault) return false; + try { + let userinfo = localStorage.getItem(`${config.prefix}userinfo`); + userinfo = JSON.parse(userinfo); + const userinfoKey = Object.keys(userinfo); + if (userinfoKey.includes(key)) { + if (sName?.substring(0, 1) === 't') { + return moment(userinfo[key]); + } + return userinfo[key]; + } + } catch (error) { + return false; + } + return false; +}; /** 获取数据默认值 */ export function getAssignFieldValue(sAssignField, srcData, allTableData, bMultiTable, bCommon) { const returnData = {}; diff --git a/src/default.less b/src/default.less index d3aaa19..7e935f3 100644 --- a/src/default.less +++ b/src/default.less @@ -911,9 +911,12 @@ .operate-bar { min-height: 28px; - + display: flex; + align-items: center; + justify-content: space-between; a { - width: 40px; + width: 24px; + height: 24px; margin: 0 !important; position: relative; diff --git a/src/mes/common/commonModalComponent/index.js b/src/mes/common/commonModalComponent/index.js index fcb4863..798858f 100644 --- a/src/mes/common/commonModalComponent/index.js +++ b/src/mes/common/commonModalComponent/index.js @@ -39,7 +39,6 @@ const CommonModalComponent = props => { window.deviceTargetInfoModalAutoShow = false; }; }, []); - console.log(props, 'asdasdasd'); return ( { ...addState, ...handleMergeCustomColumn(addState, tableList) }; - console.log(addState, 'addState'); props.onSaveState(addState); } @@ -415,7 +414,6 @@ const useCommonModelEvent = props => { sFormId: sModelsId, ...masterDataCopyTo }; - props.onSaveState({ masterData: masterDataNew, enabled: true, }); }, [props.bFinish] @@ -492,7 +490,6 @@ const useCommonModelEvent = props => { const handleGetData = async (tableList = [], isWait, bInit) => { let addState = {}; const currentIds = currentId ? currentId : props?.parentProps?.record?.sId - console.log("🚀 ~ handleGetData ~ currentIds:", currentIds, props?.parentProps?.record ) for (let i = 0; i < tableList.length; i++) { const tableName = tableList[i]; const config = formData.find(item => item.sGrd === tableName); diff --git a/src/mes/productionExec/quickSwitchTabComponent/index.js b/src/mes/productionExec/quickSwitchTabComponent/index.js index b3020ad..3339903 100644 --- a/src/mes/productionExec/quickSwitchTabComponent/index.js +++ b/src/mes/productionExec/quickSwitchTabComponent/index.js @@ -105,7 +105,7 @@ const QuickSwitchTabComponent = baseProps => { return (
- {list.map((title, index) => { + {/* {list.map((title, index) => { const currentId = listId[index]; const currentMesPane = commonUtils.convertStrToObj( localStorage.xlybusinesscurrentMesPane @@ -138,7 +138,7 @@ const QuickSwitchTabComponent = baseProps => { {title}
); - })} + })} */}
); };