高级过滤代码添加

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