fix: 组织管理查询功能

This commit is contained in:
fit2cloud-chenyw 2021-05-19 17:50:10 +08:00
parent d6f799aea2
commit 1bf8fe5dff

View File

@ -93,7 +93,7 @@
import LayoutContent from '@/components/business/LayoutContent' import LayoutContent from '@/components/business/LayoutContent'
import TreeTable from '@/components/business/tree-table' import TreeTable from '@/components/business/tree-table'
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import { formatCondition } from '@/utils/index' import { formatCondition, formatQuickCondition } from '@/utils/index'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect' import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect'
import { checkPermission } from '@/utils/permission' import { checkPermission } from '@/utils/permission'
@ -149,10 +149,9 @@ export default {
], ],
searchConfig: { searchConfig: {
useQuickSearch: true, useQuickSearch: true,
useComplexSearch: false,
quickPlaceholder: '按名称搜索', quickPlaceholder: '按名称搜索',
components: [ components: [
{ field: 'name', label: this.$t('organization.name'), component: 'FuComplexInput' }
] ]
}, },
@ -260,17 +259,18 @@ export default {
}, },
// //
search(condition) { search(condition) {
// this.setTableAttr() condition = formatQuickCondition(condition, 'name')
let conditionExist = false
const temp = formatCondition(condition)
this.tableData = [] this.tableData = []
let param = {} let param = {}
if (condition && condition.quick) { if (temp && temp.conditions && temp.conditions.length !== 0) {
const con = this.quick_condition(condition) conditionExist = true
param = formatCondition(con) param = temp
} else { } else {
param = { conditions: [this.defaultCondition] } param = { conditions: [this.defaultCondition] }
} }
// param.conditions.push(this.defaultCondition)
loadTable(param).then(res => { loadTable(param).then(res => {
let data = res.data let data = res.data
data = data.map(obj => { data = data.map(obj => {
@ -280,11 +280,15 @@ export default {
return obj return obj
}) })
if (condition && condition.quick) { if (conditionExist) {
data = this.buildTree(data) data = this.buildTree(data)
// this.setTableAttr(true)
} }
this.tableData = data this.tableData = data
this.$nextTick(() => {
this.tableData.forEach(node => {
this.$refs.table.toggleRowExpansion(node, conditionExist)
})
})
this.depts = null this.depts = null
}) })
}, },