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

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,12 +92,11 @@ 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;
this.drivingModel=selectedValue
});
const selectElement = document.getElementById('mySelect');
selectElement.addEventListener('change', function() {
const selectedValue = selectElement.value;
this.drivingModel=selectedValue
});
},
methods:{
@ -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{