|
|
@@ -0,0 +1,150 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryForm" inline size="small">
|
|
|
+ <el-form-item label="AppKey">
|
|
|
+ <el-input v-model="queryForm.id" placeholder="AppKey"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="启用">
|
|
|
+ <el-select v-model="queryForm.isEnable" clearable placeholder="用户状态">
|
|
|
+ <el-option label="是" value="Y"/>
|
|
|
+ <el-option label="否" value="N"/>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注说明">
|
|
|
+ <el-input v-model="queryForm.remark" placeholder="备注说明"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-row class="action-bar-container" type="flex" justify="end">
|
|
|
+ <el-button type="primary" size="small" @click.native="fetchData">查询</el-button>
|
|
|
+ <el-button-group>
|
|
|
+ <el-button v-permission="['app.key.add']" size="small" @click.native="$refs.dialogForm.open({})">
|
|
|
+ 新建
|
|
|
+ </el-button>
|
|
|
+ <el-button v-permission="['app.key.enable']" size="small" @click.native="enabledByIds(multipleSelection)">
|
|
|
+ 启用
|
|
|
+ </el-button>
|
|
|
+ <el-button v-permission="['app.key.disable']" size="small" @click.native="disableByIds(multipleSelection)">
|
|
|
+ 禁用
|
|
|
+ </el-button>
|
|
|
+ </el-button-group>
|
|
|
+ </el-row>
|
|
|
+ <el-table
|
|
|
+ v-loading="isLoading"
|
|
|
+ :data="pageData.records"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ >
|
|
|
+ <el-table-column type="selection" width="55"/>
|
|
|
+ <el-table-column label="AppKey" prop="id" width="150"/>
|
|
|
+ <el-table-column label="密钥" prop="encryptKey" width="600"/>
|
|
|
+ <el-table-column label="创建时间" prop="createdTime" :formatter="dateTimeFormatter" width="160"/>
|
|
|
+
|
|
|
+ <el-table-column label="启用" width="55">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag v-if="scope.row.isEnable.value===1">{{ scope.row.isEnable.text }}</el-tag>
|
|
|
+ <el-tag v-else type="danger">{{ scope.row.isEnable.text }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="授权接口" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ (scope.row.permissions && scope.row.permissions.length) || 0 }}个
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备注说明" prop="remark"/>
|
|
|
+
|
|
|
+ <el-table-column label="操作" width="70" fixed="right">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-dropdown>
|
|
|
+ <el-button type="text">
|
|
|
+ 操作<i class="el-icon-arrow-down el-icon--right"/>
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item v-permission="['app.key.edit']" @click.native="$refs.dialogForm.open(scope.row)">编辑</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-if="scope.row.isEnable.value===0" v-permission="['app.key.enable']" @click.native="enabledByIds([scope.row.id])">启用</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-if="scope.row.isEnable.value===1" v-permission="['app.key.disable']" @click.native="disableByIds([scope.row.id])">禁用</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-pagination
|
|
|
+ class="pagination-container"
|
|
|
+ background
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :total="pageData.total"
|
|
|
+ :page-size="pageData.pageSize"
|
|
|
+ @current-change="paginationChange"
|
|
|
+ />
|
|
|
+ <dialog-form ref="dialogForm" @ok="fetchData"/>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { findPage, enableByIds, disableByIds } from '@/api/appKeyInfo'
|
|
|
+import DialogForm from './DialogForm'
|
|
|
+import { dateTimeFormatter } from '@/utils/formater'
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: { DialogForm },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ queryForm: {},
|
|
|
+ isLoading: true,
|
|
|
+ pageData: {},
|
|
|
+ currentPage: 1,
|
|
|
+ multipleSelection: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ dateTimeFormatter,
|
|
|
+ selectionChange(val) {
|
|
|
+ const temp = []
|
|
|
+ val.forEach(o => {
|
|
|
+ temp.push(o.id)
|
|
|
+ })
|
|
|
+ this.multipleSelection = temp
|
|
|
+ },
|
|
|
+ paginationChange(val) {
|
|
|
+ this.currentPage = val
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
+ enabledByIds(ids) {
|
|
|
+ console.log(`当前页: ${ids}`)
|
|
|
+ this.$confirm('确认要启用吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ enableByIds(ids).then(() => {
|
|
|
+ this.fetchData()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ disableByIds(ids) {
|
|
|
+ console.log(`当前页: ${ids}`)
|
|
|
+ this.$confirm('确认要禁用吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ disableByIds(ids).then(() => {
|
|
|
+ this.fetchData()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fetchData() {
|
|
|
+ this.isLoading = true
|
|
|
+ findPage({ ...this.queryForm, current: this.currentPage })
|
|
|
+ .then((response) => {
|
|
|
+ this.pageData = response
|
|
|
+ })
|
|
|
+ .finally(() => (this.isLoading = false))
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|