|
@@ -72,10 +72,18 @@
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="操作" align="center" width="175">
|
|
<el-table-column label="操作" align="center" width="175">
|
|
- <template #default="{ row }">
|
|
|
|
- <el-button text type="danger" @click="toDel(row)">删除</el-button>
|
|
|
|
- <!-- <el-button text type="primary" @click="toDel(row)">向下</el-button>
|
|
|
|
- <el-button text type="success" @click="toDel(row)">向上</el-button> -->
|
|
|
|
|
|
+ <template #default="{ row, $index }">
|
|
|
|
+ <el-col :span="24" class="propbtn">
|
|
|
|
+ <el-col :span="8">
|
|
|
|
+ <el-button v-if="$index > 0" text type="primary" @click="toUp('up', $index, row)">向上</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="8">
|
|
|
|
+ <el-button v-if="$index < form.columns.length - 1" text type="success" @click="toUp('down', $index, row)">向下</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="8">
|
|
|
|
+ <el-button text type="danger" @click="toDel(row)">删除</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-col>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -125,7 +133,10 @@ let form: Ref<{ columns: any; name_zh: string; remark: string; name: string; pro
|
|
project: '',
|
|
project: '',
|
|
dir: '',
|
|
dir: '',
|
|
});
|
|
});
|
|
|
|
+
|
|
form.value = props.form as { columns: []; name_zh: ''; remark: ''; name: ''; project: ''; dir: '' };
|
|
form.value = props.form as { columns: []; name_zh: ''; remark: ''; name: ''; project: ''; dir: '' };
|
|
|
|
+console.log(form.value.columns.length);
|
|
|
|
+
|
|
const rules = reactive<FormRules>({
|
|
const rules = reactive<FormRules>({
|
|
name: [{ required: true, message: '表名', trigger: 'blur' }],
|
|
name: [{ required: true, message: '表名', trigger: 'blur' }],
|
|
});
|
|
});
|
|
@@ -143,10 +154,16 @@ const toAdd = () => {
|
|
list.push({ index: false, required: false, type: 'String' });
|
|
list.push({ index: false, required: false, type: 'String' });
|
|
};
|
|
};
|
|
// 删除字段
|
|
// 删除字段
|
|
-const toDel = (row: { title: String }) => {
|
|
|
|
|
|
+const toDel = (row: { title: string }) => {
|
|
let info = form.value.columns.filter((i: any) => i.title != row.title);
|
|
let info = form.value.columns.filter((i: any) => i.title != row.title);
|
|
form.value.columns = info;
|
|
form.value.columns = info;
|
|
};
|
|
};
|
|
|
|
+const toUp = (type: string, $index: number, row: any) => {
|
|
|
|
+ let list: Array<Arr> = form.value.columns;
|
|
|
|
+ list.splice($index, 1);
|
|
|
|
+ if (type == 'up') list.splice($index - 1, 0, row);
|
|
|
|
+ else if (type == 'down') list.splice($index + 1, 0, row);
|
|
|
|
+};
|
|
// 提交
|
|
// 提交
|
|
const submitForm = async (formEl: FormInstance | undefined) => {
|
|
const submitForm = async (formEl: FormInstance | undefined) => {
|
|
if (!formEl) return;
|
|
if (!formEl) return;
|
|
@@ -205,4 +222,7 @@ const toBack = () => {
|
|
.el-button + .el-button {
|
|
.el-button + .el-button {
|
|
margin-left: 0;
|
|
margin-left: 0;
|
|
}
|
|
}
|
|
|
|
+.propbtn {
|
|
|
|
+ display: flex;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|