|
@@ -115,6 +115,16 @@ interface defaultState {
|
|
|
softBedFormulaEnum: any[];
|
|
softBedFormulaEnum: any[];
|
|
|
deptEnum: any[];
|
|
deptEnum: any[];
|
|
|
accessoryEnum: any[];
|
|
accessoryEnum: any[];
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @description 按钮loading状态管理
|
|
|
|
|
+ */
|
|
|
|
|
+ loadingStatus: {
|
|
|
|
|
+ save: boolean;
|
|
|
|
|
+ audit: boolean;
|
|
|
|
|
+ caudit: boolean;
|
|
|
|
|
+ delete: boolean;
|
|
|
|
|
+ download: boolean;
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -159,7 +169,14 @@ export const useHooks = (t?: any) => {
|
|
|
ErpMtrlPriceDialogProps: {},
|
|
ErpMtrlPriceDialogProps: {},
|
|
|
softBedFormulaEnum: [],
|
|
softBedFormulaEnum: [],
|
|
|
deptEnum: [],
|
|
deptEnum: [],
|
|
|
- accessoryEnum: []
|
|
|
|
|
|
|
+ accessoryEnum: [],
|
|
|
|
|
+ loadingStatus: {
|
|
|
|
|
+ save: false,
|
|
|
|
|
+ audit: false,
|
|
|
|
|
+ caudit: false,
|
|
|
|
|
+ delete: false,
|
|
|
|
|
+ download: false
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
// 表格配置项
|
|
// 表格配置项
|
|
|
const columns: ColumnProps<any>[] = [
|
|
const columns: ColumnProps<any>[] = [
|
|
@@ -1579,6 +1596,9 @@ export const useHooks = (t?: any) => {
|
|
|
type: state.orderStatus
|
|
type: state.orderStatus
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ // 设置loading状态为true
|
|
|
|
|
+ state.loadingStatus.save = true;
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
await SaveSoftBedQuote(params)
|
|
await SaveSoftBedQuote(params)
|
|
|
.then((res: any) => {
|
|
.then((res: any) => {
|
|
@@ -1592,9 +1612,16 @@ export const useHooks = (t?: any) => {
|
|
|
})
|
|
})
|
|
|
.catch(error => {
|
|
.catch(error => {
|
|
|
console.log("error !! :>> ", error);
|
|
console.log("error !! :>> ", error);
|
|
|
|
|
+ ElMessage.error(t("sys.api.operationFailed"));
|
|
|
|
|
+ })
|
|
|
|
|
+ .finally(() => {
|
|
|
|
|
+ // 无论成功失败都要重置loading状态
|
|
|
|
|
+ state.loadingStatus.save = false;
|
|
|
});
|
|
});
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
ElMessage.error(t("sys.api.operationFailed"));
|
|
ElMessage.error(t("sys.api.operationFailed"));
|
|
|
|
|
+ // 异常情况下也要重置loading状态
|
|
|
|
|
+ state.loadingStatus.save = false;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -1613,10 +1640,19 @@ export const useHooks = (t?: any) => {
|
|
|
type: "warning"
|
|
type: "warning"
|
|
|
})
|
|
})
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
- AuditSoftBedQuote({ list, type: 1 }).then(() => {
|
|
|
|
|
- ElMessage.success(t("sys.api.operationSuccess"));
|
|
|
|
|
- cb && cb();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ state.loadingStatus.audit = true;
|
|
|
|
|
+ AuditSoftBedQuote({ list, type: 1 })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ ElMessage.success(t("sys.api.operationSuccess"));
|
|
|
|
|
+ cb && cb();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(error => {
|
|
|
|
|
+ console.log("审核失败:", error);
|
|
|
|
|
+ ElMessage.error(t("sys.api.operationFailed"));
|
|
|
|
|
+ })
|
|
|
|
|
+ .finally(() => {
|
|
|
|
|
+ state.loadingStatus.audit = false;
|
|
|
|
|
+ });
|
|
|
})
|
|
})
|
|
|
.catch((e: TypeError) => {
|
|
.catch((e: TypeError) => {
|
|
|
ElMessage({
|
|
ElMessage({
|
|
@@ -1635,11 +1671,20 @@ export const useHooks = (t?: any) => {
|
|
|
type: "warning"
|
|
type: "warning"
|
|
|
})
|
|
})
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
- AuditSoftBedQuote({ list, type: 0 }).then(() => {
|
|
|
|
|
- ElMessage.success(t("sys.api.operationSuccess"));
|
|
|
|
|
- cb && cb();
|
|
|
|
|
- state.VxeTableRef.refresh();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ state.loadingStatus.caudit = true;
|
|
|
|
|
+ AuditSoftBedQuote({ list, type: 0 })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ ElMessage.success(t("sys.api.operationSuccess"));
|
|
|
|
|
+ cb && cb();
|
|
|
|
|
+ state.VxeTableRef.refresh();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(error => {
|
|
|
|
|
+ console.log("撤审失败:", error);
|
|
|
|
|
+ ElMessage.error(t("sys.api.operationFailed"));
|
|
|
|
|
+ })
|
|
|
|
|
+ .finally(() => {
|
|
|
|
|
+ state.loadingStatus.caudit = false;
|
|
|
|
|
+ });
|
|
|
})
|
|
})
|
|
|
.catch((e: TypeError) => {
|
|
.catch((e: TypeError) => {
|
|
|
ElMessage({
|
|
ElMessage({
|
|
@@ -1658,11 +1703,20 @@ export const useHooks = (t?: any) => {
|
|
|
type: "warning"
|
|
type: "warning"
|
|
|
})
|
|
})
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
- DeleteSoftBedQuote({ list }).then(() => {
|
|
|
|
|
- ElMessage.success(t("sys.api.operationSuccess"));
|
|
|
|
|
- cb && cb();
|
|
|
|
|
- state.VxeTableRef.refresh();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ state.loadingStatus.delete = true;
|
|
|
|
|
+ DeleteSoftBedQuote({ list })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ ElMessage.success(t("sys.api.operationSuccess"));
|
|
|
|
|
+ cb && cb();
|
|
|
|
|
+ state.VxeTableRef.refresh();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(error => {
|
|
|
|
|
+ console.log("删除失败:", error);
|
|
|
|
|
+ ElMessage.error(t("sys.api.operationFailed"));
|
|
|
|
|
+ })
|
|
|
|
|
+ .finally(() => {
|
|
|
|
|
+ state.loadingStatus.delete = false;
|
|
|
|
|
+ });
|
|
|
})
|
|
})
|
|
|
.catch((e: TypeError) => {
|
|
.catch((e: TypeError) => {
|
|
|
ElMessage({
|
|
ElMessage({
|