Quellcode durchsuchen

Merge branch 'master' of http://192.168.101.4:3000/jiaxiaoqiang/JG-ADMIN-TEMP

ooo vor 1 Jahr
Ursprung
Commit
ca18ae8541

+ 22 - 7
src/components/CommonTable/index.vue

@@ -49,16 +49,31 @@ const props = defineProps({
 
 const isShowTable = ref(false);
 
-const startSelect = () => {
+const startSelect = (param) => {
+  if (param) {
+    commonConfig.value.params = param;
+  }
+  dataList();
   isShowTable.value = true;
 };
 
 // 传入一个url,后面不带/
-const { url, form, data, option, search, page, toDeleteIds, Methords, Utils, } =
-  useCrud({
-    src: tableConfig[props.tableType].url,
-  });
-const { dataList, createRow, updateRow, deleteRow , searchChange, resetChange} = Methords; //增删改查
+const {
+  url,
+  form,
+  data,
+  option,
+  search,
+  page,
+  toDeleteIds,
+  Methords,
+  Utils,
+  commonConfig,
+} = useCrud({
+  src: tableConfig[props.tableType].url,
+});
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+  Methords; //增删改查
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 
 const crudRef = ref(null); //crudRef.value 获取avue-crud对象
@@ -73,7 +88,7 @@ onMounted(() => {
     addBtn: false,
     column: tableConfig[props.tableType].column,
   });
-  dataList();
+  // dataList();
 });
 watch(
   () => props.tableType,

+ 5 - 2
src/hooks/userCrud.ts

@@ -3,6 +3,7 @@ import { PageOption } from "@smallwei/avue";
 import { ElMessageBox, ElMessage } from "element-plus";
 import { useUserStoreHook } from "@/store/modules/user";
 import { checkPerm } from "@/directive/permission";
+import { configs } from "@typescript-eslint/eslint-plugin";
 
 interface UseCrudConfig {
   // 模块的url,用来进行增删改查
@@ -20,7 +21,7 @@ interface UseCrudConfig {
   index?: number;
   // 用于中断操作
   loading?: () => void;
-  // 查询参数 一般用search的值就可以了
+  // 额外查询参数 一般用search的值就可以了
   params?: object;
   // 是否是编辑,如果是编辑调用更新,否则调用新增
   isEdit?: boolean;
@@ -28,7 +29,7 @@ interface UseCrudConfig {
 
 export const useCrud = (config?: UseCrudConfig) => {
   const url = ref(config?.src);
-
+  const commonConfig = ref(config);
   /** 表格配置属性 */
   const option = ref({
     searchIcon: true,
@@ -109,6 +110,7 @@ export const useCrud = (config?: UseCrudConfig) => {
             pageNo: page.value.currentPage,
             pageSize: page.value.pageSize,
             ...search.value,
+            ...(commonConfig.value?.params ?? {}),
           },
         });
         if (res?.data) {
@@ -341,5 +343,6 @@ export const useCrud = (config?: UseCrudConfig) => {
     toDeleteIds,
     Methords,
     Utils,
+    commonConfig,
   };
 };

+ 1 - 1
src/views/base/craftManagement/route/components/bottomTable.vue

@@ -72,7 +72,7 @@ const crudRef = ref(null); //crudRef.value 获取avue-crud对象
 
 const startCreat = () => {
   if (props.tableType === "wuliaocaiji") {
-    commonTableRef.value && commonTableRef.value.startSelect();
+    commonTableRef.value && commonTableRef.value.startSelect({ hhhh: "ddddd" });
   } else {
     crudRef.value && crudRef.value.rowAdd();
   }