index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="90px">
  4. <el-form-item label="企微公司" prop="corpId">
  5. <el-select v-model="queryParams.corpId" placeholder="企微公司" size="small" @change="updateCorpId()">
  6. <el-option
  7. v-for="dict in myQwCompanyList"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="群名" prop="name">
  15. <el-input
  16. v-model="queryParams.name"
  17. placeholder="请输入群名"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="群主(后台)" prop="ownerName">
  24. <el-input
  25. v-model="queryParams.ownerName"
  26. placeholder="请输入群主名称"
  27. clearable
  28. size="small"
  29. @keyup.enter.native="handleQuery"
  30. />
  31. </el-form-item>
  32. <el-form-item label="群主(企微)" prop="qwName">
  33. <el-input
  34. v-model="queryParams.qwName"
  35. placeholder="请输入群主名称"
  36. clearable
  37. size="small"
  38. @keyup.enter.native="handleQuery"
  39. />
  40. </el-form-item>
  41. <el-form-item label="员工账号" prop="userName">
  42. <el-input
  43. v-model="queryParams.userName"
  44. placeholder="请输入员工账号"
  45. clearable
  46. size="small"
  47. @keyup.enter.native="handleQuery"
  48. />
  49. </el-form-item>
  50. <el-form-item>
  51. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  52. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  53. </el-form-item>
  54. </el-form>
  55. <el-row :gutter="10" class="mb8">
  56. <el-col :span="1.5">
  57. <el-button
  58. type="primary"
  59. plain
  60. size="mini"
  61. :disabled="chatIds.length === 0"
  62. @click="handleTransferOnJob"
  63. v-hasPermi="['qw:groupChatTransfer:transferOnJob']"
  64. >分配客户群</el-button>
  65. </el-col>
  66. </el-row>
  67. <el-table v-loading="loading" :data="groupChatList" border @selection-change="handleSelectionChange">
  68. <el-table-column
  69. type="selection"
  70. width="55">
  71. </el-table-column>
  72. <el-table-column label="群名" align="center" prop="name" >
  73. <template slot-scope="scope">
  74. <i class="el-icon-s-comment"></i>
  75. {{scope.row.name}}
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="群主(后台)" align="center" prop="ownerName" />
  79. <el-table-column label="群主(企微)" align="center" prop="qwUserName" />
  80. <el-table-column label="群公告" align="center" prop="notice" show-overflow-tooltip/>
  81. <el-table-column label="企微主体ID" align="center" prop="corpId" />
  82. <el-table-column label="群创建时间" align="center" prop="createTime" />
  83. </el-table>
  84. <pagination
  85. v-show="total>0"
  86. :total="total"
  87. :page.sync="queryParams.pageNum"
  88. :limit.sync="queryParams.pageSize"
  89. @pagination="getList"
  90. />
  91. <!-- 分配客户群 -->
  92. <el-dialog :title="chatDialog.title" :visible.sync="chatDialog.open" width="800px" append-to-body>
  93. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  94. <div style="background-color: rgb(239, 250, 255); margin: 10px;padding: 15px;">
  95. <div>可将选中的客户群转接给其他员工,进行后续服务</div>
  96. <div>继承给的新群主,必须是配置了客户联系功能的成员</div>
  97. <div>继承给的新群主,必须有设置实名</div>
  98. <div>继承给的新群主,必须有激活企业微信</div>
  99. <div>同一个人的群,限制每天最多分配300个给新群主</div>
  100. <div>继承给的新群主和旧的群主,需要在最近一年内至少登陆过一次企业微信</div>
  101. <div>90个自然日内,在职成员的每个客户群仅可被转接2次</div>
  102. </div>
  103. <el-form-item label="新群主" prop="qwId">
  104. <el-input style="width: 150px" disabled>
  105. <template slot="prefix">
  106. <el-button
  107. plain
  108. size="small"
  109. type="success"
  110. v-if="this.form.nickName">
  111. {{ form.nickName }}
  112. </el-button>
  113. </template>
  114. </el-input>
  115. </el-form-item>
  116. <el-card>
  117. <qwUserSelectOne ref="qwUserSelectOne" @selectUser="selectUser"></qwUserSelectOne>
  118. </el-card>
  119. </el-form>
  120. <div slot="footer" class="dialog-footer">
  121. <el-button type="primary" :disabled="chatDialog.save" :loading="chatDialog.save" @click="submitForm">确 定</el-button>
  122. <el-button @click="cancel">取 消</el-button>
  123. </div>
  124. </el-dialog>
  125. </div>
  126. </template>
  127. <script>
  128. import {getMyQwCompanyList} from '@/api/qw/user'
  129. import {listOnJob,transferOnJob} from '@/api/qw/groupChatTransfer.js'
  130. import qwUserSelectOne from '@/views/qw/user/qwUserSelectOne.vue'
  131. export default {
  132. name: 'groupChatTransferOnJob',
  133. components: { qwUserSelectOne },
  134. data() {
  135. return {
  136. loading: false,
  137. total: 0,
  138. chatIds: [],
  139. queryParams: {
  140. corpId: null,
  141. name: null,
  142. ownerName: null,
  143. qwName: null,
  144. userName:null,
  145. pageNum: 1,
  146. pageSize: 10
  147. },
  148. myQwCompanyList: [],
  149. groupChatList: [],
  150. chatDialog: {
  151. open: false,
  152. title: '分配客户群',
  153. save: false
  154. },
  155. form: {
  156. nickName: null,
  157. qwId: null,
  158. },
  159. rules: {
  160. qwId: [{ required: true, message: '请选择新群主', trigger: 'blur' }],
  161. }
  162. }
  163. },
  164. created() {
  165. this.getMyQwCompanyList();
  166. },
  167. methods: {
  168. getMyQwCompanyList() {
  169. getMyQwCompanyList().then(response => {
  170. this.myQwCompanyList = response.data;
  171. if(this.myQwCompanyList!=null){
  172. this.queryParams.corpId=this.myQwCompanyList[0].dictValue
  173. this.getList();
  174. }
  175. });
  176. },
  177. updateCorpId() {
  178. this.handleQuery()
  179. },
  180. handleQuery() {
  181. this.queryParams.pageNum = 1;
  182. this.getList();
  183. },
  184. getList() {
  185. this.loading = true;
  186. listOnJob(this.queryParams).then(response => {
  187. this.groupChatList = response.rows;
  188. this.total = response.total;
  189. this.loading = false;
  190. })
  191. },
  192. resetQuery() {
  193. this.resetForm("queryForm");
  194. this.queryParams.corpId= this.myQwCompanyList[0].dictValue
  195. this.handleQuery();
  196. },
  197. handleSelectionChange(selection) {
  198. this.chatIds = selection.map(item => {
  199. return {
  200. chatId: item.chatId,
  201. owner: item.owner,
  202. qwId: item.qwId
  203. }
  204. })
  205. },
  206. handleTransferOnJob() {
  207. if(this.chatIds.length ===0){
  208. this.$message({
  209. message: '请选择需要分配的客户群',
  210. type: 'warning'
  211. });
  212. return;
  213. }
  214. setTimeout(() => {
  215. this.$refs.qwUserSelectOne.getDetails(this.queryParams.corpId);
  216. }, 1);
  217. this.reset();
  218. this.chatDialog.open = true;
  219. },
  220. selectUser(row) {
  221. this.form.nickName = row.qwUserName;
  222. this.form.qwId = row.id;
  223. },
  224. submitForm() {
  225. this.chatDialog.save = true;
  226. this.$refs["form"].validate(valid => {
  227. if (valid) {
  228. const form = {
  229. chatIds: this.chatIds,
  230. qwId: this.form.qwId,
  231. corpId: this.queryParams.corpId
  232. }
  233. transferOnJob(form).then(response => {
  234. this.$message.success({
  235. message: response.msg,
  236. dangerouslyUseHTMLString: true
  237. });
  238. this.chatDialog.open = false;
  239. this.getList();
  240. });
  241. }
  242. this.chatDialog.save = false;
  243. });
  244. },
  245. cancel() {
  246. this.chatDialog.open = false;
  247. this.reset();
  248. },
  249. reset() {
  250. this.form = {
  251. nickName: null,
  252. qwId: null,
  253. };
  254. this.resetForm("form");
  255. },
  256. }
  257. }
  258. </script>
  259. <style scoped>
  260. </style>