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

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

View File

@ -83,7 +83,6 @@ export default {
mounted() {
const urlParams = new URLSearchParams(window.location.search);
this.supplierType = urlParams.get('supplierType');
// this.$toast('页面supplierType'+this.supplierType)
this.getDriverList()
},
methods:{
@ -105,7 +104,6 @@ export default {
}, 1000);
},
addDriver(){
// this.$toast('supplierType的值为'+this.supplierType)
if(this.supplierType == 1){
this.$toast("无权添加")
}else{
@ -136,16 +134,12 @@ export default {
}else{
this.states = 0
}
let res = await enableAction({
await enableAction({
driverId:item.driverId,
states:this.states
})
this.pageNum = 1;
await this.getDriverList();
// setTimeout(()=>{
// this.$toast('操作成功')
// },2000)
console.log("item",res)
},
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>
@ -183,8 +167,7 @@ export default {
.wrap {
background: #F4F5F7;
box-sizing: border-box;
padding: 13px;
@include sizingPadding(13px,13px);
@include wh(100%, 100%);
overflow-y: auto;
}
@ -195,53 +178,43 @@ export default {
border-radius: 10px;
opacity: 0.7;
border: 1px solid #FFFFFF;
@include flexCenter;
justify-content: center;
@include flexTwoCenter;
img{
@include widHeiMar(9px,8px,4px);
}
.addTxt{
@include fontWeightSize(bolder,11px);
opacity: .7;
color: #FFFFFF;
@include colorOpa( #FFFFFF,0.7);
}
}
}
.itemWrap {
@include wh(100%, 104px);
background: #FFFFFF;
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 radiusSizing(6px);
@include fontWeightSize(400, 12px);
@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 {
opacity: .5;
margin-right: 5px;
}
.allOpci {
opacity: 1;
}
.statusNo {
color: #FF0000;
}
.statusYes {
color: #09B820
}
}
.name-status {
display: flex;
justify-content: space-between;
@include flexColBet;
.namephone {
@include fontWeightSize(bold, 14px)
}
@ -250,26 +223,19 @@ export default {
display: flex;
button {
border: none;
//width: 48px;
//padding: 2px;
//@include all-height(20px);
padding: 4px 8px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 3px;
@include flexTwoCenter;
@include fontWeightSize(bold, 12px)
}
.del {
border: 1px solid #DDDDDD;
background-color: #FFFFFF;
}
.revise {
color: #FFFFFF;
@include bgFontColor( #FFFFFF,#354D93);
margin-left: 15px;
background: #354D93;
}
}

View File

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

View File

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

View File

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