企微助手 ,仓库名 短剧

employee_bulk_messaging_log.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <template>
  2. <div v-loading="loading">
  3. <div class="screenBox" style="align-items: center;padding-right:16px">
  4. <div class="flex-align-center" style="flex:1">
  5. <!-- 所属客服 -->
  6. <!-- <self-customerservice title='选择员工' :reset='resetFlag' @customerDefine="(val)=>{user_id_list=val;init(1)}"></self-customerservice> -->
  7. <!-- 添加时间 -->
  8. <date-picker title='发送时间' :reset='resetFlag' @changeTime="changeTime"></date-picker>
  9. <!-- 创建人 -->
  10. <self-channel title="创建人" type='circleCreate' :labelWidth="true" @channelDefine="(val)=>{circleCreate_val = val;init(1)}"></self-channel>
  11. </div>
  12. <el-button type="primary" size="mini" @click="createdMassMsg">新建群发</el-button>
  13. </div>
  14. <div class="tableInfo">
  15. <div>
  16. <div class="flex">
  17. <div class="totalCustom">共有<span>{{total}}</span>条群发内容</div>
  18. </div>
  19. </div>
  20. <div class="flex">
  21. <el-button type="primary" plain size="mini" @click="init(1,'export')">导出Excel</el-button>
  22. </div>
  23. </div>
  24. <!-- table -->
  25. <el-table ref="multipleTable" :height='height' :data="tableData" tooltip-effect="dark" style="width: 100%">
  26. <el-table-column prop="name" label="群发标题" show-overflow-tooltip align="center"></el-table-column>
  27. <el-table-column label="消息类型" align="center">
  28. <template slot-scope="scope">
  29. <div>{{scope.row.send_type == 1 ? '立即发送':scope.row.send_type == 2?'定时发送':''}}</div>
  30. </template>
  31. </el-table-column>
  32. <el-table-column label="创建人" align="center">
  33. <template slot-scope="scope">
  34. <div class="customerServiceTagBox">
  35. <div class="customerServiceTag"><i class="el-icon-user-solid"></i> {{ scope.row.creator }}</div>
  36. </div>
  37. </template>
  38. </el-table-column>
  39. <el-table-column prop="send_time" min-width="120" label="发送时间" show-overflow-tooltip align="center">
  40. <template #header>
  41. <div :class="['flex-align-jus-center','pointer',sort_field=='send_time'?'sortFieldStyle':'']" @click="sortFieldEvent('send_time')">
  42. 发送时间
  43. <i class="el-icon-caret-bottom"></i>
  44. </div>
  45. </template>
  46. <template slot-scope="scope">
  47. <div :class="sort_field=='send_time'?'sortFieldStyle':''">{{scope.row.send_time}}</div>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="创建时间" min-width="120" show-overflow-tooltip align="center">
  51. <template #header>
  52. <div :class="['flex-align-jus-center','pointer',sort_field=='created_at'?'sortFieldStyle':'']" @click="sortFieldEvent('created_at')">
  53. 创建时间
  54. <i class="el-icon-caret-bottom"></i>
  55. </div>
  56. </template>
  57. <template slot-scope="scope">
  58. <div :class="sort_field=='created_at'?'sortFieldStyle':''">
  59. {{scope.row.created_at}}
  60. </div>
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="estimated_user" label="预计送达人数" show-overflow-tooltip align="center"></el-table-column>
  64. <el-table-column prop="send_success" label="送达客户数" show-overflow-tooltip align="center"></el-table-column>
  65. <el-table-column prop="send_fail" label="" show-overflow-tooltip align="center">
  66. <template slot="header">
  67. <div>失败客户数</div>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="发送状态" show-overflow-tooltip align="center">
  71. <template slot-scope="scope">
  72. <span v-if="scope.row.enable==-2" class="c-F03F5C">已删除</span>
  73. <span v-if="scope.row.enable==-1" class="c-666">发送失败</span>
  74. <span v-if="scope.row.enable==0" class="c-F03F5C">禁用</span>
  75. <span v-if="scope.row.enable==1" class="c-FFB055">待发送</span>
  76. <span v-if="scope.row.enable==2" class="c-448AFF">正在发送中</span>
  77. <span v-if="scope.row.enable==3" class="c-58BCA6">发送完成</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column min-width="120" label="操作" align="center">
  81. <template slot-scope="scope">
  82. <div class="flex" style="justify-content:center">
  83. <el-popconfirm :disabled="scope.row.enable==1||scope.row.enable==2?false:true" @confirm="remind_send(scope.row)" :title="'猎羽将提醒未发送的客户发送消息,是否确认提醒 ?'">
  84. <div slot="reference" class="table_button" v-if="scope.row.enable==1||scope.row.enable==2" :class="scope.row.enable==1||scope.row.enable==2?'c-00B38A pointer':'pointer-drop c-999'">提醒</div>
  85. </el-popconfirm>
  86. <div :class="['pointer','table_button',scope.row.enable == 1 ? 'c-FF604D' :'c-007AFF']" v-if="scope.row.enable == 1 || scope.row.enable == 0" @click="welcomeMsg_del(scope.row)">
  87. {{scope.row.enable == 1 ? '禁用' : scope.row.enable == 0 ? '启用':''}}
  88. </div>
  89. <div class="c-00B38A pointer table_button" @click="goDetail(scope.row)">详情</div>
  90. <el-popconfirm @confirm="copyDetail(scope.row)" :title="`确定复制【${scope.row.name}】群发消息?`">
  91. <div slot="reference" class="c-00B38A pointer table_button">复制</div>
  92. </el-popconfirm>
  93. </div>
  94. </template>
  95. </el-table-column>
  96. </el-table>
  97. <div class="pagination" v-show="total>0">
  98. <el-pagination background :current-page="page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count='Number(pages)'>
  99. </el-pagination>
  100. </div>
  101. <el-drawer size="1200px" :visible.sync="massMsgFlag" :with-header="false">
  102. <createMassMsg ref="createMassMsg" v-if="massMsgFlag" :is_copy='is_copy' :title="detail_rule_id?'群发详情':'新建群发'" :rule_id='detail_rule_id' @close="detailClose"></createMassMsg>
  103. </el-drawer>
  104. <el-drawer size="1200px" :visible.sync="detialFlag" :with-header="false">
  105. <massMsgDetail v-if="detialFlag" title="群发详情" :rule_id='detail_rule_id' @close="detailClose"></massMsgDetail>
  106. </el-drawer>
  107. </div>
  108. </template>
  109. <script>
  110. // import selfCustomerservice from '@/components/assembly/screen/customerService.vue'
  111. import datePicker from '@/components/assembly/screen/datePicker.vue'
  112. import createMassMsg from './createMassMsg.vue'
  113. import massMsgDetail from './massMsgDetail/index.vue'
  114. import selfChannel from '@/components/assembly/screen/channel.vue'
  115. import { pageFromType } from '@/assets/js/staticTypes'
  116. export default {
  117. components: { datePicker, createMassMsg, massMsgDetail, selfChannel },
  118. data () {
  119. return {
  120. detialFlag: false,
  121. massMsgFlag: false,
  122. loading: false,
  123. page: 1,
  124. pages: 0,
  125. total: 0,
  126. page_size: 20,
  127. pageOptionValue: 2,
  128. tableData: [],
  129. user_id_list: [],//客服user_id列表
  130. add_date_start: '',//添加日期 起始
  131. add_date_end: '',//添加日期 截止
  132. resetFlag: false,//重置
  133. height: '',
  134. detail_rule_id: '',
  135. is_copy: false,
  136. sort_field: 'send_time',
  137. circleCreate_val: '',
  138. }
  139. },
  140. created () {
  141. this.height = document.documentElement.clientHeight - 260 > 400 ? document.documentElement.clientHeight - 260 : 400
  142. this.init(1)
  143. },
  144. mounted() {
  145. this.handleAutoCreateMsg() // 判断页面跳转来源 => 执行自动创建推广链接
  146. },
  147. methods: {
  148. // 执行自动创建推广链接
  149. async handleAutoCreateMsg() {
  150. const { from, miniProAppId, miniProPath, miniProDesc, miniProCover, h5Path, h5Desc, h5Cover } = this.$route.query
  151. if (from && from === pageFromType.PLAYLET_LINK_MINIAPP) { // 页面来自"企微助手 - 剧集管理 - 创建群发(创建小程序链接)"
  152. try {
  153. // 执行新建群发 && 把 miniProAppId、miniProPath 回显到"群发内容 => 附件 => 小程序"
  154. this.createdMassMsg()
  155. await this.$nextTick()
  156. // 获取 createMassMsg 组件
  157. const comp_createMassMsg = this.$refs.createMassMsg
  158. // 获取 editCon 组件
  159. const comp_editCon = comp_createMassMsg.$refs.editCon
  160. if (comp_editCon) {
  161. // 显示添加附件 => 小程序
  162. comp_editCon.fileEvent('miniprogram')
  163. // 回显 "appId"、"路径"、"标题"、"封面"
  164. comp_editCon.miniprogram.appid = decodeURIComponent(miniProAppId)
  165. comp_editCon.miniprogram.page = decodeURIComponent(miniProPath)
  166. comp_editCon.miniprogram.title = decodeURIComponent(miniProDesc)
  167. comp_editCon.miniprogram.pic_url = decodeURIComponent(miniProCover)
  168. }
  169. } catch (error) {
  170. console.log('error => ', error)
  171. }
  172. } else if (from && from === pageFromType.PLAYLET_LINK_H5) { // 页面来自"企微助手 - 剧集管理 - 创建群发(创建H5推广链接)"
  173. try {
  174. // 执行新建群发 && 把 h5Path 回显到"群发内容 => 附件 => H5推广"
  175. this.createdMassMsg()
  176. await this.$nextTick()
  177. // 获取 createMassMsg 组件
  178. const comp_createMassMsg = this.$refs.createMassMsg
  179. // 获取 editCon 组件
  180. const comp_editCon = comp_createMassMsg.$refs.editCon
  181. if (comp_editCon) {
  182. // 显示添加附件 => H5推广
  183. comp_editCon.fileEvent('linkExtend')
  184. // 回显 "链接地址"、"链接标题"、"图文封面"
  185. comp_editCon.linkExtend.jump_url = decodeURIComponent(h5Path)
  186. comp_editCon.linkExtend.title = decodeURIComponent(h5Desc)
  187. comp_editCon.linkExtend.picurl = decodeURIComponent(h5Cover)
  188. }
  189. } catch (error) {
  190. console.log('error => ', error)
  191. }
  192. }
  193. },
  194. sortFieldEvent (type) {
  195. if (type == this.sort_field) return;
  196. this.sort_field = type;
  197. this.init(1)
  198. },
  199. detailClose (val) {
  200. if (val == 'update') {//编辑
  201. this.init(this.page)
  202. } else if (val == 'update_new') {//复制或者新建
  203. this.sort_field = 'created_at'
  204. this.init(1)
  205. this.$refs.multipleTable.bodyWrapper.scrollTop = 0;
  206. }
  207. this.massMsgFlag = false
  208. this.detialFlag = false
  209. },
  210. createdMassMsg () {
  211. this.detail_rule_id = '';
  212. this.massMsgFlag = true
  213. },
  214. remind_send (data) {//提醒发送
  215. this.$loading(this.$loadingConfig);
  216. this.$axios.get(this.URL.BASEURL + this.URL.massMsg_noticeUser, {
  217. params: {
  218. rule_id: data.rule_id,
  219. }
  220. }).then((res) => {
  221. var res = res.data;
  222. this.$loading(this.$loadingConfig).close();
  223. if (res && res.errno == 0) {
  224. this.$message({
  225. message: '操作成功!',
  226. type: 'success'
  227. })
  228. } else {
  229. this.$message({
  230. message: res.err,
  231. type: 'warning'
  232. })
  233. }
  234. }).catch(() => {
  235. this.$loading(this.$loadingConfig).close();
  236. })
  237. },
  238. goDetail (data) {
  239. this.detail_rule_id = data.rule_id;
  240. this.is_copy = false;
  241. if (data.enable == 1) {//待发送
  242. this.massMsgFlag = true
  243. } else {
  244. this.detialFlag = true
  245. }
  246. },
  247. copyDetail (data) {//复制
  248. this.massMsgFlag = true;
  249. this.is_copy = true
  250. this.detail_rule_id = data.rule_id;
  251. },
  252. welcomeMsg_del (item) {
  253. if (item.enable != 1 && item.enable != 0) {
  254. return
  255. }
  256. this.$confirm(`确定${item.enable == 1 ? '禁用' : '启用'}【${item.name}】?`, '提示', {
  257. confirmButtonText: '确定',
  258. cancelButtonText: '取消',
  259. type: 'warning'
  260. }).then(() => {
  261. this.$loading(this.$loadingConfig);
  262. this.$axios.get(this.URL.BASEURL + this.URL.massMsg_updateStatus, {
  263. params: {
  264. rule_id: item.rule_id,
  265. status: item.enable == 1 ? 0 : 1
  266. }
  267. }).then((res) => {
  268. var res = res.data;
  269. this.$loading(this.$loadingConfig).close();
  270. if (res && res.errno == 0) {
  271. this.$message({
  272. message: '操作成功!',
  273. type: 'success'
  274. })
  275. this.init(1)
  276. } else {
  277. this.$message({
  278. message: res.err,
  279. type: 'warning'
  280. })
  281. }
  282. }).catch(() => {
  283. this.$loading(this.$loadingConfig).close();
  284. })
  285. }).catch(() => {
  286. })
  287. },
  288. changeTime (time) {//筛选时间变化
  289. if (!time || time && time.length == 0) {
  290. this.add_date_start = '';
  291. this.add_date_end = '';
  292. } else {
  293. this.add_date_start = time[0]
  294. this.add_date_end = time[1]
  295. }
  296. this.init(1)
  297. },
  298. init (page, type) {
  299. if (type != 'export') {
  300. this.page = page ? page : this.page;
  301. } else {
  302. if (this.total == 0) {
  303. this.$message({
  304. message: '暂无数据可导出',
  305. type: "warning"
  306. })
  307. return
  308. }
  309. }
  310. this.loading = true
  311. this.$axios.get(this.URL.BASEURL + this.URL.massMsg_lists, {
  312. params: {
  313. creator_id: this.user_id_list,
  314. send_time_start: this.add_date_start ? this.add_date_start + ' 00:00:00' : '',
  315. send_time_end: this.add_date_end ? this.$day_format(this.$date_compatible(this.add_date_end + ' 24:00:00')) : '',
  316. page: type == 'export' ? 1 : this.page,
  317. page_size: type == 'export' ? this.$store.state.exportNumber : this.page_size,
  318. sort_column: this.sort_field,
  319. creator_id: this.circleCreate_val,
  320. }
  321. }).then((res) => {
  322. var res = res.data
  323. this.loading = false
  324. if (res && res.errno == 0) {
  325. if (type == 'export') {
  326. this.exportEvent(res.rst.data)
  327. } else {
  328. this.tableData = res.rst.data;
  329. this.total = res.rst.pageInfo.total;
  330. this.pages = res.rst.pageInfo.pages;
  331. }
  332. } else if (res.errno != 4002) {
  333. this.$message({
  334. message: res.err,
  335. type: "warning"
  336. })
  337. }
  338. }).catch((err) => {
  339. this.loading = false
  340. });
  341. },
  342. handleCurrentChange (val) {
  343. this.init(val)
  344. },
  345. exportEvent (data) {
  346. let list = data;
  347. let tHeader = ['企业ID', '群发标题', '发送类型', '发送时间', '消息文本内容', '附件信息', '发送状态', '消息内容总数', '创建人', '消息送达数', '消息发送失败数', '总发送数']
  348. let filterVal = ['corpid', 'name', 'send_type_name', 'send_time', 'content', 'attachments', 'enable_name', 'msg_count', 'creator', 'send_success', 'send_fail', 'send_total']
  349. list.forEach((item) => {
  350. item.send_type_name = item.send_type == 1 ? '立即发送' : item.send_type == 2 ? '定时发送' : '';
  351. item.enable_name = item.enable == -2 ? '已删除' : item.enable == -1 ? '发送失败' : item.enable == 1 ? '待发送' : item.enable == 2 ? '正在发送中' : item.enable == 3 ? '发送完成' : ''
  352. })
  353. let excelDatas = [
  354. {
  355. tHeader: tHeader, // sheet表一头部
  356. filterVal: filterVal, // 表一的数据字段
  357. tableDatas: list, // 表一的整体json数据
  358. sheetName: ''// 表一的sheet名字
  359. }
  360. ]
  361. this.$exportOrder({ excelDatas, name: `员工群发消息(导出时间:${this.$getDay(0)})` })
  362. }
  363. }
  364. }
  365. </script>
  366. <style lang="scss" scoped>
  367. @import "@/style/list.scss";
  368. .tableInfo {
  369. height: 50px;
  370. }
  371. .table_button {
  372. margin: 0 4px;
  373. min-width: 26px;
  374. }
  375. </style>