Commit 7d479422 authored by 黄奎's avatar 黄奎

新增和平用车

parent d0fbae57
......@@ -36,6 +36,7 @@
<li>
<input type="button" class="normalBtn" :value="$t('pub.searchBtn')" @click="getList()" />
<button class="hollowFixedBtn" @click="editPlan(null)">{{$t('pub.addBtn')}}</button>
<button class="normalBtn" type="button" @click="downLoadPlan()">{{$t('adm.adm_download')}}</button>
</li>
</ul>
</div>
......@@ -64,16 +65,16 @@
{{item.CarNo}}
</td>
<template v-for="(subItem,subIndex) in item.SubList">
<td>
<td :key="`d_`+index+`_j_`+subIndex">
<template v-if="subItem.DayObj">
<template v-if="subItem.DayObj.UseType==1">
<font></font>
<font></font>
</template>
<template v-if="subItem.DayObj.UseType==2">
<font></font>
<font></font>
</template>
<template v-if="subItem.DayObj.UseType==3">
<font>全天</font>
<font></font>
</template>
<template v-if="subItem.DayObj.UseType==4">
<font>X</font>
......@@ -85,14 +86,32 @@
<tr>
<template v-for="(subItem,subIndex) in item.SubList">
<template v-if="subItem.DayObj">
<td v-if="subItem.DayObj.DayNum==1" :colspan="subItem.DayObj.ColumnNum">
<font @click="editPlan(subItem.DayObj)" style="color:blue;cursor:pointer;"> {{subItem.DayObj.DMCNum}}
{{subItem.DayObj.InOutStr}}</font>
<i class="el-icon-delete" @click="deleteTrip(subItem.DayObj)" style="color:red;"></i>
<td v-if="subItem.DayObj.DayNum==1" :colspan="subItem.DayObj.ColumnNum"
:key="`d_`+index+`_d_`+subIndex">
<font style="cursor:pointer;">
<template v-if="subItem.DayObj.PlanType==1">
<el-tooltip class="item" effect="dark" content="点击修改" placement="top-start">
<font style="color:blue;" @click="editPlan(subItem.DayObj)">
{{subItem.DayObj.DMCNum}}&nbsp;{{subItem.DayObj.InOutStr}}</font>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="点击跳转团队详情" placement="top-start">
<i class="el-icon-view" @click="gotoTeam(subItem.DayObj)" style="color:green;"></i>
</el-tooltip>
</template>
<template v-else>
<el-tooltip class="item" effect="dark" content="点击修改" placement="top-start">
<font style="color:green;" @click="editPlan(subItem.DayObj)">
{{subItem.DayObj.UseName}}&nbsp;{{subItem.DayObj.InOutStr}}(外部车)</font>
</el-tooltip>
</template>
</font>
<el-tooltip class="item" effect="dark" content="点击删除" placement="top-start">
<i class="el-icon-delete" @click="deleteTrip(subItem.DayObj)" style="color:red;"></i>
</el-tooltip>
</td>
</template>
<template v-else>
<td>
<td :key="`d_`+index+`_n_`+subIndex">
</td>
</template>
</template>
......@@ -130,10 +149,41 @@
editTripPlan
},
methods: {
//机票导出
downLoadPlan() {
this.loading = true;
var fileName = this.msg.MonthStr + "用车计划下载.xls";
this.GetLocalFile("tripcar_post_DownLoadTripCar", this.msg, fileName,
res => {
this.loading = false;
});
},
//跳转到团队详情
gotoTeam(item) {
var path = "TravelControlList";
if (item.TeamType == 1) {
path = "TravelControlListSale";
} else if (item.TeamType == 2) {
path = "oneDayTrip";
} else if (item.TeamType == 4) {
path = "TravelTeam";
} else {
path = "TravelControlList";
}
this.$router.push({
name: path,
query: {
id: item.TCID,
tcmun: item.TCNUM,
blank: "y",
tab: "团控列表",
},
});
},
//删除用车
deleteTrip(item) {
var that = this;
var tipMsg = "是否删除【" + item.DMCNum + "】用车?"
var tipMsg = "是否删除【" + (item.PlanType == 1 ? item.DMCNum : item.UseName) + "】用车?";
this.Confirm(tipMsg, function () {
var delMsg = {
PlanId: item.PlanId
......@@ -172,7 +222,6 @@
this.headerList = [];
this.apipost('travel_post_GetTripCarPlanList', this.msg, res => {
this.loading = false;
console.log("travel_post_GetTripCarPlanList", res)
if (res.data.resultCode == 1) {
this.dataList = res.data.data;
if (this.dataList && this.dataList.length > 0) {
......
......@@ -5,11 +5,11 @@
<template>
<div class="editTripPlan">
<el-form :model="postMsg" ref="form" label-width="100px">
<el-row>
<el-row v-if="postMsg&&postMsg.PlanId==0">
<el-col :span="24">
<el-form-item label="用车类型">
<el-radio v-model="postMsg.PlanType" :label="1">内部用车</el-radio>
<el-radio v-model="postMsg.PlanType" :label="2">外部用车</el-radio>
<el-radio v-model="postMsg.PlanType" :label="1" @change="changePlanType">内部用车</el-radio>
<el-radio v-model="postMsg.PlanType" :label="2" @change="changePlanType">外部用车</el-radio>
</el-form-item>
</el-col>
</el-row>
......@@ -20,6 +20,8 @@
<el-select v-model="postMsg.TCID" filterable :placeholder="$t('pub.pleaseSel')" @change="getPriceTrip()">
<el-option :label="$t('pub.unlimitedSel')" :value="0"></el-option>
<el-option v-for="item in priceList" :label="item.TCNUM" :value="item.TCID" :key="item.TCID">
<span style="float: left">{{ item.TCNUM }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.DMCNum }}</span>
</el-option>
</el-select>
</el-form-item>
......@@ -32,13 +34,17 @@
</el-col>
<el-col :span="8">
<el-form-item label="开始日期">
<el-date-picker type="date" v-model="postMsg.StartDate" value-format="yyyy-MM-dd" placeholder>
<el-date-picker type="date" v-model="postMsg.StartDate" :disabled="postMsg.PlanType==1"
value-format="yyyy-MM-dd" placeholder style="width:205px;" @change="changeDate"
:picker-options="pickerBeginDateBefore">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="结束日期">
<el-date-picker type="date" v-model="postMsg.EndDate" value-format="yyyy-MM-dd" placeholder>
<el-date-picker type="date" v-model="postMsg.EndDate" :disabled="postMsg.PlanType==1"
value-format="yyyy-MM-dd" placeholder style="width:205px;" @change="changeDate"
:picker-options="pickerBeginDateAfter">
</el-date-picker>
</el-form-item>
</el-col>
......@@ -70,7 +76,6 @@
<el-form-item class="ImpressionTicketing-OuterFrame" label-width="0px">
<div>
<span class="ImpressionTicketing-title">用车详情</span>
<span class="el-icon-circle-plus-outline itc-outline" v-if="postMsg.PlanType==2"></span>
</div>
</el-form-item>
</el-col>
......@@ -96,17 +101,12 @@
<el-form-item label="用车备注" label-position="left">
<el-input v-model="item.DRemark"></el-input>
</el-form-item>
<template v-if="postMsg.PlanType==2">
<!-- <span @click="addRule()" class="el-icon-circle-plus-outline itc-outline"></span>
<span @click="deleteRule(item,index)" class="el-icon-delete itc-delete"></span> -->
</template>
</el-col>
</el-row>
</template>
<el-row type="flex" justify="center">
<el-button @click="closeForm()">{{$t('pub.closeSel')}}</el-button>&nbsp;
<el-button @click="saveTripPlan" type="primary" :loading="saveLoading">
<el-button @click="closeForm()" size="small">{{$t('pub.closeSel')}}</el-button>&nbsp;
<el-button @click="saveTripPlan" type="primary" size="small" :loading="saveLoading">
{{$t('pub.saveBtn')}}
</el-button>
</el-row>
......@@ -134,12 +134,29 @@
Remark: "", //备注
CarId: 0, //车Id,
InOutStr: "", //进出点
DetailsList: []
DetailsList: [],
UseName: "", //用车信息
},
priceList: [], //价格列表
carList: [], //车辆列表
userInfo: {},
saveLoading: false,
pickerBeginDateBefore: {
disabledDate: (time) => {
if (this.postMsg.EndDate) {
return time.getTime() >= new Date(this.postMsg.EndDate).getTime();
}
return false;
}
},
pickerBeginDateAfter: {
disabledDate: (time) => {
if (this.postMsg.StartDate) {
return time.getTime() < new Date(this.postMsg.StartDate).getTime() - 24 * 3600 * 1000;
}
return false;
},
},
};
},
created() {
......@@ -165,6 +182,62 @@
},
},
methods: {
changePlanType() {
this.postMsg.TCID = 0;
this.postMsg.StartDate = "";
this.postMsg.EndDate = "";
this.postMsg.Remark = "";
this.postMsg.CarId = 0;
this.postMsg.InOutStr = "";
this.postMsg.UseName = "";
this.postMsg.DetailsList = [];
},
getDaysBetweenDates(dateString1, dateString2) {
const date1 = new Date(dateString1);
const date2 = new Date(dateString2);
// 使用UTC时间去除时区影响
const utcDate1 = Date.UTC(date1.getFullYear(), date1.getMonth(), date1.getDate());
const utcDate2 = Date.UTC(date2.getFullYear(), date2.getMonth(), date2.getDate());
// 计算天数差
const timeDiff = Math.abs(utcDate2 - utcDate1);
const daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
return daysDiff;
},
changeDate() {
if (this.postMsg.PlanType == 2) {
if (this.postMsg.StartDate && this.postMsg.EndDate) {
var totalDays = this.getDaysBetweenDates(this.postMsg.StartDate, this.postMsg.EndDate);
totalDays = totalDays + 1;
var oldArray = [];
if (this.postMsg.DetailsList && this.postMsg.DetailsList.length > 0) {
oldArray = JSON.parse(JSON.stringify(this.postMsg.DetailsList));
}
this.postMsg.DetailsList = [];
for (var i = 1; i <= totalDays; i++) {
var dayObj = this.getDetailsObj();
dayObj.DayNum = i;
if (dayObj.DayNum == 1) {
dayObj.UseType = 1;
} else if (dayObj.DayNum == totalDays) {
dayObj.UseType = 2;
} else {
dayObj.UseType = 3;
}
var oldDayObj = null;
if (oldArray && oldArray.length > 0) {
oldDayObj = oldArray.find((item) => {
return item.DayNum === i;
})
}
if (oldDayObj) {
this.postMsg.DetailsList.push(oldDayObj);
} else {
this.postMsg.DetailsList.push(dayObj);
}
}
}
}
},
//获取车辆列表
getCarList() {
this.apipost("travel_post_GetJapanCarList", {}, res => {
......@@ -192,7 +265,6 @@
PlanId: this.editMsg.Q_PlanId
};
this.apipost('travel_post_GetTripCarPlan', pMsg, res => {
console.log("travel_post_GetTripCarPlan", res);
if (res.data.resultCode == 1) {
var tempData = res.data.data;
if (tempData) {
......@@ -204,6 +276,7 @@
this.postMsg.StartDate = tempData.StartDate;
this.postMsg.EndDate = tempData.EndDate;
this.postMsg.InOutStr = tempData.InOutStr;
this.postMsg.UseName = tempData.UseName;
if (tempData.DetailsList && tempData.DetailsList.length > 0) {
this.postMsg.DetailsList = tempData.DetailsList;
}
......
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