From f9c714d115426f81ab98fdb5aa5fccf6bea31a4e Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 08 九月 2025 09:29:17 +0800
Subject: [PATCH] 添加 取样单 还样单 模块

---
 pages/quyangdan/table.vue                                      |  283 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 components/PushSeOutStockBillPopup/PushSeOutStockBillPopup.vue |    1 
 package.json                                                   |    1 
 3 files changed, 280 insertions(+), 5 deletions(-)

diff --git a/components/PushSeOutStockBillPopup/PushSeOutStockBillPopup.vue b/components/PushSeOutStockBillPopup/PushSeOutStockBillPopup.vue
index 330fa92..5ea3dbe 100644
--- a/components/PushSeOutStockBillPopup/PushSeOutStockBillPopup.vue
+++ b/components/PushSeOutStockBillPopup/PushSeOutStockBillPopup.vue
@@ -76,7 +76,6 @@
                 <uni-pagination id="#pagination" title="鏍囬鏂囧瓧" v-model="curPage" :pageSize="size"
                     :total="length"></uni-pagination>
             </view>
-
         </uni-popup>
     </view>
 </template>
diff --git a/package.json b/package.json
index 0a5f075..4c2978e 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,7 @@
     "@psdk/device-ble-uniapp": "^0.6.1",
     "@psdk/esc": "^0.6.1",
     "@psdk/tspl": "^0.6.1",
+    "dayjs": "^1.11.18",
     "echarts": "^5.6.0",
     "i": "^0.3.7",
     "npm": "^9.5.1",
diff --git a/pages/quyangdan/table.vue b/pages/quyangdan/table.vue
index c8e5017..4e658c7 100644
--- a/pages/quyangdan/table.vue
+++ b/pages/quyangdan/table.vue
@@ -1,21 +1,135 @@
 <template>
     <view>
-        <view class="page-header"></view>
+        <view class="page-header">
+            <view class="search-item">
+                <view class="left">鏃ユ湡闂撮殧</view>
+                <view class="right">
+                    <picker mode="selector" :value="curDateGap" :range="dateRangePicker"
+                        @change="onDateRangePickerChangeHandler">
+                        <input disabled v-model="curDateGap" placeholder="璇烽�夋嫨鏃ユ湡闂撮殧" />
+                        <view class="picker-overlay"></view>
+                    </picker>
+
+                </view>
+            </view>
+            <view class="search-item">
+                <view class="left">寮�濮嬫棩鏈�</view>
+                <view class="right">
+                    <uni-datetime-picker :clear-icon="false" type="date" v-model="startDate"
+                        :disabled="!enableCustomDateRange">
+                        <view class="datetime-picker-inner"
+                            :class="enableCustomDateRange?'font__enable':'font__disable'">
+                            <text>{{ startDate }}</text>
+                        </view>
+                    </uni-datetime-picker>
+                </view>
+            </view>
+            <view class="search-item">
+                <view class="left">缁撴潫鏃ユ湡</view>
+                <view class="right">
+                    <uni-datetime-picker :clear-icon="false" type="date" v-model="endDate"
+                        :disabled="!enableCustomDateRange">
+                        <view class="datetime-picker-inner"
+                            :class="enableCustomDateRange?'font__enable':'font__disable'">{{ endDate }}</view>
+                    </uni-datetime-picker>
+                </view>
+            </view>
+            <view class="search-item">
+                <view class="left">鍗曟嵁鍙�</view>
+                <view class="right">
+                    <input type="text" auto-focus v-model="HBillNo" />
+                </view>
+            </view>
+
+            <view class="button-groups">
+                <button type="default" size="mini" class="btn-c" @tap.stop="onSearchClickHandler">鏌ヨ</button>
+                <button type="default" size="mini" class="btn-a" @tap.stop="onResetClickHandler">閲嶇疆</button>
+            </view>
+        </view>
+        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
         <scroll-view class="page-content">
+
+            <view class="over" v-if="listData.length == 0">鏆傛棤鏁版嵁</view>
         </scroll-view>
         <!-- 鍒嗛〉鍣� -->
-        <view class="page-footer"></view>
+        <view class="page-footer">
+            <uni-pagination id="#pagination" title="鏍囬鏂囧瓧" v-model="pageMeta.curPage" :pageSize="pageMeta.size"
+                :total="pageMeta.total"></uni-pagination>
+        </view>
     </view>
 </template>
 
 <script>
+    import dayjs from 'dayjs'
+    import {
+        CommonUtils
+    } from '@/utils/common.js'
+    import {
+        getUserInfo
+    } from '../../utils/auth'
     export default {
         data() {
             return {
+                // 鍒嗛〉鎺у埗
+                pageMeta: {
+                    curPage: 1,
+                    size: 50,
+                    total: 0,
+                },
                 // 婊氬姩鎺у埗
                 scrollTop: 0,
                 old: {
                     scrollTop: 0
+                },
+
+                dateRangePicker: ["浠绘剰闂撮殧", "浠婂ぉ", "杩戜袱澶�", "杩戜笁澶�",
+                    "杩戝洓澶�", "杩戜簲澶�", "杩戝叚澶�", "杩戜竷澶�", "杩�30澶�"
+                ],
+                curDateGap: "杩戜竷澶�",
+                enableCustomDateRange: false,
+                startDate: dayjs(new Date()).subtract(7, 'day').format('YYYY-MM-DD'),
+                endDate: dayjs(new Date()).format('YYYY-MM-DD'),
+                HBillNo: '',
+
+                listData: [],
+            }
+        },
+        computed: {
+            dateSwhere: {
+                get() {
+                    let date = new Date()
+                    switch (this.curDateGap) {
+                        case "浠婂ぉ":
+                            return ` and 鏃ユ湡 between convert(date, ${date.toLocaleDateString()}, 110) and convert(date, ${date.toLocaleDateString()}, 110)`;
+                            break;
+                        case "杩戜竴澶�":
+                            return ` and 鏃ユ湡 between convert(date, ${date.setDate(date.getDate() - 1).toLocaleDateString()}, 110) and convert(date, ${date.toLocaleDateString()}, 110)`;
+                            break;
+                        case "杩戜袱澶�":
+                            return ` and 鏃ユ湡 between convert(date, ${date.setDate(date.getDate() - 2).toLocaleDateString()}, 110) and convert(date, ${date.toLocaleDateString()}, 110)`;
+                            break;
+                        case "杩戜笁澶�":
+                            return ` and 鏃ユ湡 between convert(date, ${date.setDate(date.getDate() - 3).toLocaleDateString()}, 110) and convert(date, ${date.toLocaleDateString()}, 110)`;
+                            break;
+                        case "杩戝洓澶�":
+                            return ` and 鏃ユ湡 between convert(date, ${date.setDate(date.getDate() - 4).toLocaleDateString()}, 110) and convert(date, ${date.toLocaleDateString()}, 110)`;
+                            break;
+                        case "杩戜簲澶�":
+                            return ` and 鏃ユ湡 between convert(date, ${date.setDate(date.getDate() - 5).toLocaleDateString()}, 110) and convert(date, ${date.toLocaleDateString()}, 110)`;
+                            break;
+                        case "杩戝叚澶�":
+                            return ` and 鏃ユ湡 between convert(date, ${date.setDate(date.getDate() - 6).toLocaleDateString()}, 110) and convert(date, ${date.toLocaleDateString()}, 110)`;
+                            break;
+                        case "杩戜竷澶�":
+                            return ` and 鏃ユ湡 between convert(date, ${date.setDate(date.getDate() - 7).toLocaleDateString()}, 110) and convert(date, ${date.toLocaleDateString()}, 110)`;
+                            break;
+                        case "杩�30澶�":
+                            return ` and 鏃ユ湡 between convert(date, ${date.setDate(date.getDate() - 30).toLocaleDateString()}, 110) and convert(date, ${date.toLocaleDateString()}, 110)`;
+                            break;
+                        case "浠绘剰闂撮殧":
+                            return ` and 鏃ユ湡 between convert(date, ${date.setDate(this.startDate).toLocaleDateString()}, 110) and convert(date, ${date.setDate(this.startDate).toLocaleDateString()}, 110)`;
+                            break;
+                    }
                 }
             }
         },
@@ -26,11 +140,172 @@
                 this.$nextTick(function() {
                     this.scrollTop = 0
                 });
+            },
+            onDateRangePickerChangeHandler({
+                detail
+            }) {
+                this.enableCustomDateRange = false
+                this.curDateGap = this.dateRangePicker[detail.value]
+                let date = new Date()
+                switch (this.curDateGap) {
+                    case "浠婂ぉ":
+                        this.startDate = dayjs(date).format("YYYY-MM-DD")
+                        break;
+                    case "杩戜竴澶�":
+                        this.startDate = dayjs(date).subtract(1, 'day').format("YYYY-MM-DD")
+                        break;
+                    case "杩戜袱澶�":
+                        this.startDate = dayjs(date).subtract(2, 'day').format("YYYY-MM-DD")
+                        break;
+                    case "杩戜笁澶�":
+                        this.startDate = dayjs(date).subtract(3, 'day').format("YYYY-MM-DD")
+                        break;
+                    case "杩戝洓澶�":
+                        this.startDate = dayjs(date).subtract(4, 'day').format("YYYY-MM-DD")
+                        break;
+                    case "杩戜簲澶�":
+                        this.startDate = dayjs(date).subtract(5, 'day').format("YYYY-MM-DD")
+                        break;
+                    case "杩戝叚澶�":
+                        this.startDate = dayjs(date).subtract(6, 'day').format("YYYY-MM-DD")
+                        break;
+                    case "杩戜竷澶�":
+                        this.startDate = dayjs(date).subtract(7, 'day').format("YYYY-MM-DD")
+                        break;
+                    case "杩�30澶�":
+                        this.startDate = dayjs(date).subtract(30, 'day').format("YYYY-MM-DD")
+                        break;
+                }
+                if (this.curDateGap == '浠绘剰闂撮殧') {
+                    this.enableCustomDateRange = true
+                }
+            },
+            onSearchClickHandler() {
+                let sWhere = ''
+                if (this.startDate) {
+                    sWhere += " and CONVERT(varchar(100),鏃ユ湡, 23) >= '" + this.startDate + "'";
+                }
+                if (this.endDate) {
+                    sWhere += " and CONVERT(varchar(100),鏃ユ湡, 23) <= '" + this.endDate + "'";
+                }
+                if (this.HBillNo) {
+                    sWhere += " and 鍗曟嵁鍙� like '%" + this.HBillNo + "%'";
+                }
+                this.get_DisplayPage(sWhere);
+            },
+            onResetClickHandler() {
+
+            },
+            get_DisplayPage(sWhere) {
+                CommonUtils.doRequest2({
+                    url: '/QC_TakeSampleCheckBill/getQC_TakeSampleCheckBillListPage',
+                    data: {
+                        "sWhere": sWhere,
+                        "user": getUserInfo()["Czymc"],
+                        "page": 1,
+                        "size": 50
+                    },
+                    resFunction: (res) => {
+                        let {
+                            data,
+                            Message,
+                            count
+                        } = res.data
+                        console.log('res.data: ', res.data);
+                        this.listData = data;
+                        this.pageMeta.total = count
+                    }
+                })
             }
-        }
+        },
     }
 </script>
 
-<style>
+<style lang="scss">
+    .page-header {
+        display: flex;
+        box-sizing: border-box;
+        padding: 20rpx;
+        flex-direction: column;
+        gap: 10rpx;
+        font-size: 32rpx;
 
+        .search-item {
+            display: flex;
+            flex-direction: row;
+            gap: 10rpx;
+            justify-content: center;
+            align-items: center;
+
+            .left {
+                width: 4em;
+            }
+
+            .right {
+                flex: 1;
+                position: relative;
+                border-radius: 22rpx;
+                border: 1px solid #acacac;
+                display: flex;
+                padding: 4rpx 10rpx;
+
+                picker {
+                    width: 100%;
+                }
+            }
+        }
+
+        input {
+            width: inherit;
+            padding: 8rpx 20rpx;
+            font-size: 30rpx;
+        }
+
+        .datetime-picker-inner {
+            padding: 8rpx 20rpx;
+            font-size: 30rpx;
+            display: flex;
+            align-items: center;
+        }
+
+        .font__enable {
+            color: #000;
+        }
+
+        .font__disable {
+            color: #cccccc;
+        }
+    }
+
+    .button-groups {
+        box-sizing: border-box;
+        padding: 10rpx 0 0 0;
+        display: flex;
+        flex-direction: row;
+        gap: 10rpx;
+        justify-content: space-between;
+
+        .btn-a {
+            background-color: #acacac;
+            color: #fff;
+        }
+
+        .btn-b {
+            background-color: #41a863;
+            color: #fff;
+        }
+
+        .btn-c {
+            background-color: #3a78ff;
+            color: #fff;
+        }
+    }
+
+    .page-footer {
+        position: fixed;
+        bottom: 0;
+        width: 100%;
+        box-sizing: border-box;
+        padding: 32rpx 10rpx;
+    }
 </style>
\ No newline at end of file

--
Gitblit v1.9.1