Add shared dialog
This commit is contained in:
@@ -19,7 +19,10 @@
|
||||
|
||||
<template v-slot:body-cell-name="p">
|
||||
<q-td class="flex justify-between items-center" :props="p">
|
||||
{{ p.row.name }}
|
||||
<div>
|
||||
{{ p.row.name }}
|
||||
<!-- <q-icon class="q-ml-xs" title="共有中です" name="people" :color="p.row.domainActive ? 'grey-8' : 'grey-4'" /> -->
|
||||
</div>
|
||||
<q-badge v-if="!p.row.domainActive" color="grey">未启用</q-badge>
|
||||
<q-badge v-if="p.row.id == currentDomainId" color="primary">現在</q-badge>
|
||||
</q-td>
|
||||
@@ -29,6 +32,7 @@
|
||||
<q-td :props="p">
|
||||
<q-btn-group flat>
|
||||
<q-btn flat color="primary" padding="xs" size="1em" icon="edit_note" @click="editRow(p.row)" />
|
||||
<q-btn flat color="primary" :disable="!p.row.domainActive" padding="xs" size="1em" icon="person_add_alt" @click="openShareDg(p.row)" />
|
||||
<q-btn flat color="negative" padding="xs" size="1em" icon="delete_outline" @click="removeRow(p.row)" />
|
||||
</q-btn-group>
|
||||
</q-td>
|
||||
@@ -121,6 +125,8 @@
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
<share-domain-dialog v-model="shareDg" :domain="shareDomain" @close="closeShareDg()" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -129,6 +135,7 @@ import { ref, onMounted, computed } from 'vue';
|
||||
import { api } from 'boot/axios';
|
||||
import { useAuthStore } from 'stores/useAuthStore';
|
||||
import { useDomainStore } from 'stores/useDomainStore';
|
||||
import ShareDomainDialog from 'components/ShareDomain/ShareDomainDialog.vue';
|
||||
import { IDomain, IDomainDisplay, IDomainSubmit } from '../types/DomainTypes';
|
||||
|
||||
const authStore = useAuthStore();
|
||||
@@ -150,7 +157,7 @@ const columns = [
|
||||
{ name: 'url', label: 'URL', field: 'url', align: 'left', sortable: true, classes: inactiveRowClass },
|
||||
// { name: 'owner', label: '所有者', field: 'owner', align: 'left', classes: inactiveRowClass },
|
||||
{ name: 'user', label: 'ログイン名', field: 'user', align: 'left', classes: inactiveRowClass },
|
||||
{ name: 'actions', label: '操作', field: 'actions' }
|
||||
{ name: 'actions', label: '操作', field: 'actions', classes: inactiveRowClass }
|
||||
];
|
||||
|
||||
const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 20 });
|
||||
@@ -174,6 +181,8 @@ const domainActive = ref(true);
|
||||
const isCreate = ref(true);
|
||||
let editId = ref(0);
|
||||
let ownerid = ref('');
|
||||
const shareDg = ref(false);
|
||||
const shareDomain = ref<IDomainDisplay|object>({});
|
||||
|
||||
const getDomain = async () => {
|
||||
loading.value = true;
|
||||
@@ -209,7 +218,10 @@ const removeRow = (row: IDomainDisplay) => {
|
||||
}
|
||||
|
||||
const deleteDomain = () => {
|
||||
api.delete(`api/domain/${editId.value}`).then(() => {
|
||||
api.delete(`api/domain/${editId.value}`).then(({ data }) => {
|
||||
if (!data.data) {
|
||||
// TODO dialog
|
||||
}
|
||||
getDomain();
|
||||
// authStore.setCurrentDomain();
|
||||
})
|
||||
@@ -266,6 +278,15 @@ const onSubmit = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const openShareDg = (row: IDomainDisplay) => {
|
||||
shareDomain.value = row;
|
||||
shareDg.value = true;
|
||||
};
|
||||
|
||||
const closeShareDg = () => {
|
||||
shareDg.value = false;
|
||||
}
|
||||
|
||||
const onReset = () => {
|
||||
name.value = '';
|
||||
url.value = '';
|
||||
@@ -283,5 +304,6 @@ const onReset = () => {
|
||||
<style lang="scss">
|
||||
.q-table td.inactive-row {
|
||||
color: #aaa;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
</style>
|
||||
@@ -28,32 +28,8 @@
|
||||
</template>
|
||||
|
||||
<template v-slot:item="props">
|
||||
<div class="q-pa-sm">
|
||||
<q-card :class="['domain-card', isNotOwner(props.row.id) ? 'bg-grey-2': '']">
|
||||
<q-card-section>
|
||||
<div class="row items-center no-wrap">
|
||||
<div class="col">
|
||||
<div class="text-h6">{{ props.row.name }}</div>
|
||||
<div class="text-subtitle2">{{ props.row.url }}</div>
|
||||
</div>
|
||||
<div v-if="isNotOwner(props.row.id)" class="col-auto">
|
||||
<q-icon name="account_circle" color="teal" size="2em" ></q-icon>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-card-section>
|
||||
<div class="row items-center no-wrap">
|
||||
<div class="col">
|
||||
<div class="text-grey-7 text-caption text-weight-medium">アカウント</div>
|
||||
<div class="smaller-font-size">{{ props.row.kintoneuser }}</div>
|
||||
</div>
|
||||
<div v-if="isNotOwner(props.row.id)" class="col-auto">
|
||||
<div class="text-grey-7 text-caption text-weight-medium">所有者</div>
|
||||
<div class="smaller-font-size">{{ props.row.owner }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<domain-card :item="props.row" :isNotOwnerFunc="isNotOwner">
|
||||
<template v-slot:actions>
|
||||
<q-card-actions align="right">
|
||||
<q-chip v-if="isActive(props.row.id)" outline color="teal" text-color="white" icon="done">
|
||||
既定
|
||||
@@ -61,8 +37,8 @@
|
||||
<q-btn flat v-else :loading="activeDomainLoadingId === props.row.id" :disable="deleteDomainLoadingId === props.row.id" @click="activeDomain(props.row)">既定にする</q-btn>
|
||||
<q-btn flat :disable="isNotOwner(props.row.id) || activeDomainLoadingId === props.row.id" :text-color="isNotOwner(props.row.id)?'grey':''" :loading="deleteDomainLoadingId === props.row.id" @click="clickDeleteConfirm(props.row)">削除</q-btn>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</div>
|
||||
</template>
|
||||
</domain-card>
|
||||
</template>
|
||||
</q-table>
|
||||
|
||||
@@ -94,6 +70,7 @@ import { api } from 'boot/axios';
|
||||
import { useAuthStore } from 'stores/useAuthStore';
|
||||
|
||||
import ShowDialog from 'components/ShowDialog.vue';
|
||||
import DomainCard from 'components/UserDomain/DomainCard.vue';
|
||||
import DomainSelect from 'components/DomainSelect.vue';
|
||||
|
||||
const authStore = useAuthStore();
|
||||
@@ -129,9 +106,9 @@ const clickAddDomain = () => {
|
||||
|
||||
const addUserDomainFinished = async (val: string) => {
|
||||
showAddDomainDg.value = true;
|
||||
addUserDomainLoading.value = true;
|
||||
const selected = addDomainRef.value.selected;
|
||||
if (val == 'OK' && selected.length > 0) {
|
||||
addUserDomainLoading.value = true;
|
||||
const { data } = await api.post(`api/domain/${authStore.userId}?domainid=${selected[0].id}`)
|
||||
if (rows.value.length === 0 && data.data) {
|
||||
const domain = data.data;
|
||||
@@ -142,9 +119,9 @@ const addUserDomainFinished = async (val: string) => {
|
||||
});
|
||||
}
|
||||
await getDomain();
|
||||
addUserDomainLoading.value = false;
|
||||
showAddDomainDg.value = false;
|
||||
}
|
||||
addUserDomainLoading.value = false;
|
||||
showAddDomainDg.value = false;
|
||||
};
|
||||
|
||||
const showDeleteConfirm = ref(false);
|
||||
|
||||
Reference in New Issue
Block a user