|
@@ -1,6 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<div class="open-mgmt">
|
|
<div class="open-mgmt">
|
|
- <Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoading"></Loading>
|
|
|
|
|
|
+ <Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoading" />
|
|
<!-- 列表 -->
|
|
<!-- 列表 -->
|
|
<div class="open-mgmt-left">
|
|
<div class="open-mgmt-left">
|
|
<div class="open-header">
|
|
<div class="open-header">
|
|
@@ -8,16 +8,15 @@
|
|
<div class="open-action">
|
|
<div class="open-action">
|
|
<!-- <Icon type="md-add" size="18" style="margin-right: 10px" color="rgb(115 115 115)" @click="editOpen(true, true)" /> -->
|
|
<!-- <Icon type="md-add" size="18" style="margin-right: 10px" color="rgb(115 115 115)" @click="editOpen(true, true)" /> -->
|
|
<Icon type="md-add" title="新增" size="18" style="margin-right: 10px" color="#FFF" @click="editOpen(true, true)" />
|
|
<Icon type="md-add" title="新增" size="18" style="margin-right: 10px" color="#FFF" @click="editOpen(true, true)" />
|
|
-
|
|
|
|
<Icon type="md-trash" title="删除" size="18" color="#FFF" @click="delOpen" />
|
|
<Icon type="md-trash" title="删除" size="18" color="#FFF" @click="delOpen" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<vuescroll>
|
|
<vuescroll>
|
|
<div class="open-left-list">
|
|
<div class="open-left-list">
|
|
- <div :class="['open-list', index == nowIndex ? 'list-select': '']"
|
|
|
|
- v-for="(item, index) in openList"
|
|
|
|
- :key="index"
|
|
|
|
- @click="list(index)"
|
|
|
|
|
|
+ <div :class="['open-list', index == nowIndex ? 'list-select' : '']"
|
|
|
|
+ v-for="(item, index) in openList"
|
|
|
|
+ :key="index"
|
|
|
|
+ @click="list(index)"
|
|
>
|
|
>
|
|
<span>{{ item.name }}</span>
|
|
<span>{{ item.name }}</span>
|
|
</div>
|
|
</div>
|
|
@@ -48,80 +47,95 @@
|
|
<div class="open-right-info">
|
|
<div class="open-right-info">
|
|
<div class="open-info">
|
|
<div class="open-info">
|
|
<vuescroll>
|
|
<vuescroll>
|
|
- <div class=" dark-iview-form">
|
|
|
|
|
|
+ <div class="dark-iview-form">
|
|
<!-- <div class="open-mgmt-info"> -->
|
|
<!-- <div class="open-mgmt-info"> -->
|
|
- <Form :model="openMgInfo" label-position="top">
|
|
|
|
- <div class="open-mgmt-info">
|
|
|
|
- <FormItem :label="$t('settings.openName')">
|
|
|
|
- <Input v-model="openMgInfo.name"
|
|
|
|
- :class="isEdit ? '' : 'open-info-disabled'"
|
|
|
|
- :readonly="isEdit ? false : true"></Input>
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem :label="$t('settings.token')" class="api-token" v-show="!isEdit">
|
|
|
|
- <div class="api-icon">
|
|
|
|
- <!-- 隐藏 -->
|
|
|
|
- <Icon :type="isTokenShow ? 'md-eye' : 'md-eye-off'" :title="isTokenShow ? '隐藏' : '显示'" size="18" style="margin-right: 10px" color="#FFF" @click="isTokenShow = !isTokenShow" />
|
|
|
|
- <!-- 刷新 -->
|
|
|
|
- <Icon type="md-refresh" title="刷新" v-show="isTokenShow" size="18" style="margin-right: 10px" color="#FFF" @click="refresh" />
|
|
|
|
- <!-- 复制 -->
|
|
|
|
- <Icon type="ios-copy" title="复制" v-show="isTokenShow" size="18" color="#FFF" @click="copyToken" />
|
|
|
|
- </div>
|
|
|
|
- <Input
|
|
|
|
- v-model="openMgInfo.token"
|
|
|
|
- type="textarea"
|
|
|
|
- :autosize="{ minRows: 10 }"
|
|
|
|
- class="open-info-disabled"
|
|
|
|
- readonly
|
|
|
|
- v-show="isTokenShow"
|
|
|
|
- ></Input>
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem :label="$t('settings.des')">
|
|
|
|
- <Input v-model="openMgInfo.descr"
|
|
|
|
- type="textarea"
|
|
|
|
- :autosize="{ minRows: 2 }"
|
|
|
|
- :class="isEdit ? '' : 'open-info-disabled'"
|
|
|
|
- :readonly="isEdit ? false : true"></Input>
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem :label="$t('settings.openStatus')">
|
|
|
|
- <RadioGroup v-model="openMgInfo.status">
|
|
|
|
- <Radio :label="1" :disabled="isEdit ? false : true">{{ $t("settings.enable") }}</Radio>
|
|
|
|
- <Radio :label="0" :disabled="isEdit ? false : true">{{ $t("settings.disable") }}</Radio>
|
|
|
|
- </RadioGroup>
|
|
|
|
- </FormItem>
|
|
|
|
- </div>
|
|
|
|
- <p>{{ $t('settings.webhook') }}</p>
|
|
|
|
- <div class="open-mgmt-info">
|
|
|
|
- <FormItem :label="$t('settings.domainName')">
|
|
|
|
- <Input v-model="openMgInfo.domain"
|
|
|
|
- :class="isEdit ? '' : 'open-info-disabled'"
|
|
|
|
- :readonly="isEdit ? false : true"></Input>
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem :label="$t('settings.authorization')">
|
|
|
|
- <Input v-model="openMgInfo.webhookToken"
|
|
|
|
- type="textarea"
|
|
|
|
- :autosize="{ minRows: 2 }"
|
|
|
|
- :class="isEdit ? '' : 'open-info-disabled'"
|
|
|
|
- :readonly="isEdit ? false : true"></Input>
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem :label="$t('settings.subNews')">
|
|
|
|
- <CheckboxGroup v-model="openMgInfo.webhooks">
|
|
|
|
- <Checkbox v-for="(item, index) in webhook"
|
|
|
|
- :label="item.auth"
|
|
|
|
- :disabled="isEdit ? false : true"
|
|
|
|
- :key="index"
|
|
|
|
- >
|
|
|
|
- <span>{{ item.name}}</span>
|
|
|
|
- </Checkbox>
|
|
|
|
- </CheckboxGroup>
|
|
|
|
- </FormItem>
|
|
|
|
- </div>
|
|
|
|
- </Form>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <Form :model="openMgInfo" label-position="top">
|
|
|
|
+ <div class="open-mgmt-info">
|
|
|
|
+ <FormItem :label="$t('settings.openName')">
|
|
|
|
+ <Input v-model="openMgInfo.name"
|
|
|
|
+ :class="isEdit ? '' : 'open-info-disabled'"
|
|
|
|
+ :readonly="isEdit ? false : true"
|
|
|
|
+ ></Input>
|
|
|
|
+ </FormItem>
|
|
|
|
+ <FormItem :label="$t('settings.token')" class="api-token" v-show="!isEdit">
|
|
|
|
+ <div class="api-icon">
|
|
|
|
+ <!-- 隐藏 -->
|
|
|
|
+ <Icon :type="isTokenShow ? 'md-eye' : 'md-eye-off'"
|
|
|
|
+ :title="isTokenShow ? '隐藏' : '显示'"
|
|
|
|
+ size="18"
|
|
|
|
+ style="margin-right: 10px"
|
|
|
|
+ color="#FFF"
|
|
|
|
+ @click="isTokenShow = !isTokenShow"
|
|
|
|
+ />
|
|
|
|
+ <!-- 刷新 -->
|
|
|
|
+ <Icon type="md-refresh"
|
|
|
|
+ title="刷新"
|
|
|
|
+ v-show="isTokenShow"
|
|
|
|
+ size="18"
|
|
|
|
+ style="margin-right: 10px"
|
|
|
|
+ color="#FFF"
|
|
|
|
+ @click="refresh"
|
|
|
|
+ />
|
|
|
|
+ <!-- 复制 -->
|
|
|
|
+ <Icon type="ios-copy"
|
|
|
|
+ title="复制"
|
|
|
|
+ v-show="isTokenShow"
|
|
|
|
+ size="18"
|
|
|
|
+ color="#FFF"
|
|
|
|
+ @click="copyToken"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ <Input v-model="openMgInfo.token"
|
|
|
|
+ type="textarea"
|
|
|
|
+ :autosize="{ minRows: 10 }"
|
|
|
|
+ class="open-info-disabled"
|
|
|
|
+ readonly
|
|
|
|
+ v-show="isTokenShow"
|
|
|
|
+ ></Input>
|
|
|
|
+ </FormItem>
|
|
|
|
+ <FormItem :label="$t('settings.des')">
|
|
|
|
+ <Input v-model="openMgInfo.descr"
|
|
|
|
+ type="textarea"
|
|
|
|
+ :autosize="{ minRows: 2 }"
|
|
|
|
+ :class="isEdit ? '' : 'open-info-disabled'"
|
|
|
|
+ :readonly="isEdit ? false : true"
|
|
|
|
+ ></Input>
|
|
|
|
+ </FormItem>
|
|
|
|
+ <FormItem :label="$t('settings.openStatus')">
|
|
|
|
+ <RadioGroup v-model="openMgInfo.status">
|
|
|
|
+ <Radio :label="1" :disabled="isEdit ? false : true">
|
|
|
|
+ {{ $t("settings.enable") }}
|
|
|
|
+ </Radio>
|
|
|
|
+ <Radio :label="0" :disabled="isEdit ? false : true">
|
|
|
|
+ {{ $t("settings.disable") }}
|
|
|
|
+ </Radio>
|
|
|
|
+ </RadioGroup>
|
|
|
|
+ </FormItem>
|
|
|
|
+ </div>
|
|
|
|
+ <p>{{ $t("settings.webhook") }}</p>
|
|
|
|
+ <div class="open-mgmt-info">
|
|
|
|
+ <FormItem :label="$t('settings.domainName')">
|
|
|
|
+ <Input v-model="openMgInfo.domain"
|
|
|
|
+ :class="isEdit ? '' : 'open-info-disabled'"
|
|
|
|
+ :readonly="isEdit ? false : true"
|
|
|
|
+ ></Input>
|
|
|
|
+ </FormItem>
|
|
|
|
+ <FormItem :label="$t('settings.authorization')">
|
|
|
|
+ <Input v-model="openMgInfo.webhookToken"
|
|
|
|
+ type="textarea"
|
|
|
|
+ :autosize="{ minRows: 2 }"
|
|
|
|
+ :class="isEdit ? '' : 'open-info-disabled'"
|
|
|
|
+ :readonly="isEdit ? false : true"
|
|
|
|
+ ></Input>
|
|
|
|
+ </FormItem>
|
|
|
|
+ </div>
|
|
|
|
+ </Form>
|
|
|
|
+ </div>
|
|
<!-- </div> -->
|
|
<!-- </div> -->
|
|
</vuescroll>
|
|
</vuescroll>
|
|
</div>
|
|
</div>
|
|
<div class="open-api dark-iview-table dark-iview-page dark-iview-tabs-card">
|
|
<div class="open-api dark-iview-table dark-iview-page dark-iview-tabs-card">
|
|
- <!-- <div class="open-api"> -->
|
|
|
|
|
|
+ <!-- <div class="open-api"> -->
|
|
<Tabs value="1">
|
|
<Tabs value="1">
|
|
<TabPane :label="$t('settings.apiType1')" name="1">
|
|
<TabPane :label="$t('settings.apiType1')" name="1">
|
|
<div class="open-api-table">
|
|
<div class="open-api-table">
|
|
@@ -158,6 +172,23 @@
|
|
</Table>
|
|
</Table>
|
|
</div>
|
|
</div>
|
|
</TabPane>
|
|
</TabPane>
|
|
|
|
+ <TabPane :label="$t('settings.subNews')" name="3">
|
|
|
|
+ <div class="open-api-table">
|
|
|
|
+ <Table ref="selection"
|
|
|
|
+ :loading="isLoadList"
|
|
|
|
+ :columns="apiListCol"
|
|
|
|
+ :data="isEdit ? newsListSel : newsListNow"
|
|
|
|
+ @on-selection-change="selectionChange3"
|
|
|
|
+ >
|
|
|
|
+ <template slot-scope="{ row }" slot="name">
|
|
|
|
+ <span>{{ row.name }}</span>
|
|
|
|
+ <Poptip trigger="hover" :content="row.descr" placement="right">
|
|
|
|
+ <Icon type="ios-alert-outline" />
|
|
|
|
+ </Poptip>
|
|
|
|
+ </template>
|
|
|
|
+ </Table>
|
|
|
|
+ </div>
|
|
|
|
+ </TabPane>
|
|
</Tabs>
|
|
</Tabs>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -186,7 +217,7 @@ export default {
|
|
{
|
|
{
|
|
title: this.$t("settings.apiName"),
|
|
title: this.$t("settings.apiName"),
|
|
key: "name",
|
|
key: "name",
|
|
- slot: "name"
|
|
|
|
|
|
+ slot: "name",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: this.$t("settings.apiAddress"),
|
|
title: this.$t("settings.apiAddress"),
|
|
@@ -202,56 +233,93 @@ export default {
|
|
}, */
|
|
}, */
|
|
],
|
|
],
|
|
apiList: [], //api原有列表
|
|
apiList: [], //api原有列表
|
|
- apiListR: [], //读取接口
|
|
|
|
- apiListW: [], //写入接口
|
|
|
|
- // apiListSelect: [], //api选择列表
|
|
|
|
- // apiListNow: [], //当前应用已有的api 列表
|
|
|
|
apiListSelR: [], //已有的读取接口
|
|
apiListSelR: [], //已有的读取接口
|
|
apiListSelW: [], //已有的写入接口
|
|
apiListSelW: [], //已有的写入接口
|
|
|
|
+ newsList: [], //原始通知列表
|
|
|
|
+ newsListNow: [], //已有的通知
|
|
pageTotal: 0,
|
|
pageTotal: 0,
|
|
- pageSizeOpts:[5, 10, 20, 30, 40],
|
|
|
|
- webhook: [],
|
|
|
|
|
|
+ pageSizeOpts: [5, 10, 20, 30, 40],
|
|
nowIndex: 0, //当前下标
|
|
nowIndex: 0, //当前下标
|
|
isEdit: false, //编辑状态
|
|
isEdit: false, //编辑状态
|
|
isAdd: false, // 编辑/新增
|
|
isAdd: false, // 编辑/新增
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- mounted () {
|
|
|
|
|
|
+ mounted() {
|
|
this.getOpenList()
|
|
this.getOpenList()
|
|
- this.getApiList()
|
|
|
|
- this.getWebhook()
|
|
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ // 读取接口
|
|
|
|
+ apiListR() {
|
|
|
|
+ if (this.apiList && this.openMgInfo && this.openMgInfo.auths) {
|
|
|
|
+ return this.apiList.filter((item) => {
|
|
|
|
+ item._checked = this.openMgInfo.auths.includes(item.auth)
|
|
|
|
+ return item.type == "r"
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ return []
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 写入接口
|
|
|
|
+ apiListW() {
|
|
|
|
+ if (this.apiList && this.openMgInfo && this.openMgInfo.auths) {
|
|
|
|
+ return this.apiList.filter((item) => {
|
|
|
|
+ item._checked = this.openMgInfo.auths.includes(item.auth)
|
|
|
|
+ return item.type == "w"
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ return []
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 通知
|
|
|
|
+ newsListSel() {
|
|
|
|
+ if (this.newsList && this.openMgInfo && this.openMgInfo.webhooks) {
|
|
|
|
+ return this.newsList.filter((item) => {
|
|
|
|
+ item._checked = this.openMgInfo.webhooks.includes(item.auth)
|
|
|
|
+ return item
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ return []
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// 获取应用列表
|
|
// 获取应用列表
|
|
getOpenList() {
|
|
getOpenList() {
|
|
this.isLoading = true
|
|
this.isLoading = true
|
|
let list = []
|
|
let list = []
|
|
- let req = {code: this.schoolCode}
|
|
|
|
|
|
+ let req = { code: this.schoolCode }
|
|
this.$api.openMgmt.getOpenList(req).then(
|
|
this.$api.openMgmt.getOpenList(req).then(
|
|
- res => {
|
|
|
|
|
|
+ (res) => {
|
|
if (res) {
|
|
if (res) {
|
|
list = [...res.apps]
|
|
list = [...res.apps]
|
|
// 没有创建时间,暂时倒序
|
|
// 没有创建时间,暂时倒序
|
|
list.reverse()
|
|
list.reverse()
|
|
this.openList = list
|
|
this.openList = list
|
|
this.openMgInfo = this._.cloneDeep(this.openList[this.nowIndex])
|
|
this.openMgInfo = this._.cloneDeep(this.openList[this.nowIndex])
|
|
- this.isLoading = false
|
|
|
|
|
|
+ // this.isLoading = false
|
|
|
|
+ this.getApiList()
|
|
|
|
+ this.getWebhook()
|
|
}
|
|
}
|
|
- }, err => {
|
|
|
|
- this.$Message.warning(this.$t('settings.openModal1'))
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
|
+ },
|
|
|
|
+ (err) => {
|
|
|
|
+ this.$Message.warning(this.$t("settings.openModal1"))
|
|
|
|
+ /* setTimeout(() => {
|
|
this.isLoading = false
|
|
this.isLoading = false
|
|
- }, 1000)
|
|
|
|
|
|
+ }, 1000) */
|
|
|
|
+ }
|
|
|
|
+ ).finally(() => {
|
|
|
|
+ this.isLoading = false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 获取api 列表
|
|
// 获取api 列表
|
|
getApiList() {
|
|
getApiList() {
|
|
this.apiList = []
|
|
this.apiList = []
|
|
let reqs = {}
|
|
let reqs = {}
|
|
- this.$api.openMgmt.getApiList(reqs).then(res => {
|
|
|
|
|
|
+ this.$api.openMgmt.getApiList(reqs).then(
|
|
|
|
+ (res) => {
|
|
if (res) {
|
|
if (res) {
|
|
let list = [...res.apis]
|
|
let list = [...res.apis]
|
|
- if(list.length > 0) {
|
|
|
|
|
|
+ if (list.length > 0) {
|
|
// 根据auth 的大小进行排序
|
|
// 根据auth 的大小进行排序
|
|
list.sort((a, b) => {
|
|
list.sort((a, b) => {
|
|
return a.auth - b.auth
|
|
return a.auth - b.auth
|
|
@@ -260,138 +328,117 @@ export default {
|
|
this.apiList = list
|
|
this.apiList = list
|
|
this.selectApi()
|
|
this.selectApi()
|
|
}
|
|
}
|
|
- }, err => {
|
|
|
|
- this.$Message.warning(this.$t('settings.openModal2'))
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
|
+ },
|
|
|
|
+ (err) => {
|
|
|
|
+ this.$Message.warning(this.$t("settings.openModal2"))
|
|
|
|
+ /* setTimeout(() => {
|
|
this.isLoadList = false
|
|
this.isLoadList = false
|
|
- }, 1000)
|
|
|
|
- })
|
|
|
|
|
|
+ }, 1000) */
|
|
|
|
+ }
|
|
|
|
+ )
|
|
},
|
|
},
|
|
// 获取订阅通知
|
|
// 获取订阅通知
|
|
getWebhook() {
|
|
getWebhook() {
|
|
let reqs = {}
|
|
let reqs = {}
|
|
- this.$api.openMgmt.getWebhook(reqs).then(res => {
|
|
|
|
- if(res) {
|
|
|
|
- res.webhooks.sort(function(a, b) {
|
|
|
|
|
|
+ this.$api.openMgmt.getWebhook(reqs).then((res) => {
|
|
|
|
+ if (res) {
|
|
|
|
+ let list = res.webhooks
|
|
|
|
+ list.sort(function (a, b) {
|
|
return a.auth - b.auth
|
|
return a.auth - b.auth
|
|
})
|
|
})
|
|
- this.webhook = res.webhooks
|
|
|
|
|
|
+ this.newsList = this._.cloneDeep(list)
|
|
|
|
+ this.selectNews()
|
|
}
|
|
}
|
|
- }).catch(err => {})
|
|
|
|
|
|
+ })
|
|
},
|
|
},
|
|
// 筛选出该应用已有的api
|
|
// 筛选出该应用已有的api
|
|
selectApi() {
|
|
selectApi() {
|
|
- let listSel = this._.cloneDeep(this.apiList)
|
|
|
|
- let apiNow = []
|
|
|
|
- if(listSel.length > 0) {
|
|
|
|
- if(this.openMgInfo.auths.length > 0) {
|
|
|
|
- listSel.map(item => {
|
|
|
|
- this.openMgInfo.auths.map(items => {
|
|
|
|
- if(item.auth == items) {
|
|
|
|
- apiNow.push({...item})
|
|
|
|
- item._checked = true
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- let listArr = this.screenType(listSel)
|
|
|
|
- this.apiListR = listArr.listR
|
|
|
|
- this.apiListW = listArr.listW
|
|
|
|
- let listSelArr = this.screenType(apiNow)
|
|
|
|
- this.apiListSelR = listSelArr.listR
|
|
|
|
- this.apiListSelW = listSelArr.listW
|
|
|
|
|
|
+ let schoolApi = this.apiList.filter((item) => {
|
|
|
|
+ return this.openMgInfo.auths.includes(item.auth)
|
|
|
|
+ })
|
|
|
|
+ this.apiListSelR = schoolApi.filter((item) => {
|
|
|
|
+ return item.type == "r"
|
|
|
|
+ })
|
|
|
|
+ this.apiListSelW = schoolApi.filter((item) => {
|
|
|
|
+ return item.type == "w"
|
|
|
|
+ })
|
|
},
|
|
},
|
|
- // 分出写入和读取接口
|
|
|
|
- screenType(arr) {
|
|
|
|
- let list = arr
|
|
|
|
- let listArr = {
|
|
|
|
- listR: [],
|
|
|
|
- listW: []
|
|
|
|
- }
|
|
|
|
- for (let i = 0; i < list.length; i++) {
|
|
|
|
- if(list[i].type == "r") {
|
|
|
|
- listArr.listR.push(list[i])
|
|
|
|
- } else if(list[i].type == "w") {
|
|
|
|
- listArr.listW.push(list[i])
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return listArr
|
|
|
|
|
|
+ // 筛选已有的通知
|
|
|
|
+ selectNews() {
|
|
|
|
+ this.newsListNow = this.newsList.filter((item) => {
|
|
|
|
+ return this.openMgInfo.webhooks.includes(item.auth)
|
|
|
|
+ })
|
|
},
|
|
},
|
|
// 编辑、新增
|
|
// 编辑、新增
|
|
- editOpen (isEdit, isAdd) {
|
|
|
|
|
|
+ editOpen(isEdit, isAdd) {
|
|
this.isTokenShow = false
|
|
this.isTokenShow = false
|
|
- if(this.isEdit) {
|
|
|
|
- return
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (!this.isEdit) {
|
|
this.apiListCol.unshift({
|
|
this.apiListCol.unshift({
|
|
- type: 'selection',
|
|
|
|
|
|
+ type: "selection",
|
|
width: 40,
|
|
width: 40,
|
|
- align: 'center',
|
|
|
|
|
|
+ align: "center",
|
|
})
|
|
})
|
|
this.isEdit = isEdit
|
|
this.isEdit = isEdit
|
|
this.isAdd = isAdd
|
|
this.isAdd = isAdd
|
|
// 新增
|
|
// 新增
|
|
- if(isAdd) {
|
|
|
|
|
|
+ if (isAdd) {
|
|
var defaultInfo = {
|
|
var defaultInfo = {
|
|
auths: [],
|
|
auths: [],
|
|
- code: this.schoolCode,
|
|
|
|
|
|
+ // code: this.schoolCode,
|
|
descr: null,
|
|
descr: null,
|
|
- name: this.$t('settings.opName'),
|
|
|
|
- school: this.schoolCode,
|
|
|
|
|
|
+ name: this.$t("settings.opName"),
|
|
|
|
+ // school: this.schoolCode,
|
|
status: 0,
|
|
status: 0,
|
|
|
|
+ webhooks: [],
|
|
}
|
|
}
|
|
this.openList.unshift(defaultInfo)
|
|
this.openList.unshift(defaultInfo)
|
|
this.openMgInfo = defaultInfo
|
|
this.openMgInfo = defaultInfo
|
|
this.nowIndex = 0
|
|
this.nowIndex = 0
|
|
- let listArr = this.screenType(this.apiList)
|
|
|
|
- this.apiListR = listArr.listR
|
|
|
|
- this.apiListW = listArr.listW
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 删除应用
|
|
// 删除应用
|
|
- delOpen () {
|
|
|
|
- if(this.isEdit) {
|
|
|
|
- return
|
|
|
|
- } else {
|
|
|
|
|
|
+ delOpen() {
|
|
|
|
+ if (!this.isEdit) {
|
|
var titWord = this.$t("settings.delModal1") + this.openMgInfo.name + this.$t("settings.delModal2")
|
|
var titWord = this.$t("settings.delModal1") + this.openMgInfo.name + this.$t("settings.delModal2")
|
|
this.$Modal.confirm({
|
|
this.$Modal.confirm({
|
|
title: `${titWord}`,
|
|
title: `${titWord}`,
|
|
onOk: () => {
|
|
onOk: () => {
|
|
|
|
+ this.isLoading = true
|
|
let req = {
|
|
let req = {
|
|
id: this.openMgInfo.id,
|
|
id: this.openMgInfo.id,
|
|
- code: this.schoolCode
|
|
|
|
|
|
+ code: this.schoolCode,
|
|
}
|
|
}
|
|
this.$api.openMgmt.delOpen(req).then(
|
|
this.$api.openMgmt.delOpen(req).then(
|
|
- res => {
|
|
|
|
|
|
+ (res) => {
|
|
this.openList.splice(this.nowIndex, 1)
|
|
this.openList.splice(this.nowIndex, 1)
|
|
- if(this.openList.length == this.nowIndex) {
|
|
|
|
|
|
+ if (this.openList.length == this.nowIndex) {
|
|
this.nowIndex = 0
|
|
this.nowIndex = 0
|
|
}
|
|
}
|
|
this.openMgInfo = this._.cloneDeep(this.openList[this.nowIndex])
|
|
this.openMgInfo = this._.cloneDeep(this.openList[this.nowIndex])
|
|
this.selectApi()
|
|
this.selectApi()
|
|
|
|
+ this.selectNews()
|
|
this.isTokenShow = false
|
|
this.isTokenShow = false
|
|
- this.$Message.success(this.$t('settings.delModal3'))
|
|
|
|
- }, err => {
|
|
|
|
- this.$Message.error(this.$t('settings.delModal4'))
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.isLoading = false
|
|
|
|
- }, 1000)
|
|
|
|
|
|
+ this.$Message.success(this.$t("settings.delModal3"))
|
|
|
|
+ },
|
|
|
|
+ (err) => {
|
|
|
|
+ this.$Message.error(this.$t("settings.delModal4"))
|
|
}
|
|
}
|
|
- )
|
|
|
|
|
|
+ ).finally(()=>{
|
|
|
|
+ this.isLoading = false
|
|
|
|
+ })
|
|
},
|
|
},
|
|
onCancel: () => {
|
|
onCancel: () => {
|
|
- this.$Message.info(this.$t('settings.delModal5'));
|
|
|
|
|
|
+ this.$Message.info(this.$t("settings.delModal5"))
|
|
},
|
|
},
|
|
})
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- list (index) {
|
|
|
|
- if(index != this.nowIndex) {
|
|
|
|
|
|
+ list(index) {
|
|
|
|
+ if (index != this.nowIndex) {
|
|
this.isTokenShow = false
|
|
this.isTokenShow = false
|
|
- if(this.isEdit) {
|
|
|
|
- if(this.isAdd) {
|
|
|
|
|
|
+ if (this.isEdit) {
|
|
|
|
+ if (this.isAdd) {
|
|
this.openList.splice(0, 1)
|
|
this.openList.splice(0, 1)
|
|
index = index - 1
|
|
index = index - 1
|
|
}
|
|
}
|
|
@@ -399,74 +446,81 @@ export default {
|
|
this.apiListCol.splice(0, 1)
|
|
this.apiListCol.splice(0, 1)
|
|
}
|
|
}
|
|
this.nowIndex = index
|
|
this.nowIndex = index
|
|
- var info = this._.cloneDeep(this.openList[index])
|
|
|
|
- this.openMgInfo = info
|
|
|
|
|
|
+ this.openMgInfo = this._.cloneDeep(this.openList[index])
|
|
this.selectApi()
|
|
this.selectApi()
|
|
|
|
+ this.selectNews()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 保存平台信息
|
|
// 保存平台信息
|
|
- keepMgmt (type) {
|
|
|
|
|
|
+ keepMgmt(type) {
|
|
// this.isEdit = type
|
|
// this.isEdit = type
|
|
- if(type) {
|
|
|
|
|
|
+ if (type) {
|
|
|
|
+ if(!this.openMgInfo.name) {
|
|
|
|
+ this.$Message.warning("请输入应用名称")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.isLoading = true
|
|
let auths = []
|
|
let auths = []
|
|
let arr = this.apiListSelR.concat(this.apiListSelW)
|
|
let arr = this.apiListSelR.concat(this.apiListSelW)
|
|
- if(arr.length > 0) {
|
|
|
|
- arr.map(item => {
|
|
|
|
|
|
+ if (arr.length > 0) {
|
|
|
|
+ arr.map((item) => {
|
|
auths.push(item.auth)
|
|
auths.push(item.auth)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- let req = {}
|
|
|
|
- if(this.isAdd) {
|
|
|
|
- req = this.openMgInfo
|
|
|
|
- req.auths = auths
|
|
|
|
- } else{
|
|
|
|
- req = {
|
|
|
|
- id: this.openMgInfo.id,
|
|
|
|
- auths,
|
|
|
|
- code: this.schoolCode,
|
|
|
|
- descr: this.openMgInfo.descr,
|
|
|
|
- name: this.openMgInfo.name,
|
|
|
|
- school: this.schoolCode,
|
|
|
|
- status: this.openMgInfo.status,
|
|
|
|
- domain: this.openMgInfo.domain,
|
|
|
|
- webhookToken: this.openMgInfo.webhookToken,
|
|
|
|
- webhooks: this.openMgInfo.webhooks
|
|
|
|
- }
|
|
|
|
|
|
+ let webhooks = []
|
|
|
|
+ if (this.newsListNow.length > 0) {
|
|
|
|
+ this.newsListNow.map((item) => {
|
|
|
|
+ webhooks.push(item.auth)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
- console.log(req);
|
|
|
|
- this.$api.openMgmt.editOpenInfo(req).then(res => {
|
|
|
|
|
|
+ let req = {
|
|
|
|
+ code: this.schoolCode,
|
|
|
|
+ school: this.schoolCode,
|
|
|
|
+ auths,
|
|
|
|
+ webhooks
|
|
|
|
+ }
|
|
|
|
+ req = Object.assign(this.openMgInfo, req)
|
|
|
|
+ this.$api.openMgmt.editOpenInfo(req).then(
|
|
|
|
+ (res) => {
|
|
if (res) {
|
|
if (res) {
|
|
- console.log(res.app);
|
|
|
|
|
|
+ console.log(res.app)
|
|
this.openMgInfo = res.app
|
|
this.openMgInfo = res.app
|
|
this.refreshToken()
|
|
this.refreshToken()
|
|
- this.getOpenList()
|
|
|
|
|
|
+ this.openList.splice(this.nowIndex, 1, this.openMgInfo)
|
|
|
|
+ // this.getOpenList()
|
|
this.selectApi()
|
|
this.selectApi()
|
|
- this.$Message.success(this.$t('settings.keepModal1'));
|
|
|
|
|
|
+ this.selectNews()
|
|
|
|
+ this.$Message.success(this.$t("settings.keepModal1"))
|
|
}
|
|
}
|
|
- }, err => {
|
|
|
|
- this.$Message.warning(this.$t('settings.keepModal2'))
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.isLoading = false
|
|
|
|
- }, 1000)
|
|
|
|
|
|
+ },
|
|
|
|
+ (err) => {
|
|
|
|
+ this.$Message.warning(this.$t("settings.keepModal2"))
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
+ // this.isLoading = false
|
|
|
|
+ // }, 1000)
|
|
|
|
+ }
|
|
|
|
+ ).finally(() => {
|
|
|
|
+ this.isLoading = false
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
- this.openList = this.openList.filter(i => i.id)
|
|
|
|
|
|
+ this.openList = this.openList.filter((i) => i.id)
|
|
this.openMgInfo = this._.cloneDeep(this.openList[this.nowIndex])
|
|
this.openMgInfo = this._.cloneDeep(this.openList[this.nowIndex])
|
|
this.selectApi()
|
|
this.selectApi()
|
|
|
|
+ this.selectNews()
|
|
}
|
|
}
|
|
this.apiListCol.splice(0, 1)
|
|
this.apiListCol.splice(0, 1)
|
|
this.isEdit = false
|
|
this.isEdit = false
|
|
},
|
|
},
|
|
// 刷新token
|
|
// 刷新token
|
|
refresh() {
|
|
refresh() {
|
|
- if(this.isTokenShow) {
|
|
|
|
|
|
+ if (this.isTokenShow) {
|
|
this.$Modal.confirm({
|
|
this.$Modal.confirm({
|
|
- title: this.$t('settings.refreshModal3'),
|
|
|
|
|
|
+ title: this.$t("settings.refreshModal3"),
|
|
onOk: () => {
|
|
onOk: () => {
|
|
this.refreshToken()
|
|
this.refreshToken()
|
|
},
|
|
},
|
|
onCancel: () => {
|
|
onCancel: () => {
|
|
- this.$Message.info(this.$t('settings.refreshModal4'));
|
|
|
|
|
|
+ this.$Message.info(this.$t("settings.refreshModal4"))
|
|
},
|
|
},
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -474,35 +528,39 @@ export default {
|
|
refreshToken() {
|
|
refreshToken() {
|
|
let req = {
|
|
let req = {
|
|
id: this.openMgInfo.id,
|
|
id: this.openMgInfo.id,
|
|
- code: this.openMgInfo.school
|
|
|
|
|
|
+ code: this.openMgInfo.school,
|
|
}
|
|
}
|
|
- this.$api.openMgmt.getToken(req).then(res => {
|
|
|
|
|
|
+ this.$api.openMgmt.getToken(req).then(
|
|
|
|
+ (res) => {
|
|
if (res) {
|
|
if (res) {
|
|
this.openList[this.nowIndex].token = res.auth_token
|
|
this.openList[this.nowIndex].token = res.auth_token
|
|
this.openMgInfo.token = res.auth_token
|
|
this.openMgInfo.token = res.auth_token
|
|
- if(!this.isAdd) {
|
|
|
|
- this.$Message.success(this.$t('settings.refreshModal1'));
|
|
|
|
|
|
+ if (!this.isAdd) {
|
|
|
|
+ this.$Message.success(
|
|
|
|
+ this.$t("settings.refreshModal1")
|
|
|
|
+ )
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
- }, err => {
|
|
|
|
- this.$Message.warning(this.$t('settings.refreshModal2'))
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
|
+ },
|
|
|
|
+ (err) => {
|
|
|
|
+ this.$Message.warning(this.$t("settings.refreshModal2"))
|
|
|
|
+ /* setTimeout(() => {
|
|
this.isLoading = false
|
|
this.isLoading = false
|
|
- }, 1000)
|
|
|
|
- })
|
|
|
|
|
|
+ }, 1000) */
|
|
|
|
+ }
|
|
|
|
+ )
|
|
},
|
|
},
|
|
copyToken() {
|
|
copyToken() {
|
|
- if(this.isTokenShow) {
|
|
|
|
- var that = this;
|
|
|
|
|
|
+ if (this.isTokenShow) {
|
|
|
|
+ var that = this
|
|
this.$copyText(this.openMgInfo.token).then(
|
|
this.$copyText(this.openMgInfo.token).then(
|
|
- function(e) {
|
|
|
|
- that.$Message.success(that.$t('settings.copyModal1'));
|
|
|
|
|
|
+ function (e) {
|
|
|
|
+ that.$Message.success(that.$t("settings.copyModal1"))
|
|
},
|
|
},
|
|
- function(e) {
|
|
|
|
- that.$Message.error(that.$t('settings.copyModal2'));
|
|
|
|
|
|
+ function (e) {
|
|
|
|
+ that.$Message.error(that.$t("settings.copyModal2"))
|
|
}
|
|
}
|
|
- );
|
|
|
|
|
|
+ )
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 写入接口
|
|
// 写入接口
|
|
@@ -513,28 +571,28 @@ export default {
|
|
selectionChange2(selection) {
|
|
selectionChange2(selection) {
|
|
this.apiListSelR = selection
|
|
this.apiListSelR = selection
|
|
},
|
|
},
|
|
- selectMenu(name) {
|
|
|
|
- console.log(name);
|
|
|
|
- this.apiType = name
|
|
|
|
|
|
+ // 通知接口
|
|
|
|
+ selectionChange3(selection) {
|
|
|
|
+ this.newsListNow = selection
|
|
},
|
|
},
|
|
- }
|
|
|
|
|
|
+ },
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|
|
<style lang="less">
|
|
- @import "./OpenMgmt2.less";
|
|
|
|
|
|
+@import "./OpenMgmt2.less";
|
|
</style>
|
|
</style>
|
|
|
|
|
|
<style lang="less">
|
|
<style lang="less">
|
|
-.open-mgmt{
|
|
|
|
-
|
|
|
|
- .ivu-form-item:not(:first-child){
|
|
|
|
|
|
+.open-mgmt {
|
|
|
|
+ .ivu-form-item:not(:first-child) {
|
|
margin-top: 30px;
|
|
margin-top: 30px;
|
|
}
|
|
}
|
|
- .ivu-form-item:last-child{
|
|
|
|
|
|
+ .ivu-form-item:last-child {
|
|
margin-bottom: 70px;
|
|
margin-bottom: 70px;
|
|
}
|
|
}
|
|
- .ivu-radio-inner, .ivu-checkbox-inner {
|
|
|
|
|
|
+ .ivu-radio-inner,
|
|
|
|
+ .ivu-checkbox-inner {
|
|
width: 18px;
|
|
width: 18px;
|
|
height: 18px;
|
|
height: 18px;
|
|
border-radius: 4px;
|
|
border-radius: 4px;
|
|
@@ -560,27 +618,27 @@ export default {
|
|
border-color: #0094ff;
|
|
border-color: #0094ff;
|
|
}
|
|
}
|
|
|
|
|
|
- .ivu-checkbox-disabled .ivu-checkbox-inner{
|
|
|
|
|
|
+ .ivu-checkbox-disabled .ivu-checkbox-inner {
|
|
background-color: #0f0f0f;
|
|
background-color: #0f0f0f;
|
|
border-color: #4d4d4d;
|
|
border-color: #4d4d4d;
|
|
}
|
|
}
|
|
|
|
|
|
.ivu-radio-wrapper,
|
|
.ivu-radio-wrapper,
|
|
- .ivu-checkbox-wrapper{
|
|
|
|
|
|
+ .ivu-checkbox-wrapper {
|
|
color: #a5a5a5;
|
|
color: #a5a5a5;
|
|
}
|
|
}
|
|
|
|
|
|
- .ivu-checkbox{
|
|
|
|
|
|
+ .ivu-checkbox {
|
|
margin-right: 0;
|
|
margin-right: 0;
|
|
}
|
|
}
|
|
|
|
|
|
- .ivu-checkbox-wrapper{
|
|
|
|
|
|
+ .ivu-checkbox-wrapper {
|
|
margin-left: 0;
|
|
margin-left: 0;
|
|
margin-right: 30px;
|
|
margin-right: 30px;
|
|
}
|
|
}
|
|
|
|
|
|
- .open-info-disabled{
|
|
|
|
- .ivu-input{
|
|
|
|
|
|
+ .open-info-disabled {
|
|
|
|
+ .ivu-input {
|
|
background: transparent;
|
|
background: transparent;
|
|
border: none;
|
|
border: none;
|
|
box-shadow: none;
|
|
box-shadow: none;
|
|
@@ -590,30 +648,29 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- .ivu-tabs-nav{
|
|
|
|
|
|
+ .ivu-tabs-nav {
|
|
color: #a5a5a5;
|
|
color: #a5a5a5;
|
|
|
|
|
|
- .ivu-tabs-tab{
|
|
|
|
|
|
+ .ivu-tabs-tab {
|
|
height: 40px;
|
|
height: 40px;
|
|
}
|
|
}
|
|
|
|
|
|
- .ivu-tabs-ink-bar{
|
|
|
|
|
|
+ .ivu-tabs-ink-bar {
|
|
border-bottom: 2px solid #1cc0f3;
|
|
border-bottom: 2px solid #1cc0f3;
|
|
}
|
|
}
|
|
|
|
|
|
- .ivu-tabs-tab-active{
|
|
|
|
|
|
+ .ivu-tabs-tab-active {
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
color: #fff;
|
|
color: #fff;
|
|
}
|
|
}
|
|
|
|
|
|
- .ivu-tabs-tab:hover{
|
|
|
|
|
|
+ .ivu-tabs-tab:hover {
|
|
color: #fff;
|
|
color: #fff;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- .ivu-tabs-bar{
|
|
|
|
|
|
+ .ivu-tabs-bar {
|
|
margin-left: 20px;
|
|
margin-left: 20px;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|