|
|
|
|
@@ -335,33 +335,10 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>-->
|
|
|
|
|
</div>
|
|
|
|
|
<two-common-btn class="btn" @cancelClick="h5GoBack" @submitClick="submitAuditHandle" />
|
|
|
|
|
<two-common-btn class="btn" @cancelClick="h5GoBack" @submitClick="submitBtn" />
|
|
|
|
|
<van-calendar v-model="showDatePicker" :min-date="minDate"
|
|
|
|
|
:max-date="maxDate" type="range" @confirm="onConfirm" />
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<van-popup ref="success" v-model="approvalDialogShow">
|
|
|
|
|
<div class="pop_wrap">
|
|
|
|
|
<div class="pop_title">车辆提交审批</div>
|
|
|
|
|
<div class="pop_content">
|
|
|
|
|
<div class="iptWrap" v-if="vehicleInfoChange">
|
|
|
|
|
<div>车辆和服务备注</div>
|
|
|
|
|
<el-input placeholder="请输入车辆和服务备注" type="textarea" show-word-limit maxlength="200"
|
|
|
|
|
v-model="approvalForm.serviceRemark"></el-input>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="iptWrap" v-if="insuranceChange">
|
|
|
|
|
<div>保单备注</div>
|
|
|
|
|
<el-input placeholder="请输入保单备注" type="textarea" show-word-limit maxlength="200"
|
|
|
|
|
v-model="approvalForm.insuranceRemark"></el-input>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tip_button_wrap">
|
|
|
|
|
<div class="continue close" @click="closeApproval">取消</div>
|
|
|
|
|
<div class="continue" :class="{'loading': loading}" @click="submitApprovalHandle">提交审批</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</van-popup>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@@ -370,8 +347,7 @@
|
|
|
|
|
import {Dialog} from "vant";
|
|
|
|
|
import {formatDate1} from "@/utils/common"
|
|
|
|
|
import {myMixins} from "@/utils/myMixins"
|
|
|
|
|
import {vehicleTypeList,saveVehicle,getInfoById,supplierServiceTree, uploadImage, ocrHandler,
|
|
|
|
|
userOperationPermissions,saveSupplierApproval} from "@/api/mine"
|
|
|
|
|
import {vehicleTypeList,saveVehicle,getInfoById,supplierServiceTree, uploadImage, ocrHandler, userOperationPermissions} from "@/api/mine"
|
|
|
|
|
import TwoCommonBtn from "@/components/twoBtnCommon.vue"
|
|
|
|
|
import CellGroup from "@/components/cellGroup.vue";
|
|
|
|
|
export default {
|
|
|
|
|
@@ -402,7 +378,6 @@ export default {
|
|
|
|
|
typeList:[],//车辆类型列表
|
|
|
|
|
selectedOption:[],//车辆类型
|
|
|
|
|
id:'',//车辆Id
|
|
|
|
|
supplierId:'',//服务商Id
|
|
|
|
|
serviceIds:[],//车辆服务种类,
|
|
|
|
|
supplierServiceList:[],
|
|
|
|
|
oldSupplierServiceList:[],
|
|
|
|
|
@@ -530,25 +505,7 @@ export default {
|
|
|
|
|
}, {
|
|
|
|
|
name: '其他',
|
|
|
|
|
value: 14
|
|
|
|
|
}],
|
|
|
|
|
approvalForm:{
|
|
|
|
|
type:2,
|
|
|
|
|
supplierId:'',
|
|
|
|
|
vehicleId:'',
|
|
|
|
|
serviceChange:null,
|
|
|
|
|
serviceRemark:'',
|
|
|
|
|
insuranceChange:null,
|
|
|
|
|
insuranceRemark:'',
|
|
|
|
|
vehicleOtherChange:null,
|
|
|
|
|
vehicleOtherRemark:'',
|
|
|
|
|
},
|
|
|
|
|
originData:{},//记录更改之前的数据
|
|
|
|
|
changedFields: [], // 用于存储变更过的字段
|
|
|
|
|
approvalDialogShow:false,
|
|
|
|
|
vehicleInfoChange:false,
|
|
|
|
|
insuranceChange:false,
|
|
|
|
|
loading: false,
|
|
|
|
|
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
@@ -596,25 +553,13 @@ export default {
|
|
|
|
|
this.setDefault();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async mounted() {
|
|
|
|
|
this.id=this.$route.params?.id
|
|
|
|
|
this.approvalForm.supplierId=this.$route.params?.supplierId
|
|
|
|
|
await this.getSupplierServiceTree();
|
|
|
|
|
await this.getTypeList();
|
|
|
|
|
if( this.id){
|
|
|
|
|
await this.vehicleInfo()
|
|
|
|
|
}else{
|
|
|
|
|
this.originData={
|
|
|
|
|
vehicleType:'',
|
|
|
|
|
vehicleStatus:'',
|
|
|
|
|
virtualVehicle:'',
|
|
|
|
|
serviceIds:[],
|
|
|
|
|
hasLiabilityInsurance:'',
|
|
|
|
|
insuranceCorp:'',
|
|
|
|
|
liabilityInsuranceStartTime:'',
|
|
|
|
|
liabilityInsuranceEndTime:'',
|
|
|
|
|
insurancePicturePhoto:''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods:{
|
|
|
|
|
@@ -647,10 +592,6 @@ export default {
|
|
|
|
|
const [start, end] = date;
|
|
|
|
|
this.showDatePicker = false;
|
|
|
|
|
this.dateVal = `${this.formatDate(start)} - ${this.formatDate(end)}`;
|
|
|
|
|
console.log('this.dateVal',this.dateVal)
|
|
|
|
|
let timeObj = this.formatDateTimeRange(this.dateVal)
|
|
|
|
|
console.log('timeObj',timeObj)
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
formatDateTimeRange(str) {
|
|
|
|
|
const [startStr, endStr] = str.split(' - ').map(s => s.trim());
|
|
|
|
|
@@ -864,7 +805,6 @@ export default {
|
|
|
|
|
let result=res.data;
|
|
|
|
|
console.log("result",result)
|
|
|
|
|
this.id=result.vehicleId
|
|
|
|
|
this.approvalForm.vehicleId=this.id
|
|
|
|
|
this.carNum=result.plateNumber
|
|
|
|
|
this.isJoin=result.hasPolymerization.code
|
|
|
|
|
this.selectedOption=result.vehicleType?.split(',').map((item)=>{
|
|
|
|
|
@@ -906,17 +846,6 @@ export default {
|
|
|
|
|
if( result.liabilityInsuranceEndTime && result.liabilityInsuranceStartTime ) {
|
|
|
|
|
this.dateVal = formatDate1(result.liabilityInsuranceStartTime) + ' - ' + formatDate1(result.liabilityInsuranceEndTime)
|
|
|
|
|
}
|
|
|
|
|
this.originData={
|
|
|
|
|
vehicleType:result.vehicleType,
|
|
|
|
|
vehicleStatus:result.vehicleStatus,
|
|
|
|
|
virtualVehicle:result.virtualVehicle,
|
|
|
|
|
serviceIds:result.serviceIds,
|
|
|
|
|
hasLiabilityInsurance:result.hasLiabilityInsurance,
|
|
|
|
|
insuranceCorp:result.insuranceCorp,
|
|
|
|
|
liabilityInsuranceStartTime:result.liabilityInsuranceStartTime,
|
|
|
|
|
liabilityInsuranceEndTime:result.liabilityInsuranceEndTime,
|
|
|
|
|
insurancePicturePhoto:result.insurancePicturePhoto
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
isChange(e){
|
|
|
|
|
this.hasLiabilityInsurance=e
|
|
|
|
|
@@ -934,183 +863,6 @@ export default {
|
|
|
|
|
isVehicleChange(e) {
|
|
|
|
|
this.vehicleStatus=e
|
|
|
|
|
},
|
|
|
|
|
async submitAuditHandle(){//提交审核
|
|
|
|
|
let urls=[]
|
|
|
|
|
this.insurancePictureFiles?.forEach(item => urls.push(item.url))
|
|
|
|
|
let time =this.dateVal ? this.formatDateTimeRange(this.dateVal) : ''
|
|
|
|
|
// let time1=time.endTime?.split(' ')
|
|
|
|
|
let newFormValue={
|
|
|
|
|
vehicleStatus:this.vehicleStatus,
|
|
|
|
|
virtualVehicle:this.virtualVehicle,
|
|
|
|
|
serviceIds:this.$refs.tree.getCheckedKeys(true) || [],
|
|
|
|
|
vehicleType:this.selectedOption?.join(',') || '',
|
|
|
|
|
hasLiabilityInsurance:this.hasLiabilityInsurance,
|
|
|
|
|
insuranceCorp:this.insuranceCorp,
|
|
|
|
|
insurancePicturePhoto:urls?.join(','),
|
|
|
|
|
// liabilityInsuranceStartTime:time.startTime ? time.startTime : '',
|
|
|
|
|
liabilityInsuranceEndTime:time.endTime ? time.endTime : '',
|
|
|
|
|
}
|
|
|
|
|
console.log('newFormValue',newFormValue)
|
|
|
|
|
let oldFormValue={...this.originData,}
|
|
|
|
|
console.log('oldFormValue',oldFormValue)
|
|
|
|
|
|
|
|
|
|
this.compareObjects(newFormValue,oldFormValue);
|
|
|
|
|
if( this.changedFields && this.changedFields.length>0){
|
|
|
|
|
const arr1Set = new Set(this.changedFields);
|
|
|
|
|
const change1=['vehicleStatus','virtualVehicle','vehicleType','serviceIds']
|
|
|
|
|
const change2=['hasLiabilityInsurance','insurancePicturePhoto','insuranceCorp','liabilityInsuranceStartTime','liabilityInsuranceEndTime']
|
|
|
|
|
const serviceChangeItems = change1.filter(item => arr1Set.has(item));
|
|
|
|
|
console.log('serviceChangeItems',serviceChangeItems)
|
|
|
|
|
if(serviceChangeItems?.length>0){
|
|
|
|
|
this.vehicleInfoChange=true
|
|
|
|
|
this.approvalForm.serviceChange={}
|
|
|
|
|
change1.forEach(key => {
|
|
|
|
|
this.approvalForm.serviceChange[key] = this[key];
|
|
|
|
|
if(key=='serviceIds'){
|
|
|
|
|
this.approvalForm.serviceChange[key]=this.$refs.tree.getCheckedKeys(true)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}else {
|
|
|
|
|
this.vehicleInfoChange=false
|
|
|
|
|
this.approvalForm.serviceChange=null
|
|
|
|
|
}
|
|
|
|
|
const insuranceChangeItems = change2.filter(item => arr1Set.has(item));
|
|
|
|
|
console.log('insuranceChangeItems',insuranceChangeItems)
|
|
|
|
|
if(insuranceChangeItems?.length>0){
|
|
|
|
|
this.insuranceChange=true
|
|
|
|
|
this.approvalForm.insuranceChange={}
|
|
|
|
|
change2.forEach(key => {
|
|
|
|
|
this.approvalForm.insuranceChange[key] =this[key];
|
|
|
|
|
let time =this.dateVal ? this.formatDateTimeRange(this.dateVal) : ''
|
|
|
|
|
if(key=='liabilityInsuranceStartTime' && time && time.startTime){
|
|
|
|
|
this.approvalForm.insuranceChange[key]=time.startTime
|
|
|
|
|
}
|
|
|
|
|
if(key=='liabilityInsuranceEndTime' && time && time.endTime){
|
|
|
|
|
// let time1=time.endTime?.split(' ')
|
|
|
|
|
this.approvalForm.insuranceChange[key]= time.endTime
|
|
|
|
|
}
|
|
|
|
|
if(key=='insurancePicturePhoto' && this.insurancePictureFiles?.length>0){
|
|
|
|
|
let urls=[]
|
|
|
|
|
this.insurancePictureFiles?.forEach(item => urls.push(item.url))
|
|
|
|
|
this.approvalForm.insuranceChange[key]=urls?.join(',')
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}else {
|
|
|
|
|
this.insuranceChange=false
|
|
|
|
|
this.approvalForm.insuranceChange=null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(this.vehicleInfoChange || this.insuranceChange){
|
|
|
|
|
this.approvalDialogShow=true
|
|
|
|
|
console.log('11111',this.approvalForm.serviceChange)
|
|
|
|
|
console.log('2222',this.approvalForm.insuranceChange)
|
|
|
|
|
}else {
|
|
|
|
|
this.approvalDialogShow=false
|
|
|
|
|
await this.submitBtn();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async submitApprovalHandle(){//提交审批-走接口
|
|
|
|
|
if(this.vehicleInfoChange){
|
|
|
|
|
if(!(this.selectedOption.length > 0)){
|
|
|
|
|
this.$toast('车辆类别不能为空')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
let res = this.checkDisabledItems();
|
|
|
|
|
if(!res) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if( !this.virtualVehicle ) {
|
|
|
|
|
this.$toast('车辆属性不能为空')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if( !this.vehicleStatus ) {
|
|
|
|
|
this.$toast('车辆状态不能为空')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(!this.approvalForm.serviceRemark){
|
|
|
|
|
this.$toast('车辆和服务备注不能为空')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(this.insuranceChange){
|
|
|
|
|
if(this.hasLiabilityInsurance === null || this.hasLiabilityInsurance === undefined || this.hasLiabilityInsurance === '') { // 有职业责任险,就需要有保单照片
|
|
|
|
|
this.$toast('救援职业责任险不能为空')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(!this.insurancePicturePhoto && this.hasLiabilityInsurance == 1) { // 有职业责任险,就需要有保单照片
|
|
|
|
|
this.$toast('保单照片不能为空')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(this.selectedOption?.length==1 && this.selectedOption.includes(1)){//选择小修车时需清除原本的拖车服务类型
|
|
|
|
|
let data=this.oldSupplierServiceList.filter(item => item.name ==='拖车服务')
|
|
|
|
|
this.serviceIds = this.serviceIds.filter(item => !data[0].children.some(obj => obj.id === item));
|
|
|
|
|
}
|
|
|
|
|
if(!this.insuranceCorp && this.hasLiabilityInsurance == 1) { // 有职业责任险,就需要有保单照片
|
|
|
|
|
this.$toast('承保保司不能为空')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(!this.dateVal && this.hasLiabilityInsurance == 1) { // 有职业责任险,就需要有保单照片
|
|
|
|
|
this.$toast('保单有效期不能为空')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(!this.approvalForm.insuranceRemark){
|
|
|
|
|
this.$toast('保单备注不能为空')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
await saveSupplierApproval({...this.approvalForm})
|
|
|
|
|
} finally {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
}
|
|
|
|
|
this.$toast('提交审批成功')
|
|
|
|
|
this.closeApproval()
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
this.$router.back();
|
|
|
|
|
},2000)
|
|
|
|
|
},
|
|
|
|
|
compareObjects(newObj, oldObj) {
|
|
|
|
|
this.changedFields=[]
|
|
|
|
|
for (let key in newObj) {
|
|
|
|
|
if( Array.isArray(newObj[key])){
|
|
|
|
|
if(newObj[key]?.length != oldObj[key]?.length){
|
|
|
|
|
this.changedFields.push(key);
|
|
|
|
|
}else {
|
|
|
|
|
// console.log('newObj[key]',newObj[key])
|
|
|
|
|
if(newObj[key][0]?.id){
|
|
|
|
|
let flag=newObj[key].every((item, index) => item.id == oldObj[key][index]?.id);
|
|
|
|
|
// console.log('flag',flag)
|
|
|
|
|
if(!flag){
|
|
|
|
|
this.changedFields.push(key);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
let flag=newObj[key].every((value, index) => value == oldObj[key][index]);
|
|
|
|
|
if(!flag){
|
|
|
|
|
this.changedFields.push(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
let isEqual = (
|
|
|
|
|
(newObj[key] == null && oldObj[key] == 0) ||
|
|
|
|
|
(newObj[key] == 0 && oldObj[key] == null) ||
|
|
|
|
|
(newObj[key] == oldObj[key])
|
|
|
|
|
);
|
|
|
|
|
if (!isEqual) {
|
|
|
|
|
this.changedFields.push(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
closeApproval(){
|
|
|
|
|
this.approvalForm.serviceRemark=''
|
|
|
|
|
this.approvalForm.insuranceRemark=''
|
|
|
|
|
this.approvalForm.vehicleOtherRemark=''
|
|
|
|
|
this.approvalDialogShow=false
|
|
|
|
|
this.vehicleInfoChange=false
|
|
|
|
|
this.insuranceChange=false
|
|
|
|
|
},
|
|
|
|
|
async submitBtn(){
|
|
|
|
|
if( !this.vehicleLicenseFront ) {
|
|
|
|
|
this.$toast('行驶证主页照片不能为空')
|
|
|
|
|
@@ -1336,69 +1088,4 @@ export default {
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
}
|
|
|
|
|
.pop_wrap {
|
|
|
|
|
width: 340px;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
padding: 10px 15px;
|
|
|
|
|
position: relative;
|
|
|
|
|
.pop_title {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
.pop_content {
|
|
|
|
|
width: 304px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #4C5361;
|
|
|
|
|
margin-left: 6px;
|
|
|
|
|
line-height: 25px;
|
|
|
|
|
.iptWrap{
|
|
|
|
|
margin: 10px 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.tip_button_wrap {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
.close {
|
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
|
color: black;
|
|
|
|
|
background-color: #FFFFFF;
|
|
|
|
|
}
|
|
|
|
|
.continue {
|
|
|
|
|
padding: 6px 10px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
}
|
|
|
|
|
div:last-child{
|
|
|
|
|
background-color: #3266be;
|
|
|
|
|
color: #FFFFFF;
|
|
|
|
|
margin-left: 8px;
|
|
|
|
|
margin-right: 4px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.loading {
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.loading::after{
|
|
|
|
|
content: '';
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 50%;
|
|
|
|
|
left: 50%;
|
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
|
width: 20px;
|
|
|
|
|
height: 20px;
|
|
|
|
|
border: 2px solid #000;
|
|
|
|
|
border-top-color: transparent;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
animation: spin 1s linear infinite;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes spin {
|
|
|
|
|
0% {
|
|
|
|
|
transform: translate(-50%, -50%) rotate(0deg);
|
|
|
|
|
}
|
|
|
|
|
100% {
|
|
|
|
|
transform: translate(-50%, -50%) rotate(360deg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|