|
|
@ -1,6 +1,17 @@ |
|
|
|
<template> |
|
|
|
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false"> |
|
|
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px"> |
|
|
|
<el-form-item :label="$t('dict.dictPValue')"> |
|
|
|
<el-select v-model="dataForm.dictPValue" |
|
|
|
placeholder="请选择" |
|
|
|
class="overtime-input"> |
|
|
|
<el-option v-for="item in pDictList" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="dictValue" :label="$t('dict.dictValue')"> |
|
|
|
<el-input v-model="dataForm.dictValue" :placeholder="$t('dict.dictValue')"></el-input> |
|
|
|
</el-form-item> |
|
|
@ -27,11 +38,14 @@ export default { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
visible: false, |
|
|
|
pDictList: [], |
|
|
|
dataForm: { |
|
|
|
id: '', |
|
|
|
dictTypeId: '', |
|
|
|
dictLabel: '', |
|
|
|
dictValue: '', |
|
|
|
dictPValue: '', |
|
|
|
dictType: '', |
|
|
|
sort: 0, |
|
|
|
remark: '' |
|
|
|
} |
|
|
@ -57,9 +71,11 @@ export default { |
|
|
|
this.visible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs['dataForm'].resetFields() |
|
|
|
this.dataForm.dictPValue = '' |
|
|
|
if (this.dataForm.id) { |
|
|
|
this.getInfo() |
|
|
|
} |
|
|
|
this.initPDictList() |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取信息 |
|
|
@ -74,12 +90,30 @@ export default { |
|
|
|
} |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
//获取客户数据 |
|
|
|
async initPDictList () { |
|
|
|
let params = { |
|
|
|
dictType: this.dataForm.dictType |
|
|
|
} |
|
|
|
this.$http |
|
|
|
.post('/sys/dict/data/dictlist', params) |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code === 0) { |
|
|
|
this.pDictList = res.data |
|
|
|
console.log(this.pDictList) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
|
dataFormSubmitHandle: debounce(function () { |
|
|
|
this.$refs['dataForm'].validate((valid) => { |
|
|
|
if (!valid) { |
|
|
|
return false |
|
|
|
} |
|
|
|
console.log('===',this.dataForm.dictPValue=== ''); |
|
|
|
if (this.dataForm.dictPValue === ''){ |
|
|
|
this.dataForm.dictPValue = null; |
|
|
|
} |
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dict/data', this.dataForm).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|