Browse Source

【PC端优化】前端优化(字典管理项数据错乱问题修改)-王公峰-2020-07-27

master
wanggongfeng 6 years ago
parent
commit
e17787ccbd
  1. 1
      src/views/modules/sys/dept-add-or-update.vue
  2. 2
      src/views/modules/sys/dict-add-or-update.vue
  3. 21
      src/views/modules/sys/dict.vue

1
src/views/modules/sys/dept-add-or-update.vue

@ -6,7 +6,6 @@
<el-form :model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
label-width="120px">
<el-form-item prop="name"
:label="$t('dept.name')">

2
src/views/modules/sys/dict-add-or-update.vue

@ -1,6 +1,6 @@
<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 :model="dataForm" :rules="dataRule" ref="dataForm" label-width="120px">
<el-form-item prop="dictName" :label="$t('dict.dictName')">
<el-input v-model="dataForm.dictName" :placeholder="$t('dict.dictName')"></el-input>
</el-form-item>

21
src/views/modules/sys/dict.vue

@ -17,17 +17,17 @@
@keyup.native="btKeyUpDictType"
clearable></el-input>
</el-form-item>
<el-form-item v-if="dataForm.pid !== '0'">
<el-form-item v-if="dataForm.pid !== '0'" label='字典值'>
<el-input v-model="dataForm.dictValue"
:placeholder="$t('dict.dictValue')"
clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataListSearch()" type='primary'>{{ $t('query') }}</el-button>
<el-button @click="getDataListSearch()" type='success'>{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('sys:dict:save')"
type="success"
type="primary"
@click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
<!-- <el-form-item>
@ -143,16 +143,18 @@ export default {
components: {
AddOrUpdate
},
activated () {
created: function () {
// pid,
this.dataForm.pid = this.$route.params.pid || '0'
if (this.dataForm.pid !== '0') {
this.mixinViewModuleOptions.getDataListURL = '/sys/dict/list'
this.mixinViewModuleOptions.getDataListIsPage = false
this.dataForm.dictType = this.$route.params.type || ''
}
this.getDataList()
},
activated(){
this.getDataList()
},
methods: {
//
childHandle (row) {
@ -195,9 +197,18 @@ export default {
addOrUpdateHandle (row = {}) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
var dictTypeSubStr = ''
if (this.dataForm.pid !== '0') {
var titleName = `${this.$route.meta.title}`
var startIndex = titleName.indexOf('- ') === -1 ? 0 : titleName.indexOf('- ')
dictTypeSubStr = titleName.substr(startIndex,titleName.length).replace('- ','')
}
this.$refs.addOrUpdate.dataForm.id = row.id
this.$refs.addOrUpdate.dataForm.pid = this.dataForm.pid
this.$refs.addOrUpdate.dataForm.dictType = row.dictType || this.dataForm.dictType || ''
if (this.$refs.addOrUpdate.dataForm.dictType === null || this.$refs.addOrUpdate.dataForm.dictType === '') {
this.$refs.addOrUpdate.dataForm.dictType = dictTypeSubStr
}
this.$refs.addOrUpdate.init()
})
}

Loading…
Cancel
Save