mirror of
https://gitee.com/devlive-community/datacap.git
synced 2024-12-02 20:17:45 +08:00
[Core] [Refactor] [UI] [Source] [Manager] Remove unused component
This commit is contained in:
parent
1e1168a300
commit
c8a49cbc44
@ -199,7 +199,7 @@ export default defineComponent({
|
||||
type: null;
|
||||
engine: null;
|
||||
comment: null;
|
||||
database: { name: null, id: null };
|
||||
database: { name: null, id: string };
|
||||
}) => {
|
||||
const structure: StructureModel = {
|
||||
title: item.name,
|
||||
@ -271,7 +271,7 @@ export default defineComponent({
|
||||
engine: null;
|
||||
isKey: null;
|
||||
defaultValue: null;
|
||||
table: { name: null, id: null, database: { name: null, id: null } };
|
||||
table: { name: null, id: null, database: { name: null, id: string } };
|
||||
}) => {
|
||||
const structure: StructureModel = {
|
||||
title: item.name,
|
||||
|
@ -1,177 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<Modal v-model="visible"
|
||||
:title="$t('source.manager.new') + ' [ ' + $t('source.manager.newTable') + ' ]'"
|
||||
:mask-closable="false"
|
||||
@cancel="handlerCancel()">
|
||||
<Form :model="formState"
|
||||
:label-width="120">
|
||||
<FormItem :label="$t('source.manager.tableName')">
|
||||
<Input v-model="formState.name"/>
|
||||
</FormItem>
|
||||
<FormItem :label="$t('source.manager.tableComment')">
|
||||
<Input v-model="formState.comment"
|
||||
type="textarea">
|
||||
</Input>
|
||||
</FormItem>
|
||||
<FormItem :label="$t('source.manager.tableEngine')">
|
||||
<Input v-model="formState.engine"/>
|
||||
</FormItem>
|
||||
<Divider orientation="left">{{ $t('source.manager.column') }}</Divider>
|
||||
<Collapse accordion>
|
||||
<Panel v-for="(item, index) in formState.columns"
|
||||
:key="index">
|
||||
{{ item.name }}
|
||||
<Button type="text"
|
||||
size="small"
|
||||
@click="handlerRemove(index)">
|
||||
<FontAwesomeIcon icon="circle-minus"/>
|
||||
</Button>
|
||||
<Button type="text"
|
||||
size="small"
|
||||
@click="handlerAdd">
|
||||
<FontAwesomeIcon icon="circle-plus"/>
|
||||
</Button>
|
||||
<template #content>
|
||||
<Row>
|
||||
<Col span="12">
|
||||
<FormItem :label="$t('source.manager.columnName')"
|
||||
:label-width="80">
|
||||
<Input v-model="item.name"/>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="12">
|
||||
<FormItem :label="$t('source.manager.columnType')"
|
||||
:label-width="80">
|
||||
<Input v-model="item.type"/>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="12">
|
||||
<FormItem :label="$t('source.manager.columnLength')"
|
||||
:label-width="80">
|
||||
<InputNumber v-model="item.length"/>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="12">
|
||||
<FormItem :label="$t('source.manager.columnDefaultValue')"
|
||||
:label-width="80">
|
||||
<Input v-model="item.defaultValue"/>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="12">
|
||||
<FormItem :label="$t('source.manager.columnPrimaryKey')"
|
||||
:label-width="80">
|
||||
<Switch v-model="item.primaryKey"/>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="12">
|
||||
<FormItem :label="$t('source.manager.columnAutoIncrement')"
|
||||
:label-width="80">
|
||||
<Switch v-model="item.autoIncrement"/>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="12">
|
||||
<FormItem :label="$t('source.manager.columnIsNullable')">
|
||||
<Switch v-model="item.isNullable"/>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="24">
|
||||
<FormItem :label="$t('source.manager.columnComment')"
|
||||
:label-width="80">
|
||||
<Input v-model="item.comment"
|
||||
type="textarea">
|
||||
</Input>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
</template>
|
||||
</Panel>
|
||||
</Collapse>
|
||||
</Form>
|
||||
<template #footer>
|
||||
<Button type="primary"
|
||||
:loading="loading"
|
||||
@click="handlerSave()">
|
||||
<FontAwesomeIcon v-if="!loading"
|
||||
icon="save">
|
||||
</FontAwesomeIcon>
|
||||
{{ $t('common.save') }}
|
||||
</Button>
|
||||
</template>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import {defineComponent} from "vue";
|
||||
import {DataStructureModel} from "@/model/DataStructure";
|
||||
import TableService from "@/services/Table";
|
||||
|
||||
export default defineComponent({
|
||||
name: "TableCreate",
|
||||
props: {
|
||||
isVisible: {
|
||||
type: Boolean,
|
||||
default: () => false
|
||||
},
|
||||
data: {
|
||||
type: DataStructureModel
|
||||
}
|
||||
},
|
||||
data()
|
||||
{
|
||||
return {
|
||||
loading: false,
|
||||
formState: {
|
||||
name: null,
|
||||
comment: null,
|
||||
engine: null,
|
||||
columns: [{name: 'column_name', type: null, length: 0, comment: null, defaultValue: null, primaryKey: false, autoIncrement: null, isNullable: false}]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handlerSave()
|
||||
{
|
||||
this.loading = true;
|
||||
TableService.createTable(this.data.databaseId, this.formState)
|
||||
.then(response => {
|
||||
if (response.data) {
|
||||
if (response.data.isSuccessful) {
|
||||
this.$Message.success(this.$t('common.success'));
|
||||
this.handlerCancel();
|
||||
}
|
||||
else {
|
||||
this.$Message.error(response.data?.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
.finally(() => this.loading = false)
|
||||
},
|
||||
handlerAdd()
|
||||
{
|
||||
const newColumn = {name: 'column_name', type: null, length: 0, comment: null, defaultValue: null, primaryKey: false, autoIncrement: null, isNullable: false}
|
||||
this.formState.columns.push(newColumn);
|
||||
},
|
||||
handlerRemove(index: number)
|
||||
{
|
||||
this.formState.columns.splice(index, 1);
|
||||
},
|
||||
handlerCancel()
|
||||
{
|
||||
this.visible = false;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
visible: {
|
||||
get(): boolean
|
||||
{
|
||||
return this.isVisible;
|
||||
},
|
||||
set(value: boolean)
|
||||
{
|
||||
this.$emit('close', value);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user