Commit bd95e8ce authored by tanjunxin's avatar tanjunxin

fix: 生产打样下单日期选择器细节优化

parent 850d3c8b
......@@ -290,7 +290,6 @@
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划开始时间"
:picker-options="pickerOptions"
@focus="writeRow(scope.row)"
@change="editTime(scope.row, 'start')"
>
......@@ -316,7 +315,6 @@
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划结束时间"
:picker-options="pickerOptions"
@focus="writeRow(scope.row)"
@change="editTime(scope.row, 'end')"
>
......@@ -992,6 +990,12 @@ export default {
this.editTimeLast = JSON.parse(JSON.stringify(row))
},
editTime(row, type){
const startTime = new Date(this.editTimeLast.scheduleStartDate).getTime() + 3 * 60 * 1000;
const endTime = new Date(this.editTimeLast.scheduleEndDate).getTime() + 3 * 60 * 1000;
const nowTime = new Date().getTime();
if(startTime < nowTime || endTime < nowTime) {
return this.$message.warning('手工排产时间不得早于当前时间!');
}
const scheduleStartDate = dayjs(this.editTimeLast.scheduleStartDate)
const scheduleEndDate = dayjs(this.editTimeLast.scheduleEndDate)
if (type === 'start') {
......@@ -1002,9 +1006,7 @@ export default {
console.log('duration', duration)
row.scheduleStartDate = dayjs(row.scheduleEndDate).add(duration).format('YYYY-MM-DD HH:mm:ss')
}
console.log(scheduleStartDate)
console.log(scheduleEndDate)
// this.submitForm(row)
this.submitForm(row)
},
/** 搜索按钮操作 */
handleWorkunitQuery() {
......
......@@ -36,7 +36,6 @@
style="width: 100%;"
placeholder="请选择计划开始时间"
format ="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
......@@ -52,8 +51,9 @@
style="width: 100%;"
placeholder="请选择计划结束时间"
format ="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss">
value-format="yyyy-MM-dd HH:mm:ss"
@change="editTime(scope.row, 'end')"
>
</el-date-picker>
</el-form-item>
</template>
......@@ -137,8 +137,8 @@ export default {
this.tableForm.tableData = response.rows.map(item => {
return {
...item,
scheduleStartTime: this.$attrs.currentData.requestDate ? this.$attrs.currentData.requestDate + ' 00:00:00' : null,
scheduleEndTime: this.$attrs.currentData.requestDate ? this.$attrs.currentData.requestDate + ' 00:00:00' : null
scheduleStartTime: this.$attrs.currentData.requestDate ? this.$attrs.currentData.requestDate : null,
scheduleEndTime: this.$attrs.currentData.requestDate ? this.$attrs.currentData.requestDate : null
}
})
this.loading = false;
......@@ -177,7 +177,14 @@ export default {
let params = {
workorderId: this.$attrs.workorderId
}
let flag = false;
params.processData = this.tableForm.tableData.map(item => {
const startTime = new Date(item.scheduleStartTime).getTime() + 3 * 60 * 1000;
const endTime = new Date(item.scheduleEndTime).getTime() + 3 * 60 * 1000;
const nowTime = new Date().getTime();
if(startTime < nowTime || endTime < nowTime) {
flag = true;
}
return {
"scheduleEndTime": item.scheduleEndTime,
"scheduleStartTime": item.scheduleStartTime,
......@@ -185,7 +192,10 @@ export default {
"workunitId": item.workunitId
}
})
console.log(params)
// console.log(params)
if(flag) {
return this.$message.warning('手工排产时间不得早于当前时间!');
}
workorderProofMakeProduction(params).then(res => {
if (res.code === 200) {
this.$emit('close')
......@@ -197,6 +207,13 @@ export default {
}
})
},
editTime(row){
const startTime = new Date(row.scheduleStartTime).getTime();
const endTime = new Date(row.scheduleEndTime).getTime();
if(startTime > endTime) {
return this.$message.warning('计划结束时间不能小于计划开始时间!');
}
}
},
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment