Commit d0fbae57 authored by liudong1993's avatar liudong1993
parents 26fd8dc1 711f075a
<style scoped>
.tripPlanTab {
border-collapse: collapse;
}
.tripPlanTab tr th,
.tripPlanTab tr td {
border: 1px solid gray;
text-align: center;
padding-left: 1px;
padding-right: 1px;
}
.tripPlanTab tr th {
min-width: 55px;
height: 29px;
}
.tripPlanTab tr td {
height: 28px;
line-height: 28px;
}
</style>
<template>
<div>
<div class="query-box" style="border-bottom: none;">
<ul>
<li><span><em>{{$t('pub.date')}}</em>
<el-date-picker v-model="msg.MonthStr" type="month" placeholder="选择月" format="yyyy-MM" @change="getList()"
value-format="yyyy-MM">
</el-date-picker>
</span>
</li>
<li>
<input type="button" class="normalBtn" :value="$t('pub.searchBtn')" @click="getList()" />
<button class="hollowFixedBtn" @click="editPlan(null)">{{$t('pub.addBtn')}}</button>
</li>
</ul>
</div>
<div style="width:100%;overflow-x:auto;padding-bottom:10px;margin-top:10px;min-height:100px;"
class="ownScrollbarStyle" v-loading="loading">
<table class="tripPlanTab" v-if="dataList&&dataList.length>0">
<thead>
<tr>
<th>
{{msg.MonthStr}}
</th>
<template v-if="headerList&&headerList.length>0">
<template v-for="(hItem,hIndex) in headerList">
<th :key="`h_`+hIndex">
{{hItem.DayStr}}
<span style="display: block;">{{hItem.WeekStr}}</span>
</th>
</template>
</template>
</tr>
</thead>
<tbody v-for="(item,index) in dataList" :key="`d_`+index">
<tr>
<td rowspan="2">
{{item.CarName}}({{item.CarSeatNum}}座)<br />
{{item.CarNo}}
</td>
<template v-for="(subItem,subIndex) in item.SubList">
<td>
<template v-if="subItem.DayObj">
<template v-if="subItem.DayObj.UseType==1">
<font>接机</font>
</template>
<template v-if="subItem.DayObj.UseType==2">
<font>送机</font>
</template>
<template v-if="subItem.DayObj.UseType==3">
<font>全天</font>
</template>
<template v-if="subItem.DayObj.UseType==4">
<font>X</font>
</template>
</template>
</td>
</template>
</tr>
<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>
</template>
<template v-else>
<td>
</td>
</template>
</template>
</tr>
</tbody>
</table>
</div>
<el-dialog class="app-attachment-dialog" width="1000" :title="dialogTitle" :visible.sync="isShowEditPlanDialog"
:close-on-click-modal="false">
<editTripPlan v-if="isShowEditPlanDialog" :editMsg="editMsg" @success="getList"></editTripPlan>
</el-dialog>
</div>
</template>
<script>
import editTripPlan from "./editTripPlan"; //新增修改团队用车
export default {
data() {
return {
loading: false,
msg: {
MonthStr: "",
},
headerList: [], //表头
dataList: [],
Q_PlanId: 0,
editMsg: {
MonthStr: "",
Q_PlanId: 0,
},
isShowEditPlanDialog: false, //是否显示新增修改
dialogTitle: "",
}
},
components: {
editTripPlan
},
methods: {
//删除用车
deleteTrip(item) {
var that = this;
var tipMsg = "是否删除【" + item.DMCNum + "】用车?"
this.Confirm(tipMsg, function () {
var delMsg = {
PlanId: item.PlanId
};
that.apipost(
"travel_post_DeleteTripCar",
delMsg,
res => {
if (res.data.resultCode == 1) {
that.Success(that.$t('tips.shanchuchenggong'));
that.getList();
} else {
that.Error(res.data.data);
}
},
null
);
});
},
//新增团队行程用车
editPlan(item) {
this.editMsg.MonthStr = this.msg.MonthStr;
if (item) {
this.dialogTitle = "修改";
this.editMsg.Q_PlanId = item.PlanId;
} else {
this.dialogTitle = "新增";
this.editMsg.Q_PlanId = 0;
}
this.isShowEditPlanDialog = true;
},
getList() {
this.loading = true;
this.isShowEditPlanDialog = false;
this.dataList = [];
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) {
this.headerList = this.dataList[0].SubList;
}
} else {
this.Error(res.data.message);
}
})
},
},
mounted() {
let myDate = new Date();
let yearStr = myDate.getFullYear();
let monthStr = parseInt(myDate.getMonth() + 1);
this.msg.MonthStr = yearStr + "-" + (monthStr < 10 ? '0' + monthStr : monthStr);
this.getList();
},
}
</script>
<style scoped>
</style>
<template>
<div class="editTripPlan">
<el-form :model="postMsg" ref="form" label-width="100px">
<el-row>
<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-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<template v-if="postMsg.PlanType==1">
<el-form-item label="选择团号">
<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">
</el-option>
</el-select>
</el-form-item>
</template>
<template v-else>
<el-form-item label="用车信息">
<el-input v-model="postMsg.UseName"></el-input>
</el-form-item>
</template>
</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>
</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>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="车牌号">
<el-select v-model="postMsg.CarId" filterable :placeholder="$t('pub.pleaseSel')">
<el-option :label="$t('pub.unlimitedSel')" :value="0"></el-option>
<el-option v-for="item in carList" :label="item.CarName+`(`+item.CarNo+`)`" :value="item.Id"
:key="item.Id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="进出点">
<el-input v-model="postMsg.InOutStr"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注">
<el-input v-model="postMsg.Remark"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<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>
</el-row>
<template v-for="(item,index) in postMsg.DetailsList">
<el-row :key="index">
<el-col :span="4">
<el-form-item label="" label-position="left">
{{item.DayNum}}
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="用车类型" label-width="100px" label-position="left">
<el-select v-model="item.UseType" filterable :placeholder="$t('pub.pleaseSel')">
<el-option label="接机" :value="1"></el-option>
<el-option label="送机" :value="2"></el-option>
<el-option label="全天" :value="3"></el-option>
<el-option label="不用车" :value="4"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<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">
{{$t('pub.saveBtn')}}
</el-button>
</el-row>
<el-row>
<el-col :span="24">
&nbsp;
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
export default {
props: ["editMsg"],
components: {},
data() {
return {
loading: false,
postMsg: {
PlanId: 0, //计划Id
TCID: 0, //团队编号
PlanType: 1, //用车类型(1-内部用车,2-外部用车)
StartDate: "", //用车开始时间
EndDate: "", //用车结束时间
Remark: "", //备注
CarId: 0, //车Id,
InOutStr: "", //进出点
DetailsList: []
},
priceList: [], //价格列表
carList: [], //车辆列表
userInfo: {},
saveLoading: false,
};
},
created() {
this.userInfo = this.getLocalStorage();
this.getCarList();
},
mounted() {
if (this.editMsg) {
if (this.editMsg.MonthStr) {
this.getPriceList();
}
if (this.editMsg.Q_PlanId) {
this.getPlanInfo();
}
}
},
watch: {
editMsg: {
handler(val, oldVal) {
this.getPriceList();
this.getPlanInfo();
},
},
},
methods: {
//获取车辆列表
getCarList() {
this.apipost("travel_post_GetJapanCarList", {}, res => {
if (res.data.resultCode == 1) {
this.carList = res.data.data;
}
});
},
//获取月份下的团队列表
getPriceList() {
var pMsg = {
MonthStr: this.editMsg.MonthStr
}
this.apipost('travel_post_GetTravelPriceListByMonth', pMsg, res => {
if (res.data.resultCode == 1) {
this.priceList = res.data.data;
} else {
this.Error(res.data.message);
}
})
},
//获取计划详情
getPlanInfo() {
var pMsg = {
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) {
this.postMsg.PlanId = tempData.PlanId;
this.postMsg.TCID = tempData.TCID;
this.postMsg.PlanType = tempData.PlanType;
this.postMsg.Remark = tempData.Remark;
this.postMsg.CarId = tempData.CarId;
this.postMsg.StartDate = tempData.StartDate;
this.postMsg.EndDate = tempData.EndDate;
this.postMsg.InOutStr = tempData.InOutStr;
if (tempData.DetailsList && tempData.DetailsList.length > 0) {
this.postMsg.DetailsList = tempData.DetailsList;
}
}
} else {
this.Error(res.data.message);
}
})
},
getDetailsObj() {
var dObj = {
DetailId: 0, //详情Id
PlanId: 0, //主表计划Id
DayNum: 0, //第几天
UseType: 1, //用车类型(1-接机,2-送机,3-全天,4-不用车)
DRemark: "", //用车备注
}
return dObj;
},
//切换团号
getPriceTrip() {
if (this.postMsg.TCID > 0) {
var priceMsg = {
TCID: this.postMsg.TCID
};
this.apipost("travel_post_GetPriceTripPlan", priceMsg, res => {
if (res.data.resultCode == 1) {
var tempData = res.data.data;
if (tempData) {
this.postMsg.StartDate = tempData.StartDate;
this.postMsg.EndDate = tempData.EndDate;
this.postMsg.InOutStr = tempData.InOutStr;
if (tempData.DetailsList && tempData.DetailsList.length > 0) {
this.postMsg.DetailsList = tempData.DetailsList;
}
}
}
})
}
},
closeForm() {
//关闭弹窗并刷新页面
this.$emit("success");
},
//保存
saveTripPlan() {
this.saveLoading = true;
this.apipost('travel_post_SetTripCarPlan', this.postMsg, res => {
this.saveLoading = false;
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.$emit("success");
} else {
this.Error(res.data.message);
}
})
}
},
};
</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