按钮防重复点击

This commit is contained in:
2023-08-23 16:26:39 +08:00
parent 6060a36d92
commit f6ba33b0a2
11 changed files with 95 additions and 107 deletions

View File

@ -42,6 +42,13 @@ export function vehicleTypeList(){
url:'/supplierAppV2/dispatchApp/user/vehicleTypeList', url:'/supplierAppV2/dispatchApp/user/vehicleTypeList',
method:'POST' method:'POST'
}) })
}
// 服务商服务能力
export function supplierServiceTree(){
return request({
url:'/supplierAppV2/dispatchApp/user/supplierServiceTree',
method:'POST'
})
} }
//司机列表 //司机列表
export function driverList(data){ export function driverList(data){

View File

@ -1,12 +1,14 @@
<template> <template>
<div class="button" @click="clickHandler"> <div class="button" @click="noMultipleClicks(clickHandler)">
{{ title }} {{ title }}
</div> </div>
</template> </template>
<script> <script>
import {myMixins} from "@/utils/myMixins"
export default { export default {
name: "commonBtn", name: "commonBtn",
mixins:[myMixins],
props: { props: {
title: { title: {
type: String, type: String,

View File

@ -1,13 +1,15 @@
<template> <template>
<div class="btn"> <div class="btn">
<button class="cancel" @click="cancelClick">{{ title1 }}</button> <button class="cancel" @click="noMultipleClicks(cancelClick)">{{ title1 }}</button>
<button class="submit" @click="submitClick">{{ title2}}</button> <button class="submit" @click="noMultipleClicks(submitClick)">{{ title2}}</button>
</div> </div>
</template> </template>
<script> <script>
import {myMixins} from "@/utils/myMixins"
export default { export default {
name: "twoBtnCommon", name: "twoBtnCommon",
mixins:[myMixins],
props:{ props:{
title1:{ title1:{
type:String, type:String,

View File

@ -1,6 +1,6 @@
import axios from "axios"; import axios from "axios";
import qs from 'qs' import qs from 'qs'
import { Toast } from 'vant'
// console.log('process.env.VUE_APP_BASE_API', process.env.VUE_APP_BASE_API) // console.log('process.env.VUE_APP_BASE_API', process.env.VUE_APP_BASE_API)
const service = axios.create({ const service = axios.create({
@ -17,10 +17,10 @@ service.interceptors.request.use(
config => { config => {
config.data = config.contentType ? config.data : qs.stringify(config.data) config.data = config.contentType ? config.data : qs.stringify(config.data)
config.headers['Content-Type'] = config.contentType || 'application/x-www-form-urlencoded' config.headers['Content-Type'] = config.contentType || 'application/x-www-form-urlencoded'
const token = localStorage.getItem('token'); // const token = localStorage.getItem('token');
// const urlParams = new URLSearchParams(window.location.search); // const urlParams = new URLSearchParams(window.location.search);
// const token = urlParams.get('token') ; // const token = urlParams.get('token') ;
// let token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzemwiLCJhdWQiOlsic3VwcGxpZXItYXBwIl0sIm5iZiI6MTY5MjY4MDk1MywidXNlcl9pbmZvIjp7InVzZXJJZCI6NTQ1ODUsInBob25lIjoiMTc2MzAwMzU2NTgiLCJuYW1lIjoi5bCP5a6LIiwic3VwcGxpZXJOYW1lIjoi5LiK5rW35a6J55WFQSIsInN1cHBsaWVySWQiOjExMjgsInN1cHBsaWVyVHlwZSI6MSwidXNlcm5hbWUiOiJzemwiLCJ1c2VyVHlwZSI6IkFQUCIsImF1dGhvcml0aWVzIjpbXX0sInNjb3BlIjpbImFsbCJdLCJpc3MiOiJodHRwczovL3Npbm9hc3Npc3QuY29tIiwiZXhwIjoxNjkyNzY3MzUzLCJpYXQiOjE2OTI2ODA5NTN9.GClSyBkWX_LedBuO2h6xoBHyL3xsgFeGp_zirimAuTk' let token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzemwiLCJhdWQiOlsic3VwcGxpZXItYXBwIl0sIm5iZiI6MTY5Mjc3MzMxMSwidXNlcl9pbmZvIjp7InVzZXJJZCI6NTQ1ODUsInBob25lIjoiMTc2MzAwMzU2NTgiLCJuYW1lIjoi5bCP5a6LIiwic3VwcGxpZXJOYW1lIjoi5LiK5rW35a6J55WFQSIsInN1cHBsaWVySWQiOjExMjgsInN1cHBsaWVyVHlwZSI6MSwidXNlcm5hbWUiOiJzemwiLCJ1c2VyVHlwZSI6IkFQUCIsImF1dGhvcml0aWVzIjpbXX0sInNjb3BlIjpbImFsbCJdLCJpc3MiOiJodHRwczovL3Npbm9hc3Npc3QuY29tIiwiZXhwIjoxNjkyODU5NzExLCJpYXQiOjE2OTI3NzMzMTF9.bFTJlX73vYl06ncE6Ge5_qtbEwRNFZwXhzNjMXzikkE'
config.headers['Authorization'] = `${token}`; config.headers['Authorization'] = `${token}`;
return config return config
}, },
@ -33,21 +33,27 @@ service.interceptors.request.use(
service.interceptors.response.use( service.interceptors.response.use(
response => { response => {
const res = response.data const res = response.data
// console.log('rere', res) // return res //请求响应数据
return res //请求响应数据 // if(res.code === 401){
// if (res.code && (res.code != '00' && res.code != '105' )) { // Toast('token不合法或过期')
// Toast(res.msg || 'Error') // }else if(){
// return Promise.reject(new Error(res.msg || 'Error')) //
// } else {
// if( res.code === 0 ) {
// return res.result
// } else {
// return res.data
// }
// } // }
if ( res.code === 401 || res.code === 400 || res.code == 500) {
Toast(res.msg || 'Error')
return Promise.reject(new Error(res.msg || 'Error'))
} else {
return res
// if( res.code === 200 ) {
// return res.data
// } else {
// return res.data
// }
}
}, },
error => { error => {
console.log('err' + error) console.log('err' + error)
Toast(error.message)
return Promise.reject(error) return Promise.reject(error)
} }
) )

View File

@ -43,7 +43,7 @@ export default {
} }
}, },
async mounted() { async mounted() {
console.log(this.$route.query?.id) // console.log(this.$route.query?.id)
this.form.batchCode=this.$route.query?.id; this.form.batchCode=this.$route.query?.id;
this.form.startTime=this.$route.query?.startTime; this.form.startTime=this.$route.query?.startTime;
this.form.overTime=this.$route.query?.overTime; this.form.overTime=this.$route.query?.overTime;
@ -56,9 +56,9 @@ export default {
pageSize:this.pageSize, pageSize:this.pageSize,
...this.form, ...this.form,
}) })
if(res.code=== 200){ // if(res.code=== 200){
this.detailList=res.data this.detailList=res.data
} // }
// console.log("resssss",res) // console.log("resssss",res)
} }
} }

View File

@ -73,7 +73,7 @@ export default {
pageNum:this.pageNum, pageNum:this.pageNum,
pageSize:this.pageSize pageSize:this.pageSize
}) })
if(res.code === 0){ // if(res.code === 0){
this.notifyList=res.data; this.notifyList=res.data;
console.log(this.notifyList) console.log(this.notifyList)
if(this.notifyList.length === 0){ if(this.notifyList.length === 0){
@ -82,7 +82,7 @@ export default {
this.show=false this.show=false
} }
} }
}, // },
} }
} }
</script> </script>

View File

@ -90,12 +90,12 @@ export default {
reportingItem:this.radio ? this.radio : "", reportingItem:this.radio ? this.radio : "",
reportingDesc:this.decscripTxt ? this.decscripTxt : "" reportingDesc:this.decscripTxt ? this.decscripTxt : ""
}) })
if(result.code === 200){ // if(result.code === 200){
this.$toast(result.msg) this.$toast(result.msg)
setTimeout(()=>{ setTimeout(()=>{
window.android.sendMessage("goBack"); window.android.sendMessage("goBack");
},2000) },2000)
} // }
}else{ }else{
this.$toast("报备事项和报备描述必填一项") this.$toast("报备事项和报备描述必填一项")
} }

View File

@ -37,15 +37,15 @@ export default {
methods:{ methods:{
async getList(){ async getList(){
let result=await getToDoList(); let result=await getToDoList();
if(result.code === 200){ // if(result.code === 200){
this.todolist=result.data; this.todolist=result.data;
if(this.todolist.length === 0){ if(this.todolist?.length === 0){
this.show=true this.show=true
}else { }else {
this.show=false this.show=false
} }
console.log("this.todolist",this.todolist.length) // console.log("this.todolist",this.todolist?.length)
} // }
}, },
async noPass(item){ async noPass(item){
let result=await toDoAudit({ let result=await toDoAudit({

View File

@ -57,68 +57,28 @@
</div> </div>
</div> </div>
<div class="serviceType"> <div class="serviceType">
<div class="trailerService"> <div class="trailerService" v-for="(item,index) in supplierServiceList" :key="index">
<div class="serviceline"> <div class="serviceline">
<span class="service">拖车服务:</span> <span class="service">{{ item.name }}:</span>
<span class="line"></span> <span class="line"></span>
</div> </div>
<van-radio-group v-model="trailerService" @change="change" class="radioWrap"> <van-radio-group v-model="trailerService" @change="change" class="radioWrap">
<van-radio name="故障——平板拖车" class="item"> <van-radio :name="item2.name" class="item" v-for="(item2,index2) in item.children" :key="index2">
故障平板拖车 {{item2.name }}
<img
slot="icon"
slot-scope="props"
:src="props.checked ? activeIcon : inactiveIcon"
>
</van-radio>
<van-radio name=" 事故——平板拖车" class="item">
事故平板拖车
<img
slot="icon"
slot-scope="props"
:src="props.checked ? activeIcon : inactiveIcon"
>
</van-radio>
</van-radio-group>
</div>
<div class="smallRepairService">
<div class="serviceline">
<span class="service">小修服务:</span>
<span class="line"></span>
</div>
<van-radio-group v-model="smallRepairService" @change="change2" class="radioWrap">
<van-radio name="换胎" class="item">
换胎
<img
slot="icon"
slot-scope="props"
:src="props.checked ? activeIcon : inactiveIcon"
>
</van-radio>
<van-radio name="搭电" class="item">
搭电
<img
slot="icon"
slot-scope="props"
:src="props.checked ? activeIcon : inactiveIcon"
>
</van-radio>
<van-radio name="送油" class="item">
送油
<img
slot="icon"
slot-scope="props"
:src="props.checked ? activeIcon : inactiveIcon"
>
</van-radio>
<van-radio name="送水" class="item">
送水
<img <img
slot="icon" slot="icon"
slot-scope="props" slot-scope="props"
:src="props.checked ? activeIcon : inactiveIcon" :src="props.checked ? activeIcon : inactiveIcon"
> >
</van-radio> </van-radio>
<!-- <van-radio name=" 事故——平板拖车" class="item">-->
<!-- 事故平板拖车-->
<!-- <img-->
<!-- slot="icon"-->
<!-- slot-scope="props"-->
<!-- :src="props.checked ? activeIcon : inactiveIcon"-->
<!-- >-->
<!-- </van-radio>-->
</van-radio-group> </van-radio-group>
</div> </div>
</div> </div>
@ -129,7 +89,7 @@
<script> <script>
import {myMixins} from "@/utils/myMixins" import {myMixins} from "@/utils/myMixins"
import {vehicleTypeList,saveVehicle,getInfoById} from "@/api/mine" import {vehicleTypeList,saveVehicle,getInfoById,supplierServiceTree} 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";
export default { export default {
@ -146,7 +106,8 @@ export default {
typeList:[],//车辆类型列表 typeList:[],//车辆类型列表
selectedOption:'1',//车辆类型 selectedOption:'1',//车辆类型
id:'',//车辆Id id:'',//车辆Id
serviceIds:''//车辆服务种类 serviceIds:'',//车辆服务种类,
supplierServiceList:[]
} }
}, },
async mounted() { async mounted() {
@ -159,7 +120,10 @@ export default {
this.selectedOption=selectElement.value; this.selectedOption=selectElement.value;
}); });
await this.getTypeList(); await this.getTypeList();
await this.vehicleInfo() if( this.id){
await this.vehicleInfo()
}
await this.getSupplierServiceTree();
}, },
methods:{ methods:{
async getTypeList() { async getTypeList() {
@ -168,21 +132,26 @@ export default {
this.typeList=result.data this.typeList=result.data
} }
}, },
async getSupplierServiceTree(){
let res = await supplierServiceTree();
this.supplierServiceList=res.data
},
async vehicleInfo(){ async vehicleInfo(){
let res= await getInfoById({ let res= await getInfoById({
vehicleId:this.id vehicleId:this.id
}) })
if(res.code === 200){ // if(res.code === 200){
let result=res.data; let result=res.data;
this.id=result.vehicleId this.id=result.vehicleId
this.carNum=result.plateNumber this.carNum=result.plateNumber
this.isJoin=result.hasPolymerization.code this.isJoin=result.hasPolymerization.code
this.selectedOption=result.vehicleType; this.selectedOption=result.vehicleType;
this.serviceIds=result.serviceIds this.serviceIds=result.serviceIds
} // }
}, },
change(e) { change(e) {
this.trailerService=e this.trailerService=e
console.log(" this.trailerService", this.trailerService)
}, },
change2(e) { change2(e) {
this.smallRepairService=e this.smallRepairService=e
@ -194,17 +163,18 @@ export default {
this.$router.back() this.$router.back()
}, },
async submitBtn(){ async submitBtn(){
let res=await saveVehicle({ if(!(this.carNum && this.selectedOption && this.isJoin)){
vehicleId:this.id ? this.id : '', this.$toast('必填字段未填写')
plateNumber:this.carNum ? this.carNum :'', }else{
vehicleType:this.selectedOption ? this.selectedOption : '', await saveVehicle({
hasPolymerization:Number(this.isJoin ? this.isJoin : '') , vehicleId:this.id ? this.id : '',
serviceIds:this.serviceIds ? this.serviceIds : [] plateNumber:this.carNum ? this.carNum :'',
}) vehicleType:this.selectedOption ? this.selectedOption : '',
if(res.code === 200){ hasPolymerization:Number(this.isJoin ? this.isJoin : '') ,
serviceIds:this.serviceIds ? this.serviceIds : []
})
if(this.id){ if(this.id){
this.$toast('修改成功') this.$toast('修改成功')
}else{ }else{
this.$toast('添加成功') this.$toast('添加成功')
} }
@ -229,6 +199,7 @@ export default {
} }
.wrap{ .wrap{
@include wh(100%,100%); @include wh(100%,100%);
overflow-y: auto;
} }
.addContentWrap{ .addContentWrap{
margin-left: 16px; margin-left: 16px;
@ -301,10 +272,11 @@ export default {
} }
} }
.btn{ .btn{
margin-left: 8px; //margin-left: 8px;
width: 90%; width: 90%;
position: fixed; margin: 40px 0 30px 8px;
bottom: 30px; //position: fixed;
//bottom: 30px;
} }
} }
</style> </style>

View File

@ -64,7 +64,7 @@ export default {
pageNum:this.pageNum, pageNum:this.pageNum,
pageSize:this.pageSize pageSize:this.pageSize
}) })
if(result.code === 200){ // if(result.code === 200){
this.total=result.total this.total=result.total
if(this.pageNum == 1){// 第一页直接赋值 if(this.pageNum == 1){// 第一页直接赋值
this.vehicleList=result.data; this.vehicleList=result.data;
@ -73,20 +73,20 @@ export default {
let arr = result.data; let arr = result.data;
this.vehicleList = preList.concat(arr) this.vehicleList = preList.concat(arr)
} }
} // }
}, },
deleteItem(id){//删除车辆 deleteItem(id){//删除车辆
this.show=true this.show=true
this.id=id this.id=id
}, },
async handleConfirm(){//调删除车辆接口 async handleConfirm(){//调删除车辆接口
let result= await deleteVehicle({ await deleteVehicle({
vehicleId:this.id vehicleId:this.id
}) })
if(result.code === 200){ // if(result.code === 200){
this.$toast('删除成功'); this.$toast('删除成功');
await this.getVehicleList(); await this.getVehicleList();
} // }
}, },
updateVehicle(item){//修改 updateVehicle(item){//修改
this.$router.push({ this.$router.push({

View File

@ -90,7 +90,6 @@ export default {
this.userOrderId = urlParams.get('userOrderId'); this.userOrderId = urlParams.get('userOrderId');
this.orderCode=urlParams.get('orderCode'); this.orderCode=urlParams.get('orderCode');
this.taskOrderId=urlParams.get('taskOrderId') ? urlParams.get('taskOrderId') : ''; this.taskOrderId=urlParams.get('taskOrderId') ? urlParams.get('taskOrderId') : '';
// console.log(this.queryType)
await this.getDetail(); await this.getDetail();
}, },
methods:{ methods:{
@ -101,9 +100,9 @@ export default {
orderCode:this.orderCode, orderCode:this.orderCode,
taskOrderId:this.taskOrderId ? this.taskOrderId : '' taskOrderId:this.taskOrderId ? this.taskOrderId : ''
}) })
if(result.code === 200){ // if(result.code === 200){
this.orderDetailInfo=result.data; this.orderDetailInfo=result;
} // }
} }
} }
} }