城阳运营端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.

540 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"
5 years ago
:width="60"
5 years ago
@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
5 years ago
<c-dialog class="dialogSub"
:showFooter='false'
5 years ago
:title="'订阅消息'"
:isNest="false"
:visible="diaSubVisible"
5 years ago
:dialogHeight="1.3"
:width="80"
5 years ago
@cancel="diaSubCancel">
5 years ago
<div ref="ref_sub"
style=" position: relative;">
5 years ago
<el-tabs v-model="activeName"
class="el-tabs">
<el-tab-pane label="居民端"
name="resi">
5 years ago
<!-- <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> -->
5 years ago
</el-tab-pane>
5 years ago
5 years ago
<el-tab-pane label="工作端"
5 years ago
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> -->
5 years ago
</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";
5 years ago
import TempList from "./TempList";
5 years ago
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,
5 years ago
5 years ago
resiDataList: [],
workDataList: [],
resiTempIdList: [],//居民端未同步的模板数组
workDataList: [],//工作端未同步的模板数组
}
},
components: {
5 years ago
CTable, CDialog, TempList
},
activated () {
this.$nextTick(() => {
this.$refs.table.doLayout() // 解决表格错位
})
},
mounted () {
5 years ago
5 years ago
this.tableParams.source = this.env
5 years ago
5 years ago
if (this.env === 'test') {//测试
this.workAppid = config.appId.testWorkAppid
this.resiAppid = config.appId.testResiAppid
5 years ago
} else if (this.env === 'prod') {//生产
this.workAppid = config.appId.prodWorkAppid
this.resiAppid = config.appId.prodResiAppid
5 years ago
} else {//开发
this.workAppid = config.appId.devWorkAppid
this.resiAppid = config.appId.devResiAppid
}
5 years ago
console.log("工作端appId")
console.log(this.workAppid)
console.log("居民端appId")
console.log(this.resiAppid)
// eslint-disable-next-line
5 years ago
this.loadData()
},
computed: {
5 years ago
subTabHeight () {
return this.clientHeight * 0.57 / 2
},
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.selCustomerId = row.customerId
this.loadSubscribeData()
5 years ago
})
},
5 years ago
5 years ago
//加载列表数据
5 years ago
async loadSubscribeData () {
5 years ago
this.dataListLoading = true
5 years ago
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/third/subscribe/getcustomerlist'
5 years ago
const url = 'https://epmet-cloud.elinkservice.cn/api/third/subscribe/getcustomerlist'
5 years ago
let params = {
5 years ago
customerId: this.selCustomerId,
5 years ago
resiAppId: this.resiAppid,
5 years ago
workAppId: this.workAppid
// sync: sync
5 years ago
}
const { data, code, msg, internalMsg } = await requestPost(url, params)
if (code === 0) {
5 years ago
let resiList = []
let resiList_sync = []
let resiList_sync_no = []
let workList = []
let workList_sync = []
let workList_sync_no = []
data.resiList.forEach(element => {
5 years ago
if (element.state === '0') {
5 years ago
resiList_sync_no.push(element)
} else {
resiList_sync.push(element)
5 years ago
}
})
5 years ago
data.workList.forEach(element => {
5 years ago
if (element.state === '0') {
5 years ago
workList_sync_no.push(element)
} else {
workList_sync.push(element)
5 years ago
}
})
5 years ago
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)
5 years ago
} else {
this.$message.error(msg + ":" + internalMsg)
}
5 years ago
this.dataListLoading = false
5 years ago
},
// 订阅消息窗口取消
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>
5 years ago
<style lang="css" >
.dialogSub .el-dialog__body {
padding: 0 20px 10px 20px;
}
5 years ago
.div_btn {
z-index: 10;
position: absolute;
5 years ago
right: 10px;
top: 5px;
/* margin: 0 0 20px 0; */
}
5 years ago
.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>