|
@@ -37,8 +37,7 @@ import { ColumnProps, dwnameSaveLayoutAttr } from "@/components/LjVxeTable/inter
|
|
|
import { useLayoutStore } from "@/stores/modules/layout";
|
|
|
import { useRoute } from "vue-router";
|
|
|
import { useAuthButtons } from "@/hooks/useAuthButtons";
|
|
|
-import { ElNotification } from "element-plus";
|
|
|
-import { ElMessage } from "element-plus";
|
|
|
+import { ElMessage, ElNotification, ElMessageBox } from "element-plus";
|
|
|
import { useTable } from "@/hooks/useTable";
|
|
|
import { useDwLayout } from "@/hooks/useDwLayout";
|
|
|
import {
|
|
@@ -58,6 +57,7 @@ import { usePrint } from "@/hooks/usePrint";
|
|
|
import variables from "@/styles/js.module.scss";
|
|
|
import PrintEditor from "@/components/PrintEditor/index.vue";
|
|
|
import PrintTemplateSelector from "@/components/Selector/PrintTemplate/index.vue";
|
|
|
+import { CommonDynamicSelect } from "@/api/modules/common";
|
|
|
|
|
|
const { t } = useI18n();
|
|
|
/** 默认使用通用接口,并只读第一条数据作为主表数据 */
|
|
@@ -247,6 +247,34 @@ const loadDwLayout = (data: any) => {
|
|
|
initLayoutColumns();
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * @description 默认接口
|
|
|
+ * @param params
|
|
|
+ */
|
|
|
+const defaultRequest = (params: any) => {
|
|
|
+ if (!props.requestAuto) return undefined;
|
|
|
+ console.log("defaultRequest props, params :>> ", props, props.dsname, params);
|
|
|
+ let newParams: any = {};
|
|
|
+ params.pageNum && (newParams.pageindex = params.pageNum);
|
|
|
+ params.pageSize && (newParams.pagesize = params.pageSize);
|
|
|
+ params.orderstr && (newParams.orderstr = params.orderstr);
|
|
|
+ delete params.pageNum;
|
|
|
+ delete params.pageSize;
|
|
|
+ delete params.orderstr;
|
|
|
+ newParams.queryParams = JSON.parse(JSON.stringify(params));
|
|
|
+
|
|
|
+ newParams.dsname = props.dsname ?? dwnameBasic.value;
|
|
|
+ return CommonDynamicSelect(newParams, dwnameBasic.value);
|
|
|
+};
|
|
|
+const defaultDataCallback = (data: any) => {
|
|
|
+ return {
|
|
|
+ list: data.datatable,
|
|
|
+ tableinfo: data.tableinfo,
|
|
|
+ total: data.totalcnt,
|
|
|
+ pageNum: data.pageindex,
|
|
|
+ pageSize: data.pagesize
|
|
|
+ };
|
|
|
+};
|
|
|
// 表格操作 Hooks
|
|
|
const {
|
|
|
tableData,
|
|
@@ -262,10 +290,10 @@ const {
|
|
|
// handleCurrentChange,
|
|
|
// handlePageChange
|
|
|
} = useTable(
|
|
|
- props.requestApi,
|
|
|
+ props.requestApi || defaultRequest,
|
|
|
props.initParam,
|
|
|
props.pagination,
|
|
|
- props.dataCallback,
|
|
|
+ props.dataCallback || defaultDataCallback,
|
|
|
props.requestError,
|
|
|
props.dwname,
|
|
|
undefined,
|
|
@@ -555,6 +583,12 @@ const setEnumMap = async (col: ColumnProps) => {
|
|
|
const dwnameLayout = computed(() => {
|
|
|
return props.dwname + "__layout-detail";
|
|
|
});
|
|
|
+/**
|
|
|
+ * @description 基础信息布局
|
|
|
+ */
|
|
|
+const dwnameBasic = computed(() => {
|
|
|
+ return props.dwname + "-detail";
|
|
|
+});
|
|
|
// /**
|
|
|
// * @description 当前基础信息的布展示列field集合
|
|
|
// */
|
|
@@ -946,19 +980,43 @@ const saveBasicSettingFunc = async (columns: any, formParams: any, callback: any
|
|
|
/**
|
|
|
* @description 基础设置: 保存系统默认模版
|
|
|
*/
|
|
|
-const saveDefaultLayout = async (columns: any, formParams: any, callback?: any) => {
|
|
|
+const saveDefaultLayout = async (columns: any, formParams: any, cb?: any) => {
|
|
|
if (!props.dwname) {
|
|
|
ElMessage.error("LjVextable组件未设置储存的模版名称,无法保存");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- let layout = await saveColumnsFunc(columns, formParams, true, -1);
|
|
|
+ // let layout = await saveColumnsFunc(columns, formParams, true, -1);
|
|
|
|
|
|
- console.log("saveDefaultLayout layout :>> ", layout);
|
|
|
+ // console.log("saveDefaultLayout layout :>> ", layout);
|
|
|
|
|
|
- await layoutStore.saveDwLayout_online(-1, props.dwname, layout);
|
|
|
+ // await layoutStore.saveDwLayout_online(-1, props.dwname, layout);
|
|
|
|
|
|
- callback && callback();
|
|
|
+ // callback && callback();
|
|
|
+
|
|
|
+ ElMessageBox.confirm("是否确认设置为默认布局?", "操作提示", {
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ confirmButtonText: "仅设置默认布局",
|
|
|
+ cancelButtonText: t("sys.layout.settingsAndDelete")
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ let layout = await saveColumnsFunc(columns, formParams, true, -1);
|
|
|
+
|
|
|
+ props.dwname && (await layoutStore.saveDwLayout_online(-1, dwnameBasic.value, layout, 0, 1));
|
|
|
+
|
|
|
+ cb && cb(true);
|
|
|
+ })
|
|
|
+ .catch(async (action: any) => {
|
|
|
+ if (action === "cancel") {
|
|
|
+ let layout = await saveColumnsFunc(columns, formParams, true, -1);
|
|
|
+
|
|
|
+ props.dwname && (await layoutStore.saveDwLayout_online(-1, dwnameBasic.value, layout, 1, 1));
|
|
|
+
|
|
|
+ cb && cb(true);
|
|
|
+ } else {
|
|
|
+ cb && cb(false);
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const initLayoutColFunc = (data: any) => {
|
|
@@ -1005,7 +1063,7 @@ const initLayoutColFunc = (data: any) => {
|
|
|
*/
|
|
|
const resetBasicSettingFunc = async (callback: any) => {
|
|
|
// 获取原始数据列
|
|
|
- let oriColumns = await getOriColumns(true, true, -1, enumMap.value, props.columns);
|
|
|
+ let oriColumns = await getOriColumns(true, true, -1, enumMap.value, enumMap.value);
|
|
|
console.log("resetBasicSettingFunc enumMap :>> ", enumMap.value);
|
|
|
console.log("resetBasicSettingFunc oriColumns -1:>> ", oriColumns);
|
|
|
oriColumns = initLayoutColFunc(oriColumns);
|