😎代码优化
This commit is contained in:
parent
c5a032f42a
commit
cd8eb395a2
@ -286,11 +286,6 @@ const submit = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const isOrNotSelect = () => [
|
||||
{ label: '是', value: 1 },
|
||||
{ label: '否', value: 0 },
|
||||
];
|
||||
|
||||
// 导出对象
|
||||
defineExpose({ openDialog });
|
||||
</script>
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<div class="sys-codeGenConfig-container">
|
||||
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="600px">
|
||||
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="700px">
|
||||
<template #header>
|
||||
<div style="color: #fff">
|
||||
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
|
||||
<span> 选择正则 </span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<el-table-column prop="pattern" label="正则式" minWidth="120" show-overflow-tooltip />
|
||||
<el-table-column prop="action" label="操作" width="100" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-button type="primary" @click="handleDeleteRule(scope)">删除</el-button>
|
||||
<el-button icon="ele-Delete" text type="danger" @click="handleDeleteRule(scope)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -33,22 +33,11 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tool-box {
|
||||
padding-bottom: 20px;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
align-items: center;
|
||||
// background: red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, reactive, ref, toRaw } from 'vue';
|
||||
import { reactive, ref, toRaw } from 'vue';
|
||||
import ruleDialog from '/@/views/system/codeGen/component/ruleDialog.vue';
|
||||
|
||||
const emits = defineEmits(['submitVerify']);
|
||||
// const fkDialogRef = ref();
|
||||
const ruleDialogRef = ref();
|
||||
const state = reactive({
|
||||
id: 0,
|
||||
@ -58,29 +47,9 @@ const state = reactive({
|
||||
title: '',
|
||||
});
|
||||
|
||||
onMounted(async () => {});
|
||||
|
||||
// 添加返回
|
||||
const submitRuleOK = (data: any) => {
|
||||
let row = toRaw(data);
|
||||
if (state.tableData === null) {
|
||||
state.tableData = [];
|
||||
}
|
||||
console.log('row', state.tableData);
|
||||
state.tableData.push(row);
|
||||
// console.log('submitRuleOK',state.tableData);
|
||||
};
|
||||
|
||||
onUnmounted(() => {
|
||||
// mittBus.off('submitRefresh', () => { });
|
||||
//mittBus.off('submitRefreshFk', () => { });
|
||||
});
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (row: any) => {
|
||||
// handleQuery(addRow);
|
||||
state.title = `${row.columnComment} -- 校验规则`;
|
||||
// console.log('row',row);
|
||||
state.title = `校验规则 -- ${row.columnComment}`;
|
||||
state.tableData = new Array();
|
||||
if (row.rules != '') {
|
||||
state.tableData = JSON.parse(row.rules);
|
||||
@ -91,7 +60,7 @@ const openDialog = (row: any) => {
|
||||
state.isShowDialog = true;
|
||||
};
|
||||
|
||||
// 打开弹窗
|
||||
// 打开验证规则弹窗
|
||||
const openRuleDialog = () => {
|
||||
ruleDialogRef.value.openDialog(state.id);
|
||||
};
|
||||
@ -115,6 +84,15 @@ const submit = async () => {
|
||||
closeDialog();
|
||||
};
|
||||
|
||||
// 添加返回
|
||||
const submitRuleOK = (data: any) => {
|
||||
let row = toRaw(data);
|
||||
if (state.tableData === null) {
|
||||
state.tableData = [];
|
||||
}
|
||||
state.tableData.push(row);
|
||||
};
|
||||
|
||||
// 删除验证规则
|
||||
const handleDeleteRule = (scope: any) => {
|
||||
state.tableData.splice(scope.$index, 1);
|
||||
@ -123,3 +101,13 @@ const handleDeleteRule = (scope: any) => {
|
||||
// 导出对象
|
||||
defineExpose({ openDialog });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tool-box {
|
||||
padding-bottom: 20px;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
align-items: center;
|
||||
// background: red;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user