callLogStatistics.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <!--通话记录统计 -->
  3. <div class="callLogStatistics">
  4. <div class="filteroption">
  5. <el-row class="search_box" type="flex" :gutter="10" justify="space-between">
  6. <el-col :span="16" class="searchs">
  7. <el-date-picker
  8. v-model="statisticvalue1"
  9. size="small"
  10. clearable
  11. type="date"
  12. placeholder="开始日期"
  13. value-format="yyyy-MM-dd"
  14. />
  15. &nbsp;至&nbsp;
  16. <el-date-picker
  17. v-model="statisticvalue2"
  18. size="small"
  19. clearable
  20. type="date"
  21. placeholder="结束日期"
  22. value-format="yyyy-MM-dd"
  23. />
  24. &nbsp;&nbsp;
  25. <el-button
  26. type="primary"
  27. size="small"
  28. @click="searchBtn"
  29. >查询</el-button>
  30. </el-col>
  31. <el-col :span="8" style="text-align:end;">
  32. <el-button
  33. type="primary"
  34. size="small"
  35. :disabled="multipleSelection.length!==1"
  36. @click="start"
  37. >播放</el-button>
  38. <el-button
  39. type="primary"
  40. size="small"
  41. :disabled="multipleSelection.length!==1"
  42. @click="dowmMP3"
  43. >下载</el-button>
  44. </el-col>
  45. </el-row>
  46. </div>
  47. <div class="tableheight">
  48. <table-item
  49. :id="'pdfDom'"
  50. :table-data="statisData"
  51. :column="statisColumn"
  52. :pagination="true"
  53. :pagesize="pagination.size"
  54. :currentpage="pagination.current"
  55. :total="pagination.total"
  56. :for-id="true"
  57. :border="true"
  58. :multiple="true"
  59. :fixed="true"
  60. :isdelete="false"
  61. class="tableFont"
  62. @handleCurrentChange="handleCurrentChange"
  63. @handleSizeChange="handleSizeChange"
  64. @handleSelectionChange="handleSelectionChange"
  65. />
  66. </div>
  67. <el-dialog title="录音播放" :visible.sync="dialogVisible" width="20%" :before-close="pause">
  68. <template>
  69. <center>
  70. <audio
  71. ref="audio"
  72. :src="audioSrc"
  73. autoplay="autoplay"
  74. controls="controls"
  75. >Your browser does not support the audio element.</audio>
  76. </center>
  77. </template>
  78. </el-dialog>
  79. </div>
  80. </template>
  81. <script>
  82. import TableItem from '@/components/TableAuto'
  83. import { IP } from '@/utils/request'
  84. // import MergeModal from './particular_merge'
  85. import { client } from '@/utils/index'
  86. import { getCallRecord } from '@/api/hotline'
  87. import { parseTime } from '@/utils/index'
  88. import { getFileAudio2 } from '@/api/xjWorkSiteCheckApi'
  89. export default {
  90. components: { TableItem },
  91. data() {
  92. const end = new Date()
  93. const start = new Date()
  94. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
  95. return {
  96. dialogVisible: false,
  97. audioSrc: '',
  98. dialogGDVisible: false,
  99. activeName: '1',
  100. actives: [],
  101. activeNum: [],
  102. gdEditRow: {},
  103. // 统计页面
  104. Bm: '',
  105. user: '',
  106. departmentList: [],
  107. UserList: [],
  108. statisticvalue1: parseTime(start, '{y}-{m}-{d}'),
  109. statisticvalue2: parseTime(end, '{y}-{m}-{d}'),
  110. statisData: [], // 统计数据
  111. searchDate: {
  112. start: '',
  113. end: ''
  114. },
  115. // 列表项
  116. Bm2: '',
  117. user2: '',
  118. departmentList2: [],
  119. UserList2: [],
  120. stateList: [{
  121. id: '',
  122. name: '全部'
  123. }, {
  124. id: '0',
  125. name: '已质检'
  126. }, {
  127. id: '1',
  128. name: '未质检'
  129. }],
  130. statisColumn: [
  131. {
  132. label: '员工',
  133. prop: 'empName'
  134. }, {
  135. label: '呼叫类型',
  136. prop: 'callTypeName'
  137. },
  138. {
  139. label: '服务类型',
  140. prop: 'callReasultName'
  141. },
  142. {
  143. label: '用户号码',
  144. prop: 'telephone'
  145. },
  146. {
  147. label: '系统号码',
  148. prop: 'sysphone'
  149. },
  150. {
  151. label: '分机号码',
  152. prop: 'rate'
  153. },
  154. {
  155. label: '呼叫时间',
  156. prop: 'callTime'
  157. },
  158. {
  159. label: '接通时间',
  160. prop: 'connectTime'
  161. },
  162. {
  163. label: '话后处理时间',
  164. prop: 'rate'
  165. },
  166. {
  167. label: '挂机时间',
  168. prop: 'hangupTime'
  169. },
  170. {
  171. label: '呼叫结果',
  172. prop: 'causeValue'
  173. },
  174. {
  175. label: '转坐席结果',
  176. prop: 'rate'
  177. }
  178. ],
  179. pagination: { current: 1, size: 20, total: 0 },
  180. // 详细页面
  181. showStatistic: true,
  182. gdlx: '',
  183. gzxq: '',
  184. date: [],
  185. client: client().height,
  186. value1: parseTime(start, '{y}-{m}-{d}'),
  187. value2: parseTime(end, '{y}-{m}-{d}'),
  188. workOrderType: [],
  189. malfunction: [],
  190. isState: '',
  191. // 总页数
  192. total: 0,
  193. // 数据列表加载等待
  194. listLoading: true,
  195. // 选中内容
  196. multipleSelection: [],
  197. // 模态框标题
  198. dialogTitle: '',
  199. // 添加数据初始化
  200. editData: {},
  201. // 删除模态框标杆
  202. dialogDelete: false,
  203. // 查看 修改按钮标杆
  204. disabledBtn: true,
  205. width: '1200px',
  206. sfQxList: { '0': '清晰', '1': '不清晰' },
  207. sfCbzList: { '0': '有错别字', '1': '无错别字' },
  208. sfSlsxList: { '0': '超过', '1': '未超过' }
  209. }
  210. },
  211. computed: {
  212. mapHeight() {
  213. return '500px'
  214. },
  215. },
  216. watch: {
  217. multipleSelection(value) {
  218. this.disabledBtn = this.multipleSelection.length !== 1
  219. }
  220. },
  221. created() {
  222. this.getStaticInfo()
  223. // this.fetchData();
  224. // getDepartment().then(res => {
  225. // if (res.code === 1) {
  226. // this.departmentList = res.result
  227. // this.departmentList2 = res.result
  228. // }
  229. // })
  230. // getGdgltypeTree().then(res => {
  231. // if (res.code === 1) {
  232. // this.workOrderType = res.result
  233. // }
  234. // })
  235. },
  236. methods: {
  237. // 获取当前页
  238. handleCurrentChange(currentPage) {
  239. this.pagination.current = currentPage
  240. this.getStaticInfo()
  241. },
  242. // 每页多少条
  243. handleSizeChange(pagesize) {
  244. this.pagination.size = pagesize
  245. this.getStaticInfo()
  246. },
  247. // 获取选中数据
  248. handleSelectionChange(value) {
  249. this.multipleSelection = value
  250. },
  251. // 查询
  252. searchBtn() {
  253. this.pagination.current = 1
  254. this.getStaticInfo()
  255. },
  256. /**
  257. * 获取统计数据
  258. */
  259. getStaticInfo() {
  260. if (!this.statisticvalue1) {
  261. this.$message.error('请选择开始时间!')
  262. return
  263. }
  264. if (!this.statisticvalue2) {
  265. this.$message.error('请选择结束时间!')
  266. return
  267. }
  268. if (this.statisticvalue1 > this.statisticvalue2) {
  269. this.$message.error('开始时间不能大于结束时间!')
  270. return
  271. }
  272. const params = {
  273. endTime: this.statisticvalue2 + ' 23:59:59',
  274. startTime: this.statisticvalue1 + ' 00:00:00'
  275. }
  276. Object.assign(params, this.pagination)
  277. getCallRecord(params).then(res => {
  278. if (res.code == 1) {
  279. this.statisData = res.result.records
  280. this.pagination.total = res.result.total
  281. }
  282. })
  283. },
  284. start() {
  285. if (!this.multipleSelection[0].recordFile) {
  286. this.$message.info('暂无音频')
  287. return
  288. }
  289. this.dialogVisible = true
  290. var token = this.$store.state.user.token
  291. console.log(this.multipleSelection,'this.multipleSelection')
  292. // this.audioSrc = `${IP}/base/file/loadAudio?remotePath=http://172.31.21.200.8089/calllist${this.multipleSelection[0].recordFile}&access_token=${token}`
  293. this.audioSrc = `http://172.31.21.200:8089/calllist${this.multipleSelection[0].recordFile}`
  294. this.$nextTick(()=>{
  295. console.log(this.$refs.audio,'audio')
  296. this.$refs.audio.play()
  297. })
  298. // })
  299. },
  300. pause() {
  301. this.dialogVisible = false
  302. this.$refs.audio.pause()
  303. this.$refs.audio.currentTime = 0
  304. },
  305. dowmMP3() {
  306. if (!this.multipleSelection[0].recordFile) {
  307. this.$message.info('暂无音频')
  308. return
  309. }
  310. getFileAudio2(
  311. this.$store.state.user.token,
  312. this.multipleSelection[0].recordFile).then(src => {
  313. console.log(src,'src')
  314. let BLOB = new Blob([src]);
  315. console.log(BLOB,'blob')
  316. let url = window.URL.createObjectURL(BLOB);
  317. console.log(url,'url')
  318. const a = document.createElement('a')
  319. a.download = '录音文件'
  320. // 后端设置的文件名称在res.headers的 "content-disposition": "form-data; name=\"attachment\"; filename=\"20181211191944.zip\"",
  321. a.href = url
  322. console.log(a.href,'href')
  323. document.body.appendChild(a)
  324. a.click()
  325. document.body.removeChild(a)
  326. })
  327. },
  328. /**
  329. * @description 判断字符串是否为空
  330. */
  331. strIsNull(strVal) {
  332. strVal = strVal || ''
  333. return (typeof (strVal) === 'undefined' || strVal == null || strVal == '')
  334. },
  335. exportPdf() {
  336. this.getPdf('工单质检统计')
  337. }
  338. }
  339. }
  340. </script>
  341. <style lang="scss" scoped>
  342. .callLogStatistics {
  343. height: 100%;
  344. width: 100%;
  345. padding: 5px;
  346. .filteroption {
  347. width: 100%;
  348. height: 40px;
  349. font-size: 14px;
  350. display: flex;
  351. align-items: center;
  352. .search_box{
  353. width: 100%;
  354. }
  355. }
  356. .tableheight {
  357. margin-top: 4px;
  358. height: calc(100% - 44px);
  359. }
  360. .delete {
  361. display: flex;
  362. flex-direction: column;
  363. justify-content: center;
  364. align-items: center;
  365. :nth-child(1) {
  366. font-size: 50px;
  367. color: red;
  368. margin-bottom: 10px;
  369. }
  370. p {
  371. font-size: 20px;
  372. }
  373. }
  374. .dialog_style {
  375. width: 100%;
  376. /deep/ .el-table {
  377. text-align: center;
  378. vertical-align: middle;
  379. }
  380. }
  381. /deep/ .dialog > div > div:nth-child(2) {
  382. padding: 10px 20px;
  383. }
  384. .datebox{
  385. display: flex;
  386. justify-content: center;
  387. align-items: center;
  388. }
  389. /deep/ .el-table__footer-wrapper td{
  390. text-align: center !important;
  391. }
  392. }
  393. .Cecharts{
  394. margin-top: 10px;
  395. height: 375px;
  396. width: 90%;
  397. }
  398. </style>