pcsn 时间add

This commit is contained in:
2026-04-22 16:42:22 +08:00
parent ac7fee7676
commit b1e4f0ba4f
3 changed files with 125 additions and 11 deletions

View File

@@ -123,9 +123,10 @@ export const checkBucket = (code, option, bill) => post('api/pda/st/in/checkBuck
option: option
})
// 1.3获取单据信息
export const getBillDtl = (page, size) => post('api/pda/st/in/getBillDtl', {
export const getBillDtl = (page, size, pcsn) => post('api/pda/st/in/getBillDtl', {
page: page,
size: size
size: size,
pcsn: pcsn
})
// 1.4 确认组盘
export const confirmVehicle = (option, vehicle, rows, point, bill, level) => post('api/pda/st/in/confirmVehicle', {
@@ -185,11 +186,13 @@ export const askVehicle = (row, point) => post('api/pda/st/in/askVehicle', {
point: point
})
// 1.6获取软废单据信息
export const getRecBillDtl = (page, size, mater, code) => post('api/pda/st/in/getRecBillDtl', {
export const getRecBillDtl = (page, size, mater, code, startTime, endTime) => post('api/pda/st/in/getRecBillDtl', {
page: page,
size: size,
material_search: mater,
bill_code: code
bill_code: code,
startTime: startTime,
endTime: endTime
})
// 1.9 获取软废等级下拉框(进页面查询)
export const inIetIvtLevel = () => post('api/pda/st/in/getIvtLevel', {})

View File

@@ -2,6 +2,14 @@
<section>
<nav-bar :inner="true" title="查找关联单据"></nav-bar>
<section class="content mgt196 mgb70" v-infinite-scroll="loadMore" infinite-scroll-disabled="busy" infinite-scroll-distance="0" infinite-scroll-immediate-check="false">
<div class="filter-wraper">
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">批次</div>
<div class="fxcol mgl20">
<input type="text" class="filter-input filter-scan-input" placeholder="批次号" v-model="val1">
</div>
</div>
</div>
<div class="grid-wraper">
<div class="left_fixed">
<table class="layout-t left_layout_t">
@@ -37,6 +45,7 @@
<div class="loading-tips">{{desc}}</div>
</section>
<section class="submit-bar">
<button class="btn submit-button" @click="toSearch">查询</button>
<button class="btn submit-button" :class="{'btn-disabled': pkId === ''}" @click="toSure">确认</button>
</section>
</section>
@@ -52,19 +61,30 @@ export default {
},
data () {
return {
val1: '',
dataList: [],
pkId: '',
pkObj: {},
page: 1,
size: '10',
busy: false,
desc: '加载数据中...'
desc: ''
}
},
created () {
this._getBillDtl()
// this._getBillDtl()
},
methods: {
toSearch () {
this.dataList = []
this.pkId = ''
this.pkObj = {}
this.page = 1
this.size = '10'
this.busy = false
this.desc = ''
this._getBillDtl()
},
toCheck (e) {
this.pkId = this.pkId === e.source_billdtl_id ? '' : e.source_billdtl_id
this.pkObj = this.pkId === e.source_billdtl_id ? e : {}
@@ -80,7 +100,8 @@ export default {
async loadMore () {
this.busy = true
this.page++
let res = await getBillDtl(this.page + '', this.size)
this.desc = '加载数据中...'
let res = await getBillDtl(this.page + '', this.size, this.val1)
if (res.code === '1') {
let newArr = []
res.rows.map(el => { newArr.push(Object.assign({}, el, {checked: 0})) })
@@ -97,7 +118,7 @@ export default {
}
},
async _getBillDtl () {
let res = await getBillDtl(this.page + '', this.size)
let res = await getBillDtl(this.page + '', this.size, this.val1)
if (res.code === '1') {
let newArr = []
res.rows.map(el => { newArr.push(Object.assign({}, el, {checked: 0})) })

View File

@@ -15,6 +15,37 @@
<input type="text" class="filter-input filter-scan-input" v-model="val2">
</div>
</div>
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">开始时间</div>
<div class="fxcol mgl20">
<div class="filter-input filter-input_1 pointer" style="min-height: 0.9rem" @click="showStart = true">
{{ startDateText }}
</div>
</div>
</div>
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">结束时间</div>
<div class="fxcol mgl20">
<div class="filter-input filter-input_1 pointer" style="min-height: 0.9rem" @click="showEnd = true">
{{ endDateText }}
</div>
</div>
</div>
<!-- 开始时间日历 -->
<van-calendar
v-model="showStart"
:min-date="minDate"
:default-date="defaultStartDate"
@confirm="onConfirmStart"
/>
<!-- 结束时间日历 -->
<van-calendar
v-model="showEnd"
:min-date="minDate"
:default-date="defaultEndDate"
@confirm="onConfirmEnd"
/>
</div>
<div class="grid-wraper">
<div class="left_fixed">
@@ -54,15 +85,31 @@
</template>
<script>
import { Calendar } from 'vant'
import NavBar from '@components/NavBar.vue'
import {getRecBillDtl} from '@config/getData2.js'
export default {
name: 'SearchSoftWasteBill',
components: {
NavBar
NavBar,
[Calendar.name]: Calendar
},
data () {
// 获取今天(零点)
const today = new Date()
today.setHours(0, 0, 0, 0)
// 三天前
const threeDaysAgo = new Date(today)
threeDaysAgo.setDate(today.getDate() - 3)
return {
minDate: new Date(2000, 0, 1), // 可选最早日期
defaultStartDate: threeDaysAgo, // 开始时间默认三天前Date对象
defaultEndDate: today, // 结束时间默认今天Date对象
startDate: threeDaysAgo, // 当前选中的开始时间Date
endDate: today, // 当前选中的结束时间Date
showStart: false, // 控制开始日历弹窗
showEnd: false, // 控制结束日历弹窗
dataList: [],
pkId: '',
pkObj: {},
@@ -74,10 +121,53 @@ export default {
val2: ''
}
},
computed: {
// 格式化显示的文本
startDateText () {
return this.formatDate(this.startDate)
},
endDateText () {
return this.formatDate(this.endDate)
}
},
created () {
this._getRecBillDtl()
},
methods: {
// 格式化日期为 YYYY-MM-DD (确保参数为Date对象)
formatDate (date) {
if (!(date instanceof Date) || isNaN(date.getTime())) {
console.warn('formatDate received invalid date:', date)
return ''
}
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
// 开始时间日历确认
onConfirmStart (date) {
this.showStart = false
if (date instanceof Date) {
this.startDate = date
// 可选:如果开始时间晚于结束时间,自动调整结束时间
if (this.startDate > this.endDate) {
this.endDate = new Date(this.startDate)
}
}
},
// 结束时间日历确认
onConfirmEnd (date) {
this.showEnd = false
if (date instanceof Date) {
this.endDate = date
// 可选:如果结束时间早于开始时间,自动调整开始时间
if (this.endDate < this.startDate) {
this.startDate = new Date(this.endDate)
}
}
},
toCheck (e) {
this.pkId = this.pkId === e.source_billdtl_id ? '' : e.source_billdtl_id
this.pkObj = this.pkId === e.source_billdtl_id ? e : {}
@@ -92,7 +182,7 @@ export default {
this.busy = true
this.page++
this.desc = '加载数据中...'
let res = await getRecBillDtl(this.page + '', this.size, this.val1, this.val2)
let res = await getRecBillDtl(this.page + '', this.size, this.val1, this.val2, this.formatDate(this.startDate), this.formatDate(this.endDate))
if (res.code === '1') {
this.dataList = [...this.dataList, ...res.rows]
if (res.rows.length < 10) {
@@ -107,7 +197,7 @@ export default {
}
},
async _getRecBillDtl () {
let res = await getRecBillDtl(this.page + '', this.size, this.val1, this.val2)
let res = await getRecBillDtl(this.page + '', this.size, this.val1, this.val2, this.formatDate(this.startDate), this.formatDate(this.endDate))
if (res.code === '1') {
this.dataList = [...res.rows]
if (res.rows.length < 10) {