Commit 53ce2e8f by 匡雅琴

关联企微交互

1 parent cbc2282a
<template>
<div class="scrm-main">
<div class="form-header" v-if="$globalState.session.accountLevel == 1 && $globalState.session.merchantModel == 1">
<GLButton @click="handleContact" icon="el-icon-link" fn="门店账户关联企微" type="primary" size="small" mode="el-button">门店账户关联企微</GLButton>
<!-- <el-button type="primary" @click="handleContact" size="small" icon="el-icon-link"
>门店账户关联企微</el-button
>-->
<!-- <GLButton @click="handleContact" icon="el-icon-link" fn="门店账户关联企微" type="primary" size="small" mode="el-button">门店账户关联企微</GLButton> -->
<el-button type="primary" @click="handleContact" size="small" icon="el-icon-link">门店账户关联企微</el-button>
</div>
<div class="follow-form">
<GLCombiForm :formObj="searchForm" :searchSelectObj="searchSelectObj" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
......
......@@ -28,7 +28,7 @@
<div class="tree-list" :style="{ height: listHeight + 'px' }">
<el-radio-group v-model="checkObj.first" @change="selectChange">
<div class="tree-item" v-for="item in merchantList" :key="item.merchantId" @click.self="toNext(item, $event)">
<el-radio :label="item" :disabled="item.disabled">{{ item.merchantName }}</el-radio>
<el-radio :label="item" :disabled="item.disabled || item.children">{{ item.departmentName }}</el-radio>
<i v-show="item.hasChildren" class="el-icon-arrow-right"></i>
</div>
</el-radio-group>
......@@ -242,15 +242,32 @@ export default {
}
},
mounted() {
this.merchantList = this.parentMerchantList
// this.merchantList = this.parentMerchantList
this.getDepartmentList()
},
methods: {
// 获取门店数据
getDepartmentList() {
this.$apis.baseInfo.getDepartment({}).then(res => {
// this.departmentList = this.traverse(1, res, 'relevanceMerchant')
console.log(res[0], '==')
this.merchantList = res[0].children
})
},
handleClose() {
this.visible = false
},
submit() {
console.log(this.checkObj)
this.$emit('select')
if (!this.checkObj) {
this.$message({
message: '请选择门店',
type: 'warning'
})
return
}
this.$emit('select', this.checkObj)
this.visible = false
},
// 选中时触发
selectChange(val) {
......@@ -336,4 +353,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
......@@ -21,7 +21,7 @@
<li>无数据</li>
</template>
</ul>
<el-input slot="reference" debounce style="width: 320px" v-model="searchKey.merchantName" :size="size" @input="handleInput" @blur="handleBlur" placeholder="请输入内容">
<el-input slot="reference" debounce style="width: 320px" v-model="searchKey.departmentName" :size="size" @input="handleInput" @blur="handleBlur" placeholder="请输入内容">
<!-- <i slot="suffix" class="el-input__icon el-icon-arrow-down" :class="isOpen ? 'is-focus' : ''"></i> -->
<template slot="append">
<div class="input_append" @click.stop="arrowClick">
......@@ -30,7 +30,7 @@
</template>
</el-input>
</el-popover>
<MerchantTree ref="merchantTree"></MerchantTree>
<MerchantTree ref="merchantTree" @select="select"></MerchantTree>
</div>
</template>
......@@ -46,7 +46,7 @@ export default {
return {
searchKey: {
id: '',
merchantName: ''
departmentName: ''
}, // 绑定input的值
isOpen: false,
visible: false,
......@@ -130,7 +130,7 @@ export default {
this.$refs.merchantTree.visible = true
}
},
handleInput: utils.debounce(function (val) {
handleInput: utils.debounce(function(val) {
console.log(val)
this.getSearchList(val)
}, 300),
......@@ -153,6 +153,12 @@ export default {
// this.searchList = [val]
this.visible = false
},
select(val) {
console.log(val)
this.searchKey.id = val.first.merchantId
this.searchKey.departmentName = val.first.departmentName
this.$emit('getCurDepartment', val.first)
},
handleBlur() {
// this.visible = false
// this.searchKey = ''
......@@ -218,4 +224,4 @@ export default {
.search-popper {
padding: 0 !important;
}
</style>
\ No newline at end of file
</style>
......@@ -35,7 +35,7 @@
</div>
<div class="select_wrapper">
<div class="label">企业微信</div>
<SearchSelect></SearchSelect>
<SearchSelect @getCurDepartment="getCurDepartment"></SearchSelect>
<!-- <el-cascader ref="cascaderRef" @change="getCurDepartment" placeholder="请选择企微门店" :show-all-levels="false" v-model="selectedDepartment" :props="mypropsParam" :options="departmentList" size="small" style="width: 320px" separator=" " filterable>
<template slot-scope="{ data }">
<el-tooltip popper-class="myToolTipClass" style="border: none" :disabled="data.departmentName.length > 12 ? false : true" class="item" effect="light" :content="data.departmentName" placement="top-end">
......@@ -160,7 +160,7 @@ export default {
// 设置底部按钮宽度
setBtnWidth() {
let _this = this
this.$nextTick(function () {
this.$nextTick(function() {
_this.customWidth = _this.$refs.btnWidth.clientWidth
})
},
......@@ -177,14 +177,19 @@ export default {
},
// 获取当前选择的部门
getCurDepartment(val) {
let ids = val[val.length - 1]
let labels = this.$refs.cascaderRef.getCheckedNodes()[0].pathLabels
let curLabel = labels[labels.length - 1]
console.log(val, '---')
this.tempDepart = {
departmentId: ids,
departmentName: curLabel
departmentId: val.merchantId,
departmentName: val.departmentName
}
this.$refs.cascaderRef.dropDownVisible = false
// let ids = val[val.length - 1]
// let labels = this.$refs.cascaderRef.getCheckedNodes()[0].pathLabels
// let curLabel = labels[labels.length - 1]
// this.tempDepart = {
// departmentId: ids,
// departmentName: curLabel
// }
// this.$refs.cascaderRef.dropDownVisible = false
},
getDepartmentList() {
this.$apis.baseInfo.getDepartment({ id: 1, flag: true }).then(res => {
......@@ -345,7 +350,7 @@ export default {
this.getMerchantList()
}
}
</script>
</script>
<style lang="scss" scoped>
.gl-page {
......@@ -509,4 +514,4 @@ export default {
border-color: #5850ff;
border-radius: 4px;
}
</style>
\ No newline at end of file
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!