Commit bd95e8ce authored by tanjunxin's avatar tanjunxin

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

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