😎代码优化

This commit is contained in:
zuohuaijun 2024-08-28 12:02:50 +08:00
parent c5a032f42a
commit cd8eb395a2
3 changed files with 25 additions and 41 deletions

View File

@ -286,11 +286,6 @@ const submit = () => {
}); });
}; };
const isOrNotSelect = () => [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
];
// //
defineExpose({ openDialog }); defineExpose({ openDialog });
</script> </script>

View File

@ -1,8 +1,9 @@
<template> <template>
<div class="sys-codeGenConfig-container"> <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> <template #header>
<div style="color: #fff"> <div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
<span> 选择正则 </span> <span> 选择正则 </span>
</div> </div>
</template> </template>

View File

@ -18,7 +18,7 @@
<el-table-column prop="pattern" label="正则式" minWidth="120" show-overflow-tooltip /> <el-table-column prop="pattern" label="正则式" minWidth="120" show-overflow-tooltip />
<el-table-column prop="action" label="操作" width="100" align="center" show-overflow-tooltip> <el-table-column prop="action" label="操作" width="100" align="center" show-overflow-tooltip>
<template #default="scope"> <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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -33,22 +33,11 @@
</div> </div>
</template> </template>
<style lang="scss" scoped>
.tool-box {
padding-bottom: 20px;
display: flex;
gap: 20px;
align-items: center;
// background: red;
}
</style>
<script lang="ts" setup> <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'; import ruleDialog from '/@/views/system/codeGen/component/ruleDialog.vue';
const emits = defineEmits(['submitVerify']); const emits = defineEmits(['submitVerify']);
// const fkDialogRef = ref();
const ruleDialogRef = ref(); const ruleDialogRef = ref();
const state = reactive({ const state = reactive({
id: 0, id: 0,
@ -58,29 +47,9 @@ const state = reactive({
title: '', 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) => { const openDialog = (row: any) => {
// handleQuery(addRow); state.title = `校验规则 -- ${row.columnComment}`;
state.title = `${row.columnComment} -- 校验规则`;
// console.log('row',row);
state.tableData = new Array(); state.tableData = new Array();
if (row.rules != '') { if (row.rules != '') {
state.tableData = JSON.parse(row.rules); state.tableData = JSON.parse(row.rules);
@ -91,7 +60,7 @@ const openDialog = (row: any) => {
state.isShowDialog = true; state.isShowDialog = true;
}; };
// //
const openRuleDialog = () => { const openRuleDialog = () => {
ruleDialogRef.value.openDialog(state.id); ruleDialogRef.value.openDialog(state.id);
}; };
@ -115,6 +84,15 @@ const submit = async () => {
closeDialog(); closeDialog();
}; };
//
const submitRuleOK = (data: any) => {
let row = toRaw(data);
if (state.tableData === null) {
state.tableData = [];
}
state.tableData.push(row);
};
// //
const handleDeleteRule = (scope: any) => { const handleDeleteRule = (scope: any) => {
state.tableData.splice(scope.$index, 1); state.tableData.splice(scope.$index, 1);
@ -123,3 +101,13 @@ const handleDeleteRule = (scope: any) => {
// //
defineExpose({ openDialog }); defineExpose({ openDialog });
</script> </script>
<style lang="scss" scoped>
.tool-box {
padding-bottom: 20px;
display: flex;
gap: 20px;
align-items: center;
// background: red;
}
</style>