Commit 9075ffb6 authored by lixy's avatar lixy

营地管理--车辆保养弹框抽出

parent 8f88fe2d
......@@ -9,6 +9,16 @@ export function campsiteTagList(query) {
params: query
});
}
/**
* 获取营地全部标签
* */
export function campsiteAllTagList(query) {
return fetch({
url: '/api/campsite/admin/campsiteTag/all',
method: 'get',
params: query
});
}
/**
* 是否是筛选条件
* */
......@@ -65,6 +75,57 @@ export function getCampsiteList(query) {
return fetch({
url: '/api/campsite/admin/campsiteShop/pages',
method: 'post',
data: query
});
}
/**
* 删除营地列表数据
*/
export function delCampsiteShop(id) {
return fetch({
url: '/api/campsite/admin/campsiteShop/' + id,
method: 'delete'
});
}
/**
* 根据id获取一条营地列表数据
*/
export function getOneCampsiteShop(id) {
return fetch({
url: '/api/campsite/admin/campsiteShop/campsite/' + id,
method: 'get'
});
}
/**
* 编辑营地数据
* */
export function editCampsiteShop(query) {
return fetch({
url: '/api/campsite/admin/campsiteShop/save',
method: 'post',
data: query
});
}
/**
* 创建营地
* */
export function addCampsiteShop(params) {
return fetch({
url: '/api/campsite/admin/campsiteShop/save',
method: 'post',
data: params
});
}
/**
* 判断营地名称是否已存在
* @param id
*/
export function existCampsiteShop(query) {
return fetch({
url: '/api/campsite/admin/campsiteShop/exist',
method: 'get',
params: query
});
}
......
......@@ -35,3 +35,9 @@ export function convertDate2Str(object) {
}
}
}
export function timestamp2Date(timestamp) {
let date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
}
......@@ -172,10 +172,47 @@
},
},
methods: {
/**
* 保存时判断标签名称是否已存在
* */
isExistTagName(type, formName){
if(!this.form.name){
return;
}
let params = {
name: this.form.name
};
if(type == 'update'){//编辑
params.id = this.form.id;
}
existTag(params).then(response => {
if (response.status === 200) {
this.isExist = response.data;
if(response.data){
this.isCreate = false;
}
if(!response.data && type == "update"){//编辑
this.toUpdate(formName);
}
if(!response.data && type == "create"){
//创建
this.toCreate(formName);
}
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 判断标签名是否已存在
* */
isExistTag(){
this.form.name = (this.form.name).trim();
if(!this.form.name){
return;
}
......@@ -188,14 +225,6 @@
existTag(params).then(response => {
if (response.status === 200) {
this.isExist = response.data;
// if(response.data){
// this.$notify({
// title: '失败',
// message: '标签已存在',
// type: 'error',
// duration: 2000
// });
// }
} else {
this.$notify({
title: '失败',
......@@ -226,9 +255,9 @@
this.showLoadingBody = false;
},
/**
* 新建标签
* 创建营地类型
* */
create(formName){
toCreate(formName){
const set = this.$refs;
set[formName].validate(valid => {
if (valid && !this.isExist) {
......@@ -258,6 +287,13 @@
}
});
},
/**
* 新建标签
* */
create(formName){
this.isCreate = true;//点击了确定按钮-按钮不可用
this.isExistTagName("create", formName);
},
/**
* 删除
* */
......@@ -282,9 +318,9 @@
});
},
/**
* 编辑-更新
* 编辑营地类别
* */
update(formName) {
toUpdate(formName){
const set = this.$refs;
set[formName].validate(valid => {
if (valid && !this.isExist) {
......@@ -314,6 +350,13 @@
}
});
},
/**
* 编辑-更新
* */
update(formName) {
this.isCreate = true;//点击了确定按钮-按钮不可用
this.isExistTagName("update", formName);
},
/**
* 深拷贝
*/
......
<template>
<div class="app-container calendar-list-container" v-loading.body="showLoadingBody">
<div v-if="!oneCampsiteDialogVisible">
<div class="filter-container" ref="filter-container">
<el-form ref="queryForm" :inline="inline" :model="listQuery" label-width="100px">
<el-row>
<el-col :span="8">
<el-form-item label="名称">
<el-input v-model.number="listQuery.name" placeholder="请输入名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="时间">
<el-date-picker
v-model="listQuery.startTime"
type="date"
clearable
placeholder="选择日期">
</el-date-picker>~
<el-date-picker
v-model="listQuery.endTime"
type="date"
clearable
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button>
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate"
type="primary" icon="edit">添加
</el-button>
</div>
<el-table :key='tableKey' :data="list" border fit highlight-current-row
style="width: 1367px;">
<el-table-column
type="index"
align="center" label="序号" width="65">
</el-table-column>
<el-table-column width="200" align="center" label="名称">
<template scope="scope">
<img :src="scope.row.cover" style="width: 30px;"/>
<span>{{scope.row.name}}</span>
</template>
</el-table-column>
<el-table-column width="300" align="center" label="类型">
<template scope="scope">
<span>{{scope.row.storeTypeName}}</span>
</template>
</el-table-column>
<el-table-column width="200" align="center" label="热度">
<template scope="scope">
<span>{{scope.row.hot}}</span>
</template>
</el-table-column>
<el-table-column width="300" align="center" label="创建时间">
<template scope="scope">
<span>{{scope.row.crtTimeStr}}</span>
</template>
</el-table-column>
<el-table-column align="center" width="300" label="操作">
<template scope="scope">
<el-button size="small" type="success" @click="handleUpdate(scope.row)">编辑
</el-button>
<el-button size="small" type="primary" v-if="scope.row.status==2|| scope.row.status==0" @click="upStatus(scope.row)">上架
</el-button>
<el-button size="small" type="warn" v-if="scope.row.status==1" @click="upStatus(scope.row)">下架
</el-button>
<el-popover
ref="popover5"
placement="top"
width="160"
v-model="scope.row.visible2">
<p>确定删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.visible2 = false">取消</el-button>
<el-button type="primary" size="mini" @click="deleteHandler(scope.row)">确定</el-button>
</div>
</el-popover>
<el-button type="danger" size="small" v-popover:popover5>删除</el-button>
</template>
</el-table-column>
</el-table>
<div v-show="!listLoading" class="pagination-container">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page.sync="listQuery.page" :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit"
layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
</div>
</div>
<!-- 营地modal弹窗 -->
<oneCampsite v-if="oneCampsiteDialogVisible" :oneRow="oneRow" :title="modalTitle" v-on:oneCampsiteDialogEvent = "oneCampsiteDialogEvent"></oneCampsite>
</div>
</template>
<script>
import oneCampsite from './modal/oneCampsiteModal'// 营地
import 'static/css/uploadImg.css';// 引入图片上传组件对话框
import {
formatDate
} from 'utils/dateFormattor';
import {
toEast8Date,
deepCopyDate,
newEast8Date,
convertDate2Str,
timestamp2Date
} from 'utils/dateUtils';
import rsCode from '../../utils/rsCode';
import {mapGetters} from 'vuex';
import {
getToken
} from 'utils/auth';
import {
getCampsiteList,
delCampsiteShop
} from 'api/campsiteManage';
import Element1 from "../admin/menu/components/element";
import ElRow from "element-ui/packages/row/src/row";
import ElCol from "element-ui/packages/col/src/col";
export default {
name: 'tourManage',
components: {
ElCol,
ElRow,
Element1,
oneCampsite
},
data() {
return {
modalTitle: "创建",
BASE_API: process.env.BASE_API,
oneCampsiteDialogVisible: false,//添加、编辑弹框
showLoadingBody: false,
form: {
tagNames:"",//标签
name: undefined,//旅游名称
saleCount: undefined,//销量
stock: undefined,//总数量
},
list: null,
total: null,
listLoading: true,
listQuery: {
page: 1,
limit: 20,
startTime: undefined,
endTime:undefined,
name: '',//关键词
},
inline: true,
textMap: {
update: '编辑',
create: '创建'
},
tableKey: 0
}
},
created() {
this.getList();
},
computed: {
...mapGetters([
'elements'
])
},
methods: {
/**
* 添加
* */
handleCreate() {
this.resetTemp();
this.oneRow = {};
this.modalTitle = '创建';
this.oneCampsiteDialogVisible = true;
},
/**
* 操作-删除
* */
deleteHandler(row) {
delCampsiteShop(row.id).then(response => {
if (response.status === 200) {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
});
this.oneCampsiteDialogVisible = false;
this.getList();
} else {
this.$notify({
title: '删除失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 上架、下架 参数 id status 1-上架;2-下架 post
*/
upStatus(row){
let params = {
id: row.id,
status: row.status==1?2:1
};
upStatusChange(params).then(response => {
if (response.status === 200) {
this.$notify({
title: '成功',
message: '成功',
type: 'success',
duration: 2000
});
this.oneCampsiteDialogVisible = false;
this.getList();
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 编辑
* */
handleUpdate(row) {
this.modalTitle = '编辑';
this.oneRow = row;
this.oneCampsiteDialogVisible = true;
},
/**
* 下架
* */
undercarriageHandler(row) {
// open dialog
this.departureDialogVisible = true;
this.clearDepartureForm();
let that = this;
let selectArry = [];
this.allCompaniesArr.map(function(item){
item.value = item.name;
selectArry.push(item);
});
this.departureForm.mileage = row.mileage;
this.departureForm.expectArrivalBranchCompanyId = row.subordinateBranch;
this.departureForm.departureBranchCompanyId = row.subordinateBranch;
selectArry.map(function (iitem) {
if( row.subordinateBranch == iitem.id){
that.departureForm.departureBranchCompanyName = iitem.name;
that.departureForm.expectArrivalBranchCompanyName = iitem.name;
}
});
this.departureForm.vehicleId = row.id;
this.departureForm.numberPlate = row.numberPlate;
this.departureForm.departureDate = Date();
},
/**
* 旅游modal传递回来的数据
* */
oneCampsiteDialogEvent(e){
this.oneCampsiteDialogVisible = false;
if(!e){//关闭编辑
this.oneCampsiteDialogVisible = e;
} else if(e){
//编辑成功-重新加载列表
this.getList();
}
},
/**
* 获取旅游列表
* */
getList() {
this.listLoading = true;
if(this.listQuery.startTime){
this.listQuery.startTime = this.listQuery.startTime.getTime();
}
if(this.listQuery.endTime){
this.listQuery.endTime = this.listQuery.endTime.getTime();
}
getCampsiteList(this.listQuery).then(response => {
let totalCountRs = undefined;
let listRs = undefined;
if (!this.$utils.isEmpty(response.data.data) && this.$utils.isInteger(response.data.totalCount)) {
listRs = response.data.data;
totalCountRs = response.data.totalCount;
listRs.map(function(item){
item.visible2 = false;
item.crtTimeStr = timestamp2Date(item.crtTime);
if(item.storeTypeName){
item.storeTypeName = item.storeTypeName.join("|");
}
});
}
this.listLoading = false;
this.list = listRs;
this.total = totalCountRs;
})
},
getAddrStr(branchCompany) {
let regions = getRegionByCodes([branchCompany.addrProvince, branchCompany.addrCity, branchCompany.addrTown]);
return regions[0].name + ' ' + regions[1].name + ' ' + regions[2].name + ' ';
},
handleFilter() {
this.listQuery.page = 1;
this.$refs.queryForm.validate(valid => {
if (valid) {
this.getList();
} else {
return false;
}
});
},
handleSizeChange(val) {
this.listQuery.limit = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.page = val;
this.getList();
},
/**
* 操作-申请预定
* */
handleApply(row) {
this.resetTemp4Apply();
let that = this;
let selectArry = [];
this.allCompaniesArr.map(function(item){
item.value = item.name;
selectArry.push(item);
});
this.form4Apply.liftCompany = row.subordinateBranch;
selectArry.map(function (iitem) {
if( row.subordinateBranch == iitem.id){
that.form4Apply.state3 = iitem.name;
}
});
this.form4Apply.vehicle = row.id;
getBookedInfoIn2Month(row.id)
.then(response => {
this.curBookedInfo3Month = response.data;
this.dialogStatus = 'apply';
this.dialogForm4ApplyVisible = true;
});
},
handleBookInfo(row) {
this.$refs.bookInfoViewer.handleBookInfo(row.id);
},
create(formName) {
const set = this.$refs;
if(!this.form.state2 || this.form.state2 == "全部"){
this.form.subordinateBranch = undefined;
this.$notify({
title: '失败',
message: '请选择分公司',
type: 'warning',
duration: 2000
});
return;
}
set[formName].validate(valid => {
if (valid) {
let formTemp = this.fillDateRange2Object(this.form, 'insuranceDateRange4form', 'insuranceStartDate', 'insuranceEndDate');
convertDate2Str(formTemp);
addObj(formTemp)
.then(response => {
if (response.code === rsCode.RS_CODE_SUC) {
this.dialogFormVisible = false;
this.getList();
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
});
this.getList();
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
} else {
return false;
}
});
},
cancel(formName) {
this.dialogFormVisible = false;
this.dialogForm4ApplyVisible = false;
this.$refs[formName].resetFields();
},
cancel4Apply(formName) {
this.dialogForm4ApplyVisible = false;
this.$refs[formName].resetFields();
},
update(formName) {
const set = this.$refs;
if(!this.form.state2 || this.form.state2 == "全部"){
this.form.subordinateBranch = undefined;
this.$notify({
title: '失败',
message: '请选择分公司',
type: 'warning',
duration: 2000
});
return;
}
set[formName].validate(valid => {
if (valid) {
let formTemp = this.fillDateRange2Object(this.form, 'insuranceDateRange4form', 'insuranceStartDate', 'insuranceEndDate');
convertDate2Str(formTemp);
putObj(formTemp).then(response => {
if (response.code === rsCode.RS_CODE_SUC) {
this.dialogFormVisible = false;
this.getList();
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
});
this.getList();
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
} else {
return false;
}
});
},
/**
* 申请预定-确定
* @param formName
*/
apply(formName) {
if(!this.form4Apply.state3 || this.form4Apply.state3 == "全部"){
this.form4Apply.liftCompany = undefined;
this.$notify({
title: '失败',
message: '请选择提车分公司',
type: 'warning',
duration: 2000
});
return;
}
if(!this.form4Apply.state4 || this.form4Apply.state4 == "全部"){
this.form4Apply.retCompany = undefined;
this.$notify({
title: '失败',
message: '请选择还车分公司',
type: 'warning',
duration: 2000
});
return;
}
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
this.dialogFormVisible = false;
book(this.form4Apply).then(() => {
this.dialogForm4ApplyVisible = false;
this.getList();
this.$notify({
title: '成功',
message: '预定成功',
type: 'success',
duration: 2000
});
});
} else {
return false;
}
});
},
resetTemp() {
this.form = {
tagNames:"",//标签
name: undefined,//旅游名称
saleCount: undefined,//销量
stock: undefined,//总数量
};
},
resetTemp4Apply() {
this.form4Apply = {
bookStartDate: undefined,
bookEndDate: undefined,
state3: '',
state4:'',
retCompany: undefined,
vehicle: undefined,
selectedAccItem: undefined,
liftCompany: undefined,
liftAddr: undefined,
destination: undefined,
remark: undefined
};
},
resetTemp4BookInfo() {
this.form4BookInfo = {
selectedMonth: this.$utils.toDateString(newEast8Date(), 'yyyy-MM'),
vehicle: undefined
};
}
}
}
</script>
<template>
<el-dialog :title="form.showTitle" :visible.sync="isVisible">
<el-form :model="form" :rules="rules" ref="form" label-width="120px">
<el-row>
<el-col :span="8">
<el-form-item label="省份">
<el-select class="filter-item" v-model="listQuery.addrProvince" placeholder="请选择省份(直辖市)" @change='getValue'>
<el-option v-for="item in provinceRegions" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="城市">
<el-select class="filter-item" v-model="listQuery.addrCity" placeholder="请选择城市">
<el-option v-for="item in cityRegions4Query" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="详细地址" prop="address">
<el-input v-model="form.address" placeholder="请输入详细地址"></el-input>
</el-form-item>
<el-row>
<el-col :span="8">
<el-form-item label="经度">
<el-input :value="form.latitude" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="纬度">
<el-input :value="form.longitude" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="拾取经纬度">
<el-input v-model="keyword" placeholder="请输入详细地址获取经纬度"></el-input>
</el-form-item>
<el-form-item v-if="1>2">
<baidu-map class="map" id="mapID" center="东莞市" :zoom="zoom" :scroll-wheel-zoom="true" @click="getPoint" @ready="handler">
<!--地图类型,两种:一种是路线一种是绿的那种-->
<bm-map-type :map-types="['BMAP_NORMAL_MAP', 'BMAP_HYBRID_MAP']" anchor="BMAP_ANCHOR_TOP_LEFT"></bm-map-type>
<!--地图搜索功能,绑定上面的input,-->
<!--display: none样式很关键,因为下面默认会有地址提示信息很长,很烦,这样搜索会很舒服,-->
<!--zoom是搜索结果的视图比例,个人觉得12.8很舒服显示-->
<bm-local-search :keyword="keyword" :auto-viewport="true" :location="location" zoom="12.8" style="display: none"></bm-local-search>
<bm-navigation anchor="BMAP_ANCHOR_TOP_RIGHT"></bm-navigation>
<!--信息窗口,show属性是控制显示隐藏,infoWindowClose和infoWindowOpen是控制信息窗口关闭隐藏的方法-->
<bm-marker :position="postionMap" >
<bm-info-window :show="show" class="bm-info" @close="infoWindowClose" @open="infoWindowOpen" style="font-size: 14px">
<!--<p>站点地址:{{ add.site }}</p>-->
</bm-info-window>
</bm-marker>
</baidu-map>
</el-form-item>
<el-form-item>
<!--:center="center"-->
<baidu-map
:zoom="zoom"
:dragging="true"
:scroll-wheel-zoom="true"
class="map"
@ready="handler"
@click="getPoint"
>
<bm-local-search
:keyword="keyword"
:auto-viewport="true"
:location="location"
style="display: none"
></bm-local-search>
<bm-navigation anchor="BMAP_ANCHOR_TOP_RIGHT"></bm-navigation>
<bm-geolocation
anchor="BMAP_ANCHOR_BOTTOM_RIGHT"
:showAddressBar="true"
:autoLocation="true"
></bm-geolocation>
<bm-marker :position="{lng:form.longitude, lat: form.latitude}"></bm-marker>
</baidu-map>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-popover
ref="popover5"
placement="top"
width="160"
v-model="visible2">
<p>确定删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="visible2 = false">取消</el-button>
<el-button type="primary" size="mini" @click="deleteHandler()">确定</el-button>
</div>
</el-popover>
<el-button v-if="form.showTitle == '途径地编辑'" type="danger" v-popover:popover5>删除</el-button>
<el-button type="primary" @click="okHandler('form')">确 定</el-button>
</div>
</el-dialog>
</template>
<script>
import BaiduMap from 'vue-baidu-map';
import {
getSonRegionByCodes,
getRegionByCodes,
} from 'api/base_info/region/';
import rsCode from '../../../utils/rsCode';
import {mapGetters} from 'vuex';
import {
getAllCompany,
getAll
} from 'api/base_info/branch_company/';
import ElRow from "element-ui/packages/row/src/row";
import ElInput from "../../../../node_modules/element-ui/packages/input/src/input.vue";
import ElCol from "element-ui/packages/col/src/col";
import ElFormItem from "../../../../node_modules/element-ui/packages/form/src/form-item.vue";
export default {
props: ["obj"],
name: 'destinationDialog',
components: {
ElFormItem,
ElCol,
ElInput,
ElRow
},
data() {
return {
jgNameDialog: false,
show: false,
postionMap:{ //地图坐标
lng: 120.211486,
lat: 30.256576
},
visible2: false,//是否显示删除确认框
location: '',
keyword: '', //搜索框关键词
zoom: 12.8, //放大比例
address:'', //位置详细信息
add:{
siteName:'',
site:'',
jd:'',
wd:'',
desce:'',
type:'',
jgName:'',
jgNum:'',
},
organizationData:[],
jgName:'',
jgNum:'',
form: {
showTitle: "",//弹框名称
name: undefined,//地址名称
keyword:"",//根据关键词查找经纬度
address:undefined,//详细地址
longitude: undefined,
latitude:undefined,
eventName: undefined
},
listQuery: {
addrProvince: undefined,
addrCity: undefined,
},
rules: {
name: [
{
type: 'string',
required: true,
message: '请输入名称',
trigger: 'blur'
},
{
min: 0,
max: 2000,
message: '长度小于 2000 个字符',
trigger: 'blur'
}
],
address: [
{
type: 'string',
required: true,
message: '请输入详细地址',
trigger: 'blur'
},
{
min: 0,
max: 2000,
message: '长度小于 2000 个字符',
trigger: 'blur'
}
],
longitude:{
type: 'string',
required: true,
message: '请输入经纬度',
trigger: 'blur'
},
latitude:{
type: 'string',
required: true,
message: '请输入经纬度',
trigger: 'blur'
},
addrProvince:{
required: true,
message: '请选择省份',
trigger: 'blur'
},
addrCity:{
required: true,
message: '请选择城市',
trigger: 'blur'
},
},
allCompanies: {},
allCompaniesArr: [],
isVisible: false,
allUpkeepItems: null,
dialogStatus: undefined,
baidumapSwitch:false,
zoom: 16,
location: "深圳市",
}
},
created() {
},
watch: {
isVisible(newValue, oldValue){
if(!newValue){
this.$emit(this.form.eventName, false);
this.cleanForm();
}
},
},
mounted() {
let that = this;
let row = this.obj;
this.cleanForm();
this.form = this.obj;
this.listQuery.addrProvince = this.obj.province;
this.listQuery.addrCity = this.obj.city;
this.keyword = row.keyword?row.keyword:"东莞市";
this.isVisible = true;
},
computed: {
...mapGetters([
'elements',
]),
provinceRegions() {
return getSonRegionByCodes(1);
},
cityRegions4Query() {
if (!this.$utils.isInteger(this.listQuery.addrProvince)) {
return null;
}
return getSonRegionByCodes(this.listQuery.addrProvince);
},
},
methods: {
/**
* 删除
* */
deleteHandler(formName) {
// 删除
this.form.method = 'delete';
this.$emit(this.form.eventName, this.form);
},
querySearch(queryString, cb) {
let selectArry = [];
this.allCompaniesArr.map(function(item){
item.value = item.name;
selectArry.push(item);
});
this.selectArry = selectArry;
var results = queryString ? selectArry.filter(this.createFilter(queryString)) : selectArry;
// 调用 callback 返回建议列表的数据
cb(results);
},
handleSelect(item) {
this.upkeepForm.branchCompanyId = item.id;
console.log(item);
},
createFilter(queryString) {
return (restaurant) => {
return (restaurant.name.indexOf(queryString.toLowerCase()) != -1);
};
},
getTypeName: function(type) {
if (this.$utils.isEmpty(this.vehicleWarningMsgType[type])) {
return '未知';
}
return this.vehicleWarningMsgType[type].val;
},
getValue(e){
this.listQuery.addrCity = undefined;
},
/**
* 确定
* */
okHandler(formName) {
const set = this.$refs;
if(!this.listQuery.addrProvince){
this.$notify({
title: '请选择省份',
message: '操作失败!',
type: 'error',
duration: 2000
});
return;
}
if(!this.listQuery.addrCity){
this.$notify({
title: '请选择城市',
message:'操作失败!',
type: 'error',
duration: 2000
});
return;
}
this.form.province = this.listQuery.addrProvince;
this.form.city = this.listQuery.addrCity;
set[formName].validate(valid => {
if (valid) {
this.$emit(this.form.eventName, this.form);
} else {
return;
}
});
},
/**
* 加载地图
* */
handler({map}){
},
//点击获取到当前经纬度
getClickInfo(e) {
console.log(e.point.lng);
console.log(e.point.lat);
this.form.longitude = e.point.lng;
this.form.latitude = e.point.lat;
},
//双向绑定经纬度以及缩放尺寸
syncCenterAndZoom(e) {
const { lng, lat } = e.target.getCenter();
this.form.longitude = lng;
this.form.latitude = lat;
// this.zoom = e.target.getZoom();
},
//经纬度同步
baidumap(){
this.baiduDevicelocationx = this.form.longitude
this.baiduDevicelocationy = this.form.latitude
},
/**
* 弹框-取消
* */
cancel() {
this.$emit(this.form.eventName, false);
this.cleanForm();
},
/**
* 清空弹框数据
*/
cleanForm() {
this.form = {
showTitle: "",//弹框名称
name: undefined,//地址名称
keyword:"",//根据关键词查找经纬度
address:undefined,//详细地址
longitude: undefined,
latitude:undefined,
eventName: undefined
};
this.listQuery = {
addrProvince: undefined,
addrCity: undefined,
}
},
getPoint(e){ //点击地图获取一些信息,
this.show = true;
this.postionMap.lng = e.point.lng; //通过 e.point.lng获取经度
this.postionMap.lat = e.point.lat; //通过 e.point.lat获取纬度
this.add.jd = e.point.lng;
this.add.wd = e.point.lat;
this.zoom = e.target.getZoom();
let geocoder= new BMap.Geocoder(); //创建地址解析器的实例
geocoder.getLocation(e.point,rs=>{
this.add.site = rs.address;
this.keyword = rs.address;
this.form.latitude = rs.point.lat;
this.form.longitude = rs.point.lng;
//地址描述(string)=
// console.log(rs.address); //这里打印可以看到里面的详细地址信息,可以根据需求选择想要的
// console.log(rs.addressComponents);//结构化的地址描述(object)
console.log(rs.addressComponents.province); //省
console.log(rs.addressComponents.city); //城市
console.log(rs.addressComponents.district); //区县
console.log(rs.addressComponents.street); //街道
console.log(rs.addressComponents.streetNumber); //门牌号
// console.log(rs.surroundingPois); //附近的POI点(array)
// console.log(rs.business); //商圈字段,代表此点所属的商圈(string)
});
},
infoWindowClose () {
this.show = false
},
infoWindowOpen () {
//这里有个问题纠结了很久,百度的信息窗口默认有个点击其他地方就消失的事件,我没有找到
//并且信息窗口点击一次显示,一次消失
//于是我加了一个100毫秒的定时器,保证每次点击地图都可以展示信息窗口
setInterval(()=>{
this.show = true
},100)
},
}
}
</script>
<style scoped>
.map {
width: 100%;
height: 500px;
}
.bm-info input[type="button"]{
width: 30px;
}
</style>
<template>
<!-- 营地:创建、编辑 -->
<div>
<h4>{{title}}</h4>
<el-form :model="form" :rules="rules" ref="form" label-width="90px">
<el-row>
<el-col :span="8">
<el-form-item label="营地名称">
<el-input v-model="form.name" placeholder="请输入营地名称" @blur="checkName()"></el-input><span v-if="isExist" style="color:red;">标签名已存在</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="营地地址">
<el-input v-model="form.addressStr" readonly placeholder="请输入营地地址" :on-icon-click="selectDestination" icon="edit"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="客服电话">
<el-input v-model="form.servicePhone" placeholder="请输入客服电话"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="联系人">
<el-input v-model="form.concat" placeholder="请输入联系人"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="联系电话">
<el-input v-model="form.phone" placeholder="请输入联系电话"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="营地类型" prop="approvers">
<span v-for="item in form.campsiteTagListVos"
:key="item.id" style="border: 1px solid #ccc; padding: 5px 10px;border-radius: 5px;margin-right: 10px;">{{item.name}}</span>
<el-button size="small" class="el-button el-button--primary" type="button" icon="edit" @click="editLable(form.campsiteTagListVos)">编辑</el-button>
</el-form-item>
<el-row>
<el-col :span="4">
<el-form-item label="热度值">
<el-input v-model="form.hot" placeholder="请输入热度值" type="number" min="0"></el-input>
</el-form-item>
</el-col>
</el-row>
<!--BASE_API + -->
<el-form-item label="封面图" :style="{display:'block'}">
<el-upload
class="upload-demo"
:headers="getHeaderWithToken"
action="https://xxtest.upyuns.com/api/universal/file/app/unauth/admin/upload"
:show-file-list="false"
:on-success="handleAvatarSuccess"
list-type="picture">
<img v-if="$utils.isString(form.logo) && !$utils.isEmpty(form.logo)" :src="form.logo" style="width:300px;max-height:300px;">
<i v-else class="el-icon-plus avatar-uploader-icon" style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i>
</el-upload>
</el-form-item>
<el-form-item label="轮播图" :style="{display:'block'}">
<el-upload
class="upload-demo"
:headers="getHeaderWithToken"
action="https://xxtest.upyuns.com/api/universal/file/app/unauth/admin/upload"
:on-remove="handleRemove"
:file-list="fileList2"
:on-success="handleBannerSuccess"
list-type="picture">
<div slot="tip" class="el-upload__tip">最多上传5张</div>
<el-button v-if="fileList2.length<5" size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
<el-tabs v-model="activeName2" type="card" @tab-click="handleClick">
<el-tab-pane label="营地详情" name="first">
<Editor v-if="activeName2=='first'" @input="handelContentIncrease" :value="form.content" :myQuillEditor="'myQuillEditorContent'" :activeName2="activeName2"></Editor>
</el-tab-pane>
<el-tab-pane label="配套&收费" name="second">
<Editor v-if="activeName2=='second'" @input="handelIntroduceIncrease" :value="form.configure" :myQuillEditor="'myQuillEditorIntroduce'" :activeName2="activeName2"></Editor>
</el-tab-pane>
</el-tabs>
<el-form-item></el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" v-if="title=='创建' && !isCreate" @click="create()">确 定</el-button>
<el-button type="primary" v-if="title=='编辑' && !isCreate" @click="update()">确 定</el-button>
</div>
<!--编辑营地地址-->
<campsiteModal v-if="showCampsiteVisible" :obj="campsiteObj" v-on:campsiteEvent = "campsiteEvent"></campsiteModal>
<!--编辑营地标签-->
<campsiteLabelModal v-if="editLableVisible" :allLabelList="allLabelList" :checkList="checkList" v-on:tourLabelEvent = "tourLabelEvent"></campsiteLabelModal>
</div>
</template>
<style>
.el-upload-list{
display: flex;
width: 100px;
}
.el-upload-list li{
margin-left: 10px;
}
</style>
<script>
import Editor from "../../modal/editorTool";//富文本
import campsiteLabelModal from "../../tourManage/modal/tourLabelModal";//标签
import campsiteModal from "./campsiteModal";//营地地址
import {
getOneCampsiteShop,
campsiteAllTagList,
editCampsiteShop,
addCampsiteShop,
existCampsiteShop
} from 'api/campsiteManage';
import {
getSonRegionByCodes,
getRegionByCodes,
} from 'api/base_info/region/';
import rsCode from '../../../utils/rsCode';
import {
getToken
} from '../../../utils/auth';
import {mapGetters} from 'vuex';
export default {
props: ["oneRow", "title"],
name: 'upkeepDialog',
components: {
Editor,
campsiteModal,
campsiteLabelModal
},
data() {
return {
isExist:false,//名称是否已存在
campsiteObj: {},//营地地址
departureList: [],//出发地列表
departureObj:{name: ""},//出发地
pathway: [],//途径地
isCreate: false,//是否点击了创建-确定
fileList2:[],
activeName2: 'first',//行程亮点
form: {
id: undefined,
name: undefined,//营地名称
hot: 0,//营地热度
servicePhone: "",//客服电话
phone: "",//联系电话
province: undefined,//省份
provinceName: undefined,//省份名称
city: undefined,//市编号
cityName: undefined,//市名称
address: undefined,//详细地址
latitude: undefined,
longitude: undefined,
content: undefined,//营地详情
concat: "",//联系人
logo:undefined,//封面图
configure: undefined,//配套&收费
campsiteTagListVos: [],//营地类型
carouse:[],//banner轮播
},
showCampsiteVisible: false,//编辑营地地址
rules: {
name: [
{
type: 'string',
required: true,
message: '请输入消息内容',
trigger: 'blur'
},
{
min: 0,
max: 100,
message: '长度小于 100 个字符',
trigger: 'blur'
}
]
},
checkList:[],//已选中的标签
allCompanies: {},
allCompaniesArr: [],
oneTourDialogVisible: false,
editLableVisible: false,//营地标签
allLabelList: [],//全部营地标签
}
},
created() {
this.getAllLabelList();
},
watch: {
oneTourDialogVisible(newValue, oldValue){
if(!newValue){
this.cleanForm();
}
},
},
mounted() {
if(this.title == "编辑"){
let row = this.oneRow;
this.getOne(row.id);
}
this.cleanForm();
this.oneTourDialogVisible = true;
},
computed: {
getHeaderWithToken() {
return {Authorization: getToken()};
},
},
methods: {
/**
* 判断标签名是否已存在
* */
checkName(){
this.form.name = (this.form.name).trim();
if(!this.form.name){
return;
}
let params = {
name: this.form.name
};
if(this.title == "编辑"){
params.id = this.form.id;
}
existCampsiteShop(params).then(response => {
if (response.status === 200) {
this.isExist = response.data;
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
handleClick(tab, event) {
console.log(tab, event);
},
/**
* 编辑营地标签
* */
editLable(list){
console.log(list);
this.editLableVisible = true;
},
/**
* 创建
* */
create(){
this.isCreate = true;
let carouse = [];//营地轮播图
this.form.carouse.map(function (item) {
let c = {
id: item.id,
imgUrl: item.imgUrl
};
carouse.push(c);
});
/**
* 营地类别
* */
let campsiteTagDTOS = [];
this.form.campsiteTagListVos.map(function (item) {
campsiteTagDTOS.push(item.id);
});
let params = {
name: this.form.name,//营地名称
logo: this.form.logo,//封面图
content: this.form.content,//营地详情
configure: this.form.configure,//配套&收费
hot: this.form.hot,//营地热度
campsiteTagDTOS: campsiteTagDTOS,//营地类别
carouselDTOS: carouse,//轮播图
concat: this.form.concat,//联系人
servicePhone: this.form.servicePhone,//客服电话
phone: this.form.phone,//联系电话
province: this.campsiteObj.province,//省份
provinceName: this.campsiteObj.provinceName,//省份名称
city: this.campsiteObj.city,//市编号
cityName: this.campsiteObj.cityName,//市名称
address: this.campsiteObj.address,//详细地址
latitude: this.campsiteObj.latitude,
longitude: this.campsiteObj.longitude,
};
console.log(params);
this.isExistCampsiteShop("create", params);
},
/**
* 判断营地名称是否已存在
* */
isExistCampsiteShop(type, datas){
if(!this.form.name){
return;
}
let params = {
name: this.form.name
};
if(type == 'update'){//编辑
params.id = this.form.id;
}
existCampsiteShop(params).then(response => {
if (response.status === 200) {
this.isExist = response.data;
if(response.data){
this.isCreate = false;
}
if(!response.data && type == "update"){//编辑
this.toUpdate(datas);
}
if(!response.data && type == "create"){
//创建
this.toCreate(datas);
}
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 编辑
* */
update(){
this.isCreate = true;
let carouse = [];//营地轮播图
this.form.carouse.map(function (item) {
let c = {
id: item.id,
imgUrl: item.imgUrl
};
carouse.push(c);
});
/**
* 营地类别
* */
let campsiteTagDTOS = [];
this.form.campsiteTagListVos.map(function (item) {
campsiteTagDTOS.push(item.id);
});
let params = {
id: this.form.id,
name: this.form.name,//营地名称
logo: this.form.logo,//封面图
content: this.form.content,//营地详情
configure: this.form.configure,//配套&收费
hot: this.form.hot,//营地热度
campsiteTagDTOS: campsiteTagDTOS,//营地类别
carouselDTOS: carouse,//轮播图
concat: this.form.concat,//联系人
servicePhone: this.form.servicePhone,//客服电话
phone: this.form.phone,//联系电话
province: this.campsiteObj.province,//省份
provinceName: this.campsiteObj.provinceName,//省份名称
city: this.campsiteObj.city,//市编号
cityName: this.campsiteObj.cityName,//市名称
address: this.campsiteObj.address,//详细地址
latitude: this.campsiteObj.latitude,
longitude: this.campsiteObj.longitude,
};
console.log(params);
this.isExistCampsiteShop("update", params);
},
/**
* 更新
* */
toUpdate(params){
editCampsiteShop(params).then(response => {
if (response.status === 200) {
this.$notify({
title: '成功',
message: '编辑成功',
type: 'success',
duration: 2000
});
this.$emit("oneCampsiteDialogEvent", true);
} else {
this.$notify({
title: '编辑失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 创建
* */
toCreate(params){
editCampsiteShop(params).then(response => {
if (response.status === 200) {
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
});
this.$emit("oneCampsiteDialogEvent", true);
} else {
this.$notify({
title: '创建失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 获取全部营地类型
* */
getAllLabelList() {
campsiteAllTagList().then(response => {
this.allLabelList = response;
});
},
/**
* 关闭营地地址弹框
* */
campsiteEvent(obj){
this.showCampsiteVisible = false;
if(obj){
this.campsiteObj = obj;
let provinceObj = getRegionByCodes([obj.province]);
let cityObj = getRegionByCodes([obj.city]);
this.campsiteObj.provinceName = provinceObj[0].name;
this.campsiteObj.cityName = cityObj[0].name;
this.form.addressStr = this.campsiteObj.provinceName + this.campsiteObj.cityName + this.campsiteObj.address;
console.log(this.campsiteObj);
}
},
/**
* 编辑营地地址
* */
selectDestination(){
let that = this;
this.campsiteObj.showTitle = "营地地址编辑";
this.campsiteObj.eventName ='campsiteEvent';
this.campsiteObj.keyword = this.campsiteObj.address;
this.showCampsiteVisible = true;
},
/**
* 关闭营地标签弹框
* */
tourLabelEvent(obj){
let that = this;
this.editLableVisible = false;
let arr = [];
let ckeckList = [];
if(obj){
this.allLabelList.map(function(item){
obj.map(function(b){
if(item.name == b){
arr.push(item);
ckeckList.push(b);
}
});
});
this.form.campsiteTagListVos = arr;
this.checkList = ckeckList;
console.log(obj);
}
},
/**
* 获取一条营地
* */
getOne(id){
let that = this;
getOneCampsiteShop(id).then(response => {
this.form = response.data;
this.campsiteObj = {
address: response.data.address,
province: response.data.province,
provinceName: response.data.provinceName,
city: response.data.city,
cityName: response.data.cityName,
latitude: response.data.latitude,
longitude: response.data.longitude,
};
response.data.addressStr = this.campsiteObj.provinceName + this.campsiteObj.cityName + this.campsiteObj.address;
let arr = [];
that.allLabelList.map(function(b){
response.data.campsiteTagListVos.map(function(item){
if(item.id == b.id){
arr.push(item.name);
}
});
});
this.checkList = arr;
//轮播
let fileList2 = [];
response.data.carouse.map(function (p) {
let pp = {
id: p.id,
url: p.imgUrl
};
fileList2.push(pp);
});
this.fileList2 = fileList2;
})
},
/**
* 旅游-弹框-取消
* */
cancel() {
this.cleanForm();
this.$emit("oneCampsiteDialogEvent", false);
},
/**
* 配套&收费 富文本
* */
handelIntroduceIncrease(step){
this.form.configure = step;
},
/**
* 富文本 营地详情
* */
handelContentIncrease(step){
this.form.content = step;
},
/**
* 删除banner
* */
handleRemove(file, fileList){
let list = [];
fileList.map(function(item){
if(item.url != file.url){
list.push(item);
}
});
this.fileList2 = list;
let arr = [];
this.form.carouse.map(function(item){
if(item.imgUrl != file.url){
arr.push(item);
}
});
this.form.carouse = arr;
},
/**
* 封面图上传
* **/
handleAvatarSuccess(res, file){
this.form.logo = res.data;
},
/**
* banner上传
* */
handleBannerSuccess(res, file){
this.fileList2.push({url:res.data});
this.form.carouse.push({imgUrl:res.data});
},
/**
* 清空旅游弹框数据
*/
cleanForm() {
this.campsiteObj ={name: ""};//营地地址
this.fileList2=[];
this.activeName2= 'first';//营地详情
this.form = {
id: undefined,
name: undefined,//营地名称
hot: 0,//营地热度
servicePhone: "",//客服电话
phone: "",//联系电话
province: undefined,//省份
provinceName: undefined,//省份名称
city: undefined,//市编号
cityName: undefined,//市名称
address: undefined,//详细地址
latitude: undefined,
longitude: undefined,
content: undefined,//营地详情
concat: "",//联系人
logo:undefined,//封面图
configure: undefined,//配套&收费
campsiteTagListVos: [],//营地类型
carouse:[],//banner轮播
};
this.showCampsiteVisible= false;//编辑营地地址
}
}
}
</script>
......@@ -79,7 +79,7 @@
<!--</el-form-item>-->
</el-col>
<el-col :span="8">
<el-form-item label="省份">
<el-form-item label="省份">
<el-select class="filter-item" v-model="listQuery.addrProvince" placeholder="请选择省份(直辖市)" @change='getValue'>
<el-option :key="undefined" label="无" :value="undefined"></el-option>
<el-option v-for="item in provinceRegions" :key="item.id" :label="item.name" :value="item.id"></el-option>
......@@ -712,52 +712,12 @@
</el-dialog>
<!-- 车辆保养弹窗 -->
<el-dialog title="保养" :visible.sync="upkeepDialogVisible">
<el-form :model="upkeepForm" :rules="rules" ref="form" label-width="90px">
<el-form-item label="车牌号">
<el-input v-model="upkeepForm.numberPlate" disabled></el-input>
</el-form-item>
<el-form-item label="保养人" prop="operator">
<el-input v-model="upkeepForm.operator" placeholder="请输入车辆保养人"></el-input>
</el-form-item>
<el-form-item label="公里数" prop="mileage">
<el-input v-model="upkeepForm.mileage" placeholder="请输入保养时公里数"></el-input>
</el-form-item>
<el-form-item label="总费用" prop="amount">
<el-input v-model="upkeepForm.amount" placeholder="请输入保养总费用"></el-input>
</el-form-item>
<el-form-item label="审批人" prop="approvers">
<el-input v-model="upkeepForm.approvers" placeholder="请输入保养审批人"></el-input>
</el-form-item>
<el-form-item label="分公司" prop="branchCompanyId">
<!--<el-select class="filter-item" v-model="upkeepForm.branchCompanyId" placeholder="请选择分公司">-->
<!--<el-option v-for="item in allCompanies" :key="item.id" :label="item.name" :value="item.id"></el-option>-->
<!--</el-select>-->
<el-autocomplete
class="inline-input"
v-model="upkeepForm.state1"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
@select="handleSelect"
></el-autocomplete>
</el-form-item>
<el-form-item label="保养项目" prop="upkeepItems">
<el-checkbox-group v-model="upkeepForm.upkeepItems">
<el-checkbox v-for="item in allUpkeepItems" :label="item.id" :key="item.id">{{item.name}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelUpkeep">取 消</el-button>
<el-button type="primary" @click="upkeepVehicleHandler">确 定</el-button>
</div>
</el-dialog>
<upkeepDialog v-if="upkeepDialogVisible" :upkeepRow="upkeepRow" v-on:upkeepDialogEvent = "upkeepDialogEvent"></upkeepDialog>
</div>
</template>
<script>
import upkeepDialog from '../../modal/upkeepDialogVisible'// 保养弹框
import 'static/css/uploadImg.css';// 引入图片上传组件对话框
import {
page,
......@@ -840,12 +800,13 @@
ElRow,
Element1,
bookInfoViewer,
accItemSelector
accItemSelector,
upkeepDialog
},
data() {
return {
upkeepRow: {},//保养数据
state1: '',
select: "餐厅名",
BASE_API: process.env.BASE_API,
dialogForm4LicenceVisible: false,
licenceSrcUrl: undefined,
......@@ -1130,18 +1091,6 @@
arrivalBranchCompanyName: ''
},
upkeepDialogVisible: false,
upkeepForm: {
state1: "",
vehicleId: null,
numberPlate: null,
operator: null,
date: null,
mileage: null,
amount: null,
approvers: null,
branchCompanyId: null,
upkeepItems: []
},
allUpkeepItems: null
}
},
......@@ -1327,10 +1276,13 @@
notBookedEndDate: undefined,
code: undefined
};
this.getList();
// this.reload();
// window.reload();
// this.$router.go(0)
this.getList();
},
/**
* 保养modal传递回来的数据
* */
upkeepDialogEvent(e){
this.upkeepDialogVisible = e;
},
querySearch(queryString, cb) {
let selectArry = [];
......@@ -1441,65 +1393,13 @@
});
});
},
upkeepVehicleHandler() {
upkeepVehicle(this.upkeepForm).then(response => {
if (response.code === rsCode.RS_CODE_SUC) {
this.upkeepDialogVisible = false;
this.$notify({
title: '成功',
message: '操作成功',
type: 'success',
duration: 2000
});
this.getList();
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
})
},
cancelUpkeep() {
this.cleanUpkeepForm();
this.upkeepDialogVisible = false;
},
/**
* 操作-保养-按钮
* */
upkeepHandler(row) {
this.cleanUpkeepForm();
this.upkeepForm.branchCompanyId = row.subordinateBranch;
let that = this;
let selectArry = [];
this.allCompaniesArr.map(function(item){
item.value = item.name;
selectArry.push(item);
});
selectArry.map(function (iitem) {
if( row.subordinateBranch == iitem.id){
that.upkeepForm.state1 = iitem.name;
}
});
this.upkeepForm.mileage = row.mileageLastUpdate;
this.upkeepForm.vehicleId = row.id;
this.upkeepForm.mileage = row.mileage;
this.upkeepForm.numberPlate = row.numberPlate;
this.upkeepRow = row;
this.upkeepDialogVisible = true;
},
cleanUpkeepForm() {
this.upkeepForm = {
vehicleId: null,
numberPlate: null,
operator: null,
date: null,
mileage: null,
state1: "",
amount: null,
approvers: null,
branchCompanyId: null,
upkeepItems: []
}
},
handleDepartureLog(row) {
this.$router.push({
path: '/vehicle/vehicleDepartureLog',
......@@ -1767,7 +1667,7 @@
getAllVehicleStatus: function () {
return this.vehicleStatus;
},
getBrand: function (code) {
getBrand: function (code) {debugger
if (!this.$utils.isInteger(code) || code == VEHICLE_CONSTANT_BRAND_CODE_UNKOWN) {
return '未知';
}
......
......@@ -102,51 +102,12 @@
</div>
</el-dialog>
<!-- 车辆保养弹窗 -->
<el-dialog title="保养" :visible.sync="upkeepDialogVisible">
<el-form :model="upkeepForm" :rules="rules" ref="form" label-width="90px">
<el-form-item label="车牌号">
<el-input v-model="upkeepForm.numberPlate" disabled></el-input>
</el-form-item>
<el-form-item label="保养人" prop="operator">
<el-input v-model="upkeepForm.operator" placeholder="请输入车辆保养人"></el-input>
</el-form-item>
<el-form-item label="公里数" prop="mileage">
<el-input v-model="upkeepForm.mileage" placeholder="请输入保养时公里数"></el-input>
</el-form-item>
<el-form-item label="总费用" prop="amount">
<el-input v-model="upkeepForm.amount" placeholder="请输入保养总费用"></el-input>
</el-form-item>
<el-form-item label="审批人" prop="approvers">
<el-input v-model="upkeepForm.approvers" placeholder="请输入保养审批人"></el-input>
</el-form-item>
<el-form-item label="分公司" prop="branchCompanyId">
<el-autocomplete
class="inline-input"
v-model="upkeepForm.state1"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
@select="handleSelect"
></el-autocomplete>
<!--<el-select class="filter-item" v-model="upkeepForm.branchCompanyId" placeholder="请选择分公司">-->
<!--<el-option v-for="item in allCompanies" :key="item.id" :label="item.name" :value="item.id"></el-option>-->
<!--</el-select>-->
</el-form-item>
<el-form-item label="保养项目" prop="upkeepItems">
<el-checkbox-group v-model="upkeepForm.upkeepItems">
<el-checkbox v-for="item in allUpkeepItems" :label="item.id" :key="item.id">{{item.name}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelUpkeep">取 消</el-button>
<el-button type="primary" @click="upkeepVehicleHandler">确 定</el-button>
</div>
</el-dialog>
<upkeepDialog v-if="upkeepDialogVisible" :upkeepRow="upkeepRow" v-on:upkeepDialogEvent = "upkeepDialogEvent"></upkeepDialog>
</div>
</template>
<script>
import upkeepDialog from '../../modal/upkeepDialogVisible'
import {
page,
addObj,
......@@ -170,9 +131,12 @@
} from 'api/vehicle/active';
export default {
name: 'vehicleInfo',
components: {},
components: {
upkeepDialog
},
data() {
return {
upkeepRow: {},//保养数据
form: {
msg: undefined,
remark: undefined
......@@ -261,26 +225,6 @@
])
},
methods: {
querySearch(queryString, cb) {
let selectArry = [];
this.allCompaniesArr.map(function(item){
item.value = item.name;
selectArry.push(item);
});
this.selectArry = selectArry;
var results = queryString ? selectArry.filter(this.createFilter(queryString)) : selectArry;
// 调用 callback 返回建议列表的数据
cb(results);
},
handleSelect(item) {
this.upkeepForm.branchCompanyId = item.id;
console.log(item);
},
createFilter(queryString) {
return (restaurant) => {
return (restaurant.name.indexOf(queryString.toLowerCase()) != -1);
};
},
getTypeName: function(type) {
if (this.$utils.isEmpty(this.vehicleWarningMsgType[type])) {
return '未知';
......@@ -319,38 +263,16 @@
this.getList();
},
/**
* 保养-确定
* 保养modal传递回来的数据
* */
upkeepVehicleHandler() {debugger
upkeepVehicle(this.upkeepForm).then(response => {
if (response.code === rsCode.RS_CODE_SUC) {
this.upkeepDialogVisible = false;
this.$notify({
title: '成功',
message: '操作成功',
type: 'success',
duration: 2000
});
this.getList();
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
})
upkeepDialogEvent(e){
this.upkeepDialogVisible = e;
},
handleCreate() {
this.resetTemp();
this.dialogStatus = 'create';
this.dialogFormVisible = true;
},
cancelUpkeep() {
this.cleanUpkeepForm();
this.upkeepDialogVisible = false;
},
/**
* 保养结束
* */
......@@ -379,22 +301,7 @@
* @param row
*/
handleDeal(row) {
this.cleanUpkeepForm();
this.upkeepForm.branchCompanyId = row.subordinateBranch;
let that = this;
let selectArry = [];
this.allCompaniesArr.map(function(item){
item.value = item.name;
selectArry.push(item);
});
selectArry.map(function (iitem) {
if( row.subordinateBranch == iitem.id){
that.upkeepForm.state1 = iitem.name;
}
});debugger
this.upkeepForm.mileage = row.mileageLastUpdate;
this.upkeepForm.vehicleId = row.vehicleId;
this.upkeepForm.numberPlate = row.numberPlate;
this.upkeepRow = row;
this.upkeepDialogVisible = true;
},
cleanUpkeepForm() {
......@@ -411,26 +318,6 @@
upkeepItems: []
}
},
// handleDeal(row) {
// this.$confirm('此操作不可恢复, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// })
// .then(() => {
// dealObj(row.id)
// .then(() => {
// this.$notify({
// title: '成功',
// message: '处理成功',
// type: 'success',
// duration: 2000
// });
// const index = this.list.indexOf(row);
// this.list.splice(index, 1);
// });
// });
// },
create(formName) {
const set = this.$refs;
set[formName].validate(valid => {
......
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