【update】标签管理+数据字典-一些细节的处理

This commit is contained in:
fengchenchen
2023-08-25 22:46:20 +08:00
parent 5f9726840d
commit 4fd32f1d2f
12 changed files with 238 additions and 117 deletions
+3 -1
View File
@@ -18,7 +18,9 @@ export const FieldType = {
FILE_UP: { text: '上传文件', value: '8' },
TEXT_BOX: { text: '文本框', value: '9' },
OPTION_SINGLE: { text: '下拉单选', value: '10' },
OPTION_MORE: { text: '下拉多选', value: '11' }
OPTION_MORE: { text: '下拉多选', value: '11' },
TREE: { text: '树形结构', value: '12' },
TEXT_LINK: { text: '输入框(链接)', value: '13' }
}
export const TagsTypeEnums = new EsEnums({
+9 -3
View File
@@ -133,12 +133,18 @@ export default {
this.model.description = (this.model.description || '').trim()
this.model.status = this.status
let obj
// 数据字典
if (!this.model.id) {
obj = addDictItem(this.model)
obj = addDictItem
} else {
obj = editDictItem(this.model)
obj = editDictItem
}
obj.then((res) => {
const params = Object.assign({}, this.model, {
dictId: this.dictId, // 数据字典的id
isTagDict: 0, // 是否为标签管理的表示
delFlag: 0 // 是否删除的标识,新的接口必须增加这一个字段,可以联系后端沟通,否则不能查看
})
obj(params).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
@@ -104,7 +104,7 @@ export default {
{ min: 1, max: 50, message: this.$t('charactersLength'), trigger: 'blur' }
],
sort: [
{ required: true, message: this.$t('enterSortingNumber'), trigger: 'change' }
{ required: false, message: this.$t('enterSortingNumber'), trigger: 'change' }
]
},
moduleArr: TagsTypeEnums.getItemList()
+57 -19
View File
@@ -18,11 +18,16 @@
<a-icon type="plus" />
{{$t('add')}}
</div>
<div class="operator-text" @click="batchDel">
<a-icon type="delete" />
{{ $t('batchDelete') }}
</div>
</div>
<a-table
<j-table
ref="table"
:bordered="true"
bordered
can-drag
size="middle"
rowKey="id"
:columns="columns"
@@ -32,20 +37,13 @@
:scroll="{x: '100%'}"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<template slot="text" slot-scope="text">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text">{{ text || text === 0 ? text : global.emptyLine }}</div>
</a-tooltip>
</template>
<div slot="action" class="table-action" slot-scope="text, record">
<div slot="action" class="table-action" slot-scope="{text, record}">
<a class="action-edit" @click="handleEdit(record)" v-has="'area:edit'"
>{{ $t('edit') }}</a>
<a class="table-del" @click="handleDelete(record.id)" v-has="'area:delete'"
>{{ $t('delete') }}</a>
</div>
</a-table>
</j-table>
</a-spin>
<!--新增表单-->
<area-form-modal v-bind="$props" ref="modalForm" @ok="modalFormOk"></area-form-modal>
@@ -58,6 +56,7 @@ import AreaFormModal from './AreaFormModal'
import { TagsTypeEnums } from '../../../../enums/commonEnums'
import { SimpleListMixin } from '../../../../mixins/SimpleListMixin'
import { postAction } from '../../../../api/manage'
import JTable from '../../../../components/jero/JTable'
export default {
name: 'AreaModal',
@@ -71,7 +70,8 @@ export default {
}
},
components: {
AreaFormModal
AreaFormModal,
JTable
},
data () {
return {
@@ -104,13 +104,13 @@ export default {
dataIndex: 'enName',
ellipsis: true
},
{
title: this.$t('system.tag.module'),
align: 'left',
width: 100,
dataIndex: 'isModelName',
ellipsis: true
},
// {
// title: this.$t('system.tag.module'),
// align: 'left',
// width: 100,
// dataIndex: 'isModelName',
// ellipsis: true
// },
{
title: this.$t('dict.rankingValue'),
align: 'left',
@@ -155,6 +155,8 @@ export default {
modalFormOk () {
this.$emit('refresh')
this.loadData()
// 清空列表选中
this.onClearSelected()
},
handleDelete: function (id) {
if (!this.url.delete) {
@@ -173,6 +175,7 @@ export default {
if (that.ipagination.current > 1 && ((that.ipagination.current - 1) * that.ipagination.pageSize) + 1 === that.ipagination.total) {
that.ipagination.current -= 1
}
// 增加列表页的操作
that.$emit('refresh')
that.loadData()
} else {
@@ -182,6 +185,41 @@ export default {
}
})
},
batchDel () {
if (!this.url.deleteBatch) {
this.$message.error('请设置url.deleteBatch属性!')
return
}
if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
return
}
const ids = this.selectedRowKeys.join()
const that = this
this.$confirm({
title: '确认删除',
content: '是否删除选中数据?',
onOk: function () {
that.loading = true
postAction(that.url.deleteBatch, { ids: ids }).then((res) => {
if (res.success) {
// 重新计算分页问题
that.reCalculatePage(that.selectedRowKeys.length)
that.$message.success(res.message)
that.loadData()
that.onClearSelected()
// 增加列表页的操作
that.$emit('refresh')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.loading = false
})
}
})
}
}
}
</script>
@@ -115,8 +115,8 @@
<script>
import JDictSelectTag from '../../../../components/dict/JDictSelectTag'
import { TagsTypeEnums } from '../../../../enums/commonEnums'
import { queryDictName } from '../../../../api/api'
import { FieldType, TagsAttributeTypeEnums, TagsTypeEnums } from '../../../../enums/commonEnums'
import { addTag, editTag, queryDictName } from '../../../../api/api'
export default {
name: 'ClauseSplittingDrawer',
@@ -211,34 +211,14 @@ export default {
areaOptions: [],
// 选项内容选项
contentOption: [],
contentOption1: [],
contentOption2: [],
contentOptionSelect: [],
contentOptionTree: [],
moduleArr: TagsTypeEnums.getItemList()
}
},
watch: {
'form.fieldShowType' (val) {
// this.contentFlag=val
if (val == 0) {
this.contentOption = [...this.contentOption2]
this.isTagContent = true
} else if (val == 3 || val == 4) {
this.contentOption = [...this.contentOption1]
this.isTagContent = true
} else {
this.isTagContent = false
}
if (val == 7) {
this.isSearch = false
this.form.isQuery = 0
} else {
this.isSearch = true
}
if (val == 1 || val == 8 || val == 9 || val == 10 || val == 11 || val == 'sel_user') {
this.isLength = true
} else {
this.isLength = false
}
this.initFlags(val)
}
},
methods: {
@@ -271,6 +251,23 @@ export default {
this.$refs.editForm.validate((valid) => {
console.log('---err-----', valid)
if (valid) {
this.confirmLoading = true
const formData = Object.assign({}, this.form)
let Func = addTag
if (this.isEdit) {
Func = editTag
}
Func(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.onClose()
} else {
this.$message.error(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
}
})
},
@@ -296,26 +293,59 @@ export default {
callback()
}
},
// 初始化所有判断的值
// 具体值对应关系可以去commonEnums.js中查看 FieldType
initFlags (val) {
val = val + ''
// this.contentFlag=val
// 树形结构
if (val === FieldType.TREE.value) {
this.contentOption = [...this.contentOptionTree]
this.isTagContent = true
} else if (val === FieldType.OPTION_SINGLE.value || val === FieldType.OPTION_MORE.value) {
// 下拉单选 下拉多选
this.contentOption = [...this.contentOptionSelect]
this.isTagContent = true
} else {
this.isTagContent = false
}
// 上传文件
if (val === FieldType.FILE_UP.value) {
this.isSearch = false
this.form.isQuery = 0
} else {
this.isSearch = true
}
// 输入框(字符串) 文本框 人员选择 标准选择 输入框(链接)
if (val === FieldType.TEXT_LINK.value || val === FieldType.TEXT_BOX.value || val === FieldType.USER_SINGLE.value || val === FieldType.STANDARD_MORE.value || val === FieldType.TEXT_LINK.value || val === 'sel_user') {
this.isLength = true
} else {
this.isLength = false
}
},
// 获取选项内容
loadContent () {
const params = {}
queryDictName(params).then((res) => {
if (res.success) {
const data = [...res.result]
this.contentOption1 = []
this.contentOption2 = []
this.contentOptionSelect = []
this.contentOptionTree = []
data.map(res => {
if (res.attributeType == '1') {
this.contentOption1.push(res)
} else if (res.attributeType == '2') {
this.contentOption2.push(res)
const num = Number(res.attributeType)
if (num === TagsAttributeTypeEnums.SELECT.value) {
this.contentOptionSelect.push(res)
} else if (num === TagsAttributeTypeEnums.TREE.value) {
this.contentOptionTree.push(res)
}
})
if (this.form.fieldShowType == 0) {
this.contentOption = [...this.contentOption2]
// 树形结构
if (this.form.fieldShowType === FieldType.TREE.value) {
this.contentOption = [...this.contentOptionTree]
this.isTagContent = true
} else if (this.form.fieldShowType == 3 || this.form.fieldShowType == '4') {
this.contentOption = [...this.contentOption1]
} else if (this.form.fieldShowType === FieldType.OPTION_SINGLE.value || this.form.fieldShowType === FieldType.OPTION_MORE.value) {
// 下拉单选 下拉多选
this.contentOption = [...this.contentOptionSelect]
this.isTagContent = true
} else {
this.isTagContent = false
@@ -178,7 +178,7 @@
import { addTag, editTag, getShowAreaData, queryDictName } from '../../../../api/api'
import JDictSelectTag from '../../../../components/dict/JDictSelectTag'
import { TagsTypeEnums } from '../../../../enums/commonEnums'
import { FieldType, TagsAttributeTypeEnums, TagsTypeEnums } from '../../../../enums/commonEnums'
export default {
name: 'StandardDrawer',
@@ -293,36 +293,14 @@ export default {
areaOptions: [],
// 选项内容选项
contentOption: [],
contentOption1: [],
contentOption2: [],
contentOptionSelect: [],
contentOptionTree: [],
moduleArr: TagsTypeEnums.getItemList()
}
},
watch: {
// 具体值对应关系可以去commonEnums.js中查看 FieldType
'form.fieldShowType' (val) {
val = val + ''
// this.contentFlag=val
if (val === '0') {
this.contentOption = [...this.contentOption2]
this.isTagContent = true
} else if (val === '3' || val === '4') {
this.contentOption = [...this.contentOption1]
this.isTagContent = true
} else {
this.isTagContent = false
}
if (val === '7') {
this.isSearch = false
this.form.isQuery = 0
} else {
this.isSearch = true
}
if (val === '1' || val === '8' || val === '9' || val === '10' || val === '11' || val === 'sel_user') {
this.isLength = true
} else {
this.isLength = false
}
this.initFlags(val)
}
},
methods: {
@@ -344,7 +322,7 @@ export default {
this.visible = true
},
// 初始化一些数据
initData () {
async initData () {
this.getShowAreaData()
this.loadContent()
},
@@ -408,26 +386,59 @@ export default {
}
})
},
// 初始化所有判断的值
// 具体值对应关系可以去commonEnums.js中查看 FieldType
initFlags (val) {
val = val + ''
// this.contentFlag=val
// 树形结构
if (val === FieldType.TREE.value) {
this.contentOption = [...this.contentOptionTree]
this.isTagContent = true
} else if (val === FieldType.OPTION_SINGLE.value || val === FieldType.OPTION_MORE.value) {
// 下拉单选 下拉多选
this.contentOption = [...this.contentOptionSelect]
this.isTagContent = true
} else {
this.isTagContent = false
}
// 上传文件
if (val === FieldType.FILE_UP.value) {
this.isSearch = false
this.form.isQuery = 0
} else {
this.isSearch = true
}
// 输入框(字符串) 文本框 人员选择 标准选择 输入框(链接)
if (val === FieldType.TEXT_LINK.value || val === FieldType.TEXT_BOX.value || val === FieldType.USER_SINGLE.value || val === FieldType.STANDARD_MORE.value || val === FieldType.TEXT_LINK.value || val === 'sel_user') {
this.isLength = true
} else {
this.isLength = false
}
},
// 获取选项内容
loadContent () {
const params = {}
queryDictName(params).then((res) => {
if (res.success) {
const data = [...res.result]
this.contentOption1 = []
this.contentOption2 = []
this.contentOptionSelect = []
this.contentOptionTree = []
data.map(res => {
if (res.attributeType == '1') {
this.contentOption1.push(res)
} else if (res.attributeType == '2') {
this.contentOption2.push(res)
const num = Number(res.attributeType)
if (num === TagsAttributeTypeEnums.SELECT.value) {
this.contentOptionSelect.push(res)
} else if (num === TagsAttributeTypeEnums.TREE.value) {
this.contentOptionTree.push(res)
}
})
if (this.form.fieldShowType == 0) {
this.contentOption = [...this.contentOption2]
// 树形结构
if (this.form.fieldShowType === FieldType.TREE.value) {
this.contentOption = [...this.contentOptionTree]
this.isTagContent = true
} else if (this.form.fieldShowType == 3 || this.form.fieldShowType == '4') {
this.contentOption = [...this.contentOption1]
} else if (this.form.fieldShowType === FieldType.OPTION_SINGLE.value || this.form.fieldShowType === FieldType.OPTION_MORE.value) {
// 下拉单选 下拉多选
this.contentOption = [...this.contentOptionSelect]
this.isTagContent = true
} else {
this.isTagContent = false
@@ -110,11 +110,7 @@ export default {
]
},
// 父级项目下拉框数据的集合
parentDataPid: [],
treeFunc: {
add: 'sys/category/add',
edit: 'sys/category/edit',
}
parentDataPid: []
}
},
methods: {
@@ -126,6 +122,10 @@ export default {
edit (record) {
if (record.id) {
this.dictId = record.dictId
// 一级菜单则将父级的默认值0 删除
if (record.parentId === '0') {
record.parentId = undefined
}
}
this.status = record.status
this.visibleCheck = (record.status === 1)
@@ -31,11 +31,11 @@
</a-form>
</div>
<div class="table-operator">
<div class="operator-text" @click="handleAdd">
<div class="operator-text" @click="handleAdd" v-has="'sys:dict:operation'">
<a-icon type="plus" />
{{ $t('newlyAdded') }}
</div>
<div class="operator-text" @click="batchDel">
<div class="operator-text" @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)">{{ $t('edit') }}</a>
<a class="table-del" @click="handleDelete(record.id)">{{ $t('delete') }}</a>
<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>
</div>
</j-table>
</div>
@@ -144,6 +144,11 @@ export default {
}
],
columns: [],
/* 排序参数--按照排序字段失序 */
isorter: {
column: 'sortOrder',
order: 'ascend'
},
// 树形结构对应的接口
treeUrl: {
list: 'sys/dictItem/treeList',
@@ -26,6 +26,15 @@
<j-dict-select-tag type="list" v-model="model.attributeType" dictCode="attribute_type"
:placeholder="$t('pleaseSelect') + $t('system.tag.labelType')"/>
</a-form-model-item>
<!--字典编码 ---是因为后端会报错增加的但是需求设计中没有这个字段 -->
<a-form-model-item prop="dictCode" :label="$t('dict.dictionaryNumber')">
<a-input
:maxLength="50"
:placeholder="$t('pleaseEnter') + $t('dict.dictionaryNumber')"
v-model="model.dictCode"
@change="event => event.target.value = event.target.value.trim()"
/>
</a-form-model-item>
<!--展示顺序-->
<a-form-model-item :label="$t('system.tag.displayOrder')" prop="orderNum" class="tag-item">
<a-input-number v-model="model.orderNum" :placeholder="$t('pleaseEnter') + $t('system.tag.displayOrder')" style="width: 100%"
@@ -49,7 +58,7 @@
<script>
import JDictSelectTag from '../../../../components/dict/JDictSelectTag'
import { addDict, editDict } from '../../../../api/api'
import { addDict, duplicateCheck, editDict } from '../../../../api/api'
export default {
name: 'TagContentModal',
@@ -80,6 +89,10 @@ export default {
attributeType: [
{ required: true, message: this.$t('pleaseSelect') + this.$t('system.tag.labelType'), trigger: 'blur' }
],
// 字典编码
dictCode: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('dict.dictionaryNumber') },
{ validator: this.validateDictCode }],
// 展示顺序
orderNum: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('system.tag.displayOrder'), trigger: 'blur' }
@@ -152,6 +165,22 @@ export default {
} else {
return 0
}
},
validateDictCode (rule, value, callback) {
// 重复校验
const params = {
tableName: 'sys_dict',
fieldName: 'dict_code',
fieldVal: value,
dataId: this.model.id
}
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback(res.message)
}
})
}
}
}
@@ -4,7 +4,7 @@
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<a-col :span="8">
<a-form-item :label="$t('system.tag.attributeName')" :labelCol="{span: 5}"
:wrapperCol="{span: 18, offset: 1}">
<j-input :placeholder="$t('pleaseEnter') + $t('system.tag.attributeName')"
+3 -2
View File
@@ -4,14 +4,14 @@
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<a-col :span="8">
<a-form-item :label="$t('system.tag.attributeName')" :labelCol="{span: 5}"
:wrapperCol="{span: 18, offset: 1}">
<j-input :placeholder="$t('pleaseEnter') + $t('system.tag.attributeName')"
v-model="queryParam.dbFieldTxt"></j-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-col :span="8">
<a-form-item :label="$t('system.tag.showArea')" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
<a-select class="box-input" v-model="queryParam.showArea"
:placeholder="$t('pleaseSelect') + $t('system.tag.showArea')">
@@ -149,6 +149,7 @@ export default {
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
fixed: 'right',
width: 150
}
]
+7 -8
View File
@@ -3,20 +3,20 @@
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<a-col :span="8">
<a-form-item :label="$t('system.tag.labelName')" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
<j-input :placeholder="$t('pleaseEnter') + $t('system.tag.labelName')"
v-model="queryParam.dictName"></j-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-col :span="8">
<a-form-item :label="$t('system.tag.labelType')" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
<j-dict-select-tag type="list" v-model="queryParam.attributeType" dictCode="attribute_type"
:placeholder="$t('pleaseSelect') + $t('system.tag.labelType')" />
</a-form-item>
</a-col>
<div style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-col :span="8">
<a-button class="box-button" @click="searchReset">{{ $t('reset') }}</a-button>
<a-button class="box-button" style="margin-left: 8px" type="primary" @click="searchQuery">
{{ $t('query') }}
@@ -28,12 +28,12 @@
</div>
<div class="table-operator">
<!--v-has="'dict:add'"-->
<div class="operator-text" @click="handleAdd">
<div class="operator-text" @click="handleAdd" v-has="'sys:dict:operation'">
<a-icon type="plus" />
{{ $t('newlyAdded') }}
</div>
<!--v-has="'dict:logicDeleteBatch'"-->
<div class="operator-text" @click="batchDel">
<div class="operator-text" @click="batchDel" v-has="'sys:dict:operation'">
<a-icon type="delete" />
{{ $t('batchDelete') }}
</div>
@@ -53,9 +53,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" @click="handleEdit(record)">{{ $t('edit') }}</a>
<a class="action-delete" href="javascript:;" @click="handleDelete(record.id)"
>{{ $t('delete') }}</a>
<a class="action-edit" @click="handleEdit(record)" v-has="'sys:dict:operation'">{{ $t('edit') }}</a>
<a class="action-delete" @click="handleDelete(record.id)" v-has="'sys:dict:operation'">{{ $t('delete') }}</a>
</div>
</j-table>