【update】优化

This commit is contained in:
fengchenchen
2023-08-25 09:18:25 +08:00
parent 732897a665
commit d7f1560572
3 changed files with 32 additions and 41 deletions
+3
View File
@@ -62,6 +62,8 @@ const treeList = (params) => getAction('/sys/dict/treeList', params)
const queryDictName = (params) => getAction('/sys/dict/queryDictName', params)
const addDictItem = (params) => postAction('/sys/dictItem/add', params)
const editDictItem = (params) => postAction('/sys/dictItem/edit', params)
// 获得数据字典的树形格式数据
const getDictTreeList = (params) => getAction('/sys/dictItem/treeList', params)
// 字典标签专用(通过code获取字典数组)
export const ajaxGetDictItems = (code, params) => getAction(`/sys/dict/getDictItems/${code}`, params)
@@ -153,6 +155,7 @@ export {
queryDictName,
addDictItem,
editDictItem,
getDictTreeList,
doReleaseData,
doReovkeData,
getLoginfo,
@@ -30,13 +30,18 @@
@change="event => event.target.value = event.target.value.trim()"
/>
</a-form-model-item>
<!--父级名称 只有树形结构时显示-->
<a-form-model-item :label="$t('system.tag.parentName')" prop="pid" v-if="attributeType === TagsAttributeTypeEnums.TREE.value">
<a-select v-model="model.pid" :placeholder="$t('pleaseSelect')" allowClear>
<a-select-option :value="item.id" v-for="(item, index) in parentDataPid" :key="item.id">
{{item.name}}
</a-select-option>
</a-select>
<!--父级名称 只有树形结构时显示 TODO 中英文的限制需要做显示的判断-->
<a-form-model-item :label="$t('system.tag.parentName')" prop="parentId" v-if="attributeType === TagsAttributeTypeEnums.TREE.value">
<a-tree-select
style="width:100%"
:dropdownStyle="{ maxHeight: '200px', overflow: 'auto' }"
:treeData="parentDataPid"
:replaceFields="{children:'children', title: 'name', key:'id', value: 'id' }"
v-model="model.parentId"
:placeholder="$t('pleaseSelect')"
allowClear
>
</a-tree-select>
</a-form-model-item>
<!--数据值-->
<a-form-model-item prop="itemValue" :label="$t('system.tag.dataValue')">
@@ -63,7 +68,7 @@
<script>
import { TagsAttributeTypeEnums } from '../../../../enums/commonEnums'
import { addDictItem, editDictItem, addCategoryItem, editCategoryItem } from '../../../../api/api'
import { addDictItem, editDictItem, getDictTreeList } from '../../../../api/api'
import { getAction } from '../../../../api/manage'
export default {
@@ -145,7 +150,6 @@ export default {
// 确定
handleOk () {
const that = this
console.log(1111)
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
@@ -153,21 +157,11 @@ export default {
// 启用、禁用的标识
that.model.status = that.status
let obj
// 树形结构
if (this.attributeType === TagsAttributeTypeEnums.TREE.value) {
if (!this.model.id) {
obj = addCategoryItem
} else {
obj = editCategoryItem
}
// 数据字典
if (!this.model.id) {
obj = addDictItem
} else {
// 数据字典
if (!this.model.id) {
obj = addDictItem
} else {
obj = editDictItem
}
obj = editDictItem
}
const params = Object.assign({}, this.model, {
dictId: this.dictId, // 数据字典的id
@@ -225,12 +219,15 @@ export default {
}
},
getAllTree () {
// TODO 获取所有的树形结构
getAction(`sys/dictItem/treeList`, {
sysDictId: this.dictId,
// 获取所有的树形结构
const params = {
dictId: this.dictId,
isTagDict: 1
}).then(res => {
this.parentDataPid = res.result
}
getDictTreeList(params).then(res => {
if (res.success) {
this.parentDataPid = res.result || []
}
})
}
}
@@ -50,7 +50,7 @@
:components="drag(columns,'columns')"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:pagination="attributeType === TagsAttributeTypeEnums.TREE.value ? false : ipagination"
:loading="loading"
:scroll="{x: '100%'}"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@@ -153,8 +153,8 @@ export default {
// 树形结构对应的接口
treeUrl: {
list: 'sys/dictItem/treeList',
delete: 'sys/category/delete',
deleteBatch: 'sys/category/deleteBatch'
delete: 'sys/dictItem/delete',
deleteBatch: 'sys/dictItem/deleteBatch'
},
dictUrl: {
list: 'sys/dictItem/page',
@@ -162,16 +162,7 @@ export default {
deleteBatch: '/sys/dictItem/deleteBatch'
},
// 混入中查询等相关接口
url: {
list: 'sys/dictItem/page',
// 数据字典的相关接口
delete: '/sys/dictItem/delete',
deleteBatch: '/sys/dictItem/deleteBatch'
// delete: 'sys/dictItem/logicDelete', // TODO weilai
// deleteBatch: 'sys/dictItem/logicDeleteBatch', // TODO weilai
// deleteBatch: 'sys/category/logicDeleteBatch', // TODO weilai 树形结构的
},
url: {},
// // 其他的查询条件
filters: {
dictId: '' // 列表页数据字典的值