城阳运营端pc前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

531 lines
15 KiB

<template>
<div class="registerList">
<el-card shadow="never"
class="aui-card--fill">
<div class="mod-demo__demo}">
<el-form :inline="true"
:model="dataForm"
5 years ago
@keyup.enter.native="loadData()">
<el-form-item>
<el-input v-model="dataForm.name"
placeholder="组织名称">
</el-input>
</el-form-item>
<el-form-item>
5 years ago
<el-button @click="loadData()">查询</el-button>
</el-form-item>
</el-form>
<c-table column-type=""
5 years ago
ref="table"
:url="tableUrl"
:params="tableParams"
keyword="RegisterInfo"
:operations="operations"
:tableHeight="tableHeight"
5 years ago
@init="init"
@delete="del"
5 years ago
@showToken="showToken"
@showSubscribe="showSubscribe">
5 years ago
</c-table>
</div>
</el-card>
5 years ago
<c-dialog :showFooter='false'
5 years ago
:title="'Token信息'"
5 years ago
:isNest="false"
:visible="diaVisible"
:dialogHeight="1.1"
:width="40"
@cancel="diaCancel">
<el-form :inline="false"
:model="tokenForm"
ref="tokenForm"
:label-width="'120px'">
<div style="margin-top:20px">
5 years ago
<el-form-item label="客户名称"
prop="customerName">
<div class="item_width_1">
5 years ago
<span>{{tokenForm.customerName}}</span>
</div>
5 years ago
</el-form-item>
5 years ago
<el-form-item label="开发token"
prop="componentAccessToken">
<div class="item_width_1">
5 years ago
<span>{{tokenForm.componentAccessToken}}</span>
</div>
5 years ago
</el-form-item>
<el-form-item label="工作端token"
prop="workAuthorizerToken">
<div class="item_width_1">
5 years ago
<span>{{tokenForm.workAuthorizerToken}}</span>
</div>
5 years ago
</el-form-item>
<el-form-item label="居民端token"
prop="resiAuthorizerToken">
<div class="item_width_1">
5 years ago
<span>{{tokenForm.resiAuthorizerToken}}</span>
</div>
5 years ago
</el-form-item>
</div>
</el-form>
</c-dialog>
5 years ago
<c-dialog :showFooter='false'
:title="'订阅消息'"
:isNest="false"
:visible="diaSubVisible"
:dialogHeight="1.1"
:width="60"
@cancel="diaSubCancel">
<div style=" position: relative;">
<div class="div_btn">
<el-button type="primary"
size="mini"
5 years ago
@click="syncSubSure">同步默认订阅消息</el-button>
5 years ago
</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%;">
5 years ago
<el-table-column prop="tmplId"
5 years ago
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>
</el-tab-pane>
<el-tab-pane label="工作端"
name="gov">
<el-table ref="ref_publictable_gov"
v-loading="dataListLoading"
:data="workDataList"
border
style="width: 100%;">
5 years ago
<el-table-column prop="tmplId"
5 years ago
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>
</el-tab-pane>
</el-tabs>
</div>
</c-dialog>
</div>
</template>
<script>
5 years ago
import CDialog from '@c/CDialog'
5 years ago
import CTable from '@c/CTable'
5 years ago
import config from "@/js/dai/config";
import { requestPost } from "@/js/dai/request";
import { mapGetters } from 'vuex'
5 years ago
import { Loading } from 'element-ui' // 引入Loading服务
let loading // 加载动画
export default {
data () {
return {
dataForm: {
name: '' // 组织名称
},
5 years ago
workAppid: '',
resiAppid: '',
5 years ago
// 列表相关
5 years ago
tableUrl:
'https://epmet-cloud.elinkservice.cn/api/third/pacustomer/registerinfo',
5 years ago
// tableUrl: 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/third/pacustomer/registerinfo',
tableParams: {
source: this.env
},
// 列表操作栏的操作项数组
5 years ago
operations: [
{
lable: '初始化', // 按钮显示名称
size: 'mini',
style: 'margin: 0 6px;',
type: 'text',
slot: '',
plain: false,
methodName: 'init', // 回调方法名称
5 years ago
isShow: (row) => {
if (
row.initState === 0 &&
row.resiAuth === 1 &&
row.workAuth === 1
) {
5 years ago
return true
} else {
return false
}
}
},
5 years ago
{
lable: '订阅消息', // 按钮显示名称
size: 'mini',
style: 'margin: 0 6px;',
type: 'text',
slot: '',
plain: false,
methodName: 'showSubscribe', // 回调方法名称
isShow: (row) => {
5 years ago
if (
row.initState === 1
) {
return true
} else {
return false
}
5 years ago
}
},
{
5 years ago
lable: '删除', // 按钮显示名称
size: 'mini',
style: 'margin: 0 6px;',
type: 'text',
slot: '',
plain: false,
methodName: 'delete', // 回调方法名称
isShow: (row) => {
if (this.env !== 'prod') {
return true
} else {
return false
}
}
},
{
5 years ago
lable: 'token', // 按钮显示名称
size: 'mini',
style: 'margin: 0 6px;',
type: 'text',
slot: '',
plain: false,
methodName: 'showToken', // 回调方法名称
isShow: (row) => {
// if (this.env !== 'prod') {
return true
// } else {
// return false
// }
5 years ago
}
5 years ago
},
],
// 初始化相关
5 years ago
initUrl: '/oper/crm/customer/init',
//token弹出框相关
diaVisible: false,
tokenForm: {
customerId: '',
customerName: '',
componentAccessToken: '',
resiAuthorizerToken: '',
workAuthorizerToken: ''
5 years ago
},
//订阅消息列表相关
selCustomerId: '',
diaSubVisible: false,
activeName: 'resi',
dataListLoading: false,
resiDataList: [],
workDataList: [],
resiTempIdList: [],//居民端未同步的模板数组
workDataList: [],//工作端未同步的模板数组
}
},
components: {
5 years ago
CTable, CDialog
},
activated () {
this.$nextTick(() => {
this.$refs.table.doLayout() // 解决表格错位
})
},
mounted () {
this.tableParams.source = this.env
5 years ago
if (this.env === 'test') {//测试
this.workAppid = config.appId.devWorkAppid
this.resiAppid = config.appId.devResiAppid
} else if (this.env === 'prod') {//生产
this.workAppid = config.appId.testWorkAppid
this.resiAppid = config.appId.testResiAppid
} else {//开发
this.workAppid = config.appId.devWorkAppid
this.resiAppid = config.appId.devResiAppid
}
// eslint-disable-next-line
5 years ago
this.loadData()
},
computed: {
tableHeight () {
return this.clientHeight - 60 - 80 - 80 - 50
},
...mapGetters(['clientHeight', 'env'])
},
methods: {
5 years ago
// 获取列表数据
loadData () {
this.$refs.table.loadData()
},
// 客户初始化
init (row) {
5 years ago
this.startLoading()
const param = {
customerId: row.customerId
}
5 years ago
window.app.ajax.post(
this.initUrl,
param,
(data, rspMsg) => {
5 years ago
this.endLoading()
this.$message.success('初始化成功')
this.loadData()
// eslint-disable-next-line
},
(rspMsg, data) => {
5 years ago
this.endLoading()
this.$message.error(rspMsg)
5 years ago
}
)
},
5 years ago
//删除客户,开发和体验服显示
del (row) {
5 years ago
this.$confirm('确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.startLoading()
const url = 'https://epmet-cloud.elinkservice.cn/api/third/pacustomer/deletepubliccustomer'
const param = {
customerId: row.customerId,
source: this.env
5 years ago
}
5 years ago
window.app.ajax.post(
url,
param,
(data, rspMsg) => {
this.endLoading()
this.$message.success('删除成功')
this.loadData()
// eslint-disable-next-line
},
(rspMsg, data) => {
this.endLoading()
this.$message.error(rspMsg)
}
)
})
5 years ago
},
//获取token,开发和体验服显示
showToken (row) {
this.startLoading()
5 years ago
const url = 'https://epmet-cloud.elinkservice.cn/api/third/pacustomer/tokenlist'
5 years ago
const param = {
customerId: row.customerId
}
window.app.ajax.post(
url,
param,
(data, rspMsg) => {
this.endLoading()
this.diaVisible = true
this.$nextTick(() => {
this.tokenForm = data
})
// eslint-disable-next-line
},
(rspMsg, data) => {
this.endLoading()
this.$message.error(rspMsg)
}
)
},
// 取消
diaCancel () {
this.diaVisible = false
},
5 years ago
//订阅消息
showSubscribe (row) {
this.diaSubVisible = true
5 years ago
this.resiDataList = []
this.workDataList = []
5 years ago
this.$nextTick(() => {
5 years ago
this.loadSubscribeData(row.customerId) // 解决表格错位
5 years ago
})
},
//加载列表数据
5 years ago
async loadSubscribeData (customerId) {
5 years ago
this.dataListLoading = true
5 years ago
this.selCustomerId = customerId
5 years ago
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/third/subscribe/getcustomerlist',
const url = '/third/subscribe/getcustomerlist'
let params = {
5 years ago
customerId: customerId,
5 years ago
workAppId: this.workAppid,
resiAppId: this.resiAppid,
}
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 => {
if (element.state === '0') {
5 years ago
this.resiTempIdList.push(element.id)
5 years ago
}
})
this.workDataList.forEach(element => {
if (element.state === '0') {
5 years ago
this.workTempIdList.push(element.id)
5 years ago
}
})
} 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()
5 years ago
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/third/subscribe/init'
const url = '/third/subscribe/init'
5 years ago
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('同步成功')
5 years ago
this.loadSubscribeData(this.selCustomerId)
5 years ago
} else {
this.$message.error(msg + ":" + internalMsg)
}
this.endLoading()
},
// 订阅消息窗口取消
diaSubCancel () {
this.diaSubVisible = false
},
5 years ago
// 开启加载动画
startLoading () {
loading = Loading.service({
lock: true, // 是否锁定
text: '正在加载……', // 加载中需要显示的文字
background: 'rgba(0,0,0,.7)' // 背景颜色
})
},
// 结束加载动画
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close()
}
}
}
}
</script>
<style lang="css">
.aaa {
height: 100px;
}
5 years ago
.div_btn {
z-index: 10;
position: absolute;
5 years ago
right: 10px;
top: 5px;
/* margin: 0 0 20px 0; */
}
</style>