This commit is contained in:
2025-03-21 14:42:38 +08:00
parent 3fe42736e3
commit 38d09f0f37
4 changed files with 33 additions and 24 deletions

View File

@@ -39,33 +39,34 @@
<uni-data-select v-model="index2" :localdata="options1"></uni-data-select>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">交期时间</span>
</view>
<view class="zd-col-17 filter_select">
<uni-datetime-picker type="datetime" v-model="datetimesingle" :border="false" />
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>操作</th>
<th @tap="addRow">
<view style="display: flex;align-items: center;font-weight: normal;">
<uni-icons type="plus-filled" size="28" color="#4e6ef2"></uni-icons>
</view>
</th>
<th>订单号</th>
<th>物料号</th>
<th>物料数量</th>
<th>交期时间</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i">
<td @tap="addRow"><uni-icons type="plus-filled" size="30" color="#4e6ef2"></uni-icons></td>
<td @tap="addRow">
<view style="display: flex;align-items: center;">
<uni-icons type="plus-filled" size="28" color="#4e6ef2"></uni-icons>
</view>
</td>
<td><input type="text" class="td_input" v-model="e.order_code"></td>
<td><input type="text" class="td_input" v-model="e.material_code"></td>
<td><input type="number" class="td_input" v-model="e.material_qty"></td>
<td>{{e.due_date}}</td>
</tr>
</tbody>
</table>
@@ -109,8 +110,7 @@
index1: '',
index2: '',
disabled: false,
dataList: [{order_code: '', material_code: '', material_qty: 0}],
datetimesingle: ''
dataList: []
};
},
onLoad (options) {
@@ -119,7 +119,7 @@
},
methods: {
selectChange (e) {
this.dataList = [{order_code: '', material_code: '', material_qty: 0}]
this.dataList = []
this.index1 = ''
this.index2 = ''
},
@@ -131,13 +131,13 @@
})
},
addRow () {
this.dataList.push({order_code: '', material_code: '', material_qty: 0})
this.dataList.push({order_code: '', material_code: '', material_qty: 0, due_date: this.getCurrentDateTime()})
},
clearUp () {
this.val1 = ''
this.val2 = ''
this.index = ''
this.dataList = [{order_code: '', material_code: '', material_qty: 0}]
this.dataList = []
this.index1 = ''
this.index2 = ''
this.disabled = false
@@ -155,7 +155,7 @@
}
})
try {
let res = await handheldBlanking(this.index, this.val1, this.index1, this.val2, arr, this.index2, this.datetimesingle)
let res = await handheldBlanking(this.index, this.val1, this.index1, this.val2, arr, this.index2)
this.clearUp()
uni.showToast({
title: res.message,
@@ -164,6 +164,16 @@
} catch (e) {
this.disabled = false
}
},
getCurrentDateTime() {
const now = new Date()
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0') // 月份从0开始需要加1
const day = String(now.getDate()).padStart(2, '0')
const hours = String(now.getHours()).padStart(2, '0')
const minutes = String(now.getMinutes()).padStart(2, '0')
const seconds = String(now.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
}
}
}