Commit c2c7d4cc by xinla

修改bug

1 parent 9f5cb278
...@@ -14,16 +14,18 @@ export default { ...@@ -14,16 +14,18 @@ export default {
type: String, type: String,
default: '选择标签' default: '选择标签'
}, },
// selected: {
// type: Array,
// default: () => [],
// },
// "标签分组类型(1:客户标签;2:群标签)" // "标签分组类型(1:客户标签;2:群标签)"
type: { type: {
type: String, type: String,
default: '1' default: '1'
}, },
destroyOnClose: Boolean, destroyOnClose: Boolean,
// 已选中的标签,一般用于回显
selected: {
type: Array,
default: () => []
},
// 已选中的标签,一般用于回显,(下一主版本弃用)
defaultValues: { defaultValues: {
type: Array, type: Array,
default: () => [] default: () => []
...@@ -38,6 +40,13 @@ export default { ...@@ -38,6 +40,13 @@ export default {
} }
}, },
watch: { watch: {
selected: {
handler(val = []) {
this.selectedList = [...val]
},
immediate: true
},
// 下一主版本弃用
defaultValues: { defaultValues: {
handler(val = []) { handler(val = []) {
this.selectedList = [...val] this.selectedList = [...val]
......
<script> <script>
import { upload } from '@/api/material' import { upload } from '@/api/material'
import Video from 'video.js' import Video from 'video.js'
import BenzAMRRecorder from 'benz-amr-recorder'
export default { export default {
name: 'Upload', name: 'Upload',
components: {}, components: {},
...@@ -50,7 +51,7 @@ export default { ...@@ -50,7 +51,7 @@ export default {
created() {}, created() {},
mounted() {}, mounted() {},
methods: { methods: {
handleBeforeUpload(file) { async handleBeforeUpload(file) {
this.loading = true this.loading = true
let isFormat = true, let isFormat = true,
isSize = true isSize = true
...@@ -76,6 +77,17 @@ export default { ...@@ -76,6 +77,17 @@ export default {
if (!isSize) { if (!isSize) {
this.$message.error('上传文件大小不能超过 2MB!') this.$message.error('上传文件大小不能超过 2MB!')
} }
let amr = new BenzAMRRecorder()
try {
await amr.initWithBlob(file)
isSize = amr.getDuration() <= 60
if (!isSize) {
this.$message.error('上传文件时长不能超过 60秒!')
}
} catch (error) {
console.log(error)
this.$message.error('文件损坏')
}
} else if (this.type === '2') { } else if (this.type === '2') {
// 视频 // 视频
isFormat = file.type === 'video/mp4' isFormat = file.type === 'video/mp4'
......
...@@ -40,9 +40,10 @@ export default { ...@@ -40,9 +40,10 @@ export default {
this.$playRec.onEnded(() => { this.$playRec.onEnded(() => {
this.actived = false this.actived = false
}) })
console.log('amr 时长:' + this.$playRec.getDuration())
}) })
.catch(e => { .catch((e) => {
this.$message.error('播放录音失败') this.$message.error('播放录音失败,或文件损坏')
}) })
} }
// this.audioSrc = [JSON.parse(this.message.contact)[type]] // this.audioSrc = [JSON.parse(this.message.contact)[type]]
......
...@@ -9,6 +9,10 @@ $yellow: #ffcf0e; ...@@ -9,6 +9,10 @@ $yellow: #ffcf0e;
$panGreen: #30b08f; $panGreen: #30b08f;
$grayBg: #efeff4; $grayBg: #efeff4;
$sub-text-color: #999;
.sub-text-color {
color: $sub-text-color;
}
// sidebar // sidebar
$menuText: #333; $menuText: #333;
$menuActiveText: #333; $menuActiveText: #333;
......
...@@ -193,7 +193,7 @@ export default { ...@@ -193,7 +193,7 @@ export default {
<div class="mid-action"> <div class="mid-action">
<div> <div>
<el-button type="primary" @click="goRoute()">新建自动拉群</el-button> <el-button type="primary" @click="goRoute()">新建活码</el-button>
</div> </div>
<div> <div>
<el-button type="primary" :disabled="!ids.length" @click="downloadBatch()" <el-button type="primary" :disabled="!ids.length" @click="downloadBatch()"
...@@ -224,28 +224,20 @@ export default { ...@@ -224,28 +224,20 @@ export default {
</el-image> </el-image>
</template> --> </template> -->
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="emplList" label="使用员工" align="center">
prop="emplList" <template #default="{ row }">
label="使用员工" <el-popover
align="center" v-if="row.emplList"
:show-overflow-tooltip="true" placement="bottom"
trigger="hover"
:content="row.emplList.map((d) => d.businessName).join()"
> >
<div v-if="row.emplList" slot-scope="{ row }"> <div slot="reference" class="table-desc toe">
<el-popover placement="bottom" trigger="hover" :disabled="row.emplList.length < 3"> <!-- {{ getDisplayRealGroups(row) }} -->
<div> {{ row.emplList.map((d) => d.businessName).join() }}
<el-tag v-for="(unit, unique) in row.emplList" :key="unique">
{{ unit.businessName }}
</el-tag>
</div>
<div slot="reference">
<el-tag v-for="(unit, unique) in row.emplList.slice(0, 2)" :key="unique">
{{ unit.businessName }}
</el-tag>
<el-tag key="a" v-if="row.emplList.length > 2">...</el-tag>
</div> </div>
</el-popover> </el-popover>
</div> </template>
<span v-else>无</span>
</el-table-column> </el-table-column>
<el-table-column label="客户标签" align="center"> <el-table-column label="客户标签" align="center">
<div v-if="row.tagList" slot-scope="{ row }"> <div v-if="row.tagList" slot-scope="{ row }">
......
...@@ -291,15 +291,15 @@ export default { ...@@ -291,15 +291,15 @@ export default {
<div v-if="row.tagList" slot-scope="{ row }"> <div v-if="row.tagList" slot-scope="{ row }">
<el-popover placement="bottom" trigger="hover" :disabled="row.tagList.length < 3"> <el-popover placement="bottom" trigger="hover" :disabled="row.tagList.length < 3">
<div> <div>
<el-tag type="info" v-for="(unit, unique) in row.tagList" :key="unique"> <el-tag v-for="(unit, unique) in row.tagList" :key="unique">
{{ unit.name }} {{ unit.name }}
</el-tag> </el-tag>
</div> </div>
<div slot="reference"> <div slot="reference">
<el-tag type="info" v-for="(unit, unique) in row.tagList.slice(0, 2)" :key="unique"> <el-tag v-for="(unit, unique) in row.tagList.slice(0, 2)" :key="unique">
{{ unit.name }} {{ unit.name }}
</el-tag> </el-tag>
<el-tag type="info" key="a" v-if="row.tagList.length > 2">...</el-tag> <el-tag key="a" v-if="row.tagList.length > 2">...</el-tag>
</div> </div>
</el-popover> </el-popover>
</div> </div>
......
...@@ -206,6 +206,10 @@ export default { ...@@ -206,6 +206,10 @@ export default {
// this.$refs.selectTag.$forceUpdate() // this.$refs.selectTag.$forceUpdate()
}, },
sync() { sync() {
if (this.isSync) {
this.msgError('由于企业微信开放平台的限制,两小时内不得重复同步操作')
return
}
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
text: 'Loading', text: 'Loading',
...@@ -216,6 +220,7 @@ export default { ...@@ -216,6 +220,7 @@ export default {
.sync() .sync()
.then(() => { .then(() => {
loading.close() loading.close()
this.getList(1)
this.msgSuccess('后台开始同步数据,请稍后关注进度') this.msgSuccess('后台开始同步数据,请稍后关注进度')
}) })
.catch((fail) => { .catch((fail) => {
...@@ -344,9 +349,7 @@ export default { ...@@ -344,9 +349,7 @@ export default {
<div class="tag-input" @click="showTagDialog"> <div class="tag-input" @click="showTagDialog">
<span class="tag-place" v-if="!queryTag.length">请选择</span> <span class="tag-place" v-if="!queryTag.length">请选择</span>
<template v-else> <template v-else>
<el-tag type="info" v-for="(unit, unique) in queryTag" :key="unique">{{ <el-tag v-for="(unit, unique) in queryTag" :key="unique">{{ unit.name }}</el-tag>
unit.name
}}</el-tag>
</template> </template>
</div> </div>
</el-form-item> </el-form-item>
...@@ -354,9 +357,7 @@ export default { ...@@ -354,9 +357,7 @@ export default {
<div class="tag-input" @click="dialogVisibleSelectUser = true"> <div class="tag-input" @click="dialogVisibleSelectUser = true">
<span class="tag-place" v-if="!queryUser.length">请选择</span> <span class="tag-place" v-if="!queryUser.length">请选择</span>
<template v-else> <template v-else>
<el-tag type="info" v-for="(unit, unique) in queryUser" :key="unique">{{ <el-tag v-for="(unit, unique) in queryUser" :key="unique">{{ unit.name }}</el-tag>
unit.name
}}</el-tag>
</template> </template>
</div> </div>
</el-form-item> </el-form-item>
...@@ -418,7 +419,8 @@ export default { ...@@ -418,7 +419,8 @@ export default {
<span class="num">{{ total }}</span> 位客户,实际客户 <span class="num">{{ total }}</span> 位客户,实际客户
<span class="num">{{ total }}</span> 位。 --> <span class="num">{{ total }}</span> 位。 -->
<el-tooltip <el-tooltip
:disabled="isSync" effect="light"
:disabled="!isSync"
class="item" class="item"
content="由于企业微信开放平台的限制,两小时内不得重复同步操作" content="由于企业微信开放平台的限制,两小时内不得重复同步操作"
placement="top-start" placement="top-start"
...@@ -426,18 +428,17 @@ export default { ...@@ -426,18 +428,17 @@ export default {
<el-button <el-button
v-hasPermi="['customerManage:customer:sync']" v-hasPermi="['customerManage:customer:sync']"
v-preventReClick v-preventReClick
:disabled="isSync"
type="primary" type="primary"
@click="sync" @click="sync"
>同步客户</el-button >同步客户</el-button
> >
</el-tooltip> </el-tooltip>
<!-- <el-button v-hasPermi="['customerManage:customer:checkRepeat']" type="primary">查看重复客户</el-button> --> <!-- <el-button v-hasPermi="['customerManage:customer:checkRepeat']" type="primary">查看重复客户</el-button> -->
<span> 最近同步:{{ lastSyncTime }} </span> <span class="sub-text-color"> 最近同步:{{ lastSyncTime }} </span>
</div> </div>
</div> </div>
<div>客户总数(去重):{{ noRepeatCustomerTotal }}</div> <div class="sub-text-color">客户总数(去重):{{ noRepeatCustomerTotal }}</div>
<el-table <el-table
ref="table" ref="table"
...@@ -451,7 +452,11 @@ export default { ...@@ -451,7 +452,11 @@ export default {
<el-table-column label="客户" prop="customerName" align="center"> <el-table-column label="客户" prop="customerName" align="center">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<div class="cp flex aic" @click="goRoute(row)"> <div class="cp flex aic" @click="goRoute(row)">
<el-image style="width: 50px; height: 50px;" :src="row.avatar" fit="fit"></el-image> <el-image
style="width: 50px; height: 50px; flex:none;"
:src="row.avatar"
fit="fit"
></el-image>
<div class="ml10"> <div class="ml10">
{{ row.customerName }} {{ row.customerName }}
<span :style="{ color: row.customerType === 1 ? '#4bde03' : '#f9a90b' }">{{ <span :style="{ color: row.customerType === 1 ? '#4bde03' : '#f9a90b' }">{{
...@@ -462,19 +467,19 @@ export default { ...@@ -462,19 +467,19 @@ export default {
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="tagNames" label="客户标签" align="center"> <el-table-column prop="tagNames" label="客户标签" align="center" width="220">
<div v-if="row.tagNames" slot-scope="{ row }"> <div v-if="row.tagNames" slot-scope="{ row }">
<el-popover placement="bottom" trigger="hover" :disabled="row.tagNames.length < 3"> <el-popover placement="bottom" trigger="hover" :disabled="row.tagNames.length < 3">
<div> <div>
<el-tag type="info" v-for="(unit, unique) in row.tagNames" :key="unique"> <el-tag v-for="(unit, unique) in row.tagNames" :key="unique">
{{ unit }} {{ unit }}
</el-tag> </el-tag>
</div> </div>
<div slot="reference"> <div slot="reference">
<el-tag type="info" v-for="(unit, unique) in row.tagNames.slice(0, 2)" :key="unique"> <el-tag v-for="(unit, unique) in row.tagNames.slice(0, 2)" :key="unique">
{{ unit }} {{ unit }}
</el-tag> </el-tag>
<el-tag type="info" key="a" v-if="row.tagNames.length > 2">...</el-tag> <el-tag key="a" v-if="row.tagNames.length > 2">...</el-tag>
</div> </div>
</el-popover> </el-popover>
</div> </div>
...@@ -502,7 +507,7 @@ export default { ...@@ -502,7 +507,7 @@ export default {
}}</template> --> }}</template> -->
</el-table-column> </el-table-column>
<el-table-column label="操作" width="160" align="center"> <el-table-column label="操作" width="200" align="center">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<el-button <el-button
v-hasPermi="['customerManage:customer:view']" v-hasPermi="['customerManage:customer:view']"
......
...@@ -25,10 +25,15 @@ export default { ...@@ -25,10 +25,15 @@ export default {
}, },
recod: [], recod: [],
active: '0', active: '0',
openTrack: ['0'] openTrack: ['0'],
lastSyncTime: 0
}
},
computed: {
isSync() {
return (+new Date() - +new Date(this.lastSyncTime)) / 3600000 < 2
} }
}, },
computed: {},
watch: {}, watch: {},
created() { created() {
this.userId ? this.getCustomerInfoByUserId() : this.getSummary() this.userId ? this.getCustomerInfoByUserId() : this.getSummary()
...@@ -77,8 +82,13 @@ export default { ...@@ -77,8 +82,13 @@ export default {
this.active = type this.active = type
}, },
sync() { sync() {
this.openTrack = [null] if (this.isSync) {
this.msgError('由于企业微信开放平台的限制,两小时内不得重复同步操作')
return
}
this.openTrack = ['0']
this.active = '0' this.active = '0'
this.$refs['record'][0].$forceUpdate()
} }
} }
} }
...@@ -96,7 +106,8 @@ export default { ...@@ -96,7 +106,8 @@ export default {
:key="index" :key="index"
:class="['flex', index && 'mt20']" :class="['flex', index && 'mt20']"
> >
<div style="width:60px;flex: none;">{{ item.userName }}:</div> <div class="name oe">{{ item.userName }}</div>
:
<template v-if="item.tagNames"> <template v-if="item.tagNames">
<el-tag <el-tag
type="info" type="info"
...@@ -105,7 +116,7 @@ export default { ...@@ -105,7 +116,7 @@ export default {
>{{ unit }}</el-tag >{{ unit }}</el-tag
> >
</template> </template>
<div v-else> <div v-else class="sub-text-color">
暂无标签 暂无标签
</div> </div>
</div> </div>
...@@ -118,7 +129,8 @@ export default { ...@@ -118,7 +129,8 @@ export default {
:key="index" :key="index"
:class="['flex', index && 'mt20']" :class="['flex', index && 'mt20']"
> >
<div style="width:60px;flex: none;">{{ item.userName }}:</div> <div class="name oe">{{ item.userName }}</div>
:
<template v-if="item.tagNames"> <template v-if="item.tagNames">
<el-tag <el-tag
type="info" type="info"
...@@ -127,7 +139,7 @@ export default { ...@@ -127,7 +139,7 @@ export default {
>{{ unit }}</el-tag >{{ unit }}</el-tag
> >
</template> </template>
<div v-else> <div v-else class="sub-text-color">
暂无标签 暂无标签
</div> </div>
</div> </div>
...@@ -135,8 +147,10 @@ export default { ...@@ -135,8 +147,10 @@ export default {
<el-card class="mb10" shadow="never"> <el-card class="mb10" shadow="never">
<div slot="header" class="card-title">跟进状态</div> <div slot="header" class="card-title">跟进状态</div>
<template v-if="portrayalSum.trackStates && portrayalSum.trackStates.length">
<div class="fxbw mb20" v-for="(item, index) of portrayalSum.trackStates" :key="index"> <div class="fxbw mb20" v-for="(item, index) of portrayalSum.trackStates" :key="index">
<div style="width:60px;flex: none;">{{ item.userName }}:</div> <div class="name oe">{{ item.userName }}</div>
:
<el-steps <el-steps
style="flex:auto;" style="flex:auto;"
:active="item.trackStateList.length" :active="item.trackStateList.length"
...@@ -150,11 +164,13 @@ export default { ...@@ -150,11 +164,13 @@ export default {
></el-step> ></el-step>
</el-steps> </el-steps>
</div> </div>
</template>
<div v-else class="ac sub-text-color">暂无数据</div>
</el-card> </el-card>
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="card-title">跟进记录</div> <div slot="header" class="card-title">跟进记录</div>
<el-tabs value="0"> <el-tabs v-if="portrayalSum.trackStates && portrayalSum.trackStates.length" value="0">
<el-tab-pane <el-tab-pane
v-for="(item, index) in portrayalSum.trackStates" v-for="(item, index) in portrayalSum.trackStates"
:key="index" :key="index"
...@@ -163,15 +179,32 @@ export default { ...@@ -163,15 +179,32 @@ export default {
<record :userId="item.userId" viewType="1"></record> <record :userId="item.userId" viewType="1"></record>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<div v-else class="ac sub-text-color">暂无数据</div>
</el-card> </el-card>
</div> </div>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<div class="right"> <div class="right">
<el-card> <el-card>
<div slot="header"> <div slot="header">
<span class="card-title">客户轨迹</span> <span class="card-title">客户轨迹</span>
<span style=" color: #13a2e8;" class="fr cp" @click="sync">同步</span> <el-tooltip
effect="light"
:disabled="!isSync"
class="item"
content="由于企业微信开放平台的限制,两小时内不得重复同步操作"
placement="top-start"
>
<el-button
v-preventReClick
style="color: #13a2e8;padding: 0;"
class="fr cp"
type="text"
@click="sync"
>同步</el-button
>
</el-tooltip>
</div> </div>
<div class="flex track-tab-wrap mb15"> <div class="flex track-tab-wrap mb15">
<div <div
...@@ -185,6 +218,7 @@ export default { ...@@ -185,6 +218,7 @@ export default {
</div> </div>
<template v-for="(item, index) in openTrack"> <template v-for="(item, index) in openTrack">
<record <record
ref="record"
v-show="item === active" v-show="item === active"
:key="index" :key="index"
:userId="userId" :userId="userId"
...@@ -199,6 +233,11 @@ export default { ...@@ -199,6 +233,11 @@ export default {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.name {
width: 65px;
flex: none;
text-align: right;
}
.el-card { .el-card {
.el-row { .el-row {
color: #666; color: #666;
......
...@@ -83,16 +83,16 @@ export default { ...@@ -83,16 +83,16 @@ export default {
<div class="ml10"> <div class="ml10">
<div> <div>
{{ customer.customerName + (customer.corpName ? '-' + customer.corpName : '') }} {{ customer.customerName + (customer.corpName ? '-' + customer.corpName : '') }}
<span :style="{ color: customer.customerType === 1 ? '#4bde03' : '#f9a90b' }">{{ <span :style="{ color: customer.customerType === 1 ? '#4bde03' : '#f9a90b' }">
{ 1: '@微信', 2: '@企业微信' }[customer.customerType] {{ { 1: '@微信', 2: '@企业微信' }[customer.customerType] }}
}}</span> </span>
<i :class="['el-icon-s-custom', { 1: 'man', 2: 'woman' }[customer.gender]]"></i> <i :class="['el-icon-s-custom', { 1: 'man', 2: 'woman' }[customer.gender]]"></i>
</div> </div>
<div class="mt10"> <div class="mt10">
<template v-if="customer.tagNames"> <template v-if="customer.tagNames">
<el-tag v-for="(unit, unique) in customer.tagNames.split(',')" :key="unique">{{ <el-tag v-for="(unit, unique) in customer.tagNames.split(',')" :key="unique">
unit {{ unit }}
}}</el-tag> </el-tag>
</template> </template>
<div v-else> <div v-else>
暂无标签 暂无标签
......
...@@ -26,8 +26,8 @@ export default { ...@@ -26,8 +26,8 @@ export default {
ids: [], ids: [],
// 非多个禁用 // 非多个禁用
multiple: true, multiple: true,
// 总条数
lastSyncTime: '', lastSyncTime: '',
// 总条数
total: 0, total: 0,
// 表格数据 // 表格数据
list: [], list: [],
...@@ -41,6 +41,11 @@ export default { ...@@ -41,6 +41,11 @@ export default {
makeLabelCustomerList: [] makeLabelCustomerList: []
} }
}, },
computed: {
isSync() {
return (+new Date() - +new Date(this.lastSyncTime)) / 3600000 < 2
}
},
created() { created() {
this.getList() this.getList()
}, },
...@@ -138,6 +143,10 @@ export default { ...@@ -138,6 +143,10 @@ export default {
this.getList(1) this.getList(1)
}, },
sync() { sync() {
if (this.isSync) {
this.msgError('由于企业微信开放平台的限制,两小时内不得重复同步操作')
return
}
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
text: 'Loading', text: 'Loading',
...@@ -187,9 +196,7 @@ export default { ...@@ -187,9 +196,7 @@ export default {
<div class="tag-input" @click="showTagDialog"> <div class="tag-input" @click="showTagDialog">
<span class="tag-place" v-if="!queryTag.length">请选择</span> <span class="tag-place" v-if="!queryTag.length">请选择</span>
<template v-else> <template v-else>
<el-tag type="info" v-for="(unit, unique) in queryTag" :key="unique">{{ <el-tag v-for="(unit, unique) in queryTag" :key="unique">{{ unit.name }}</el-tag>
unit.name
}}</el-tag>
</template> </template>
</div> </div>
</el-form-item> </el-form-item>
...@@ -224,7 +231,7 @@ export default { ...@@ -224,7 +231,7 @@ export default {
<el-button v-hasPermi="['customerManage:group:sync']" type="primary" @click="sync" <el-button v-hasPermi="['customerManage:group:sync']" type="primary" @click="sync"
>同步客户群</el-button >同步客户群</el-button
> >
<span> <span class="sub-text-color">
最近同步:{{ lastSyncTime }} 最近同步:{{ lastSyncTime }}
<!-- <span class="num">{{total}}</span> 条信息 , <!-- <span class="num">{{total}}</span> 条信息 ,
共 共
...@@ -244,22 +251,22 @@ export default { ...@@ -244,22 +251,22 @@ export default {
<el-table-column label="群主" align="center" prop="groupLeaderName" /> <el-table-column label="群主" align="center" prop="groupLeaderName" />
<el-table-column label="群人数" align="center" prop="memberNum" /> <el-table-column label="群人数" align="center" prop="memberNum" />
<el-table-column prop="tagNames" label="群标签" align="center"> <el-table-column prop="tagNames" label="群标签" align="center">
<template slot-scope="{ row }"> <div v-if="row.tagNames" slot-scope="{ row }">
<template v-if="row.tags"> <el-popover placement="bottom" trigger="hover">
<template v-for="(item, index) in row.tags"> <div>
<el-tag size="mini" v-if="index < 2" :key="index">{{ item }}</el-tag> <el-tag v-for="(unit, unique) in row.tags" :key="unique">
</template> {{ unit }}
<el-popover trigger="hover" width="200" v-if="row.tags.length > 2"> </el-tag>
<template v-for="(unit, index) in row.tags"> </div>
<el-tag class="mb5" :key="index" v-if="index > 1" size="mini">{{ unit }}</el-tag> <div slot="reference">
</template> <el-tag v-for="(unit, unique) in row.tags.slice(0, 2)" :key="unique">
<div style="display:inline;" slot="reference"> {{ unit }}
<el-tag size="mini">...</el-tag> </el-tag>
<el-tag key="a" v-if="row.tags.length > 2">...</el-tag>
</div> </div>
</el-popover> </el-popover>
</template> </div>
<span v-else>无标签</span> <span v-else>无标签</span>
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="创建时间" label="创建时间"
......
...@@ -222,9 +222,10 @@ export default { ...@@ -222,9 +222,10 @@ export default {
<!-- 选择标签弹窗 --> <!-- 选择标签弹窗 -->
<SelectTag <SelectTag
ref="selectTag" ref="selectTag"
type="2"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:title="tagDialogType.title" :title="tagDialogType.title"
:selected="selectedTag" :defaultValues="selectedTag"
@success="submitSelectTag" @success="submitSelectTag"
> >
</SelectTag> </SelectTag>
......
...@@ -42,7 +42,13 @@ export default { ...@@ -42,7 +42,13 @@ export default {
// 总条数 // 总条数
total: 0, total: 0,
// 表格数据 // 表格数据
list: [] list: [],
lastSyncTime: 0
}
},
computed: {
isSync() {
return (+new Date() - +new Date(this.lastSyncTime)) / 3600000 < 2
} }
}, },
created() { created() {
...@@ -55,9 +61,10 @@ export default { ...@@ -55,9 +61,10 @@ export default {
this.loading = true this.loading = true
api api
.getList(this.query) .getList(this.query)
.then(({ rows, total }) => { .then(({ rows, total, lastSyncTime }) => {
this.list = rows this.list = rows
this.total = +total this.total = +total
this.lastSyncTime = lastSyncTime
this.loading = false this.loading = false
}) })
.catch(() => { .catch(() => {
...@@ -71,17 +78,26 @@ export default { ...@@ -71,17 +78,26 @@ export default {
this.dialogVisible = true this.dialogVisible = true
}, },
syncTag() { syncTag() {
if (this.isSync) {
this.msgError('由于企业微信开放平台的限制,两小时内不得重复同步操作')
return
}
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
text: 'Loading', text: 'Loading',
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}) })
api.syncTag().then(() => { api
.syncTag()
.then(() => {
loading.close() loading.close()
this.msgSuccess('操作成功') this.msgSuccess('后台开始同步数据,请稍后关注进度')
this.getList() this.getList()
}) })
.catch(() => {
loading.close()
})
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
...@@ -112,14 +128,17 @@ export default { ...@@ -112,14 +128,17 @@ export default {
<el-button v-hasPermi="['customerManage:tag:add']" type="primary" @click="edit()" <el-button v-hasPermi="['customerManage:tag:add']" type="primary" @click="edit()"
>新建标签组</el-button >新建标签组</el-button
> >
<el-button <el-tooltip
v-if="type == 1" effect="light"
v-hasPermi="['customerManage:tag:sync']" :disabled="!isSync"
type="primary" class="item"
plain content="由于企业微信开放平台的限制,两小时内不得重复同步操作"
@click="syncTag" placement="top-start"
>同步企微标签</el-button
> >
<el-button v-if="type == 1" v-preventReClick type="primary" plain @click="syncTag">
同步企微标签
</el-button>
</el-tooltip>
</div> </div>
<div> <div>
<el-button <el-button
...@@ -136,19 +155,22 @@ export default { ...@@ -136,19 +155,22 @@ export default {
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="标签组" align="center" prop="gourpName" /> <el-table-column label="标签组" align="center" prop="gourpName" />
<el-table-column label="标签" align="center" prop="weTags"> <el-table-column label="标签" align="center" prop="weTags">
<template slot-scope="scope"> <div v-if="row.weTags" slot-scope="{ row }">
<template v-for="(item, index) in scope.row.weTags"> <el-popover placement="bottom" trigger="hover" :disabled="row.weTags.length < 3">
<el-tag v-if="index < 3" type="primary" :key="index">{{ item.name }}</el-tag> <div>
</template> <el-tag v-for="(unit, unique) in row.weTags" :key="unique">
<el-popover trigger="hover" width="200"> {{ unit.name }}
<template v-for="(unit, index) in scope.row.weTags"> </el-tag>
<el-tag :key="index" v-if="index >= 3" size="mini">{{ unit.name }}</el-tag> </div>
</template> <div slot="reference">
<div style="display:inline;" slot="reference"> <el-tag v-for="(unit, unique) in row.weTags.slice(0, 2)" :key="unique">
<el-tag v-if="scope.row.weTags.length > 3" size="mini">...</el-tag> {{ unit.name }}
</el-tag>
<el-tag key="a" v-if="row.weTags.length > 2">...</el-tag>
</div> </div>
</el-popover> </el-popover>
</template> </div>
<span v-else>无标签</span>
</el-table-column> </el-table-column>
<!-- <el-table-column label="创建人" align="center" prop="createBy" /> --> <!-- <el-table-column label="创建人" align="center" prop="createBy" /> -->
<!-- <el-table-column label="创建时间" align="center" prop="operTime" width="180"> <!-- <el-table-column label="创建时间" align="center" prop="operTime" width="180">
......
<script> <script>
import MaPage from '@/views/material/components/MaPage' import MaPage from '@/views/material/components/MaPage'
import Voice from '@/components/Voice'
export default { export default {
name: 'Audio', name: 'Audio',
components: { MaPage }, components: { MaPage, Voice },
data() { data() {
return { return {
ids: [] // 选中数组 ids: [] // 选中数组
...@@ -24,7 +25,11 @@ export default { ...@@ -24,7 +25,11 @@ export default {
<MaPage ref="page" type="1" :selected="ids" v-slot="{ list }"> <MaPage ref="page" type="1" :selected="ids" v-slot="{ list }">
<el-table :data="list" @selection-change="handleSelectionChange"> <el-table :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column label="语音" align="center" prop="materialName" /> <el-table-column label="语音" align="center" prop="materialUrl">
<template slot-scope="{ row }">
<Voice :amrUrl="row.materialUrl"></Voice>
</template>
</el-table-column>
<el-table-column label="时长" align="center" prop="audioTime" /> <el-table-column label="时长" align="center" prop="audioTime" />
<el-table-column label="最近更新时间" align="center" prop="updateTime" width="160"> <el-table-column label="最近更新时间" align="center" prop="updateTime" width="160">
</el-table-column> </el-table-column>
......
...@@ -18,6 +18,7 @@ import 'quill/dist/quill.snow.css' ...@@ -18,6 +18,7 @@ import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css' import 'quill/dist/quill.bubble.css'
import { quillEditor } from 'vue-quill-editor' import { quillEditor } from 'vue-quill-editor'
import Voice from '@/components/Voice'
// import { // import {
// getList // getList
...@@ -39,7 +40,7 @@ var validateHttp = (rule, value, callback) => { ...@@ -39,7 +40,7 @@ var validateHttp = (rule, value, callback) => {
} }
export default { export default {
name: 'MaPage', name: 'MaPage',
components: { quillEditor }, components: { quillEditor, Voice },
props: { props: {
// 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file), 4 文本, 5 海报, 6 海报字体", 7 图文, 8 链接,9 小程序 // 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file), 4 文本, 5 海报, 6 海报字体", 7 图文, 8 链接,9 小程序
type: { type: {
...@@ -149,7 +150,7 @@ export default { ...@@ -149,7 +150,7 @@ export default {
this.loading = true this.loading = true
getList(this.query) getList(this.query)
.then(({ rows, total }) => { .then(({ rows, total }) => {
this.list = rows this.list = rows.sort((a, b) => +new Date(b.updateTime) - +new Date(a.updateTime))
this.total = +total this.total = +total
this.loading = false this.loading = false
this.$emit('listChange', this.list) this.$emit('listChange', this.list)
...@@ -535,6 +536,7 @@ export default { ...@@ -535,6 +536,7 @@ export default {
<template v-else-if="type === '1'"> <template v-else-if="type === '1'">
<el-form-item label="语音" prop="materialUrl"> <el-form-item label="语音" prop="materialUrl">
<Voice v-if="form.materialUrl" :amrUrl="form.materialUrl"></Voice>
<upload <upload
:fileUrl.sync="form.materialUrl" :fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName" :fileName.sync="form.materialName"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!