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.

149 lines
4.8 KiB

<template>
<el-dialog
:title="!dataForm.ticketsId ? '新增' : '修改'"
:close-on-click-modal="false"
1 month ago
:visible.sync="visible"
width="500px">
<el-form :model="dataForm" :rules="dataRule" label-width="100px" size="mini" ref="dataForm" @keyup.enter.native="dataFormSubmit()">
<el-form-item label="小车类型" prop="carType">
1 month ago
<el-select v-model="dataForm.carType" placeholder="小车类型">
<el-option
1 month ago
v-for="item in dictsOpt['car_type']"
1 month ago
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="异常类型" prop="errorType">
1 month ago
<el-select v-model="dataForm.carType" placeholder="异常类型">
1 month ago
<el-option
1 month ago
v-for="item in dictsOpt['error_type']"
1 month ago
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="合同编号" prop="contractNumber">
1 month ago
<el-select v-model="dataForm.contractNumber" placeholder="合同编号">
<el-option
v-for="item in contractOpt"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
1 month ago
<el-form-item label="客户" prop="clientId">
1 month ago
<el-select v-model="dataForm.clientId" placeholder="客户">
<el-option
v-for="item in clientIdOpt"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="故障描述" prop="description">
1 month ago
<el-input type="textarea" :rows="2" placeholder="故障描述" v-model="dataForm.description"></el-input>
</el-form-item>
<el-form-item label="客户联系电话" prop="deptPhone">
<el-input v-model="dataForm.deptPhone" placeholder="客户联系电话"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
1 month ago
<el-button size="mini" @click="visible = false">取消</el-button>
<el-button size="mini" type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
1 month ago
carTypeOpt: [],
errorTypeOpt: [],
dataForm: {
2 months ago
ticketsId: null,
carType: '',
errorType: '',
contractNumber: '',
clientId: '',
description: '',
1 month ago
deptPhone: ''
},
dataRule: {
carType: [
{ required: true, message: '小车类型不能为空', trigger: 'blur' }
],
errorType: [
{ required: true, message: '异常类型不能为空', trigger: 'blur' }
],
clientId: [
{ required: true, message: '客户id不能为空', trigger: 'blur' }
]
}
}
},
1 month ago
props: {
contractOpt: Array,
clientIdOpt: Array,
dictsOpt: Object
2 months ago
},
methods: {
init (id) {
this.dataForm.ticketsId = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.ticketsId) {
this.$http({
url: this.$http.adornUrl(`/tickets/tickets/info/${this.dataForm.ticketsId}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.carType = data.tickets.carType
this.dataForm.errorType = data.tickets.errorType
this.dataForm.contractNumber = data.tickets.contractNumber
this.dataForm.clientId = data.tickets.clientId
this.dataForm.description = data.tickets.description
this.dataForm.deptPhone = data.tickets.deptPhone
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/tickets/tickets/${!this.dataForm.ticketsId ? 'save' : 'update'}`),
method: 'post',
1 month ago
data: this.$http.adornData(this.dataForm)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>