diff --git a/src/components/team/dialog.vue b/src/components/team/dialog.vue index 55b9a95ad0a2fb0df73c18972ff515fcc36ac196..9c83c1e34850ff46f7750e9815a0ee8709a87c42 100644 --- a/src/components/team/dialog.vue +++ b/src/components/team/dialog.vue @@ -23,7 +23,7 @@ <template slot-scope="scope">{{scope.row.mobile || '-'}}</template> </el-table-column> <el-table-column label="æ„å‘度"> - <template slot-scope="scope">{{scope.row.intention || '-'}}</template> + <template slot-scope="scope">{{transIntention(scope.row.intention)}}</template> </el-table-column> <el-table-column label="最近备注时间"> <template slot-scope="scope"> @@ -62,7 +62,7 @@ <template slot-scope="scope">{{scope.row.mobile || '-'}}</template> </el-table-column> <el-table-column label="æ„å‘度"> - <template slot-scope="scope">{{scope.row.intention || '-'}}</template> + <template slot-scope="scope">{{transIntention(scope.row.intention)}}</template> </el-table-column> <el-table-column label="最近备注时间"> <template slot-scope="scope"> @@ -101,7 +101,7 @@ <template slot-scope="scope">{{scope.row.contact_phone || '-'}}</template> </el-table-column> <el-table-column label="æ„å‘度"> - <template slot-scope="scope">{{scope.row.intention || '-'}}</template> + <template slot-scope="scope">{{transIntention(scope.row.intention)}}</template> </el-table-column> <el-table-column label="最近备注时间"> <template slot-scope="scope"> @@ -175,6 +175,7 @@ <script> import {getVisitedApi, getClassOpenedApi, getAchievementApi, getPhoneRecordApi, getValidchatApi} from "@service/api"; + import {CALLBACK_INTENTION} from "@/util/wordbook"; import page from '@framework/page' export default { @@ -210,6 +211,18 @@ } }, + transIntention(string) { + var result; + if (string) { + result = CALLBACK_INTENTION.find(i => { + return i.value == string + }).label + } else { + result = '-' + } + return result + }, + periodName(val) { let str = ''; if (val.goods_id) { diff --git a/src/components/team/hourDialog.vue b/src/components/team/hourDialog.vue index e7430be41abe4676097bef096fbb4c2f76b7e3b8..03131a5928196a789cb1d4e1935ffa383a8cd1e7 100644 --- a/src/components/team/hourDialog.vue +++ b/src/components/team/hourDialog.vue @@ -69,11 +69,11 @@ <template slot-scope="scope">{{scope.row.phone_start_time || '-'}}</template> </el-table-column> <el-table-column label="é€šè¯æ—¶é—´"> - <template slot-scope="scope">{{scope.row.phone_duration ? scope.row.phone_duration + 's' : '-'}}</template> + <template slot-scope="scope">{{transTime(scope.row.phone_duration)}}</template> </el-table-column> <!--todo 转义--> <el-table-column label="æ„å‘度"> - <template slot-scope="scope">{{scope.row.intention || '-'}}</template> + <template slot-scope="scope">{{transIntention(scope.row.intention)}}</template> </el-table-column> <el-table-column label="下次回访时间"> <template slot-scope="scope">{{scope.row.next_visit_at || '-'}}</template> @@ -128,14 +128,14 @@ </el-table-column> <el-table-column v-if="dialog.search.type == '1'" label="呼出时间" width="92px"> - <template slot-scope="scope">{{scope.row.phone_start_time || '-'}}</template> + <template slot-scope="scope">{{scope.row.start_time || '-'}}</template> </el-table-column> <el-table-column v-if="dialog.search.type == '1'" label="é€šè¯æ—¶é—´"> - <template slot-scope="scope">{{scope.row.phone_duration ? scope.row.phone_duration + 's' : '-'}}</template> + <template slot-scope="scope">{{transTime(scope.row.duration)}}</template> </el-table-column> <el-table-column label="æ„å‘度"> - <template slot-scope="scope">{{scope.row.intention || '-'}}</template> + <template slot-scope="scope">{{transIntention(scope.row.intention)}}</template> </el-table-column> <el-table-column label="下次回访时间"> <template slot-scope="scope">{{scope.row.next_visit_at || '-'}}</template> @@ -167,6 +167,8 @@ import PhoneRecord from '@framework/PhoneRecord' import ChatRecord from '@framework/ChatRecord' import page from '@framework/page' + import CommonJs from '@util/common'; + import {CALLBACK_INTENTION} from "@/util/wordbook"; export default { name: "HourDialog", @@ -217,6 +219,21 @@ this.initDialog() }, methods: { + transTime(time) { + return CommonJs.secondFmt(time) || '-' + }, + transIntention(string) { + var result; + if (string) { + result = CALLBACK_INTENTION.find(i => { + return i.value == string + }).label + } else { + result = '-' + } + return result + }, + initDialog() { if (this.dialogObj) { this.show = this.dialogObj.show; diff --git a/src/components/team/index.vue b/src/components/team/index.vue index 417ec79d6e0dcc875652ae12ddc67d15ab2f0daf..e51f785dcbbeab68a4547827ac430158981f3fb2 100644 --- a/src/components/team/index.vue +++ b/src/components/team/index.vue @@ -126,6 +126,7 @@ </span> </el-tooltip> </template> + <template slot-scope="scope">{{transTime(scope.row.phone_total_time)}}</template> </el-table-column> <el-table-column prop="lately_class_num"> @@ -191,10 +192,11 @@ </template> <script> - import page from '@framework/page' - import TeamDialog from './dialog' + import page from '@framework/page'; + import TeamDialog from './dialog'; import {getTeamApi} from '@service/api'; import {TIP_TEAM} from '@util/tipArr'; + import CommonJs from '@util/common'; function getNowFormatDate() { var date = new Date(); @@ -286,7 +288,9 @@ } return ''; }, - + transTime(time) { + return CommonJs.secondFmt(time) || '-' + }, dialogToggle(row, type) { this.dialogObj = { alias: row.alias, // è€å¸ˆå¾®ä¿¡å· diff --git a/src/util/common.js b/src/util/common.js index dc126484904719c5e26c13ef00202a5e8021b1ea..d584ecd1a55bc8713e1c81df7e364f41290ba6f1 100644 --- a/src/util/common.js +++ b/src/util/common.js @@ -1,54 +1,65 @@ import md5 from 'js-md5'; -export default{ - dateFmt:function(date,format) { - var o = { - "M+" : date.getMonth()+1, //month - "d+" : date.getDate(), //day - "h+" : date.getHours(), //hour - "m+" : date.getMinutes(), //minute - "s+" : date.getSeconds(), //second - "q+" : Math.floor((date.getMonth()+3)/3), //quarter - "S" : date.getMilliseconds() //millisecond - } - if(/(y+)/.test(format)) format=format.replace(RegExp.$1, - (date.getFullYear()+"").substr(4 - RegExp.$1.length)); - for(var k in o)if(new RegExp("("+ k +")").test(format)) - format = format.replace(RegExp.$1, - RegExp.$1.length==1 ? o[k] : - ("00"+ o[k]).substr((""+ o[k]).length)); - return format; - }, + +export default { + secondFmt: function (second) { // second 2 hms + var h, m, s; + h = Math.floor(second / 60 / 60); + m = Math.floor(second / 60 % 60); + s = Math.floor(second % 60); + return `${h > 0 ? h + 'h ' : ''}${m > 0 ? m + 'm ' : ''}${s > 0 ? s + 's' : ''}` + }, + dateFmt: function (date, format) { + var o = { + "M+": date.getMonth() + 1, //month + "d+": date.getDate(), //day + "h+": date.getHours(), //hour + "m+": date.getMinutes(), //minute + "s+": date.getSeconds(), //second + "q+": Math.floor((date.getMonth() + 3) / 3), //quarter + "S": date.getMilliseconds() //millisecond + } + if (/(y+)/.test(format)) format = format.replace(RegExp.$1, + (date.getFullYear() + "").substr(4 - RegExp.$1.length)); + for (var k in o) if (new RegExp("(" + k + ")").test(format)) + format = format.replace(RegExp.$1, + RegExp.$1.length == 1 ? o[k] : + ("00" + o[k]).substr(("" + o[k]).length)); + return format; + }, // 将匹é…结果替æ¢è¡¨æƒ…图片 - emotion (res) { - let word = res.replace(/\#|\;/gi,'') + emotion(res) { + let word = res.replace(/\#|\;/gi, '') const list = ['微笑', '撇嘴', '色', 'å‘呆', 'å¾—æ„', 'æµæ³ª', '害羞', 'é—嘴', 'ç¡', '大å“', 'å°´å°¬', '呿€’', '调皮', '呲牙', '惊讶', '难过', 'é…·', '冷汗', '抓狂', 'å', 'å·ç¬‘', 'å¯çˆ±', '白眼', '傲慢', '饥饿', 'å›°', '惊æ', 'æµæ±—', '憨笑', '大兵', '奋斗', '咒骂', 'ç–‘é—®', '嘘', '晕', '折磨', 'è¡°', '骷髅', '敲打', 'å†è§', '擦汗', 'æŠ é¼»', '鼓掌', '糗大了', 'å笑', '左哼哼', 'å³å“¼å“¼', 'å“ˆæ¬ ', '鄙视', '委屈', 'å¿«å“了', '阴险', '亲亲', 'å“', '坿€œ', 'èœåˆ€', '西瓜', '啤酒', '篮çƒ', '乒乓', 'å’–å•¡', 'é¥', '猪头', '玫瑰', '凋谢', '示爱', '爱心', '心碎', '蛋糕', '闪电', '炸弹', '刀', 'è¶³çƒ', '瓢虫', '便便', '月亮', '太阳', '礼物', '拥抱', '强', 'å¼±', 'æ¡æ‰‹', '胜利', '抱拳', '勾引', '拳头', '差劲', 'çˆ±ä½ ', 'NO', 'OK', '爱情', '飞å»', '跳跳', '呿Ж', '怄ç«', '转圈', '磕头', '回头', '跳绳', '挥手', '激动', '街舞', '献å»', '左太æž', 'å³å¤ªæž'] let index = list.indexOf(word) return `<img src="https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/${index}.gif" align="middle">` }, - tipFilter(h,column,tipArr){ - // console.log(column) - // console.log(h) - return h("span", [ - h("span", column.label), - h( - "el-tooltip", - { - props: { - effect: "dark", - content: tipArr[column.label], - placement: "top" - } - }, - [ - h("i", { - class: "el-icon-question", - style: "color:#409eff;display:block;" - }) - ] - ) - ]); + tipFilter(h, column, tipArr) { + // console.log(column) + // console.log(h) + return h("span", [ + h("span", column.label), + h( + "el-tooltip", + { + props: { + effect: "dark", + content: tipArr[column.label], + placement: "top" + } + }, + [ + h("i", { + class: "el-icon-question", + style: "color:#409eff;display:block;" + }) + ] + ) + ]); }, - md5Code(){ - return md5(JSON.stringify({file:md5('file_'+this.dateFmt(new Date(),"yyyy-MM-dd")),sing: "singsingenglish21000"})) + md5Code() { + return md5(JSON.stringify({ + file: md5('file_' + this.dateFmt(new Date(), "yyyy-MM-dd")), + sing: "singsingenglish21000" + })) } }