Commit dab08b87 by 胡悦

gegnx

1 parent b2ffe876
......@@ -6,7 +6,8 @@ const methods = {
MerchantType: `${path}dict.type`,
SearchChildList: `${path}group.search.param`, // 子商户根据商户号或者商户名搜索商户列表
SearchList: `${path}group.search.parampar`, // 父商户根据商户号或者商户名搜索商户列表
GetTree: `${path}tree`,
GetTree: `${path}group.merchant.tree`,
GroupSearchMerchant: `${path}group.search.merchant`,
MerchantModify: `${path}modify`,
MerchantEnable: `${path2}enable.merchant`,
MerchantDisable: `${path2}disable.merchant`
......
......@@ -22,9 +22,9 @@ const request = {
params.timestamp = new Date().getTime()
params.v = '1.0.0'
params.format = 'json'
const url = process.env.NODE_ENV === 'production' ? 'router' : params.method
return GlAxios.get(url, { 'params': sign(params) })
// return GlAxios.get('router', { 'params': sign(params) })
// const url = process.env.NODE_ENV === 'production' ? 'router' : params.method
// return GlAxios.get(url, { 'params': sign(params) })
return GlAxios.get('router', { 'params': sign(params) })
}
}
export {
......
......@@ -63,19 +63,15 @@
placeholder="请输入内容"
></gl-input> -->
<gl-select
v-model="searchResult.merchantName"
v-model="searchResult.merchantId"
filterable
remote
clearable
name="merchantId"
placeholder="请输入商户名称/商户号"
data-vv-as="商户名称/商户号"
v-validate="'required'"
@change="changeMerchant"
:remote-method="remoteList"
:loading="loading">
:remote-method="remoteMerchantList"
:loading="treeLoading">
<gl-option
v-for="item in businessList"
v-for="item in businessTreeList"
:key="item.merchantId"
:label="item.merchantName"
:value="item.merchantId">
......@@ -189,16 +185,13 @@
:addDialogVisible="addDialogVisible"
@addData="handleAddData"
></add-business>
<gl-dialog
<!-- <gl-dialog
title="编辑商户"
:visible.sync="merchantDialogVisible"
>
:visible.sync="merchantDialogVisible">
<gl-form :model="merchantInfo">
<gl-form-item
label="商户名称:"
:label-width="formLabelWidth"
>
<!-- <gl-input v-model="merchantInfo.merchantName" auto-complete="off"></gl-input> -->
:label-width="formLabelWidth">
<div>{{merchantInfo.merchantName}}</div>
</gl-form-item>
<gl-form-item
......@@ -233,10 +226,6 @@
>
</gl-option>
</gl-select>
<!-- <span
v-show="errorBags.has('merchantId')"
class="error"
>{{ errorBags.first('merchantId') }}</span> -->
</gl-form-item>
</gl-form>
<div
......@@ -249,7 +238,7 @@
@click="submitMerchant"
>确 定</gl-button>
</div>
</gl-dialog>
</gl-dialog> -->
</div>
</template>
......@@ -390,8 +379,8 @@ export default {
children: 'list',
label: 'merchantName'
},
businessList: [],
loading: false,
businessTreeList: [],
treeLoading: false,
searchResult: {}, // 搜索结果的对象
allTree: [],
target: [],
......@@ -413,18 +402,17 @@ export default {
this.addDialogVisible = false
this.dialogVisible_search = false
// this.searchParams.groupId = params.groupId
const para = {}
para.groupId = this.groupId
para.method = groupDetailMethods.GetTree
request.req(para).then(res => {
this.dataTree = res
})
})
// this.loadingGetList()
this.getMerchantType()
this.eventBus = this.$root.eventBus
// gettree
const params = {}
// params.groupId = this.groupId
params.method = groupDetailMethods.GetTree
request.req(params).then(res => {
console.log(res)
this.dataTree = res.data
})
},
methods: {
loadingGetList() {
......@@ -548,78 +536,49 @@ export default {
},
// 树操作
// 父商户搜索
remoteList(query) {
remoteMerchantList(query) {
if (query !== '') {
this.loading = true
this.treeLoading = true
const params = {}
params.groupId = this.groupId
params.searchWrod = query
params.method = groupDetailMethods.SearchList
params.method = groupDetailMethods.GroupSearchMerchant
request.req(params).then(res => {
this.loading = false
this.businessList = res.merchantParams
console.log(res)
this.treeLoading = false
this.businessTreeList = res.merchantParams
}).catch(err => {
notice.errorTips(err)
})
} else {
this.businessList = []
this.businessTreeList = []
}
},
changeMerchant(val) {
if (val) {
this.businessList.forEach(item => {
this.businessTreeList.forEach(item => {
if (item.merchantId === val && item.merchantType !== null) {
this.merchantInfo.merchantType = item.merchantType
this.disabledMerchant = true
}
})
this.businessList = []
this.businessTreeList = []
}
},
// 查询
searchMerchant() {
console.log(this.lastSearch.style ? this.lastSearch.style.backgroundColor : null)
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].$el.childNodes[0].__vue__.getNodeKey(this.$refs.tree.$children[0].store._getAllNodes()[1]))
this.lastSearch.style ? this.lastSearch.style.backgroundColor = '#ffffff' : null
this.allTree = this.$refs.tree.$children[0].store._getAllNodes()
let result = ''
console.log(this.allTree)
this.allTree.forEach(element => {
if (element.key === this.searchResult.merchantId) {
// console.log(element)
result = element
}
})
console.log(result.key)
this.searchChildren(this.$refs.tree.$children[0].store._getAllNodes(), result.key)
const rootList = this.$refs.tree.$children[0].$children
// console.log(rootList)
// console.log(this.target)
this.cycle(rootList, this.target[0])
// rootList.forEach(i => {
// if (i.node.key === this.target[0].key) {
// this.$nextTick(() => {
// i.$children.forEach(j => {
// if (j.node.key === this.target[1].key) {
// 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'
// })
// }
// })
// }
// })
// })
// }
// })
},
cycle(arr, target) {
this.$nextTick(() => {
......@@ -631,11 +590,7 @@ export default {
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) {
......@@ -646,10 +601,8 @@ export default {
},
searchChildren(data, id) {
data.forEach(el => {
// console.log(el.store.getCurrentNode())
if (el.key === id) {
this.$set(el, 'expanded', true)
this.searchParent(el)
} else {
this.$set(el, 'expanded', false)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!