6d21390a
wuxw
开发车辆详情页面
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancel') }}</el-button>
<el-button type="primary" @click="_submitEditMemberCarInfo">{{ $t('common.save') }}</el-button>
</div>
</el-dialog>
</template>
<script>
import { editOwnerCar } from '@/api/car/listOwnerCarApi'
import { getDict } from '@/api/community/communityApi'
import { getCommunityId } from '@/api/community/communityApi'
export default {
name: 'EditMemberCar',
data() {
return {
visible: false,
editMemberCarInfo: {
carId: '',
memberId: '',
carNum: '',
carBrand: '',
carType: '',
carColor: '',
remark: "",
startTime: '',
endTime: '',
carNumType: '',
leaseType: '',
},
carTypes: [],
rules: {
carNum: [
{ required: true, message: this.$t('editMemberCar.licensePlateRequired'), trigger: 'blur' },
{ min: 2, max: 12, message: this.$t('editMemberCar.licensePlateInvalid'), trigger: 'blur' }
],
carType: [
{ required: true, message: this.$t('editMemberCar.carTypeRequired'), trigger: 'change' }
],
memberId: [
{ required: true, message: this.$t('editMemberCar.carDataError'), trigger: 'blur' }
]
}
}
},
created() {
this.communityId = getCommunityId()
this.loadCarTypes()
},
methods: {
async loadCarTypes() {
try {
const data = await getDict('owner_car', 'car_type')
this.carTypes = data
} catch (error) {
console.error('获取字典数据失败:', error)
}
},
open(carInfo) {
this.editMemberCarInfo = Object.assign({}, carInfo)
this.visible = true
this.$nextTick(() => {
this.$refs.editMemberCarForm.clearValidate()
})
},
_submitEditMemberCarInfo() {
this.$refs.editMemberCarForm.validate(valid => {
if (valid) {
this.editMemberCarInfo.communityId = this.communityId
editOwnerCar(this.editMemberCarInfo).then(response => {
if (response.code === 0) {
this.visible = false
this.$emit('notify')
|