Commit 4a574033 by 前端

Merge branch 'SAAS+V4.45.2-1021' into 'master'

上线合并

See merge request !18
2 parents 512abd27 72a2fb9d
<template>
<GLDialog class="second-dialog" title="重要提示" width="576px" :visible.sync="secondVisible" :show-close="true" :hasFooter="!isEditVin" :before-close="handleCancel" :close-on-click-modal="false" @onCancel="handleCancel" @onOk="handleOk">
<div class="modal-wrap">
<div class="tips">
<img class="icon-info" src="@/assets/icon_info.png" />
{{secondInfo.tips}}
</div>
<glsx-combi-form :isInline="false" class="edit-form-container" ref="editFormRefSec" labelWidth="154px" defaultWidth="284px" formRef="editChildRef" :isEdit="true" :formObj="editFormSec" :formData="secondInfo.editFormDataSec" :formRules="formRules">
<template slot="vin">
<div v-if="!isEditVin" class="vin-detail">
<div>{{editFormSec.vin?.replace(/(.{4})/g, "$1 ")}}</div>
<img class="icon-edit" src="@/assets/icon_edit.png" @click="handleChangeVin" />
</div>
<div v-else class="vin-edit">
<el-input placeholder="请输入车架号" v-model.trim="editFormSec.vin" maxlength="17" style="width: 284px; margin-right: 10px;"></el-input>
<el-button class="vin-btn" type="text" @click="handleVinConfirm">确认</el-button>
<el-button class="vin-btn" type="text" style="margin-left: 8px;" @click="handleVinCancel">取消</el-button>
</div>
</template>
</glsx-combi-form>
</div>
</GLDialog>
</template>
<script>
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'secondDialog',
props: {
secondVisible: {
type: Boolean,
default: false
},
formRules: {
type: Object,
default: () => { }
},
editForm: {
type: Object,
default: () => { }
}
},
components: {
glsxCombiForm
},
data() {
return {
secondInfo: {
tips: '请核对车架号是否正确,如信息有误后期将无法申请补偿服务!',
editFormDataSec: [
{
label: '车架号',
name: 'vin',
addHtml: 'vin'
}
],
},
isEditVin: false,
editFormSec: {
vin: ''
},
tempVin: ''
}
},
mounted() {
this.editFormSec.vin = this.$common.utils.deepClone(this.editForm?.vehicle.vin)
this.tempVin = this.$common.utils.deepClone(this.editForm?.vehicle.vin)
},
methods: {
resetStatus() {
this.isEditVin = false
},
handleChangeVin() {
this.isEditVin = !this.isEditVin
this.$refs?.editFormRefSec?.$refs?.editChildRef?.clearValidate();
},
// 取消后,vin改回原来的值
handleVinCancel() {
this.editFormSec.vin = this.$common.utils.deepClone(this.tempVin)
this.handleChangeVin()
},
handleVinConfirm() {
this.$refs.editFormRefSec.$refs.editChildRef.validate(valid => {
if (valid) {
this.handleChangeVin()
this.tempVin = this.$common.utils.deepClone(this.editFormSec.vin)
}
})
},
handleCancel() {
this.resetStatus()
this.$emit('handleSecondClose')
},
handleOk() {
this.resetStatus()
this.$emit('handleSecondOk', this.editFormSec.vin)
}
}
}
</script>
<style lang="scss" scoped>
.second-dialog .tips {
margin-bottom: 32px;
padding: 0 16px;
height: 40px;
line-height: 40px;
background: #ffefda;
font-size: 14px;
color: #000000a6;
display: flex;
align-items: center;
}
.second-dialog .icon-info {
width: 16px;
height: 16px;
margin-right: 8px;
}
.second-dialog .icon-edit {
width: 16px;
height: 16px;
margin-left: 10px;
cursor: pointer;
}
.second-dialog .vin-detail {
display: flex;
align-items: center;
}
.second-dialog .vin-edit {
display: flex;
}
.second-dialog .vin-edit .vin-btn {
padding: 0;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!