fix api call result & some UI improve
This commit is contained in:
@@ -11,7 +11,10 @@ export default {
|
|||||||
name: 'DomainSelect',
|
name: 'DomainSelect',
|
||||||
props: {
|
props: {
|
||||||
name: String,
|
name: String,
|
||||||
type: String
|
type: String,
|
||||||
|
filterInitRowsFunc: {
|
||||||
|
type: Function,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const columns = [
|
const columns = [
|
||||||
@@ -26,6 +29,9 @@ export default {
|
|||||||
api.get(`api/domains`).then(res =>{
|
api.get(`api/domains`).then(res =>{
|
||||||
res.data.data.forEach((item) =>
|
res.data.data.forEach((item) =>
|
||||||
{
|
{
|
||||||
|
if (props.filterInitRowsFunc && !props.filterInitRowsFunc(item)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rows.push({id:item.id,tenantid:item.tenantid,name:item.name,url:item.url,kintoneuser:item.kintoneuser});
|
rows.push({id:item.id,tenantid:item.tenantid,name:item.name,url:item.url,kintoneuser:item.kintoneuser});
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,14 +14,14 @@
|
|||||||
|
|
||||||
<q-space />
|
<q-space />
|
||||||
<div class="row q-gutter-md">
|
<div class="row q-gutter-md">
|
||||||
<q-item v-if="authStore.permissions === 'admin'" tag="label" dense @click="clickSwitchUser()">
|
<!-- <q-item v-if="authStore.permissions === 'admin'" tag="label" dense @click="clickSwitchUser()">
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>適用するユーザ : </q-item-label>
|
<q-item-label>適用するユーザ : </q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
{{ currentUserName }}
|
{{ currentUserName }}
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item> -->
|
||||||
|
|
||||||
<q-input borderless dense filled debounce="300" v-model="userDomainTableFilter" placeholder="Search">
|
<q-input borderless dense filled debounce="300" v-model="userDomainTableFilter" placeholder="Search">
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
</q-table>
|
</q-table>
|
||||||
|
|
||||||
<show-dialog v-model:visible="showAddDomainDg" name="ドメイン" @close="addUserDomainFinished">
|
<show-dialog v-model:visible="showAddDomainDg" name="ドメイン" @close="addUserDomainFinished">
|
||||||
<domain-select ref="addDomainRef" name="ドメイン" type="multiple"></domain-select>
|
<domain-select ref="addDomainRef" name="ドメイン" type="single" :filterInitRowsFunc="filterInitRows"></domain-select>
|
||||||
</show-dialog>
|
</show-dialog>
|
||||||
|
|
||||||
<show-dialog v-model:visible="showSwitchUserDd" name="ドメイン" minWidth="35vw" @close="switchUserFinished">
|
<show-dialog v-model:visible="showSwitchUserDd" name="ドメイン" minWidth="35vw" @close="switchUserFinished">
|
||||||
@@ -131,6 +131,7 @@ import UserList from 'components/UserList.vue';
|
|||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const pagination = ref({ sortBy: 'id', rowsPerPage: 0 });
|
const pagination = ref({ sortBy: 'id', rowsPerPage: 0 });
|
||||||
const rows = ref([] as any[]);
|
const rows = ref([] as any[]);
|
||||||
|
const rowIds = new Set<string>();
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
@@ -152,19 +153,19 @@ let editId = ref(0);
|
|||||||
const showAddDomainDg = ref(false);
|
const showAddDomainDg = ref(false);
|
||||||
const addDomainRef = ref();
|
const addDomainRef = ref();
|
||||||
|
|
||||||
|
const filterInitRows = (row: {id: string}) => {
|
||||||
|
return !rowIds.has(row.id);
|
||||||
|
}
|
||||||
|
|
||||||
const clickAddDomain = () => {
|
const clickAddDomain = () => {
|
||||||
editId.value = 0;
|
editId.value = 0;
|
||||||
showAddDomainDg.value = true;
|
showAddDomainDg.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addUserDomainFinished = (val: string) => {
|
const addUserDomainFinished = (val: string) => {
|
||||||
if (val == 'OK') {
|
const selected = addDomainRef.value.selected;
|
||||||
let dodmainids = [];
|
if (val == 'OK' && selected.length > 0) {
|
||||||
let domains = JSON.parse(JSON.stringify(addDomainRef.value.selected));
|
api.post(`api/domain/${useOtherUser.value ? otherUserId.value : authStore.userId}?domainid=${selected[0].id}`)
|
||||||
for (var key in domains) {
|
|
||||||
dodmainids.push(domains[key].id);
|
|
||||||
}
|
|
||||||
api.post(`api/domain/${useOtherUser.value ? otherUserId.value : authStore.userId}`, dodmainids)
|
|
||||||
.then(() => { getDomain(useOtherUser.value ? otherUserId.value : undefined); });
|
.then(() => { getDomain(useOtherUser.value ? otherUserId.value : undefined); });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -221,11 +222,13 @@ const switchUserFinished = async (val: string) => {
|
|||||||
|
|
||||||
const getDomain = async (userId? : string) => {
|
const getDomain = async (userId? : string) => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
|
rowIds.clear();
|
||||||
const resp = await api.get(`api/activedomain${useOtherUser.value ? `?userId=${otherUserId.value}` : ''}`);
|
const resp = await api.get(`api/activedomain${useOtherUser.value ? `?userId=${otherUserId.value}` : ''}`);
|
||||||
activeDomainId.value = resp?.data?.data?.id;
|
activeDomainId.value = resp?.data?.data?.id;
|
||||||
const domainResult = userId ? await api.get(`api/domain?userId=${userId}`) : await api.get(`api/domain`);
|
const domainResult = userId ? await api.get(`api/domain?userId=${userId}`) : await api.get(`api/domain`);
|
||||||
const domains = domainResult.data as any[];
|
const domains = domainResult.data as any[];
|
||||||
rows.value = domains.map((item) => {
|
rows.value = domains.map((item) => {
|
||||||
|
rowIds.add(item.id);
|
||||||
return { id: item.id, name: item.name, url: item.url, kintoneuser: item.kintoneuser, kintonepwd: item.kintonepwd }
|
return { id: item.id, name: item.name, url: item.url, kintoneuser: item.kintoneuser, kintonepwd: item.kintonepwd }
|
||||||
});
|
});
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user