Commit e70097de authored by caicaicai's avatar caicaicai

修改

parent 6f25f3bf
......@@ -2,10 +2,10 @@ ENV = 'development'
# 接口地址
#VUE_APP_BASE_API = 'http://localhost:8000'
VUE_APP_BASE_API = 'http://192.168.0.110:8001'
VUE_APP_BASE_API = 'http://8.143.203.103:9090'
VUE_APP_WS_API = 'ws://192.168.0.111:8001/webSocket'
VUE_APP_LOCAL_API = 'http://192.168.0.110:8001'
VUE_APP_LOCAL_API2 = 'http://192.168.0.110:8001'
VUE_APP_LOCAL_API = 'http://8.143.203.103:9090'
VUE_APP_LOCAL_API2 = 'http://8.143.203.103:9090'
# 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true
This diff is collapsed.
......@@ -21,8 +21,8 @@
<div class="content">
<el-table :data="tableData" v-loading="loading" border style="width:auto" :row-class-name="tableRowClassName">
<el-table-column prop="banci" label="班次" align="center"></el-table-column>
<el-table-column prop="startTime" label="开始时间" align="center"></el-table-column>
<el-table-column prop="endTime" label="结束时间" align="center"></el-table-column>
<el-table-column prop="startTime" label="开始时间" align="center" :formatter="currentTime1"></el-table-column>
<el-table-column prop="endTime" label="结束时间" align="center" :formatter="currentTime2"></el-table-column>
<el-table-column label="操作" align="center" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="primary" icon="el-icon-edit" @click="toEdit(scope.row)"></el-button>
......@@ -45,10 +45,10 @@
<el-input v-model="form.item.banci" style="width:220px;" placeholder="请输入班次"/>
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-time-picker v-model="form.item.startTime" placeholder="任意时间点"></el-time-picker>
<el-date-picker type="datetime" v-model="form.item.startTime" placeholder="任意时间点"></el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-time-picker v-model="form.item.endTime" placeholder="任意时间点"></el-time-picker>
<el-date-picker type="datetime" v-model="form.item.endTime" placeholder="任意时间点"></el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -77,8 +77,8 @@ export default {
tableData: [],
form: {
title:'新增班次',
visible:false,
reqType:'add',
visible:false,
reqType:'add',
status:{cu:0},
item:{},
},
......@@ -158,8 +158,8 @@ export default {
this.form.status.cu = 0;
this.form.visible = true;
this.form.item = {...item};
this.form.item.startTime = '';
this.form.item.endTime = '';
this.form.item.startTime = '';
this.form.item.endTime = '';
this.form.reqType = 'edit';
this.ShiftId = this.form.item.id;
},
......@@ -202,8 +202,8 @@ export default {
//新增班次
reqAddItem(form, item){
let lastData = {...item};
lastData.startTime = this.currentTime(lastData.startTime);
lastData.endTime = this.currentTime(lastData.endTime);
lastData.startTime = lastData.startTime;
lastData.endTime = lastData.endTime;
HttpReq.truckDispatching.shiftAdd(lastData).then((res) => {
form.visible = false;
if(res.code == 200){
......@@ -227,8 +227,8 @@ export default {
//修改班次
reqUpdateItem(form, item){
let lastData = {...item};
lastData.startTime = this.currentTime(lastData.startTime);
lastData.endTime = this.currentTime(lastData.endTime);
lastData.startTime = lastData.startTime;
lastData.endTime = lastData.endTime;
lastData.id = this.ShiftId;
HttpReq.truckDispatching.shiftUpdate(lastData).then((res) => {
form.visible = false;
......@@ -269,27 +269,73 @@ export default {
this.loadData();
})
},
//转换时间
currentTime(time){
var date = new Date(time);
var hours = date.getHours(); //小时 ,返回 Date 对象的小时 (0 ~ 23)
var minutes = date.getMinutes(); //分钟 ,返回 Date 对象的分钟 (0 ~ 59)
var seconds = date.getSeconds(); //秒 ,返回 Date 对象的秒数 (0 ~ 59)
//修改小时格式
if (hours >= 0 && hours <= 9) {
hours = "0" + hours;
}
//修改分钟格式
if (minutes >= 0 && minutes <= 9) {
minutes = "0" + minutes;
}
//修改秒格式
if (seconds >= 0 && seconds <= 9) {
seconds = "0" + seconds;
}
let currentFormatDate = hours + ":" + minutes + ":" + seconds;
return currentFormatDate;
},
//转换时间
currentTime1(row){
var date = new Date(row.startTime);
var year = date.getFullYear(); //年 ,从 Date 对象以四位数字返回年份
var month = date.getMonth() + 1; //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
var day = date.getDate(); //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
var hours = date.getHours(); //小时 ,返回 Date 对象的小时 (0 ~ 23)
var minutes = date.getMinutes(); //分钟 ,返回 Date 对象的分钟 (0 ~ 59)
var seconds = date.getSeconds(); //秒 ,返回 Date 对象的秒数 (0 ~ 59)
//修改月份格式
if (month >= 1 && month <= 9) {
month = "0" + month;
}
//修改日期格式
if (day >= 0 && day <= 9) {
day = "0" + day;
}
//修改小时格式
if (hours >= 0 && hours <= 9) {
hours = "0" + hours;
}
//修改分钟格式
if (minutes >= 0 && minutes <= 9) {
minutes = "0" + minutes;
}
//修改秒格式
if (seconds >= 0 && seconds <= 9) {
seconds = "0" + seconds;
}
//获取当前系统时间 格式(yyyy-mm-dd hh:mm:ss)
let currentFormatDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
//console.log(currentFormatDate);
return currentFormatDate;
},
currentTime2(row){
var date = new Date(row.endTime);
var year = date.getFullYear(); //年 ,从 Date 对象以四位数字返回年份
var month = date.getMonth() + 1; //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
var day = date.getDate(); //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
var hours = date.getHours(); //小时 ,返回 Date 对象的小时 (0 ~ 23)
var minutes = date.getMinutes(); //分钟 ,返回 Date 对象的分钟 (0 ~ 59)
var seconds = date.getSeconds(); //秒 ,返回 Date 对象的秒数 (0 ~ 59)
//修改月份格式
if (month >= 1 && month <= 9) {
month = "0" + month;
}
//修改日期格式
if (day >= 0 && day <= 9) {
day = "0" + day;
}
//修改小时格式
if (hours >= 0 && hours <= 9) {
hours = "0" + hours;
}
//修改分钟格式
if (minutes >= 0 && minutes <= 9) {
minutes = "0" + minutes;
}
//修改秒格式
if (seconds >= 0 && seconds <= 9) {
seconds = "0" + seconds;
}
//获取当前系统时间 格式(yyyy-mm-dd hh:mm:ss)
let currentFormatDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
//console.log(currentFormatDate);
return currentFormatDate;
},
}
}
</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