企微助手 ,仓库名 短剧

serviceSingle.vue 8.8KB

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