Commit 6e54520f authored by rockyl's avatar rockyl

meta编辑器一些字段必填

parent c0681ad5
......@@ -13,8 +13,12 @@
"Export": "Export",
"Upload": "Upload",
"Edit": "Edit",
"ID": "ID",
"Name": "Name",
"Output": "Output",
"Code": "Code",
"Desc": "Desc",
"Empty": "Empty",
"Event": "Event",
"No desc": "No desc",
"Description": "Description",
......
......@@ -3,37 +3,34 @@
:close-on-click-modal="false"
:append-to-body="true">
<div class="meta-editor-wrapper">
<el-form class="info-editor" size="mini" label-position="right" label-width="70px">
<template v-if="meta">
<el-form-item label="ID">
<el-input v-model="meta.id" placeholder="ID" :readonly="!editable"/>
<el-form ref="form" v-if="meta" :model="meta" :rules="rules" :show-message="false" class="info-editor" size="mini" label-position="right" label-width="70px">
<template>
<el-form-item prop="id" label="ID">
<el-input v-model="meta.id" :placeholder="$t('ID')" :readonly="!editable"/>
</el-form-item>
<el-form-item label="Name">
<el-input v-model="meta.name" placeholder="Name" :readonly="!editable"/>
<el-form-item prop="name" label="Name">
<el-input v-model="meta.name" :placeholder="$t('Name')" :readonly="!editable"/>
</el-form-item>
</template>
<template v-if="meta">
<el-form-item label="Desc">
<el-input v-model="meta.desc" placeholder="Description" :readonly="!editable"/>
<el-form-item prop="desc" label="Desc">
<el-input v-model="meta.desc" :placeholder="$t('Description')" :readonly="!editable"/>
</el-form-item>
<el-form-item label="Props">
<el-link :underline="false" @click="onClickEditProps" :disabled="!editable">
<template v-if="Object.keys(meta.props).length">
<el-tag type="success" size="mini" v-for="(option, key) in meta.props" :key="key">{{key}}</el-tag>
</template>
<template v-else>Nothing</template>
<template v-else>{{$t('Empty')}}</template>
</el-link>
</el-form-item>
<el-form-item label="Output">
<div style="display: flex;flex: 1;">
<el-select style="flex: 1;" v-model="meta.output" :disabled="!editable" allow-create filterable multiple
placeholder="Output"/>
:placeholder="$t('Output')"/>
</div>
</el-form-item>
</template>
</el-form>
<el-input v-if="meta" class="script-editor" :readonly=" !editable" type="textarea"
<el-input v-if="meta" class="script-editor" :readonly=" !editable" type="textarea" :placeholder="$t('Code')"
v-model="meta.script"></el-input>
</div>
<div slot="footer" class="dialog-footer">
......@@ -58,6 +55,15 @@
visible: false,
meta: null,
propsEditorVisible: false,
rules: {
id: [
{ required: true, message: '', trigger: 'blur' },
],
name: [
{ required: true, message: '', trigger: 'blur' }
],
},
}
},
computed: {
......@@ -78,6 +84,8 @@
this.$refs.propsEditorDialog.edit(this.meta.props);
},
save() {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.oldMetaID !== this.meta.id && this.$store.getters.metaIDExists(this.meta.id)) {
this.$alert(this.$t('This Meta ID is in use, can not save'), this.$t('Alert'))
.catch((e) => {
......@@ -86,6 +94,10 @@
this.$emit('input', this.meta);
this.visible = false;
}
} else {
return false;
}
});
},
cancel() {
this.visible = false;
......
<template>
<editor-wrapper :editable="editable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<el-select :disabled="!editable" :value="editValue" @input="onInput" :placeholder="property.default" class="el-select">
<el-select :disabled="!editable" :value="editValue" filterable @input="onInput" :placeholder="property.default" class="el-select">
<el-option
v-for="(item, key) in assets"
:key="key"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment