Commit 9075ffb6 authored by lixy's avatar lixy

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

parent 8f88fe2d
...@@ -9,6 +9,16 @@ export function campsiteTagList(query) { ...@@ -9,6 +9,16 @@ export function campsiteTagList(query) {
params: 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) { ...@@ -65,6 +75,57 @@ export function getCampsiteList(query) {
return fetch({ return fetch({
url: '/api/campsite/admin/campsiteShop/pages', url: '/api/campsite/admin/campsiteShop/pages',
method: 'post', 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 params: query
}); });
} }
......
...@@ -35,3 +35,9 @@ export function convertDate2Str(object) { ...@@ -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 @@ ...@@ -172,10 +172,47 @@
}, },
}, },
methods: { 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(){ isExistTag(){
this.form.name = (this.form.name).trim();
if(!this.form.name){ if(!this.form.name){
return; return;
} }
...@@ -188,14 +225,6 @@ ...@@ -188,14 +225,6 @@
existTag(params).then(response => { existTag(params).then(response => {
if (response.status === 200) { if (response.status === 200) {
this.isExist = response.data; this.isExist = response.data;
// if(response.data){
// this.$notify({
// title: '失败',
// message: '标签已存在',
// type: 'error',
// duration: 2000
// });
// }
} else { } else {
this.$notify({ this.$notify({
title: '失败', title: '失败',
...@@ -226,9 +255,9 @@ ...@@ -226,9 +255,9 @@
this.showLoadingBody = false; this.showLoadingBody = false;
}, },
/** /**
* 新建标签 * 创建营地类型
* */ * */
create(formName){ toCreate(formName){
const set = this.$refs; const set = this.$refs;
set[formName].validate(valid => { set[formName].validate(valid => {
if (valid && !this.isExist) { if (valid && !this.isExist) {
...@@ -258,6 +287,13 @@ ...@@ -258,6 +287,13 @@
} }
}); });
}, },
/**
* 新建标签
* */
create(formName){
this.isCreate = true;//点击了确定按钮-按钮不可用
this.isExistTagName("create", formName);
},
/** /**
* 删除 * 删除
* */ * */
...@@ -282,9 +318,9 @@ ...@@ -282,9 +318,9 @@
}); });
}, },
/** /**
* 编辑-更新 * 编辑营地类别
* */ * */
update(formName) { toUpdate(formName){
const set = this.$refs; const set = this.$refs;
set[formName].validate(valid => { set[formName].validate(valid => {
if (valid && !this.isExist) { if (valid && !this.isExist) {
...@@ -314,6 +350,13 @@ ...@@ -314,6 +350,13 @@
} }
}); });
}, },
/**
* 编辑-更新
* */
update(formName) {
this.isCreate = true;//点击了确定按钮-按钮不可用
this.isExistTagName("update", formName);
},
/** /**
* 深拷贝 * 深拷贝
*/ */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<!--</el-form-item>--> <!--</el-form-item>-->
</el-col> </el-col>
<el-col :span="8"> <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-select class="filter-item" v-model="listQuery.addrProvince" placeholder="请选择省份(直辖市)" @change='getValue'>
<el-option :key="undefined" label="无" :value="undefined"></el-option> <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> <el-option v-for="item in provinceRegions" :key="item.id" :label="item.name" :value="item.id"></el-option>
...@@ -712,52 +712,12 @@ ...@@ -712,52 +712,12 @@
</el-dialog> </el-dialog>
<!-- 车辆保养弹窗 --> <!-- 车辆保养弹窗 -->
<el-dialog title="保养" :visible.sync="upkeepDialogVisible"> <upkeepDialog v-if="upkeepDialogVisible" :upkeepRow="upkeepRow" v-on:upkeepDialogEvent = "upkeepDialogEvent"></upkeepDialog>
<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>
</div> </div>
</template> </template>
<script> <script>
import upkeepDialog from '../../modal/upkeepDialogVisible'// 保养弹框
import 'static/css/uploadImg.css';// 引入图片上传组件对话框 import 'static/css/uploadImg.css';// 引入图片上传组件对话框
import { import {
page, page,
...@@ -840,12 +800,13 @@ ...@@ -840,12 +800,13 @@
ElRow, ElRow,
Element1, Element1,
bookInfoViewer, bookInfoViewer,
accItemSelector accItemSelector,
upkeepDialog
}, },
data() { data() {
return { return {
upkeepRow: {},//保养数据
state1: '', state1: '',
select: "餐厅名",
BASE_API: process.env.BASE_API, BASE_API: process.env.BASE_API,
dialogForm4LicenceVisible: false, dialogForm4LicenceVisible: false,
licenceSrcUrl: undefined, licenceSrcUrl: undefined,
...@@ -1130,18 +1091,6 @@ ...@@ -1130,18 +1091,6 @@
arrivalBranchCompanyName: '' arrivalBranchCompanyName: ''
}, },
upkeepDialogVisible: false, upkeepDialogVisible: false,
upkeepForm: {
state1: "",
vehicleId: null,
numberPlate: null,
operator: null,
date: null,
mileage: null,
amount: null,
approvers: null,
branchCompanyId: null,
upkeepItems: []
},
allUpkeepItems: null allUpkeepItems: null
} }
}, },
...@@ -1327,10 +1276,13 @@ ...@@ -1327,10 +1276,13 @@
notBookedEndDate: undefined, notBookedEndDate: undefined,
code: undefined code: undefined
}; };
this.getList(); this.getList();
// this.reload(); },
// window.reload(); /**
// this.$router.go(0) * 保养modal传递回来的数据
* */
upkeepDialogEvent(e){
this.upkeepDialogVisible = e;
}, },
querySearch(queryString, cb) { querySearch(queryString, cb) {
let selectArry = []; let selectArry = [];
...@@ -1441,65 +1393,13 @@ ...@@ -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) { upkeepHandler(row) {
this.cleanUpkeepForm(); this.upkeepRow = row;
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.upkeepDialogVisible = true; 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) { handleDepartureLog(row) {
this.$router.push({ this.$router.push({
path: '/vehicle/vehicleDepartureLog', path: '/vehicle/vehicleDepartureLog',
...@@ -1767,7 +1667,7 @@ ...@@ -1767,7 +1667,7 @@
getAllVehicleStatus: function () { getAllVehicleStatus: function () {
return this.vehicleStatus; return this.vehicleStatus;
}, },
getBrand: function (code) { getBrand: function (code) {debugger
if (!this.$utils.isInteger(code) || code == VEHICLE_CONSTANT_BRAND_CODE_UNKOWN) { if (!this.$utils.isInteger(code) || code == VEHICLE_CONSTANT_BRAND_CODE_UNKOWN) {
return '未知'; return '未知';
} }
......
...@@ -102,51 +102,12 @@ ...@@ -102,51 +102,12 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 车辆保养弹窗 --> <!-- 车辆保养弹窗 -->
<el-dialog title="保养" :visible.sync="upkeepDialogVisible"> <upkeepDialog v-if="upkeepDialogVisible" :upkeepRow="upkeepRow" v-on:upkeepDialogEvent = "upkeepDialogEvent"></upkeepDialog>
<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>
</div> </div>
</template> </template>
<script> <script>
import upkeepDialog from '../../modal/upkeepDialogVisible'
import { import {
page, page,
addObj, addObj,
...@@ -170,9 +131,12 @@ ...@@ -170,9 +131,12 @@
} from 'api/vehicle/active'; } from 'api/vehicle/active';
export default { export default {
name: 'vehicleInfo', name: 'vehicleInfo',
components: {}, components: {
upkeepDialog
},
data() { data() {
return { return {
upkeepRow: {},//保养数据
form: { form: {
msg: undefined, msg: undefined,
remark: undefined remark: undefined
...@@ -261,26 +225,6 @@ ...@@ -261,26 +225,6 @@
]) ])
}, },
methods: { 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) { getTypeName: function(type) {
if (this.$utils.isEmpty(this.vehicleWarningMsgType[type])) { if (this.$utils.isEmpty(this.vehicleWarningMsgType[type])) {
return '未知'; return '未知';
...@@ -319,38 +263,16 @@ ...@@ -319,38 +263,16 @@
this.getList(); this.getList();
}, },
/** /**
* 保养-确定 * 保养modal传递回来的数据
* */ * */
upkeepVehicleHandler() {debugger upkeepDialogEvent(e){
upkeepVehicle(this.upkeepForm).then(response => { this.upkeepDialogVisible = e;
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
});
}
})
}, },
handleCreate() { handleCreate() {
this.resetTemp(); this.resetTemp();
this.dialogStatus = 'create'; this.dialogStatus = 'create';
this.dialogFormVisible = true; this.dialogFormVisible = true;
}, },
cancelUpkeep() {
this.cleanUpkeepForm();
this.upkeepDialogVisible = false;
},
/** /**
* 保养结束 * 保养结束
* */ * */
...@@ -379,22 +301,7 @@ ...@@ -379,22 +301,7 @@
* @param row * @param row
*/ */
handleDeal(row) { handleDeal(row) {
this.cleanUpkeepForm(); this.upkeepRow = row;
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.upkeepDialogVisible = true; this.upkeepDialogVisible = true;
}, },
cleanUpkeepForm() { cleanUpkeepForm() {
...@@ -411,26 +318,6 @@ ...@@ -411,26 +318,6 @@
upkeepItems: [] 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) { create(formName) {
const set = this.$refs; const set = this.$refs;
set[formName].validate(valid => { 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