2020-08-19 14:45:25 +02:00
|
|
|
<template>
|
2020-08-20 01:35:08 +02:00
|
|
|
<ui-form ref="form" v-slot="form" @submit="onSubmit" @load="onLoad">
|
|
|
|
|
<ui-overlay-editor class="ui-module-overlay">
|
2020-08-19 14:45:25 +02:00
|
|
|
|
2020-08-20 01:35:08 +02:00
|
|
|
<template v-slot:header>
|
|
|
|
|
<ui-header-bar :title="config.module.name" :back-button="false" :close-button="true" />
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:footer>
|
2020-09-07 14:55:05 +02:00
|
|
|
<ui-button type="light onbg" label="@ui.close" @click="config.hide"></ui-button>
|
2020-09-17 11:26:23 +02:00
|
|
|
<ui-button v-if="!disabled" type="primary" :submit="true" label="Confirm" :state="form.state" :disabled="loading"></ui-button>
|
2020-08-20 01:35:08 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<ui-loading v-if="loading" :is-big="true" />
|
|
|
|
|
|
|
|
|
|
<div v-if="!loading" class="ui-module-overlay-editor">
|
2020-10-20 16:00:55 +02:00
|
|
|
<ui-editor :config="editor" v-model="model" :meta="meta" :is-page="false" infos="none" :disabled="disabled" />
|
2020-08-20 01:35:08 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</ui-overlay-editor>
|
|
|
|
|
</ui-form>
|
2020-08-19 14:45:25 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-11-20 15:17:41 +01:00
|
|
|
import ModulesApi from 'zero/api/modules.js';
|
2020-11-01 22:20:29 +01:00
|
|
|
import UiEditor from 'zero/editor/editor.vue';
|
2020-08-19 14:45:25 +02:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
|
|
|
|
props: {
|
|
|
|
|
config: Object
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
components: { UiEditor },
|
|
|
|
|
|
|
|
|
|
data: () => ({
|
2020-08-20 14:35:08 +02:00
|
|
|
isAdd: true,
|
2020-08-20 01:35:08 +02:00
|
|
|
disabled: false,
|
|
|
|
|
id: null,
|
|
|
|
|
loading: true,
|
2020-08-19 14:45:25 +02:00
|
|
|
state: 'default',
|
2020-08-20 01:35:08 +02:00
|
|
|
meta: {},
|
2020-10-20 16:00:55 +02:00
|
|
|
editor: null,
|
2020-08-20 01:35:08 +02:00
|
|
|
model: {}
|
2020-08-19 14:45:25 +02:00
|
|
|
}),
|
|
|
|
|
|
2020-10-20 16:00:55 +02:00
|
|
|
created()
|
|
|
|
|
{
|
|
|
|
|
this.editor = this.config.editor;
|
|
|
|
|
},
|
2020-08-19 14:45:25 +02:00
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
2020-08-20 01:35:08 +02:00
|
|
|
onLoad(form)
|
2020-08-19 14:45:25 +02:00
|
|
|
{
|
2020-08-20 14:35:08 +02:00
|
|
|
if (this.config.model)
|
|
|
|
|
{
|
|
|
|
|
this.isAdd = false;
|
|
|
|
|
this.model = JSON.parse(JSON.stringify(this.config.model));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
form.load(ModulesApi.getEmpty(this.config.module.alias)).then(response =>
|
2020-08-20 01:35:08 +02:00
|
|
|
{
|
2020-09-17 11:26:23 +02:00
|
|
|
this.disabled = !response.meta.canEdit || this.config.disabled;
|
2020-08-20 01:35:08 +02:00
|
|
|
this.meta = response.meta;
|
2020-08-20 14:35:08 +02:00
|
|
|
|
|
|
|
|
if (this.isAdd)
|
|
|
|
|
{
|
|
|
|
|
this.model = response.entity;
|
|
|
|
|
}
|
2020-08-20 01:35:08 +02:00
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onSubmit(form)
|
|
|
|
|
{
|
|
|
|
|
this.config.confirm(this.model);
|
2020-08-19 14:45:25 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.ui-module-overlay
|
|
|
|
|
{
|
|
|
|
|
> content
|
|
|
|
|
{
|
2020-08-20 01:35:08 +02:00
|
|
|
position: relative;
|
2020-08-19 14:45:25 +02:00
|
|
|
padding-top: 0 !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ui-box
|
|
|
|
|
{
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ui-tabs-list
|
|
|
|
|
{
|
|
|
|
|
padding: 0;
|
|
|
|
|
padding-bottom: 32px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ui-property.ui-modules
|
|
|
|
|
{
|
|
|
|
|
margin: 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.editor-outer.-infos-aside:not(.is-page)
|
|
|
|
|
{
|
|
|
|
|
display: block;
|
|
|
|
|
}
|
2020-08-20 01:35:08 +02:00
|
|
|
|
|
|
|
|
.ui-loading
|
|
|
|
|
{
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 50%;
|
|
|
|
|
top: 50%;
|
|
|
|
|
margin: -14px 0 0 -14px;
|
|
|
|
|
}
|
2020-08-19 14:45:25 +02:00
|
|
|
}
|
|
|
|
|
</style>
|