Parcourir la source

searchfrom md

zhangjie il y a 1 an
Parent
commit
b053be173c

+ 18 - 3
src/components/global/search-form/index.vue

@@ -17,7 +17,12 @@
           :style="{ width: colToWidth(item.colSpan || 0) }"
           :class="{ 'buttons-wrap': item.type == 'buttons' }"
         >
-          <SearchFormItem :item="item" :params="params" />
+          <slot
+            v-if="item.cell"
+            :name="item.cell"
+            v-bind="{ item, params }"
+          ></slot>
+          <SearchFormItem v-else :item="item" :params="params" />
         </t-form-item>
         <div class="flex-1"></div>
         <t-form-item
@@ -28,7 +33,12 @@
           :style="{ width: colToWidth(item.colSpan || 0) }"
           :class="{ 'buttons-wrap': item.type == 'buttons' }"
         >
-          <SearchFormItem :item="item" :params="params" />
+          <slot
+            v-if="item.cell"
+            :name="item.cell"
+            v-bind="{ item, params }"
+          ></slot>
+          <SearchFormItem v-else :item="item" :params="params" />
         </t-form-item>
         <div v-if="showExpandBtn && !showAll" class="flex-1 text-right">
           <t-button
@@ -53,7 +63,12 @@
           :style="{ width: colToWidth(item.colSpan || 0) }"
           :class="{ 'buttons-wrap': item.type == 'buttons' }"
         >
-          <SearchFormItem :item="item" :params="params" />
+          <slot
+            v-if="item.cell"
+            :name="item.cell"
+            v-bind="{ item, params }"
+          ></slot>
+          <SearchFormItem v-else :item="item" :params="params" />
         </t-form-item>
       </div>
     </t-form>

+ 10 - 2
src/views/system/config-manage/customer-manage/index.vue

@@ -1,6 +1,13 @@
 <template>
   <div class="registration-query flex flex-col h-full">
-    <SearchForm :fields="fields" :params="params"></SearchForm>
+    <SearchForm :fields="fields" :params="params">
+      <template #manager="{ item, params }">
+        <t-select v-model="params[item.prop]">
+          <t-option label="label1" :value="1" />
+          <t-option label="label2" :value="2" />
+        </t-select>
+      </template>
+    </SearchForm>
     <div class="flex-1 page-wrap">
       <t-space size="small">
         <t-button theme="success" @click="handleAdd">新增</t-button>
@@ -117,11 +124,12 @@ const fields = ref([
   },
   {
     prop: 'managerId',
+    cell: 'manager',
     label: '客户经理',
     type: 'select',
     labelWidth: 100,
     colSpan: 5,
-    options: [{ value: 1, label: '张三' }],
+    // options: [{ value: 1, label: '张三' }],
   },
   {
     prop: 'name',