You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

153 lines
4.5 KiB

<template>
<div class="app-container">
<div class="tab-header webtop">
<div>车辆买断</div>
<div>
<el-button type="primary" size="small" :disabled="dialogFormVisible" @click="handleCreate()">保存</el-button>
<el-button type="info" size="small" @click="handleReturn()">返回</el-button>
</div>
</div>
<div class="listconadd">
<div class="titwu">车辆买断</div>
<el-form ref="dataForm" :model="temp" label-position="right" class="formadd" :rules="rules">
<el-row class="first_row">
<el-col :span="4">
<el-form-item>
<span>车架号</span>
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item>
<span>{{ temp.vinNo }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item>
<span><span class="icon">*</span>买断日期</span>
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item prop="solidDate">
<el-date-picker v-model="temp.solidDate" type="date" format="yyyy-MM-dd" class="addinputw" value-format="yyyy-MM-dd" placeholder="选择日期时间"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item>
<span><span class="icon">*</span>上传买断证明</span>
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item>
<upload ref="uploadImg" v-model="imgList" :limit="1" bucket="map" :upload-data="{type:'0001'}"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
</template>
<script>
import { vehicleBuyBreak } from '@/api/cheliang/basevehicle'
import Upload from '@/components/uploadFile/upload_maiduan.vue'
export default {
name: 'CheLiangTaiZhangMai',
components: {
Upload
},
data() {
return {
temp: {
commonAppendix: {},
solidDate: '',
vehicleSid: [],
vinNo: ''
},
dialogFormVisible: false,
imgList: [],
rules: {
solidDate: [{ required: true, message: '买断日期不能为空', trigger: 'blur' }]
}
}
},
methods: {
showMai(sids, vinNos) {
this.temp.vehicleSid = sids
this.temp.vinNo = vinNos.toString()
var newDate = new Date()
var date = {
year: newDate.getFullYear(),
month: newDate.getMonth() + 1,
day: newDate.getDate()
}
this.temp.solidDate = date.year + '-' + (date.month >= 10 ? date.month : '0' + date.month) + '-' + (date.day >= 10 ? date.day : '0' + date.day)
},
getUrl() {
if (this.imgList.length > 0) {
console.log('imgList', this.imgList)
let img01_list = new Object()
// for (var i = 0; i < this.imgList.length; i++) {
const type = this.imgList[this.imgList.length - 1].name.split('.')
img01_list = {
attachType: type[type.length - 1],
createBySid: window.sessionStorage.getItem('userSid'),
fileName: this.imgList[this.imgList.length - 1].name,
filePath: this.imgList[this.imgList.length - 1].url,
fileSize: this.imgList[this.imgList.length - 1].size,
fileType: type[type.length - 1]
}
// }
this.temp.commonAppendix = img01_list
} else {
this.temp.commonAppendix = []
}
},
// 保存
handleCreate() {
this.getUrl()
if (this.temp.solidDate === '') {
this.$message({ showClose: true, message: '买断日期不能为空!', type: 'error' })
return
}
this.dialogFormVisible = true
vehicleBuyBreak(this.temp).then((response) => {
if (response.code === '200') {
this.dialogFormVisible = false
this.handleReturn('true')
} else {
this.dialogFormVisible = false
}
})
.catch(e => {
this.dialogFormVisible = false
})
},
// 返回
handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist')
this.temp = {
vinNo: '',
commonAppendix: []
}
this.imgList = []
this.$emit('doback')
}
}
}
</script>
<style scoped>
/deep/ .el-col-4 {
text-align: right;
float: left;
font-size: 14px;
color: #606266;
line-height: 40px !important;
font-weight: 600;
}
</style>