【update】数据字典、标签管理是否可修改bug的处理

This commit is contained in:
fengchenchen
2023-11-08 21:30:46 +08:00
parent 67e073c600
commit 0205e5dd01
9 changed files with 74 additions and 35 deletions
+7
View File
@@ -179,6 +179,13 @@ export const PayState = new EsEnums({
nonPayment: { text: '未支付', value: '2' }
})
// 标签管理-只读状态的数据字段
export const IsReadOnlyEnums = {
configurable: { text: '非固定字段', value: 0 },
fixed: { text: '固定的', value: 1 },
subConfigurable: { text: '字段固定,内部可配', value: 2 }
}
// 标准法规入库/变更流程
export const FGEntryChangeProcessNode = {
initiate: { text: '法规工程师发起', value: '1', btn: ['save', 'submit'] },
+7 -3
View File
@@ -43,7 +43,7 @@
</a-row>
<a-row>
<a-col :md="2" :sm="24">
<a-button style="margin-bottom: 10px" type="primary" @click="handleAdd">{{ $t('newlyAdded') }}</a-button>
<a-button style="margin-bottom: 10px" type="primary" @click="handleAdd" v-if="model.isReadOnly === IsReadOnlyEnums.configurable.value || model.isReadOnly === IsReadOnlyEnums.subConfigurable.value">{{ $t('newlyAdded') }}</a-button>
</a-col>
</a-row>
</a-form>
@@ -62,9 +62,9 @@
>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">{{ $t('edit') }}</a>
<a @click="handleEdit(record)" v-if="record.isReadOnly === IsReadOnlyEnums.subConfigurable.value || record.isReadOnly === IsReadOnlyEnums.configurable.value">{{ $t('edit') }}</a>
<a-divider type="vertical"/>
<a-popconfirm :title="$t('areYouSure')" @confirm="() => handleDelete(record.id)">
<a-popconfirm :title="$t('areYouSure')" @confirm="() => handleDelete(record.id)" v-if="record.isReadOnly === IsReadOnlyEnums.subConfigurable.value || record.isReadOnly === IsReadOnlyEnums.configurable.value">
<a>{{ $t('delete') }}</a>
</a-popconfirm>
</span>
@@ -83,6 +83,7 @@ import { filterObj } from '@/utils/util'
import DictItemModal from './modules/DictItemModal'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JInput from '@/components/jero/JInput'
import { IsReadOnlyEnums } from '../../enums/commonEnums'
export default {
name: 'DictItemList',
@@ -90,6 +91,7 @@ export default {
components: { DictItemModal, JInput },
data () {
return {
IsReadOnlyEnums,
columns: [
{
title: this.$t('name'),
@@ -124,6 +126,7 @@ export default {
delFlag: '1',
status: []
},
isReadOnly: IsReadOnlyEnums.configurable.value,
title: this.$t('operation'),
visible: false,
screenWidth: 1000,
@@ -162,6 +165,7 @@ export default {
edit (record) {
if (record.id) {
this.dictId = record.id
this.isReadOnly = record.isReadOnly // 父级readonly的值 用于判断是否可以编辑
}
this.queryParam = {}
this.form.resetFields()
+5 -2
View File
@@ -74,6 +74,7 @@
// import pick from 'lodash.pick'
import { addDictItem, editDictItem } from '@/api/api'
import { getAction } from '@api/manage'
import { IsReadOnlyEnums } from '../../../enums/commonEnums'
export default {
name: 'DictItemModal',
@@ -149,9 +150,11 @@ export default {
} else {
obj = editDictItem
}
const params = Object.assign({}, this.model, {
dictId: this.dictId, // 数据字典的id
const params = Object.assign({
isTagDict: 0, // 是否为标签管理的表示
isReadOnly: IsReadOnlyEnums.configurable.value // 是否可以操作,默认是可配的
}, this.model, {
dictId: this.dictId, // 数据字典的id
delFlag: 0 // 是否删除的标识,新的接口必须增加这一个字段,可以联系后端沟通,否则不能查看
})
obj(params).then((res) => {
@@ -63,6 +63,7 @@
<a-form-model-item :label="$t('system.tag.attributeType')" prop="fieldShowType">
<j-dict-select-tag type="list" v-model="form.fieldShowType" dictCode="field_show_type"
:placeholder="$t('pleaseSelect') + $t('system.tag.attributeType')"
@change="fieldShowTypeChange"
:disabled="disabledEdit" />
</a-form-model-item>
@@ -74,6 +75,7 @@
v-model="form.dictId"
show-search
:filter-option="filterOption"
@change="optionContentChange"
>
<a-select-option v-for="item in contentOption" :key="item.id" :value="item.id">
{{ item.dictName }}
@@ -291,6 +293,18 @@ export default {
onClose () {
this.visible = false
},
fieldShowTypeChange (e) {
this.form.dictId = undefined
// 很重要,必须要复制一下,否则不能重新赋值成功
this.form = { ...this.form }
this.$forceUpdate()
},
optionContentChange (e) {
this.form.dictId = e
// 很重要,必须要复制一下,否则不能重新赋值成功
this.form = { ...this.form }
this.$forceUpdate()
},
handleOk () {
this.$refs.editForm.validate((valid) => {
console.log('---err-----', valid)
@@ -347,7 +361,7 @@ export default {
val = val + ''
// this.contentFlag=val
// 树形结构
if (val === FieldType.TREE.value) {
if (val === FieldType.TREE.value || val === FieldType.TREE_SINGLE.value || val === FieldType.TREE_MODAL_SELECT.value) {
this.contentOption = [...this.contentOptionTree]
this.isTagContent = true
} else if (val === FieldType.OPTION_SINGLE.value || val === FieldType.OPTION_MORE.value) {
@@ -83,7 +83,7 @@
<a-col :span="24" v-if="isTagContent">
<a-form-model-item :label="$t('system.tag.optionContent')" prop="dictId" key="dictId">
<template>
<a-select :placeholder="$t('pleaseSelect') + $t('system.tag.optionContent')" v-model="form.dictId">
<a-select :placeholder="$t('pleaseSelect') + $t('system.tag.optionContent')" v-model="form.dictId" @change="optionContentChange">
<a-select-option v-for="item in contentOption" :key="item.id" :value="item.id">
{{ item.dictName }}
</a-select-option>
@@ -359,13 +359,17 @@ export default {
onClose () {
this.visible = false
},
fieldShowTypeChange(e) {
console.log(e, '----------')
// this.form.dictId = undefined
// this.$refs.editForm.resetFields({
// dictId: undefined
// })
// this.$forceUpdate()
fieldShowTypeChange (e) {
this.form.dictId = undefined
// 很重要,必须要复制一下,否则不能重新赋值成功
this.form = { ...this.form }
this.$forceUpdate()
},
optionContentChange (e) {
this.form.dictId = e
// 很重要,必须要复制一下,否则不能重新赋值成功
this.form = { ...this.form }
this.$forceUpdate()
},
handleOk () {
this.$refs.editForm.validate((valid) => {
@@ -74,7 +74,7 @@
</template>
<script>
import { TagsAttributeTypeEnums } from '../../../../enums/commonEnums'
import { IsReadOnlyEnums, TagsAttributeTypeEnums } from '../../../../enums/commonEnums'
import { addDictItem, editDictItem, getDictTreeList } from '../../../../api/api'
import { getAction } from '../../../../api/manage'
@@ -167,18 +167,19 @@ export default {
that.confirmLoading = true
// 启用、禁用的标识
that.model.status = that.status
let obj
// 数据字典
if (!this.model.id) {
obj = addDictItem
} else {
obj = editDictItem
}
const params = Object.assign({}, this.model, {
dictId: this.dictId, // 数据字典的id
isTagDict: 1, // 是否为标签管理的表示
delFlag: 0 // 是否删除的标识,新的接口必须增加这一个字段,可以联系后端沟通
})
let obj
// 数据字典
if (!this.model.id) {
obj = addDictItem
params.isReadOnly = IsReadOnlyEnums.configurable.value // 是否可以操作,默认是可配的
} else {
obj = editDictItem
}
obj(params).then((res) => {
if (res.success) {
that.$message.success(res.message)
@@ -31,11 +31,11 @@
</a-form>
</div>
<div class="table-operator">
<div class="operator-text" @click="handleAdd" v-has="'sys:dict:operation'">
<div class="operator-text" v-if="record.isReadOnly === IsReadOnlyEnums.configurable.value || record.isReadOnly === IsReadOnlyEnums.subConfigurable.value" @click="handleAdd" v-has="'sys:dict:operation'">
<a-icon type="plus" />
{{ $t('newlyAdded') }}
</div>
<div class="operator-text" @click="batchDel" v-has="'sys:dict:operation'">
<div class="operator-text" v-if="record.isReadOnly === IsReadOnlyEnums.configurable.value || record.isReadOnly === IsReadOnlyEnums.subConfigurable.value" @click="batchDel" v-has="'sys:dict:operation'">
<a-icon type="delete" />
{{ $t('batchDelete') }}
</div>
@@ -56,8 +56,8 @@
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<div slot="action" class="table-action" slot-scope="{text, record}">
<a class="action-edit" @click="handleEdit(record)" v-has="'sys:dict:operation'">{{ $t('edit') }}</a>
<a class="table-del" @click="handleDelete(record.id)" v-has="'sys:dict:operation'">{{ $t('delete') }}</a>
<a class="action-edit" v-if="record.isReadOnly === IsReadOnlyEnums.configurable.value || record.isReadOnly === IsReadOnlyEnums.subConfigurable.value" @click="handleEdit(record)" v-has="'sys:dict:operation'">{{ $t('edit') }}</a>
<a class="table-del" v-if="record.isReadOnly === IsReadOnlyEnums.configurable.value || record.isReadOnly === IsReadOnlyEnums.subConfigurable.value" @click="handleDelete(record.id)" v-has="'sys:dict:operation'">{{ $t('delete') }}</a>
</div>
</j-table>
</div>
@@ -69,7 +69,7 @@
import '@assets/less/common.less'
import TagContentDictItemModal from './TagContentDictItemModal'
import { SimpleListMixin } from '../../../../mixins/SimpleListMixin'
import { TagsAttributeTypeEnums } from '../../../../enums/commonEnums'
import { IsReadOnlyEnums, TagsAttributeTypeEnums } from '../../../../enums/commonEnums'
import JTable from '../../../../components/jero/JTable'
export default {
@@ -81,11 +81,13 @@ export default {
},
data () {
return {
IsReadOnlyEnums,
TagsAttributeTypeEnums,
visible: false,
title: this.$t('system.tag.dictionaryConfiguration'),
width: 1000,
confirmLoading: false,
record: {},
commonColumns: [
{
// 英文名称
@@ -58,6 +58,7 @@
<script>
import JDictSelectTag from '../../../../components/dict/JDictSelectTag'
import { addDict, duplicateCheck, editDict } from '../../../../api/api'
import { IsReadOnlyEnums } from '../../../../enums/commonEnums'
export default {
name: 'TagContentModal',
@@ -123,15 +124,16 @@ export default {
this.$refs.form.validate(valid => {
if (valid) {
this.confirmLoading = true
let Func = addDict
if (this.isEdit) {
Func = editDict
}
const formData = Object.assign({}, this.model)
// 重要,设置为标签内容
formData.isTagDict = 1
// 设置为非固定字段--默认可以编辑
formData.isReadOnly = 0
let Func = addDict
if (this.isEdit) {
Func = editDict
} else {
// 设置为非固定字段--默认可以编辑
formData.isReadOnly = IsReadOnlyEnums.configurable.value // 是否可以操作,默认是可配的
}
Func(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
+4 -2
View File
@@ -56,8 +56,8 @@
>
<div slot="action" class="table-action" slot-scope="{text, record}">
<a class="action-dict" @click="editDictItem(record)">{{ $t('system.tag.dictionaryConfiguration') }}</a>
<a class="action-edit" v-if="canOpeFlag || record.isReadOnly === 0" @click="handleEdit(record)" v-has="'sys:dict:operation'">{{ $t('edit') }}</a>
<a class="action-delete" v-if="canOpeFlag || record.isReadOnly === 0" @click="handleDelete(record.id)" v-has="'sys:dict:operation'">{{ $t('delete') }}</a>
<a class="action-edit" v-if="canOpeFlag || record.isReadOnly === IsReadOnlyEnums.configurable.value" @click="handleEdit(record)" v-has="'sys:dict:operation'">{{ $t('edit') }}</a>
<a class="action-delete" v-if="canOpeFlag || record.isReadOnly === IsReadOnlyEnums.configurable.value" @click="handleDelete(record.id)" v-has="'sys:dict:operation'">{{ $t('delete') }}</a>
</div>
</j-table>
@@ -79,6 +79,7 @@ import JTable from '../../../../components/jero/JTable'
import Vue from 'vue'
import { getAction } from '../../../../api/manage'
import { UI_CACHE_DB_DICT_DATA } from '../../../../store/mutation-types'
import { IsReadOnlyEnums } from '../../../../enums/commonEnums'
export default {
name: 'TagContent',
@@ -91,6 +92,7 @@ export default {
},
data () {
return {
IsReadOnlyEnums,
columns: [
{
title: this.$t('system.tag.labelName'),