diff --git a/src/components/Common/CommonComponent/index.js b/src/components/Common/CommonComponent/index.js
index ab19884..cc372bb 100644
--- a/src/components/Common/CommonComponent/index.js
+++ b/src/components/Common/CommonComponent/index.js
@@ -301,8 +301,6 @@ export default class CommonComponent extends Component {
/* 若下拉配置了movesql 则离开时 调用下拉sql数据 */
if (this.props.showConfig && (this.props.showConfig.sDropDownType === 'movesql' || commonUtils.isNotEmptyObject(this.props.showConfig.sButtonParam))) {
this.props.onDropDownBlur(this.props.name, this.props.showConfig.sName, this.props.record, this.props.showConfig);
- console.log(this.props, 'onDropDownBlur');
-
}
this.onCheckFields(500);
diff --git a/src/components/Common/CommonHooks/useCommonBase.js b/src/components/Common/CommonHooks/useCommonBase.js
index 388193f..8e31f65 100644
--- a/src/components/Common/CommonHooks/useCommonBase.js
+++ b/src/components/Common/CommonHooks/useCommonBase.js
@@ -42,7 +42,7 @@ const useCommonBase = props => {
const tempRef = useRef({});
let mounted = true
console.log(props, 'useCommonBase');
-
+
const setTempRef = (params, bRewrite) => {
if (bRewrite) {
tempRef.current = params;
@@ -2419,8 +2419,8 @@ const useCommonBase = props => {
);
};
if (!dbclickPopConfig) return
- let { sActiveId, sActiveName } = dbclickPopConfig;
+ let { sActiveId, sActiveName } = dbclickPopConfig;
// 如果行数据里有sFormId, 则取sFormId作为弹窗的表单id
const { sFormId, sMaintenanceLevel } = record;
if (sFormId && sMaintenanceLevel) {
@@ -2443,7 +2443,7 @@ const useCommonBase = props => {
sActiveId = "17102090670002643282020454509600";
}
} else {
- sActiveId = sFormId;
+ sActiveId = sFormId || sActiveId;
sActiveName = '编辑';
}
@@ -2600,8 +2600,6 @@ const useCommonBase = props => {
const values = { sConfigformId, sControlName, sRowData };
if (true) {
const dataReturn = (await commonServices.postValueService(app.token, values, dataUrl)).data;
- console.log(dataReturn, 'dataReturn');
-
const allReturnMap = {};
if (dataReturn.code === 1) {
const returnData = dataReturn.dataset.rows[0];
@@ -3284,6 +3282,82 @@ const useCommonBase = props => {
}
}
};
+ const handleDel = (obj) => {
+ const props = { ...this.props, ...this.state };
+ const onOkDel = handleOkDel;
+ confirm({
+ title: obj.title,
+ onOk() {
+ onOkDel(props);
+ },
+ onCancel() {
+ },
+ });
+ };
+ /* 确定要删除 */
+ const handleOkDel = async (props) => {
+ /* 数据参数 */
+ const {
+ token, sModelsId, sModelsType, masterConfig, masterData, slaveConfig, checkConfig, orderDetailConfig, app,
+ } = props;
+ const { userinfo, systemData } = app;
+ const { sMakePerson } = masterData; /* 本单据制单人 */
+ const { sUserName, sType } = userinfo;/* 登录用户 */
+ const iIndex = systemData.findIndex(item => item.sName === 'CkxModifyBillNoMakePerson');
+ if (iIndex > -1) {
+ const sValue = systemData[iIndex].sValue;
+ if (sValue === '0') { /* 系统未启用非制单人修改单据,普通用户非制单人不可以修改制单人的单据 */
+ if (sType !== 'sysadmin' && sUserName !== sMakePerson) {
+ message.error(commonFunc.showMessage(app.commonConst, 'NoDelByNoMakePerson'));
+ return;
+ }
+ }
+ }
+ const value = {
+ sClientType: '1',
+ data: {
+ sMasterTable: masterConfig.sTbName,
+ sId: [masterData.sId],
+ },
+ };
+ const sSlaveTable = [];
+ if (commonUtils.isNotEmptyObject(slaveConfig)) {
+ sSlaveTable.push({
+ tableName: slaveConfig.sTbName,
+ relationName: 'sParentId',
+ });
+ }
+ if (commonUtils.isNotEmptyObject(checkConfig)) {
+ sSlaveTable.push({
+ tableName: checkConfig.sTbName,
+ relationName: 'sParentId',
+ });
+ }
+ if (sModelsType === 'purchase/purchaseOrder') {
+ sSlaveTable.push({
+ tableName: orderDetailConfig.sTbName,
+ relationName: 'sParentId',
+ });
+ }
+ value.sSlaveTable = sSlaveTable;
+ const { sBillNo, sId } = masterData || {};
+ const url = `${commonConfig.server_host}business/delMasSlaBusinessData?sModelsId=${sModelsId}&sBillNo=${sBillNo}&sSysLogSrcId=${sId}`;
+ /* 接收返回值 */
+ const { data } = await commonServices.postValueService(token, value, url);
+ if (data.code === 1) {
+ /* 数据删除成功 */
+ if (this.props.app.currentPane.refresh !== undefined) {
+ this.props.app.currentPane.refresh();
+ }
+ if (sModelsType !== 'commonOeeBill') {
+ this.handleDelDataSuccess(props);
+ } else {
+ message.info('删除成功!');
+ }
+ } else { /* 失败 */
+ this.props.getServiceError(data);
+ }
+ };
const returnProps = {
...props,
...state,
@@ -3315,7 +3389,8 @@ const useCommonBase = props => {
onMergeTableConfig: handleMergeTableConfig, // 合并config配置和所有sButtonEnabled配置
awaitPromiseReturn: awaitPromiseReturn,
onSelectCommonPopup: handleSelectCommonPopup,
- onDropDownBlur: handleTableBlur
+ onDropDownBlur: handleTableBlur,
+ onDel: handleDel
};
// 切换页面时,加载角标数据
diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js
index 08e24b7..2d9390b 100644
--- a/src/components/Common/CommonTable/index.js
+++ b/src/components/Common/CommonTable/index.js
@@ -1220,13 +1220,15 @@ class CommonTableRc extends React.Component {
/** 行选择 */
onDoubleClick = (name, record) => {
-
if (this.props.onDoubleClickNew) {
+ console.log('onDoubleClick', 1111);
+
this.props.onDoubleClickNew({ name, record });
} else if (this.props.onDoubleClick !== undefined) {
this.props.onDoubleClick(record);
+ console.log('onDoubleClick', 2222);
}
-
+
};
onKeyDownDiv = (e, sName) => {
@@ -3557,7 +3559,7 @@ class CommonTableRc extends React.Component {
rowSelection = null;
}
const { expKeys } = this.state;
- const {sModelType} = this.props?.parentProps || {}
+ const { sModelType } = this.props?.parentProps || {}
/* 返回值 */
return {
components,
@@ -8232,7 +8234,7 @@ class CommonTableRc extends React.Component {
) {
btnPupopConfig = controlConfig[0];
console.log(btnPupopConfig, 'btnPupopConfig');
-
+
this.setState({
commonPopupVisible: true,
commonPopupTbName: name,
@@ -12168,7 +12170,6 @@ const useGetTableBtnOprSetting = props => {
item => item.sControlName?.toLowerCase() === "btntableopr"
) || {};
let { sDefault = "" } = btnTableOprConfig;
-
const btnTableDelConfig =
gdsconfigformslave.find(
item => item.sControlName?.toLowerCase() === "btntabledel"
@@ -12196,7 +12197,19 @@ const useGetTableBtnOprSetting = props => {
if (location.pathname.includes("indexPad") && sDefault) {
sDefault = "add,del,save";
}
- sDefault = sDefault + ',materials'
+ const getButtonName = (sControlName) => {
+ if (!sControlName) return '';
+ const parts = sControlName.split('.');
+ return parts[parts.length - 1].replace(/^btn/i, ''); // 取最后一部分
+ };
+ if (sDefault === '') {
+ // sDefault =
+ const btnList = gdsconfigformslave.filter(item => item.bVisible && item.sControlName.includes('Btn'))
+ sDefault = btnList?.map(item => {
+ return getButtonName(item.sControlName.toLowerCase())
+ }).join(',')
+ }
+ // sDefault = sDefault + ',materials'
const { bSubmit, bCheck } = props?.parentProps?.masterData || {};
if (location.pathname.includes("indexPad") && sDefault && !props.enabled) {
if (!bSubmit && !bCheck) {
@@ -12209,7 +12222,6 @@ const useGetTableBtnOprSetting = props => {
if (!sDefault) {
return result;
}
-
// 表格滚动到底部
const scrollToBottom = tableClassName => {
setTimeout(() => {
@@ -12234,7 +12246,7 @@ const useGetTableBtnOprSetting = props => {
const resultTemp = {};
const list = sDefault.split(",");
list.forEach(btnType => {
- if (btnType === "add") {
+ if (btnType.includes("add")) {
resultTemp.mesAdd = params => {
const { sDefault: str } = btnTableAddConfig;
let disabled = props.getBtnDisabled({
@@ -12266,7 +12278,7 @@ const useGetTableBtnOprSetting = props => {
/>
);
};
- } else if (btnType === "del") {
+ } else if (btnType.includes("del")) {
resultTemp.mesDel = params => {
const { record } = params;
const { sDefault: str } = btnTableDelConfig;
@@ -12290,7 +12302,7 @@ const useGetTableBtnOprSetting = props => {
/>
);
};
- } else if (btnType === "copy") {
+ } else if (btnType.includes("copy")) {
resultTemp.mesCopy = params => {
let disabled = false;
if (props.parentProps.bMesBill) {
@@ -12311,7 +12323,7 @@ const useGetTableBtnOprSetting = props => {
/>
}
;
- } else if (btnType === "save") {
+ } else if (btnType.includes("slave")) {
resultTemp.mesSave = () => (
}
@@ -73,7 +74,7 @@ const CommonModalComponent = props => {
height: "100%"
}}
>
-