This commit is contained in:
hujiabin 2022-08-03 19:36:42 +08:00
parent 622cc564ec
commit 3bd61b9cd1
9 changed files with 85 additions and 70 deletions

View File

@ -13,6 +13,7 @@ export default class Url {
static readonly SHOW_MENU : string = "show-menu/%d"; static readonly SHOW_MENU : string = "show-menu/%d";
static readonly ALLOT_NODE_GROUP : string = "allot-node-group/%d"; static readonly ALLOT_NODE_GROUP : string = "allot-node-group/%d";
static readonly ALLOT_MENU : string = "allot-menu/%d"; static readonly ALLOT_MENU : string = "allot-menu/%d";
static readonly UPDATE_NICKNAME : string = "update-nickname";
// TODO 菜单 // TODO 菜单
static readonly MENUS : string = "menu"; static readonly MENUS : string = "menu";
@ -42,6 +43,7 @@ export default class Url {
static readonly DELETE_APPLY : string = "apply/%d"; static readonly DELETE_APPLY : string = "apply/%d";
static readonly APPLY_PASS : string = "apply/pass/%d"; static readonly APPLY_PASS : string = "apply/pass/%d";
static readonly APPLY_NO_PASS : string = "apply/no-pass/%d"; static readonly APPLY_NO_PASS : string = "apply/no-pass/%d";
static readonly EXECUTE_APPLY : string = "apply/execute/%d";
} }

View File

@ -28,6 +28,16 @@ export interface NodeGroupInterface{
name ?: string; name ?: string;
} }
export interface ApplyInterface{
id : number;
item_id : number;
reason : string;
send_account : string;
state : number;
unikey : string;
execute_state ?: number;
}
export interface ElTreeDataInterface { export interface ElTreeDataInterface {
id : number; id : number;
label : string; label : string;

View File

@ -35,6 +35,9 @@ export default class Apply extends HomeParent {
public showApplyDialog:boolean = false; public showApplyDialog:boolean = false;
public DataDetail:any=[]; public DataDetail:any=[];
public columns: TableColumn[] = [{ public columns: TableColumn[] = [{
title: "unikey",
key: "unikey"
},{
title: "申请者", title: "申请者",
key: "creator_account" key: "creator_account"
}, { }, {

View File

@ -25,6 +25,9 @@ export default class Audit extends HomeParent {
public showApplyDialog:boolean = false; public showApplyDialog:boolean = false;
public DataDetail:any=[]; public DataDetail:any=[];
public columns: TableColumn[] = [{ public columns: TableColumn[] = [{
title: "unikey",
key: "unikey"
}, {
title: "申请者", title: "申请者",
key: "creator_account" key: "creator_account"
}, { }, {

View File

@ -7,7 +7,7 @@ import {
Mutation Mutation
} from "vuex-class"; } from "vuex-class";
import HomeParent from "@/views/home/Common/HomeParent"; import HomeParent from "@/views/home/Common/HomeParent";
import { ElTreeDataInterface, } from "@/views/home/Common/Types"; import { ElTreeDataInterface, ApplyInterface } from "@/views/home/Common/Types";
import CustomPage from "@/components/page.vue"; import CustomPage from "@/components/page.vue";
import {Form, TableColumn} from "view-design"; import {Form, TableColumn} from "view-design";
import {Message, Tree} from "element-ui"; import {Message, Tree} from "element-ui";
@ -21,10 +21,13 @@ import {Request} from "@/utils/Request";
export default class Execute extends HomeParent { export default class Execute extends HomeParent {
name: string = "execute"; name: string = "execute";
public Data = [] public Data:ApplyInterface[] = []
public showApplyDialog:boolean = false; public showApplyDialog:boolean = false;
public DataDetail:any=[]; public DataDetail:any=[];
public columns: TableColumn[] = [ { public columns: TableColumn[] = [ {
title: "unikey",
key: "unikey"
},{
title: "申请者", title: "申请者",
key: "creator_account" key: "creator_account"
}, { }, {
@ -40,9 +43,13 @@ export default class Execute extends HomeParent {
title: "审核时间", title: "审核时间",
key: "audit_time" key: "audit_time"
}, { }, {
title: "状态", title: "审核状态",
slot: "state", slot: "state",
align: 'center', align: 'center',
}, {
title: "执行状态",
slot: "execute_state",
align: 'center',
}, { }, {
title: "操作", title: "操作",
slot: "operation", slot: "operation",
@ -90,7 +97,19 @@ export default class Execute extends HomeParent {
} }
public execute(row){ public execute(row){
if (row.execute_state){
this.error('无法再次执行')
return
}
let url : string = this.$sprintf(Url.EXECUTE_APPLY, row.id);
Request('get', url).then((res:any)=>{
if (res.code == 200){
this._getData();
this.success()
}else {
this.error(res.message)
}
})
} }
private async _getData() { private async _getData() {

View File

@ -9,6 +9,14 @@
<Tag color="magenta" v-else >未通过</Tag> <Tag color="magenta" v-else >未通过</Tag>
</div> </div>
</template> </template>
<template slot-scope="{row}" slot="execute_state">
<div class="space-x-3">
<Tag color="geekblue" v-if="row.execute_state == 1">执行中...</Tag>
<Tag color="green" v-else-if="row.execute_state == 2" >执行成功</Tag>
<Tag color="red" v-else-if="row.execute_state == 3" >执行失败</Tag>
<Tag color="purple" v-else >未执行</Tag>
</div>
</template>
<template slot-scope="{row}" slot="operation"> <template slot-scope="{row}" slot="operation">
<Dropdown transfer trigger="click" @on-click="onDropdownEvent($event,row)"> <Dropdown transfer trigger="click" @on-click="onDropdownEvent($event,row)">
<a href="javascript:void(0)"> <a href="javascript:void(0)">

View File

@ -68,9 +68,41 @@ export default class Layout extends HomeParent {
}) })
} }
} }
public async updateName(){ public updateName(){
const res:any = await Request('get','home') let self = this;
// console.log(res) this.$Modal.confirm({
title:"修改昵称",
render: function(h) {
return h('Input', {
props: {
value: self.$store.getters.user.name,
autofocus: true,
placeholder: 'Please enter your name...'
},
on: {
input: (val) => {
this.value = val;
}
}
})
},
onOk :function() {
self.onVisibleChange(true)
if (!this.value || this.value == self.$store.getters.user.name || this.value == '') {
return;
}
let data = {nickname:this.value};
Request('get', Url.UPDATE_NICKNAME,data).then((res:any)=>{
if (res.code == 200){
self.success()
}else {
self.error(res.message)
}
})
}
})
} }
@ -93,23 +125,6 @@ export default class Layout extends HomeParent {
private _getMyMenu() { private _getMyMenu() {
// this.myMenus = [
// {id:1,name:'用户管理',url:'/user',children:[
// {id:2,name:'用户',url:'/user',children:[]},
// {id:3,name:'权限',url:'/node',children:[]},
// {id:4,name:'权限组',url:'/node-group',children:[]},
// {id:5,name:'菜单',url:'/menu',children:[]},
// ]},
// {id:6,name:'metamask',url:'/table',children:[
// {id:7,name:'nft',url:'/nft',children:[]},
// {id:8,name:'mint',url:'/mint',children:[]},
// ]},
// {id:9,name:'CEBG',url:'/table',children:[
// {id:10,name:'apply',url:'/apply',children:[]},
// {id:11,name:'audit',url:'/audit',children:[]},
// {id:12,name:'execute',url:'/execute',children:[]},
// ]}
// ]
Request('get', Url.MY_MENU).then((res:any)=>{ Request('get', Url.MY_MENU).then((res:any)=>{
if (res.code == 200){ if (res.code == 200){
this.myMenus = this._parseTreeData(res.data); this.myMenus = this._parseTreeData(res.data);

View File

@ -153,54 +153,11 @@ export default class Users extends HomeParent {
}) })
} }
public modalClose () { public modalClose () {
this.checkMenuDefault = [] this.checkMenuDefault = []
this.checkNodeDefault = [] this.checkNodeDefault = []
} }
public enabledUser(row : UserInterface) : void {
this._saveUser(row);
}
public disableUser(row : UserInterface) : void {
this.$Modal.confirm({
title : "禁用",
content : "确认要删禁用该用户吗?",
loading : true,
onOk : () => {
this.$Modal.remove();
if (row.id === this.UserInfo.id) {
this.error("不能禁用自己");
return;
}
this._saveUser(row);
}
})
}
private _saveUser(user : UserInterface) {
// let url : string = this.$sprintf(Url.DISABLE_USER, user.id);
// let method : Function = this.$http.delete;
// if (user.deleted_at) {
// url = this.$sprintf(Url.ENABLE_USER, user.id);
// method = this.$http.get;
// }
// method.call(this.$http, url).then(res => {
// this.success();
// this._getData();
// this.stopLoading();
// }).catch(msg => {
// this.error(msg);
// this.stopLoading();
// })
}
private async _getData() { private async _getData() {
const res:any = await Request('get', Url.USER,this.search) const res:any = await Request('get', Url.USER,this.search)

View File

@ -8,8 +8,6 @@
:total="total" :columns="columns"> :total="total" :columns="columns">
<template slot-scope="{row}" slot="operation"> <template slot-scope="{row}" slot="operation">
<div class="space-x-3"> <div class="space-x-3">
<!-- <Button type="error" v-if="!row.deleted_at" :loading="loading" @click="disableUser(row)">禁用</Button>-->
<!-- <Button type="primary" @click="enabledUser(row)" :loading="loading" v-else>启用</Button>-->
<Button type="success" @click="initNodeData(row)">权限</Button> <Button type="success" @click="initNodeData(row)">权限</Button>
<Button type="info" @click="initMenuData(row)">菜单</Button> <Button type="info" @click="initMenuData(row)">菜单</Button>
</div> </div>