This commit is contained in:
2024-12-02 21:59:43 +09:00
4 changed files with 26 additions and 23 deletions

View File

@@ -46,10 +46,6 @@
<q-card-section class="q-pt-none q-mt-none"> <q-card-section class="q-pt-none q-mt-none">
<div class="q-gutter-lg"> <div class="q-gutter-lg">
<q-input filled v-model="tenantid" label="テナントID" hint="テナントIDを入力してください。" lazy-rules
:rules="[val => val && val.length > 0 || 'テナントIDを入力してください。']" />
<q-input filled v-model="name" label="環境名 *" hint="kintoneの環境名を入力してください" lazy-rules <q-input filled v-model="name" label="環境名 *" hint="kintoneの環境名を入力してください" lazy-rules
:rules="[val => val && val.length > 0 || 'kintoneの環境名を入力してください。']" /> :rules="[val => val && val.length > 0 || 'kintoneの環境名を入力してください。']" />
@@ -103,7 +99,7 @@
</q-card-section> </q-card-section>
<q-card-actions align="right" class="text-primary q-mb-md q-mx-sm"> <q-card-actions align="right" class="text-primary q-mb-md q-mx-sm">
<q-btn label="保存" type="submit" color="primary" /> <q-btn :loading="addEditLoading" label="保存" type="submit" color="primary" />
<q-btn label="キャンセル" type="cancel" color="primary" flat class="q-ml-sm" @click="closeDg()" /> <q-btn label="キャンセル" type="cancel" color="primary" flat class="q-ml-sm" @click="closeDg()" />
</q-card-actions> </q-card-actions>
</q-form> </q-form>
@@ -141,23 +137,25 @@ const inactiveRowClass = (row: IDomainDisplay) => row.domainActive ? '' : 'inact
const columns = [ const columns = [
{ name: 'id', label: 'ID', field: 'id', align: 'left', sortable: true, classes: inactiveRowClass }, { name: 'id', label: 'ID', field: 'id', align: 'left', sortable: true, classes: inactiveRowClass },
{ // {
name: 'tenantid', // name: 'tenantid',
required: true, // required: true,
label: 'テナントID', // label: 'テナントID',
field: 'tenantid', // field: 'tenantid',
align: 'left', // align: 'left',
sortable: true, // sortable: true,
classes: inactiveRowClass // classes: inactiveRowClass
}, // },
{ name: 'name', label: '環境名', field: 'name', align: 'left', sortable: true, classes: inactiveRowClass }, { name: 'name', label: '環境名', field: 'name', align: 'left', sortable: true, classes: inactiveRowClass },
{ name: 'url', label: 'URL', field: 'url', align: 'left', sortable: true, classes: inactiveRowClass }, { 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: 'user', label: 'ログイン名', field: 'user', align: 'left', classes: inactiveRowClass },
{ name: 'actions', label: '操作', field: 'actions' } { name: 'actions', label: '操作', field: 'actions' }
]; ];
const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 20 }); const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 20 });
const loading = ref(false); const loading = ref(false);
const addEditLoading = ref(false);
const filter = ref(''); const filter = ref('');
const rows = ref<IDomainDisplay[]>([]); const rows = ref<IDomainDisplay[]>([]);
const show = ref(false); const show = ref(false);
@@ -165,7 +163,7 @@ const confirm = ref(false);
const resetPsw = ref(false); const resetPsw = ref(false);
const currentDomainId = computed(() => authStore.currentDomain.id); const currentDomainId = computed(() => authStore.currentDomain.id);
const tenantid = ref(authStore.currentDomain.id); // const tenantid = ref(authStore.currentDomain.id);
const name = ref(''); const name = ref('');
const url = ref(''); const url = ref('');
const isPwd = ref(true); const isPwd = ref(true);
@@ -221,7 +219,7 @@ const deleteDomain = () => {
const editRow = (row) => { const editRow = (row) => {
isCreate.value = false isCreate.value = false
editId.value = row.id; editId.value = row.id;
tenantid.value = row.tenantid; // tenantid.value = row.tenantid;
name.value = row.name; name.value = row.name;
url.value = row.url; url.value = row.url;
kintoneuser.value = row.user; kintoneuser.value = row.user;
@@ -246,10 +244,11 @@ const closeDg = () => {
} }
const onSubmit = () => { const onSubmit = () => {
addEditLoading.value = true;
const method = editId.value !== 0 ? 'put' : 'post'; const method = editId.value !== 0 ? 'put' : 'post';
const param: IDomainSubmit = { const param: IDomainSubmit = {
'id': editId.value, 'id': editId.value,
'tenantid': tenantid.value, 'tenantid': '1', // TODO: テナントIDを取得する
'name': name.value, 'name': name.value,
'url': url.value, 'url': url.value,
'kintoneuser': kintoneuser.value, 'kintoneuser': kintoneuser.value,
@@ -263,6 +262,7 @@ const onSubmit = () => {
domainStore.loadUserDomains(); domainStore.loadUserDomains();
closeDg(); closeDg();
onReset(); onReset();
addEditLoading.value = false;
}) })
} }
@@ -277,6 +277,7 @@ const onReset = () => {
isCreate.value = true; isCreate.value = true;
domainActive.value = true; domainActive.value = true;
resetPsw.value = false resetPsw.value = false
addEditLoading.value = false;
} }
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@@ -142,7 +142,6 @@ const columns = [
{ name: 'url', align: 'center', label: 'Domain', field: 'url', sortable: true }, { name: 'url', align: 'center', label: 'Domain', field: 'url', sortable: true },
{ name: 'kintoneuser', label: 'User', field: 'kintoneuser', sortable: true }, { name: 'kintoneuser', label: 'User', field: 'kintoneuser', sortable: true },
{ name: 'kintonepwd' }, { name: 'kintonepwd' },
{ name: 'active', field: 'active' }
]; ];
const userDomainTableFilter = ref(); const userDomainTableFilter = ref();
@@ -250,7 +249,7 @@ const getDomain = async (userId? : string) => {
// TODO // TODO
return; return;
} }
const resp = await api.get(`api/activedomain`); const resp = await api.get(`api/defaultdomain`);
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[];

View File

@@ -127,7 +127,7 @@
</q-card-section> </q-card-section>
<q-card-actions align="right" class="text-primary q-mb-md q-mx-sm"> <q-card-actions align="right" class="text-primary q-mb-md q-mx-sm">
<q-btn label="保存" type="submit" color="primary" /> <q-btn :loading="addEditLoading" label="保存" type="submit" color="primary" />
<q-btn label="キャンセル" type="cancel" color="primary" flat class="q-ml-sm" @click="closeDg()" /> <q-btn label="キャンセル" type="cancel" color="primary" flat class="q-ml-sm" @click="closeDg()" />
</q-card-actions> </q-card-actions>
</q-form> </q-form>
@@ -168,6 +168,7 @@ const columns = [
const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 20 }); const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 20 });
const loading = ref(false); const loading = ref(false);
const addEditLoading = ref(false);
const filter = ref(''); const filter = ref('');
const statusFilter = ref('全データ'); const statusFilter = ref('全データ');
const rows = ref([]); const rows = ref([]);
@@ -260,6 +261,7 @@ const closeDg = () => {
} }
const onSubmit = () => { const onSubmit = () => {
addEditLoading.value = true;
if (editId.value !== 0) { if (editId.value !== 0) {
api.put(`api/v1/users/${editId.value}`, { api.put(`api/v1/users/${editId.value}`, {
'first_name': firstName.value, 'first_name': firstName.value,
@@ -302,6 +304,7 @@ const onReset = () => {
isPwd.value = true; isPwd.value = true;
editId.value = 0; editId.value = 0;
isCreate.value = true; isCreate.value = true;
resetPsw.value = false resetPsw.value = false;
addEditLoading.value = false;
} }
</script> </script>

View File

@@ -68,7 +68,7 @@ export const useAuthStore = defineStore('auth', {
} }
}, },
async getCurrentDomain(): Promise<IDomainInfo> { async getCurrentDomain(): Promise<IDomainInfo> {
const resp = await api.get(`api/activedomain`); const resp = await api.get(`api/defaultdomain`);
const activedomain = resp?.data?.data; const activedomain = resp?.data?.data;
return { return {
id: activedomain?.id, id: activedomain?.id,
@@ -97,7 +97,7 @@ export const useAuthStore = defineStore('auth', {
if (domain.id === this.currentDomain.id) { if (domain.id === this.currentDomain.id) {
return; return;
} }
await api.put(`api/activedomain/${domain.id}`); await api.put(`api/defaultdomain/${domain.id}`);
this.currentDomain = domain; this.currentDomain = domain;
}, },
}, },