Commit 6a8e79e8 authored by 张伯涛's avatar 张伯涛

组织机构模块

parent 6b346d0e
...@@ -72,7 +72,7 @@ export function updateStatus(data) { ...@@ -72,7 +72,7 @@ export function updateStatus(data) {
data = Qs.stringify(data) data = Qs.stringify(data)
return request({ return request({
url: '/syscontentnewsinformation/updateStatus/' + businessId, url: '/syscontentnewsinformation/updateStatus/' + businessId,
method: 'put', method: 'post',
data: data data: data
}) })
} }
import request from '@/utils/request'
/** 组织结构新增接口*/
export function organizationAddApi(data) {
return request({
url: '/iaminstitution/add',
method: 'post',
params: data
})
}
/** 组织结构删除接口*/
export function organizationDelApi(id) {
return request({
url: 'iaminstitution/deleteLogical/' + id,
method: 'delete'
})
}
/** 组织结构修改接口*/
export function organizationUpdataApi(data, id) {
return request({
url: '/iaminstitution/update/' + id,
method: 'put',
params: data
})
}
/** 组织结构获取详情接口*/
export function organizationGetDetailApi( id) {
return request({
url: '/iaminstitution/detail/' + id,
method: 'get'
})
}
/** 组织结构分页查询接口*/
export function organizationGetDataListApi(data) {
return request({
url: '/iaminstitution/list',
method: 'get',
params: data
})
}
...@@ -94,6 +94,19 @@ export const constantRoutes = [ ...@@ -94,6 +94,19 @@ export const constantRoutes = [
meta: { title: '运维管理', icon: 'dashboard' } meta: { title: '运维管理', icon: 'dashboard' }
}] }]
}, },
{
path: '/OpenApi',
component: Layout,
name: 'OpenApi',
hidden: true,
redirect: '/OpenApi/index',
children: [{
path: '/OpenApi/index',
name: 'OpenApi',
component: () => import('@/views/OpenApi/index.vue'),
meta: { title: '开放网关', icon: 'dashboard' }
}]
},
{ {
path: '/userCache', path: '/userCache',
component: Layout, component: Layout,
......
<template>
<div class="OpenApi_module">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="组织机构" name="first">
<div class="search" style="border-bottom: 14px solid #f4f4f4">
<el-form ref="queryForm" style="padding: 0 0 0 10px" class="formClass" :model="queryParams" :inline="true" label-width="auto">
<el-form-item label="ip:" prop="ips">
<el-input
v-model.trim="queryParams.ips"
placeholder="请输入ip"
clearable
:maxlength="30"
size="small"
/>
</el-form-item>
<el-form-item label="机构名称:" prop="organizationalStructure">
<el-input
v-model.trim="queryParams.organizationalStructure"
placeholder="请输入机构名称"
clearable
:maxlength="30"
size="small"
/>
</el-form-item>
<el-form-item>
<!-- //查询按钮-->
<el-button
:class="commonField.queryClass"
:type="commonField.typePrimary"
:icon="commonField.queryIcon"
:size="commonField.smallSize"
@click="handleQuery"
>{{ commonField.queryName }}</el-button>
<!-- //重置按钮-->
<el-button
:class="commonField.resetClass"
:icon="commonField.resetIcon"
:size="commonField.smallSize"
@click="resetQuery"
>{{ commonField.resetName }}</el-button>
</el-form-item>
<div style="text-align: end;">
<el-form-item>
<el-button
:class="commonField.addClass"
:type="commonField.typePrimary"
:icon="commonField.addIcon"
:size="commonField.smallSize"
@click="handleAdd"
>新建</el-button>
</el-form-item>
</div>
</el-form>
</div>
<div style="padding:5px 10px">
<div class="tableTitle">组织机构列表</div>
<el-table
v-loading="loading"
style="padding-right: 10px"
:data="dataList"
>
<el-table-column type="index" label="序号" width="90" />
<el-table-column label="机构名称" prop="organizationalStructure" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.organizationalStructure || '-' }}
</template>
</el-table-column>
<el-table-column label="机构编号" prop="institutionCode" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.institutionCode || '-' }}
</template>
</el-table-column>
<el-table-column label="ip" prop="ips" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.ips || '-' }}
</template>
</el-table-column>
<el-table-column label="accessKey" prop="accessKey" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.accessKey || '-' }}
</template>
</el-table-column>
<el-table-column label="secretKey" prop="secretKey" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.secretKey || '-' }}
</template>
</el-table-column>
<el-table-column label="apiPubKey" prop="apiPubKey" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.apiPubKey || '-' }}
</template>
</el-table-column>
<el-table-column label="apiSecretKey" prop="apiSecretKey" width="130" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.apiSecretKey || '-' }}
</template>
</el-table-column>
<el-table-column label="状态" prop="flag" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-switch
v-model="scope.row.flag"
class="switchDisabledStyle"
inactive-value="0"
active-value="1"
@click.native="handleStatusChange(scope.row)"
/>
</template>
</el-table-column>
<el-table-column label="备注" prop="remarks" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.remarks || '-' }}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="创建时间" prop="createDate" width="160">
<template slot-scope="scope">
<span>{{ scope.row.createDate | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
width="250"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<!-- //查看详情-->
<el-button
:class="commonField.updateClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="handleDetail(scope.row)"
>{{ commonField.viewName }}</el-button>
<!-- //修改-->
<el-button
:class="commonField.updateClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="handleUpdate(scope.row)"
>{{ commonField.updateName }}</el-button>
<!-- //删除-->
<el-button
:class="commonField.delClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="handleDelete(scope.row)"
>{{ commonField.deleteName }}</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.rows"
@pagination="getList"
/>
</div>
</el-tab-pane>
<el-tab-pane label="网关日志" name="second">网关日志</el-tab-pane>
</el-tabs>
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="50%" append-to-body class="openApiAddDialog">
<el-form ref="form" :model="form" :rules="rules" label-width="auto">
<el-row>
<el-col :span="12">
<el-form-item label="机构名称:" prop="organizationalStructure">
<el-input :disabled="formDisabled" v-model="form.organizationalStructure" show-word-limit maxlength="20" placeholder="请输入机构名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="机构编号:" prop="institutionCode">
<el-input :disabled="formDisabled" v-model="form.institutionCode" show-word-limit maxlength="20" placeholder="请输入机构编号" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="ip:" prop="ips">
<el-input :disabled="formDisabled" v-model="form.ips" show-word-limit maxlength="20" placeholder="请输入ip" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="accessKey:" prop="accessKey">
<el-input :disabled="formDisabled" v-model="form.accessKey" show-word-limit maxlength="20" placeholder="请输入accessKey" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="secretKey:" prop="secretKey" class="secretKeyItem">
<el-input :disabled="formDisabled" v-model="form.secretKey" show-word-limit maxlength="20" placeholder="请输入secretKey" />
<el-button v-if="formDisabled === true" class="copy-btn" type="primary" @click="handleCopy">复 制</el-button>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="apiPubKey:" prop="apiPubKey">
<el-input :disabled="formDisabled" v-model="form.apiPubKey" show-word-limit maxlength="20" placeholder="请输入apiPubKey" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="apiSecretKey:" prop="apiSecretKey">
<el-input :disabled="formDisabled" v-model="form.apiSecretKey" show-word-limit maxlength="20" placeholder="请输入apiSecretKey" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否启用:" prop="flag">
<el-radio-group :disabled="formDisabled" v-model="form.flag">
<el-radio :label="'1'">启用</el-radio>
<el-radio :label="'0'">停用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="发布日期:" prop="releaseDate">
<el-date-picker
:disabled="formDisabled"
v-model="dateRange"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="handleChangeTime"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注:" prop="remarks">
<el-input :disabled="formDisabled" v-model="form.remarks" type="textarea" show-word-limit maxlength="100" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button class="cancelBtn" @click="cancel">取 消</el-button>
<el-button :disabled="formDisabled" class="submitBtn" type="primary" @click="submitForm">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import ClipboardJS from 'clipboard'
import commonField from '@/utils/commonField'
import {
organizationAddApi, organizationDelApi,
organizationGetDataListApi,
organizationGetDetailApi,
organizationUpdataApi
} from '@/api/openApi'
export default {
name: 'Index',
data() {
return {
formDisabled: false,
dateRange: [],
// 遮罩层
loading: false,
dataList: [],
// 总条数
total: 0,
activeName: 'first',
queryParams: {
page: 1,
rows: 10,
ips: '',
organizationalStructure: ''
},
form: {
flag: '1',
apiSecretKey: '',
apiPubKey: '',
secretKey: '',
accessKey: '',
ips: '',
institutionCode: '',
organizationalStructure: '',
startTime: '',
endTime: ''
},
open: false,
title: '',
rules: {
}
}
},
computed: {
commonField() {
return commonField
}
},
created() {
this.getList() // 列表查询
},
mounted() {
},
methods: {
/** 新增修改的时候选择时间*/
handleChangeTime() {
if (this.dateRange && this.dateRange !== '' && this.dateRange !== undefined && this.dateRange.length > 0) {
this.form.startTime = this.dateRange[0] + ' 00:00:00'
this.form.endTime = this.dateRange[1] + ' 23:59:59'
} else {
this.form.startTime = ''
this.form.endTime = ''
}
console.log('this.form.startTime', this.form.startTime)
console.log('this.form.endTime', this.form.endTime)
},
/** tab切换*/
handleClick(tab, event) {
console.log(tab, event)
},
/** 查询按钮*/
handleQuery() {
this.queryParams.page = 1
this.getList()
},
/** 列表查询方法*/
getList() {
this.loading = true
organizationGetDataListApi(this.queryParams).then(response => {
this.dataList = response.rows
this.total = response.total
this.loading = false
}).catch(function() {
this.loading = false
})
},
/** 重置*/
resetQuery() {
this.queryParams = {
page: 1,
rows: 10,
ips: '',
organizationalStructure: ''
}
this.handleQuery()
},
/** 表单重置*/
reset() {
this.form = {
flag: '1',
apiSecretKey: '',
apiPubKey: '',
secretKey: '',
accessKey: '',
ips: '',
institutionCode: '',
organizationalStructure: '',
startTime: '',
endTime: ''
}
this.dateRange = []
this.resetForm('form')
},
/** 新建*/
handleAdd() {
this.formDisabled = false
this.reset()
this.open = true
this.title = '添加用户'
},
// 改变状态
handleStatusChange(row) {
const text = row.flag === '1' ? '启用' : '停用'
this.$confirm('确认确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
const params = {
flag: row.flag === '1' ? '0' : '1'
}
return organizationUpdataApi(params, row.businessId)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch(function() {
row.flag = row.flag === '0' ? '1' : '0'
})
},
/** dialog取消*/
cancel() {
this.open = false
this.reset()
},
/** 复制按钮*/
handleCopy() {
// 使用clipboard.js实现复制文本到剪贴板
const clipboard = new ClipboardJS('.copy-btn', {
text: () => this.form.secretKey
})
clipboard.on('success', () => {
console.log('复制成功!')
// 可以在这里添加成功复制后的提示或其他逻辑
clipboard.destroy() // 销毁实例,释放内存
})
clipboard.on('error', () => {
console.error('复制失败,请手动复制。')
// 可以在这里添加复制失败后的提示或其他逻辑
clipboard.destroy() // 销毁实例,释放内存
})
// 手动触发复制动作
clipboard.onClick({ currentTarget: document.querySelector('.copy-btn') })
},
/** dialog确认*/
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.businessId !== undefined) {
organizationUpdataApi(this.form, this.form.businessId).then(response => {
if (response.code === 200) {
this.$message({
message: '修改成功',
type: 'success'
})
this.open = false
this.getList()
}
})
} else {
organizationAddApi(this.form).then(response => {
if (response.code === 200) {
this.$message({
message: '新增成功', type: 'success'
})
this.open = false
this.getList()
}
})
}
}
})
},
/** 查看*/
handleDetail(row) {
this.formDisabled = true
this.reset()
const userId = row.businessId
organizationGetDetailApi(userId).then(response => {
this.open = true
this.form = response.data
if (this.form.startTime && this.form.endTime) {
this.dateRange = [this.form.startTime.slice(0, 10), this.form.endTime.slice(0, 10)]
} else {
this.dateRange = []
}
this.title = '修改用户'
})
},
/** 修改*/
handleUpdate(row) {
this.formDisabled = false
this.reset()
const userId = row.businessId
organizationGetDetailApi(userId).then(response => {
this.open = true
this.form = response.data
if (this.form.startTime && this.form.endTime) {
this.dateRange = [this.form.startTime.slice(0, 10), this.form.endTime.slice(0, 10)]
} else {
this.dateRange = []
}
this.title = '修改用户'
})
},
/** 修改*/
handleDelete(row) {
const userId = row.businessId
this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return organizationDelApi(userId)
}).then(() => {
this.getList()
this.$message({
message: '刪除成功',
type: 'success'
})
}).catch(function() {})
}
}
}
</script>
<style scoped lang="scss">
.openApiAddDialog{
::v-deep .el-range-editor--small.el-input__inner{
width: 100%!important;
}
.secretKeyItem{
::v-deep .el-form-item__content{
display: flex!important;
}
}
}
.OpenApi_module{
padding: 0 30px 0;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment