Commit 33fec714 authored by lixy's avatar lixy

旅游省市名称换-旅游标签名称校验

parent 9075ffb6
......@@ -77,8 +77,8 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelHandel">取 消</el-button>
<el-button v-if="modalTitle=='创建'" type="primary" @click="create('form')">确 定</el-button>
<el-button v-else type="primary" @click="update('form')">确 定</el-button>
<el-button v-if="modalTitle=='创建' && !isCreate" type="primary" @click="create('form')">确 定</el-button>
<el-button v-if="modalTitle=='编辑' && !isCreate" type="primary" @click="update('form')">确 定</el-button>
</div>
</el-dialog>
</div>
......@@ -127,6 +127,7 @@
},
data() {
return {
isCreate: false,
modalTitle: "创建",
BASE_API: process.env.BASE_API,
dialogVisible: false,//添加、编辑弹框
......
......@@ -9,22 +9,22 @@
<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-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>
......
<template>
<!-- 车辆保养弹窗 -->
<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>
</template>
<script>
import {
page,
addObj,
getObj,
dealObj
} from 'api/vehicle/vehicleWarningMsg/';
import {
getAllUpkeepItem
} from 'api/vehicle/upkeep';
import rsCode from '../../utils/rsCode';
import {mapGetters} from 'vuex';
import {
getAllCompany,
getAll
} from 'api/base_info/branch_company/';
import {
upkeepEndVehicle,
upkeepVehicle
} from 'api/vehicle/active';
export default {
props: ["upkeepRow"],
name: 'upkeepDialog',
components: {},
data() {
return {
upkeepForm: {
vehicleId: null,
state1: "",
numberPlate: null,
operator: null,
date: null,
mileage: null,
amount: null,
approvers: null,
branchCompanyId: null,
upkeepItems: []
},
rules: {
name: [
{
type: 'string',
required: true,
message: '请输入消息内容',
trigger: 'blur'
},
{
min: 0,
max: 2000,
message: '长度小于 2000 个字符',
trigger: 'blur'
}
],
remark: [
{
min: 0,
max: 2000,
message: '长度小于 2000 个字符',
trigger: 'blur'
}
]
},
allCompanies: {},
allCompaniesArr: [],
upkeepDialogVisible: false,
allUpkeepItems: null,
dialogStatus: undefined,
}
},
created() {
},
watch: {
upkeepDialogVisible(newValue, oldValue){
if(!newValue){
this.cleanUpkeepForm();
this.$emit("upkeepDialogEvent", false);
}
},
},
mounted() {
let row = this.upkeepRow;
this.cleanUpkeepForm();debugger
this.upkeepForm.branchCompanyId = row.subordinateBranch;
let that = this;
let selectArry = [];
getAll()
.then(response => {
this.allCompaniesArr = response.data;
response.data.map(function(item){
item.value = item.name;
selectArry.push(item);
});
selectArry.map(function (iitem) {
if( row.subordinateBranch == iitem.id){
that.upkeepForm.state1 = iitem.name;
}
});
});
getAllCompany(codeAndBranchCompany => {
this.allCompanies = codeAndBranchCompany;
});
getAllUpkeepItem().then(response => {
this.allUpkeepItems = response.data;
});
this.upkeepForm.mileage = row.mileageLastUpdate?row.mileageLastUpdate: row.mileage;
this.upkeepForm.vehicleId = row.vehicleId ? row.vehicleId: row.id;
this.upkeepForm.numberPlate = row.numberPlate;
this.upkeepDialogVisible = true;
},
computed: {
...mapGetters([
'elements',
'vehicleWarningMsgType'
])
},
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 '未知';
}
return this.vehicleWarningMsgType[type].val;
},
/**
* 保养-确定
* */
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.$emit("upkeepDialogEvent", false);
},
/**
* 清空保养弹框数据
*/
cleanUpkeepForm() {
this.upkeepForm = {
state1: "",
vehicleId: null,
numberPlate: null,
operator: null,
date: null,
mileage: null,
amount: null,
approvers: null,
branchCompanyId: null,
upkeepItems: []
}
}
}
}
</script>
......@@ -209,8 +209,9 @@
} from 'api/tourManage';
import {
getAllUpkeepItem
} from 'api/vehicle/upkeep';
getSonRegionByCodes,
getRegionByCodes,
} from 'api/base_info/region/';
import rsCode from '../../../utils/rsCode';
import {
......@@ -510,15 +511,8 @@
} else {
tagDTOS.push({tagId: item.id});
}
});
//轮播图
// let bannerDTOS = [];
// this.form.bannerDTOS.map(function(item){
// bannerDTOS.push({cover: item.cover});
// });
let siteDTOS = [];
let siteDTOS = [];debugger
//出发地
this.departureList.map(function(item){
let p = {
......@@ -539,6 +533,10 @@
});
//途径地
this.pathway.map(function(item){
let provinceObj = getRegionByCodes([item.province]);
let cityObj = getRegionByCodes([item.city]);
item.provinceName = provinceObj[0].name;
item.cityName = cityObj[0].name;
let p = {
name: item.name,
address: item.addrDetail?item.addrDetail: item.address,
......@@ -556,6 +554,10 @@
});
//destinationObj目的地
let destinationObj = this.destinationObj;
let provinceObj = getRegionByCodes([destinationObj.province]);
let cityObj = getRegionByCodes([destinationObj.city]);
destinationObj.provinceName = provinceObj[0].name;
destinationObj.cityName = cityObj[0].name;
let p = {
name: destinationObj.name,
address: destinationObj.addrDetail?destinationObj.addrDetail: destinationObj.address,
......
......@@ -77,7 +77,7 @@
</el-form-item>
<!--0-app首页,1-app旅游页;2-租车-->
<el-form-item label="排序" prop="tourTagDTO.rank">
<el-input v-model="form.tourTagDTO.rank" placeholder="请输入排序值"></el-input>
<el-input v-model="form.tourTagDTO.rank" placeholder="请输入排序值" type="number" min="0"></el-input>
</el-form-item>
<!--BASE_API + -->
<el-form-item label="封面图" prop="tourTagDTO.img" :style="{display:'block'}">
......@@ -107,8 +107,8 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelHandel">取 消</el-button>
<el-button v-if="modalTitle=='创建'" type="primary" @click="create('form')">确 定</el-button>
<el-button v-else type="primary" @click="update('form')">确 定</el-button>
<el-button v-if="modalTitle=='创建' && !isCreate" type="primary" @click="create('form')">确 定</el-button>
<el-button v-if="modalTitle=='编辑' && !isCreate" type="primary" @click="update('form')">确 定</el-button>
</div>
</el-dialog>
</div>
......@@ -167,6 +167,7 @@
},
data() {
return {
isCreate: false,//是否点击了确定按钮
isExist: false,//标签是否已存在
tableKey:0,
modalTitle: "创建",
......@@ -185,7 +186,7 @@
isDel: undefined,
isHot: undefined,
name: undefined,
rank: undefined
rank: 0
},
tourTagBannerDTOS:{},
},
......@@ -251,10 +252,48 @@
this.modalTitle = '创建';
this.bannerDialogVisible = true;
},
/**
* 保存时判断标签名称是否已存在
* */
isExistTagName(type, formName){
this.form.tourTagDTO.name = (this.form.tourTagDTO.name).trim();
if(!this.form.tourTagDTO.name){
return;
}
let params = {
name: this.form.tourTagDTO.name
};
if(type == 'update'){//编辑
params.id = this.form.tourTagDTO.id;
}
existTourTag(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
});
}
});
},
/**
* 判断标签名是否已存在
* */
isExistTourTag(){
this.form.tourTagDTO.name = (this.form.tourTagDTO.name).trim();
if(!this.form.tourTagDTO.name){
return;
}
......@@ -267,14 +306,6 @@
existTourTag(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: '失败',
......@@ -339,15 +370,15 @@
this.form = {
tourTagDTO:{
bannerNums: 0,
count: undefined,
ctrTime: undefined,
describe: undefined,
id: undefined,
img: undefined,
isDel: undefined,
isHot: undefined,
name: undefined,
rank: undefined
count: undefined,
ctrTime: undefined,
describe: undefined,
id: undefined,
img: undefined,
isDel: undefined,
isHot: undefined,
name: undefined,
rank: 0
},
tourTagBannerDTOS:[],
};
......@@ -380,9 +411,9 @@
});
},
/**
* 创建
* 创建请求
* */
create(formName) {
toCreate(formName){
const set = this.$refs;
set[formName].validate(valid => {
if (valid && !this.isExist) {
......@@ -412,14 +443,25 @@
}
});
},
/**
* 创建
* */
create(formName) {
this.isCreate = true;//点击后确定按钮不可用
this.isExistTagName("create", formName);
},
/**
* 编辑-确定按钮
* */
update(formName){
this.isCreate = true;//点击后确定按钮不可用
this.isExistTagName("update", formName);
},
/**
* 编辑-更新
* */
update(formName) {
toUpdate(formName) {
const set = this.$refs;
// console.log(this.fileList2);
// console.log(this.form.tourTagBannerDTOS);
// debugger;
set[formName].validate(valid => {
if (valid && !this.isExist) {
tourTagUpdate(this.form).then(response => {
......
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