Commit 39febd04 authored by rencs's avatar rencs

8.28 后台用户

parent aa85b7b6
......@@ -42,6 +42,16 @@ export function company_all_list() {
});
}
//所有门店列表 state: 1
export function branchCompany_all_list(query) {
return fetch({
url: "vehicle/branchCompany/alls",
method: "get",
params: query,
});
}
// 添加公司
export function add_company(query) {
return fetch({
......
<template>
<div class="app-container calendar-list-container">
<div class="filter-container">
<el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="姓名或账户" v-model="listQuery.name"> </el-input>
<el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button>
<el-button class="filter-item" v-if="userManager_btn_add" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="edit">添加</el-button>
</div>
<el-table :key='tableKey' :data="list" v-loading.body="listLoading" border fit highlight-current-row style="width: 100%">
<el-table-column align="center" label="序号" width="65"> <template slot-scope="scope">
<div class="app-container calendar-list-container">
<div class="filter-container">
<el-form>
<el-row>
<el-col :span="5">
<el-form-item label="姓名或账户">
<el-input
@keyup.enter.native="handleFilter"
style="width: 200px;"
class="filter-item"
placeholder="姓名或账户"
v-model="listQuery.name"
></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="所属公司">
<el-select
class="filter-item"
v-model="listQuery.corporationId"
clearable
filterable
placeholder="请选择公司"
>
<el-option label="全部" value="0"></el-option>
<el-option
v-for="val in companys_list"
:key="val.id"
:label="val.name"
:value="val.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="所属门店">
<el-select
class="filter-item"
v-model="listQuery.companyId"
clearable
placeholder="请选择"
>
<el-option label="全部" value="0"></el-option>
<el-option
v-for="val in branchCompany_list"
:key="val.id"
:label="val.name"
:value="val.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-button
class="filter-item"
type="primary"
v-waves
icon="search"
@click="handleFilter"
>搜索</el-button>
<el-button
class="filter-item"
v-if="userManager_btn_add"
style="margin-left: 10px;"
@click="handleCreate"
type="primary"
icon="edit"
>添加</el-button>
</el-col>
</el-row>
</el-form>
</div>
<el-table
:key="tableKey"
:data="list"
v-loading.body="listLoading"
border
fit
highlight-current-row
style="width: 100%"
>
<el-table-column align="center" label="序号" width="65">
<template slot-scope="scope">
<span>{{scope.row.id}}</span>
</template> </el-table-column>
<el-table-column width="200" align="center" label="姓名"> <template slot-scope="scope">
<span>{{scope.row.name}}</span>
</template> </el-table-column>
<el-table-column width="110" align="center" label="账户"> <template slot-scope="scope">
<span>{{scope.row.username}}</span>
</template> </el-table-column>
<el-table-column width="110" align="center" label="性别"> <template slot-scope="scope">
</template>
</el-table-column>
<el-table-column align="center" label="姓名">
<template slot-scope="scope">
<span>{{scope.row.name}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="账户">
<template slot-scope="scope">
<span>{{scope.row.username}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="所属公司">
<template slot-scope="scope">
<span>{{scope.row.corporationName}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="所属门店">
<template slot-scope="scope">
<span>{{scope.row.companyName}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="角色">
<template slot-scope="scope">
<span>{{scope.row.groupStr}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="状态">
<template slot-scope="scope">
<span v-if="scope.row.status==1">启用</span>
<span v-else>停用</span>
</template>
</el-table-column>
<!--<el-table-column width="110" align="center" label="性别"> <template slot-scope="scope">
<span>{{scope.row.sex}}</span>
</template> </el-table-column>
<el-table-column width="300" align="center" label="备注"> <template slot-scope="scope">
<span>{{scope.row.description}}</span>
</template> </el-table-column>
<el-table-column width="180" align="center" label="最后时间"> <template slot-scope="scope">
<span>{{scope.row.updTime}}</span>
</template> </el-table-column>
<el-table-column width="200" align="center" label="最后更新人"> <template slot-scope="scope">
<span>{{scope.row.updName}}</span>
</template> </el-table-column>
<el-table-column align="center" label="操作" width="150"> <template slot-scope="scope">
<el-button v-if="userManager_btn_edit" size="small" type="success" @click="handleUpdate(scope.row)">编辑
</el-button>
<el-button v-if="userManager_btn_del" size="small" type="danger" @click="handleDelete(scope.row)">删除
</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>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :model="form" :rules="rules" ref="form" label-width="100px">
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入姓名"></el-input>
</el-form-item>
<el-form-item label="账户" prop="username">
<!--v-if="dialogStatus == 'create'"-->
<el-input v-model="form.username" placeholder="请输入账户"></el-input>
<!--<el-input v-else v-model="form.username" placeholder="请输入账户" readonly></el-input>-->
</el-form-item>
<el-form-item v-if="dialogStatus == 'create'" label="密码" placeholder="请输入密码" prop="password">
<el-input type="password" v-model="form.password"></el-input>
</el-form-item>
<el-form-item v-if="dialogStatus == 'update'" label="密码" placeholder="请输入密码">
<el-input type="password" v-model="form.passwordEdit"></el-input>
</el-form-item>
<el-form-item label="性别">
<el-select class="filter-item" v-model="form.sex" placeholder="请选择">
<el-option v-for="item in sexOptions" :key="item" :label="item" :value="item"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="是否开启" prop="status">
<el-radio-group class="filter-item" v-model.number="form.status" >
<el-radio v-for="item in statusOptions" :key="item.val" :label="item.id">{{item.val}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="所属片区" prop="zoneId">
<el-select class="filter-item" v-model="form.zoneId" clearable placeholder="请选择" @change="getProvinceRegions">
<el-option v-for="val in getAllZoneList" :key="val.id" :label="val.name" :value="val.id"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="所属分公司" prop="companyId">
<!--<el-autocomplete-->
<!--class="inline-input"-->
<!--v-model="form.companyName"-->
<!--:fetch-suggestions="querySearch"-->
<!--placeholder="请输入内容"-->
<!--@select="handleSelectSubordinate"-->
<!--&gt;</el-autocomplete>-->
<el-select class="filter-item" v-model="form.companyId" clearable filterable placeholder="请选择分公司">
<el-option v-for="val in allBranchCompany" :key="val.id" :label="val.name" :value="val.id"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="所属角色" prop="members">
<el-autocomplete
<el-table-column width="300" align="center" label="备注">
<template slot-scope="scope">
<span>{{scope.row.description}}</span>
</template>
</el-table-column>
<el-table-column width="180" align="center" label="最后时间">
<template slot-scope="scope">
<span>{{scope.row.updTime}}</span>
</template>
</el-table-column>
<el-table-column width="200" align="center" label="最后更新人">
<template slot-scope="scope">
<span>{{scope.row.updName}}</span>
</template>
</el-table-column>-->
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
v-if="userManager_btn_edit"
size="small"
type="success"
@click="handleUpdate(scope.row)"
>编辑</el-button>
<el-button
v-if="scope.row.status==2"
size="small"
type="warning"
@click="UpdateStatus(scope.row,1)"
>启用</el-button>
<el-button
v-if="scope.row.status==1"
size="small"
type="warning"
@click="UpdateStatus(scope.row,2)"
>停用</el-button>
<el-button
v-if="userManager_btn_del"
size="small"
type="danger"
@click="handleDelete(scope.row)"
>删除</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>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :model="form" :rules="rules" ref="form" label-width="100px">
<el-form-item label="状态" prop="status">
<el-radio-group class="filter-item" v-model.number="form.status">
<el-radio v-for="item in statusOptions" :key="item.val" :label="item.id">{{item.val}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" style="width:30%" placeholder="请输入姓名"></el-input>
</el-form-item>
<el-form-item label="账户" prop="username">
<!--v-if="dialogStatus == 'create'"-->
<el-input v-model="form.username" style="width:30%" placeholder="请输入账户"></el-input>
<!--<el-input v-else v-model="form.username" placeholder="请输入账户" readonly></el-input>-->
</el-form-item>
<el-form-item
v-if="dialogStatus == 'create'"
label="密码"
placeholder="请输入密码"
prop="password"
>
<el-input type="password" style="width:30%" v-model="form.password"></el-input>
</el-form-item>
<el-form-item v-if="dialogStatus == 'update'" label="密码" placeholder="请输入密码">
<el-input type="password" style="width:30%" v-model="form.passwordEdit"></el-input>
</el-form-item>
<!--<el-form-item label="性别">
<el-select class="filter-item" v-model="form.sex" placeholder="请选择">
<el-option v-for="item in sexOptions" :key="item" :label="item" :value="item"></el-option>
</el-select>
</el-form-item>-->
<el-form-item label="所属公司" prop="corporationId">
<el-select
class="filter-item"
v-model="form.corporationId"
clearable
filterable
placeholder="请选择公司"
>
<el-option label="全部" value="0"></el-option>
<el-option v-for="val in companys_list" :key="val.id" :label="val.name" :value="val.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属门店" prop="companyId">
<el-select class="filter-item" v-model="form.companyId" clearable placeholder="请选择">
<el-option label="全部" value="0"></el-option>
<el-option
v-for="val in branchCompany_list"
:key="val.id"
:label="val.name"
:value="val.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属角色" prop="members">
<el-autocomplete
class="inline-input"
v-model="membersName"
:fetch-suggestions="querySearch"
placeholder="请选择"
@select="handleSelect2"
></el-autocomplete>
<!-- <el-select v-model="form.members" multiple filterable placeholder="请选择" :loading="loading" :remote-method="remoteGroupsMethod" remote>
<el-option
v-for="item in myGroups"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select> -->
</el-form-item>
<el-form-item label="数据权限" prop="dataState">
<!-- <el-checkbox-group v-model="form.dataLimit" >-->
<!-- &lt;!&ndash;<el-checkbox v-for="item in dataOptions" :label="item.id" >{{item.val}}</el-checkbox>&ndash;&gt;-->
<!-- <el-checkbox label="1">所属分公司</el-checkbox>-->
<!-- <el-checkbox label="2">所属片区</el-checkbox>-->
<!-- <el-checkbox label="3">所有数据</el-checkbox>-->
<!-- </el-checkbox-group>-->
<el-radio-group v-model="form.dataLimit">
<el-radio label="1">所属分公司</el-radio>
<el-radio label="2">所属片区</el-radio>
<el-radio label="3">所有数据</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="描述">
<el-input type="textarea" :autosize="{ minRows: 3, maxRows: 5}" placeholder="请输入内容"
v-model="form.description"></el-input>
<el-input
type="textarea"
:autosize="{ minRows: 3, maxRows: 5}"
placeholder="请输入内容"
v-model="form.description"
></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -125,496 +258,522 @@
</template>
<script>
import {
page,
addObj,
getObj,
delObj,
putObj
} from 'api/admin/user/index';
import { page, addObj, getObj, delObj, putObj } from "api/admin/user/index";
import {mapGetters} from 'vuex';
import { mapGetters } from "vuex";
import {
getAllCompany,
getAll
} from 'api/base_info/branch_company/';
import { getAllCompany, getAll } from "api/base_info/branch_company/";
import {
getAllZone
} from 'api/base_info/constant/';
import { getAllZone } from "api/base_info/constant/";
import {
fetchTree,
getUserGroups,
getCurrentGroups,
listAll
} from 'api/admin/group/index';
import {getAllBranchCompanyByZoneId} from "../../../api/order/rentVehicle";
import {
fetchTree,
getUserGroups,
getCurrentGroups,
listAll,
} from "api/admin/group/index";
import { getAllBranchCompanyByZoneId } from "../../../api/order/rentVehicle";
import { company_all_list, branchCompany_all_list } from "api/company.js";
export default {
name: 'user',
data() {
return {
membersName: '',//角色
form: {
username: undefined,
name: undefined,
sex: '男',
status: 1,
zoneId: undefined,//所属片区
companyId: undefined,//所属分公司id
companyName: "",//所属公司
state2: '',
password: undefined,
passwordEdit: undefined,
description: undefined,
// dataLimit: [],//数据权限
dataLimit: undefined,//数据权限
members: [],
},
editCompanyId: undefined,//编辑时公司id
baranchQuery: {
zoneId: null
},
rules: {
name: [
{
required: true,
message: '请输入用户',
trigger: 'blur'
},
{
min: 3,
max: 20,
message: '长度在 3 到 20 个字符',
trigger: 'blur'
}
],
username: [
{
required: true,
message: '请输入账户',
trigger: 'blur'
},
{
min: 3,
max: 20,
message: '长度在 3 到 20 个字符',
trigger: 'blur'
}
],
password: [
{
required: true,
message: '请输入密码',
trigger: 'blur'
},
{
min: 5,
max: 20,
message: '长度在 5 到 20 个字符',
trigger: 'blur'
}
],
status: [
{
type: 'integer',
required: true,
message: '请选择',
trigger: 'blur'
}
],
zoneId: {
export default {
name: "user",
data() {
return {
membersName: "", //角色
form: {
username: undefined,
name: undefined,
sex: "男",
status: 1,
corporationId: undefined, //所属公司id
companyId: undefined, //所属门店id
companyName: "", //所属公司
state2: "",
password: undefined,
passwordEdit: undefined,
description: undefined,
// dataLimit: [],//数据权限
dataLimit: undefined, //数据权限
members: [],
},
editCompanyId: undefined, //编辑时公司id
baranchQuery: {
zoneId: null,
},
rules: {
name: [
{
required: true,
message: "请输入用户",
trigger: "blur",
},
{
min: 3,
max: 20,
message: "长度在 3 到 20 个字符",
trigger: "blur",
},
],
username: [
{
required: true,
message: '请选择所属片区',
message: "请输入账户",
trigger: "blur",
},
companyId: {
{
min: 3,
max: 20,
message: "长度在 3 到 20 个字符",
trigger: "blur",
},
],
password: [
{
required: true,
message: '请选择所属分公司',
message: "请输入密码",
trigger: "blur",
},
// members:{
// type: 'array',
// required: true,
// message: '请选择角色'
// }
},
list: null,
total: null,
listLoading: true,
listQuery: {
page: 1,
limit: 20,
name: undefined,
username:undefined
{
min: 5,
max: 20,
message: "长度在 5 到 20 个字符",
trigger: "blur",
},
],
status: [
{
type: "integer",
required: true,
message: "请选择",
trigger: "blur",
},
],
corporationId: {
required: true,
message: "请选择所属公司",
},
sexOptions: ['男', '女'],
zoneOptions: ['男', '女'],
dataOptions: [{id: "1", val: "所属分公司"}, {id: "2", val: "所属片区"}, {id: "3", val: "所有数据"}],
statusOptions: [{id: 1, val: '开启'}, {id: 2, val: '禁用'}],
dialogFormVisible: false,
dialogStatus: '',
userManager_btn_edit: false,
userManager_btn_del: false,
userManager_btn_add: false,
allCompanies: {},
allCompaniesArr: [],
myGroups: [],//角色列表
loading: false,
textMap: {
update: '编辑',
create: '创建'
companyId: {
required: true,
message: "请选择所属门店",
},
tableKey: 0,
allBranchCompany: [],//所有分公司列表
list_All: []
// members:{
// type: 'array',
// required: true,
// message: '请选择角色'
// }
},
list: null,
total: null,
listLoading: true,
listQuery: {
page: 1,
limit: 20,
name: undefined,
corporationId: undefined,
companyId: undefined,
username: undefined,
},
sexOptions: ["男", "女"],
zoneOptions: ["男", "女"],
dataOptions: [
{ id: "1", val: "所属分公司" },
{ id: "2", val: "所属片区" },
{ id: "3", val: "所有数据" },
],
statusOptions: [
{ id: 1, val: "启用" },
{ id: 2, val: "停用" },
],
dialogFormVisible: false,
dialogStatus: "",
userManager_btn_edit: false,
userManager_btn_del: false,
userManager_btn_add: false,
allCompanies: {},
allCompaniesArr: [],
myGroups: [], //角色列表
loading: false,
textMap: {
update: "编辑",
create: "创建",
},
tableKey: 0,
allBranchCompany: [], //所有分公司列表
list_All: [],
companys_list: [],
branchCompany_list: [],
edit_item: {},
};
},
created() {
this.getList();
// getAll().then((response) => {
// this.allCompaniesArr = response.data;
// this.allBranchCompany = response.data;
// });
// getAllCompany((codeAndBranchCompany) => {
// this.allCompanies = codeAndBranchCompany;
// });
listAll().then((response) => {
this.list_All = response;
});
this.remoteGroupsMethod("");
// getCurrentGroups().then(result => {
// this.myGroups = result.data;
// const mems = [];
// for (let i = 0; i < result.data.length; i++) {
// mems.push(result.data[i].id);
// }
// this.members = mems;
// });
this.userManager_btn_edit = this.elements["userManager:btn_edit"];
this.userManager_btn_del = this.elements["userManager:btn_del"];
this.userManager_btn_add = this.elements["userManager:btn_add"];
this.get_all_companys();
this.get_all_branchCompany();
},
computed: {
...mapGetters(["elements"]),
getAllZoneList() {
// console.log('getAllZoneList')
let allZone = getAllZone();
this.allZoneArr = allZone;
return allZone;
},
},
methods: {
//所有公司
get_all_companys() {
company_all_list().then((res) => {
if (res.status == 200) {
this.companys_list = res.data;
}
});
},
//所有门店
get_all_branchCompany() {
branchCompany_all_list({ state: 1 }).then((res) => {
if (res.status == 200) {
this.branchCompany_list = res.data;
}
});
},
getAllZone,
remoteGroupsMethod(query) {
// if (query !== '') {
this.loading = true;
this.loading = false;
fetchTree({
name: query,
}).then((response) => {
this.myGroups = response;
// this.total = response.data.total;
this.loading = false;
});
// } else {
// this.myGroups = [];
// }
},
/**
* 所属分公司
* */
handleSelectSubordinate(item) {
this.form.companyId = item.id;
this.form.companyName = item.name;
},
// 角色
handleSelect2(item) {
this.form.members = [];
this.form.members.push(item.id);
},
/**
* 获取后台用户管理列表数据
* */
getList() {
this.listLoading = true;
this.listQuery.username = this.listQuery.name;
if (this.listQuery.corporationId == "0") {
this.listQuery.corporationId = undefined;
}
if (this.listQuery.companyId == "0") {
this.listQuery.companyId = undefined;
}
page(this.listQuery).then((response) => {
this.list = response.data.rows;
this.total = response.data.total;
this.listLoading = false;
});
},
handleFilter() {
this.getList();
},
handleSizeChange(val) {
this.listQuery.limit = val;
this.getList();
},
created() {
handleCurrentChange(val) {
this.listQuery.page = val;
this.getList();
getAll()
.then(response => {
this.allCompaniesArr = response.data;
this.allBranchCompany= response.data;
})
getAllCompany(codeAndBranchCompany => {
this.allCompanies = codeAndBranchCompany;
},
handleCreate() {
this.resetTemp();
// this.getGroups()
this.dialogStatus = "create";
this.dialogFormVisible = true;
},
UpdateStatus(row, status) {
console.log(row);
putObj(row.id, {
id: row.id,
status: status,
username: row.username,
}).then((response) => {
if (response.status == 200) {
this.$notify({
title: "成功",
message: "编辑成功",
type: "success",
duration: 2000,
});
} else {
this.$notify({
title: "失败",
message: response.message,
type: "error",
duration: 2000,
});
}
this.getList();
});
listAll().then(response => {
this.list_All = response;
})
this.remoteGroupsMethod('');
// getCurrentGroups().then(result => {
// this.myGroups = result.data;
// const mems = [];
// for (let i = 0; i < result.data.length; i++) {
// mems.push(result.data[i].id);
// }
// this.members = mems;
// });
this.userManager_btn_edit = this.elements['userManager:btn_edit'];
this.userManager_btn_del = this.elements['userManager:btn_del'];
this.userManager_btn_add = this.elements['userManager:btn_add'];
},
computed: {
...mapGetters([
'elements'
]),
getAllZoneList() {
// console.log('getAllZoneList')
let allZone = getAllZone();
this.allZoneArr = allZone ;
return allZone;
},
/**
* 编辑后台账号
* */
handleUpdate(row) {
this.form = {
id: row.id,
username: row.username,
name: row.name,
sex: row.sex,
status: row.status,
corporationId: row.corporationId, //所属公司id
companyId: row.companyId, //所属门店id
companyName: row.companyName, //所属公司
state2: "",
password: undefined,
passwordEdit: undefined,
description: row.description,
// dataLimit: [],//数据权限
dataLimit: undefined, //数据权限
members: [],
};
this.membersName = row.groupStr;
this.list_All.forEach((item) => {
if (item.name == row.groupStr) {
this.form.members = [];
this.form.members.push(item.id);
}
});
// membersName
this.dialogStatus = "update";
this.dialogFormVisible = true;
},
methods: {
getAllZone,
remoteGroupsMethod(query) {
// if (query !== '') {
this.loading = true;
this.loading = false;
fetchTree({
name: query
}).then(response => {
this.myGroups = response;
// this.total = response.data.total;
this.loading = false;
// changeMembers(){debugger
// this.$set(this.form, "members", this.form.members)
// },
handleDelete(row) {
this.$confirm("此操作将永久删除, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delObj(row.id).then(() => {
this.$notify({
title: "成功",
message: "删除成功",
type: "success",
duration: 2000,
});
const index = this.list.indexOf(row);
this.list.splice(index, 1);
});
// } else {
// this.myGroups = [];
// }
},
/**
* 所属分公司
* */
handleSelectSubordinate(item) {
});
},
/**
* 创建后台账号
* */
create(formName) {
const set = this.$refs;
set[formName].validate((valid) => {
if (valid) {
if (this.form.corporationId == "0") {
this.form.corporationId = undefined;
} else {
this.form.dataCorporation = this.form.corporationId;
}
if (this.form.companyId == "0") {
this.form.companyId = undefined;
} else {
this.form.dataCompany = this.form.companyId;
}
if (
this.form.corporationId == undefined &&
this.form.companyId == undefined
) {
this.form.dataAll = 1;
}
this.form.companyId = item.id;
this.form.companyName = item.name;
},
// 角色
handleSelect2(item) {
this.form.members=[]
this.form.members.push(item.id);
},
/**
* 获取后台用户管理列表数据
* */
getList() {
this.listLoading = true;
this.listQuery.username=this.listQuery.name
page(this.listQuery)
.then(response => {
this.list = response.data.rows;
this.total = response.data.total;
this.listLoading = false;
})
},
handleFilter() {
this.getList();
},
handleSizeChange(val) {
this.listQuery.limit = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.page = val;
this.getList();
},
handleCreate() {
this.resetTemp();
// this.getGroups()
this.dialogStatus = 'create';
this.dialogFormVisible = true;
},
/**
* 编辑后台账号
* */
handleUpdate(row) {
this.resetTemp();
if (row.zoneId) {
getAllBranchCompanyByZoneId({zoneId: row.zoneId})
.then(res => {
this.allBranchCompany = res.data;
getObj(row.id).then(response => {
this.form.id = response.data.id;
this.editCompanyId = response.data.companyId,//所属分公司id
this.form.username = response.data.username,
this.form.name = response.data.name,
this.form.sex = response.data.sex,
this.form.status = response.data.status,
this.form.zoneId = response.data.zoneId,//所属片区
this.form.companyId = response.data.companyId,//所属分公司id
this.form.description = response.data.description
// let dataLimit = [];
let dataLimit = undefined;
if (response.data.dataCompany) {
let companys = response.data.dataCompany.split(",");
if (companys.includes(response.data.companyId + "")) {
// dataLimit.push("1");
dataLimit = '1'
}
}
if (response.data.dataZone) {
let zones = response.data.dataZone.split(",");
if (zones.includes(response.data.zoneId + "")) {
// dataLimit.push("2");
dataLimit = '2'
}
}
if (response.data.dataAll && response.data.dataAll == 1) {
// dataLimit.push("3");
dataLimit = '3'
}
let mems = [];
for (let i = 1; i < 10; i++) {
this.myGroups.push({name: "q" + i, id: i});
}
this.$set(this.form, "dataLimit", dataLimit);
// console.log(JSON.stringify(this.form))
getUserGroups(response.data.id).then(result => {
if (result.data) {
this.myGroups = result.data;
for (let i = 0; i < result.data.length; i++) {
mems.push(result.data[i].id);
}
this.membersName = result.data[0].name
this.$set(this.form, "members", mems)
}
});
this.dialogFormVisible = true;
this.dialogStatus = 'update';
// console.log(this.form);
// console.log(JSON.stringify(this.form))
addObj(this.form).then((response) => {
if (response.status == 200) {
this.$notify({
title: "成功",
message: "添加成功",
type: "success",
duration: 2000,
});
});
} else {
this.dialogFormVisible = true;
this.dialogStatus = 'update';
}
},
// changeMembers(){debugger
// this.$set(this.form, "members", this.form.members)
// },
handleDelete(row) {
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
delObj(row.id)
.then(() => {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
});
const index = this.list.indexOf(row);
this.list.splice(index, 1);
} else {
this.$notify({
title: "失败",
message: response.message,
type: "error",
duration: 2000,
});
}
this.dialogFormVisible = false;
this.getList();
});
},
/**
* 创建后台账号
* */
create(formName) {
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
addObj(this.form)
.then(response => {
console.log(response)
if(response.status == 200) {
this.$notify({
title: '成功',
message: "添加成功",
type: 'success',
duration: 2000
});
} else {
this.$notify({
title: '失败',
message: response.message,
type: 'error',
duration: 2000
});
}
this.dialogFormVisible = false;
this.getList();
})
} else {
return false;
}
});
},
cancel(formName) {
this.dialogFormVisible = false;
this.$refs[formName].resetFields();
},
querySearch(queryString, cb) {
let selectArry = [];
this.list_All.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);
},
createFilter(queryString) {
return (restaurant) => {
return restaurant.name.indexOf(queryString.toLowerCase()) != -1;
};
},
update(formName) {
const set = this.$refs;
set[formName].validate((valid) => {
if (valid) {
this.dialogFormVisible = false;
if (this.form.passwordEdit) {
this.form.password = this.form.passwordEdit;
this.form.passwordEdit = undefined;
} else {
return false;
this.form.password = undefined;
}
});
},
cancel(formName) {
this.dialogFormVisible = false;
this.$refs[formName].resetFields();
},
querySearch(queryString, cb) {
let selectArry = [];
this.list_All.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);
},
createFilter(queryString) {
return (restaurant) => {
return (restaurant.name.indexOf(queryString.toLowerCase()) != -1);
};
},
update(formName) {
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
this.dialogFormVisible = false;
if (this.form.passwordEdit) {
this.form.password = this.form.passwordEdit;
this.form.passwordEdit = undefined;
putObj(this.form.id, this.form).then((response) => {
if (response.status == 200) {
this.$notify({
title: "成功",
message: "编辑成功",
type: "success",
duration: 2000,
});
} else {
this.form.password = undefined;
this.$notify({
title: "失败",
message: response.message,
type: "error",
duration: 2000,
});
}
putObj(this.form.id, this.form).then(response => {
if(response.status == 200) {
this.$notify({
title: '成功',
message: '编辑成功',
type: 'success',
duration: 2000
});
} else {
this.$notify({
title: '失败',
message: response.message,
type: 'error',
duration: 2000
});
}
this.dialogFormVisible = false;
this.getList();
this.form.password = undefined;
});
} else {
return false;
this.dialogFormVisible = false;
this.getList();
this.form.password = undefined;
});
} else {
return false;
}
});
},
/**
* 所属片区改变事件
* @param item
*/
getProvinceRegions(item) {
this.form.zoneId = item;
this.form.companyId = undefined; //片区修改后所属公司联动
this.baranchQuery.zoneId = item;
if (this.baranchQuery.zoneId) {
getAllBranchCompanyByZoneId(this.baranchQuery).then((response) => {
this.allBranchCompany = response.data;
if (this.editCompanyId) {
this.form.companyId = this.editCompanyId;
this.editCompanyId = undefined;
}
});
},
/**
* 所属片区改变事件
* @param item
*/
getProvinceRegions(item) {
this.form.zoneId = item;
this.form.companyId = undefined;//片区修改后所属公司联动
this.baranchQuery.zoneId = item;
if (this.baranchQuery.zoneId) {
getAllBranchCompanyByZoneId(this.baranchQuery)
.then(response => {
this.allBranchCompany = response.data;
if (this.editCompanyId) {
this.form.companyId = this.editCompanyId;
this.editCompanyId = undefined;
}
})
}
},
resetTemp() {
this.membersName = undefined;
this.editCompanyId = undefined;
this.form = {
username: undefined,
name: undefined,
sex: '男',
status: 1,
zoneId: undefined,//所属片区
companyId: undefined,//所属分公司id
companyName: "",//所属公司
state2: '',
password: undefined,
passwordEdit: undefined,
description: undefined,
// dataLimit: [],//数据权限
dataLimit: undefined,//数据权限
members: [],
};
}
},
resetTemp() {
this.membersName = undefined;
this.editCompanyId = undefined;
this.form = {
username: undefined,
name: undefined,
sex: "男",
status: 1,
corporationId: undefined, //所属公司id
companyId: undefined, //所属门店id
companyName: "", //所属公司
state2: "",
password: undefined,
passwordEdit: undefined,
description: undefined,
// dataLimit: [],//数据权限
dataLimit: undefined, //数据权限
members: [],
};
// this.form = {
// username: undefined,
// name: undefined,
// status: 1,
// sex: '男',
// zoneId: undefined,
// passwordEdit:undefined,
// companyId: undefined,
// password: "",
// description: undefined,
// dataLimit: [],
// members: [],
// };
},
// initGroups() {
// getUsers(this.groupId).then(response => {
// this.lItems = response.data.leaders;
// this.mItems = response.data.members;
// const mems = [], leas = [];
// for (let i = 0; i < response.data.members.length; i++) {
// mems.push(response.data.members[i].id);
// }
// for (let i = 0; i < response.data.leaders.length; i++) {
// leas.push(response.data.leaders[i].id);
// }
// this.members = mems;
// this.leaders = leas;
// });
// }
}
}
// this.form = {
// username: undefined,
// name: undefined,
// status: 1,
// sex: '男',
// zoneId: undefined,
// passwordEdit:undefined,
// companyId: undefined,
// password: "",
// description: undefined,
// dataLimit: [],
// members: [],
// };
},
// initGroups() {
// getUsers(this.groupId).then(response => {
// this.lItems = response.data.leaders;
// this.mItems = response.data.members;
// const mems = [], leas = [];
// for (let i = 0; i < response.data.members.length; i++) {
// mems.push(response.data.members[i].id);
// }
// for (let i = 0; i < response.data.leaders.length; i++) {
// leas.push(response.data.leaders[i].id);
// }
// this.members = mems;
// this.leaders = leas;
// });
// }
},
};
</script>
......@@ -659,9 +659,11 @@ export default {
var addComp = rs.addressComponents;
_this.store_form.province = rs.addressComponents.province;
_this.store_form.city = rs.addressComponents.city;
_this.store_form.detail_address =
rs.addressComponents.street + rs.addressComponents.streetNumber;
// _this.listQuery.address = rs.address;
if (rs.addressComponents && rs.addressComponents != "") {
_this.store_form.detail_address =
rs.addressComponents.street + rs.addressComponents.streetNumber;
// _this.listQuery.address = rs.address;
}
});
this.store_form.longitude = e.point.lng;
this.store_form.latitude = e.point.lat;
......
......@@ -2,38 +2,93 @@
<div class="app-container calendar-list-container" v-loading.body="showLoadingBody">
<div v-if="!oneTourDialogVisible">
<div class="filter-container" ref="filter-container">
<el-form :rules="rules4Query" ref="queryForm" :inline="inline" :model="listQuery" label-width="100px">
<el-form
:rules="rules4Query"
ref="queryForm"
:inline="inline"
:model="listQuery"
label-width="100px"
>
<el-row>
<el-col :span="8">
<el-col :span="5">
<el-form-item label="旅行名称">
<el-input v-model.number="listQuery.name" placeholder="请输入旅行名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="5">
<el-form-item label="标签">
<el-select class="filter-item" v-model="listQuery.tagId" placeholder="请选择标签">
<el-option :key="undefined" label="无" :value="undefined"></el-option>
<el-option v-for="val in allLabelList" :key="val.id" :label="val.name"
:value="val.id"></el-option>
<el-option :key="undefined" label="全部" :value="undefined"></el-option>
<el-option
v-for="val in allLabelList"
:key="val.id"
:label="val.name"
:value="val.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="所属公司">
<el-select
class="filter-item"
v-model="listQuery.corporationId"
clearable
filterable
placeholder="请选择公司"
>
<el-option label="全部" :key="undefined" :value="undefined"></el-option>
<el-option
v-for="val in companys_list"
:key="val.id"
:label="val.name"
:value="val.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="所属门店">
<el-select
class="filter-item"
v-model="listQuery.companyId"
clearable
placeholder="请选择"
>
<el-option label="全部" :key="undefined" :value="undefined"></el-option>
<el-option
v-for="val in branchCompany_list"
:key="val.id"
:label="val.name"
:value="val.id"
></el-option>
</el-select>
</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" v-if="good_btn_add">添加
</el-button>
<el-button
class="filter-item"
type="primary"
v-waves
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button>
<el-button class="filter-item" v-waves @click="clear_handleFilter">清除搜索</el-button>
<el-button
class="filter-item"
style="margin-left: 10px;"
@click="handleCreate"
type="primary"
icon="el-icon-edit"
v-if="good_btn_add"
>添加</el-button>
</div>
<el-table :key='tableKey' :data="list" border fit highlight-current-row
style="width: 100%">
<el-table-column
type="index"
align="center" label="序号" width="65">
</el-table-column>
<el-table :key="tableKey" :data="list" border fit highlight-current-row style="width: 100%">
<el-table-column type="index" align="center" label="序号" width="65"></el-table-column>
<el-table-column width="666" align="center" label="旅行名称/价格">
<template slot-scope="scope">
<img :src="scope.row.cover" style="width: 30px;"/>
<img :src="scope.row.cover" style="width: 30px;" />
<span>{{scope.row.name}}{{scope.row.price}}/{{scope.row.unit}}</span>
</template>
</el-table-column>
......@@ -57,970 +112,1168 @@
</el-table-column>
<el-table-column align="center" width="150" label="操作">
<template slot-scope="scope">
<el-button size="small" class="el-button el-button--text el-button--small" @click="handleUpdate(scope.row)">{{good_btn_update?'编辑':'查看'}}
</el-button>
<el-button size="small" class="el-button el-button--text el-button--small" style="color: #6ce26c;" v-if="(scope.row.status==2&&good_btn_upstatus)||(scope.row.status==0&&good_btn_upstatus)" @click="upStatus(scope.row)">上架
</el-button>
<el-button size="small" class="el-button el-button--text el-button--small" style="color: #1d90e6" v-if="scope.row.status==1&&good_btn_upstatus" @click="upStatus(scope.row)">下架
</el-button>
<el-button class="el-button el-button--text el-button--small" style="color:red;" size="small" @click="deleteHandler(scope.row)" v-if="good_btn_del">删除</el-button>
<el-button
size="small"
class="el-button el-button--text el-button--small"
@click="handleUpdate(scope.row)"
>{{good_btn_update?'编辑':'查看'}}</el-button>
<el-button
size="small"
class="el-button el-button--text el-button--small"
style="color: #6ce26c;"
v-if="(scope.row.status==2&&good_btn_upstatus)||(scope.row.status==0&&good_btn_upstatus)"
@click="upStatus(scope.row)"
>上架</el-button>
<el-button
size="small"
class="el-button el-button--text el-button--small"
style="color: #1d90e6"
v-if="scope.row.status==1&&good_btn_upstatus"
@click="upStatus(scope.row)"
>下架</el-button>
<el-button
class="el-button el-button--text el-button--small"
style="color:red;"
size="small"
@click="deleteHandler(scope.row)"
v-if="good_btn_del"
>删除</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>
<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弹窗 -->
<oneTour v-if="oneTourDialogVisible" :oneTourRow="oneTourRow" :good_btn_update="good_btn_update" :title="modalTitle" v-on:oneTourDialogEvent = "oneTourDialogEvent"></oneTour>
<oneTour
v-if="oneTourDialogVisible"
:oneTourRow="oneTourRow"
:good_btn_update="good_btn_update"
:title="modalTitle"
v-on:oneTourDialogEvent="oneTourDialogEvent"
></oneTour>
</div>
</template>
<script>
import oneTour from './modal/oneTourModal'// 旅游
import 'static/css/uploadImg.css';// 引入图片上传组件对话框
import oneTour from "./modal/oneTourModal"; // 旅游
import "static/css/uploadImg.css"; // 引入图片上传组件对话框
import {
formatDate
} from 'utils/dateFormattor';
import { formatDate } from "utils/dateFormattor";
import { company_all_list, branchCompany_all_list } from "api/company.js";
import {
toEast8Date,
deepCopyDate,
newEast8Date,
convertDate2Str
} from 'utils/dateUtils';
import {
toEast8Date,
deepCopyDate,
newEast8Date,
convertDate2Str,
} from "utils/dateUtils";
import rsCode from '../../utils/rsCode';
import rsCode from "../../utils/rsCode";
import {mapGetters} from 'vuex';
import {
getToken
} from 'utils/auth';
import { mapGetters } from "vuex";
import { getToken } from "utils/auth";
import {
page,
goodsEdit,
getAllTourTag,
goodDel,
upStatusChange
} from 'api/tourManage';
import {
page,
goodsEdit,
getAllTourTag,
goodDel,
upStatusChange,
} from "api/tourManage";
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";
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,
oneTour
},
data() {
return {
modalTitle: "创建",
BASE_API: process.env.BASE_API,
oneTourDialogVisible: false,//添加、编辑弹框
showLoadingBody: false,
form: {
tagNames:"",//标签
name: undefined,//旅游名称
saleCount: undefined,//销量
stock: undefined,//总数量
},
allLabelList:[],//全部标签
rules: {
subordinateBranch: [
{
type: 'integer',
required: true,
message: '请选择公司',
trigger: 'blur'
}
],
maintenanceMileage: [this.integerValidator()],
code: [
{
validator: (rule, value, callback) => {
if (this.$utils.isUndefined(value) || this.$utils.isNull(value)) {
return callback();
}
if (!this.$utils.isInteger(value)) {
return callback(new Error('编码必须为整数'));
}
if (value < 1 || value > 9999999999) {
return callback(new Error('编码合法范围:[1 - 9999999999]'));
}
callback();
},
trigger: 'blur'
}
],
vin: [
{
min: 0,
max: 200,
message: '长度小于 200 个字符',
trigger: 'blur'
}
],
numberPlate: [
{
min: 0,
max: 20,
message: '长度小于 20 个字符',
trigger: 'blur'
}
],
remark: [
{
min: 0,
max: 2000,
message: '长度小于 2000 个字符',
trigger: 'blur'
}
]
},
pickerOptions4Apply: {
disabledDate: this.checkBookDate
},
rules4Query: {
vin: [
{
min: 0,
max: 200,
message: '长度小于 200 个字符',
trigger: 'blur'
}
],
subordinateBranch: [
{
validator: (rule, value, callback) => {
if ((this.$utils.isString(this.listQuery.bookedStartDate) && this.listQuery.bookedStartDate !== '') ||
(this.$utils.isString(this.listQuery.bookedEndDate) && this.listQuery.bookedEndDate !== '') ||
(this.$utils.isString(this.listQuery.notBookedStartDate) && this.listQuery.notBookedStartDate !== '') ||
(this.$utils.isString(this.listQuery.notBookedEndDate) && this.listQuery.notBookedEndDate !== '')) {
if (!this.listQuery.subordinateBranch) {
return callback(new Error('若需按预定日期查询车辆,选择分公司'));
}
}
callback();
},
trigger: 'blur'
}
],
notBookDateRange: [
{
validator: (rule, value, callback) => {
if (this.notBookDateRange) {
let startDate = toEast8Date(this.listQuery.notBookedStartDate);
let endDate = toEast8Date(this.listQuery.notBookedEndDate);
if (this.$utils.isDate(startDate) && startDate.setMonth(startDate.getMonth() + 2) < endDate) {
return callback(new Error('日期范围不能超过2个月'));
}
}
callback();
},
trigger: 'blur'
}
],
bookDateRange: [
{
validator: (rule, value, callback) => {
if (this.bookDateRange) {
let startDate = toEast8Date(this.listQuery.bookedStartDate);
let endDate = toEast8Date(this.listQuery.bookedEndDate);
if (this.$utils.isDate(startDate) && startDate.setMonth(startDate.getMonth() + 2) < endDate) {
return callback(new Error('日期范围不能超过2个月'));
}
}
callback();
},
trigger: 'blur'
}
]
},
rules4Apply: {
bookDateRange4Apply: [
{
validator: (rule, value, callback) => {
if (!this.$utils.isArray(this.bookDateRange4Apply) || this.bookDateRange4Apply.length === 0) {
return callback(new Error('请输入预定时间。'));
}
let [oriStartDate, ortEndDate] = this.bookDateRange4Apply;
if (!this.$utils.isDate(oriStartDate) || !this.$utils.isDate(ortEndDate)) {
return callback(new Error('请输入预定时间。'));
}
let [startDate, endDate] = [deepCopyDate(oriStartDate), deepCopyDate(ortEndDate)];
if (!this.$utils.isDate(oriStartDate) || !this.$utils.isDate(ortEndDate)) {
return callback();
}
for (let curDate = startDate; curDate <= endDate; curDate.setDate(curDate.getDate() + 1)) {
if (this.checkBookDate(curDate)) {
return callback(new Error('请选择从今天起两个月内,未预定的时间。'));
}
}
callback();
},
required: true,
trigger: 'blur'
}
],
liftCompany: [
{
required: true,
message: '请选择提车分公司',
trigger: 'blur',
type: 'integer'
}
],
retCompany: [
{
required: true,
message: '请选择还车分公司',
trigger: 'blur',
type: 'integer'
}
],
destination: [
{
min: 0,
max: 200,
message: '长度小于 200 个字符',
trigger: 'blur'
}
],
remark: [
{
min: 0,
max: 2000,
message: '长度小于 2000 个字符',
trigger: 'blur'
}
]
},
selectArry:[],
list: null,
total: null,
listLoading: true,
listQuery: {
page: 1,
limit: 20,
tagId: undefined,
name: '',//关键词
},
inline: true,
tourManage_btn_edit: false,//编辑
tourManage_btn_add: false,//添加
vehicleInfo_btn_apply: false,
allCompanies: {},
allCompaniesArr: [],
textMap: {
update: '编辑',
create: '创建'
},
tableKey: 0,
departureDialogVisible: false,
arrivalDialogVisible: false,
good_btn_add: false,//旅游添加
good_btn_update: false,//旅游编辑
good_btn_upstatus: false,//旅游上下架
good_btn_del: false,//旅游删除
}
},
created() {
this.getList();
this.getAllLabelList();//获取全部标签
this.good_btn_add=this.elements['good:btn_add'];//旅游添加
this.good_btn_update=this.elements['good:btn_update'];//旅游编辑
this.good_btn_upstatus=this.elements['good:btn_upstatus'];//旅游上下架
this.good_btn_del=this.elements['good:btn_del'];//旅游删除
},
computed: {
...mapGetters([
'elements',
'belong2Type',
'vehicleStatus'
]),
provinceRegions() {
return getSonRegionByCodes(1);
},
cityRegions() {
if (!this.$utils.isInteger(this.form.addrProvince)) {
return null;
}
return getSonRegionByCodes(this.form.addrProvince);
export default {
name: "tourManage",
components: {
ElCol,
ElRow,
Element1,
oneTour,
},
data() {
return {
modalTitle: "创建",
BASE_API: process.env.BASE_API,
oneTourDialogVisible: false, //添加、编辑弹框
showLoadingBody: false,
form: {
tagNames: "", //标签
name: undefined, //旅游名称
saleCount: undefined, //销量
stock: undefined, //总数量
},
townRegions() {
if (!this.$utils.isInteger(this.form.addrCity)) {
return null;
}
return getSonRegionByCodes(this.form.addrCity);
allLabelList: [], //全部标签
rules: {
subordinateBranch: [
{
type: "integer",
required: true,
message: "请选择公司",
trigger: "blur",
},
],
maintenanceMileage: [this.integerValidator()],
code: [
{
validator: (rule, value, callback) => {
if (this.$utils.isUndefined(value) || this.$utils.isNull(value)) {
return callback();
}
if (!this.$utils.isInteger(value)) {
return callback(new Error("编码必须为整数"));
}
if (value < 1 || value > 9999999999) {
return callback(new Error("编码合法范围:[1 - 9999999999]"));
}
callback();
},
trigger: "blur",
},
],
vin: [
{
min: 0,
max: 200,
message: "长度小于 200 个字符",
trigger: "blur",
},
],
numberPlate: [
{
min: 0,
max: 20,
message: "长度小于 20 个字符",
trigger: "blur",
},
],
remark: [
{
min: 0,
max: 2000,
message: "长度小于 2000 个字符",
trigger: "blur",
},
],
},
cityRegions4Query() {
if (!this.$utils.isInteger(this.listQuery.addrProvince)) {
return null;
}
return getSonRegionByCodes(this.listQuery.addrProvince);
pickerOptions4Apply: {
disabledDate: this.checkBookDate,
},
townRegions4Query() {
if (!this.$utils.isInteger(this.listQuery.addrCity)) {
return null;
}
return getSonRegionByCodes(this.listQuery.addrCity);
rules4Query: {
vin: [
{
min: 0,
max: 200,
message: "长度小于 200 个字符",
trigger: "blur",
},
],
subordinateBranch: [
{
validator: (rule, value, callback) => {
if (
(this.$utils.isString(this.listQuery.bookedStartDate) &&
this.listQuery.bookedStartDate !== "") ||
(this.$utils.isString(this.listQuery.bookedEndDate) &&
this.listQuery.bookedEndDate !== "") ||
(this.$utils.isString(this.listQuery.notBookedStartDate) &&
this.listQuery.notBookedStartDate !== "") ||
(this.$utils.isString(this.listQuery.notBookedEndDate) &&
this.listQuery.notBookedEndDate !== "")
) {
if (!this.listQuery.subordinateBranch) {
return callback(
new Error("若需按预定日期查询车辆,选择分公司")
);
}
}
callback();
},
trigger: "blur",
},
],
notBookDateRange: [
{
validator: (rule, value, callback) => {
if (this.notBookDateRange) {
let startDate = toEast8Date(this.listQuery.notBookedStartDate);
let endDate = toEast8Date(this.listQuery.notBookedEndDate);
if (
this.$utils.isDate(startDate) &&
startDate.setMonth(startDate.getMonth() + 2) < endDate
) {
return callback(new Error("日期范围不能超过2个月"));
}
}
callback();
},
trigger: "blur",
},
],
bookDateRange: [
{
validator: (rule, value, callback) => {
if (this.bookDateRange) {
let startDate = toEast8Date(this.listQuery.bookedStartDate);
let endDate = toEast8Date(this.listQuery.bookedEndDate);
if (
this.$utils.isDate(startDate) &&
startDate.setMonth(startDate.getMonth() + 2) < endDate
) {
return callback(new Error("日期范围不能超过2个月"));
}
}
callback();
},
trigger: "blur",
},
],
},
getHeaderWithToken() {
return {Authorization: getToken()};
rules4Apply: {
bookDateRange4Apply: [
{
validator: (rule, value, callback) => {
if (
!this.$utils.isArray(this.bookDateRange4Apply) ||
this.bookDateRange4Apply.length === 0
) {
return callback(new Error("请输入预定时间。"));
}
let [oriStartDate, ortEndDate] = this.bookDateRange4Apply;
if (
!this.$utils.isDate(oriStartDate) ||
!this.$utils.isDate(ortEndDate)
) {
return callback(new Error("请输入预定时间。"));
}
let [startDate, endDate] = [
deepCopyDate(oriStartDate),
deepCopyDate(ortEndDate),
];
if (
!this.$utils.isDate(oriStartDate) ||
!this.$utils.isDate(ortEndDate)
) {
return callback();
}
for (
let curDate = startDate;
curDate <= endDate;
curDate.setDate(curDate.getDate() + 1)
) {
if (this.checkBookDate(curDate)) {
return callback(
new Error("请选择从今天起两个月内,未预定的时间。")
);
}
}
callback();
},
required: true,
trigger: "blur",
},
],
liftCompany: [
{
required: true,
message: "请选择提车分公司",
trigger: "blur",
type: "integer",
},
],
retCompany: [
{
required: true,
message: "请选择还车分公司",
trigger: "blur",
type: "integer",
},
],
destination: [
{
min: 0,
max: 200,
message: "长度小于 200 个字符",
trigger: "blur",
},
],
remark: [
{
min: 0,
max: 2000,
message: "长度小于 2000 个字符",
trigger: "blur",
},
],
},
getSelectedAccItemStr() {
if (!this.$utils.isEmpty(this.form4Apply.selectedAccItem)) {
let rsStr = '';
for (let key in this.form4Apply.selectedAccItem) {
rsStr = rsStr + this.$refs.accItemSelector.getNameById(key) + ' : ' + this.form4Apply.selectedAccItem[key] + '\n';
}
return rsStr;
}
return '';
selectArry: [],
list: null,
total: null,
listLoading: true,
listQuery: {
page: 1,
limit: 20,
tagId: undefined,
corporationId: undefined,
companyId: undefined,
name: "", //关键词
},
getUnkownBrandCode: () => VEHICLE_CONSTANT_BRAND_CODE_UNKOWN,
getCurBookedInfo: function () {
if (!this.$utils.isEmpty(this.curBookedInfo3Month) && this.curBookedInfo3Month.length > 0) {
let rs = {};
for (let index in this.curBookedInfo3Month) {
rs[this.curBookedInfo3Month[index].yearMonth] = this.curBookedInfo3Month[index].bookedDate;
}
return rs;
}
return undefined;
inline: true,
tourManage_btn_edit: false, //编辑
tourManage_btn_add: false, //添加
vehicleInfo_btn_apply: false,
allCompanies: {},
allCompaniesArr: [],
textMap: {
update: "编辑",
create: "创建",
},
bookDateRange: {
get: function () {
let startDate = undefined;
let endDate = undefined;
if (this.$utils.isString(this.listQuery.bookedStartDate) && this.listQuery.bookedStartDate !== '') {
startDate = toEast8Date(this.listQuery.bookedStartDate);
}
if (this.$utils.isString(this.listQuery.bookedEndDate) && this.listQuery.bookedEndDate !== '') {
endDate = toEast8Date(this.listQuery.bookedEndDate);
}
return [startDate, endDate];
},
set: function ([startDate, endDate]) {
if (this.$utils.isDate(startDate)) {
this.listQuery.bookedStartDate = formatDate(startDate, 'yyyy-MM-dd');
} else {
this.listQuery.bookedStartDate = undefined;
}
if (this.$utils.isDate(endDate)) {
this.listQuery.bookedEndDate = formatDate(endDate, 'yyyy-MM-dd');
} else {
this.listQuery.bookedEndDate = undefined;
}
}
},
notBookDateRange: {
get: function () {
let startDate = undefined;
let endDate = undefined;
if (this.$utils.isString(this.listQuery.notBookedStartDate) && this.listQuery.notBookedStartDate !== '') {
startDate = toEast8Date(this.listQuery.notBookedStartDate);
}
if (this.$utils.isString(this.listQuery.notBookedEndDate) && this.listQuery.notBookedEndDate !== '') {
endDate = toEast8Date(this.listQuery.notBookedEndDate);
}
return [startDate, endDate];
},
set: function ([startDate, endDate]) {
if (this.$utils.isDate(startDate)) {
this.listQuery.notBookedStartDate = formatDate(startDate, 'yyyy-MM-dd');
} else {
this.listQuery.notBookedStartDate = undefined;
}
if (this.$utils.isDate(endDate)) {
this.listQuery.notBookedEndDate = formatDate(endDate, 'yyyy-MM-dd');
} else {
this.listQuery.notBookedEndDate = undefined;
}
}
},
bookDateRange4Apply: {
get: function () {
let startDate = undefined;
let endDate = undefined;
if (this.$utils.isString(this.form4Apply.bookStartDate) && this.form4Apply.bookStartDate !== '') {
startDate = toEast8Date(this.form4Apply.bookStartDate);
}
if (this.$utils.isString(this.form4Apply.bookEndDate) && this.form4Apply.bookEndDate !== '') {
endDate = toEast8Date(this.form4Apply.bookEndDate);
}
return [startDate, endDate];
},
set: function ([startDate, endDate]) {
if (this.$utils.isDate(startDate)) {
this.form4Apply.bookStartDate = formatDate(startDate, 'yyyy-MM-dd');
} else {
this.form4Apply.bookStartDate = undefined;
}
if (this.$utils.isDate(endDate)) {
this.form4Apply.bookEndDate = formatDate(endDate, 'yyyy-MM-dd');
} else {
this.form4Apply.bookEndDate = undefined;
}
}
tableKey: 0,
departureDialogVisible: false,
arrivalDialogVisible: false,
good_btn_add: false, //旅游添加
good_btn_update: false, //旅游编辑
good_btn_upstatus: false, //旅游上下架
good_btn_del: false, //旅游删除
companys_list: [], //门店列表
branchCompany_list: [], //公司列表
};
},
created() {
this.getList();
this.getAllLabelList(); //获取全部标签
this.good_btn_add = this.elements["good:btn_add"]; //旅游添加
this.good_btn_update = this.elements["good:btn_update"]; //旅游编辑
this.good_btn_upstatus = this.elements["good:btn_upstatus"]; //旅游上下架
this.good_btn_del = this.elements["good:btn_del"]; //旅游删除
this.get_all_companys();
this.get_all_branchCompany();
},
computed: {
...mapGetters(["elements", "belong2Type", "vehicleStatus"]),
provinceRegions() {
return getSonRegionByCodes(1);
},
cityRegions() {
if (!this.$utils.isInteger(this.form.addrProvince)) {
return null;
}
return getSonRegionByCodes(this.form.addrProvince);
},
methods: {
/**
* 获取全部旅游标签
* */
getAllLabelList() {
getAllTourTag().then(response => {
this.allLabelList = response.data;
});
},
/**
* 添加
* */
handleCreate() {
this.resetTemp();
this.oneTourRow = {};
this.modalTitle = '创建';
this.oneTourDialogVisible = true;
},
/**
* 操作-删除
* */
deleteHandler(row) {
this.$confirm('确定删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
goodDel(row.id).then(response => {
if (response.status === 200) {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
});
this.oneTourDialogVisible = 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.oneTourDialogVisible = 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.oneTourRow = row;
this.oneTourDialogVisible = 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传递回来的数据
* */
oneTourDialogEvent(e){
this.oneTourDialogVisible = false;
if(!e){//关闭编辑
this.oneTourDialogVisible = e;
} else if(e){
//编辑成功-重新加载列表
this.getList();
townRegions() {
if (!this.$utils.isInteger(this.form.addrCity)) {
return null;
}
return getSonRegionByCodes(this.form.addrCity);
},
cityRegions4Query() {
if (!this.$utils.isInteger(this.listQuery.addrProvince)) {
return null;
}
return getSonRegionByCodes(this.listQuery.addrProvince);
},
townRegions4Query() {
if (!this.$utils.isInteger(this.listQuery.addrCity)) {
return null;
}
return getSonRegionByCodes(this.listQuery.addrCity);
},
getHeaderWithToken() {
return { Authorization: getToken() };
},
getSelectedAccItemStr() {
if (!this.$utils.isEmpty(this.form4Apply.selectedAccItem)) {
let rsStr = "";
for (let key in this.form4Apply.selectedAccItem) {
rsStr =
rsStr +
this.$refs.accItemSelector.getNameById(key) +
" : " +
this.form4Apply.selectedAccItem[key] +
"\n";
}
},
clearDepartureForm() {
this.departureForm = {
vehicleId: null,
numberPlate: null,
departureBranchCompanyName: '',
departureDate: null,
departureBranchCompanyId: null,
use: null,
user: null,
userTel: null,
checkMan: null,
checkManTel: null,
expectArrivalBranchCompanyId: null,
expectArrivalBranchCompanyName: '',
mileage: null
return rsStr;
}
return "";
},
getUnkownBrandCode: () => VEHICLE_CONSTANT_BRAND_CODE_UNKOWN,
getCurBookedInfo: function () {
if (
!this.$utils.isEmpty(this.curBookedInfo3Month) &&
this.curBookedInfo3Month.length > 0
) {
let rs = {};
for (let index in this.curBookedInfo3Month) {
rs[
this.curBookedInfo3Month[index].yearMonth
] = this.curBookedInfo3Month[index].bookedDate;
}
},
departureVehicleHandler() {
console.log(this.departureForm);
if(this.departureForm.expectArrivalBranchCompanyName == "全部" || this.departureForm.expectArrivalBranchCompanyName == ''){
this.departureForm.expectArrivalBranchCompanyId = undefined;
return rs;
}
return undefined;
},
bookDateRange: {
get: function () {
let startDate = undefined;
let endDate = undefined;
if (
this.$utils.isString(this.listQuery.bookedStartDate) &&
this.listQuery.bookedStartDate !== ""
) {
startDate = toEast8Date(this.listQuery.bookedStartDate);
}
if(this.departureForm.departureBranchCompanyName == "全部" || this.departureForm.departureBranchCompanyName == ''){
this.departureForm.departureBranchCompanyId = undefined;
if (
this.$utils.isString(this.listQuery.bookedEndDate) &&
this.listQuery.bookedEndDate !== ""
) {
endDate = toEast8Date(this.listQuery.bookedEndDate);
}
departureVehicle(this.departureForm).then(response => {
if (response.code === rsCode.RS_CODE_SUC) {
this.departureDialogVisible = 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
});
}
});
},
getAllBelong2Type: function () {
return this.belong2Type;
return [startDate, endDate];
},
getBelongToNameStr(row) {
if (!this.$utils.isInteger(row.belongTo)) {
return undefined;
}
if (BELONG_TO_TYPE_OWN === row.belongTo) {
return this.belong2Type[row.belongTo].val;
set: function ([startDate, endDate]) {
if (this.$utils.isDate(startDate)) {
this.listQuery.bookedStartDate = formatDate(startDate, "yyyy-MM-dd");
} else {
this.listQuery.bookedStartDate = undefined;
}
if (this.$utils.isString(row.belongToName) && !this.$utils.isEmpty(row.belongToName)) {
return row.belongToName;
if (this.$utils.isDate(endDate)) {
this.listQuery.bookedEndDate = formatDate(endDate, "yyyy-MM-dd");
} else {
this.listQuery.bookedEndDate = undefined;
}
return undefined;
},
showImgDialog(drivingLicensePath) {
this.licenceSrcUrl = this.getDrivingLicenseUrl(drivingLicensePath);
this.dialogForm4LicenceVisible = true;
},
getDrivingLicenseUrl(drivingLicensePath) {
return process.env.BASE_API +
'/vehicle/vehicleInfo/download/drivingLicense?realFileRelPath=' + encodeURI(drivingLicensePath);
},
handleAvatarSuccess(res, file) {
this.form.drivingLicensePath = res.data;
this.showLoadingBody = false;
},
beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpeg' || file.type === 'image/gif';
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isJPG) {
this.$message.error('上传图片只能是 JPG/GIF 格式!');
},
notBookDateRange: {
get: function () {
let startDate = undefined;
let endDate = undefined;
if (
this.$utils.isString(this.listQuery.notBookedStartDate) &&
this.listQuery.notBookedStartDate !== ""
) {
startDate = toEast8Date(this.listQuery.notBookedStartDate);
}
if (!isLt2M) {
this.$message.error('上传图片大小不能超过 10MB!');
if (
this.$utils.isString(this.listQuery.notBookedEndDate) &&
this.listQuery.notBookedEndDate !== ""
) {
endDate = toEast8Date(this.listQuery.notBookedEndDate);
}
this.showLoadingBody = true;
return isJPG && isLt2M;
},
accItemSelected(selected) {
this.form4Apply.selectedAccItem = selected;
},
accItemClear() {
this.form4Apply.selectedAccItem = undefined;
},
handleAccItemSelect() {
this.$refs.accItemSelector.show();
},
integerValidator: function () {
return {
validator: (rule, value, callback) => {
if (this.$utils.isUndefined(value) || this.$utils.isNull()) {
return callback();
}
if (!this.$utils.isInteger(value)) {
return callback(new Error('必须为整数'));
}
if (value < 1 || value > 9999999999) {
return callback(new Error('编码合法范围:[1 - 9999999999]'));
}
callback();
},
trigger: 'blur'
};
return [startDate, endDate];
},
fillDateRange2Object: function (realBelong, rangePropName, startDatePropName, endDatePropName) {
if (this.$utils.isEmpty(realBelong) || !this.$utils.isArray(realBelong[rangePropName])) {
return realBelong;
}
let belong = this.$utils.clone(realBelong, true);
let [startDate, endDate] = belong[rangePropName];
set: function ([startDate, endDate]) {
if (this.$utils.isDate(startDate)) {
belong[startDatePropName] = formatDate(startDate, 'yyyy-MM-dd hh:mm:ss');
this.listQuery.notBookedStartDate = formatDate(
startDate,
"yyyy-MM-dd"
);
} else {
belong[startDatePropName] = undefined;
this.listQuery.notBookedStartDate = undefined;
}
if (this.$utils.isDate(endDate)) {
belong[endDatePropName] = formatDate(endDate, 'yyyy-MM-dd hh:mm:ss');
this.listQuery.notBookedEndDate = formatDate(endDate, "yyyy-MM-dd");
} else {
belong[endDatePropName] = undefined;
}
belong[rangePropName] = undefined;
return belong;
},
fillDates2Range: function (belong, rangePropName, startDatePropName, endDatePropName) {
if (this.$utils.isEmpty(belong) || !this.$utils.isString(belong[startDatePropName]) || belong[startDatePropName] === '' ||
!this.$utils.isString(belong[endDatePropName]) || belong[endDatePropName] === '') {
return;
this.listQuery.notBookedEndDate = undefined;
}
let [startDateStr, endDateStr] = [belong[startDatePropName], belong[endDatePropName]];
belong[rangePropName] = [toEast8Date(startDateStr), toEast8Date(endDateStr)];
},
changeDate4BookInfo: function (date) {
getBookedInfo(this.form4BookInfo.vehicle, date).then(response => {
this.curBookedInfo = response.data;
});
},
checkBookDate: function (time) {
let nowDate = newEast8Date();
if (this.$utils.toDateString(time, 'yyyy-MM-dd') < this.$utils.toDateString(nowDate, 'yyyy-MM-dd')) {
return true;
}
if (nowDate.setMonth(nowDate.getMonth() + 2) < time) {//预定范围两个月内
return true;
},
bookDateRange4Apply: {
get: function () {
let startDate = undefined;
let endDate = undefined;
if (
this.$utils.isString(this.form4Apply.bookStartDate) &&
this.form4Apply.bookStartDate !== ""
) {
startDate = toEast8Date(this.form4Apply.bookStartDate);
}
let curYearMonth = formatDate(time, 'yyyy-MM');
if (!this.$utils.isEmpty(this.getCurBookedInfo) && this.$utils.isInteger(this.getCurBookedInfo[curYearMonth])) {
let int4BitMap = this.getCurBookedInfo[curYearMonth];
let dayOfMonth = time.getDate();
return (int4BitMap & (1 << (dayOfMonth - 1))) != 0;
if (
this.$utils.isString(this.form4Apply.bookEndDate) &&
this.form4Apply.bookEndDate !== ""
) {
endDate = toEast8Date(this.form4Apply.bookEndDate);
}
return false;
},
checkIfRuning: vehicle => vehicle.status === VEHICLE_CONSTANT_STATUS_NORMAL,
getVehicleStatus: function (code) {
return this.vehicleStatus[code].val;
},
getAllVehicleStatus: function () {
return this.vehicleStatus;
return [startDate, endDate];
},
getBrand: function (code) {
if (!this.$utils.isInteger(code) || code == VEHICLE_CONSTANT_BRAND_CODE_UNKOWN) {
return '未知';
set: function ([startDate, endDate]) {
if (this.$utils.isDate(startDate)) {
this.form4Apply.bookStartDate = formatDate(startDate, "yyyy-MM-dd");
} else {
this.form4Apply.bookStartDate = undefined;
}
return getConstantByTypeAndCode(VEHICLE_CONSTANT_VEHICLE_BRAND, code).val;
},
getAllBranch: () => {
return getConstantListByType(VEHICLE_CONSTANT_VEHICLE_BRAND);
},
getUseType: function (code) {
if (!this.$utils.isInteger(code) || code == VEHICLE_CONSTANT_USE_TYPE_UNKOWN) {
return '未知';
if (this.$utils.isDate(endDate)) {
this.form4Apply.bookEndDate = formatDate(endDate, "yyyy-MM-dd");
} else {
this.form4Apply.bookEndDate = undefined;
}
return getConstantByTypeAndCode(VEHICLE_CONSTANT_VEHICLE_USE, code).val;
},
getAllUseType: () => {
return getConstantListByType(VEHICLE_CONSTANT_VEHICLE_USE);
},
/**
* 获取旅游列表
* */
getList() {
this.listLoading = true;
page(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;
},
},
methods: {
/**
* 获取全部旅游标签
* */
getAllLabelList() {
getAllTourTag().then((response) => {
this.allLabelList = response.data;
});
},
/**
* 添加
* */
handleCreate() {
this.resetTemp();
this.oneTourRow = {};
this.modalTitle = "创建";
this.oneTourDialogVisible = true;
},
/**
* 操作-删除
* */
deleteHandler(row) {
this.$confirm("确定删除吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
goodDel(row.id).then((response) => {
if (response.status === 200) {
this.$notify({
title: "成功",
message: "删除成功",
type: "success",
duration: 2000,
});
}
this.listLoading = false;
this.list = listRs;
this.total = totalCountRs;
})
},
getAddrStr(branchCompany) {
let regions = getRegionByCodes([branchCompany.addrProvince, branchCompany.addrCity, branchCompany.addrTown]);
let address = "";
for(let i = 0; i < regions.length; i++){
address += regions[i].name + " ";
}
return address;
// return regions[0].name + ' ' + regions[1].name + ' ' + regions[2].name + ' ';
},
handleFilter() {
this.listQuery.page = 1;
this.$refs.queryForm.validate(valid => {
if (valid) {
this.oneTourDialogVisible = false;
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.$notify({
title: "删除失败",
message: rsCode.msg[response.code]
? rsCode.msg[response.code]
: "操作失败!",
type: "error",
duration: 2000,
});
}
});
this.form4Apply.vehicle = row.id;
getBookedInfoIn2Month(row.id)
.then(response => {
this.curBookedInfo3Month = response.data;
this.dialogStatus = 'apply';
this.dialogForm4ApplyVisible = true;
});
},
/**
* 上架、下架 参数 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,
});
},
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.oneTourDialogVisible = false;
this.getList();
} else {
this.$notify({
title: '失败',
message: '请选择分公司',
type: 'warning',
duration: 2000
title: "失败",
message: rsCode.msg[response.code]
? rsCode.msg[response.code]
: "操作失败!",
type: "error",
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;
});
},
/**
* 编辑
* */
handleUpdate(row) {
this.modalTitle = "编辑";
this.oneTourRow = row;
this.oneTourDialogVisible = 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传递回来的数据
* */
oneTourDialogEvent(e) {
this.oneTourDialogVisible = false;
if (!e) {
//关闭编辑
this.oneTourDialogVisible = e;
} else if (e) {
//编辑成功-重新加载列表
this.getList();
}
},
clearDepartureForm() {
this.departureForm = {
vehicleId: null,
numberPlate: null,
departureBranchCompanyName: "",
departureDate: null,
departureBranchCompanyId: null,
use: null,
user: null,
userTel: null,
checkMan: null,
checkManTel: null,
expectArrivalBranchCompanyId: null,
expectArrivalBranchCompanyName: "",
mileage: null,
};
},
departureVehicleHandler() {
console.log(this.departureForm);
if (
this.departureForm.expectArrivalBranchCompanyName == "全部" ||
this.departureForm.expectArrivalBranchCompanyName == ""
) {
this.departureForm.expectArrivalBranchCompanyId = undefined;
}
if (
this.departureForm.departureBranchCompanyName == "全部" ||
this.departureForm.departureBranchCompanyName == ""
) {
this.departureForm.departureBranchCompanyId = undefined;
}
departureVehicle(this.departureForm).then((response) => {
if (response.code === rsCode.RS_CODE_SUC) {
this.departureDialogVisible = false;
this.$notify({
title: '失败',
message: '请选择分公司',
type: 'warning',
duration: 2000
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,
});
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;
});
},
getAllBelong2Type: function () {
return this.belong2Type;
},
getBelongToNameStr(row) {
if (!this.$utils.isInteger(row.belongTo)) {
return undefined;
}
if (BELONG_TO_TYPE_OWN === row.belongTo) {
return this.belong2Type[row.belongTo].val;
}
if (
this.$utils.isString(row.belongToName) &&
!this.$utils.isEmpty(row.belongToName)
) {
return row.belongToName;
}
return undefined;
},
showImgDialog(drivingLicensePath) {
this.licenceSrcUrl = this.getDrivingLicenseUrl(drivingLicensePath);
this.dialogForm4LicenceVisible = true;
},
getDrivingLicenseUrl(drivingLicensePath) {
return (
process.env.BASE_API +
"/vehicle/vehicleInfo/download/drivingLicense?realFileRelPath=" +
encodeURI(drivingLicensePath)
);
},
handleAvatarSuccess(res, file) {
this.form.drivingLicensePath = res.data;
this.showLoadingBody = false;
},
beforeAvatarUpload(file) {
const isJPG = file.type === "image/jpeg" || file.type === "image/gif";
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isJPG) {
this.$message.error("上传图片只能是 JPG/GIF 格式!");
}
if (!isLt2M) {
this.$message.error("上传图片大小不能超过 10MB!");
}
this.showLoadingBody = true;
return isJPG && isLt2M;
},
accItemSelected(selected) {
this.form4Apply.selectedAccItem = selected;
},
accItemClear() {
this.form4Apply.selectedAccItem = undefined;
},
handleAccItemSelect() {
this.$refs.accItemSelector.show();
},
integerValidator: function () {
return {
validator: (rule, value, callback) => {
if (this.$utils.isUndefined(value) || this.$utils.isNull()) {
return callback();
}
});
},
/**
* 申请预定-确定
* @param formName
*/
apply(formName) {
if(!this.form4Apply.state3 || this.form4Apply.state3 == "全部"){
this.form4Apply.liftCompany = undefined;
this.$notify({
title: '失败',
message: '请选择提车分公司',
type: 'warning',
duration: 2000
if (!this.$utils.isInteger(value)) {
return callback(new Error("必须为整数"));
}
if (value < 1 || value > 9999999999) {
return callback(new Error("编码合法范围:[1 - 9999999999]"));
}
callback();
},
trigger: "blur",
};
},
fillDateRange2Object: function (
realBelong,
rangePropName,
startDatePropName,
endDatePropName
) {
if (
this.$utils.isEmpty(realBelong) ||
!this.$utils.isArray(realBelong[rangePropName])
) {
return realBelong;
}
let belong = this.$utils.clone(realBelong, true);
let [startDate, endDate] = belong[rangePropName];
if (this.$utils.isDate(startDate)) {
belong[startDatePropName] = formatDate(
startDate,
"yyyy-MM-dd hh:mm:ss"
);
} else {
belong[startDatePropName] = undefined;
}
if (this.$utils.isDate(endDate)) {
belong[endDatePropName] = formatDate(endDate, "yyyy-MM-dd hh:mm:ss");
} else {
belong[endDatePropName] = undefined;
}
belong[rangePropName] = undefined;
return belong;
},
fillDates2Range: function (
belong,
rangePropName,
startDatePropName,
endDatePropName
) {
if (
this.$utils.isEmpty(belong) ||
!this.$utils.isString(belong[startDatePropName]) ||
belong[startDatePropName] === "" ||
!this.$utils.isString(belong[endDatePropName]) ||
belong[endDatePropName] === ""
) {
return;
}
let [startDateStr, endDateStr] = [
belong[startDatePropName],
belong[endDatePropName],
];
belong[rangePropName] = [
toEast8Date(startDateStr),
toEast8Date(endDateStr),
];
},
changeDate4BookInfo: function (date) {
getBookedInfo(this.form4BookInfo.vehicle, date).then((response) => {
this.curBookedInfo = response.data;
});
},
checkBookDate: function (time) {
let nowDate = newEast8Date();
if (
this.$utils.toDateString(time, "yyyy-MM-dd") <
this.$utils.toDateString(nowDate, "yyyy-MM-dd")
) {
return true;
}
if (nowDate.setMonth(nowDate.getMonth() + 2) < time) {
//预定范围两个月内
return true;
}
let curYearMonth = formatDate(time, "yyyy-MM");
if (
!this.$utils.isEmpty(this.getCurBookedInfo) &&
this.$utils.isInteger(this.getCurBookedInfo[curYearMonth])
) {
let int4BitMap = this.getCurBookedInfo[curYearMonth];
let dayOfMonth = time.getDate();
return (int4BitMap & (1 << (dayOfMonth - 1))) != 0;
}
return false;
},
checkIfRuning: (vehicle) =>
vehicle.status === VEHICLE_CONSTANT_STATUS_NORMAL,
getVehicleStatus: function (code) {
return this.vehicleStatus[code].val;
},
getAllVehicleStatus: function () {
return this.vehicleStatus;
},
getBrand: function (code) {
if (
!this.$utils.isInteger(code) ||
code == VEHICLE_CONSTANT_BRAND_CODE_UNKOWN
) {
return "未知";
}
return getConstantByTypeAndCode(VEHICLE_CONSTANT_VEHICLE_BRAND, code).val;
},
getAllBranch: () => {
return getConstantListByType(VEHICLE_CONSTANT_VEHICLE_BRAND);
},
getUseType: function (code) {
if (
!this.$utils.isInteger(code) ||
code == VEHICLE_CONSTANT_USE_TYPE_UNKOWN
) {
return "未知";
}
return getConstantByTypeAndCode(VEHICLE_CONSTANT_VEHICLE_USE, code).val;
},
getAllUseType: () => {
return getConstantListByType(VEHICLE_CONSTANT_VEHICLE_USE);
},
/**
* 获取旅游列表
* */
getList() {
this.listLoading = true;
page(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;
});
return;
}
if(!this.form4Apply.state4 || this.form4Apply.state4 == "全部"){
this.form4Apply.retCompany = undefined;
this.$notify({
title: '失败',
message: '请选择还车分公司',
type: 'warning',
duration: 2000
this.listLoading = false;
this.list = listRs;
this.total = totalCountRs;
});
},
getAddrStr(branchCompany) {
let regions = getRegionByCodes([
branchCompany.addrProvince,
branchCompany.addrCity,
branchCompany.addrTown,
]);
let address = "";
for (let i = 0; i < regions.length; i++) {
address += regions[i].name + " ";
}
return address;
// return regions[0].name + ' ' + regions[1].name + ' ' + regions[2].name + ' ';
},
clear_handleFilter() {
this.listQuery = {
page: 1,
limit: 20,
tagId: undefined,
corporationId: undefined,
companyId: undefined,
name: "", //关键词
};
this.getList();
},
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,
});
}
});
return;
} else {
return false;
}
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
this.dialogFormVisible = false;
book(this.form4Apply).then(() => {
this.dialogForm4ApplyVisible = 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
title: "成功",
message: "更新成功",
type: "success",
duration: 2000,
});
});
} else {
return false;
}
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,
});
},
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
};
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,
};
},
//所有公司
get_all_companys() {
company_all_list().then((res) => {
if (res.status == 200) {
this.companys_list = res.data;
}
});
},
//所有门店
get_all_branchCompany() {
branchCompany_all_list({ state: 1 }).then((res) => {
if (res.status == 200) {
this.branchCompany_list = res.data;
}
});
},
},
};
</script>
......@@ -19,8 +19,8 @@
</el-row>
<el-row>
<el-col :span="4">
<el-form-item label="旅行原价" prop="price">
<el-input v-model="form.price" type="number" min="0" placeholder="请输入旅行原价"></el-input>
<el-form-item label="成人价" prop="price">
<el-input v-model="form.price" type="number" min="0" placeholder="请输入成人价"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
......@@ -31,19 +31,19 @@
</el-row>
<el-row>
<el-col :span="4">
<el-form-item label="是否为推荐">
<el-form-item label="是否为推荐" v-if="false">
<el-radio class="radio" v-model="form.recommend" label="1"></el-radio>
<el-radio class="radio" v-model="form.recommend" label="0"></el-radio>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="会员价格">
<el-form-item label="会员价格" v-if="false">
<el-radio class="radio" v-model="form.isMember" label="1">启用会员价</el-radio>
<el-radio class="radio" v-model="form.isMember" label="0">不启用会员价</el-radio>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="">
<el-form-item label v-if="false">
<el-radio class="radio" v-model="form.isOutside" label="0">省内</el-radio>
<el-radio class="radio" v-model="form.isOutside" label="1">省外</el-radio>
</el-form-item>
......@@ -57,12 +57,21 @@
<el-row>
<!--<el-col :span="24">-->
<el-form-item label="出发地">
<el-input style="display: inline-block;margin-right: 10px;width: 240px;" v-model="item.name"
v-for="item in departureList"
:key="item.id" readonly placeholder="请输入内容"></el-input>
<el-button size="small" class="el-button el-button--primary" type="button" icon="edit"
@click="editDeparture(departureList)">编辑
</el-button>
<el-input
style="display: inline-block;margin-right: 10px;width: 240px;"
v-model="item.name"
v-for="item in departureList"
:key="item.id"
readonly
placeholder="请输入内容"
></el-input>
<el-button
size="small"
class="el-button el-button--primary"
type="button"
icon="edit"
@click="editDeparture(departureList)"
>编辑</el-button>
<!--<el-autocomplete-->
<!--v-for="item in departureList"-->
<!--:key="item.id"-->
......@@ -79,8 +88,13 @@
<el-row>
<el-col :span="8">
<el-form-item label="目的地">
<el-input v-model="destinationObj.address" readonly placeholder="请选择目的地" :on-icon-click="selectDestination"
icon="edit"></el-input>
<el-input
v-model="destinationObj.address"
readonly
placeholder="请选择目的地"
:on-icon-click="selectDestination"
icon="edit"
></el-input>
</el-form-item>
</el-col>
</el-row>
......@@ -89,40 +103,92 @@
<el-form-item label="途径地">
<!--<el-input v-for="item in pathway" style="display: inline-block;margin-right: 10px;width: 240px;"-->
<!--:key="item.id" v-model="item.name" readonly placeholder="请选择途径地" :data-rowId="item.id" :on-icon-click="selectPathway" icon="edit"></el-input>-->
<el-button v-for="item in pathway"
:key="item.id" size="small" class="el-button el-button--primary" type="button"
@click="editPathway(item)">{{item.name}}<i class="el-icon-edit el-icon--right"></i></el-button>
<el-button size="small" class="el-button el-button--primary" type="button" icon="plus" @click="addPathway()">
添加
<el-button
v-for="item in pathway"
:key="item.id"
size="small"
class="el-button el-button--primary"
type="button"
@click="editPathway(item)"
>
{{item.name}}
<i class="el-icon-edit el-icon--right"></i>
</el-button>
<el-button
size="small"
class="el-button el-button--primary"
type="button"
icon="plus"
@click="addPathway()"
>添加</el-button>
</el-form-item>
<!--</el-col>-->
</el-row>
<el-row>
<el-form-item prop="operator" label="活动日期">
<!--tourDepartTimeVo-->
<el-button v-for="item in form.tourDepartTimeVo" disabled
:key="item.id" class="el-button el-button--default" type="button">
{{item.startTime}}~{{item.endTime}}
</el-button>
<el-button
v-for="item in form.tourDepartTimeVo"
disabled
:key="item.id"
class="el-button el-button--default"
type="button"
>{{item.startTime}}~{{item.endTime}}</el-button>
<el-button size="small" class="el-button el-button--primary" type="button" icon="edit" @click="editTime()">
编辑
</el-button>
<el-button
size="small"
class="el-button el-button--primary"
type="button"
icon="edit"
@click="editTime()"
>编辑</el-button>
<!--<el-input v-model="form.operator" placeholder="请选择活动日期"></el-input>-->
</el-form-item>
</el-row>
<el-form-item label="旅行标签">
<span v-for="item in form.tagDTOS"
:key="item.id" style="border: 1px solid #ccc; padding: 5px 10px;border-radius: 5px;margin-right: 10px;">{{item.name}}</span>
<span
v-for="item in form.tagDTOS"
:key="item.id"
style="border: 1px solid #ccc; padding: 5px 10px;border-radius: 5px;margin-right: 10px;"
>{{item.name}}</span>
<!--<el-checkbox-group v-model="checkList">-->
<!--<el-checkbox v-for="item in allLabelList"-->
<!--:key="item.id" :label="item.name"></el-checkbox>-->
<!--</el-checkbox-group>-->
<el-button size="small" class="el-button el-button--primary" type="button" icon="edit"
@click="editLable(form.tagDTOS)">编辑
</el-button>
<el-button
size="small"
class="el-button el-button--primary"
type="button"
icon="edit"
@click="editLable(form.tagDTOS)"
>编辑</el-button>
</el-form-item>
<el-row>
<el-form-item label="所属公司">
<el-select
class="filter-item"
v-model="form.corporationId"
clearable
filterable
placeholder="请选择公司"
>
<el-option label="全部" :key="undefined" :value="undefined"></el-option>
<el-option v-for="val in companys_list" :key="val.id" :label="val.name" :value="val.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属门店">
<el-select class="filter-item" v-model="form.companyId" clearable placeholder="请选择">
<el-option label="全部" :key="undefined" :value="undefined"></el-option>
<el-option
v-for="val in branchCompany_list"
:key="val.id"
:label="val.name"
:value="val.id"
></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item label="浏览量">
......@@ -154,45 +220,58 @@
:show-file-list="false"
:on-success="handleAvatarSuccess"
:on-progress="uploadProcess"
list-type="picture">
<div slot="tip" class="el-upload__tip"><span style="color: red;">建议尺寸:320*228px</span></div>
<el-progress v-show="imgFlag == true" type="circle" :percentage="percent"
style="margin-top: 20px"></el-progress>
<img v-if="$utils.isString(form.cover) && !$utils.isEmpty(form.cover) && !imgFlag" :src="form.cover"
style="width:300px;max-height:300px;">
<i v-else-if="!imgFlag" class="el-icon-plus avatar-uploader-icon"
style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i>
list-type="picture"
>
<div slot="tip" class="el-upload__tip">
<span style="color: red;">建议尺寸:320*228px</span>
</div>
<el-progress
v-show="imgFlag == true"
type="circle"
:percentage="percent"
style="margin-top: 20px"
></el-progress>
<img
v-if="$utils.isString(form.cover) && !$utils.isEmpty(form.cover) && !imgFlag"
:src="form.cover"
style="width:300px;max-height:300px;"
/>
<i
v-else-if="!imgFlag"
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-row>
<el-col :span="8">
<el-form-item label="alt">
<el-form-item label="alt" v-if="false">
<el-input v-model="form.alt" type="text" placeholder="请输入替代文本"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-title">
<el-form-item label="img-title" v-if="false">
<el-input v-model="form.imgTitle" type="text" placeholder="请输入图片title"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-keyword">
<el-form-item label="img-keyword" v-if="false">
<el-input v-model="form.imgKeyword" type="text" placeholder="请输入图片关键字"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-desc">
<el-form-item label="img-desc" v-if="false">
<el-input v-model="form.imgDesc" type="text" placeholder="请输入图片描述"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="海报背景" :style="{display:'block'}">
<el-form-item label="海报背景" :style="{display:'block'}" v-if="false">
<el-upload
class="upload-demo"
:headers="getHeaderWithToken"
......@@ -200,14 +279,27 @@
:show-file-list="false"
:on-success="handlePosterSuccess"
:on-progress="uploadPosterProcess"
list-type="picture">
<div slot="tip" class="el-upload__tip"><span style="color: red;">建议尺寸:320*228px</span></div>
<el-progress v-show="imgPosterFlag == true" type="circle" :percentage="percent_poster"
style="margin-top: 20px"></el-progress>
<img v-if="$utils.isString(form.posterBackground) && !$utils.isEmpty(form.posterBackground)&& !imgPosterFlag"
:src="form.posterBackground" style="width:300px;max-height:300px;">
<i v-else-if="!imgPosterFlag" class="el-icon-plus avatar-uploader-icon"
style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i>
list-type="picture"
>
<div slot="tip" class="el-upload__tip">
<span style="color: red;">建议尺寸:320*228px</span>
</div>
<el-progress
v-show="imgPosterFlag == true"
type="circle"
:percentage="percent_poster"
style="margin-top: 20px"
></el-progress>
<img
v-if="$utils.isString(form.posterBackground) && !$utils.isEmpty(form.posterBackground)&& !imgPosterFlag"
:src="form.posterBackground"
style="width:300px;max-height:300px;"
/>
<i
v-else-if="!imgPosterFlag"
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'}">
......@@ -218,30 +310,49 @@
:on-remove="handleRemove"
:file-list="fileList2"
:on-success="handleBannerSuccess"
list-type="picture">
<div slot="tip" class="el-upload__tip">最多上传5张 <span style="color: red;">建议尺寸:1080*644px</span></div>
list-type="picture"
>
<div slot="tip" class="el-upload__tip">
最多上传5张
<span style="color: red;">建议尺寸:1080*644px</span>
</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">
<div class="editor-container" v-if="activeName2=='first'">
<UE :editorId="activeName2" :defaultMsg="form.content" :config=config ref="ue"
@ready="editorReadyEvent"></UE>
<UE
:editorId="activeName2"
:defaultMsg="form.content"
:config="config"
ref="ue"
@ready="editorReadyEvent"
></UE>
</div>
<!--<Editor v-if="activeName2=='first'" @input="handelContentIncrease" :value="form.content" :myQuillEditor="'myQuillEditorContent'" :activeName2="activeName2"></Editor>-->
</el-tab-pane>
<el-tab-pane label="行程介绍" name="second">
<div class="editor-container" v-if="activeName2=='second'">
<UE :editorId="activeName2" :defaultMsg="form.introduce" :config=config ref="ue"
@ready="editorReadyEvent"></UE>
<UE
:editorId="activeName2"
:defaultMsg="form.introduce"
:config="config"
ref="ue"
@ready="editorReadyEvent"
></UE>
</div>
<!--<Editor v-if="activeName2=='second'" @input="handelIntroduceIncrease" :value="form.introduce" :myQuillEditor="'myQuillEditorIntroduce'" :activeName2="activeName2"></Editor>-->
</el-tab-pane>
<el-tab-pane label="费用说明" name="third">
<div class="editor-container" v-if="activeName2=='third'">
<UE :editorId="activeName2" :defaultMsg="form.explain" :config=config ref="ue"
@ready="editorReadyEvent"></UE>
<UE
:editorId="activeName2"
:defaultMsg="form.explain"
:config="config"
ref="ue"
@ready="editorReadyEvent"
></UE>
</div>
<!--<Editor v-if="activeName2=='third'" @input="handelExplainIncrease" :value="form.explain" :myQuillEditor="'myQuillEditorExplain'" :activeName2="activeName2"></Editor>-->
</el-tab-pane>
......@@ -250,892 +361,950 @@
<div slot="footer" class="dialog-footer">
<el-button @click="cancelTour">取 消</el-button>
<el-button type="primary" v-if="title=='创建' && !isCreate" @click="create('form')">确 定</el-button>
<el-button type="primary" v-if="title=='编辑' && !isCreate&&good_btn_update" @click="update('form')">确 定</el-button>
<el-button
type="primary"
v-if="title=='编辑' && !isCreate&&good_btn_update"
@click="update('form')"
>确 定</el-button>
</div>
<!--编辑出发地-->
<departureModal v-if="editDepartureVisible" :list="departureList"
v-on:departureEvent="departureEvent"></departureModal>
<departureModal
v-if="editDepartureVisible"
:list="departureList"
v-on:departureEvent="departureEvent"
></departureModal>
<!--编辑目的地-->
<destination v-if="showDestinationVisible" :obj="destinationObj"
v-on:destinationEvent="destinationEvent"></destination>
<destination
v-if="showDestinationVisible"
:obj="destinationObj"
v-on:destinationEvent="destinationEvent"
></destination>
<!--编辑途径地-->
<destination v-if="showPathWayVisible" :obj="onePathObj" v-on:pathWayEvent="pathWayEvent"></destination>
<!--编辑活动时间-->
<tourTime v-if="showTimeVisible" :list="form.tourDepartTimeVo" :number="form.number"
v-on:tourDepartTimeEvent="tourDepartTimeEvent"></tourTime>
<tourTime
v-if="showTimeVisible"
:list="form.tourDepartTimeVo"
:number="form.number"
v-on:tourDepartTimeEvent="tourDepartTimeEvent"
></tourTime>
<!--编辑旅游标签-->
<tourLabelModal v-if="editLableVisible" :allLabelList="allLabelList" :checkList="checkList"
v-on:tourLabelEvent="tourLabelEvent"></tourLabelModal>
<tourLabelModal
v-if="editLableVisible"
:allLabelList="allLabelList"
:checkList="checkList"
v-on:tourLabelEvent="tourLabelEvent"
></tourLabelModal>
</div>
</template>
<style>
textarea {
display: none;
}
textarea {
display: none;
}
.el-upload-list {
display: flex;
width: 100px;
}
.el-upload-list {
display: flex;
width: 100px;
}
.el-upload-list li {
margin-left: 10px;
}
.el-upload-list li {
margin-left: 10px;
}
</style>
<script>
// import Editor from "../../modal/editorTool";//富文本
import UE from '../../modal/Ueditor';//百度ue富文本
import Destination from "./destinationModal";//目的地弹框
import tourTime from "./tourTime";//活动时间
import tourLabelModal from "./tourLabelModal";//旅游标签
import departureModal from "./departureModal";//出发地弹框
import {
page,
goodsEdit,
getOneGoodsById
} from 'api/tourManage';
import {
getSonRegionByCodes,
getRegionByCodes,
} from 'api/base_info/region/';
// import Editor from "../../modal/editorTool";//富文本
import UE from "../../modal/Ueditor"; //百度ue富文本
import Destination from "./destinationModal"; //目的地弹框
import tourTime from "./tourTime"; //活动时间
import tourLabelModal from "./tourLabelModal"; //旅游标签
import departureModal from "./departureModal"; //出发地弹框
import { page, goodsEdit, getOneGoodsById } from "api/tourManage";
import rsCode from '../../../utils/rsCode';
import {
getToken
} from '../../../utils/auth';
import {mapGetters} from 'vuex';
import {
getAllCompany,
getAll
} from 'api/base_info/branch_company/';
import {
getTourTagList,
getAllTourTag
} from 'api/tourManage';
import ElRow from "element-ui/packages/row/src/row";
import { getSonRegionByCodes, getRegionByCodes } from "api/base_info/region/";
export default {
props: ["oneTourRow", "title", "good_btn_update"],
name: 'upkeepDialog',
components: {
// Editor,
ElRow,
UE,
Destination,
tourTime,
tourLabelModal,
departureModal
import rsCode from "../../../utils/rsCode";
import { getToken } from "../../../utils/auth";
import { mapGetters } from "vuex";
import { getAllCompany, getAll } from "api/base_info/branch_company/";
import { getTourTagList, getAllTourTag } from "api/tourManage";
import ElRow from "element-ui/packages/row/src/row";
import { company_all_list, branchCompany_all_list } from "api/company.js";
export default {
props: ["oneTourRow", "title", "good_btn_update"],
name: "upkeepDialog",
components: {
// Editor,
ElRow,
UE,
Destination,
tourTime,
tourLabelModal,
departureModal,
},
data() {
return {
imgPosterFlag: false,
percent_poster: 0,
BASE_API: process.env.BASE_API,
config: {
initialFrameWidth: null,
initialFrameHeight: 350,
},
percent: 0, //上传进度
imgFlag: false,
onePathObj: { name: "" }, //待编辑的途径地
destinationObj: {}, //目的地
departureList: [], //出发地列表
departureObj: { name: "" }, //出发地
pathway: [], //途径地
isCreate: false, //是否点击了创建-确定
fileList2: [],
activeName2: "", //行程亮点
form: {
alt: undefined,
imgTitle: undefined,
imgKeyword: undefined,
imgDesc: undefined,
childPrice: undefined, //儿童价
isOutside: "0",
tourDepartVo: undefined, //type:0出发地 1途径地 2目的地
content: "", //行程亮点
cover: undefined, //封面图
describe: undefined, //描述
introduce: "", //行程介绍
crtTime: undefined,
explain: "", //费用说明
name: undefined, //旅行名称
price: undefined, //成人价
rank: undefined,
recommend: "0", //是否设置为推荐,默认不推荐
saleCount: undefined, //初始销量
status: undefined, //0:未发布,1:上架 2:下架
stock: undefined, //总人数
unit: undefined, //单位
updTime: undefined, //更新时间
viewCount: undefined, //浏览量
isMember: "0", //是否是会员商品
tagDTOS: [], //旅行标签
bannerDTOS: [], //banner轮播
posterBackground: "", //海报背景
corporationId: undefined,
companyId: undefined,
},
showDestinationVisible: false, //编辑目的地
showPathWayVisible: false, //编辑途径地
showTimeVisible: false, //编辑时间
rules: {
name: {
type: "string",
required: true,
message: "请输入旅游名称",
trigger: "blur",
},
data() {
return {
imgPosterFlag: false,
percent_poster: 0,
BASE_API: process.env.BASE_API,
config: {
initialFrameWidth: null,
initialFrameHeight: 350
},
percent: 0,//上传进度
imgFlag: false,
onePathObj: {name: ""},//待编辑的途径地
destinationObj: {},//目的地
departureList: [],//出发地列表
departureObj: {name: ""},//出发地
pathway: [],//途径地
isCreate: false,//是否点击了创建-确定
fileList2: [],
activeName2: '',//行程亮点
form: {
alt: undefined,
imgTitle: undefined,
imgKeyword: undefined,
imgDesc: undefined,
childPrice: undefined,//儿童价
isOutside: "0",
tourDepartVo: undefined,//type:0出发地 1途径地 2目的地
content: "",//行程亮点
cover: undefined,//封面图
describe: undefined,//描述
introduce: "",//行程介绍
crtTime: undefined,
explain: "",//费用说明
name: undefined,//旅行名称
price: undefined,//成人价
rank: undefined,
recommend: "0",//是否设置为推荐,默认不推荐
saleCount: undefined,//初始销量
status: undefined,//0:未发布,1:上架 2:下架
stock: undefined,//总人数
unit: undefined,//单位
updTime: undefined,//更新时间
viewCount: undefined,//浏览量
isMember: "0",//是否是会员商品
tagDTOS: [],//旅行标签
bannerDTOS: [],//banner轮播
posterBackground: '',//海报背景
},
showDestinationVisible: false,//编辑目的地
showPathWayVisible: false,//编辑途径地
showTimeVisible: false,//编辑时间
rules: {
name: {
type: 'string',
required: true,
message: '请输入旅游名称',
trigger: 'blur'
},
price: {
required: true,
message: '请输入价格',
},
childPrice: {
required: true,
message: '请输入儿童价格'
},
stock: {
required: true,
message: '请输入库存'
}
},
checkList: [],//已选中的标签
allCompanies: {},
allCompaniesArr: [],
oneTourDialogVisible: false,
editLableVisible: false,//旅游标签
editDepartureVisible: false,//出发地弹框
allUpkeepItems: null,
dialogStatus: undefined,
allLabelList: [],//全部旅游标签
}
price: {
required: true,
message: "请输入价格",
},
created() {
getAll()
.then(response => {
this.allCompaniesArr = response.data;
})
getAllCompany(codeAndBranchCompany => {
this.allCompanies = codeAndBranchCompany;
});
this.getAllLabelList();
childPrice: {
required: true,
message: "请输入儿童价格",
},
watch: {
oneTourDialogVisible(newValue, oldValue) {
if (!newValue) {
this.cleanForm();
}
},
stock: {
required: true,
message: "请输入库存",
},
mounted() {
this.cleanForm();
if (this.title == "编辑") {
let row = this.oneTourRow;
this.getOneGoods(row.id);
},
checkList: [], //已选中的标签
allCompanies: {},
allCompaniesArr: [],
oneTourDialogVisible: false,
editLableVisible: false, //旅游标签
editDepartureVisible: false, //出发地弹框
allUpkeepItems: null,
dialogStatus: undefined,
allLabelList: [], //全部旅游标签
companys_list: [], //门店列表
branchCompany_list: [], //公司列表
};
},
created() {
getAll().then((response) => {
this.allCompaniesArr = response.data;
});
getAllCompany((codeAndBranchCompany) => {
this.allCompanies = codeAndBranchCompany;
});
this.getAllLabelList();
this.get_all_companys();
this.get_all_branchCompany();
},
watch: {
oneTourDialogVisible(newValue, oldValue) {
if (!newValue) {
this.cleanForm();
}
},
},
mounted() {
this.cleanForm();
if (this.title == "编辑") {
let row = this.oneTourRow;
this.getOneGoods(row.id);
} else {
this.activeName2 = "first";
}
this.oneTourDialogVisible = true;
},
computed: {
getHeaderWithToken() {
return { Authorization: getToken() };
},
},
methods: {
//所有公司
get_all_companys() {
company_all_list().then((res) => {
if (res.status == 200) {
this.companys_list = res.data;
}
});
},
//所有门店
get_all_branchCompany() {
branchCompany_all_list({ state: 1 }).then((res) => {
if (res.status == 200) {
this.branchCompany_list = res.data;
}
});
},
/**
* 封面图
* */
uploadProcess(event, file, fileList) {
this.imgFlag = true;
console.log(event.percent);
this.percent = Math.floor(event.percent);
},
handleClick(tab, event) {
console.log(tab, event);
},
getWeek(week, name) {
let weekStr = "";
switch (week) {
case 0:
weekStr = name + "天";
break;
case 1:
weekStr = name + "一";
break;
case 2:
weekStr = name + "二";
break;
case 3:
weekStr = name + "三";
break;
case 4:
weekStr = name + "四";
break;
case 5:
weekStr = name + "五";
break;
case 6:
weekStr = name + "六";
break;
}
return weekStr;
},
/**
* 编辑出发地
* */
editDeparture(list) {
console.log(list);
this.editDepartureVisible = true;
},
/**
* 关闭出发地弹框
* */
departureEvent(obj) {
this.editDepartureVisible = false;
if (obj) {
this.departureList = obj;
console.log(obj);
}
},
/**
* 编辑旅游标签
* */
editLable(list) {
console.log(list);
this.editLableVisible = true;
},
/**
* 创建
* */
create(formName) {
const set = this.$refs;
set[formName].validate((valid) => {
if (valid) {
//旅游标签
let tagDTOS = [];
this.form.tagDTOS.map(function (item) {
if (item.tagId) {
tagDTOS.push({ tagId: item.tagId });
} else {
this.activeName2 = "first";
tagDTOS.push({ tagId: item.id });
}
this.oneTourDialogVisible = true;
},
computed: {
getHeaderWithToken() {
return {Authorization: getToken()};
},
},
methods: {
/**
* 封面图
* */
uploadProcess(event, file, fileList) {
this.imgFlag = true;
console.log(event.percent);
this.percent = Math.floor(event.percent);
},
handleClick(tab, event) {
console.log(tab, event);
},
getWeek(week, name) {
let weekStr = "";
switch (week) {
case 0:
weekStr = name + "天";
break;
case 1:
weekStr = name + "一";
break;
case 2:
weekStr = name + "二";
break;
case 3:
weekStr = name + "三";
break;
case 4:
weekStr = name + "四";
break;
case 5:
weekStr = name + "五";
break;
case 6:
weekStr = name + "六";
break;
}
return weekStr;
},
/**
* 编辑出发地
* */
editDeparture(list) {
console.log(list);
this.editDepartureVisible = true;
},
/**
* 关闭出发地弹框
* */
departureEvent(obj) {
this.editDepartureVisible = false;
if (obj) {
this.departureList = obj;
console.log(obj);
}
},
/**
* 编辑旅游标签
* */
editLable(list) {
console.log(list);
this.editLableVisible = true;
},
/**
* 创建
* */
create(formName) {
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
//旅游标签
let tagDTOS = [];
this.form.tagDTOS.map(function (item) {
if (item.tagId) {
tagDTOS.push({tagId: item.tagId});
} else {
tagDTOS.push({tagId: item.id});
}
});
let siteDTOS = [];
//出发地
this.departureList.map(function (item) {
let pp = item.province ? item.province : item.addrProvince;
let c = item.addrCity ? item.addrCity : item.city;
let provinceObj = pp ? getRegionByCodes([pp]) : [{name: ""}];
let cityObj = c ? getRegionByCodes([c]) : [{name: ""}];
let p = {
name: item.name,
departTime: item.departTime ? item.departTime : 0,
address: item.addrDetail ? item.addrDetail : item.address,
companyId: item.companyId,
province: item.addrProvince ? item.addrProvince : item.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: item.addrCity ? item.addrCity : item.city,
longitude: item.longitude,
latitude: item.latitude,
type: 0,
rank: item.rank
};
siteDTOS.push(p);
});
if (this.departureList.length <= 0) {
this.$notify({
title: '警告',
message: '请选择出发地',
type: 'warning',
duration: 2000
});
return;
}
//途径地
this.pathway.map(function (item) {
let provinceObj = item.province ? getRegionByCodes([item.province]) : [{name: ""}];
let cityObj = item.city ? getRegionByCodes([item.city]) : [{name: ""}];
// let provinceObj = getRegionByCodes([item.province]);
// let cityObj = getRegionByCodes([item.city]);
let p = {
name: item.name,
address: item.addrDetail ? item.addrDetail : item.address,
// companyId: item.id,
province: item.addrProvince ? item.addrProvince : item.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: item.addrCity ? item.addrCity : item.city,
longitude: item.longitude,
latitude: item.latitude,
type: 1,
rank: item.rank
};
siteDTOS.push(p);
});
//destinationObj目的地
let destinationObj = this.destinationObj;
if (!destinationObj.name) {
this.$notify({
title: '警告',
message: '请选择目的地',
type: 'warning',
duration: 2000
});
return;
}
let provinceObj = destinationObj.province ? getRegionByCodes([destinationObj.province]) : [{name: ""}];
let cityObj = destinationObj.city ? getRegionByCodes([destinationObj.city]) : [{name: ""}];
let p = {
name: destinationObj.name,
address: destinationObj.addrDetail ? destinationObj.addrDetail : destinationObj.address,
province: destinationObj.addrProvince ? destinationObj.addrProvince : destinationObj.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: destinationObj.addrCity ? destinationObj.addrCity : destinationObj.city,
longitude: destinationObj.longitude,
latitude: destinationObj.latitude,
type: 2
};
siteDTOS.push(p);
this.isCreate = true;
let params = {
isOutside: this.form.isOutside,//省内、省外
name: this.form.name,//旅游路线名称
cover: this.form.cover,//封面图
price: this.form.price,//成人价
childPrice: this.form.childPrice,//儿童价
viewCount: this.form.viewCount,//商品浏览量
saleCount: this.form.saleCount,//商品销售量
describe: this.form.describe,//商品描述
content: this.form.content,//商品详情(行程亮点)
introduce: this.form.introduce,//行程介绍
explain: this.form.explain,//费用说明
rank: this.form.rank,//旅行排序
recommend: this.form.recommend,//是否推荐:0-未推荐;1-已推荐
isMember: this.form.isMember,//是否启用会员价
stock: this.form.stock,//库存
unit: this.form.unit,//单位
number: this.form.number,//活动天数
bannerDTOS: this.form.bannerDTOS,//banner轮播图
siteDTOS: siteDTOS,//出发地type=0,途径地type=1,目的地type=2
priceDTOS: this.form.tourDepartTimeVo,//活动日期
tagDTOS: tagDTOS,//旅游标签
posterBackground: this.form.posterBackground,//海报背景
alt: this.form.alt, //seo 标签优化
imgTitle: this.form.imgTitle,
imgKeyword: this.form.imgKeyword,
imgDesc: this.form.imgDesc
};
console.log(params);
goodsEdit(params).then(response => {
this.isCreate = false;
if (response.status === 200) {
this.$notify({
title: '成功',
message: '添加成功',
type: 'success',
duration: 2000
});
this.$emit("oneTourDialogEvent", true);
} else {
this.$notify({
title: '添加失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
} else {
return;
}
});
},
/**
* 编辑
* */
update(formName) {
//旅游标签
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
let tagDTOS = [];
this.form.tagDTOS.map(function (item) {
if (item.tagId) {
tagDTOS.push({tagId: item.tagId});
} else {
tagDTOS.push({tagId: item.id});
}
});
let siteDTOS = [];
//出发地
this.departureList.map(function (item) {
let pp = item.province ? item.province : item.addrProvince;
let c = item.addrCity ? item.addrCity : item.city;
let provinceObj = pp ? getRegionByCodes([pp]) : [{name: ""}];
let cityObj = c ? getRegionByCodes([c]) : [{name: ""}];
let p = {
id: item.id,
name: item.name,
departTime: item.departTime ? item.departTime : 0,
address: item.addrDetail ? item.addrDetail : item.address,
companyId: item.companyId,
province: item.addrProvince ? item.addrProvince : item.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: item.addrCity ? item.addrCity : item.city,
longitude: item.longitude,
latitude: item.latitude,
type: 0,
rank: item.rank
};
siteDTOS.push(p);
});
if (this.departureList.length <= 0) {
this.$notify({
title: '警告',
message: '请选择出发地',
type: 'warning',
duration: 2000
});
return;
}
//途径地
this.pathway.map(function (item) {
let provinceObj = item.province ? getRegionByCodes([item.province]) : [{name: ""}];
let cityObj = item.city ? getRegionByCodes([item.city]) : [{name: ""}];
let p = {
id: item.id,
name: item.name,
address: item.addrDetail ? item.addrDetail : item.address,
// companyId: item.id,
province: item.addrProvince ? item.addrProvince : item.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: item.addrCity ? item.addrCity : item.city,
longitude: item.longitude,
latitude: item.latitude,
type: 1,
rank: item.rank
};
siteDTOS.push(p);
});
//destinationObj目的地
let destinationObj = this.destinationObj;
if (!destinationObj.name) {
this.$notify({
title: '警告',
message: '请选择目的地',
type: 'warning',
duration: 2000
});
return;
}
let provinceObj = destinationObj.province ? getRegionByCodes([destinationObj.province]) : [{name: ""}];
let cityObj = destinationObj.city ? getRegionByCodes([destinationObj.city]) : [{name: ""}];
let p = {
id: destinationObj.id,
name: destinationObj.name,
address: destinationObj.addrDetail ? destinationObj.addrDetail : destinationObj.address,
province: destinationObj.addrProvince ? destinationObj.addrProvince : destinationObj.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: destinationObj.addrCity ? destinationObj.addrCity : destinationObj.city,
longitude: destinationObj.longitude,
latitude: destinationObj.latitude,
type: 2
};
siteDTOS.push(p);
let params = {
id: this.form.id,
isOutside: this.form.isOutside,//省内、省外
name: this.form.name,//旅游路线名称
cover: this.form.cover,//封面图
price: this.form.price,//成人价
childPrice: this.form.childPrice,//儿童价
viewCount: this.form.viewCount,//商品浏览量
saleCount: this.form.saleCount,//商品销售量
describe: this.form.describe,//商品描述
content: this.form.content,//商品详情(行程亮点)
introduce: this.form.introduce,//行程介绍
explain: this.form.explain,//费用说明
rank: this.form.rank,//旅行排序
recommend: this.form.recommend,//是否推荐:0-未推荐;1-已推荐
isMember: this.form.isMember,//是否启用会员价
stock: this.form.stock,//库存
unit: this.form.unit,//单位
number: this.form.number,//活动天数
bannerDTOS: this.form.bannerDTOS,//banner轮播图
siteDTOS: siteDTOS,//出发地type=0,途径地type=1,目的地type=2
priceDTOS: this.form.tourDepartTimeVo,//活动日期
tagDTOS: tagDTOS,//旅游标签
posterBackground: this.form.posterBackground,//海报背景
alt: this.form.alt, //seo 标签优化
imgTitle: this.form.imgTitle,
imgKeyword: this.form.imgKeyword,
imgDesc: this.form.imgDesc
};
console.log(params);
this.isCreate = true;
console.log(this.form);
goodsEdit(params).then(response => {
this.isCreate = false;
if (response.status === 200) {
this.$notify({
title: '成功',
message: '编辑成功',
type: 'success',
duration: 2000
});
this.$emit("oneTourDialogEvent", true);
} else {
this.$notify({
title: '编辑失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
} else {
return;
}
});
},
/**
* 获取全部旅游标签
* */
getAllLabelList() {
getAllTourTag().then(response => {
this.allLabelList = response.data;
});
},
/**
* 关闭目的地弹框
* */
destinationEvent(obj) {
this.showDestinationVisible = false;
if (obj) {
this.destinationObj = obj;
console.log(obj);
}
},
/**
* 选择目的地
* */
selectDestination() {
let that = this;
this.destinationObj.showTitle = "目的地编辑";
this.destinationObj.headTitle = "目的地名称";
this.destinationObj.eventName = 'destinationEvent';
this.destinationObj.keyword = this.destinationObj.address;
this.showDestinationVisible = true;
},
/**
* 关闭活动日期
* */
tourDepartTimeEvent(params) {
this.showTimeVisible = false;
if (params) {
this.form.number = params.num;
this.form.tourDepartTimeVo = params.priceDTOS;
console.log(params);
}
},
/**
* 关闭途径地弹框
* */
pathWayEvent(obj) {
this.showPathWayVisible = false;
if (obj) {
if (obj.showTitle == "途径地编辑") {
if (obj.method == "delete") {
//删除当前路径
this.pathway.splice(obj, 1);
} else {
this.onePathObj = obj;
}
} else {
this.pathway.push(obj);
}
console.log(obj);
}
},
/**
* 编辑一条途径地数据
* */
selectPathway(obj) {
let that = this;
console.log(obj);
this.onePathObj = obj;
this.onePathObj.showTitle = "途径地编辑";
this.onePathObj.headTitle = "途径地名称";
},
/**
* 关闭旅游标签弹框
* */
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.tagDTOS = arr;
this.checkList = ckeckList;
console.log(obj);
}
},
/**
* 编辑一条途径地
**/
editPathway(item) {
this.onePathObj = item;
this.onePathObj.showTitle = "途径地编辑";//弹框名称
this.onePathObj.headTitle = "途径地名称";
this.onePathObj.keyword = item.address,//根据关键词查找经纬度
this.onePathObj.eventName = "pathWayEvent";
this.showPathWayVisible = true;
},
/**
* 添加途径地
* */
addPathway() {
let that = this;
this.onePathObj = {
showTitle: "途径地添加",//弹框名称
headTitle: "途径地名称",
name: undefined,//地址名称
keyword: "东莞市",//根据关键词查找经纬度
address: undefined,//详细地址
longitude: 113.758993,
latitude: 23.031565,
eventName: "pathWayEvent"
};
this.showPathWayVisible = true;
},
/**
* 添加时间
* */
editTime() {
this.showTimeVisible = true;
},
/**
* 获取一条旅游路线
* */
getOneGoods(id) {
let params = {
id: id
};
let that = this;
getOneGoodsById(params).then(response => {
that.pathway = [];
response.data.tourDepartVo.map(function (item) {
if (item.type == 0) {
//出发地
that.departureList.push(item);
}
if (item.type == 2 && that.destinationObj.name == "") {
//目的地
that.destinationObj = item;
}
if (item.type == 1) {
//途径地
that.pathway.push(item);
}
});
let arr = [];
this.form = response.data;
this.allLabelList.map(function (b) {
response.data.tagDTOS.map(function (item) {
if (item.tagId == b.id) {
arr.push(item.name);
}
});
});
this.checkList = arr;
});
let siteDTOS = [];
//出发地
this.departureList.map(function (item) {
let pp = item.province ? item.province : item.addrProvince;
let c = item.addrCity ? item.addrCity : item.city;
let provinceObj = pp ? getRegionByCodes([pp]) : [{ name: "" }];
let cityObj = c ? getRegionByCodes([c]) : [{ name: "" }];
let p = {
name: item.name,
departTime: item.departTime ? item.departTime : 0,
address: item.addrDetail ? item.addrDetail : item.address,
companyId: item.companyId,
province: item.addrProvince ? item.addrProvince : item.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: item.addrCity ? item.addrCity : item.city,
longitude: item.longitude,
latitude: item.latitude,
type: 0,
rank: item.rank,
};
siteDTOS.push(p);
});
if (this.departureList.length <= 0) {
this.$notify({
title: "警告",
message: "请选择出发地",
type: "warning",
duration: 2000,
});
return;
}
//途径地
this.pathway.map(function (item) {
let provinceObj = item.province
? getRegionByCodes([item.province])
: [{ name: "" }];
let cityObj = item.city
? getRegionByCodes([item.city])
: [{ name: "" }];
// let provinceObj = getRegionByCodes([item.province]);
// let cityObj = getRegionByCodes([item.city]);
let p = {
name: item.name,
address: item.addrDetail ? item.addrDetail : item.address,
// companyId: item.id,
province: item.addrProvince ? item.addrProvince : item.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: item.addrCity ? item.addrCity : item.city,
longitude: item.longitude,
latitude: item.latitude,
type: 1,
rank: item.rank,
};
siteDTOS.push(p);
});
//destinationObj目的地
let destinationObj = this.destinationObj;
if (!destinationObj.name) {
this.$notify({
title: "警告",
message: "请选择目的地",
type: "warning",
duration: 2000,
});
return;
}
let provinceObj = destinationObj.province
? getRegionByCodes([destinationObj.province])
: [{ name: "" }];
let cityObj = destinationObj.city
? getRegionByCodes([destinationObj.city])
: [{ name: "" }];
let p = {
name: destinationObj.name,
address: destinationObj.addrDetail
? destinationObj.addrDetail
: destinationObj.address,
province: destinationObj.addrProvince
? destinationObj.addrProvince
: destinationObj.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: destinationObj.addrCity
? destinationObj.addrCity
: destinationObj.city,
longitude: destinationObj.longitude,
latitude: destinationObj.latitude,
type: 2,
};
siteDTOS.push(p);
this.isCreate = true;
let params = {
isOutside: this.form.isOutside, //省内、省外
name: this.form.name, //旅游路线名称
cover: this.form.cover, //封面图
price: this.form.price, //成人价
childPrice: this.form.childPrice, //儿童价
viewCount: this.form.viewCount, //商品浏览量
saleCount: this.form.saleCount, //商品销售量
describe: this.form.describe, //商品描述
content: this.form.content, //商品详情(行程亮点)
introduce: this.form.introduce, //行程介绍
explain: this.form.explain, //费用说明
rank: this.form.rank, //旅行排序
recommend: this.form.recommend, //是否推荐:0-未推荐;1-已推荐
isMember: this.form.isMember, //是否启用会员价
stock: this.form.stock, //库存
unit: this.form.unit, //单位
number: this.form.number, //活动天数
bannerDTOS: this.form.bannerDTOS, //banner轮播图
siteDTOS: siteDTOS, //出发地type=0,途径地type=1,目的地type=2
priceDTOS: this.form.tourDepartTimeVo, //活动日期
tagDTOS: tagDTOS, //旅游标签
posterBackground: this.form.posterBackground, //海报背景
alt: this.form.alt, //seo 标签优化
imgTitle: this.form.imgTitle,
imgKeyword: this.form.imgKeyword,
imgDesc: this.form.imgDesc,
};
console.log(params);
goodsEdit(params).then((response) => {
this.isCreate = false;
if (response.status === 200) {
this.$notify({
title: "成功",
message: "添加成功",
type: "success",
duration: 2000,
});
this.$emit("oneTourDialogEvent", true);
} else {
this.$notify({
title: "添加失败",
message: rsCode.msg[response.code]
? rsCode.msg[response.code]
: "操作失败!",
type: "error",
duration: 2000,
});
}
});
} else {
return;
}
});
},
/**
* 编辑
* */
update(formName) {
//旅游标签
const set = this.$refs;
set[formName].validate((valid) => {
if (valid) {
let tagDTOS = [];
this.form.tagDTOS.map(function (item) {
if (item.tagId) {
tagDTOS.push({ tagId: item.tagId });
} else {
tagDTOS.push({ tagId: item.id });
}
});
let siteDTOS = [];
//出发地
this.departureList.map(function (item) {
let pp = item.province ? item.province : item.addrProvince;
let c = item.addrCity ? item.addrCity : item.city;
let provinceObj = pp ? getRegionByCodes([pp]) : [{ name: "" }];
let cityObj = c ? getRegionByCodes([c]) : [{ name: "" }];
let p = {
id: item.id,
name: item.name,
departTime: item.departTime ? item.departTime : 0,
address: item.addrDetail ? item.addrDetail : item.address,
companyId: item.companyId,
province: item.addrProvince ? item.addrProvince : item.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: item.addrCity ? item.addrCity : item.city,
longitude: item.longitude,
latitude: item.latitude,
type: 0,
rank: item.rank,
};
siteDTOS.push(p);
});
if (this.departureList.length <= 0) {
this.$notify({
title: "警告",
message: "请选择出发地",
type: "warning",
duration: 2000,
});
return;
}
//途径地
this.pathway.map(function (item) {
let provinceObj = item.province
? getRegionByCodes([item.province])
: [{ name: "" }];
let cityObj = item.city
? getRegionByCodes([item.city])
: [{ name: "" }];
let p = {
id: item.id,
name: item.name,
address: item.addrDetail ? item.addrDetail : item.address,
// companyId: item.id,
province: item.addrProvince ? item.addrProvince : item.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: item.addrCity ? item.addrCity : item.city,
longitude: item.longitude,
latitude: item.latitude,
type: 1,
rank: item.rank,
};
siteDTOS.push(p);
});
//destinationObj目的地
let destinationObj = this.destinationObj;
if (!destinationObj.name) {
this.$notify({
title: "警告",
message: "请选择目的地",
type: "warning",
duration: 2000,
});
return;
}
let provinceObj = destinationObj.province
? getRegionByCodes([destinationObj.province])
: [{ name: "" }];
let cityObj = destinationObj.city
? getRegionByCodes([destinationObj.city])
: [{ name: "" }];
let p = {
id: destinationObj.id,
name: destinationObj.name,
address: destinationObj.addrDetail
? destinationObj.addrDetail
: destinationObj.address,
province: destinationObj.addrProvince
? destinationObj.addrProvince
: destinationObj.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: destinationObj.addrCity
? destinationObj.addrCity
: destinationObj.city,
longitude: destinationObj.longitude,
latitude: destinationObj.latitude,
type: 2,
};
siteDTOS.push(p);
let params = {
id: this.form.id,
isOutside: this.form.isOutside, //省内、省外
name: this.form.name, //旅游路线名称
cover: this.form.cover, //封面图
price: this.form.price, //成人价
childPrice: this.form.childPrice, //儿童价
viewCount: this.form.viewCount, //商品浏览量
saleCount: this.form.saleCount, //商品销售量
describe: this.form.describe, //商品描述
content: this.form.content, //商品详情(行程亮点)
introduce: this.form.introduce, //行程介绍
explain: this.form.explain, //费用说明
rank: this.form.rank, //旅行排序
recommend: this.form.recommend, //是否推荐:0-未推荐;1-已推荐
isMember: this.form.isMember, //是否启用会员价
stock: this.form.stock, //库存
unit: this.form.unit, //单位
number: this.form.number, //活动天数
bannerDTOS: this.form.bannerDTOS, //banner轮播图
siteDTOS: siteDTOS, //出发地type=0,途径地type=1,目的地type=2
priceDTOS: this.form.tourDepartTimeVo, //活动日期
tagDTOS: tagDTOS, //旅游标签
posterBackground: this.form.posterBackground, //海报背景
alt: this.form.alt, //seo 标签优化
imgTitle: this.form.imgTitle,
imgKeyword: this.form.imgKeyword,
imgDesc: this.form.imgDesc,
};
console.log(params);
this.isCreate = true;
console.log(this.form);
goodsEdit(params).then((response) => {
this.isCreate = false;
if (response.status === 200) {
this.$notify({
title: "成功",
message: "编辑成功",
type: "success",
duration: 2000,
});
this.$emit("oneTourDialogEvent", true);
} else {
this.$notify({
title: "编辑失败",
message: rsCode.msg[response.code]
? rsCode.msg[response.code]
: "操作失败!",
type: "error",
duration: 2000,
});
}
});
} else {
return;
}
});
},
/**
* 获取全部旅游标签
* */
getAllLabelList() {
getAllTourTag().then((response) => {
this.allLabelList = response.data;
});
},
//轮播
let fileList2 = [];
response.data.bannerDTOS.map(function (item) {
let p = {
url: item.cover
};
fileList2.push(p);
});
this.fileList2 = fileList2;
this.form.isMember = this.form.isMember + "";
this.form.recommend = this.form.recommend + "";
this.form.isOutside = this.form.isOutside + "";
this.activeName2 = "first";
})
},
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.departureObj = item;
console.log(item);
},
createFilter(queryString) {
return (restaurant) => {
return (restaurant.name.indexOf(queryString.toLowerCase()) != -1);
};
},
/**
* 旅游-弹框-取消
* */
cancelTour() {
this.cleanForm();
this.$emit("oneTourDialogEvent", false);
},
/**
* 富文本 旅游
* */
editorReadyEvent(instance) {
let t = this;
instance.addListener('contentChange', () => {
if (t.activeName2 == "first") {
t.form.content = instance.getContent();
} else if (t.activeName2 == "second") {
t.form.introduce = instance.getContent();
} else if (t.activeName2 == "third") {
t.form.explain = instance.getContent();
}
});
},
// /**
// * 富文本内容 费用说明
// * @param step
// */
// handelExplainIncrease(step) {
// this.form.explain = step;
// },
// /**
// * 行程介绍 富文本
// * */
// handelIntroduceIncrease(step){
// this.form.introduce = step;
// },
// /**
// * 富文本 content行程亮点
// * */
// 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.bannerDTOS.map(function (item) {
if (item.cover != file.url) {
arr.push(item);
}
});
this.form.bannerDTOS = arr;
},
/**
* 封面图上传
* **/
handleAvatarSuccess(res, file) {
this.percent = 0;
this.imgFlag = false;
this.form.cover = res.data;
},
/**
* 海报背景上传
* **/
handlePosterSuccess(res, file) {
this.percent_poster = 0;
this.imgPosterFlag = false;
this.form.posterBackground = res.data;
},
/**
* 海报背景图上传进度
* */
uploadPosterProcess(event, file, fileList) {
this.imgPosterFlag = true;
console.log(event.percent);
this.percent_poster = Math.floor(event.percent);
},
/**
* banner上传
* */
handleBannerSuccess(res, file) {
this.fileList2.push({url: res.data});
this.form.bannerDTOS.push({cover: res.data});
},
/**
* 清空旅游弹框数据
*/
cleanForm() {
this.onePathObj = {name: ""};//待编辑的途径地
this.destinationObj = {name: ""},//目的地
this.departureList = [],//出发地列表
this.departureObj = {name: ""},//出发地
this.pathway = [],//途径地
this.fileList2 = [],
this.activeName2 = '',//行程亮点
this.form = {
isOutside: "0",//省内、省外
childPrice: undefined,//儿童价
tourDepartVo: undefined,//type:0出发地 1途径地 2目的地
content: "",//行程亮点
cover: undefined,//封面图
describe: undefined,//描述
introduce: "",//行程介绍
crtTime: undefined,
explain: "",//费用说明
name: undefined,//旅行名称
price: undefined,//成人价
rank: undefined,
recommend: "0",//是否推荐0:不推荐,1推荐
saleCount: undefined,//初始销量
status: undefined,//0:未发布,1:上架 2:下架
stock: undefined,//总人数
unit: undefined,//单位
updTime: undefined,//更新时间
viewCount: undefined,//浏览量
isMember: "0",//是否是会员商品0不启用,1启用
tagDTOS: [],//旅行标签
bannerDTOS: [],//banner轮播
tourDepartTimeVo: [],//活动时间
posterBackground: '',//海报背景
alt: '',
imgTitle: undefined,
imgKeyword: undefined,
imgDesc: undefined
},
this.showDestinationVisible = false,//编辑目的地
this.showPathWayVisible = false,//编辑途径地
this.showTimeVisible = false;//编辑时间
this.activeName2 = "";
/**
* 关闭目的地弹框
* */
destinationEvent(obj) {
this.showDestinationVisible = false;
if (obj) {
this.destinationObj = obj;
console.log(obj);
}
},
/**
* 选择目的地
* */
selectDestination() {
let that = this;
this.destinationObj.showTitle = "目的地编辑";
this.destinationObj.headTitle = "目的地名称";
this.destinationObj.eventName = "destinationEvent";
this.destinationObj.keyword = this.destinationObj.address;
this.showDestinationVisible = true;
},
/**
* 关闭活动日期
* */
tourDepartTimeEvent(params) {
this.showTimeVisible = false;
if (params) {
this.form.number = params.num;
this.form.tourDepartTimeVo = params.priceDTOS;
console.log(params);
}
},
/**
* 关闭途径地弹框
* */
pathWayEvent(obj) {
this.showPathWayVisible = false;
if (obj) {
if (obj.showTitle == "途径地编辑") {
if (obj.method == "delete") {
//删除当前路径
this.pathway.splice(obj, 1);
} else {
this.onePathObj = obj;
}
} else {
this.pathway.push(obj);
}
console.log(obj);
}
},
/**
* 编辑一条途径地数据
* */
selectPathway(obj) {
let that = this;
console.log(obj);
this.onePathObj = obj;
this.onePathObj.showTitle = "途径地编辑";
this.onePathObj.headTitle = "途径地名称";
},
/**
* 关闭旅游标签弹框
* */
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.tagDTOS = arr;
this.checkList = ckeckList;
console.log(obj);
}
},
/**
* 编辑一条途径地
**/
editPathway(item) {
this.onePathObj = item;
this.onePathObj.showTitle = "途径地编辑"; //弹框名称
this.onePathObj.headTitle = "途径地名称";
(this.onePathObj.keyword = item.address), //根据关键词查找经纬度
(this.onePathObj.eventName = "pathWayEvent");
this.showPathWayVisible = true;
},
/**
* 添加途径地
* */
addPathway() {
let that = this;
this.onePathObj = {
showTitle: "途径地添加", //弹框名称
headTitle: "途径地名称",
name: undefined, //地址名称
keyword: "东莞市", //根据关键词查找经纬度
address: undefined, //详细地址
longitude: 113.758993,
latitude: 23.031565,
eventName: "pathWayEvent",
};
this.showPathWayVisible = true;
},
/**
* 添加时间
* */
editTime() {
this.showTimeVisible = true;
},
/**
* 获取一条旅游路线
* */
getOneGoods(id) {
let params = {
id: id,
};
let that = this;
getOneGoodsById(params).then((response) => {
that.pathway = [];
response.data.tourDepartVo.map(function (item) {
if (item.type == 0) {
//出发地
that.departureList.push(item);
}
if (item.type == 2 && that.destinationObj.name == "") {
//目的地
that.destinationObj = item;
}
if (item.type == 1) {
//途径地
that.pathway.push(item);
}
});
let arr = [];
this.form = response.data;
this.allLabelList.map(function (b) {
response.data.tagDTOS.map(function (item) {
if (item.tagId == b.id) {
arr.push(item.name);
}
});
});
this.checkList = arr;
//轮播
let fileList2 = [];
response.data.bannerDTOS.map(function (item) {
let p = {
url: item.cover,
};
fileList2.push(p);
});
this.fileList2 = fileList2;
this.form.isMember = this.form.isMember + "";
this.form.recommend = this.form.recommend + "";
this.form.isOutside = this.form.isOutside + "";
this.activeName2 = "first";
});
},
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.departureObj = item;
console.log(item);
},
createFilter(queryString) {
return (restaurant) => {
return restaurant.name.indexOf(queryString.toLowerCase()) != -1;
};
},
/**
* 旅游-弹框-取消
* */
cancelTour() {
this.cleanForm();
this.$emit("oneTourDialogEvent", false);
},
/**
* 富文本 旅游
* */
editorReadyEvent(instance) {
let t = this;
instance.addListener("contentChange", () => {
if (t.activeName2 == "first") {
t.form.content = instance.getContent();
} else if (t.activeName2 == "second") {
t.form.introduce = instance.getContent();
} else if (t.activeName2 == "third") {
t.form.explain = instance.getContent();
}
}
});
},
// /**
// * 富文本内容 费用说明
// * @param step
// */
// handelExplainIncrease(step) {
// this.form.explain = step;
// },
// /**
// * 行程介绍 富文本
// * */
// handelIntroduceIncrease(step){
// this.form.introduce = step;
// },
// /**
// * 富文本 content行程亮点
// * */
// 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.bannerDTOS.map(function (item) {
if (item.cover != file.url) {
arr.push(item);
}
});
this.form.bannerDTOS = arr;
},
/**
* 封面图上传
* **/
handleAvatarSuccess(res, file) {
this.percent = 0;
this.imgFlag = false;
this.form.cover = res.data;
},
/**
* 海报背景上传
* **/
handlePosterSuccess(res, file) {
this.percent_poster = 0;
this.imgPosterFlag = false;
this.form.posterBackground = res.data;
},
/**
* 海报背景图上传进度
* */
uploadPosterProcess(event, file, fileList) {
this.imgPosterFlag = true;
console.log(event.percent);
this.percent_poster = Math.floor(event.percent);
},
/**
* banner上传
* */
handleBannerSuccess(res, file) {
this.fileList2.push({ url: res.data });
this.form.bannerDTOS.push({ cover: res.data });
},
/**
* 清空旅游弹框数据
*/
cleanForm() {
this.onePathObj = { name: "" }; //待编辑的途径地
(this.destinationObj = { name: "" }), //目的地
(this.departureList = []), //出发地列表
(this.departureObj = { name: "" }), //出发地
(this.pathway = []), //途径地
(this.fileList2 = []),
(this.activeName2 = ""), //行程亮点
(this.form = {
isOutside: "0", //省内、省外
childPrice: undefined, //儿童价
tourDepartVo: undefined, //type:0出发地 1途径地 2目的地
content: "", //行程亮点
cover: undefined, //封面图
describe: undefined, //描述
introduce: "", //行程介绍
crtTime: undefined,
explain: "", //费用说明
name: undefined, //旅行名称
price: undefined, //成人价
rank: undefined,
recommend: "0", //是否推荐0:不推荐,1推荐
saleCount: undefined, //初始销量
status: undefined, //0:未发布,1:上架 2:下架
stock: undefined, //总人数
unit: undefined, //单位
updTime: undefined, //更新时间
viewCount: undefined, //浏览量
isMember: "0", //是否是会员商品0不启用,1启用
tagDTOS: [], //旅行标签
bannerDTOS: [], //banner轮播
tourDepartTimeVo: [], //活动时间
posterBackground: "", //海报背景
alt: "",
imgTitle: undefined,
imgKeyword: undefined,
imgDesc: undefined,
}),
(this.showDestinationVisible = false), //编辑目的地
(this.showPathWayVisible = false), //编辑途径地
(this.showTimeVisible = false); //编辑时间
this.activeName2 = "";
},
},
};
</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