Commit cc98787f by cwq0219

bug修复

1 parent e363e191
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
ref="popover" ref="popover"
placement="bottom-start" placement="bottom-start"
trigger="click" trigger="click"
v-model="popoverVisible"
:disabled="targetItem.isDisabled" :disabled="targetItem.isDisabled"
@show="onShowPopover" @show="onShowPopover"
@hide="onHidePopover" @hide="onHidePopover"
...@@ -15,6 +16,7 @@ ...@@ -15,6 +16,7 @@
highlight-current highlight-current
default-expand-all default-expand-all
node-key="id" node-key="id"
:expand-on-click-node="isExpand"
:style="`min-width: ${treeWidth}`" :style="`min-width: ${treeWidth}`"
:data="treeData" :data="treeData"
:current-node-key="form[targetItem.name]" :current-node-key="form[targetItem.name]"
...@@ -29,7 +31,7 @@ ...@@ -29,7 +31,7 @@
clearable clearable
:disabled="targetItem.isDisabled" :disabled="targetItem.isDisabled"
:style="`width: ${width}px`" :style="`width: ${width}px`"
:class="{ 'rotate': showStatus }" :class="{ 'rotate': popoverVisible }"
suffix-icon="el-icon-arrow-down" suffix-icon="el-icon-arrow-down"
:placeholder="'请选择' + targetItem.label" :placeholder="'请选择' + targetItem.label"
@change="handleClear" @change="handleClear"
...@@ -44,8 +46,9 @@ export default { ...@@ -44,8 +46,9 @@ export default {
name: 'SelectTree', name: 'SelectTree',
data() { data() {
return { return {
isExpand: false,
// 树状菜单显示状态 // 树状菜单显示状态
showStatus: false, popoverVisible: false,
treeWidth: 'auto' treeWidth: 'auto'
} }
}, },
...@@ -108,12 +111,12 @@ export default { ...@@ -108,12 +111,12 @@ export default {
methods: { methods: {
// 显示时触发 // 显示时触发
onShowPopover() { onShowPopover() {
this.showStatus = true this.popoverVisible = true
this.$refs.tree.filter(false) this.$refs.tree.filter(false)
}, },
// 隐藏时触发 // 隐藏时触发
onHidePopover() { onHidePopover() {
this.showStatus = false this.popoverVisible = false
}, },
// 树节点过滤方法 // 树节点过滤方法
handleFilterNode(query, data) { handleFilterNode(query, data) {
...@@ -122,9 +125,11 @@ export default { ...@@ -122,9 +125,11 @@ export default {
}, },
handleNodeClick(val) { handleNodeClick(val) {
this.$emit('selected', { val: val, targetItem: this.targetItem, formName: this.targetItem.formName }) this.$emit('selected', { val: val, targetItem: this.targetItem, formName: this.targetItem.formName })
this.onHidePopover()
}, },
handleClear(val) { handleClear(val) {
this.$emit('selected', { val: val, targetItem: this.targetItem, formName: this.targetItem.formName }) this.$emit('selected', { val: val, targetItem: this.targetItem, formName: this.targetItem.formName })
window.event.stopPropagation()
}, },
// 搜索树状数据中的 ID // 搜索树状数据中的 ID
queryTree(tree, id) { queryTree(tree, id) {
......
...@@ -127,7 +127,6 @@ export default { ...@@ -127,7 +127,6 @@ export default {
searchForm: { searchForm: {
functionName: '', functionName: '',
merchantName: '', merchantName: '',
ownCus: 1,
menuIds: '', menuIds: '',
menuName: '', menuName: '',
ownedCusgroupType: '', ownedCusgroupType: '',
...@@ -148,23 +147,29 @@ export default { ...@@ -148,23 +147,29 @@ export default {
label: '产品', label: '产品',
name: 'productId', name: 'productId',
type: 'select', type: 'select',
multiple: true, // multiple: true,
optionList: [], optionList: [],
optionId: 'dictValue', optionId: 'dictValue',
optionLabel: 'dictLabel', optionLabel: 'dictLabel',
optionsName: 'productList', optionsName: 'productList',
changeAttr: (value, targetItem) => { changeAttr: (value, targetItem) => {
if (value.includes('')) { this.searchForm.menuIds = ''
this.searchForm[targetItem.name] = !this.oldVal[targetItem.name].includes('') ? targetItem.optionList.map(item => item[targetItem.optionId]) : this.searchForm[targetItem.name].filter(item => item !== '') this.searchForm.parentName = ''
} else { value && baseApi.getMenuTree({ productId: value }).then(res => {
if (this.oldVal[targetItem.name].includes('')) { this.baseData.searchMenuTreeList = res.data
this.searchForm[targetItem.name] = [] this.getOptionsList('searchFormData')
} else if (value.length === (targetItem.optionList.length - 1)) { })
this.searchForm[targetItem.name].push('') // if (value.includes('')) {
} // this.searchForm[targetItem.name] = !this.oldVal[targetItem.name].includes('') ? targetItem.optionList.map(item => item[targetItem.optionId]) : this.searchForm[targetItem.name].filter(item => item !== '')
} // } else {
this.oldVal[targetItem.name] = this.searchForm[targetItem.name] // if (this.oldVal[targetItem.name].includes('')) {
this.tableSearchForm[targetItem.name] = this.searchForm[targetItem.name].includes('') ? [] : this.searchForm[targetItem.name] // this.searchForm[targetItem.name] = []
// } else if (value.length === (targetItem.optionList.length - 1)) {
// this.searchForm[targetItem.name].push('')
// }
// }
// this.oldVal[targetItem.name] = this.searchForm[targetItem.name]
// this.tableSearchForm[targetItem.name] = this.searchForm[targetItem.name].includes('') ? [] : this.searchForm[targetItem.name]
} }
}, { }, {
label: '菜单', label: '菜单',
...@@ -227,8 +232,8 @@ export default { ...@@ -227,8 +232,8 @@ export default {
label: '所属客户群体', label: '所属客户群体',
prop: 'ownedGroupName' prop: 'ownedGroupName'
}, { }, {
label: '创建时间', label: '更新时间',
prop: 'createdTime' prop: 'updatedTime'
}] }]
}, },
// 弹窗 // 弹窗
...@@ -402,9 +407,9 @@ export default { ...@@ -402,9 +407,9 @@ export default {
}, },
mounted() { mounted() {
baseApi.getMenuTree().then(res => { // baseApi.getMenuTree().then(res => {
this.baseData.searchMenuTreeList = res.data // this.baseData.searchMenuTreeList = res.data
}) // })
this.getBaseData().then(res => { this.getBaseData().then(res => {
this.getOptionsList('searchFormData') this.getOptionsList('searchFormData')
this.getOptionsList('editFormData', false) this.getOptionsList('editFormData', false)
...@@ -462,7 +467,7 @@ export default { ...@@ -462,7 +467,7 @@ export default {
}, },
getParams() { getParams() {
var params = _.cloneDeep(this.searchForm) var params = _.cloneDeep(this.searchForm)
params.productId.includes('') && (params.productId = []) // params.productId.includes('') && (params.productId = [])
const tempParams = this.getSelectInputParams() const tempParams = this.getSelectInputParams()
params = { params = {
...params, ...params,
......
...@@ -183,7 +183,7 @@ export default { ...@@ -183,7 +183,7 @@ export default {
prop: 'productName' prop: 'productName'
}, { }, {
label: '更新时间', label: '更新时间',
prop: 'createdTime' prop: 'updatedTime'
}] }]
}, },
// 弹窗 // 弹窗
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!