车辆管理,司机管理代码优化

This commit is contained in:
2023-08-30 14:48:50 +08:00
parent 5909b6081a
commit eb644563d9
5 changed files with 34 additions and 139 deletions

View File

@ -13,7 +13,6 @@
</div> </div>
<cell-group label="司机姓名" placeholder="请输入司机姓名" v-model="driverName" :disabled="supplierType ==1 ? true:false"/> <cell-group label="司机姓名" placeholder="请输入司机姓名" v-model="driverName" :disabled="supplierType ==1 ? true:false"/>
<cell-group label="手机号码" v-model="driverPhone" placeholder="请输入手机号" /> <cell-group label="手机号码" v-model="driverPhone" placeholder="请输入手机号" />
<p v-if="phoneNumberError" class="error-message">{{ phoneNumberErrorMessage }}</p>
<cell-group label="身份证号" v-model="identityCardNumber" placeholder="请输入身份证号" /> <cell-group label="身份证号" v-model="identityCardNumber" placeholder="请输入身份证号" />
<div class="itemContent"> <div class="itemContent">
<div class="titleType"> <div class="titleType">
@ -58,13 +57,12 @@
</div> </div>
</div> </div>
<div class="lineBot"></div> <div class="lineBot"></div>
<two-common-btn class="btn" @cancelClick="cancelBtn" @submitClick="submitBtn" /> <two-common-btn class="btn" @cancelClick="h5GoBack" @submitClick="submitBtn" />
</div> </div>
</template> </template>
<script> <script>
import {myMixins} from "@/utils/myMixins" import {myMixins} from "@/utils/myMixins"
// import {timeFormat} from "@/utils/common"
import {saveDriver} from "@/api/mine" import {saveDriver} from "@/api/mine"
import TwoCommonBtn from "@/components/twoBtnCommon.vue" import TwoCommonBtn from "@/components/twoBtnCommon.vue"
import CellGroup from "@/components/cellGroup.vue" import CellGroup from "@/components/cellGroup.vue"
@ -81,8 +79,6 @@ export default {
states:'', states:'',
activeIcon: require('@/assets/check.png'), activeIcon: require('@/assets/check.png'),
inactiveIcon: require('@/assets/uncheck.png'), inactiveIcon: require('@/assets/uncheck.png'),
phoneNumberError: false,
phoneNumberErrorMessage: '',
supplierType:'', supplierType:'',
createTime:'' createTime:''
} }
@ -96,12 +92,11 @@ export default {
this.states = this.$route.params?.states; this.states = this.$route.params?.states;
this.supplierType=this.$route.params?.supplierType; this.supplierType=this.$route.params?.supplierType;
this.createTime=this.$route.params?.createTime; this.createTime=this.$route.params?.createTime;
console.log(this.driverName,this.driverPhone,this.drivingModel,this.identityCardNumber,this.states) const selectElement = document.getElementById('mySelect');
const selectElement = document.getElementById('mySelect'); selectElement.addEventListener('change', function() {
selectElement.addEventListener('change', function() { const selectedValue = selectElement.value;
const selectedValue = selectElement.value; this.drivingModel=selectedValue
this.drivingModel=selectedValue });
});
}, },
methods:{ methods:{
@ -109,9 +104,6 @@ export default {
this.states=e this.states=e
}, },
async submitBtn(){ async submitBtn(){
// if (this.driverName || this.driverPhone || this.identityCardNumber || this.drivingModel || this.states){
// this.$toast('必填字段未填写')
// }else{
await saveDriver({ await saveDriver({
driverId:this.id ? this.id : '', driverId:this.id ? this.id : '',
driverName:this.driverName , driverName:this.driverName ,
@ -123,29 +115,13 @@ export default {
}) })
if(this.id){ if(this.id){
this.$toast('修改成功') this.$toast('修改成功')
}else{ }else{
this.$toast('添加成功') this.$toast('添加成功')
} }
setTimeout(()=>{ setTimeout(()=>{
this.$router.back(); this.$router.back();
},2000) },2000)
// }
}, },
cancelBtn(){//取消
this.$router.back()
},
// @blurIn="validatePhoneNumber"
// validatePhoneNumber() {
// const phoneNumberRegex = /^1[0-9]{10}$/;
// if (!phoneNumberRegex.test(this.driverPhone)) {
// this.phoneNumberError = true;
// this.phoneNumberErrorMessage = '电话号码格式不正确请输入有效的11位手机号码。';
// } else {
// this.phoneNumberError = false;
// this.phoneNumberErrorMessage = '';
// }
// }
}, },
components:{ components:{
TwoCommonBtn, TwoCommonBtn,
@ -157,9 +133,6 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
@import "@/styles/mixin.scss"; @import "@/styles/mixin.scss";
@import "@/styles/common.scss"; @import "@/styles/common.scss";
.error-message {
color: red;
}
.wrap{ .wrap{
@include wh(100%,100%); @include wh(100%,100%);
box-sizing: border-box; box-sizing: border-box;
@ -171,13 +144,9 @@ export default {
color: #323643; color: #323643;
appearance: none; appearance: none;
padding-right: 16px; padding-right: 16px;
background-image: url('@/assets/arrow_bot.png'); background: url('@/assets/arrow_bot.png') no-repeat right center / 15px 14px;
background-repeat: no-repeat;
background-position: right center;
background-size: 15px 14px; /* 自定义图像的大小 */
} }
.navBar{ .navBar{
//height: 46px;
margin-bottom: 46px; margin-bottom: 46px;
} }
.itemContent{ .itemContent{

View File

@ -83,7 +83,6 @@ export default {
mounted() { mounted() {
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
this.supplierType = urlParams.get('supplierType'); this.supplierType = urlParams.get('supplierType');
// this.$toast('页面supplierType'+this.supplierType)
this.getDriverList() this.getDriverList()
}, },
methods:{ methods:{
@ -105,7 +104,6 @@ export default {
}, 1000); }, 1000);
}, },
addDriver(){ addDriver(){
// this.$toast('supplierType的值为'+this.supplierType)
if(this.supplierType == 1){ if(this.supplierType == 1){
this.$toast("无权添加") this.$toast("无权添加")
}else{ }else{
@ -136,16 +134,12 @@ export default {
}else{ }else{
this.states = 0 this.states = 0
} }
let res = await enableAction({ await enableAction({
driverId:item.driverId, driverId:item.driverId,
states:this.states states:this.states
}) })
this.pageNum = 1;
await this.getDriverList(); await this.getDriverList();
// setTimeout(()=>{
// this.$toast('操作成功')
// },2000)
console.log("item",res)
}, },
updateDriver(item){ updateDriver(item){
// 在当前组件中进行路由跳转并传递参数对象 // 在当前组件中进行路由跳转并传递参数对象
@ -163,16 +157,6 @@ export default {
} }
}); });
}, },
// async handleScroll(){
// let num = Math.ceil( this.total / 10)
// if(num <= this.pageNum){
// // console.log("不在加载数据")
// }else{
// this.pageNum++;
// await this.getDriverList()
// }
// },
} }
} }
</script> </script>
@ -183,8 +167,7 @@ export default {
.wrap { .wrap {
background: #F4F5F7; background: #F4F5F7;
box-sizing: border-box; @include sizingPadding(13px,13px);
padding: 13px;
@include wh(100%, 100%); @include wh(100%, 100%);
overflow-y: auto; overflow-y: auto;
} }
@ -195,53 +178,43 @@ export default {
border-radius: 10px; border-radius: 10px;
opacity: 0.7; opacity: 0.7;
border: 1px solid #FFFFFF; border: 1px solid #FFFFFF;
@include flexCenter; @include flexTwoCenter;
justify-content: center;
img{ img{
@include widHeiMar(9px,8px,4px); @include widHeiMar(9px,8px,4px);
} }
.addTxt{ .addTxt{
@include fontWeightSize(bolder,11px); @include fontWeightSize(bolder,11px);
opacity: .7; @include colorOpa( #FFFFFF,0.7);
color: #FFFFFF;
} }
} }
} }
.itemWrap { .itemWrap {
@include wh(100%, 104px); @include wh(100%, 104px);
background: #FFFFFF; @include radiusSizing(6px);
box-shadow: 0px 2px 10px 0px rgba(216, 216, 216, 0.5);
border-radius: 6px;
margin-bottom: 10px;
box-sizing: border-box;
padding: 11px 13px 9px 15px;
@include fontWeightSize(400, 12px); @include fontWeightSize(400, 12px);
@include flexBetween; @include flexBetween;
background: #FFFFFF;
box-shadow: 0px 2px 10px 0px rgba(216, 216, 216, 0.5);
margin-bottom: 10px;
padding: 11px 13px 9px 15px;
.halfOpci { .halfOpci {
opacity: .5; opacity: .5;
margin-right: 5px; margin-right: 5px;
} }
.allOpci { .allOpci {
opacity: 1; opacity: 1;
} }
.statusNo { .statusNo {
color: #FF0000; color: #FF0000;
} }
.statusYes { .statusYes {
color: #09B820 color: #09B820
} }
} }
.name-status { .name-status {
display: flex; @include flexColBet;
justify-content: space-between;
.namephone { .namephone {
@include fontWeightSize(bold, 14px) @include fontWeightSize(bold, 14px)
} }
@ -250,26 +223,19 @@ export default {
display: flex; display: flex;
button { button {
border: none; border: none;
//width: 48px;
//padding: 2px;
//@include all-height(20px);
padding: 4px 8px; padding: 4px 8px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 3px; border-radius: 3px;
@include flexTwoCenter;
@include fontWeightSize(bold, 12px) @include fontWeightSize(bold, 12px)
} }
.del { .del {
border: 1px solid #DDDDDD; border: 1px solid #DDDDDD;
background-color: #FFFFFF; background-color: #FFFFFF;
} }
.revise { .revise {
color: #FFFFFF; @include bgFontColor( #FFFFFF,#354D93);
margin-left: 15px; margin-left: 15px;
background: #354D93;
} }
} }

View File

@ -65,14 +65,14 @@
<span class="line"></span> <span class="line"></span>
</div> </div>
<div :ref="'checkboxGroup' + index" class="checkbox-group"> <div :ref="'checkboxGroup' + index" class="checkbox-group">
<van-checkbox-group v-model="serviceIds" v-for="(item2,index2) in item.children" :key="index2" class="radioWrap" @change="change"> <van-checkbox-group v-model="serviceIds" v-for="(item2,index2) in item.children" :key="index2" class="radioWrap" >
<van-checkbox class="item" :name="item2.id">{{item2.name }}</van-checkbox> <van-checkbox class="item" :name="item2.id">{{item2.name }}</van-checkbox>
</van-checkbox-group> </van-checkbox-group>
</div> </div>
</div> </div>
</div> </div>
<two-common-btn class="btn" @cancelClick="cancelBtn" @submitClick="submitBtn" /> <two-common-btn class="btn" @cancelClick="h5GoBack" @submitClick="submitBtn" />
</div> </div>
</div> </div>
</template> </template>
@ -88,7 +88,6 @@ export default {
data(){ data(){
return{ return{
trailerService: '',//拖车服务 trailerService: '',//拖车服务
smallRepairService: '',//小修服务
isJoin:'',//是否参与 isJoin:'',//是否参与
activeIcon: require('@/assets/check.png'), activeIcon: require('@/assets/check.png'),
inactiveIcon: require('@/assets/uncheck.png'), inactiveIcon: require('@/assets/uncheck.png'),
@ -153,23 +152,10 @@ export default {
this.selectedOption=result.vehicleType; this.selectedOption=result.vehicleType;
this.serviceIds=result.serviceIds this.serviceIds=result.serviceIds
}, },
change(e) {
// this.trailerService=e
console.log(" this.trailerService",e, this.result)
},
change2(e) {
this.smallRepairService=e
},
isChange(e){ isChange(e){
this.isJoin=e this.isJoin=e
}, },
cancelBtn(){//取消车辆
this.$router.back()
},
async submitBtn(){ async submitBtn(){
// if(this.carNum || this.selectedOption || this.isJoin){
// this.$toast('必填字段未填写')
// }else{
await saveVehicle({ await saveVehicle({
vehicleId:this.id ? this.id : '', vehicleId:this.id ? this.id : '',
plateNumber:this.carNum ? this.carNum :'', plateNumber:this.carNum ? this.carNum :'',
@ -186,7 +172,6 @@ export default {
this.$router.back(); this.$router.back();
},2000) },2000)
} }
// },
}, },
components:{ components:{
CellGroup, CellGroup,
@ -203,10 +188,7 @@ export default {
color: #323643; color: #323643;
appearance: none; appearance: none;
padding-right: 16px; padding-right: 16px;
background-image: url('@/assets/arrow_bot.png'); background: url('@/assets/arrow_bot.png') no-repeat right center / 15px 14px;
background-repeat: no-repeat;
background-position: right center;
background-size: 15px 14px; /* 自定义图像的大小 */
} }
.checkbox-group { .checkbox-group {
display: none; display: none;
@ -221,8 +203,7 @@ export default {
.addContentWrap{ .addContentWrap{
margin-left: 16px; margin-left: 16px;
.itemContent{ .itemContent{
display: flex; @include flexColBet;
justify-content: space-between;
line-height: 56px; line-height: 56px;
box-sizing: border-box; box-sizing: border-box;
padding-right: 25px; padding-right: 25px;
@ -271,11 +252,9 @@ export default {
} }
.radioWrap{ .radioWrap{
margin-left: 10px; margin-left: 10px;
//display: none;
} }
.service{ .service{
opacity: .7; @include colorOpa(#323643,0.7);
color: #323643;
line-height: 18px; line-height: 18px;
white-space: nowrap; white-space: nowrap;
} }
@ -291,11 +270,8 @@ export default {
} }
} }
.btn{ .btn{
//margin-left: 8px;
width: 90%; width: 90%;
margin: 40px 0 30px 8px; margin: 40px 0 30px 8px;
//position: fixed;
//bottom: 30px;
} }
} }
</style> </style>

View File

@ -145,13 +145,8 @@ export default {
@import "@/styles/mixin.scss"; @import "@/styles/mixin.scss";
@import "@/styles/common.scss"; @import "@/styles/common.scss";
.wrap{ .wrap{
//overflow-y: auto;
//@include wh(100%,calc(100% - 46px));
//box-sizing: border-box;
//padding: 13px 13px 0;
background: #F4F5F7; background: #F4F5F7;
box-sizing: border-box; @include sizingPadding(13px,13px);
padding: 13px;
@include wh(100%, 100%); @include wh(100%, 100%);
overflow-y: auto; overflow-y: auto;
} }
@ -162,33 +157,26 @@ export default {
border-radius: 10px; border-radius: 10px;
opacity: 0.7; opacity: 0.7;
border: 1px solid #FFFFFF; border: 1px solid #FFFFFF;
@include flexCenter; @include flexTwoCenter;
justify-content: center;
img{ img{
@include widHeiMar(9px,8px,4px); @include widHeiMar(9px,8px,4px);
} }
.addTxt{ .addTxt{
@include fontWeightSize(bolder,11px); @include fontWeightSize(bolder,11px);
opacity: .7; @include colorOpa(#FFFFFF,0.7);
color: #FFFFFF;
} }
} }
} }
.carItem{ .carItem{
//position: relative;
// z-index: 11;
@include wh(100%,86px); @include wh(100%,86px);
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0px 2px 10px 0px rgba(216,216,216,0.5); box-shadow: 0px 2px 10px 0px rgba(216,216,216,0.5);
border-radius: 6px; @include radiusSizing(6px);
box-sizing: border-box;
padding: 11px 13px 11px 15px; padding: 11px 13px 11px 15px;
margin-bottom: 10px; margin-bottom: 10px;
@include flexBetween; @include flexBetween;
.carCode{ .carCode{
display: flex; @include flexColBet;
justify-content: space-between;
.codeLeft{ .codeLeft{
@include fontWeightSize(bold,14px) @include fontWeightSize(bold,14px)
} }
@ -196,13 +184,9 @@ export default {
display: flex; display: flex;
button{ button{
border: none; border: none;
//width: 48px;
//@include all-height(20px);
padding: 4px 8px; padding: 4px 8px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 3px; border-radius: 3px;
@include flexTwoCenter;
@include fontWeightSize(bold,12px) @include fontWeightSize(bold,12px)
} }
.del{ .del{
@ -210,9 +194,8 @@ export default {
background-color: #FFFFFF; background-color: #FFFFFF;
} }
.revise{ .revise{
color: #FFFFFF; @include bgFontColor( #FFFFFF,#354D93);
margin-left: 15px; margin-left: 15px;
background: #354D93;
} }
} }
} }

View File

@ -207,7 +207,8 @@ export default {
margin-bottom: 46px; margin-bottom: 46px;
.rightWrap { .rightWrap {
@include flexBetCen; @include flexColAround;
align-items: center;
@include wh(106px, 26px); @include wh(106px, 26px);
background: linear-gradient(180deg, #A3B8E9 0%, #6C81CD 100%); background: linear-gradient(180deg, #A3B8E9 0%, #6C81CD 100%);
border-radius: 4px; border-radius: 4px;