Lijy hace 1 año
padre
commit
e5d6618e19

+ 10 - 4
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/order/api.ts

@@ -5,10 +5,15 @@ export const GETSYSFILED = "/sys-dict/getListByCode";
 export const GETPERSONNEL = "/user/getSimpleActiveUserList";
 export const GETGENERATEFOEM = `/sys-form/getListByCode${MOD}`
 export const GETALLPRODUCT = `/sys-form/getListByCode/Order`
-export const GETTABLELIST =  `${MOD}/list`
+export const GETTABLELIST = `${MOD}/list`
 
-export const actionButtons: any[] = [
-    { text: '新建订单' },
+export function useBtn<T extends ()=>string>(fun: T) {
+    fun && fun();
+}
+
+export type ActionButton<Fun=(f:()=>void)=>void> = { text: string, event?:Fun  };
+export const actionButtons: ActionButton[] = [
+    { text: '新建订单', event: useBtn },
     { text: '批量转移' },
     { text: '批量删除' },
     { text: '回收站' },
@@ -34,4 +39,5 @@ export const tableColumns: TableColumn[] = [
     { prop: 'inchargerName', label: '负责人', width: '200' },
     { prop: 'creatorName', label: '创建人', width: '200' },
     { prop: 'createTime', label: '创建时间', width: '200' },
-]
+]
+

+ 12 - 5
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/order/index.vue

@@ -36,7 +36,7 @@
       <div class="bg-white w-full h-full p-3 shadow-md rounded-md flex flex-col">
         <div class="flex justify-end pb-3">
           <!-- 操作按钮 -->
-          <el-button v-for="(button, index) in actionButtons" :key="index" type="primary">{{ button.text }}</el-button>
+          <el-button v-for="(button, index) in actionButtons" :key="index" type="primary" @click="button.event && button.event(aabbcc)">{{ button.text }}</el-button>
         </div>
         <div class="flex-1 w-full overflow-hidden">
           <!-- 表格 -->
@@ -71,10 +71,10 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, reactive, onMounted, inject } from "vue";
+import { ref, reactive, onMounted, inject, defineExpose } from "vue";
 import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate } from '@/utils/tools'
 import { post, get } from "@/utils/request";
-import { actionButtons, tableColumns, GETSYSFILED, GETPERSONNEL, GETGENERATEFOEM, MOD, GETTABLELIST, GETALLPRODUCT } from "./api";
+import { actionButtons, tableColumns, GETSYSFILED, GETPERSONNEL, GETGENERATEFOEM, MOD, GETTABLELIST, GETALLPRODUCT, useBtn } from "./api";
 import { useRouter, useRoute } from "vue-router";
 import { URL_FETALL } from "../customer/api";
 
@@ -103,8 +103,6 @@ const formTablePaging = reactive({ // 分页条件
   pageSize: 10,
   total: 0,
 })
-const generateFormData = ref([]) // 自定义表单数据
-
 const formTable = ref([]) // 表格数据
 const allLoading = reactive({ // 按钮加载 Loading
   formTableLading: false,
@@ -187,6 +185,15 @@ function setFilterItems() {
   ]
 }
 
+function aabbcc() {
+  console.log('我被调用了')
+}
+
+// 向外暴露方法
+defineExpose({
+  aabbcc
+})
+
 onMounted(() => {
   getSystemField()
   getAllProduct()

+ 3 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/type.d.ts

@@ -36,4 +36,6 @@ type TaskResponse = { saveLoading: saveLoadingType, isClose: boolean, message?:
 
 type optionType = { value: number | string, label: string | number }
 
-type sexTYpe = { value: number | string, label: string }
+type sexTYpe = { value: number | string, label: string }
+
+type buttonType = { label?: string, value?: string, type?: string, icon?: string, disabled?: boolean, loading?: boolean, text?: string, event?: void }