Browse Source

订阅消息

master
jiangyy 5 years ago
parent
commit
62dbf76880
  1. 277
      epmet-oper-web/src/views/modules/customer/init/RegisterList.vue
  2. 267
      epmet-oper-web/src/views/modules/customer/init/TempList.vue
  3. 38
      epmet-oper-web/src/views/modules/productConfig/subscribe/MyTempList.vue
  4. 8
      epmet-oper-web/src/views/modules/productConfig/subscribe/TempEdit.vue

277
epmet-oper-web/src/views/modules/customer/init/RegisterList.vue

@ -36,7 +36,7 @@
:isNest="false"
:visible="diaVisible"
:dialogHeight="1.1"
:width="40"
:width="60"
@cancel="diaCancel">
<el-form :inline="false"
:model="tokenForm"
@ -75,91 +75,88 @@
</el-form>
</c-dialog>
<c-dialog :showFooter='false'
<c-dialog class="dialogSub"
:showFooter='false'
:title="'订阅消息'"
:isNest="false"
:visible="diaSubVisible"
:dialogHeight="1.1"
:width="60"
:dialogHeight="1.3"
:width="80"
@cancel="diaSubCancel">
<div style=" position: relative;">
<div class="div_btn">
<div ref="ref_sub"
style=" position: relative;">
<el-button type="primary"
size="mini"
@click="syncSubSure">同步默认订阅消息</el-button>
</div>
<el-tabs v-model="activeName"
class="el-tabs">
<el-tab-pane label="居民端"
name="resi">
<el-table ref="ref_publictable_resi"
v-loading="dataListLoading"
:data="resiDataList"
border
style="width: 100%;">
<el-table-column prop="tmplId"
label="模板ID"
header-align="left"
:min-width="150"
align="left"></el-table-column>
<el-table-column prop="title"
label="标题"
header-align="left"
:min-width="120"
align="left"></el-table-column>
<el-table-column prop="state"
label="状态"
header-align="left"
:min-width="80">
<template slot-scope="scope">
<span v-if="scope.row.state==='0'"
style="color: red">未同步</span>
<span v-else-if="scope.row.state==='1'">同步</span>
</template>
</el-table-column>
</el-table>
<!-- <div class="div_sub_table">
<div class="span_sub_title">已添加模板</div>
<el-button class="btn_sub"
type="primary"
size="mini"
@click="delSubSure()">删除订阅消息</el-button> -->
<temp-list ref="temp_list_resi_has"
:showCustomerTempId="true"
:tableType="'sync'"
:talbeTitle="'已同步模板'"
:btnName="'删除订阅模板'"
:activeName="'resi'"
@refresh="loadSubscribeData"></temp-list>
<!-- </div> -->
<!-- <div class="div_sub_table table2 ">
<div class="span_sub_title">未添加模板</div>
<el-button class="btn_sub"
type="primary"
size="mini"
@click="syncSubSure()">同步订阅消息</el-button> -->
<temp-list ref="temp_list_resi_no"
:showCustomerTempId="false"
:tableType="'nosync'"
:talbeTitle="'未同步模板'"
:btnName="'同步订阅模板'"
@refresh="loadSubscribeData"
:activeName="'resi'"></temp-list>
<!-- </div> -->
</el-tab-pane>
<el-tab-pane label="工作端"
name="gov">
<el-table ref="ref_publictable_gov"
v-loading="dataListLoading"
:data="workDataList"
border
style="width: 100%;">
<el-table-column prop="tmplId"
label="模板ID"
header-align="left"
:min-width="150"
align="left"></el-table-column>
<el-table-column prop="title"
label="标题"
header-align="left"
:min-width="120"
align="left"></el-table-column>
<el-table-column prop="state"
label="状态"
header-align="left"
:min-width="80">
<template slot-scope="scope">
<span v-if="scope.row.state==='0'"
style="color: red">未同步</span>
<span v-else-if="scope.row.state==='1'">同步</span>
</template>
</el-table-column>
<!-- <el-table-column prop="stateShow"
label="状态"
header-align="left"
:min-width="100"
align="left"></el-table-column> -->
</el-table>
name="work">
<!-- <div class="div_sub_table">
<div class="span_sub_title">已添加模板</div>
<el-button class="btn_sub"
type="primary"
size="mini"
@click="delSubSure()">删除订阅消息</el-button> -->
<temp-list ref="temp_list_work_has"
:showCustomerTempId="true"
:tableType="'sync'"
:talbeTitle="'已同步模板'"
:btnName="'删除订阅模板'"
@refresh="loadSubscribeData"
:activeName="'work'"></temp-list>
<!-- </div> -->
<!-- <div class="div_sub_table table2 ">
<div class="span_sub_title">未添加模板</div>
<el-button class="btn_sub"
type="primary"
size="mini"
@click="syncSubSure()">同步订阅消息</el-button> -->
<temp-list ref="temp_list_work_no"
:showCustomerTempId="false"
:tableType="'nosync'"
:talbeTitle="'未同步模板'"
:btnName="'同步订阅模板'"
@refresh="loadSubscribeData"
:activeName="'work'"></temp-list>
<!-- </div> -->
</el-tab-pane>
</el-tabs>
</div>
@ -171,6 +168,7 @@
import CDialog from '@c/CDialog'
import CTable from '@c/CTable'
import config from "@/js/dai/config";
import TempList from "./TempList";
import { requestPost } from "@/js/dai/request";
import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // Loading
@ -284,6 +282,7 @@ export default {
diaSubVisible: false,
activeName: 'resi',
dataListLoading: false,
resiDataList: [],
workDataList: [],
resiTempIdList: [],//
@ -291,7 +290,7 @@ export default {
}
},
components: {
CTable, CDialog
CTable, CDialog, TempList
},
activated () {
this.$nextTick(() => {
@ -301,8 +300,8 @@ export default {
mounted () {
this.tableParams.source = this.env
console.log("客户初始化列表------本地环境-----------------")
console.log(this.env)
if (this.env === 'test') {//
this.workAppid = config.appId.testWorkAppid
this.resiAppid = config.appId.testResiAppid
@ -314,10 +313,19 @@ export default {
this.resiAppid = config.appId.devResiAppid
}
console.log("工作端appId")
console.log(this.workAppid)
console.log("居民端appId")
console.log(this.resiAppid)
// eslint-disable-next-line
this.loadData()
},
computed: {
subTabHeight () {
return this.clientHeight * 0.57 / 2
},
tableHeight () {
return this.clientHeight - 60 - 80 - 80 - 50
},
@ -416,84 +424,62 @@ export default {
this.resiDataList = []
this.workDataList = []
this.$nextTick(() => {
this.loadSubscribeData(row.customerId) //
this.selCustomerId = row.customerId
this.loadSubscribeData()
})
},
//
async loadSubscribeData (customerId) {
async loadSubscribeData () {
this.dataListLoading = true
this.selCustomerId = customerId
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/third/subscribe/getcustomerlist',
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/third/subscribe/getcustomerlist'
const url = 'https://epmet-cloud.elinkservice.cn/api/third/subscribe/getcustomerlist'
let params = {
customerId: customerId,
workAppId: this.workAppid,
customerId: this.selCustomerId,
resiAppId: this.resiAppid,
workAppId: this.workAppid
// sync: sync
}
const { data, code, msg, internalMsg } = await requestPost(url, params)
if (code === 0) {
this.resiDataList = data.resiList
this.workDataList = data.workList
this.resiTempIdList = []
this.workTempIdList = []
this.resiDataList.forEach(element => {
let resiList = []
let resiList_sync = []
let resiList_sync_no = []
let workList = []
let workList_sync = []
let workList_sync_no = []
data.resiList.forEach(element => {
if (element.state === '0') {
this.resiTempIdList.push(element.id)
resiList_sync_no.push(element)
} else {
resiList_sync.push(element)
}
})
this.workDataList.forEach(element => {
data.workList.forEach(element => {
if (element.state === '0') {
this.workTempIdList.push(element.id)
workList_sync_no.push(element)
} else {
workList_sync.push(element)
}
})
this.$refs.temp_list_resi_has.setTableData(resiList_sync, this.selCustomerId, this.resiAppid, this.workAppid)
this.$refs.temp_list_resi_no.setTableData(resiList_sync_no, this.selCustomerId, this.resiAppid, this.workAppid)
this.$refs.temp_list_work_has.setTableData(workList_sync, this.selCustomerId, this.resiAppid, this.workAppid)
this.$refs.temp_list_work_no.setTableData(workList_sync_no, this.selCustomerId, this.resiAppid, this.workAppid)
} else {
this.$message.error(msg + ":" + internalMsg)
}
this.dataListLoading = false
},
//
async syncSubSure () {
this.$confirm('确认同步客户的订阅消息为默认订阅消息', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.syncSub()
}).catch(() => {
})
},
async syncSub () {
this.startLoading()
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/third/subscribe/init'
const url = 'https://epmet-cloud.elinkservice.cn/api/third/subscribe/init'
let params = {
customerId: this.selCustomerId,
workAppId: this.workAppid,
resiAppId: this.resiAppid,
resiTempIdList: this.resiTempIdList,
workTempIdList: this.workTempIdList,
}
const { data, code, msg, internalMsg } = await requestPost(url, params)
if (code === 0) {
this.$message.success('同步成功')
this.loadSubscribeData(this.selCustomerId)
} else {
this.$message.error(msg + ":" + internalMsg)
}
this.endLoading()
this.dataListLoading = false
},
//
@ -518,9 +504,9 @@ export default {
}
}
</script>
<style lang="css">
.aaa {
height: 100px;
<style lang="css" >
.dialogSub .el-dialog__body {
padding: 0 20px 10px 20px;
}
.div_btn {
z-index: 10;
@ -529,4 +515,25 @@ export default {
top: 5px;
/* margin: 0 0 20px 0; */
}
.el-tabs {
/* height: 2000px; */
}
.div_sub_table {
/* margin: 10px 10px; */
position: relative;
}
.table2 {
margin-top: 20px;
}
.span_sub_title {
/* height: 30px;
line-height: 30px; */
font-size: 16px;
padding: 5px 0 10px 0;
}
.btn_sub {
position: absolute;
right: 10px;
top: 0px;
}
</style>

267
epmet-oper-web/src/views/modules/customer/init/TempList.vue

@ -0,0 +1,267 @@
<template>
<div :class="['div_sub_table',{'table2': tableType==='nosync'}]">
<div class="span_sub_title">{{talbeTitle}}</div>
<el-button class="btn_sub"
type="primary"
size="mini"
@click="tableType==='sync'?delSubSure():syncSubSure()">{{btnName}}</el-button>
<el-table :height="subTabHeight"
ref="ref_table"
v-loading="dataListLoading"
:data="tableData"
border
style="width: 100%;"
@selection-change="handleSelectionChange">
<el-table-column type="selection"
width="55">
</el-table-column>
<el-table-column prop="tmplId"
label="公共模板ID"
header-align="left"
:min-width="150"
align="left"></el-table-column>
<el-table-column v-if="showCustomerTempId"
prop="personalTempId"
label="客户模板ID"
header-align="left"
:min-width="160"
align="left"></el-table-column>
<el-table-column prop="title"
label="标题"
header-align="left"
:min-width="120"
align="left"></el-table-column>
<!-- <el-table-column prop="state"
label="状态"
header-align="left"
:min-width="80">
<template slot-scope="scope">
<span v-if="scope.row.state==='0'"
style="color: red">未同步</span>
<span v-else-if="scope.row.state==='1'">同步</span>
</template>
</el-table-column> -->
</el-table>
</div>
</template>
<script>
import { requestPost } from "@/js/dai/request";
import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // Loading
let loading //
export default {
data () {
return {
dataListLoading: false,
selCustomerId: '',
resiAppid: '',
workAppid: '',
tableData: [],
selList: [],//list
title: "aaa"
}
},
components: {},
activated () {
this.$nextTick(() => {
this.$refs.table.doLayout() //
})
},
mounted () {
},
computed: {
subTabHeight () {
return this.clientHeight * 0.57 / 2
},
...mapGetters(['clientHeight', 'env'])
},
methods: {
handleSelectionChange (val) {
this.selList = val
},
getSelTemplIdList () {
let selTempIdList = []
this.selList.forEach(element => {
selTempIdList.push(element.tmplId)
})
return selTempIdList
},
getSelPersonalIdList () {
let personalIdList = []
this.selList.forEach(element => {
personalIdList.push(element.personalId)
})
return personalIdList
},
setTableData (tableData, selCustomerId, resiAppid, workAppid) {
this.tableData = tableData
this.selCustomerId = selCustomerId
this.workAppid = workAppid
this.resiAppid = resiAppid
},
//
async syncSubSure (message, type) {
this.$confirm('确认同步客户的订阅消息', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let selList = this.getSelTemplIdList()
if (selList.length === 0) {
this.$message.info("请选择要同步的模板")
} else {
console.log(selList)
this.syncSub(selList)
}
}).catch(() => {
})
},
//
async delSubSure () {
this.$confirm('确认删除客户的订阅消息', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let selList = this.getSelPersonalIdList()
if (selList.length === 0) {
this.$message.info("请选择要删除的模板")
} else {
this.delSub(selList)
}
}).catch(() => {
})
},
async syncSub (selList) {
this.startLoading()
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/third/subscribe/init'
const url = 'https://epmet-cloud.elinkservice.cn/api/third/subscribe/init'
let params = {
customerId: this.selCustomerId,
workAppId: this.workAppid,
resiAppId: this.resiAppid
}
if (this.activeName === 'resi') {
params.resiTempIdList = selList
} else {
params.workTempIdList = selList
}
const { data, code, msg, internalMsg } = await requestPost(url, params)
if (code === 0) {
this.$message.success('同步成功')
this.$emit('refresh')
} else {
this.$message.error(msg + ":" + internalMsg)
}
this.endLoading()
},
async delSub (selList) {
this.startLoading()
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/third/subscribe/delpersonaltemp'
const url = 'https://epmet-cloud.elinkservice.cn/api/third/subscribe/delpersonaltemp'
let params = {
customerId: this.selCustomerId,
clientType: this.activeName,
tempIdList: selList
}
const { data, code, msg, internalMsg } = await requestPost(url, params)
if (code === 0) {
this.$message.success('删除成功')
this.$emit('refresh')
} else {
this.$message.error(msg + ":" + internalMsg)
}
this.endLoading()
},
//
startLoading () {
loading = Loading.service({
lock: true, //
text: '正在加载……', //
background: 'rgba(0,0,0,.7)' //
})
},
//
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close()
}
}
},
props: {
//id
showCustomerTempId: {
type: Boolean,
default: true
},
// sync nosync
tableType: {
type: String,
default: 'sync'
},
//
talbeTitle: {
type: String,
default: '已同步模板'
},
//
btnName: {
type: String,
default: '删除订阅模板'
},
activeName: {
type: String,
default: 'resi'
}
}
}
</script>
<style lang="css" >
.div_sub_table {
/* margin: 10px 10px; */
position: relative;
}
.table2 {
margin-top: 20px;
}
.span_sub_title {
/* height: 30px;
line-height: 30px; */
font-size: 16px;
padding: 5px 0 10px 0;
}
.btn_sub {
position: absolute;
right: 10px;
top: 0px;
}
</style>

38
epmet-oper-web/src/views/modules/productConfig/subscribe/MyTempList.vue

@ -27,6 +27,9 @@
align="center"
width="150">
<template slot-scope="scope">
<el-button type="text"
size="small"
@click="showSync(scope.row)">同步</el-button>
<el-button type="text"
size="small"
@click="detailShow(scope.row)">详情</el-button>
@ -58,7 +61,7 @@ export default {
data () {
return {
activeName: 'resi',
appIdL: '',//
appId: '',//
//
dataListLoading: false,
@ -82,7 +85,6 @@ export default {
methods: {
doLayout () {
this.$nextTick(() => {
this.$refs['ref_table'].doLayout() //
@ -90,9 +92,7 @@ export default {
},
init (appId) {
this.appId = appId
this.loadData()
},
@ -120,7 +120,37 @@ export default {
this.appId = appId
this.loadData()
},
//
showSync (row) {
this.$confirm('确认同步模板到所有客户', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.syncToAll(row)
}).catch(() => {
})
},
async syncToAll (row) {
this.startLoading()
const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/third/subscribe/initall'
// const url = 'https://epmet-cloud.elinkservice.cn/api/third/subscribe/initall'
const params = {
appId: this.appId,
tempId: row.priTmplId
}
const { data, code, msg, internalMsg } = await requestPost(url, params)
if (code === 0) {
this.$message.success('同步成功')
// this.loadData()
} else {
this.$message.error(msg + ":" + internalMsg)
}
this.endLoading()
},
//
detailShow (row) {
this.$refs['ref_edit'].init(row)

8
epmet-oper-web/src/views/modules/productConfig/subscribe/TempEdit.vue

@ -46,6 +46,11 @@
ref="dataForm"
:label-width="'120px'">
<el-form-item label=""
prop="isSync">
<el-checkbox v-model="dataForm.isSync">同步到所有客户</el-checkbox>
</el-form-item>
<el-form-item label="App类型"
prop="appId">
<el-select class="item_width_1"
@ -130,6 +135,7 @@ export default {
resiAppid: '',
dataForm: {
isSync: true,
appId: '',
tid: '',
title: '',
@ -158,6 +164,7 @@ export default {
this.dataForm.tid = row.tid
this.dataForm.type = row.type
this.dataForm.title = row.title
this.dataForm.isSync = true
this.visible = true
@ -245,6 +252,7 @@ export default {
//
resetData () {
this.dataForm = {
isSync: true,
appId: '',
tid: '',
sceneDesc: '',

Loading…
Cancel
Save