高级过滤代码添加

This commit is contained in:
Ledo 2025-08-27 22:25:27 +08:00
parent 077acacd84
commit 9c88a17f84

View File

@ -1,39 +1,39 @@
<script setup lang="ts"> <script setup lang="ts">
import {onMounted, ref, } from "vue"; import { onMounted, ref, } from "vue";
import { import {
getReceivingGoods, postOperateAPI, receiveGoods, verification, getReceivingGoods, postOperateAPI, receiveGoods, verification,
} from "@/services/productionReport"; } from "@/services/productionReport";
import { useLoginStore } from "@/stores/modules/login"; import { useLoginStore } from "@/stores/modules/login";
const userStore = useLoginStore(); const userStore = useLoginStore();
const userId = userStore.userInfo.userId; const userId = userStore.userInfo.userId;
const popup = ref<UniHelper.UniPopupInstance>() const popup = ref<UniHelper.UniPopupInstance>()
const showPop = ref<UniHelper.UniPopupInstance>()
//
const isFinish = ref(false);
//
const isTriggered = ref(false);
const noticeMsg = ref("");
// const purchaseRemAmounts = ref("")
const isFinish = ref(false); const estimatedPrice = ref("")
// //
const isTriggered = ref(false); const isLoading = ref(false);
const noticeMsg = ref(""); //
const queryParams : Required<any> = {
const purchaseRemAmounts = ref("")
const estimatedPrice = ref("")
//
const isLoading = ref(false);
//
const queryParams: Required<any> = {
pageNo: 1, pageNo: 1,
pageSize: 5, pageSize: 5,
subOrDetailName:"", subOrDetailName: "",
projectName:undefined, projectName: undefined,
projectSubName:undefined, projectSubName: undefined,
supplierName:undefined, supplierName: undefined,
boomName:undefined, boomName: undefined,
procedureName:undefined, procedureName: undefined,
blueprintNo:undefined, blueprintNo: undefined,
}; };
const dataList = ref([]); const dataList = ref([]);
const list = ref([]); const list = ref([]);
const getListData = async () => { const getListData = async () => {
// 退 // 退
if (isLoading.value) return; if (isLoading.value) return;
if (isFinish.value === true) { if (isFinish.value === true) {
@ -53,20 +53,20 @@ const getListData = async () => {
// //
isFinish.value = true; isFinish.value = true;
} }
}; };
const todayStr = ref(""); const todayStr = ref("");
const searchVal = ref(""); const searchVal = ref("");
onMounted(async () => { onMounted(async () => {
isFinish.value = false; isFinish.value = false;
isLoading.value = false; isLoading.value = false;
queryParams.pageNo = 1; queryParams.pageNo = 1;
await getListData(); await getListData();
}); });
const isScanning = ref(false) const isScanning = ref(false)
// //
const onRefresherrefresh = async () => { const onRefresherrefresh = async () => {
// //
isTriggered.value = true; isTriggered.value = true;
// //
@ -77,10 +77,10 @@ const onRefresherrefresh = async () => {
await getListData(); await getListData();
// //
isTriggered.value = false; isTriggered.value = false;
}; };
const handleSearch = async (e) => { const handleSearch = async (e) => {
// //
queryParams.pageNo = 1; queryParams.pageNo = 1;
isFinish.value = false; isFinish.value = false;
@ -94,15 +94,15 @@ const handleSearch = async (e) => {
} catch (error) { } catch (error) {
console.error('搜索请求失败:', error); console.error('搜索请求失败:', error);
} }
}; };
const popUp = async (data) => { const popUp = async (data) => {
estimatedPrice.value=data.estimatedPrice estimatedPrice.value = data.estimatedPrice
purchaseRemAmounts.value=data.purchaseRemAmounts purchaseRemAmounts.value = data.purchaseRemAmounts
list.value.push(data) list.value.push(data)
popup.value?.open() popup.value?.open()
} }
const handleOk = async () => { const handleOk = async () => {
if (estimatedPrice.value==null||estimatedPrice.value==""||estimatedPrice.value==undefined||estimatedPrice.value==''||estimatedPrice.value<=0){ if (estimatedPrice.value == null || estimatedPrice.value == "" || estimatedPrice.value == undefined || estimatedPrice.value == '' || estimatedPrice.value <= 0) {
uni.showToast({ uni.showToast({
title: '预估总价不能为空', title: '预估总价不能为空',
icon: 'none', icon: 'none',
@ -110,7 +110,7 @@ const handleOk = async () => {
}); });
return return
} }
if (purchaseRemAmounts.value==null||purchaseRemAmounts.value==""||purchaseRemAmounts.value==undefined||purchaseRemAmounts.value<=0||purchaseRemAmounts.value==''){ if (purchaseRemAmounts.value == null || purchaseRemAmounts.value == "" || purchaseRemAmounts.value == undefined || purchaseRemAmounts.value <= 0 || purchaseRemAmounts.value == '') {
uni.showToast({ uni.showToast({
title: '入库数量不能为空或为0', title: '入库数量不能为空或为0',
icon: 'none', icon: 'none',
@ -118,8 +118,8 @@ const handleOk = async () => {
}); });
return return
} }
list.value[0].estimatedPrice=estimatedPrice.value list.value[0].estimatedPrice = estimatedPrice.value
list.value[0].purchaseRemAmounts=purchaseRemAmounts.value list.value[0].purchaseRemAmounts = purchaseRemAmounts.value
await verification(list.value[0]) await verification(list.value[0])
const res = await Promise.race([ const res = await Promise.race([
receiveGoods(list.value[0]), receiveGoods(list.value[0]),
@ -132,25 +132,51 @@ const handleOk = async () => {
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
list.value=[] list.value = []
estimatedPrice.value="" estimatedPrice.value = ""
purchaseRemAmounts.value="" purchaseRemAmounts.value = ""
popup.value?.close() popup.value?.close()
await getListData() await getListData()
} }
const cancel = () => { const cancel = () => {
list.value=[] list.value = []
estimatedPrice.value="" estimatedPrice.value = ""
purchaseRemAmounts.value="" purchaseRemAmounts.value = ""
popup.value?.close() popup.value?.close()
} }
const filterData : Required<any> = ({
projectName: '',
subProjectName: '',
supplier: '',
partName: '',
process: '',
drawingNo: ''
})
//
const toggleDropdown = () => {
showPop.value?.open()
}
//
const cancelFilter = () => {
showPop.value?.close()
}
//
const confirmFilter = () => {
//
searchVal.value = '';
//
console.log('过滤数据:', filterData);
//
showPop.value?.close();
}
</script> </script>
<template> <template>
<view class="cont"> <view class="cont">
<view class="search"> <view class="search" style="display: flex; align-items: center;">
<view <view style="
style="
width: 90%; width: 90%;
display: flex; display: flex;
align-items: center; align-items: center;
@ -158,14 +184,9 @@ const cancel = () => {
border-radius: 20rpx; border-radius: 20rpx;
padding: 0 8rpx; padding: 0 8rpx;
height: 50px; height: 50px;
" ">
> <input class="uni-input" v-model="searchVal" placeholder="请输入物料名称、图号、工序"
<input :placeholder-style="'color:#28A0F8;'" style="
class="uni-input"
v-model="searchVal"
placeholder="请输入物料名称、图号、工序"
:placeholder-style="'color:#28A0F8;'"
style="
flex: 1; flex: 1;
background: transparent; background: transparent;
border: none; border: none;
@ -174,33 +195,22 @@ const cancel = () => {
color: #28a0f8; color: #28a0f8;
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
" " @input="handleSearch({ inputValue: searchVal })" clearable />
@input="handleSearch({ inputValue: searchVal })" </view>
clearable <view class="filter-btn" @click="toggleDropdown" style="margin-left: 10px;">
/> <image src="/static/images/shalou.jpeg" mode="aspectFit" class="filter-icon"></image>
</view>
</view> </view>
</view> <scroll-view enable-back-to-top scroll-y class="data-list" refresher-enabled :refresher-triggered="isTriggered"
<scroll-view @refresherrefresh="onRefresherrefresh" @scrolltolower="getListData">
enable-back-to-top <view class="item" v-for="item in dataList" :key="item.id">
scroll-y
class="data-list"
refresher-enabled
:refresher-triggered="isTriggered"
@refresherrefresh="onRefresherrefresh"
@scrolltolower="getListData"
>
<view
class="item"
v-for="item in dataList"
:key="item.id"
>
<view class="hd"> <view class="hd">
<view class="num">图号</view> <view class="num">图号</view>
<view class="num">{{ <view class="num">{{
item.blueprintNo item.blueprintNo
}}</view> }}</view>
<view class="statusText1" @click="popUp(item)" > <view class="statusText1" @click="popUp(item)">
收货 收货
</view> </view>
</view> </view>
@ -210,7 +220,7 @@ const cancel = () => {
<view class="label">零件名称: {{ item.boomName }}</view> <view class="label">零件名称: {{ item.boomName }}</view>
</view> </view>
<view class="row-item"> <view class="row-item">
<view class="label" >派工工序: {{ item.procedureName }}</view> <view class="label">派工工序: {{ item.procedureName }}</view>
</view> </view>
</view> </view>
<view class="product-row"> <view class="product-row">
@ -218,7 +228,7 @@ const cancel = () => {
<view class="label">采购数量: {{ item.purchaseAmount }}</view> <view class="label">采购数量: {{ item.purchaseAmount }}</view>
</view> </view>
<view class="row-item"> <view class="row-item">
<view class="label" >剩余数量: {{ item.purchaseRemAmount }}</view> <view class="label">剩余数量: {{ item.purchaseRemAmount }}</view>
</view> </view>
</view> </view>
<view class="product-row"> <view class="product-row">
@ -226,7 +236,7 @@ const cancel = () => {
<view class="label">收货状态: {{ item.receivingStatus==1?"未收货":"收货中" }}</view> <view class="label">收货状态: {{ item.receivingStatus==1?"未收货":"收货中" }}</view>
</view> </view>
<view class="row-item"> <view class="row-item">
<view class="label" >物料类型: {{ item.goodsType==1?"物料":"加工件" }}</view> <view class="label">物料类型: {{ item.goodsType==1?"物料":"加工件" }}</view>
</view> </view>
</view> </view>
<view class="product-row"> <view class="product-row">
@ -234,11 +244,11 @@ const cancel = () => {
<view class="label">完成日期: {{ item.requireTimes }}</view> <view class="label">完成日期: {{ item.requireTimes }}</view>
</view> </view>
<view class="row-item"> <view class="row-item">
<view class="label" >供应商: {{ item.supplierName }}</view> <view class="label">供应商: {{ item.supplierName }}</view>
</view> </view>
</view> </view>
<view class="product-row"> <view class="product-row">
<view > <view>
<view class="label">子项目编码: {{ item.projectSubCode }}</view> <view class="label">子项目编码: {{ item.projectSubCode }}</view>
</view> </view>
</view> </view>
@ -247,10 +257,7 @@ const cancel = () => {
<!-- 底部提示文字 --> <!-- 底部提示文字 -->
<view <view class="loading-text" :style="{ paddingBottom: safeAreaInsets?.bottom + 'px' }">
class="loading-text"
:style="{ paddingBottom: safeAreaInsets?.bottom + 'px' }"
>
{{ isFinish ? "没有更多数据~" : "正在加载..." }} {{ isFinish ? "没有更多数据~" : "正在加载..." }}
</view> </view>
<uni-popup class="popup" ref="popup" :mask-click="false" type="bottom" background-color="#fff"> <uni-popup class="popup" ref="popup" :mask-click="false" type="bottom" background-color="#fff">
@ -276,18 +283,82 @@ const cancel = () => {
</uni-popup> </uni-popup>
</scroll-view> </scroll-view>
<uni-popup class="popup" ref="showPop" :mask-click="false" type="top" background-color="#fff">
<view style="margin-top: 6%;">
<uni-forms :modelValue="filterData">
<uni-forms-item label="姓名" name="projectName">
<uni-easyinput type="text" v-model="filterData.projectName" placeholder="请输入项目名称" />
</uni-forms-item>
<uni-forms-item label="年龄" name="subProjectName">
<uni-easyinput type="text" v-model="filterData.subProjectName" placeholder="请输入子项目名称" />
</uni-forms-item>
<uni-forms-item name="supplier" label="供应商">
<uni-easyinput type="text" v-model="filterData.supplier" placeholder="请输入供应商" />
</uni-forms-item>
<uni-forms-item label="姓名" name="partName">
<uni-easyinput type="text" v-model="filterData.partName" placeholder="请输入零件名称" />
</uni-forms-item>
<uni-forms-item label="年龄" name="process">
<uni-easyinput type="text" v-model="filterData.process" placeholder="请输入工序" />
</uni-forms-item>
<uni-forms-item name="drawingNo" label="图号">
<uni-easyinput type="text" v-model="filterData.drawingNo" placeholder="请输入图号" />
</uni-forms-item>
</uni-forms>
</view>
<view class="filter-buttons">
<view class="cancel" @click="cancelFilter">取消</view>
<view class="ok" @click="confirmFilter">确认</view>
</view>
</uni-popup>
</view> </view>
</template> </template>
<style lang="scss"> <style lang="scss">
.filter-buttons {
display: flex;
width: 100%;
justify-content: space-between;
}
.filter-btn {
padding: 10rpx;
display: flex;
align-items: center;
justify-content: center;
margin-left: auto; /* Push the filter button to the right */
// .filter-icon {
.search { width: 40rpx;
height: 40rpx;
}
}
.filter-buttons .cancel {
background-color: white;
color: #333;
flex: 1;
text-align: center;
padding: 10px;
border: 1px solid #ddd;
}
.filter-buttons .ok {
background-color: #007aff;
color: white;
flex: 1;
text-align: center;
padding: 10px;
}
//
.search {
padding: 0rpx; padding: 0rpx;
width: 90%; width: 90%;
margin: auto; margin: auto;
margin-top: 20rpx; margin-top: 20rpx;
position: relative; position: relative;
.uni-input { .uni-input {
border: 1px solid #d1d6db; border: 1px solid #d1d6db;
height: 60rpx; height: 60rpx;
@ -295,16 +366,22 @@ const cancel = () => {
padding: 4rpx 10rpx; padding: 4rpx 10rpx;
font-size: 32rpx; font-size: 32rpx;
border-radius: 10rpx; border-radius: 10rpx;
flex: 1; /* Make the input take the remaining space */
} }
.icons { .icons {
width: 30rpx; width: 30rpx;
position: absolute; position: absolute;
right: 40rpx; right: 40rpx;
top: 0rpx; top: 0rpx;
} }
}
.data-list {
}
.data-list {
height: 90vh; height: 90vh;
.item { .item {
@ -364,6 +441,7 @@ const cancel = () => {
} }
} }
} }
.statusText1 { .statusText1 {
font-size: 24rpx; font-size: 24rpx;
position: absolute; position: absolute;
@ -536,8 +614,9 @@ const cancel = () => {
color: #666; color: #666;
padding: 20rpx 0; padding: 20rpx 0;
} }
} }
.popup {
.popup {
.title { .title {
line-height: 1; line-height: 1;
padding: 40rpx; padding: 40rpx;
@ -594,13 +673,17 @@ const cancel = () => {
/* 新增按钮组容器样式 */ /* 新增按钮组容器样式 */
.button-group { .button-group {
display: flex; /* 开启弹性布局 */ display: flex;
justify-content: center; /* 水平居中对齐 */ /* 开启弹性布局 */
gap: 20rpx; /* 按钮间距 */ justify-content: center;
/* 水平居中对齐 */
gap: 20rpx;
/* 按钮间距 */
} }
/* 修正原有 .ok 样式 */ /* 修正原有 .ok 样式 */
.ok, .cancel { .ok,
.cancel {
font-size: 32rpx; font-size: 32rpx;
text-align: center; text-align: center;
width: 200rpx; width: 200rpx;
@ -616,5 +699,5 @@ const cancel = () => {
.cancel { .cancel {
background: linear-gradient(157deg, #A9A9A9 -3%, #A9A9A9 90%); background: linear-gradient(157deg, #A9A9A9 -3%, #A9A9A9 90%);
} }
} }
</style>import type { stringify } from 'querystring'; </style>