123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- <template>
- <div class="common-screen-item">
- <label class="common-screen-label" v-if="title&&title!=''">{{title}}</label>
- <div :style="width?'width:'+width:''" :class="['common-screen-self-box','common-input-select',selectUser&&selectUser.user_id&&clearable?'common-input-select-hover':'']" @click="screenClick">
- <div :class="['common-screen-self-con',!selectUser||!selectUser.user_id||selectUser.user_id==''?'common-screen-self-placeholder':'']">
- <div class="common-screen-self-con-div">
- <span v-if="!selectUser||!selectUser.user_id||selectUser.user_id==''">{{placeholder || '请选择'}}</span>
- <template v-else>
- <span>{{selectUser.name}}</span>
- </template>
- </div>
- <i class="el-icon-circle-close other-icon" @click.stop="clear"></i>
- </div>
- <div class="common-screen-self-icon">
- <i class="el-icon-arrow-down"></i>
- </div>
- </div>
- <el-dialog title="" :visible.sync="visible" :close-on-click-modal="false" width="400px" append-to-body center top="15vh">
- <div v-loading="loading">
- <div class="propoverItem">
- <self-input :reset='resetFlag' :hasLabel="false" width="90%" style="margin-top:0" @inputChange='(val)=>{input_keyword = val;init("userSearch")}'></self-input>
- <div class="allMember">全部成员({{userTotal}}):</div>
- <div class="memberBoxBig self-scrollbar-3">
- <template v-for="(item,index) in userList">
- <div class="memberBox" :key="index + 'userList' + item.department_id">
- <i :class="['el-icon-caret-bottom',item.is_open?'reversalAnimation':'']" @click="openEvent(index)"></i>
- <div class="meberList">
- <div class="department">
- <div class="flex">
- <i class="el-icon-s-cooperation"></i>
- <span>{{item.department_name?item.department_name:'部门'+(index+1)}}</span>
- </div>
- </div>
- <div class="memberItem" :style="item.is_open?'display:none':''" v-for="(item1) in item.user_list" :key="item1.user_id" @click="selectUserEvent('user',item1.user_id)">
- <div class="flex" style="flex:1">
- <img class="memberImg" :src="item1.avatar" alt="">
- <div class="memberInfo">
- <div class="name">{{item1.name}}</div>
- <div class="other">部门:{{item1.department_list&&item1.department_list.join(',')}}</div>
- </div>
- </div>
- <div :class="['checkbox',selectUserId==item1.user_id?'checkbox_active':'']"><i class="el-icon-check"></i></div>
- </div>
- </div>
- </div>
- </template>
- </div>
- </div>
- <div class="buttons">
- <el-button type="primary" plain size="mini" @click="visible = false">取消</el-button>
- <el-button type="primary" size="mini" @click="defineEvent">确定</el-button>
- </div>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import selfInput from '@/components/assembly/screen/input.vue'
- export default {
- components: { selfInput },
- props: {
- title: {
- type: String,
- default: '所属客服'
- },
- placeholder: {
- type: String,
- default: () => '请选择'
- },
- clearable: {
- type: Boolean,
- default: true
- },
- reset: {
- type: Boolean,
- default: false
- },
- width: {
- type: String
- },
- afferent_users: {
- type: Array
- }
- },
- watch: {
- reset () {
- this.selectUserId = '';
- this.selectUser = {};
- }
- },
- data () {
- return {
- resetFlag: false,
- visible: false,
- loading: false,
- userList: [],
- userTotal: 0,
- selectUserId: '',
- selectUser: {},
- input_keyword: ''
- }
- },
- mounted () {
- console.log(this.selectUser)
- },
- methods: {
- screenClick () {
- this.visible = true;
- if (this.userList.length == 0) {
- this.init()
- } else {
- this.serviceInit()
- }
- },
- serviceInit (type) {
- this.userList.forEach((item) => {
- item.is_open = false//是否折叠
- item.user_list.forEach((item1, index) => {
- if (item1.user_id == this.selectUserId) {
- this.selectUser = item1
- }
- })
- });
- if (type == 'define') {
- this.$emit('customerDefine', this.selectUser)
- }
- },
- clear () {
- this.selectUserId = '';
- this.selectUser = {};
- this.input_keyword = '';
- this.resetFlag = !this.resetFlag
- this.init()
- this.$emit('customerDefine', '')
- },
- defineEvent () {
- if (this.selectUserId == '') {
- this.$message({
- message: '请选择客服',
- type: "warning"
- })
- return
- }
- this.serviceInit('define')
- this.visible = false
- },
- init () {
- this.loading = true
- this.$axios.get(this.URL.BASEURL + this.URL.userList, {
- params: {
- user_name: this.input_keyword
- }
- }).then((res) => {
- var res = res.data
- this.loading = false
- if (res && res.errno == 0) {
- this.userList = res.rst.list;
- this.serviceInit()
- this.userTotal = res.rst.count
- } else if (res.errno != 4002) {
- this.$message({
- message: res.err,
- type: "warning"
- })
- }
- }).catch((err) => {
- this.loading = false
- });
- },
- openEvent (index) {
- let arr = this.userList[index]
- arr.is_open = !arr.is_open
- this.$set(this.userList, index, arr)
- },
- selectUserEvent (type, user_id) {
- this.selectUserId = user_id
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .propoverItem {
- width: 100%;
- flex: 1;
- height: 100%;
- .allMember {
- color: #666666;
- font-size: 14px;
- line-height: 20px;
- margin-top: 17px;
- }
- .title {
- color: #383e47;
- font-size: 14px;
- line-height: 20px;
- font-weight: bold;
- }
- .choice_result_top {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin: 7px 0;
- .clear {
- color: #00b38a;
- font-size: 13px;
- line-height: 18px;
- cursor: pointer;
- font-weight: bold;
- }
- .result_num {
- color: #333333;
- font-size: 13px;
- line-height: 18px;
- span {
- color: #00b38a;
- font-weight: bold;
- }
- }
- }
- .member_result {
- height: 380px;
- overflow-y: auto;
- padding-right: 15px;
- }
- }
- .line {
- width: 0.5px;
- background: #c3cbd6;
- }
- .propoverItem,
- .line {
- max-height: 478px;
- }
- .memberBoxBig {
- max-height: 400px;
- overflow-y: auto;
- }
- .memberBox {
- display: flex;
- margin-top: 10px;
- .el-icon-caret-bottom {
- color: #46a7ff;
- cursor: pointer;
- margin-right: 7px;
- margin-top: 2px;
- transition: all 0.3s;
- display: block;
- height: 14px;
- }
- .meberList {
- flex: 1;
- margin-right: 29px;
- .department {
- i {
- color: #46a7ff;
- }
- span {
- color: #383e47;
- font-size: 14px;
- line-height: 20px;
- margin-left: 5px;
- font-weight: bold;
- }
- }
- .checkbox {
- width: 15px;
- height: 15px;
- border: 1px solid #979797;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 12px;
- margin-left: 10px;
- i {
- color: transparent;
- }
- &.checkbox_active {
- i {
- color: #ffffff;
- }
- background: #00b38a;
- border-color: #00b38a;
- }
- }
- }
- }
- .memberItem,
- .department {
- display: flex;
- align-items: center;
- justify-content: space-between;
- cursor: pointer;
- }
- .memberItem {
- margin: 14px 0;
- .memberImg {
- width: 38px;
- height: 38px;
- border-radius: 4px;
- }
- .memberInfo {
- margin-left: 7px;
- flex: 1;
- .name {
- color: #333333;
- font-size: 13px;
- line-height: 18px;
- }
- .other {
- color: #898d92;
- font-size: 12px;
- line-height: 18px;
- }
- }
- }
- .reversalAnimation {
- transform: rotate(-90deg);
- }
- .buttons {
- text-align: right;
- padding: 20px 0 10px;
- }
- </style>
|