This commit is contained in:
Mouriya
2024-04-22 22:05:39 +09:00
parent 99d3a01991
commit 1a48fb5b20
9 changed files with 436 additions and 189 deletions

View File

@@ -56,7 +56,7 @@ export default {
</script>
<style lang="scss">
.action-table{
height: 100%;
max-height: 540px;
min-height: 10vh;
max-height: 68vh;
}
</style>

View File

@@ -1,21 +1,11 @@
<template>
<div class="q-pa-md" >
<div class="q-px-xs">
<div v-if="!isLoaded" class="spinner flex flex-center">
<q-spinner color="primary" size="3em" />
</div>
<q-table v-else
class="app-table"
:selection="type"
row-key="id"
v-model:selected="selected"
flat bordered
virtual-scroll
:columns="columns"
:rows="rows"
:pagination="pagination"
:rows-per-page-options="[0]"
:filter="filter"
>
<q-table v-else class="app-table" :selection="type" row-key="id" v-model:selected="selected" flat bordered
virtual-scroll :columns="columns" :rows="rows" :pagination="pagination" :rows-per-page-options="[0]"
:filter="filter" style="max-height: 65vh;">
<template v-slot:body-cell-description="props">
<q-td :props="props">
<q-scroll-area class="description-cell">
@@ -27,18 +17,20 @@
</div>
</template>
<script lang="ts">
import { ref,onMounted,reactive } from 'vue'
import { ref, onMounted, reactive, watch } from 'vue'
import { api } from 'boot/axios';
import { LeftDataBus } from './flowEditor/left/DataBus';
export default {
name: 'AppSelect',
props: {
name: String,
type: String,
filter:String
filter: String,
updateExternalSelectAppInfo: {
type: Function
}
},
setup() {
setup(props) {
const columns = [
{ name: 'id', required: true, label: 'ID', align: 'left', field: 'id', sortable: true },
{ name: 'name', label: 'アプリ名', field: 'name', sortable: true, align: 'left' },
@@ -47,15 +39,24 @@ export default {
]
const isLoaded = ref(false);
const rows: any[] = reactive([]);
const selected = ref([])
const updateExternalSelectAppInfo = props.updateExternalSelectAppInfo
watch(selected, (newValue, oldValue) => {
if (newValue && newValue[0] && updateExternalSelectAppInfo) {
updateExternalSelectAppInfo(newValue[0])
}
});
onMounted(() => {
api.get('api/v1/allapps').then(res => {
res.data.apps.forEach((item:any) =>
{
res.data.apps.forEach((item: any) => {
rows.push({
id: item.appId,
name: item.name,
description: item.description,
createdate:dateFormat(item.createdAt)});
createdate: dateFormat(item.createdAt)
});
});
isLoaded.value = true;
});
@@ -75,7 +76,7 @@ export default {
return {
columns,
rows,
selected: ref([]),
selected,
isLoaded,
pagination: ref({
rowsPerPage: 10
@@ -93,12 +94,9 @@ export default {
max-width: 300px;
white-space: break-spaces;
}
.spinner {
min-height: 300px;
min-width: 400px;
}
.app-table{
height: 100%;
max-height: 600px;
}
</style>

View File

@@ -1,21 +1,33 @@
<template>
<div class="q-pa-md">
<div class="q-px-md" style=" min-width: 50vw; max-width: 85vw;">
<div v-if="!isLoaded" class="spinner flex flex-center">
<q-spinner color="primary" size="3em" />
</div>
<q-table v-else row-key="name" :selection="type" v-model:selected="selected" :columns="columns" :rows="rows" />
<q-table flat bordered v-else row-key="name" :selection="type" v-model:selected="selected" :columns="columns"
:rows="rows" :pagination="pageSetting" :filter="filter" style="max-height: 55vh;"/>
</div>
</template>
<script>
import { ref,onMounted,reactive } from 'vue'
import { ref, onMounted, reactive, watch } from 'vue'
import { api } from 'boot/axios';
export default {
name: 'fieldSelect',
props: {
name: String,
type: {
type: String,
appId:Number
default: 'single'
},
appId: Number,
not_page: {
type: Boolean,
default: false,
},
updateSelects: {
type: Function
},
filter: String,
},
setup(props) {
const isLoaded = ref(false);
@@ -24,7 +36,26 @@ export default {
{ name: 'code', label: 'フィールドコード', align: 'left', field: 'code', sortable: true },
{ name: 'type', label: 'フィールドタイプ', align: 'left', field: 'type', sortable: true }
]
const not_page = props.not_page
const pageSetting = ref({
sortBy: 'desc',
descending: false,
page: 2,
rowsPerPage: not_page ? 0 : 5
// rowsNumber: xx if getting data from a server
})
const filter = props.filter
const rows = reactive([])
const selected = ref([])
const updateSelects = props.updateSelects
watch(selected, (newValue, oldValue) => {
if (newValue && newValue[0] && updateSelects) {
console.log(newValue);
updateSelects(newValue)
}
});
onMounted(async () => {
const res = await api.get('api/v1/appfields', {
params: {
@@ -33,8 +64,7 @@ export default {
});
let fields = res.data.properties;
console.log(fields);
Object.keys(fields).forEach((key) =>
{
Object.keys(fields).forEach((key) => {
const fld = fields[key];
// rows.push({name:fields[key].label,code:fields[key].code,type:fields[key].type});
rows.push({ name: fld.label, ...fld });
@@ -45,8 +75,9 @@ export default {
return {
columns,
rows,
selected: ref([]),
isLoaded
selected,
isLoaded,
pageSetting
}
},

View File

@@ -1,7 +1,7 @@
<template>
<!-- <div class="q-pa-md q-gutter-sm" > -->
<q-dialog :model-value="visible" persistent bordered >
<q-card :style="cardStyle" >
<q-card :style="cardStyle" style=" min-width: 40vw; max-width: 80vw; max-height: 95vh;">
<q-toolbar class="bg-grey-4">
<q-toolbar-title>{{ name }}</q-toolbar-title>
<q-space></q-space>
@@ -14,7 +14,7 @@
<q-card-section class="q-pt-none" :style="sectionStyle">
<slot></slot>
</q-card-section>
<q-card-actions align="right" class="text-primary">
<q-card-actions align="right" class="text-primary q-mt-lg">
<q-btn flat label="確定" v-close-popup @click="CloseDialogue('OK')" />
<q-btn flat label="キャンセル" v-close-popup @click="CloseDialogue('Cancel')" />
</q-card-actions>

View File

@@ -0,0 +1,215 @@
<template>
<div class="q-my-md">
<q-card flat>
<q-card-section class="q-pa-none q-my-sm q-mr-md">
<!-- <div class=" q-my-none ">App Field Select</div> -->
<div class="row q-mb-xs">
<div class="text-primary q-mb-xs text-caption">{{ $props.displayName }}</div>
</div>
<div class="row">
<div class="col">
<div class="q-mb-xs">{{ selectAppInfo?.name || 'アプリ未選択' }}</div>
</div>
<div class="col-1">
<q-btn round flat size="sm" color="primary" icon="search" @click="showDg" />
</div>
</div>
</q-card-section>
<q-card-section class="q-pa-none q-ma-none">
<div class="" style="border: 1px solid rgba(0, 0, 0, 0.12)">
<div v-if="items.length !== 0 && !show">
<q-virtual-scroll style="max-height: 150px;" :items="items" separator v-slot="{ item, index }">
<q-item :key="index" dense>
<q-item-section>
<q-item-label>
{{ item.label }}
</q-item-label>
</q-item-section>
</q-item>
</q-virtual-scroll>
</div>
<div v-else class="row q-mt-lg">
</div>
</div>
</q-card-section>
<!-- <q-separator /> -->
<q-card-section class="q-px-none q-py-xs">
<div class="row">
<div class="text-grey text-caption
"> {{ $props.placeholder }}</div>
<!-- <q-btn flat color="grey" label="clear" @click="clear" /> -->
</div>
</q-card-section>
</q-card>
</div>
<show-dialog v-model:visible="show" name="フィールド一覧" @close="closeDg">
<div class="q-mx-md q-mb-lg">
<div class="q-mb-xs q-ml-md text-primary">アプリ選択</div>
<div class="q-pa-md row" style="border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 4px;">
<div v-if="!showSelectApp && selectAppInfo">{{ selectAppInfo?.name }}</div>
<q-space />
<div>
<q-btn outline dense label="選 択" padding="none sm" color="primary" @click="() => {
showSelectApp = true;
}"></q-btn>
</div>
</div>
</div>
<div v-if="!showSelectApp && selectAppInfo?.name">
<div>
<div class="row q-mb-md">
<!-- <div class="col"> -->
<div class="q-mb-xs q-ml-md text-primary">フィールド選択</div>
<!-- </div> -->
<q-space />
<!-- <div class="col"> -->
<div class="q-mr-md">
<q-input v-model="fieldFilter" type="text" label="フィールド検索" dense outlined />
</div>
</div>
<div class="row">
<field-select ref="appDg" name="フィールド" type="multiple" :updateSelects="updateItems"
:appId="selectAppInfo?.id" not_page :filter="fieldFilter"></field-select>
</div>
</div>
</div>
<div style="min-width: 45vw;" v-else>
</div>
</show-dialog>
<show-dialog v-model:visible="showSelectApp" name="アプリ選択" @close="closeDg">
<template v-slot:toolbar>
<q-input dense debounce="300" v-model="filter" placeholder="検索" clearable>
<template v-slot:before>
<q-icon name="search" />
</template>
</q-input>
</template>
<AppSelect ref="appDg" name="アプリ" type="single" :filter="filter"
:updateExternalSelectAppInfo=updateExternalSelectAppInfo></AppSelect>
</show-dialog>
</template>
<script lang="ts">
import { defineComponent, ref, watchEffect, computed } from 'vue';
import ShowDialog from '../ShowDialog.vue';
import FieldSelect from '../FieldSelect.vue';
import { useFlowEditorStore } from 'stores/flowEditor';
import AppSelect from '../AppSelect.vue';
interface IField {
name: string,
code: string,
type: string
}
interface ISelectFieldItem {
id: string | number,
name: string | null
}
export default defineComponent({
name: 'FieldInput',
components: {
ShowDialog,
FieldSelect,
AppSelect,
},
props: {
displayName: {
type: String,
default: '',
},
name: {
type: String,
default: '',
},
placeholder: {
type: String,
default: '',
},
modelValue: {
type: Object,
default: null
},
},
setup(props, { emit }) {
const appDg = ref();
const show = ref(false);
const showSelectApp = ref(false);
const items = ref<ISelectFieldItem[]>([]);
const selectedField = ref(props.modelValue);
const store = useFlowEditorStore();
const selectAppInfo = ref()
const isSelected = computed(() => {
return selectedField.value !== null && typeof selectedField.value === 'object' && ('name' in selectedField.value)
});
const showDg = () => {
show.value = true;
};
const clear = () => {
selectAppInfo.value = undefined
items.value = []
}
const closeDg = (val: string) => {
if (val == 'OK') {
selectedField.value = appDg.value.selected[0];
}
};
const updateExternalSelectAppInfo = (newAppinfo) => {
selectAppInfo.value = newAppinfo
}
const updateItems = (newItems) => {
items.value = newItems
}
// for (let i = 0; i < 10000; i++) {
// items.value.push({
// id: i,
// name: 'name ' + i
// })
// }
watchEffect(() => {
emit('update:modelValue', selectedField.value);
});
return {
store,
appDg,
show,
showDg,
closeDg,
selectedField,
showSelectApp,
isSelected,
items,
filter: ref(),
updateExternalSelectAppInfo,
selectAppInfo,
updateItems,
clear,
fieldFilter: ref()
};
}
});
</script>

View File

@@ -96,3 +96,4 @@ export default defineComponent({
}
});
</script>

View File

@@ -15,6 +15,7 @@ import InputText from '../right/InputText.vue';
import SelectBox from '../right/SelectBox.vue';
import DatePicker from '../right/DatePicker.vue';
import FieldInput from '../right/FieldInput.vue';
import AppFieldSelect from './AppFieldSelect.vue';
import MuiltInputText from '../right/MuiltInputText.vue';
import ConditionInput from '../right/ConditionInput.vue';
import EventSetter from '../right/EventSetter.vue';
@@ -27,6 +28,7 @@ export default defineComponent({
SelectBox,
DatePicker,
FieldInput,
AppFieldSelect,
MuiltInputText,
ConditionInput,
EventSetter

View File

@@ -11,7 +11,7 @@
elevated
overlay
>
<q-card class="column full-height" style="width: 300px">
<q-card class="column" style="max-width: 300px;min-height: 100%">
<q-card-section>
<div class="text-h6">{{ actionNode?.subTitle }}設定</div>
</q-card-section>