Commit 1648b767 authored by 扫地僧's avatar 扫地僧

管理系统初始化

parent baa60211
......@@ -7,8 +7,9 @@ module.exports = {
// sit: "http://192.168.1.102:8080/logistics-mgt",//超哥本地
// sit: "http://192.168.200.173:8080",//杨飞本地
// sit:"http://flynet.imwork.net:35609/logistics-mgt",
sit:"https://chalk.fqyxa.com", //上线环境
// sit:"https://chalk.fqyxa.com", //上线环境
// sit:"http://192.168.1.103:8781",//毅豪本地
sit:"http://192.168.1.112:8080/store-system",
// -----------------------------------------------------------------
prod: "http:正式环境"
}
import request from './request'
import qs from 'qs'
export function getMessagePushList(data) {
return request({
url: '/messagePush/getMessagePushList',
method: 'post',
data: qs.stringify(data)
})
export function administratorsList(data) {
return request({
url: '/administrators/administratorsList',
method: 'post',
data: qs.stringify(data)
})
}
export function addOrEditMessagePush(data) {
return request({
url: '/messagePush/addOrEditMessagePush',
method: 'post',
data: qs.stringify(data)
})
export function addOrEditAdministrators(data) {
return request({
url: '/administrators/addOrEditAdministrators',
method: 'post',
data: qs.stringify(data)
})
}
export function delMessagePush(data) {
return request({
url: '/messagePush/delMessagePush',
method: 'post',
data: qs.stringify(data)
})
export function delAdministrators(data) {
return request({
url: '/administrators/delAdministrators',
method: 'post',
data: qs.stringify(data)
})
}
export function getMessagePushRecordList(data) {
return request({
url: '/messagePushRecord/getMessagePushRecordList',
method: 'post',
data: qs.stringify(data)
})
}
\ No newline at end of file
import request from './request'
import qs from 'qs'
//品牌列表
export function getCarBrandList(data) {
return request({
url: '/carBrand/getCarBrandList',
method: 'post',
data: qs.stringify(data)
})
}
export function addOrEditCarBrand(data) {
return request({
url: '/carBrand/addOrEditCarBrand',
method: 'post',
data: qs.stringify(data)
})
}
// 车系列表
export function getCarSeriesList(data) {
return request({
url: '/carSeries/getCarSeriesList',
method: 'post',
data: qs.stringify(data)
})
}
export function addOrEditCarSeries(data) {
return request({
url: '/carSeries/addOrEditCarSeries',
method: 'post',
data: qs.stringify(data)
})
}
// 车辆年代
export function getCarPreiodList(data) {
return request({
url: '/carPeriod/getCarPreiodList',
method: 'post',
data: qs.stringify(data)
})
}
export function addOrEditCarPreiod(data) {
return request({
url: '/carPeriod/addOrEditCarPreiod',
method: 'post',
data: qs.stringify(data)
})
}
// 车辆列表
export function getCarList(data) {
return request({
url: '/car/getCarList',
method: 'post',
data: qs.stringify(data)
})
}
export function addOrEditCar(data) {
return request({
url: '/car/addOrEditCar',
method: 'post',
data: qs.stringify(data)
})
}
// 车辆删除
export function delCarByCarId(data) {
return request({
url: '/car/delCarByCarId',
method: 'post',
data: qs.stringify(data)
})
}
// 用车订单
export function getUseCarOrderList(data) {
return request({
url: '/useCarOrder/getUseCarOrderList',
method: 'post',
data: qs.stringify(data)
})
}
export function addOrEditUseCarOrder(data) {
return request({
url: '/useCarOrder/addOrEditUseCarOrder',
method: 'post',
data: qs.stringify(data)
})
}
// 用车事由
export function getUseCarReasonList(data) {
return request({
url: '/useCarReason/getUseCarReasonList',
method: 'post',
data: qs.stringify(data)
})
}
export function addOrEditUseCarReason(data) {
return request({
url: '/useCarReason/addOrEditUseCarReason',
method: 'post',
data: qs.stringify(data)
})
}
// 三级联动获取车辆接口
// 获取品牌列表
export function getCarBrands() {
return request({
url: '/carBrand/getCarBrands',
method: 'post'
})
}
// 获取车系列表
export function getCarSeries(data) {
// param carBrandId
return request({
url: '/carSeries/getCarSeries',
method: 'post',
data: qs.stringify(data)
})
}
export function getCars() {
// 可用车辆列表
return request({
url: '/car/getCars',
method: 'post'
})
}
import request from './request'
import qs from 'qs'
// 会议室列表
export function getMeetingRoomList(data) {
return request({
url: '/meetingRoom/getMeetingRoomList',
method: 'post',
data:qs.stringify(data)
})
}
export function addOrEditMeetingRoom(data) {
return request({
url: '/meetingRoom/addOrEditMeetingRoom',
method: 'post',
data:qs.stringify(data)
})
}
// 会议室订单列表
export function getMeetingRoomOrderList(data) {
return request({
url: '/meetingRoomOrder/getMeetingRoomOrderList',
method: 'post',
data:qs.stringify(data)
})
}
export function addOrEditMeetingRoomOrder(data) {
return request({
url: '/meetingRoomOrder/addOrEditMeetingRoomOrder',
method: 'post',
data:qs.stringify(data)
})
}
//会议室申请事由
export function getMeetingRoomReasonList(data) {
return request({
url: '/meetingRoomReason/getMeetingRoomReasonList',
method: 'post',
data:qs.stringify(data)
})
}
export function addOrEditMeetingRoomReason(data) {
return request({
url: '/meetingRoomReason/addOrEditMeetingRoomReason',
method: 'post',
data:qs.stringify(data)
})
}
// 获取可用会议室
export function getMeetingRooms() {
return request({
url: '/meetingRoom/getMeetingRooms',
method: 'post'
})
}
// 会议室评价
export function getMeetingRoomCommentList(data) {
return request({
url: 'meetingRoomComment/getMeetingRoomCommentList',
method: 'post',
data:qs.stringify(data)
})
}
// 获取会服信息
export function getMeetingService(data) {
return request({
url: 'meetingRoomOrder/getMeetingService',
method: 'post',
data:qs.stringify(data)
})
}
// 读取身份证
import axios from 'axios'
import { Message } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
// create an axios instance
const service = axios.create({
baseURL: "https://localhost:24011/ZKIDROnline/ScanReadIdCardInfo?OP-DEV=1&CMD-URL=4", //身份证信息获取地址
timeout: 5000, // request timeout
headers: {'Content-Type':'application/x-www-form-urlencoded'}
})
console.log('请求地址:'+process.env.BASE_API);
// request interceptor
service.interceptors.request.use(config => {
// Do something before request is sent
return config
}, error => {
// Do something with request error
console.log(error) // for debug
Promise.reject(error)
})
// respone interceptor
service.interceptors.response.use(
//暂时这先全部返回,等登录的接口完善以后,再去修改完 response.data
response => response,
/**
* 下面的注释为通过response自定义code来标示请求状态,当code返回如下情况为权限有问题,登出并返回到登录页
* 如通过xmlhttprequest 状态码标识 逻辑可写在下面error中
*/
// const res = response.data;
// if (res.code !== 20000) {
// Message({
// message: res.message,
// type: 'error',
// duration: 5 * 1000
// });
// // 50008:非法的token; 50012:其他客户端登录了; 50014:Token 过期了;
// if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
// MessageBox.confirm('你已被登出,可以取消继续留在该页面,或者重新登录', '确定登出', {
// confirmButtonText: '重新登录',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// store.dispatch('FedLogOut').then(() => {
// location.reload();// 为了重新实例化vue-router对象 避免bug
// });
// })
// }
// return Promise.reject('error');
// } else {
// return response.data;
// }
error => {
console.log('err' + error)// for debug
Message({
message: "请检查身份证读取设备是否安装成功!",
type: 'error',
duration: 2000
})
return Promise.reject(error)
})
export function readCardInfro() {
return service({
method: 'get'
})
}
......@@ -12,6 +12,7 @@ const service = axios.create({
console.log('请求地址:'+process.env.BASE_API);
// request interceptor
service.interceptors.request.use(config => {
debugger
// Do something before request is sent
const userInfro = getUserInfro()
let param = config.data;
......
import request from './request'
import qs from 'qs'
// 菜品列表
export function getRestaurantDishesList(data) {
return request({
url: '/restaurantDishes/getRestaurantDishesList',
method: 'post',
data: qs.stringify(data)
})
}
//添加菜品
export function addOrEditRestaurantDishes(data) {
return request({
url: '/restaurantDishes/addOrEditRestaurantDishes',
method: 'post',
data: qs.stringify(data)
})
}
export function delRestaurantDishes(data) {
return request({
url: '/restaurantDishes/delRestaurantDishes',
method: 'post',
data: qs.stringify(data)
})
}
// 菜单
export function getDailyMenuList(data) {
return request({
url: '/dailyMenu/getDailyMenuList',
method: 'post',
data: qs.stringify(data)
})
}
export function addOrEditDailyMenu(data) {
return request({
url: '/dailyMenu/addOrEditDailyMenu',
method: 'post',
data: qs.stringify(data)
})
}
// 或许可选菜品
export function getRestaurantDishes() {
return request({
url: '/restaurantDishes/getRestaurantDishes',
method: 'post'
})
}
\ No newline at end of file
import request from './request'
import qs from 'qs'
// 根据科室id查询,人员信息
export function getMemberListBySection(data) {
return request({
url: '/member/getMemberListBySection',
method: 'post',
data: qs.stringify(data)
})
}
// 添加访客信息
export function addOrEditVisitor(data) {
return request({
url: '/visitor/addOrEditVisitor',
method: 'post',
data: qs.stringify(data)
})
}
// 获取访客信息列表
export function getVisitorList(data) {
return request({
url: '/visitor/getVisitorList',
method: 'post',
data: qs.stringify(data)
})
}
// 获取访客详情
export function getVisitor(data) {
return request({
url: '/visitor/getVisitor',
method: 'post',
data: qs.stringify(data)
})
}
// 获取访客事由列表
// 获取访客事由
export function getVisitReasonList(data) {
return request({
url: '/visitReason/getVisitReasonList',
method: 'post',
data: qs.stringify(data)
})
}
// 编辑访客事由
export function addOrEditVisitReason(data) {
return request({
url: '/visitReason/addOrEditVisitReason',
method: 'post',
data: qs.stringify(data)
})
}
// 删除事由
export function deleteVisitReason(data) {
return request({
url: '/visitReason/deleteVisitReason',
method: 'post',
data: qs.stringify(data)
})
}
\ No newline at end of file
......@@ -51,23 +51,71 @@ export default new Router({
})
export const asyncRouterMap = [
// 车辆管理
// 商家管理
{
path: '/car',
path: '/store',
alwaysShow:true,
component: Layout,
redirect: '/store/storeList',
meta: {
title: '商家管理',
icon: 'cheliang'
},
children: [
{ path: 'storeList', component: _import('store/storeList'), name: 'store_storeList', meta: { title: '商家列表' }}
]
},
// 运营管理
{
path: '/advert',
alwaysShow:true,
component: Layout,
redirect: '/advert/advertList',
meta: {
title: '运营管理',
icon: 'cheliang'
},
children: [
{ path: 'advertList', component: _import('advert/advertList'), name: 'advert_advertList', meta: { title: '活动列表' }}
]
},
// 店铺管理
{
path: '/administrators',
alwaysShow:true,
component: Layout,
redirect: '/car/brandList',
redirect: '/administrators/administratorstList',
meta: {
title: '车辆管理',
title: '店铺管理',
icon: 'cheliang'
},
children: [
{ path: 'brandList', component: _import('car/brandList'), name: 'car_brandList', meta: { title: '品牌列表' }},
{ path: 'seriesList', component: _import('car/seriesList'), name: 'car_seriesList', meta: { title: '车系列表' }},
{ path: 'yearList', component: _import('car/yearList'), name: 'car_yearList', meta: { title: '年代列表' }},
{ path: 'carList', component: _import('car/carList'), name: 'car_carList', meta: { title: '车辆列表' }}
{ path: 'administratorstList', component: _import('administrators/administratorstList'), name: 'administrators_administratorstList', meta: { title: '店铺管理员列表' }}
]
},
// 员工管理
{
path: '/worker',
alwaysShow:true,
component: Layout,
redirect: '/worker/workerList',
meta: {
title: '员工管理',
icon: 'cheliang'
},
children: [
{ path: 'workerList', component: _import('worker/workerList'), name: 'worker_workerList', meta: { title: '员工列表' }}
]
},
// 系统管理
{
path: '/system',
......
<template>
<div class="model-container">
<el-card shadow="never">
<div slot="header" class="clearfix">
<span><i class="iconfont icon-sousuo"></i>快捷搜索</span>
<div class="btns-wrapper-right">
<el-button type="primary" plain @click="seachFun">确定</el-button>
<el-button type="warning" plain @click="resetFun" :disabled="isActiveReset">重置</el-button>
</div>
</div>
<el-row :gutter="15">
<el-col :span="4">
<el-col class="input-name" :span="7">管理员名称</el-col>
<el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.repairWorkerName" @keyup.enter.native="seachFun"></el-input></el-col>
</el-col>
</el-row>
</el-card>
<el-card>
<div slot="header" class="clearfix">
<!-- <span><i class="iconfont icon-sousuo"></i>表格数据</span> -->
<div class="btns-wrapper-left">
<el-button type="primary" plain @click="add">新增</el-button>
</div>
</div>
<div class="table-wrapper">
<el-table empty-text="暂无数据" :stripe="true" :data="dataOption" v-loading="!dataOption">
<el-table-column prop="repairWorkerName" label="姓名"></el-table-column>
<el-table-column label="性别">
<template slot-scope="scope">
<span>{{scope.row.sex===1?'男':'女'}}</span>
</template>
</el-table-column>
<el-table-column prop="repairWorkerPhone" label="电话"></el-table-column>
<el-table-column prop="repairWorkerIdCard" label="身份证号"></el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">
<span>{{fattTime(scope.row.createTime)}}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="primary" circle class="table-icon" @click="check(scope.row)"><i class="iconfont icon-chakan"></i></el-button>
<el-button type="primary" icon="el-icon-edit" circle class="table-icon" @click="edit(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页处理 -->
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNo"
:page-sizes="[10, 20, 30]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="rowCount">
</el-pagination>
</div>
</el-card>
<!-- 添加dialog -->
<!-- 查看,编辑dialog -->
<el-dialog
:title="dialogTitle"
:visible.sync="dialogState"
width="30%"
:before-close="handleClose">
<div class="dialog-body-content">
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>姓名</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入姓名" v-model="dialogBindData.repairWorkerName"></el-input>
<span v-else>{{dialogBindData.repairWorkerName}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>性别</label></el-col>
<el-col :span="16" class="content-right">
<el-radio-group v-if="dialogType===1 || dialogType===2" v-model="dialogBindData.sex">
<el-radio size="small" :label="1"></el-radio>
<el-radio size="small" :label="0"></el-radio>
</el-radio-group>
<span v-else>{{dialogBindData.sex===1?"男":"女"}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>电话</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入电话号码" v-model="dialogBindData.repairWorkerPhone"></el-input>
<span v-else>{{dialogBindData.repairWorkerPhone}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>身份证号</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入身份证号" v-model="dialogBindData.repairWorkerIdCard"></el-input>
<span v-else>{{dialogBindData.repairWorkerIdCard}}</span>
</el-col>
</el-row>
</div>
<div class="btns-wrapper">
<el-button size="small" @click="handleClose" :disabled="dialogType===3"><i class="iconfont icon-quxiao"></i>取消</el-button>
<el-button v-if="!submmitSuccess" type="primary" size="small" @click="submmitFun" :disabled="dialogType===3"><i class="iconfont icon-tijiao"></i>提交</el-button>
<el-button v-else :loading="true" type="primary" size="small" :disabled="true">提交</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import * as admin from "../../api/administrators";
import * as common from "../../api/common";
import { fattCreateTime } from "../../utils/fattTime";
export default {
data() {
return {
seacherParam: {
repairWorkerName: ""
},
// 表格数据
dataOption: null,
// 分页数据
rowCount: new Number(), //总条数
pageSize: 10, //每页几条
pageNo: 1,
// ---------------------------------------查看和编辑dialog--------------------------------
dialogState: false,
dialogType: 1, // 1--增加 2--编辑 3--查看
dialogBindData: {
repairWorkerId: "",
repairWorkerName: "",
sex: 1,
repairWorkerPhone: "",
repairWorkerIdCard: ""
},
// 是否提交
submmitSuccess: false
};
},
beforeMount() {
this.getList();
},
mounted() {},
methods: {
seachFun() {
this.$seach
.submmit(this, admin.administratorsList)
.then(res => {
this.dataOption = res.data.data;
// 初始化分页数据
this.rowCount = res.data.rowCount;
this.pageSize = res.data.pageSize;
this.$message({
message: "搜索成功",
type: "success"
});
})
.catch(() => {
this.$message({
message: "搜索失败",
type: "warning"
});
});
},
// 重置搜索条件
resetFun() {
this.$seach.reset(this);
this.getList();
},
add() {
this.dialogType = 1;
this.dialogState = true;
},
// del(data) {
// visitor
// .deleteVisitReason({
// visitReasonId: data.visitReasonId
// })
// .then(res => {
// if (res.data.code === "1") {
// this.getList(() => {
// data.delState = false;
// });
// }
// this.$message({
// message: res.data.msg,
// type: "warning"
// });
// data.delState = false;
// });
// },
edit(data) {
this.dialogType = 2;
this.reBindData(data);
this.dialogState = true;
},
check(data) {
this.dialogType = 3;
this.reBindData(data);
this.dialogState = true;
},
//获取的列表数据重新绑定到对应模型上面
reBindData(data) {
for (const key in this.dialogBindData) {
this.dialogBindData[key] = data[key];
}
},
submmitFun() {
// if (this.dialogType === 1) {
// alert(`添加${JSON.stringify(this.dialogBindData)}`);
// } else {
// alert(`编辑${JSON.stringify(this.dialogBindData)}`);
// }
// 发送添加请求
const isSubmitActive = this.dialogBindData.repairWorkerName&&this.dialogBindData.repairWorkerPhone&&this.dialogBindData.repairWorkerIdCard;
if (isSubmitActive) {
this.submmitSuccess = true;
admin.addOrEditAdministrators(this.dialogBindData).then(res => {
this.getList(() => {
this.$message({
message: this.dialogType === 1 ? "添加成功" : "编辑成功",
type: "success"
});
this.submmitSuccess = false;
this.handleClose();
});
});
} else {
this.$message({
message: "请完善提交信息",
type: "warning"
});
}
},
//关闭弹框
handleClose() {
this.dialogState = false;
for (const key in this.dialogBindData) {
if (key === "sex") {
this.dialogBindData[key] = 1;
} else {
this.dialogBindData[key] = "";
}
}
},
// 分页处理
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
this.pageSize = Number(val);
this.getList();
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.pageNo = Number(val);
this.getList();
},
// 获取表格数据
getList(cb) {
admin
.administratorsList({ pageNo: this.pageNo, pageSize: this.pageSize })
.then(res => {
// 初始话表格数据
this.dataOption = res.data.data;
// 初始化分页数据
this.rowCount = res.data.rowCount;
this.pageSize = res.data.pageSize;
cb ? cb() : "";
});
},
// 格式化时间
fattTime(time) {
return fattCreateTime(time);
},
// 改变启用状态
handleIsVailable(data) {
console.log(data.isVailable);
const param = {
visitReasonId: data.visitReasonId,
isVailable: data.isVailable ? 0 : 1
};
visitor.addOrEditVisitReason(param).then(res => {
if (res.data.code === "1") {
this.$message({
message: "设置成功",
type: "success"
});
}
});
}
},
computed: {
// 激活重置按钮
isActiveReset() {
for (const key in this.seacherParam) {
if (this.seacherParam[key]) {
return false;
}
}
return true;
},
//弹框的title
dialogTitle() {
if (this.dialogType === 1) {
return "添加";
}
if (this.dialogType === 2) {
return "编辑";
} else {
return "查看";
}
}
}
};
</script>
<style lang="scss" scoped>
.dialog-body-content {
.el-row {
margin-top: 14px;
line-height: 32px;
&:first-child {
margin-top: 0;
}
.content-left {
text-align: right;
label {
font-weight: normal;
color: #666;
}
}
.content-right {
width: 215px;
span {
display: block;
border-bottom: solid 1px #dedede;
box-sizing: border-box;
padding-left: 15px;
}
}
}
}
</style>
......@@ -9,9 +9,9 @@
</div>
</div>
<el-row :gutter="15">
<el-col :xl="4" :lg="6" :md="6" :sm="8">
<el-col class="input-name" :span="7">品牌名称</el-col>
<el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.carBrandName" @keyup.enter.native="seachFun"></el-input></el-col>
<el-col :span="4">
<el-col class="input-name" :span="7">维修工名称</el-col>
<el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.repairWorkerName" @keyup.enter.native="seachFun"></el-input></el-col>
</el-col>
</el-row>
</el-card>
......@@ -26,7 +26,14 @@
<el-table empty-text="暂无数据" :stripe="true" :data="dataOption" v-loading="!dataOption">
<el-table-column prop="carBrandName" label="品牌名称"></el-table-column>
<el-table-column prop="repairWorkerName" label="姓名"></el-table-column>
<el-table-column label="性别">
<template slot-scope="scope">
<span>{{scope.row.sex===1?'男':'女'}}</span>
</template>
</el-table-column>
<el-table-column prop="repairWorkerPhone" label="电话"></el-table-column>
<el-table-column prop="repairWorkerIdCard" label="身份证号"></el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">
<span>{{fattTime(scope.row.createTime)}}</span>
......@@ -88,7 +95,6 @@
<!-- 查看,编辑dialog -->
<el-dialog
v-el-drag-dialog
:title="dialogTitle"
:visible.sync="dialogState"
width="30%"
......@@ -96,13 +102,53 @@
<div class="dialog-body-content">
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>品牌名称</label></el-col>
<el-col :span="8" class="content-left"><label>姓名</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入姓名" v-model="dialogBindData.repairWorkerName"></el-input>
<span v-else>{{dialogBindData.repairWorkerName}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>性别</label></el-col>
<el-col :span="16" class="content-right">
<el-radio-group v-if="dialogType===1 || dialogType===2" v-model="dialogBindData.sex">
<el-radio size="small" :label="1"></el-radio>
<el-radio size="small" :label="0"></el-radio>
</el-radio-group>
<span v-else>{{dialogBindData.sex===1?"男":"女"}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>电话</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入电话号码" v-model="dialogBindData.repairWorkerPhone"></el-input>
<span v-else>{{dialogBindData.repairWorkerPhone}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>身份证号</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入品牌名称" v-model="dialogBindData.carBrandName"></el-input>
<span v-else>{{dialogBindData.carBrandName}}</span>
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入身份证号" v-model="dialogBindData.repairWorkerIdCard"></el-input>
<span v-else>{{dialogBindData.repairWorkerIdCard}}</span>
</el-col>
</el-row>
<!-- <el-row :gutter="15">
<el-col :span="8" class="content-left"><label>备注</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" type="textarea" rows="3" placeholder="请输入备注" resize="none" v-model="dialogBindData.memo"></el-input>
<span v-else>{{dialogBindData.memo || "暂无备注"}}</span>
</el-col>
</el-row> -->
</div>
<div class="btns-wrapper">
<el-button size="small" @click="handleClose" :disabled="dialogType===3"><i class="iconfont icon-quxiao"></i>取消</el-button>
......@@ -114,12 +160,10 @@
</template>
<script>
import * as car from "../../api/car";
import * as repair from "../../api/repair";
import * as common from "../../api/common";
import { fattCreateTime } from "../../utils/fattTime";
import elDragDialog from "@/directive/el-dragDialog";
export default {
directives:{elDragDialog},
data() {
return {
seacherParam: {
......@@ -151,8 +195,11 @@ export default {
// visitReasonId:"1001"
dialogBindData: {
carBrandId: "",
carBrandName: ""
repairWorkerId: "",
repairWorkerName: "",
sex: 1,
repairWorkerPhone: "",
repairWorkerIdCard: ""
},
// 是否提交
submmitSuccess: false
......@@ -166,7 +213,7 @@ export default {
methods: {
seachFun() {
this.$seach
.submmit(this, car.getCarBrandList)
.submmit(this, repair.getRepairWorkerList)
.then(res => {
this.dataOption = res.data.data;
// 初始化分页数据
......@@ -234,10 +281,10 @@ export default {
// alert(`编辑${JSON.stringify(this.dialogBindData)}`);
// }
// 发送添加请求
const isSubmitActive = this.dialogBindData.carBrandName;
const isSubmitActive = this.dialogBindData.repairWorkerName&&this.dialogBindData.repairWorkerPhone&&this.dialogBindData.repairWorkerIdCard;
if (isSubmitActive) {
this.submmitSuccess = true;
car.addOrEditCarBrand(this.dialogBindData).then(res => {
repair.addOrEditRepairWorker(this.dialogBindData).then(res => {
this.getList(() => {
this.$message({
message: this.dialogType === 1 ? "添加成功" : "编辑成功",
......@@ -278,21 +325,9 @@ export default {
},
// 获取表格数据
getList(cb) {
let param = {
pageNo: this.pageNo,
pageSize: this.pageSize
};
// 组装搜索参数
for (const key in this.seacherParam) {
if (this.seacherParam[key]===0 || this.seacherParam[key]) {
param[key] = this.seacherParam[key]
}
}
car
.getCarBrandList(param)
repair
.getRepairWorkerList({ pageNo: this.pageNo, pageSize: this.pageSize })
.then(res => {
debugger
// 初始话表格数据
this.dataOption = res.data.data;
// 初始化分页数据
......
<template>
<div class="model-container">
<el-card shadow="never">
<div slot="header" class="clearfix">
<span><i class="iconfont icon-sousuo"></i>快捷搜索</span>
<div class="btns-wrapper-right">
<el-button type="primary" plain @click="seachFun">确定</el-button>
<el-button type="warning" plain @click="resetFun" :disabled="isActiveReset">重置</el-button>
</div>
</div>
<el-row :gutter="15">
<el-col :xl="4" :lg="6" :md="6" :sm="8">
<el-col class="input-name" :span="7">车牌号</el-col>
<el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.carPlateNo" @keyup.enter.native="seachFun"></el-input></el-col>
</el-col>
<el-col :xl="4" :lg="6" :md="6" :sm="8">
<el-col class="input-name":span="7">上下线</el-col>
<el-col :span="17" style="line-height:40px">
<el-select v-model="seacherParam.onOffLineStatus" placeholder="请选择">
<el-option
v-for="item in onOffLineStatuData"
:key="item.code"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
</el-col>
</el-col>
<el-col :xl="4" :lg="6" :md="6" :sm="8">
<el-col class="input-name" :span="7">使用状态</el-col>
<el-col :span="17" style="line-height:40px">
<el-select v-model="seacherParam.userageStatus" placeholder="请选择">
<el-option
v-for="item in userageStatuData"
:key="item.code"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
</el-col>
</el-col>
</el-row>
</el-card>
<el-card>
<div slot="header" class="clearfix">
<!-- <span><i class="iconfont icon-sousuo"></i>表格数据</span> -->
<div class="btns-wrapper-left">
<el-button type="primary" plain @click="add">新增</el-button>
</div>
</div>
<div class="table-wrapper">
<el-table empty-text="暂无数据" :stripe="true" :data="dataOption" v-loading="!dataOption">
<el-table-column prop="carPlateNo" label="车牌号"></el-table-column>
<el-table-column prop="carBrandName" label="品牌"></el-table-column>
<el-table-column prop="carSeriesName" label="车系"></el-table-column>
<el-table-column prop="carPeriodName" label="年代"></el-table-column>
<el-table-column label="座位数">
<template slot-scope="scope">
<span>{{viewSeatNum(scope.row.seatNumber)}}</span>
</template>
</el-table-column>
<el-table-column label="排量">
<template slot-scope="scope">
<span>{{scope.row.displacement+"L"}}</span>
</template>
</el-table-column>
<el-table-column label="箱型">
<template slot-scope="scope">
<span>{{viewGearBox(scope.row.gearBox)}}</span>
</template>
</el-table-column>
<el-table-column label="上下线状态">
<template slot-scope="scope">
<span>{{scope.row.onOffLineStatus==1?'上线':'下线'}}</span>
</template>
</el-table-column>
<el-table-column label="使用状态">
<template slot-scope="scope">
<span>{{scope.row.userageStatus==1?'已预占':'空闲'}}</span>
</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">
<span>{{scope.row.createTime?fattTime(scope.row.createTime):'暂无数据'}}</span>
</template>
</el-table-column>
<!-- <el-table-column prop="memo" label="备注"></el-table-column> -->
<!-- <el-table-column label="启用状态">
<template slot-scope="scope">
<span>
<el-switch
v-model="scope.row.isVailable"
:active-value="1"
:inactive-value="0"
@change="handleIsVailable(scope.row)">
</el-switch>
</span>
</template>
</el-table-column> -->
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button type="primary" circle class="table-icon" @click="check(scope.row)"><i class="iconfont icon-chakan"></i></el-button>
<el-button type="primary" v-if="scope.row.onOffLineStatus==0" icon="el-icon-edit" circle class="table-icon" @click="edit(scope.row)"></el-button>
<el-popover
v-if="scope.row.onOffLineStatus==0"
placement="top"
width="160"
trigger="hover"
v-model="scope.row.delState1">
<p style="margin-bottom:10px;font-weight:700;">确认上线吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.delState1 = false">取消</el-button>
<el-button type="primary" size="mini" @click="carOnlineState(scope.row)">确定</el-button>
</div>
<el-button slot="reference" type="success" icon="el-icon-circle-check-outline
" circle class="table-icon popver-btn"></el-button>
</el-popover>
<el-popover
v-if="scope.row.onOffLineStatus==1"
placement="top"
width="160"
trigger="hover"
v-model="scope.row.delState2">
<p style="margin-bottom:10px;font-weight:700;">确认下线吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.delState2 = false">取消</el-button>
<el-button type="primary" size="mini" @click="carOnlineState(scope.row)">确定</el-button>
</div>
<el-button slot="reference" type="warning" icon="el-icon-circle-close-outline" circle class="table-icon popver-btn"></el-button>
</el-popover>
<el-popover
v-if="scope.row.onOffLineStatus==0&&scope.row.userageStatus==0"
placement="top"
width="160"
v-model="scope.row.delState3">
<p style="margin-bottom:10px;font-weight:700;">确认删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.delState3 = false">取消</el-button>
<el-button type="primary" size="mini" @click="del(scope.row)">确定</el-button>
</div>
<el-button slot="reference" type="warning" circle icon="el-icon-delete" class="table-icon popver-btn"></el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<!-- 分页处理 -->
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNo"
:page-sizes="[10, 20, 30]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="rowCount">
</el-pagination>
</div>
</el-card>
<!-- 添加dialog -->
<!-- 查看,编辑dialog -->
<el-dialog
v-el-drag-dialog
:title="dialogTitle"
:visible.sync="dialogState"
width="30%"
:before-close="handleClose">
<div class="dialog-body-content">
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>上传图片</label></el-col>
<el-col :span="16" class="content-right">
<up-load-img
ref="imgComponent"
v-if="dialogType===1 || dialogType===2"
width="260"
height="186"
resPath="carList"
:type="dialogType===2"
:viewUrl="this.dialogBindData.carModelUrl"
@emitSuccess="handleImgLoad">
</up-load-img>
<img v-else :src="this.dialogBindData.carModelUrl" width="260" height="186">
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>选择品牌</label></el-col>
<el-col :span="16" class="content-right">
<el-select v-if="dialogType===1 || dialogType===2" size="small" placeholder="请选择品牌" v-model="carBrandId" @change="handleCarBrand">
<el-option
v-for="item in carBrands"
:key="item.carBrandId"
:label="item.carBrandName"
:value="item.carBrandId">
</el-option>
</el-select>
<span v-else>{{viewCarBrand(carBrandId)}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>选择车系</label></el-col>
<el-col :span="16" class="content-right">
<el-select v-if="dialogType===1 || dialogType===2" size="small" placeholder="请选择车系" :disabled="!carSeriezes" v-model="carSeriesId" @change="handleCarSeries">
<el-option
v-for="item in carSeriezes"
:key="item.carSeriesId"
:label="item.carSeriesName"
:value="item.carSeriesId">
</el-option>
</el-select>
<span v-else>{{viewCarSeries(carSeriesId)}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>选择年代</label></el-col>
<el-col :span="16" class="content-right">
<el-select v-if="dialogType===1 || dialogType===2" size="small" placeholder="请选择年代" :disabled="!carPeriods" v-model="carPeriodId">
<el-option
v-for="item in carPeriods"
:key="item.carPeriodId"
:label="item.carPeriodName"
:value="item.carPeriodId">
</el-option>
</el-select>
<span v-else>{{viewCarPeriods(carPeriodId)}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>车牌号</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入车牌号" v-model="dialogBindData.carPlateNo"></el-input>
<span v-else>{{dialogBindData.carPlateNo}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>座位数</label></el-col>
<el-col :span="16" class="content-right">
<el-select v-if="dialogType===1 || dialogType===2" size="small" placeholder="请选择" v-model="dialogBindData.seatNumber">
<el-option
v-for="item in seatNumberData"
:key="item.code"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
<span v-else>{{viewSeatNum(dialogBindData.seatNumber)}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>排量(L)</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入备注" v-model="dialogBindData.displacement"></el-input>
<span v-else>{{dialogBindData.displacement}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>箱型</label></el-col>
<el-col :span="16" class="content-right">
<el-select v-if="dialogType===1 || dialogType===2" size="small" placeholder="请选择" v-model="dialogBindData.gearBox">
<el-option
v-for="item in gearBoxData"
:key="item.code"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
<span v-else>{{viewGearBox(dialogBindData.gearBox)}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>年审到期时间</label></el-col>
<el-col :span="16" class="content-right">
<el-date-picker
v-if="dialogType===1 || dialogType===2"
size="small"
v-model="dialogBindData.carAnnualInfo"
type="date"
placeholder="选择日期"
:picker-options="pickerOptions">
</el-date-picker>
<span v-else>{{dialogBindData.carAnnualInfo?fattTime(dialogBindData.carAnnualInfo,'d'):'暂无数据'}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>保险到期时间</label></el-col>
<el-col :span="16" class="content-right">
<el-date-picker
v-if="dialogType===1 || dialogType===2"
size="small"
v-model="dialogBindData.carInsuranceInfo"
type="date"
placeholder="选择日期"
:picker-options="pickerOptions">
</el-date-picker>
<span v-else>{{dialogBindData.carInsuranceInfo?fattTime(dialogBindData.carInsuranceInfo,'d'):'暂无数据'}}</span>
</el-col>
</el-row>
<!-- <el-row :gutter="15">
<el-col :span="8" class="content-left"><label>备注</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" type="textarea" rows="3" placeholder="请输入备注" resize="none" v-model="dialogBindData.memo"></el-input>
<span v-else>{{dialogBindData.memo || "暂无备注"}}</span>
</el-col>
</el-row> -->
</div>
<div class="btns-wrapper">
<el-button size="small" @click="handleClose" :disabled="dialogType===3"><i class="iconfont icon-quxiao"></i>取消</el-button>
<el-button v-if="!submmitSuccess" type="primary" size="small" @click="submmitFun" :disabled="dialogType===3"><i class="iconfont icon-tijiao"></i>提交</el-button>
<el-button v-else :loading="true" type="primary" size="small" :disabled="true">提交</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import UpLoadImg from "@/components/UpLoadImg";
import * as car from "../../api/car";
import * as common from "../../api/common";
import { fattCreateTime } from "../../utils/fattTime";
import elDragDialog from "@/directive/el-dragDialog";
export default {
directives: { elDragDialog },
data() {
return {
seacherParam: {
carPlateNo: "",
onOffLineStatus: null,
userageStatus: null
},
// 搜索下拉数据
seatNumberData: [
{ code: 1, name: "2座" },
{ code: 2, name: "4座" },
{ code: 3, name: "5座" },
{ code: 4, name: "6座" }
],
gearBoxData: [
{ code: 1, name: "手动" },
{ code: 2, name: "自动" },
{ code: 3, name: "手自一体" }
],
onOffLineStatuData: [
{ code: 1, name: "上线" },
{ code: 0, name: "下线" }
],
userageStatuData: [
{ code: 1, name: "已预占" },
{ code: 0, name: "空闲" }
],
// 时间控件条件限制
pickerOptions: {
disabledDate(time) {
return time.getTime() <= Date.now();
}
},
// 表格数据
dataOption: null,
// 分页数据
rowCount: new Number(), //总条数
pageSize: 10, //每页几条
pageNo: 1,
// ---------------------------------------查看和编辑dialog--------------------------------
dialogState: false,
dialogType: 1, // 1--增加 2--编辑 3--查看
//dialog弹框绑定数据
// createTime:1527314737000
// createTimeEnd:null
// createTimeStart:null
// isVailable:
// memo:"日常拜访"
// operatorId:null
// operatorType:null
// pk:"1001"
// updateTime:null
// updateTimeEnd:null
// updateTimeStart:null
// visitReason:"日常拜访"
// visitReasonId:"1001"
dialogBindData: {
carId: "",
carPlateNo: "",
carModelName: "",
carBrandName: "",
carSeriesName: "",
carPeriodName: "",
carModelUrl: "",
seatNumber: null,
displacement: "",
gearBox: null,
carAnnualInfo:"",
carInsuranceInfo:"",
userageStatuData: null
},
// 是否提交
submmitSuccess: false,
carBrands: null,
carBrandId: "",
carSeriezes: null,
carSeriesId: "",
carPeriods: null,
carPeriodId: ""
};
},
components: { UpLoadImg },
beforeMount() {
this.getList();
this.getCarBrands();
},
mounted() {},
methods: {
seachFun() {
this.$seach
.submmit(this, car.getCarList)
.then(res => {
this.dataOption = res.data.data;
// 初始化分页数据
this.rowCount = res.data.rowCount;
this.pageSize = res.data.pageSize;
this.$message({
message: "搜索成功",
type: "success"
});
})
.catch(() => {
this.$message({
message: "搜索失败",
type: "warning"
});
});
},
// 重置搜索条件
resetFun() {
this.$seach.reset(this);
this.getList();
},
add() {
this.dialogType = 1;
this.dialogState = true;
},
del(data) {
car
.delCarByCarId({
carId: data.carId
})
.then(res => {
if (res.data.code === "1") {
this.getList(() => {
data.delState = false;
});
}
this.$message({
message: res.data.msg,
type: "warning"
});
data.delState = false;
});
},
edit(data) {
this.dialogType = 2;
this.reBindData(data);
if (!this.carSeriezes) {
car.getCarSeries({ carBrandId: data.carBrandId }).then(res => {
this.carSeriezes = res.data.data;
});
}
if (!this.carPeriods) {
car
.getCarPreiodList({
carBrandId: data.carBrandId,
carSeriesId: data.carSeriesId
})
.then(res => {
this.carPeriods = res.data.data;
this.dialogState = true;
});
}
},
check(data) {
debugger
this.dialogType = 3;
this.reBindData(data);
if (!this.carSeriezes) {
car.getCarSeries({ carBrandId: data.carBrandId }).then(res => {
this.carSeriezes = res.data.data;
});
}
if (!this.carPeriods) {
car
.getCarPreiodList({
carBrandId: data.carBrandId,
carSeriesId: data.carSeriesId
})
.then(res => {
this.carPeriods = res.data.data;
this.dialogState = true;
});
}
},
//获取的列表数据重新绑定到对应模型上面
reBindData(data) {
for (const key in this.dialogBindData) {
this.dialogBindData[key] = data[key];
}
this.carBrandId = data.carBrandId;
this.carSeriesId = data.carSeriesId;
this.carPeriodId = data.carPeriodId;
},
submmitFun() {
// if (this.dialogType === 1) {
// alert(`添加${JSON.stringify(this.dialogBindData)}`);
// } else {
// alert(`编辑${JSON.stringify(this.dialogBindData)}`);
// }
// 发送添加请求
const param = {
carId: this.dialogBindData.carId,
carBrandId: this.carBrandId,
carSeriesId: this.carSeriesId,
carPeriodId: this.carPeriodId,
carPlateNo: this.dialogBindData.carPlateNo,
carModelUrl: this.dialogBindData.carModelUrl,
seatNumber: this.dialogBindData.seatNumber,
displacement: this.dialogBindData.displacement,
gearBox: this.dialogBindData.gearBox,
carAnnualInfo: this.fattTime(this.dialogBindData.carAnnualInfo,'d'),
carInsuranceInfo:this.fattTime(this.dialogBindData.carInsuranceInfo,'d'),
userageStatus:
this.dialogType === 1 ? 0 : this.dialogBindData.userageStatus
};
debugger
const isSubmitActive =
param.carBrandId &&
param.carSeriesId &&
param.carPeriodId &&
param.carModelUrl &&
param.seatNumber &&
param.displacement &&
param.gearBox &&
param.carAnnualInfo&&
param.carInsuranceInfo&&
param.carPlateNo;
if (isSubmitActive) {
this.submmitSuccess = true;
car.addOrEditCar(param).then(res => {
if (res.data.code == 1) {
this.getList(() => {
this.$message({
message: this.dialogType === 1 ? "添加成功" : "编辑成功",
type: "success"
});
this.submmitSuccess = false;
this.handleClose();
});
} else {
this.$message({
message: res.data.msg,
type: "warning"
});
this.submmitSuccess = false;
}
});
} else {
this.$message({
message: "请完善提交信息",
type: "warning"
});
}
},
//关闭弹框
handleClose() {
this.dialogState = false;
for (const key in this.dialogBindData) {
if (key === "sex") {
this.dialogBindData[key] = 1;
} else {
this.dialogBindData[key] = "";
}
}
this.carBrandId = "";
this.carSeriesId = "";
this.carSeriezes = null;
this.carPeriodId = "";
this.carPeriods = null;
this.$refs.imgComponent.clearImg();
},
// 分页处理
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
this.pageSize = Number(val);
this.getList();
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.pageNo = Number(val);
this.getList();
},
// 获取表格数据
getList(cb) {
let param = {
pageNo: this.pageNo,
pageSize: this.pageSize
};
// 组装搜索参数
for (const key in this.seacherParam) {
if (this.seacherParam[key] === 0 || this.seacherParam[key]) {
param[key] = this.seacherParam[key];
}
}
car.getCarList(param).then(res => {
// 初始话表格数据
this.dataOption = res.data.data;
// 初始化分页数据
this.rowCount = res.data.rowCount;
this.pageSize = res.data.pageSize;
cb ? cb() : "";
});
},
// 格式化时间
fattTime(time,str) {
return fattCreateTime(time,"d");
},
// 获取品牌数据
getCarBrands() {
car.getCarBrands().then(res => {
this.carBrands = res.data.data;
});
},
// 选择品牌
handleCarBrand(id) {
this.carSeriesId = "";
this.carPeriods = null;
this.carPeriodId = "";
this.dialogBindData.carPlateNo = "";
car.getCarSeries({ carBrandId: id }).then(res => {
this.carSeriezes = res.data.data;
});
},
handleCarSeries(id) {
car
.getCarPreiodList({
carBrandId: this.carBrandId,
carSeriesId: this.carSeriesId
})
.then(res => {
this.carPeriods = res.data.data;
});
},
viewCarBrand(id) {
const data = this.carBrands;
if (data) {
for (const item of data) {
if (item.carBrandId === id) {
return item.carBrandName;
}
}
}
},
viewCarSeries(id) {
const data = this.carSeriezes;
if (data) {
for (const item of data) {
if (item.carSeriesId === id) {
return item.carSeriesName;
}
}
}
},
viewCarPeriods(id) {
const data = this.carPeriods;
if (data) {
for (const item of data) {
if (item.carPeriodId === id) {
return item.carPeriodName;
}
}
}
},
viewSeatNum(code) {
switch (code) {
case 1:
return "2座";
break;
case 2:
return "4座";
break;
case 3:
return "5座";
break;
default:
return "7座";
}
},
viewGearBox(code) {
switch (code) {
case 1:
return "手动";
break;
case 2:
return "自动";
break;
default:
return "手自一体";
}
},
handleImgLoad(url) {
debugger;
this.dialogBindData.carModelUrl = url;
},
carOnlineState(data) {
const param = {
carId: data.carId,
onOffLineStatus: data.onOffLineStatus == 1 ? 0 : 1
};
car.addOrEditCar(param).then(res => {
if (res.data.code === "1") {
this.getList(() => {
this.$message({
message: "设置成功",
type: "success"
});
this.submmitSuccess = false;
});
}
});
}
},
computed: {
// 激活重置按钮
isActiveReset() {
for (const key in this.seacherParam) {
if (this.seacherParam[key] == 0 || this.seacherParam[key]) {
return false;
}
}
return true;
},
//弹框的title
dialogTitle() {
if (this.dialogType === 1) {
return "添加";
}
if (this.dialogType === 2) {
return "编辑";
} else {
return "查看";
}
}
}
};
</script>
<style lang="scss" scoped>
.dialog-body-content {
.el-row {
margin-top: 14px;
line-height: 32px;
&:first-child {
margin-top: 0;
}
.content-left {
text-align: right;
label {
font-weight: normal;
color: #666;
}
}
.content-right {
width: 215px;
span {
display: block;
border-bottom: solid 1px #dedede;
box-sizing: border-box;
padding-left: 15px;
}
}
}
}
</style>
......@@ -82,7 +82,6 @@ export default {
this.loading = false
this.$router.push({ path: '/' })
}).catch(res => {
debugger
this.loading = false
if(res.code==0){
this.$message({
......
......@@ -9,9 +9,9 @@
</div>
</div>
<el-row :gutter="15">
<el-col :xl="4" :lg="6" :md="6" :sm="8">
<el-col class="input-name" :span="7">年代名称</el-col>
<el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.carPeriodName" @keyup.enter.native="seachFun"></el-input></el-col>
<el-col :span="4">
<el-col class="input-name" :span="7">维修工名称</el-col>
<el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.repairWorkerName" @keyup.enter.native="seachFun"></el-input></el-col>
</el-col>
</el-row>
</el-card>
......@@ -26,10 +26,17 @@
<el-table empty-text="暂无数据" :stripe="true" :data="dataOption" v-loading="!dataOption">
<el-table-column prop="carPeriodName" label="年代名称"></el-table-column>
<el-table-column prop="repairWorkerName" label="姓名"></el-table-column>
<el-table-column label="性别">
<template slot-scope="scope">
<span>{{scope.row.sex===1?'男':'女'}}</span>
</template>
</el-table-column>
<el-table-column prop="repairWorkerPhone" label="电话"></el-table-column>
<el-table-column prop="repairWorkerIdCard" label="身份证号"></el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">
<span>{{scope.row.createTime?fattTime(scope.row.createTime):'暂无数据'}}</span>
<span>{{fattTime(scope.row.createTime)}}</span>
</template>
</el-table-column>
......@@ -88,7 +95,6 @@
<!-- 查看,编辑dialog -->
<el-dialog
v-el-drag-dialog
:title="dialogTitle"
:visible.sync="dialogState"
width="30%"
......@@ -96,58 +102,53 @@
<div class="dialog-body-content">
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>选择品牌</label></el-col>
<el-col :span="8" class="content-left"><label>姓名</label></el-col>
<el-col :span="16" class="content-right">
<el-select v-if="dialogType===1 || dialogType===2" placeholder="请选择品牌" v-model="carBrandId" @change="handleCarBrand">
<el-option
v-for="item in carBrands"
:key="item.carBrandId"
:label="item.carBrandName"
:value="item.carBrandId">
</el-option>
</el-select>
<span v-else>{{viewCarBrand(carBrandId)}}</span>
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入姓名" v-model="dialogBindData.repairWorkerName"></el-input>
<span v-else>{{dialogBindData.repairWorkerName}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>选择车系</label></el-col>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>性别</label></el-col>
<el-col :span="16" class="content-right">
<el-select v-if="dialogType===1 || dialogType===2" placeholder="请选择车系" :disabled="!carSeriezes" v-model="carSeriesId">
<el-option
v-for="item in carSeriezes"
:key="item.carSeriesId"
:label="item.carSeriesName"
:value="item.carSeriesId">
</el-option>
</el-select>
<span v-else>{{viewCarSeries(carSeriesId)}}</span>
<el-radio-group v-if="dialogType===1 || dialogType===2" v-model="dialogBindData.sex">
<el-radio size="small" :label="1"></el-radio>
<el-radio size="small" :label="0"></el-radio>
</el-radio-group>
<span v-else>{{dialogBindData.sex===1?"男":"女"}}</span>
</el-col>
</el-row>
<!-- <el-row :gutter="15">
<el-col :span="8" class="content-left"><label>选择年代</label></el-col>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>电话</label></el-col>
<el-col :span="16" class="content-right">
<el-select v-if="dialogType===1 || dialogType===2" placeholder="请选择年代" :disabled="!carPeriods" v-model="carPeriodId" @change="handleCarSeries">
<el-option
v-for="item in carSeriezes"
:key="item.carSeriesId"
:label="item.carSeriesName"
:value="item.carSeriesId">
</el-option>
</el-select>
<span v-else>{{carSeriesId}}</span>
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入电话号码" v-model="dialogBindData.repairWorkerPhone"></el-input>
<span v-else>{{dialogBindData.repairWorkerPhone}}</span>
</el-col>
</el-row> -->
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>年代名称</label></el-col>
<el-col :span="8" class="content-left"><label>身份证号</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入年代" :disabled="carSeriesId==''" v-model="dialogBindData.carPeriodName"></el-input>
<span v-else>{{dialogBindData.carPeriodName}}</span>
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入身份证号" v-model="dialogBindData.repairWorkerIdCard"></el-input>
<span v-else>{{dialogBindData.repairWorkerIdCard}}</span>
</el-col>
</el-row>
<!-- <el-row :gutter="15">
<el-col :span="8" class="content-left"><label>备注</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" type="textarea" rows="3" placeholder="请输入备注" resize="none" v-model="dialogBindData.memo"></el-input>
<span v-else>{{dialogBindData.memo || "暂无备注"}}</span>
</el-col>
</el-row> -->
</div>
<div class="btns-wrapper">
<el-button size="small" @click="handleClose" :disabled="dialogType===3"><i class="iconfont icon-quxiao"></i>取消</el-button>
......@@ -159,16 +160,14 @@
</template>
<script>
import * as car from "../../api/car";
import * as repair from "../../api/repair";
import * as common from "../../api/common";
import { fattCreateTime } from "../../utils/fattTime";
import elDragDialog from "@/directive/el-dragDialog";
export default {
directives:{elDragDialog},
data() {
return {
seacherParam: {
carPeriodName: ""
repairWorkerName: ""
},
// 表格数据
dataOption: null,
......@@ -196,28 +195,25 @@ export default {
// visitReasonId:"1001"
dialogBindData: {
carPeriodId: "",
carPeriodName: ""
repairWorkerId: "",
repairWorkerName: "",
sex: 1,
repairWorkerPhone: "",
repairWorkerIdCard: ""
},
// 是否提交
submmitSuccess: false,
carBrands: null,
carBrandId: "",
carSeriezes: null,
carSeriesId: ""
submmitSuccess: false
};
},
beforeMount() {
this.getList();
this.getCarBrands();
},
mounted() {},
methods: {
seachFun() {
this.$seach
.submmit(this, car.getCarPreiodList)
.submmit(this, repair.getRepairWorkerList)
.then(res => {
this.dataOption = res.data.data;
// 初始化分页数据
......@@ -266,29 +262,17 @@ export default {
this.dialogType = 2;
this.reBindData(data);
this.dialogState = true;
if (!this.carSeriezes) {
car.getCarSeries({ carBrandId: data.carBrandId }).then(res => {
this.carSeriezes = res.data.data;
});
}
},
check(data) {
this.dialogType = 3;
this.reBindData(data);
this.dialogState = true;
if (!this.carSeriezes) {
car.getCarSeries({ carBrandId: data.carBrandId }).then(res => {
this.carSeriezes = res.data.data;
});
}
},
//获取的列表数据重新绑定到对应模型上面
reBindData(data) {
for (const key in this.dialogBindData) {
this.dialogBindData[key] = data[key];
}
this.carBrandId = data.carBrandId;
this.carSeriesId = data.carSeriesId;
},
submmitFun() {
// if (this.dialogType === 1) {
......@@ -297,17 +281,10 @@ export default {
// alert(`编辑${JSON.stringify(this.dialogBindData)}`);
// }
// 发送添加请求
const param = {
carPeriodId: this.dialogBindData.carPeriodId,
carBrandId: this.carBrandId,
carSeriesId: this.carSeriesId,
carPeriodName: this.dialogBindData.carPeriodName
};
const isSubmitActive =
param.carBrandId && param.carSeriesId && param.carPeriodName;
const isSubmitActive = this.dialogBindData.repairWorkerName&&this.dialogBindData.repairWorkerPhone&&this.dialogBindData.repairWorkerIdCard;
if (isSubmitActive) {
this.submmitSuccess = true;
car.addOrEditCarPreiod(param).then(res => {
repair.addOrEditRepairWorker(this.dialogBindData).then(res => {
this.getList(() => {
this.$message({
message: this.dialogType === 1 ? "添加成功" : "编辑成功",
......@@ -334,9 +311,6 @@ export default {
this.dialogBindData[key] = "";
}
}
this.carBrandId = "";
this.carSeriesId = "";
this.carSeriezes = null;
},
// 分页处理
handleSizeChange(val) {
......@@ -351,18 +325,8 @@ export default {
},
// 获取表格数据
getList(cb) {
let param = {
pageNo: this.pageNo,
pageSize: this.pageSize
};
// 组装搜索参数
for (const key in this.seacherParam) {
if (this.seacherParam[key]===0 || this.seacherParam[key]) {
param[key] = this.seacherParam[key]
}
}
car
.getCarPreiodList(param)
repair
.getRepairWorkerList({ pageNo: this.pageNo, pageSize: this.pageSize })
.then(res => {
// 初始话表格数据
this.dataOption = res.data.data;
......@@ -392,44 +356,6 @@ export default {
});
}
});
},
// 获取品牌数据
getCarBrands() {
car.getCarBrands().then(res => {
this.carBrands = res.data.data;
});
},
// 选择品牌
handleCarBrand(id) {
this.carSeriesId = "";
car.getCarSeriesList({ carBrandId: id }).then(res => {
this.carSeriezes = res.data.data;
});
},
// handleCarSeries(id){
// car.getCarPreiodList({carBrandId:this.carBrandId,carSeriesId:this.carSeriesId}).then(res=>{
// })
// }
viewCarBrand(id) {
const data = this.carBrands;
if (data) {
for (const item of data) {
if (item.carBrandId === id) {
return item.carBrandName;
}
}
}
},
viewCarSeries(id) {
const data = this.carSeriezes;
if (data) {
for (const item of data) {
if (item.carSeriesId === id) {
return item.carSeriesName;
}
}
}
}
},
computed: {
......
......@@ -371,6 +371,10 @@ export default {
this.submmitSuccess = true;
system.addOrEditSysPermission(this.dialogBindData).then(res => {
this.getList(() => {
this.$message({
message: this.dialogType === 1 ? "添加成功" : "编辑成功",
type: "success"
});
this.submmitSuccess = false;
this.handleClose();
});
......@@ -517,4 +521,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
......@@ -265,7 +265,7 @@ export default {
beforeMount() {
//权限添加 permName,moduleName,permType,permResource,isAvailable,menuName,ranking
this.getList();
this.getDepts();
// this.getDepts();
// const respontData = [
// {
// permId: "1",
......
......@@ -9,9 +9,9 @@
</div>
</div>
<el-row :gutter="15">
<el-col :xl="4" :lg="6" :md="6" :sm="8">
<el-col class="input-name" :span="7">车系名称</el-col>
<el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.carSeriesName" @keyup.enter.native="seachFun"></el-input></el-col>
<el-col :span="4">
<el-col class="input-name" :span="7">维修工名称</el-col>
<el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.repairWorkerName" @keyup.enter.native="seachFun"></el-input></el-col>
</el-col>
</el-row>
</el-card>
......@@ -26,40 +26,17 @@
<el-table empty-text="暂无数据" :stripe="true" :data="dataOption" v-loading="!dataOption">
<!-- <el-table-column prop="carSeriesName" label="车系名称"></el-table-column> -->
<el-table-column label="车系名称">
<el-table-column prop="repairWorkerName" label="姓名"></el-table-column>
<el-table-column label="性别">
<template slot-scope="scope">
<el-popover
placement="right"
width="200"
trigger="hover"
@show="getCarBrand(scope.row.carBrandId)"
v-model="scope.row.delState">
<div class="apply-member-infro">
<h2>车辆信息</h2>
<div class="infro-content">
<div class="infro-item">
<label>品牌</label>
<span>{{carBrand?carBrand.carBrandName:""}}</span>
</div>
<div class="infro-item">
<label>车系</label>
<span>{{scope.row.carSeriesName}}</span>
</div>
</div>
</div>
<span class="apply-member-name-tigger-btn" slot="reference">{{scope.row.carSeriesName}}</span>
</el-popover>
<!-- <span></span> -->
<span>{{scope.row.sex===1?'男':'女'}}</span>
</template>
</el-table-column>
<el-table-column prop="repairWorkerPhone" label="电话"></el-table-column>
<el-table-column prop="repairWorkerIdCard" label="身份证号"></el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">
<span>{{scope.row.createTime?fattTime(scope.row.createTime):'暂无数据'}}</span>
<span>{{fattTime(scope.row.createTime)}}</span>
</template>
</el-table-column>
......@@ -118,36 +95,60 @@
<!-- 查看,编辑dialog -->
<el-dialog
v-el-drag-dialog
:title="dialogTitle"
:visible.sync="dialogState"
width="30%"
:before-close="handleClose">
<div class="dialog-body-content">
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>姓名</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入姓名" v-model="dialogBindData.repairWorkerName"></el-input>
<span v-else>{{dialogBindData.repairWorkerName}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>性别</label></el-col>
<el-col :span="16" class="content-right">
<el-radio-group v-if="dialogType===1 || dialogType===2" v-model="dialogBindData.sex">
<el-radio size="small" :label="1"></el-radio>
<el-radio size="small" :label="0"></el-radio>
</el-radio-group>
<span v-else>{{dialogBindData.sex===1?"男":"女"}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>选择品牌</label></el-col>
<el-col :span="8" class="content-left"><label>电话</label></el-col>
<el-col :span="16" class="content-right">
<el-select v-if="dialogType===1 || dialogType===2" placeholder="请选择品牌" v-model="carBrandId">
<el-option
v-for="item in carBrands"
:key="item.carBrandId"
:label="item.carBrandName"
:value="item.carBrandId">
</el-option>
</el-select>
<span v-else>{{getCarBrand(carBrandId)}}</span>
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入电话号码" v-model="dialogBindData.repairWorkerPhone"></el-input>
<span v-else>{{dialogBindData.repairWorkerPhone}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<el-col :span="8" class="content-left"><label>车系名称</label></el-col>
<el-col :span="8" class="content-left"><label>身份证号</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入车系名称" v-model="dialogBindData.carSeriesName"></el-input>
<span v-else>{{dialogBindData.carSeriesName}}</span>
<el-input v-if="dialogType===1 || dialogType===2" size="small" placeholder="请输入身份证号" v-model="dialogBindData.repairWorkerIdCard"></el-input>
<span v-else>{{dialogBindData.repairWorkerIdCard}}</span>
</el-col>
</el-row>
<!-- <el-row :gutter="15">
<el-col :span="8" class="content-left"><label>备注</label></el-col>
<el-col :span="16" class="content-right">
<el-input v-if="dialogType===1 || dialogType===2" size="small" type="textarea" rows="3" placeholder="请输入备注" resize="none" v-model="dialogBindData.memo"></el-input>
<span v-else>{{dialogBindData.memo || "暂无备注"}}</span>
</el-col>
</el-row> -->
</div>
<div class="btns-wrapper">
<el-button size="small" @click="handleClose" :disabled="dialogType===3"><i class="iconfont icon-quxiao"></i>取消</el-button>
......@@ -159,16 +160,14 @@
</template>
<script>
import * as car from "../../api/car";
import * as repair from "../../api/repair";
import * as common from "../../api/common";
import { fattCreateTime } from "../../utils/fattTime";
import elDragDialog from "@/directive/el-dragDialog";
export default {
directives:{elDragDialog},
data() {
return {
seacherParam: {
carSeriesName: ""
repairWorkerName: ""
},
// 表格数据
dataOption: null,
......@@ -196,28 +195,25 @@ export default {
// visitReasonId:"1001"
dialogBindData: {
carSeriesId: "",
carSeriesName: ""
repairWorkerId: "",
repairWorkerName: "",
sex: 1,
repairWorkerPhone: "",
repairWorkerIdCard: ""
},
// 是否提交
submmitSuccess: false,
// 品牌信息
carBrands: null,
carBrand: null,
carBrandId:""
submmitSuccess: false
};
},
beforeMount() {
this.getList();
this.getCarBrands();
},
mounted() {},
methods: {
seachFun() {
this.$seach
.submmit(this, car.getCarSeriesList)
.submmit(this, repair.getRepairWorkerList)
.then(res => {
this.dataOption = res.data.data;
// 初始化分页数据
......@@ -277,7 +273,6 @@ export default {
for (const key in this.dialogBindData) {
this.dialogBindData[key] = data[key];
}
this.carBrandId = data.carBrandId
},
submmitFun() {
// if (this.dialogType === 1) {
......@@ -286,16 +281,10 @@ export default {
// alert(`编辑${JSON.stringify(this.dialogBindData)}`);
// }
// 发送添加请求
const param = {
carSeriesId:this.dialogBindData.carSeriesId,
carBrandId:this.carBrandId,
carSeriesName:this.dialogBindData.carSeriesName
}
const isSubmitActive = param.carBrandId&&param.carSeriesName;
const isSubmitActive = this.dialogBindData.repairWorkerName&&this.dialogBindData.repairWorkerPhone&&this.dialogBindData.repairWorkerIdCard;
if (isSubmitActive) {
this.submmitSuccess = true;
car.addOrEditCarSeries(param).then(res => {
repair.addOrEditRepairWorker(this.dialogBindData).then(res => {
this.getList(() => {
this.$message({
message: this.dialogType === 1 ? "添加成功" : "编辑成功",
......@@ -322,7 +311,6 @@ export default {
this.dialogBindData[key] = "";
}
}
this.carBrandId = ""
},
// 分页处理
handleSizeChange(val) {
......@@ -337,18 +325,8 @@ export default {
},
// 获取表格数据
getList(cb) {
let param = {
pageNo: this.pageNo,
pageSize: this.pageSize
};
// 组装搜索参数
for (const key in this.seacherParam) {
if (this.seacherParam[key]===0 || this.seacherParam[key]) {
param[key] = this.seacherParam[key]
}
}
car
.getCarSeriesList(param)
repair
.getRepairWorkerList({ pageNo: this.pageNo, pageSize: this.pageSize })
.then(res => {
// 初始话表格数据
this.dataOption = res.data.data;
......@@ -363,20 +341,21 @@ export default {
fattTime(time) {
return fattCreateTime(time);
},
// 获取车辆品牌集合
getCarBrands() {
car.getCarBrands().then(res => {
this.carBrands = res.data.data;
});
},
getCarBrand(id) {
const carBrands = this.carBrands;
for (const item of carBrands) {
if (item.carBrandId === id) {
this.carBrand = item;
return item.carBrandName;
// 改变启用状态
handleIsVailable(data) {
console.log(data.isVailable);
const param = {
visitReasonId: data.visitReasonId,
isVailable: data.isVailable ? 0 : 1
};
visitor.addOrEditVisitReason(param).then(res => {
if (res.data.code === "1") {
this.$message({
message: "设置成功",
type: "success"
});
}
}
});
}
},
computed: {
......@@ -404,42 +383,6 @@ export default {
};
</script>
<style lang="scss" scoped>
.apply-member-name-tigger-btn {
text-decoration: underline;
color: #409eff;
cursor: pointer;
}
.apply-member-infro {
h2 {
font-size: 14px;
&::before {
content: "1";
background: #3a8ee6;
color: transparent;
margin-right: 10px;
}
}
.infro-content {
.infro-item {
border-bottom: solid 1px #dedede;
label,
span {
display: inline-block;
line-height: 36px;
}
label {
font-weight: normal;
margin-right: 10px;
color: #666;
width: 48px;
text-align: right;
}
span {
color: #666;
}
}
}
}
.dialog-body-content {
.el-row {
margin-top: 14px;
......
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