Commit 6c42b130 by cwq0219
2 parents 9287851d 5fe48c71
...@@ -4,8 +4,8 @@ const methods = { ...@@ -4,8 +4,8 @@ const methods = {
Search: `${path}group.search`, Search: `${path}group.search`,
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`
} }
export { export {
methods methods
......
...@@ -12,17 +12,34 @@ ...@@ -12,17 +12,34 @@
@click="addDialog" @click="addDialog"
>添加商户</gl-button> >添加商户</gl-button>
</div> </div>
<div>
<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 align="center" v-for="(i, index) in tableData.column" :key="index" :label='i.label' :prop='i.prop' :width='i.width' > >
<gl-table-column
align="center"
v-for="(i, index) in tableData.column"
:key="index"
:label='i.label'
:prop='i.prop'
:width='i.width'
>
<template slot-scope="scope"> <template slot-scope="scope">
<template v-if='i.prop === "merchantName"'> <template v-if='i.prop === "merchantName"'>
<a @click="merchantDetail(scope.scope.row.merchantId)" class="el-button el-button--text">{{tableData.data[scope.scope.$index][i.prop]}}</a> <a
@click="merchantDetail(scope.scope.row.merchantId)"
class="el-button el-button--text"
>{{tableData.data[scope.scope.$index][i.prop]}}</a>
</template> </template>
<template v-else-if='i.prop === "parentMerchantName"'> <template v-else-if='i.prop === "parentMerchantName"'>
<a @click="merchantDetail(scope.scope.row.parentMerchantId)" class="el-button el-button--text">{{tableData.data[scope.scope.$index][i.prop]}}</a> <a
@click="merchantDetail(scope.scope.row.parentMerchantId)"
class="el-button el-button--text"
>{{tableData.data[scope.scope.$index][i.prop]}}</a>
</template> </template>
<template v-else> <template v-else>
{{tableData.data[scope.scope.$index][i.prop]}} {{tableData.data[scope.scope.$index][i.prop]}}
...@@ -30,7 +47,50 @@ ...@@ -30,7 +47,50 @@
</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-form-item label="商户:" prop="merchantId"> -->
<gl-input
v-model="searchResult.merchantName"
placeholder="请输入内容"
></gl-input>
<!-- <gl-select
v-model="searchResult.merchantName"
filterable
remote
clearable
name="merchantId"
placeholder="请输入商户名称/商户号"
data-vv-as="商户名称/商户号"
v-validate="'required'"
@change="changeMerchant"
:remote-method="remoteList"
:loading="loading">
<gl-option
v-for="item in businessList"
:key="item.merchantId"
:label="item.merchantName"
:value="item.merchantId">
</gl-option>
</gl-select> -->
<gl-button
class="newButton"
type="primary"
@click="searchMerchant"
@keyup.enter="searchMerchant"
>查询</gl-button>
<!-- </gl-form-item> -->
<!-- <gl-input v-model="searchTree" placeholder="请输入内容"></gl-input> -->
<gl-tree
:style="{height: parseInt(this.$client_height() - 140) + 'px'}"
style="overflow-x: auto"
:data="dataTree"
:props="defaultProps"
node-key='merchantId'
ref="tree"
></gl-tree>
</div>
<gl-pagination <gl-pagination
style="width: 808px;"
background background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
...@@ -41,32 +101,54 @@ ...@@ -41,32 +101,54 @@
:total="total" :total="total"
> >
</gl-pagination> </gl-pagination>
</div>
<gl-dialog <gl-dialog
title="高级搜索" title="高级搜索"
width="40%" width="40%"
:visible.sync="dialogVisible_search" :visible.sync="dialogVisible_search"
:before-close="handleClose_search" :before-close="handleClose_search"
:close-on-click-modal="false"> :close-on-click-modal="false"
>
<gl-form <gl-form
:model="searchParams" :model="searchParams"
ref="searchParams" ref="searchParams"
label-width="120px"> label-width="120px"
<gl-form-item label="商户名称:" prop="merchantName"> >
<gl-input name="merchantName" placeholder="请输入商户名称" v-model="searchParams.merchantName"></gl-input> <gl-form-item
label="商户名称:"
prop="merchantName"
>
<gl-input
name="merchantName"
placeholder="请输入商户名称"
v-model="searchParams.merchantName"
></gl-input>
</gl-form-item> </gl-form-item>
<gl-form-item label="商户号:" prop="merchantId"> <gl-form-item
<gl-input name="merchantId" placeholder="请输入商户号" v-model="searchParams.merchantId"></gl-input> label="商户号:"
prop="merchantId"
>
<gl-input
name="merchantId"
placeholder="请输入商户号"
v-model="searchParams.merchantId"
></gl-input>
</gl-form-item> </gl-form-item>
<gl-form-item label="商户类型:" prop="merchantType"> <gl-form-item
label="商户类型:"
prop="merchantType"
>
<gl-select <gl-select
name="merchantType" name="merchantType"
v-model="searchParams.merchantType" v-model="searchParams.merchantType"
placeholder="请选择"> placeholder="请选择"
>
<gl-option <gl-option
v-for="item in merchantTypeList" v-for="item in merchantTypeList"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"
>
</gl-option> </gl-option>
</gl-select> </gl-select>
</gl-form-item> </gl-form-item>
...@@ -91,8 +173,15 @@ ...@@ -91,8 +173,15 @@
</gl-date-picker> </gl-date-picker>
</gl-form-item> </gl-form-item>
</gl-form> </gl-form>
<div slot="footer" class="dialog-footer"> <div
<gl-button type="primary" @click="handleSubmit_search" :loading="searchLoading">搜索</gl-button> slot="footer"
class="dialog-footer"
>
<gl-button
type="primary"
@click="handleSubmit_search"
:loading="searchLoading"
>搜索</gl-button>
<gl-button @click="searchReset">重置</gl-button> <gl-button @click="searchReset">重置</gl-button>
</div> </div>
</gl-dialog> </gl-dialog>
...@@ -101,6 +190,67 @@ ...@@ -101,6 +190,67 @@
:addDialogVisible="addDialogVisible" :addDialogVisible="addDialogVisible"
@addData="handleAddData" @addData="handleAddData"
></add-business> ></add-business>
<gl-dialog
title="编辑商户"
: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> -->
<div>{{merchantInfo.merchantName}}</div>
</gl-form-item>
<gl-form-item
label="商户类型:"
:label-width="formLabelWidth"
>
<div>{{merchantInfo.merchantTypeName}}</div>
</gl-form-item>
<gl-form-item
label="父商户:"
:label-width="formLabelWidth"
prop="parentMerchantId"
>
<gl-select
v-model="merchantInfo.parentMerchantName"
filterable
remote
clearable
name="merchantId"
placeholder="请输入商户名称/商户号"
data-vv-as="商户名称/商户号"
v-validate="'required'"
@change="changeMerchant"
:remote-method="remoteList"
:loading="loading"
>
<gl-option
v-for="item in businessList"
:key="item.merchantId"
:label="item.merchantName"
:value="item.merchantName"
>
</gl-option>
</gl-select>
<span
v-show="errorBags.has('merchantId')"
class="error"
>{{ errorBags.first('merchantId') }}</span>
</gl-form-item>
</gl-form>
<div
slot="footer"
class="dialog-footer"
>
<gl-button @click="merchantDialogVisible = false">取 消</gl-button>
<gl-button
type="primary"
@click="submitMerchant"
>确 定</gl-button>
</div>
</gl-dialog>
</div> </div>
</template> </template>
...@@ -168,27 +318,32 @@ export default { ...@@ -168,27 +318,32 @@ export default {
{ {
label: '序号', label: '序号',
prop: 'id', prop: 'id',
width: '80px' width: '55px'
}, },
{ {
label: '商户名称', label: '商户名称',
prop: 'merchantName' prop: 'merchantName',
width: '170px'
}, },
{ {
label: '商户号', label: '商户号',
prop: 'merchantId' prop: 'merchantId',
width: '70px'
}, },
{ {
label: '地区', label: '地区',
prop: 'areaAddress' prop: 'areaAddress',
width: '90px'
}, },
{ {
label: '商户类型', label: '商户类型',
prop: 'merchantTypeName' prop: 'merchantTypeName',
width: '80px'
}, },
{ {
label: '加入分组时间', label: '加入分组时间',
prop: 'createTime' prop: 'createTime',
width: '155px'
// formatter: cellValue => { // formatter: cellValue => {
// if (cellValue.createTime) { // if (cellValue.createTime) {
// return new Date(cellValue.createTime).format('yyyy-MM-dd') // return new Date(cellValue.createTime).format('yyyy-MM-dd')
...@@ -197,14 +352,58 @@ export default { ...@@ -197,14 +352,58 @@ export default {
}, },
{ {
label: '父商户名称', label: '父商户名称',
prop: 'parentMerchantName' prop: 'parentMerchantName',
width: '100px'
}, },
{ {
label: '父商户号', label: '父商户号',
prop: 'parentMerchantId' prop: 'parentMerchantId',
width: '70px'
}
],
console: {
show: true,
label: '操作',
prop: 'options',
button: [
{
label: '编辑',
type: 'text',
callback: (index, rows) => {
console.log(rows[index])
this.editMerchat(rows[index])
}
} }
] ]
} }
},
// 编辑商户
merchantDialogVisible: false,
merchantInfo: {
// merchantName: '',
// merchantType: '',
// parentMerchantId: ''
},
formLabelWidth: '120px',
// 树
dataTree: [],
defaultProps: {
children: 'list',
label: 'merchantName'
},
businessList: [],
loading: false,
searchResult: {}, // 搜索结果的对象
allTree: [],
target: []
}
},
created() {
document.onkeydown = e => {
if (e.keyCode === 13) {
console.log('enter')
this.searchMerchant()
}
} }
}, },
mounted() { mounted() {
...@@ -218,6 +417,13 @@ export default { ...@@ -218,6 +417,13 @@ export default {
// this.loadingGetList() // this.loadingGetList()
this.getMerchantType() this.getMerchantType()
this.eventBus = this.$root.eventBus this.eventBus = this.$root.eventBus
// gettree
const params = {}
params.method = groupDetailMethods.GetTree
request.req(params).then(res => {
console.log(res)
this.dataTree = res.data
})
}, },
methods: { methods: {
loadingGetList() { loadingGetList() {
...@@ -320,6 +526,120 @@ export default { ...@@ -320,6 +526,120 @@ export default {
}, },
merchantDetail(merchantId) { merchantDetail(merchantId) {
this.$root.to(['商户数据平台', '商户数据管理', '商户数据', '商户列表管理', '*商户详情'], { merchantId: merchantId }) this.$root.to(['商户数据平台', '商户数据管理', '商户数据', '商户列表管理', '*商户详情'], { merchantId: merchantId })
},
// 编辑商户
editMerchat(row) {
this.merchantInfo = {
merchantName: row.merchantName,
merchantTypeName: row.merchantTypeName,
parentMerchantId: row.parentMerchantId,
parentMerchantName: row.parentMerchantName
}
// this.$set(this.merchantInfo.merchantName, row.merchantName)
// this.$set(this.merchantInfo.merchantTypeName, row.merchantTypeName)
// this.merchantInfo.merchantName = row.merchantName
// this.merchantInfo.merchantTypeName = row.merchantTypeName
this.merchantDialogVisible = !this.merchantDialogVisible
},
submitMerchant() {
// 调用接口
this.merchantDialogVisible = !this.merchantDialogVisible
},
// 树操作
// 父商户搜索
remoteList(query) {
if (query !== '') {
this.loading = true
const params = {}
params.groupId = this.groupId
params.searchWrod = query
params.method = groupDetailMethods.SearchList
request.req(params).then(res => {
this.loading = false
this.businessList = res.merchantParams
}).catch(err => {
notice.errorTips(err)
})
} else {
this.businessList = []
}
},
changeMerchant(val) {
if (val) {
this.businessList.forEach(item => {
if (item.merchantId === val && item.merchantType !== null) {
this.merchantInfo.merchantType = item.merchantType
this.disabledMerchant = true
}
})
this.businessList = []
}
},
// 查询
searchMerchant() {
this.searchResult.merchantId = 205
// 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.allTree = this.$refs.tree.$children[0].store._getAllNodes()
let result = ''
this.allTree.forEach(element => {
if (element.key === this.searchResult.merchantId) {
// console.log(element)
result = element
}
})
this.searchChildren(this.$refs.tree.$children[0].store._getAllNodes(), result.key)
const rootList = this.$refs.tree.$children[0].$children
// const sencondList = []
console.log(rootList)
console.log(this.target)
rootList.forEach(i => {
if (i.node.key === this.target[0].key) {
console.log(i.$children)
// sencondList = i.$children
i.$children.forEach(j => {
console.log(j)
// if (j.node.key === this.target[1].key) {
// console.log(j)
// }
})
// for (const j in sencondList) {
// }
}
})
// 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) {
data.forEach(el => {
if (el.key === id) {
this.$set(el, 'expanded', true)
this.searchParent(el)
}
})
},
searchParent(e) {
if (e.level !== 1) {
this.$set(e.parent, 'expanded', true)
this.searchParent(e.parent)
this.target[e.level - 1] = e
} else {
this.target[0] = e
}
} }
} }
} }
...@@ -333,9 +653,9 @@ export default { ...@@ -333,9 +653,9 @@ export default {
} }
} }
} }
.businessGD a{ .businessGD a {
/* color: #0000FF; */ /* color: #0000FF; */
text-decoration:underline text-decoration: underline;
} }
// .tableImg{ // .tableImg{
// width: 36px; // width: 36px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!