开放平台
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-row>
|
||||
<el-select v-model="dataForm.strategy_id" placeholder="策略" style="width:100px" @change="strategySelectChange">
|
||||
<el-option v-for="item in strategyList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-button v-if="true||isAuth('opn:opninterfaceinf:add')" type="primary" size="mini" @click="addOrUpdateHandle()">管理</el-button>
|
||||
<el-button type="primary" size="mini" @click="refreshStrategyList()">刷新</el-button>
|
||||
</el-row>
|
||||
<div style="padding: 10px"></div>
|
||||
<el-row>
|
||||
<el-tabs tab-position="left" v-model="activeIndex" style="height: 200px;" @tab-click="tabHandleClick">
|
||||
<el-tab-pane label="鉴权方式">
|
||||
<OpnStrategyAuthInf ref="opnStrategyAuthInf"></OpnStrategyAuthInf>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="IP黑白名单">
|
||||
<OpnStrategyIpInf ref="opnStrategyIpInf"></OpnStrategyIpInf>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="流量控制">
|
||||
<OpnStrategyFlowInf ref="opnStrategyIpInf"></OpnStrategyFlowInf>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-row>
|
||||
<opn-strategy-inf v-if="opnStrategyInfVisible" ref="opnStrategyInf" @refreshDataList="refreshStrategyList"></opn-strategy-inf>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './opnstrategyinf-add-or-update'
|
||||
import OpnStrategyIpInf from './opnstrategyipinf'
|
||||
import OpnStrategyAuthInf from './opnstrategyauthinf'
|
||||
import OpnStrategyFlowInf from './opnstrategyflowinf'
|
||||
import OpnStrategyInf from './opnstrategyinf1'
|
||||
|
||||
import { isGDASucc } from '@/utils'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
opnStrategyInfVisible: false,
|
||||
activeIndex: '0',
|
||||
dataForm: {
|
||||
strategy_id: '',
|
||||
gateway_id: ''
|
||||
},
|
||||
strategyList: [],
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
OpnStrategyIpInf,
|
||||
OpnStrategyAuthInf,
|
||||
OpnStrategyFlowInf,
|
||||
OpnStrategyInf
|
||||
},
|
||||
activated() {
|
||||
this.refreshStrategyList()
|
||||
},
|
||||
methods: {
|
||||
getGatewayId() {
|
||||
return this.storage.get('openapi/gatewayId')
|
||||
},
|
||||
refresh(gatewayId) {
|
||||
this.dataForm.gateway_id = gatewayId
|
||||
this.refreshStrategyList()
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle() {
|
||||
this.opnStrategyInfVisible = true
|
||||
this.dataForm.gateway_id = this.getGatewayId()
|
||||
this.$nextTick(() => {
|
||||
this.$refs.opnStrategyInf.readonly = false
|
||||
this.$refs.opnStrategyInf.dataForm.gateway_id = this.dataForm.gateway_id
|
||||
this.$refs.opnStrategyInf.init()
|
||||
})
|
||||
},
|
||||
strategySelectChange() {
|
||||
|
||||
},
|
||||
refreshStrategyList() {
|
||||
this.dataForm.gateway_id = this.getGatewayId()
|
||||
|
||||
if (!this.dataForm.gateway_id) {
|
||||
this.$message.error('gateway_id为空')
|
||||
return
|
||||
}
|
||||
// 获取接口组
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/buiopnbpc1/opnstrategyinf/listByGateway.do?gateway_id=${this.dataForm.gateway_id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (isGDASucc(data)) {
|
||||
if (data.data) {
|
||||
this.strategyList = data.data
|
||||
this.dataForm.strategy_id = this.strategyList[0]['id']
|
||||
} else {
|
||||
this.strategyList = []
|
||||
this.dataForm.strategy_id = ''
|
||||
}
|
||||
} else {
|
||||
this.strategyList = []
|
||||
this.dataForm.strategy_id = ''
|
||||
}
|
||||
})
|
||||
},
|
||||
tabHandleClick(tab, event) {
|
||||
this.$nextTick(() => {
|
||||
if (this.activeIndex === '0') {
|
||||
this.$refs.opnStrategyAuthInf.refresh(this.dataForm.gateway_id, this.dataForm.strategy_id)
|
||||
} else if (this.activeIndex === '1') {
|
||||
this.$refs.opnStrategyIpInf.refresh(this.dataForm.gateway_id, this.dataForm.strategy_id)
|
||||
} else if (this.activeIndex === '2') {
|
||||
this.$refs.opnStrategyIpInf.refresh(this.dataForm.gateway_id, this.dataForm.strategy_id)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<el-dialog title="策略管理" :close-on-click-modal="false" :visible.sync="visible">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList01()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.search" placeholder="搜索内容" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList01()">查询</el-button>
|
||||
<el-button v-if="isAuth('opn:opnstrategyinf:add')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button
|
||||
v-if="isAuth('opn:opnstrategyinf:delete')"
|
||||
type="danger"
|
||||
@click="deleteHandle()"
|
||||
:disabled="dataListSelections.length <= 0"
|
||||
>批量删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="标识"></el-table-column>
|
||||
<el-table-column prop="gateway_id" header-align="center" align="center" label="网关标识"></el-table-column>
|
||||
<el-table-column prop="name" header-align="center" align="center" label="名称"></el-table-column>
|
||||
<el-table-column prop="status" header-align="center" align="center" label="状态" column-key="status" :formatter="dict.formatter"></el-table-column>
|
||||
<el-table-column prop="remark" header-align="center" align="center" label="备注"></el-table-column>
|
||||
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="isAuth('opn:opnstrategyinf:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||
<el-button v-if="isAuth('opn:opnstrategyinf:delete')" type="text" size="small" @click="deleteHandle(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './opnstrategyinf-add-or-update'
|
||||
import { isGDASucc } from '@/utils'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
gateway_id: ''
|
||||
},
|
||||
dataList: [],
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.visible = true
|
||||
this.getDataList()
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList01() {
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/buiopnbpc1/opnstrategyinf/listByGateway.do`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'gateway_id': this.dataForm.gateway_id
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (isGDASucc(data)) {
|
||||
if (data.data) {
|
||||
this.dataList = data.data
|
||||
} else {
|
||||
this.dataList = []
|
||||
}
|
||||
} else {
|
||||
this.dataList = []
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.dataForm.gateway_id = this.dataForm.gateway_id
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(row) {
|
||||
var ids = row ? [row.id] : this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
|
||||
var ids2 = row ? [row.name] : this.dataListSelections.map(item => {
|
||||
return item.name
|
||||
})
|
||||
|
||||
this.$confirm(`确定对[${ids2.join(',')}]进行[${row ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/buiopnbpc1/opnstrategyinf/delete.do'),
|
||||
method: 'post',
|
||||
data: this.$http.adornData({
|
||||
'ids': ids.join(',')
|
||||
}, false)
|
||||
}).then(({ data }) => {
|
||||
if (isGDASucc(data)) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user