Commit 53ce2e8f by 匡雅琴

关联企微交互

1 parent cbc2282a
<template> <template>
<div class="scrm-main"> <div class="scrm-main">
<div class="form-header" v-if="$globalState.session.accountLevel == 1 && $globalState.session.merchantModel == 1"> <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> <!-- <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 type="primary" @click="handleContact" size="small" icon="el-icon-link">门店账户关联企微</el-button>
>门店账户关联企微</el-button
>-->
</div> </div>
<div class="follow-form"> <div class="follow-form">
<GLCombiForm :formObj="searchForm" :searchSelectObj="searchSelectObj" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> <GLCombiForm :formObj="searchForm" :searchSelectObj="searchSelectObj" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<div class="tree-list" :style="{ height: listHeight + 'px' }"> <div class="tree-list" :style="{ height: listHeight + 'px' }">
<el-radio-group v-model="checkObj.first" @change="selectChange"> <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)"> <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> <i v-show="item.hasChildren" class="el-icon-arrow-right"></i>
</div> </div>
</el-radio-group> </el-radio-group>
...@@ -242,15 +242,32 @@ export default { ...@@ -242,15 +242,32 @@ export default {
} }
}, },
mounted() { mounted() {
this.merchantList = this.parentMerchantList // this.merchantList = this.parentMerchantList
this.getDepartmentList()
}, },
methods: { 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() { handleClose() {
this.visible = false this.visible = false
}, },
submit() { submit() {
console.log(this.checkObj) 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) { selectChange(val) {
...@@ -336,4 +353,4 @@ export default { ...@@ -336,4 +353,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<li>无数据</li> <li>无数据</li>
</template> </template>
</ul> </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> --> <!-- <i slot="suffix" class="el-input__icon el-icon-arrow-down" :class="isOpen ? 'is-focus' : ''"></i> -->
<template slot="append"> <template slot="append">
<div class="input_append" @click.stop="arrowClick"> <div class="input_append" @click.stop="arrowClick">
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</template> </template>
</el-input> </el-input>
</el-popover> </el-popover>
<MerchantTree ref="merchantTree"></MerchantTree> <MerchantTree ref="merchantTree" @select="select"></MerchantTree>
</div> </div>
</template> </template>
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
return { return {
searchKey: { searchKey: {
id: '', id: '',
merchantName: '' departmentName: ''
}, // 绑定input的值 }, // 绑定input的值
isOpen: false, isOpen: false,
visible: false, visible: false,
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
this.$refs.merchantTree.visible = true this.$refs.merchantTree.visible = true
} }
}, },
handleInput: utils.debounce(function (val) { handleInput: utils.debounce(function(val) {
console.log(val) console.log(val)
this.getSearchList(val) this.getSearchList(val)
}, 300), }, 300),
...@@ -153,6 +153,12 @@ export default { ...@@ -153,6 +153,12 @@ export default {
// this.searchList = [val] // this.searchList = [val]
this.visible = false 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() { handleBlur() {
// this.visible = false // this.visible = false
// this.searchKey = '' // this.searchKey = ''
...@@ -218,4 +224,4 @@ export default { ...@@ -218,4 +224,4 @@ export default {
.search-popper { .search-popper {
padding: 0 !important; padding: 0 !important;
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</div> </div>
<div class="select_wrapper"> <div class="select_wrapper">
<div class="label">企业微信</div> <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> <!-- <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 }"> <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"> <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 { ...@@ -160,7 +160,7 @@ export default {
// 设置底部按钮宽度 // 设置底部按钮宽度
setBtnWidth() { setBtnWidth() {
let _this = this let _this = this
this.$nextTick(function () { this.$nextTick(function() {
_this.customWidth = _this.$refs.btnWidth.clientWidth _this.customWidth = _this.$refs.btnWidth.clientWidth
}) })
}, },
...@@ -177,14 +177,19 @@ export default { ...@@ -177,14 +177,19 @@ export default {
}, },
// 获取当前选择的部门 // 获取当前选择的部门
getCurDepartment(val) { getCurDepartment(val) {
let ids = val[val.length - 1] console.log(val, '---')
let labels = this.$refs.cascaderRef.getCheckedNodes()[0].pathLabels
let curLabel = labels[labels.length - 1]
this.tempDepart = { this.tempDepart = {
departmentId: ids, departmentId: val.merchantId,
departmentName: curLabel 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() { getDepartmentList() {
this.$apis.baseInfo.getDepartment({ id: 1, flag: true }).then(res => { this.$apis.baseInfo.getDepartment({ id: 1, flag: true }).then(res => {
...@@ -345,7 +350,7 @@ export default { ...@@ -345,7 +350,7 @@ export default {
this.getMerchantList() this.getMerchantList()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.gl-page { .gl-page {
...@@ -509,4 +514,4 @@ export default { ...@@ -509,4 +514,4 @@ export default {
border-color: #5850ff; border-color: #5850ff;
border-radius: 4px; border-radius: 4px;
} }
</style>
\ No newline at end of file \ 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!