<template> <el-dialog class="client-data-dialog" title="反馈新增" :visible.sync="visible" :before-close="handleClose" style="width:90%"> <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="140px" class="demo-ruleForm"> <el-form-item label="联系结果" prop="title"> <el-select v-model="ruleForm.title" label="联系结果" placeholder="请选择" @change="changeValue" style="width:80%"> <el-option v-for="item in operat" :key="item.name" :label="item.name" :value="item.value"> </el-option> </el-select> </el-form-item> <el-form-item label="备注信息" prop="content"> <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="ruleForm.content" style="width:60%"> </el-input> </el-form-item> </el-form> <div slot="footer" style="margin-right:30px"> <el-button @click="handleClose">取 消</el-button> <el-button type="primary" @click="submitForm('ruleForm')">确 定</el-button> </div> </el-dialog> </template> <script type="text/ecmascript-6"> export default { name: 'ByhJumpUserDetail', props: { dialogVisible: { type: Boolean, required: true }, bizNo: { type: String }, clientNo: { type: String }, }, data() { return { ui: { submitLoading: false }, visible: this.$props.dialogVisible, operat: [], ruleForm: { bizNo : '', title: '', content :'', clientCell:'', handle: '' }, rules: { }, } }, created() { this.ruleForm = { bizNo: this.bizNo, clientNo: this.clientNo, } this.$$get('/client/getClientCell/'+this.clientNo) .then(res => { if (res.data.code == 1){ this.ruleForm.clientCell = res.data.data }else{ this.$message({message: res.data.msg, type: 'error'}); } }) .catch(err => this.$$msg.err(err)) }, methods: { /** 提交点击 */ submitForm(ruleForm) { this.$$post('/contact/create', { bizNo : this.ruleForm.bizNo, title : this.ruleForm.title, clientCell : this.ruleForm.clientCell, handle : localStorage.getItem("loginName") , content : this.ruleForm.content, }) .then(res => { if (res.data.code < 1) { this.$message.error(res.data.msg); return } this.$message({message: '新增成功', type: 'success'}); this.handleClose(); this.$emit('my-event',true) }) .catch(err => { alert("error!") }) }, changeValue(value) { let obj = {}; obj = this.operat.find((item)=>{ return item.value === value; }); this.ruleForm.title = value; }, loadOperate() { this.$$get('/contact/getTitleEnum') .then(res => { if (res.data.code == 1){ let arr = [] Object.keys(res.data.data).forEach(function(key){ var a = new Object(); a.name = res.data.data[key] a.value = key; arr.push(a) }); this.operat =arr; }else{ this.$message({message: res.data.msg, type: 'error'}); } }) .catch(err => this.$$msg.err(err)) }, handleSelect(item) { this.ruleForm.title = item.value; this.ruleForm.problemDescription = item.problemDescription; this.ruleForm.solve = item.solve; }, handleIconClick(ev) { console.log(ev); }, /** 关闭处理 */ handleClose() { this.visible = false; setTimeout(() => { this.$emit('update:dialogVisible', false) }, 300); } }, mounted: function () { this.loadOperate(); }, } </script> <style> </style>