企微助手 ,仓库名 短剧

serviceSingle.vue 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <div class="common-screen-item">
  3. <label class="common-screen-label" v-if="title&&title!=''">{{title}}</label>
  4. <div :style="width?'width:'+width:''" :class="['common-screen-self-box','common-input-select',selectUser&&selectUser.user_id&&clearable?'common-input-select-hover':'']" @click="screenClick">
  5. <div :class="['common-screen-self-con',!selectUser||!selectUser.user_id||selectUser.user_id==''?'common-screen-self-placeholder':'']">
  6. <div class="common-screen-self-con-div">
  7. <span v-if="!selectUser||!selectUser.user_id||selectUser.user_id==''">{{placeholder || '请选择'}}</span>
  8. <template v-else>
  9. <span>{{selectUser.name}}</span>
  10. </template>
  11. </div>
  12. <i class="el-icon-circle-close other-icon" @click.stop="clear"></i>
  13. </div>
  14. <div class="common-screen-self-icon">
  15. <i class="el-icon-arrow-down"></i>
  16. </div>
  17. </div>
  18. <el-dialog title="" :visible.sync="visible" :close-on-click-modal="false" width="400px" append-to-body center top="15vh">
  19. <div v-loading="loading">
  20. <div class="propoverItem">
  21. <self-input :reset='resetFlag' :hasLabel="false" width="90%" style="margin-top:0" @inputChange='(val)=>{input_keyword = val;init("userSearch")}'></self-input>
  22. <div class="allMember">全部成员({{userTotal}}):</div>
  23. <div class="memberBoxBig self-scrollbar-3">
  24. <template v-for="(item,index) in userList">
  25. <div class="memberBox" :key="index + 'userList' + item.department_id">
  26. <i :class="['el-icon-caret-bottom',item.is_open?'reversalAnimation':'']" @click="openEvent(index)"></i>
  27. <div class="meberList">
  28. <div class="department">
  29. <div class="flex">
  30. <i class="el-icon-s-cooperation"></i>
  31. <span>{{item.department_name?item.department_name:'部门'+(index+1)}}</span>
  32. </div>
  33. </div>
  34. <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)">
  35. <div class="flex" style="flex:1">
  36. <img class="memberImg" :src="item1.avatar" alt="">
  37. <div class="memberInfo">
  38. <div class="name">{{item1.name}}</div>
  39. <div class="other">部门:{{item1.department_list&&item1.department_list.join(',')}}</div>
  40. </div>
  41. </div>
  42. <div :class="['checkbox',selectUserId==item1.user_id?'checkbox_active':'']"><i class="el-icon-check"></i></div>
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. </div>
  48. </div>
  49. <div class="buttons">
  50. <el-button type="primary" plain size="mini" @click="visible = false">取消</el-button>
  51. <el-button type="primary" size="mini" @click="defineEvent">确定</el-button>
  52. </div>
  53. </div>
  54. </el-dialog>
  55. </div>
  56. </template>
  57. <script>
  58. import selfInput from '@/components/assembly/screen/input.vue'
  59. export default {
  60. components: { selfInput },
  61. props: {
  62. title: {
  63. type: String,
  64. default: '所属客服'
  65. },
  66. placeholder: {
  67. type: String,
  68. default: () => '请选择'
  69. },
  70. clearable: {
  71. type: Boolean,
  72. default: true
  73. },
  74. reset: {
  75. type: Boolean,
  76. default: false
  77. },
  78. width: {
  79. type: String
  80. },
  81. afferent_users: {
  82. type: Array
  83. }
  84. },
  85. watch: {
  86. reset () {
  87. this.selectUserId = '';
  88. this.selectUser = {};
  89. }
  90. },
  91. data () {
  92. return {
  93. resetFlag: false,
  94. visible: false,
  95. loading: false,
  96. userList: [],
  97. userTotal: 0,
  98. selectUserId: '',
  99. selectUser: {},
  100. input_keyword: ''
  101. }
  102. },
  103. mounted () {
  104. console.log(this.selectUser)
  105. },
  106. methods: {
  107. screenClick () {
  108. this.visible = true;
  109. if (this.userList.length == 0) {
  110. this.init()
  111. } else {
  112. this.serviceInit()
  113. }
  114. },
  115. serviceInit (type) {
  116. this.userList.forEach((item) => {
  117. item.is_open = false//是否折叠
  118. item.user_list.forEach((item1, index) => {
  119. if (item1.user_id == this.selectUserId) {
  120. this.selectUser = item1
  121. }
  122. })
  123. });
  124. if (type == 'define') {
  125. this.$emit('customerDefine', this.selectUser)
  126. }
  127. },
  128. clear () {
  129. this.selectUserId = '';
  130. this.selectUser = {};
  131. this.input_keyword = '';
  132. this.resetFlag = !this.resetFlag
  133. this.init()
  134. this.$emit('customerDefine', '')
  135. },
  136. defineEvent () {
  137. if (this.selectUserId == '') {
  138. this.$message({
  139. message: '请选择客服',
  140. type: "warning"
  141. })
  142. return
  143. }
  144. this.serviceInit('define')
  145. this.visible = false
  146. },
  147. init () {
  148. this.loading = true
  149. this.$axios.get(this.URL.BASEURL + this.URL.userList, {
  150. params: {
  151. user_name: this.input_keyword
  152. }
  153. }).then((res) => {
  154. var res = res.data
  155. this.loading = false
  156. if (res && res.errno == 0) {
  157. this.userList = res.rst.list;
  158. this.serviceInit()
  159. this.userTotal = res.rst.count
  160. } else if (res.errno != 4002) {
  161. this.$message({
  162. message: res.err,
  163. type: "warning"
  164. })
  165. }
  166. }).catch((err) => {
  167. this.loading = false
  168. });
  169. },
  170. openEvent (index) {
  171. let arr = this.userList[index]
  172. arr.is_open = !arr.is_open
  173. this.$set(this.userList, index, arr)
  174. },
  175. selectUserEvent (type, user_id) {
  176. this.selectUserId = user_id
  177. },
  178. }
  179. }
  180. </script>
  181. <style lang="scss" scoped>
  182. .propoverItem {
  183. width: 100%;
  184. flex: 1;
  185. height: 100%;
  186. .allMember {
  187. color: #666666;
  188. font-size: 14px;
  189. line-height: 20px;
  190. margin-top: 17px;
  191. }
  192. .title {
  193. color: #383e47;
  194. font-size: 14px;
  195. line-height: 20px;
  196. font-weight: bold;
  197. }
  198. .choice_result_top {
  199. display: flex;
  200. align-items: center;
  201. justify-content: space-between;
  202. margin: 7px 0;
  203. .clear {
  204. color: #00b38a;
  205. font-size: 13px;
  206. line-height: 18px;
  207. cursor: pointer;
  208. font-weight: bold;
  209. }
  210. .result_num {
  211. color: #333333;
  212. font-size: 13px;
  213. line-height: 18px;
  214. span {
  215. color: #00b38a;
  216. font-weight: bold;
  217. }
  218. }
  219. }
  220. .member_result {
  221. height: 380px;
  222. overflow-y: auto;
  223. padding-right: 15px;
  224. }
  225. }
  226. .line {
  227. width: 0.5px;
  228. background: #c3cbd6;
  229. }
  230. .propoverItem,
  231. .line {
  232. max-height: 478px;
  233. }
  234. .memberBoxBig {
  235. max-height: 400px;
  236. overflow-y: auto;
  237. }
  238. .memberBox {
  239. display: flex;
  240. margin-top: 10px;
  241. .el-icon-caret-bottom {
  242. color: #46a7ff;
  243. cursor: pointer;
  244. margin-right: 7px;
  245. margin-top: 2px;
  246. transition: all 0.3s;
  247. display: block;
  248. height: 14px;
  249. }
  250. .meberList {
  251. flex: 1;
  252. margin-right: 29px;
  253. .department {
  254. i {
  255. color: #46a7ff;
  256. }
  257. span {
  258. color: #383e47;
  259. font-size: 14px;
  260. line-height: 20px;
  261. margin-left: 5px;
  262. font-weight: bold;
  263. }
  264. }
  265. .checkbox {
  266. width: 15px;
  267. height: 15px;
  268. border: 1px solid #979797;
  269. border-radius: 50%;
  270. display: flex;
  271. align-items: center;
  272. justify-content: center;
  273. font-size: 12px;
  274. margin-left: 10px;
  275. i {
  276. color: transparent;
  277. }
  278. &.checkbox_active {
  279. i {
  280. color: #ffffff;
  281. }
  282. background: #00b38a;
  283. border-color: #00b38a;
  284. }
  285. }
  286. }
  287. }
  288. .memberItem,
  289. .department {
  290. display: flex;
  291. align-items: center;
  292. justify-content: space-between;
  293. cursor: pointer;
  294. }
  295. .memberItem {
  296. margin: 14px 0;
  297. .memberImg {
  298. width: 38px;
  299. height: 38px;
  300. border-radius: 4px;
  301. }
  302. .memberInfo {
  303. margin-left: 7px;
  304. flex: 1;
  305. .name {
  306. color: #333333;
  307. font-size: 13px;
  308. line-height: 18px;
  309. }
  310. .other {
  311. color: #898d92;
  312. font-size: 12px;
  313. line-height: 18px;
  314. }
  315. }
  316. }
  317. .reversalAnimation {
  318. transform: rotate(-90deg);
  319. }
  320. .buttons {
  321. text-align: right;
  322. padding: 20px 0 10px;
  323. }
  324. </style>