瀏覽代碼

融资信息

huangbin 4 年之前
父節點
當前提交
3d170ad7e4

+ 1 - 1
src/common/setup/filter/index.ts

@@ -41,7 +41,7 @@ export function handleFilter(select: SelectList[] | Ref<SelectList[]>, input: In
             const cache = value ? value : '';
             result[key] = [cache];
         });
-        slot?.search?.()
+        slot?.search?.(result)
         context.emit('search', result);
     }
     function reset() {

+ 26 - 1
src/utils/time/index.ts

@@ -1,4 +1,4 @@
-import moment from "moment";
+import moment, { Moment } from "moment";
 
 /**
  * 获取number类型时间戳
@@ -6,4 +6,29 @@ import moment from "moment";
  */
 export function getTimeValue(): number {
     return moment().valueOf()
+}
+
+type Time = string | Moment | Date
+/**
+ * 获取两个时间范围内的所有时间
+ * @param val1 时间1
+ * @param val2 时间2
+ * @param type 时间格式化类型
+ * @returns string[]类型
+ */
+export function getRangeTime(val1: Time, val2: Time, type = 'YYYYMMDD'): string[] {
+    const fn = (val: Time) => moment(val).format(type)
+    const result: string[] = []
+    // 处理开始时间和结束时间
+    let startTime = fn(val1)
+    let endTime = fn(val2)
+    if (moment(startTime).isAfter(moment(endTime))) {
+        [startTime, endTime] = [endTime, startTime]
+    }
+    while (!moment(startTime).isSame(moment(endTime))) {
+        result.push(startTime)
+        startTime = moment(startTime).add(1, 'd').format(type)
+    }
+    result.push(endTime)
+    return result
 }

+ 12 - 7
src/views/platinum/platinum_financing_information/list/tab/compoments/filter/index.vue

@@ -21,6 +21,7 @@ import { Moment } from 'moment';
 import { initData } from '@/common/methods';
 import { getGoodsList } from '@/services/bus/goods';
 import { SlotParam } from '@/common/setup/filter/interface';
+import { getRangeTime } from '@/utils/time';
 
 export default defineComponent({
     name: 'filter-platinum_pick_query',
@@ -36,21 +37,24 @@ export default defineComponent({
             },
             {
                 value: undefined,
-                key: 'contracttype1',
-                placeholder: '选择状态',
+                key: 'scfcontracttype',
+                placeholder: '合同类型',
                 list: [
-                    { value: 1, lable: '个人' },
-                    { value: -1, lable: '企业' },
+                    { value: 1, lable: '仓单回购' },
+                    { value: 2, lable: '仓单质押' },
+                    { value: 3, lable: '合作套保' },
+                    { value: 4, lable: '资金贷款' },
+                    { value: 5, lable: '融资单' },
                 ],
             },
         ];
         const input: InputList[] = [{ value: '', placeholder: '模糊搜索账号', key: 'account' }];
         const slotParam: SlotParam = {
             search(result: any) {
+                // 处理范围时间内搜索
                 const time = date.value;
-                // if (time) {
-                //     result.tradedate = formatTime(time, 'd');
-                // }
+                const temp = time.length > 1 ? getRangeTime(time[0], time[1]) : [''];
+                result.contractconfirmtime = temp;
             },
             reset() {
                 date.value = [];
@@ -58,6 +62,7 @@ export default defineComponent({
         };
         const { selectList, inputList, fixedBtnList } = handleFilter(select, input, context, slotParam);
         initData(() => {
+            // 选择商品
             select[0].list = getGoodsList().map((e) => {
                 return { value: e.goodsid, lable: e.goodsname };
             });

+ 1 - 1
src/views/platinum/platinum_financing_information/list/tab/index.vue

@@ -1,7 +1,7 @@
 <template>
   <!-- 融资信息 -->
   <div class="platinum_financing_information_tab">
-    <Filter />
+    <Filter @search="search" />
     <contextMenu :contextMenuList="firstBtn">
       <a-table :columns="columns"
                class="topTable hiddenFirstCol"