Commit fb617dc4 by 胡悦

tijiao

1 parent 5fe48c71
<template> <template>
<div class="default businessGD"> <div class="default businessGD" style="overflow-y: auto;" :style="{height: parseInt(this.$client_height() - 14) + 'px'}">
<div class="m-b10"> <div class="m-b10">
<gl-button <gl-button
class="newButton" class="newButton"
...@@ -13,21 +13,18 @@ ...@@ -13,21 +13,18 @@
>添加商户</gl-button> >添加商户</gl-button>
</div> </div>
<div> <div>
<div class="merchantTable">
<gl-table <gl-table
style="width: 808px;display: inline-block;"
class="m-b10" class="m-b10"
:table="tableData" :table="tableData"
v-loading="tableLoading" v-loading="tableLoading">
>
<gl-table-column <gl-table-column
align="center" align="center"
v-for="(i, index) in tableData.column" v-for="(i, index) in tableData.column"
:key="index" :key="index"
:label='i.label' :label='i.label'
:prop='i.prop' :prop='i.prop'
:width='i.width' :width='i.width'>
>
<template slot-scope="scope"> <template slot-scope="scope">
<template v-if='i.prop === "merchantName"'> <template v-if='i.prop === "merchantName"'>
<a <a
...@@ -47,13 +44,25 @@ ...@@ -47,13 +44,25 @@
</template> </template>
</gl-table-column> </gl-table-column>
</gl-table> </gl-table>
<div style="width: 350px;display: inline-block;height: 500px;overflow-y: auto;"> <gl-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNum"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
layout="total, sizes, ->, prev, pager, next, jumper"
:total="total">
</gl-pagination>
</div>
<div style="width: 350px;display: inline-block;">
<!-- <gl-form-item label="商户:" prop="merchantId"> --> <!-- <gl-form-item label="商户:" prop="merchantId"> -->
<gl-input <!-- <gl-input
v-model="searchResult.merchantName" v-model="searchResult.merchantName"
placeholder="请输入内容" placeholder="请输入内容"
></gl-input> ></gl-input> -->
<!-- <gl-select <gl-select
v-model="searchResult.merchantName" v-model="searchResult.merchantName"
filterable filterable
remote remote
...@@ -71,7 +80,7 @@ ...@@ -71,7 +80,7 @@
:label="item.merchantName" :label="item.merchantName"
:value="item.merchantId"> :value="item.merchantId">
</gl-option> </gl-option>
</gl-select> --> </gl-select>
<gl-button <gl-button
class="newButton" class="newButton"
type="primary" type="primary"
...@@ -82,25 +91,15 @@ ...@@ -82,25 +91,15 @@
<!-- <gl-input v-model="searchTree" placeholder="请输入内容"></gl-input> --> <!-- <gl-input v-model="searchTree" placeholder="请输入内容"></gl-input> -->
<gl-tree <gl-tree
:style="{height: parseInt(this.$client_height() - 140) + 'px'}" :style="{height: parseInt(this.$client_height() - 140) + 'px'}"
style="overflow-x: auto" style="overflow-y: auto;position: relative;"
:data="dataTree" :data="dataTree"
:props="defaultProps" :props="defaultProps"
:render-content="renderContent"
node-key='merchantId' node-key='merchantId'
ref="tree" ref="tree"
></gl-tree> ></gl-tree>
</div> </div>
<gl-pagination
style="width: 808px;"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNum"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
layout="total, sizes, ->, prev, pager, next, jumper"
:total="total"
>
</gl-pagination>
</div> </div>
<gl-dialog <gl-dialog
title="高级搜索" title="高级搜索"
...@@ -234,10 +233,10 @@ ...@@ -234,10 +233,10 @@
> >
</gl-option> </gl-option>
</gl-select> </gl-select>
<span <!-- <span
v-show="errorBags.has('merchantId')" v-show="errorBags.has('merchantId')"
class="error" class="error"
>{{ errorBags.first('merchantId') }}</span> >{{ errorBags.first('merchantId') }}</span> -->
</gl-form-item> </gl-form-item>
</gl-form> </gl-form>
<div <div
...@@ -395,7 +394,8 @@ export default { ...@@ -395,7 +394,8 @@ export default {
loading: false, loading: false,
searchResult: {}, // 搜索结果的对象 searchResult: {}, // 搜索结果的对象
allTree: [], allTree: [],
target: [] target: [],
lastSearch: ''
} }
}, },
created() { created() {
...@@ -419,6 +419,7 @@ export default { ...@@ -419,6 +419,7 @@ export default {
this.eventBus = this.$root.eventBus this.eventBus = this.$root.eventBus
// gettree // gettree
const params = {} const params = {}
// params.groupId = this.groupId
params.method = groupDetailMethods.GetTree params.method = groupDetailMethods.GetTree
request.req(params).then(res => { request.req(params).then(res => {
console.log(res) console.log(res)
...@@ -577,58 +578,81 @@ export default { ...@@ -577,58 +578,81 @@ export default {
}, },
// 查询 // 查询
searchMerchant() { searchMerchant() {
this.searchResult.merchantId = 205 console.log(this.lastSearch.style ? this.lastSearch.style.backgroundColor : null)
// console.log(this.$refs.tree.$children[0]) this.lastSearch.style ? this.lastSearch.style.backgroundColor = '#ffffff' : null
console.log(this.lastSearch)
this.searchResult.merchantId = 11221 + Math.round(Math.random() * 100 + 10)
console.log(this.searchResult.merchantId)
console.log(this.$refs.tree.$children[0])
// console.log(this.$refs.tree.$children[0].store._getAllNodes()) // console.log(this.$refs.tree.$children[0].store._getAllNodes())
// console.log(this.$refs.tree.$children[0].$el.childNodes[0].__vue__.getNodeKey(this.$refs.tree.$children[0].store._getAllNodes()[1])) // console.log(this.$refs.tree.$children[0].$el.childNodes[0].__vue__.getNodeKey(this.$refs.tree.$children[0].store._getAllNodes()[1]))
this.allTree = this.$refs.tree.$children[0].store._getAllNodes() this.allTree = this.$refs.tree.$children[0].store._getAllNodes()
let result = '' let result = ''
console.log(this.allTree)
this.allTree.forEach(element => { this.allTree.forEach(element => {
if (element.key === this.searchResult.merchantId) { if (element.key === this.searchResult.merchantId) {
// console.log(element) // console.log(element)
result = element result = element
} }
}) })
console.log(result.key)
this.searchChildren(this.$refs.tree.$children[0].store._getAllNodes(), result.key) this.searchChildren(this.$refs.tree.$children[0].store._getAllNodes(), result.key)
const rootList = this.$refs.tree.$children[0].$children const rootList = this.$refs.tree.$children[0].$children
// const sencondList = [] // console.log(rootList)
console.log(rootList) // console.log(this.target)
console.log(this.target) this.cycle(rootList, this.target[0])
rootList.forEach(i => { // rootList.forEach(i => {
if (i.node.key === this.target[0].key) { // if (i.node.key === this.target[0].key) {
console.log(i.$children) // this.$nextTick(() => {
// sencondList = i.$children // i.$children.forEach(j => {
i.$children.forEach(j => {
console.log(j)
// if (j.node.key === this.target[1].key) { // if (j.node.key === this.target[1].key) {
// console.log(j) // j.$children.forEach(n => {
// if (n.node.key === this.target[2].key) {
// this.$nextTick(() => {
// console.log(n, n.$el.offsetTop)
// this.$refs.tree.$el.scrollTop = n.$el.offsetTop - n.$el.offsetHeight
// n.$el.style.background = '#f5f7fa'
// })
// } // }
}) // })
// for (const j in sencondList) { // }
// })
// })
// } // }
// })
},
cycle(arr, target) {
this.$nextTick(() => {
arr.forEach(i => {
if (i.node.key === target.key && target.level === this.target.length) {
const top = i.$el.offsetTop
this.$nextTick(() => {
setTimeout(() => {
this.$set(this.$refs.tree.$el, 'scrollTop', top - i.$el.offsetHeight / 2)
// #f5f7fa
i.$el.children[0].style['background-color'] = '#eee'
console.log(i.$el.children[0])
this.lastSearch = i.$el.children[0]
// console.log(i.node)
// this.$refs.tree.$children[0].store.setCurrentNode(i.node)
// console.log(this.$refs.tree.$children[0].store.getCurrentNode())
}, 200)
})
} else if (i.node.key === target.key) {
this.cycle(i.$children, this.target[target.level])
} }
}) })
// for (const i in rootList) { })
// if (rootList[i].node.key === this.target[0].key) {
// console.log(rootList[i])
// const sencondList = rootList[i].$children
// // for (const j in sencondList) {
// // }
// // console.log(typeof (sencondList))
// }
// if (rootList[i].children && rootList[i].children[1]) {
// console.log(rootList[i].children[1])
// }
// {if (rootList[i].children && rootList[i].children.length === 2) {
// console.log(rootList[i])
// }}
// }
}, },
searchChildren(data, id) { searchChildren(data, id) {
data.forEach(el => { data.forEach(el => {
// console.log(el.store.getCurrentNode())
if (el.key === id) { if (el.key === id) {
this.$set(el, 'expanded', true) this.$set(el, 'expanded', true)
this.searchParent(el) this.searchParent(el)
} else {
this.$set(el, 'expanded', false)
} }
}) })
}, },
...@@ -640,6 +664,14 @@ export default { ...@@ -640,6 +664,14 @@ export default {
} else { } else {
this.target[0] = e this.target[0] = e
} }
},
renderContent(h, { node, data, store }) {
return (
<span class='custom-tree-node'>
<span>{node.label}</span>
<span style='padding: 0 5px;'>-</span>
<span>{node.data.merchantTypeName}</span>
</span>)
} }
} }
} }
...@@ -653,10 +685,19 @@ export default { ...@@ -653,10 +685,19 @@ export default {
} }
} }
} }
.businessGD a { .businessGD {
a {
/* color: #0000FF; */ /* color: #0000FF; */
text-decoration: underline; text-decoration: underline;
}
.merchantTable {
width: 800px;
float: left;
margin-right: 20px
}
} }
// .tableImg{ // .tableImg{
// width: 36px; // width: 36px;
// height: 36px; // height: 36px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!