|
@@ -1,5 +1,6 @@
|
|
<template>
|
|
<template>
|
|
- <div tabindex="0" @blur="selectClihide()" style="display: inline-block;">
|
|
|
|
|
|
+<div style="display: inline-block;">
|
|
|
|
+ <div tabindex="0" @blur="selectClihide()" style="display: inline-block;" v-if="!wxCope">
|
|
<!-- <div :style="'width:' + selectWidth + 'px;height:' + selectHeight + 'px'" :class="classDiv ? 'select selectDiv' : 'select'" @click="selectCli" :ref="disabled ? '' : 'selectDiv'"> -->
|
|
<!-- <div :style="'width:' + selectWidth + 'px;height:' + selectHeight + 'px'" :class="classDiv ? 'select selectDiv' : 'select'" @click="selectCli" :ref="disabled ? '' : 'selectDiv'"> -->
|
|
<div :class="disabled ? 'disabledTrue' : 'disabledFalse'" @mouseenter="moveIonDiv" @mouseleave="outIonDiv">
|
|
<div :class="disabled ? 'disabledTrue' : 'disabledFalse'" @mouseenter="moveIonDiv" @mouseleave="outIonDiv">
|
|
<div :style="`width:${selectWidth}px;height:${selectHeight}px`" :class="classDiv ? 'select selectDiv' : 'select'" @click="selectCli" :ref="disabled ? '' : 'selectDiv'">
|
|
<div :style="`width:${selectWidth}px;height:${selectHeight}px`" :class="classDiv ? 'select selectDiv' : 'select'" @click="selectCli" :ref="disabled ? '' : 'selectDiv'">
|
|
@@ -70,6 +71,14 @@
|
|
</div>
|
|
</div>
|
|
</transition>
|
|
</transition>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div v-if="wxCope" class="waihez">
|
|
|
|
+ <!-- <div @click="dianjis()">点击</div> -->
|
|
|
|
+ <div :style="`width:${selectWidth}px;height:${selectHeight}px;line-height:${selectHeight}px;background:#fff`" class="select selectDandu" @click="dianjis()">
|
|
|
|
+ <span v-if="!multiSelect"><ww-open-data type='userName' :openid='selectName'></ww-open-data></span>
|
|
|
|
+ <!-- <span>你好</span> -->
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
@@ -84,6 +93,10 @@ export default {
|
|
subjectId: {
|
|
subjectId: {
|
|
type: [String, Number, Array]
|
|
type: [String, Number, Array]
|
|
},
|
|
},
|
|
|
|
+ wxCope: {
|
|
|
|
+ type: Boolean,
|
|
|
|
+ default: false,
|
|
|
|
+ },
|
|
// 是否支持多选
|
|
// 是否支持多选
|
|
multiSelect: {
|
|
multiSelect: {
|
|
type: Boolean,
|
|
type: Boolean,
|
|
@@ -265,6 +278,54 @@ export default {
|
|
this.dailyListIndex = this.idx
|
|
this.dailyListIndex = this.idx
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ dianjis() {
|
|
|
|
+ if(!this.disabled) {
|
|
|
|
+ let modes = this.multiSelect ? 'multi' : 'single'
|
|
|
|
+ let that = this
|
|
|
|
+ wx.invoke("selectEnterpriseContact", {
|
|
|
|
+ "fromDepartmentId": 0,// 必填,表示打开的通讯录从指定的部门开始展示,-1表示自己所在部门开始, 0表示从最上层开始
|
|
|
|
+ "mode": modes,// 必填,选择模式,single表示单选,multi表示多选
|
|
|
|
+ "type": ["user"],// 必填,选择限制类型,指定department、user中的一个或者多个
|
|
|
|
+ "selectedDepartmentIds": [],// 非必填,已选部门ID列表。用于多次选人时可重入,single模式下请勿填入多个id
|
|
|
|
+ "selectedUserIds": []// 非必填,已选用户ID列表。用于多次选人时可重入,single模式下请勿填入多个id
|
|
|
|
+ },function(res){
|
|
|
|
+ console.log(res)
|
|
|
|
+ if (res.err_msg == "selectEnterpriseContact:ok"){
|
|
|
|
+ console.log(res, '数据来源')
|
|
|
|
+ if(typeof res.result == 'string'){
|
|
|
|
+ res.result = JSON.parse(res.result) //由于目前各个终端尚未完全兼容,需要开发者额外判断result类型以保证在各个终端的兼容性
|
|
|
|
+ }
|
|
|
|
+ var selectedUserList = res.result.userList; // 已选的成员列表
|
|
|
|
+ var userId = ''
|
|
|
|
+ var userName = ''
|
|
|
|
+ for (var i = 0; i < selectedUserList.length; i++) {
|
|
|
|
+ var user = selectedUserList[i];
|
|
|
|
+ userId = user.id; // 已选的单个成员ID
|
|
|
|
+ userName = user.name;// 已选的单个成员名称
|
|
|
|
+ console.log(userId, userName)
|
|
|
|
+ }
|
|
|
|
+ for(var s in that.options) {
|
|
|
|
+ if(that.options[s].name == userId) {
|
|
|
|
+ that.selectName = userId
|
|
|
|
+ that.wxCoper(that.options[s].id)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ wxCoper(id) {
|
|
|
|
+ let obj = {
|
|
|
|
+ id: id,
|
|
|
|
+ distinction: this.distinction,
|
|
|
|
+ index: this.index, // 选中的索引
|
|
|
|
+ other: this.other,
|
|
|
|
+ name: this.selectName
|
|
|
|
+ }
|
|
|
|
+ console.log(obj)
|
|
|
|
+ this.$emit("selectCal", obj)
|
|
|
|
+ },
|
|
selectCli() {
|
|
selectCli() {
|
|
if(!this.disabled) {
|
|
if(!this.disabled) {
|
|
this.$refs.selectDiv.focus()
|
|
this.$refs.selectDiv.focus()
|
|
@@ -443,6 +504,15 @@ export default {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
|
+ .selectDandu {
|
|
|
|
+ font-size: 16px;
|
|
|
|
+ }
|
|
|
|
+ .waihez {
|
|
|
|
+ // padding-top: 7px;
|
|
|
|
+ // box-sizing: border-box;
|
|
|
|
+ // background: #FFF;
|
|
|
|
+ display: inline-block;
|
|
|
|
+ }
|
|
.selectDiv {
|
|
.selectDiv {
|
|
border-color: #409EFF !important;
|
|
border-color: #409EFF !important;
|
|
}
|
|
}
|