Commit dab08b87 by 胡悦

gegnx

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