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">
<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
:rules="[val => val && val.length > 0 || 'kintoneの環境名を入力してください。']" />
@@ -103,7 +99,7 @@
</q-card-section>
<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-card-actions>
</q-form>
@@ -141,23 +137,25 @@ const inactiveRowClass = (row: IDomainDisplay) => row.domainActive ? '' : 'inact
const columns = [
{ name: 'id', label: 'ID', field: 'id', align: 'left', sortable: true, classes: inactiveRowClass },
{
name: 'tenantid',
required: true,
label: 'テナントID',
field: 'tenantid',
align: 'left',
sortable: true,
classes: inactiveRowClass
},
// {
// name: 'tenantid',
// required: true,
// label: 'テナントID',
// field: 'tenantid',
// 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: 'owner', label: '所有者', field: 'owner', align: 'left', classes: inactiveRowClass },
{ name: 'user', label: 'ログイン名', field: 'user', align: 'left', classes: inactiveRowClass },
{ name: 'actions', label: '操作', field: 'actions' }
];
const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 20 });
const loading = ref(false);
const addEditLoading = ref(false);
const filter = ref('');
const rows = ref<IDomainDisplay[]>([]);
const show = ref(false);
@@ -165,7 +163,7 @@ const confirm = ref(false);
const resetPsw = ref(false);
const currentDomainId = computed(() => authStore.currentDomain.id);
const tenantid = ref(authStore.currentDomain.id);
// const tenantid = ref(authStore.currentDomain.id);
const name = ref('');
const url = ref('');
const isPwd = ref(true);
@@ -221,7 +219,7 @@ const deleteDomain = () => {
const editRow = (row) => {
isCreate.value = false
editId.value = row.id;
tenantid.value = row.tenantid;
// tenantid.value = row.tenantid;
name.value = row.name;
url.value = row.url;
kintoneuser.value = row.user;
@@ -246,10 +244,11 @@ const closeDg = () => {
}
const onSubmit = () => {
addEditLoading.value = true;
const method = editId.value !== 0 ? 'put' : 'post';
const param: IDomainSubmit = {
'id': editId.value,
'tenantid': tenantid.value,
'tenantid': '1', // TODO: テナントIDを取得する
'name': name.value,
'url': url.value,
'kintoneuser': kintoneuser.value,
@@ -263,6 +262,7 @@ const onSubmit = () => {
domainStore.loadUserDomains();
closeDg();
onReset();
addEditLoading.value = false;
})
}
@@ -277,6 +277,7 @@ const onReset = () => {
isCreate.value = true;
domainActive.value = true;
resetPsw.value = false
addEditLoading.value = false;
}
</script>
<style lang="scss">

View File

@@ -142,7 +142,6 @@ const columns = [
{ name: 'url', align: 'center', label: 'Domain', field: 'url', sortable: true },
{ name: 'kintoneuser', label: 'User', field: 'kintoneuser', sortable: true },
{ name: 'kintonepwd' },
{ name: 'active', field: 'active' }
];
const userDomainTableFilter = ref();
@@ -250,7 +249,7 @@ const getDomain = async (userId? : string) => {
// TODO
return;
}
const resp = await api.get(`api/activedomain`);
const resp = await api.get(`api/defaultdomain`);
activeDomainId.value = resp?.data?.data?.id;
const domainResult = userId ? await api.get(`api/domain?userId=${userId}`) : await api.get(`api/domain`);
const domains = domainResult.data as any[];

View File

@@ -127,7 +127,7 @@
</q-card-section>
<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-card-actions>
</q-form>
@@ -168,6 +168,7 @@ const columns = [
const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 20 });
const loading = ref(false);
const addEditLoading = ref(false);
const filter = ref('');
const statusFilter = ref('全データ');
const rows = ref([]);
@@ -260,6 +261,7 @@ const closeDg = () => {
}
const onSubmit = () => {
addEditLoading.value = true;
if (editId.value !== 0) {
api.put(`api/v1/users/${editId.value}`, {
'first_name': firstName.value,
@@ -302,6 +304,7 @@ const onReset = () => {
isPwd.value = true;
editId.value = 0;
isCreate.value = true;
resetPsw.value = false
resetPsw.value = false;
addEditLoading.value = false;
}
</script>

View File

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