前端异步请求
This commit is contained in:
@@ -32,4 +32,10 @@ export default {
|
|||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
GetRouterByUserId(router) {
|
||||||
|
return myaxios({
|
||||||
|
url: `/User/GetRouterByUserId?router=${router}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,28 +1,36 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<material-card color="primary" icon="mdi-account-outline">
|
||||||
<material-card color="primary" icon="mdi-account-outline">
|
|
||||||
<template #title>
|
<template #title>
|
||||||
接口管理 — <small class="text-body-1">接口可被菜单拥有</small>
|
接口管理 — <small class="text-body-1">接口可被菜单拥有</small>
|
||||||
</template>
|
</template>
|
||||||
<ccTable :defaultItem="defaultItem" :headers="headers" :axiosUrls="axiosUrls" ></ccTable>
|
<ccTable
|
||||||
|
:defaultItem="defaultItem"
|
||||||
|
:headers="headers"
|
||||||
|
:axiosUrls="axiosUrls"
|
||||||
|
></ccTable>
|
||||||
</material-card>
|
</material-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import userApi from "../api/userApi"
|
||||||
export default {
|
export default {
|
||||||
data: () => ({
|
created(){this.init()},
|
||||||
axiosUrls:{
|
methods:{
|
||||||
get:"mould/getmould",
|
init(){
|
||||||
update:"mould/updatemould",
|
userApi.GetRouterByUserId(this.$route.path).then(resp=>{
|
||||||
del:"mould/delListmould",
|
this.axiosUrls=resp.data;
|
||||||
add:"mould/addmould"
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
data: () => ({
|
||||||
|
axiosUrls: {
|
||||||
|
},
|
||||||
headers: [
|
headers: [
|
||||||
{text: "编号",align: "start",value: "id"},
|
{ text: "编号", align: "start", value: "id" },
|
||||||
{ text: "接口名", value: "mould_name", sortable: false },
|
{ text: "接口名", value: "mould_name", sortable: false },
|
||||||
{ text: "接口地址", value: "url", sortable: false },
|
{ text: "接口地址", value: "url", sortable: false },
|
||||||
{ text: "操作", value: "actions", sortable: false }
|
{ text: "操作", value: "actions", sortable: false },
|
||||||
],
|
],
|
||||||
defaultItem: {
|
defaultItem: {
|
||||||
mould_name: "test",
|
mould_name: "test",
|
||||||
url: "test/test",
|
url: "test/test",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,21 +12,26 @@
|
|||||||
</material-card>
|
</material-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import userApi from "../api/userApi"
|
||||||
export default {
|
export default {
|
||||||
created() {
|
created() {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
|
userApi.GetRouterByUserId(this.$route.path).then(resp=>{
|
||||||
|
this.axiosUrls=resp.data;
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
start: true,
|
start: true,
|
||||||
axiosUrls: {
|
axiosUrls: {
|
||||||
get: "role/getrole",
|
// get: "role/getrole",
|
||||||
update: "role/updaterole",
|
// update: "role/updaterole",
|
||||||
del: "role/delListrole",
|
// del: "role/delListrole",
|
||||||
add: "role/addrole",
|
// add: "role/addrole",
|
||||||
},
|
},
|
||||||
headers: [
|
headers: [
|
||||||
{ text: "编号", align: "start", value: "id" },
|
{ text: "编号", align: "start", value: "id" },
|
||||||
|
|||||||
@@ -36,31 +36,31 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
async showItem(item) {
|
async showItem(item) {
|
||||||
var strInfo = "";
|
var strInfo = "";
|
||||||
userApi.GetRolesByUserId(item.id).then(async(resp)=>{
|
userApi.GetRolesByUserId(item.id).then(async (resp) => {
|
||||||
|
const roleData = resp.data;
|
||||||
|
strInfo += "拥有的角色:<br>";
|
||||||
|
roleData.forEach((u) => {
|
||||||
|
strInfo += u.role_name + "<br>";
|
||||||
|
});
|
||||||
|
|
||||||
const roleData=resp.data;
|
strInfo += "<hr>";
|
||||||
strInfo+="拥有的角色:<br>"
|
Object.keys(item).forEach(async function (key) {
|
||||||
roleData.forEach(u=>{strInfo+=u.role_name+"<br>"})
|
strInfo += key + ":" + item[key] + "<br>";
|
||||||
|
});
|
||||||
|
|
||||||
strInfo+="<hr>"
|
await this.$dialog.confirm({
|
||||||
Object.keys(item).forEach(async function (key) {
|
text: strInfo,
|
||||||
strInfo += key + ":" + item[key] + "<br>";
|
title: "信息详情",
|
||||||
|
actions: {
|
||||||
|
true: "关闭",
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.$dialog.confirm({
|
|
||||||
text: strInfo,
|
|
||||||
title: "信息详情",
|
|
||||||
actions: {
|
|
||||||
true: "关闭",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
},
|
||||||
init() {
|
init() {
|
||||||
|
userApi.GetRouterByUserId(this.$route.path).then((resp) => {
|
||||||
|
this.axiosUrls = resp.data;
|
||||||
|
});
|
||||||
roleApi.getRole().then((resp) => {
|
roleApi.getRole().then((resp) => {
|
||||||
this.roleItems = resp.data;
|
this.roleItems = resp.data;
|
||||||
});
|
});
|
||||||
@@ -93,12 +93,7 @@ strInfo+="<hr>"
|
|||||||
TableSelect: [],
|
TableSelect: [],
|
||||||
select: [],
|
select: [],
|
||||||
roleItems: [],
|
roleItems: [],
|
||||||
axiosUrls: {
|
axiosUrls: {},
|
||||||
get: "user/getuser",
|
|
||||||
update: "user/updateuser",
|
|
||||||
del: "user/delListuser",
|
|
||||||
add: "user/adduser",
|
|
||||||
},
|
|
||||||
headers: [
|
headers: [
|
||||||
{ text: "编号", align: "start", value: "id" },
|
{ text: "编号", align: "start", value: "id" },
|
||||||
{ text: "用户名", value: "username", sortable: false },
|
{ text: "用户名", value: "username", sortable: false },
|
||||||
@@ -118,8 +113,8 @@ strInfo+="<hr>"
|
|||||||
icon: "mdi-lock",
|
icon: "mdi-lock",
|
||||||
nick: "橙子",
|
nick: "橙子",
|
||||||
age: 18,
|
age: 18,
|
||||||
address:"中国",
|
address: "中国",
|
||||||
phone:""
|
phone: "",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user