fix: 修复新建分组,重复新建数据没有清空的问题

main
wu.jian2 2 years ago
parent 1c2d20ecd9
commit 5e97647db1

@ -79,7 +79,7 @@
</el-dialog> </el-dialog>
<!-- 新增或编辑目录弹窗 --> <!-- 新增或编辑目录弹窗 -->
<el-dialog <el-dialog
:title="groupForm.code ? '编辑分组':'新建分组'" :title="currentCatalog.code ? '编辑分组':'新建分组'"
:visible.sync="catalogVisible" :visible.sync="catalogVisible"
custom-class="bs-el-dialog" custom-class="bs-el-dialog"
width="30%" width="30%"
@ -88,7 +88,7 @@
> >
<el-form <el-form
ref="form" ref="form"
:model="groupForm" :model="currentCatalog"
label-width="80px" label-width="80px"
:rules="formRules" :rules="formRules"
class="bs-el-form" class="bs-el-form"
@ -98,7 +98,7 @@
prop="name" prop="name"
> >
<el-input <el-input
v-model.trim="groupForm.name" v-model.trim="currentCatalog.name"
class="bs-el-input" class="bs-el-input"
clearable clearable
/> />
@ -107,7 +107,7 @@
label="排序" label="排序"
> >
<el-input-number <el-input-number
v-model="groupForm.orderNum" v-model="currentCatalog.orderNum"
:min="0" :min="0"
:max="30000" :max="30000"
controls-position="right" controls-position="right"
@ -157,11 +157,6 @@ export default {
searchKey: '', // searchKey: '', //
catalogVisible: false, catalogVisible: false,
currentCatalog: {}, currentCatalog: {},
groupForm: {
code: '',
name: '',
orderNum: ''
},
formVisible: false, formVisible: false,
formRules: { formRules: {
name: [ name: [
@ -203,10 +198,6 @@ export default {
if (!valid) { if (!valid) {
return return
} }
this.currentCatalog = {
...this.currentCatalog,
...this.groupForm
}
if (!this.currentCatalog.id) { if (!this.currentCatalog.id) {
this.$dataRoomAxios.post('/bigScreen/type/add', this.$dataRoomAxios.post('/bigScreen/type/add',
{ {
@ -235,7 +226,7 @@ export default {
this.catalogVisible = true this.catalogVisible = true
}, },
editCatalog (row) { editCatalog (row) {
this.groupForm = cloneDeep(row) this.currentCatalog = cloneDeep(row)
this.catalogVisible = true this.catalogVisible = true
}, },
// //

@ -57,7 +57,7 @@
</div> </div>
<!-- 新增或编辑目录弹窗 --> <!-- 新增或编辑目录弹窗 -->
<el-dialog <el-dialog
:title="groupForm.code ? '编辑分组':'新建分组'" :title="currentCatalog.code ? '编辑分组':'新建分组'"
:visible.sync="catalogVisible" :visible.sync="catalogVisible"
custom-class="bs-el-dialog" custom-class="bs-el-dialog"
width="30%" width="30%"
@ -66,7 +66,7 @@
> >
<el-form <el-form
ref="form" ref="form"
:model="groupForm" :model="currentCatalog"
label-width="80px" label-width="80px"
:rules="formRules" :rules="formRules"
class="bs-el-form" class="bs-el-form"
@ -76,7 +76,7 @@
prop="name" prop="name"
> >
<el-input <el-input
v-model.trim="groupForm.name" v-model.trim="currentCatalog.name"
class="bs-el-input" class="bs-el-input"
clearable clearable
/> />
@ -85,7 +85,7 @@
label="排序" label="排序"
> >
<el-input-number <el-input-number
v-model="groupForm.orderNum" v-model="currentCatalog.orderNum"
:min="0" :min="0"
:max="30000" :max="30000"
controls-position="right" controls-position="right"
@ -141,11 +141,6 @@ export default {
code: '', code: '',
orderNum: 0 orderNum: 0
}, },
groupForm: {
code: '',
name: '',
orderNum: 0
},
formRules: { formRules: {
name: [ name: [
{ required: true, message: '分组名称不能为空', trigger: 'blur' } { required: true, message: '分组名称不能为空', trigger: 'blur' }
@ -187,10 +182,6 @@ export default {
if (!valid) { if (!valid) {
return return
} }
this.currentCatalog = {
...this.currentCatalog,
...this.groupForm
}
if (!this.currentCatalog.id) { if (!this.currentCatalog.id) {
this.$dataRoomAxios.post('/bigScreen/type/add', this.$dataRoomAxios.post('/bigScreen/type/add',
{ {
@ -225,7 +216,7 @@ export default {
}, },
// //
catalogEdit () { catalogEdit () {
this.groupForm = cloneDeep(this.currentCatalog) this.currentCatalog = cloneDeep(this.currentCatalog)
this.catalogVisible = true this.catalogVisible = true
}, },
// //

@ -83,7 +83,7 @@
</el-dialog> </el-dialog>
<!-- 新增或编辑目录弹窗 --> <!-- 新增或编辑目录弹窗 -->
<el-dialog <el-dialog
:title="groupForm.code ? '编辑分组':'新建分组'" :title="currentCatalog.code ? '编辑分组':'新建分组'"
:visible.sync="catalogVisible" :visible.sync="catalogVisible"
custom-class="bs-el-dialog" custom-class="bs-el-dialog"
width="30%" width="30%"
@ -92,7 +92,7 @@
> >
<el-form <el-form
ref="form" ref="form"
:model="groupForm" :model="currentCatalog"
label-width="80px" label-width="80px"
:rules="formRules" :rules="formRules"
class="bs-el-form" class="bs-el-form"
@ -102,7 +102,7 @@
prop="name" prop="name"
> >
<el-input <el-input
v-model.trim="groupForm.name" v-model.trim="currentCatalog.name"
class="bs-el-input" class="bs-el-input"
clearable clearable
/> />
@ -111,7 +111,7 @@
label="排序" label="排序"
> >
<el-input-number <el-input-number
v-model="groupForm.orderNum" v-model="currentCatalog.orderNum"
:min="0" :min="0"
:max="30000" :max="30000"
controls-position="right" controls-position="right"
@ -165,11 +165,6 @@ export default {
name: [ name: [
{ required: true, message: '分组名称不能为空', trigger: 'blur' } { required: true, message: '分组名称不能为空', trigger: 'blur' }
] ]
},
groupForm: {
code: '',
name: '',
orderNum: 0
} }
} }
}, },
@ -204,10 +199,6 @@ export default {
if (!valid) { if (!valid) {
return return
} }
this.currentCatalog = {
...this.currentCatalog,
...this.groupForm
}
if (!this.currentCatalog.id) { if (!this.currentCatalog.id) {
this.$dataRoomAxios.post('/bigScreen/type/add', this.$dataRoomAxios.post('/bigScreen/type/add',
{ {
@ -236,7 +227,7 @@ export default {
this.catalogVisible = true this.catalogVisible = true
}, },
editCatalog (row) { editCatalog (row) {
this.groupForm = cloneDeep(row) this.currentCatalog = cloneDeep(row)
this.catalogVisible = true this.catalogVisible = true
}, },
// //

@ -66,7 +66,7 @@
</div> </div>
<!-- 新增或编辑目录弹窗 --> <!-- 新增或编辑目录弹窗 -->
<el-dialog <el-dialog
:title="groupForm.code ? '编辑分组' : '新建分组'" :title="currentCatalog.code ? '编辑分组' : '新建分组'"
:visible.sync="catalogVisible" :visible.sync="catalogVisible"
custom-class="bs-el-dialog" custom-class="bs-el-dialog"
width="30%" width="30%"
@ -75,7 +75,7 @@
> >
<el-form <el-form
ref="form" ref="form"
:model="groupForm" :model="currentCatalog"
label-width="80px" label-width="80px"
:rules="formRules" :rules="formRules"
class="bs-el-form" class="bs-el-form"
@ -85,14 +85,14 @@
prop="name" prop="name"
> >
<el-input <el-input
v-model.trim="groupForm.name" v-model.trim="currentCatalog.name"
class="bs-el-input" class="bs-el-input"
clearable clearable
/> />
</el-form-item> </el-form-item>
<el-form-item label="排序"> <el-form-item label="排序">
<el-input-number <el-input-number
v-model="groupForm.orderNum" v-model="currentCatalog.orderNum"
:min="0" :min="0"
:max="30000" :max="30000"
controls-position="right" controls-position="right"
@ -113,7 +113,9 @@
<el-button <el-button
type="primary" type="primary"
@click="addOrEditCatalog" @click="addOrEditCatalog"
>确定</el-button> >
确定
</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -162,11 +164,6 @@ export default {
id: '', id: '',
code: '' code: ''
}, },
groupForm: {
code: '',
name: '',
orderNum: ''
},
formRules: { formRules: {
name: [{ required: true, message: '分组名称不能为空', trigger: 'blur' }] name: [{ required: true, message: '分组名称不能为空', trigger: 'blur' }]
} }
@ -211,10 +208,6 @@ export default {
if (!valid) { if (!valid) {
return return
} }
this.currentCatalog = {
...this.currentCatalog,
...this.groupForm
}
if (!this.currentCatalog.id) { if (!this.currentCatalog.id) {
this.$dataRoomAxios.post('/bigScreen/type/add', { this.$dataRoomAxios.post('/bigScreen/type/add', {
...this.currentCatalog, ...this.currentCatalog,
@ -250,7 +243,7 @@ export default {
}, },
// //
catalogEdit () { catalogEdit () {
this.groupForm = cloneDeep(this.currentCatalog) this.currentCatalog = cloneDeep(this.currentCatalog)
this.catalogVisible = true this.catalogVisible = true
}, },
// //

Loading…
Cancel
Save