epmet pc工作端
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.
 
 
 
 

143 lines
3.3 KiB

<template>
<el-dialog :visible.sync="visible"
:title="'编辑外部客户'"
:close-on-click-modal="false"
:before-close="handleClose"
:close-on-press-escape="false">
<el-form :inline="true"
:model="dataForm"
:rules="dataRule"
ref="dataForm"
:label-width="'120px'">
<el-form-item label="客户名称"
prop="customerName">
<el-input class="item_width_1"
v-model="dataForm.customerName"
placeholder="客户名称"></el-input>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary"
@click="saveForm()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import { Loading } from 'element-ui' // 引入Loading服务
let loading// 加载动画
export default {
data () {
return {
visible: false,
type: '', // 操作类型A/U
dataForm: {
customerId: '',
customerName: ''
},
uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/function/upload',
}
},
created () {
// this.queryFunctionList()
},
computed: {
dataRule () {
return {
customerName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
}
}
},
methods: {
init (dataForm, type) {
this.type = type
this.visible = true
// this.dataForm=dataForm
this.$nextTick(() => {
Object.assign(this.dataForm, dataForm)
})
},
addRequest () {
this.dataForm.domainNameList.push('')
},
delRequest (index) {
this.dataForm.domainNameList.splice(index, 1)
},
saveForm () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
this.$message.error('表单验证失败!')
} else {
let url = ''
if (this.type === 'U') {
url = '/commonservice/externalcustomer/update'
} else {
url = '/commonservice/externalcustomer/add'
}
this.dataForm.functionGroup = '1'
window.app.ajax.post(url, this.dataForm,
(data, rspMsg) => {
this.$message({
type: 'success',
message: '保存成功'
})
this.$emit('editDiaOK')
this.visible = false
},
(rspMsg, data) => {
this.endLoading()
this.$message.error(rspMsg)
})
}
})
},
handleClose () {
this.visible = false
},
// 开启加载动画
startLoading () {
loading = Loading.service({
lock: true, // 是否锁定
text: '正在加载……', // 加载中需要显示的文字
background: 'rgba(0,0,0,.7)' // 背景颜色
})
},
// 结束加载动画
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close()
}
}
}
}
</script>
<style scoped>
.function-icon {
width: 28px;
}
.item_width_1 {
width: 300px;
}
.item_width_2 {
width: 700px;
}
.block {
display: block;
}
.btn_serve {
float: left;
margin-top: 4px;
margin-left: 10px;
vertical-align: bottom;
}
</style>