Browse Source

chore: 调整样式

master
wangxiang 1 year ago
parent
commit
5ab2f43b3a
  1. 114
      src/views/system/devtools/genCustomObj/GenCustomObjModal.vue
  2. 7
      src/views/system/devtools/genCustomObj/genCustomObj.data.ts

114
src/views/system/devtools/genCustomObj/GenCustomObjModal.vue

@ -1,48 +1,51 @@ @@ -1,48 +1,51 @@
<template>
<BasicModal
v-bind="$attrs"
width="820px"
@register="registerModal"
@ok="handleSubmit"
>
<BasicForm @register="registerForm"/>
<BasicTable @register="gencodeCustomFieldRegisterTable">
<template #toolbar>
<a-button
v-show="state.tag != 'view'"
type="primary"
@click="handleAdd()"
>新增</a-button>
</template>
<template #bodyCell="{ index, column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
label: '查看',
icon: 'fa-regular:eye',
onClick: handleViewEdit.bind(null, record)
},
{
label: '编辑',
icon: 'fa6-regular:pen-to-square',
onClick: handleEdit.bind(null, record, index)
},
{
label: '删除',
icon: 'ant-design:delete-outlined',
color: 'error',
onClick: handleDel.bind(null, record, index)
}]"
/>
<div ref="modal" :class="prefixCls">
<BasicModal
v-bind="$attrs"
width="820px"
:getContainer="modal"
@register="registerModal"
@ok="handleSubmit"
>
<BasicForm @register="registerForm"/>
<BasicTable v-show="state.tableVisible" @register="gencodeCustomFieldRegisterTable">
<template #toolbar>
<a-button
v-show="state.tag != 'view'"
type="primary"
@click="handleAdd()"
>新增</a-button>
</template>
</template>
</BasicTable>
<GencodeCustomFieldModal @register="gencodeCustomFieldRegisterModal" @success="handleGencodeCustomField"/>
</BasicModal>
<template #bodyCell="{ index, column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
label: '查看',
icon: 'fa-regular:eye',
onClick: handleViewEdit.bind(null, record)
},
{
label: '编辑',
icon: 'fa6-regular:pen-to-square',
onClick: handleEdit.bind(null, record, index)
},
{
label: '删除',
icon: 'ant-design:delete-outlined',
color: 'error',
onClick: handleDel.bind(null, record, index)
}]"
/>
</template>
</template>
</BasicTable>
<GencodeCustomFieldModal @register="gencodeCustomFieldRegisterModal" @success="handleGencodeCustomField"/>
</BasicModal>
</div>
</template>
<script lang="ts" setup>
import { reactive, computed } from 'vue';
import {reactive, computed, ref} from 'vue';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema, gencodeCustomFieldColumns } from './genCustomObj.data';
import { saveAndGencodeCustomField, getGencodeCustomObj, selectListByValue } from '/@/api/platform/system/controller/gencodeCustomObj';
@ -52,16 +55,21 @@ @@ -52,16 +55,21 @@
import { useMessage } from '/@/hooks/web/useMessage';
import { isNil } from 'lodash-es';
import { isEmpty } from '/@/utils/is';
import {useDesign} from '/@/hooks/web/useDesign';
/** 通用变量统一声明区域 */
interface WindowState {
tag: string;
dataSource: Recordable[];
tableVisible: boolean;
}
const state = reactive<WindowState>({
tag: '',
dataSource: []
dataSource: [],
tableVisible: false
});
const modal = ref();
const { prefixCls } = useDesign('gen-custom-obj');
const { createConfirm, createMessage } = useMessage();
/** https://v3.cn.vuejs.org/api/options-data.html#emits */
const emit = defineEmits(['success', 'register']);
@ -99,10 +107,11 @@ @@ -99,10 +107,11 @@
//
state.tag = data._tag;
state.dataSource = [];
state.tableVisible = false;
const id = data.record?.id;
const classValue = data.record?.value;
const props: Partial<ModalProps> = { confirmLoading: false, showOkBtn: true };
await updateSchema({
await updateSchema([{
field: 'value',
componentProps: {
disabled: state.tag != 'add'
@ -123,7 +132,13 @@ @@ -123,7 +132,13 @@
},
validateTrigger: 'blur'
}]
});
},
{
field: 'type',
componentProps: {
onChange: (e: ChangeEvent) => state.tableVisible = e.target.value == '0'
}
}]);
// tag
switch (state.tag) {
case 'add':
@ -134,12 +149,14 @@ @@ -134,12 +149,14 @@
props.showOkBtn = false;
const getGencodeCustomObjView = await getGencodeCustomObj(id);
state.dataSource = getGencodeCustomObjView?.gencodeCustomFieldList || [];
state.tableVisible = getGencodeCustomObjView.type == '0';
await setFieldsValue(getGencodeCustomObjView);
break;
case 'edit':
props.title = '编辑java类型';
const getGencodeCustomObjEdit = await getGencodeCustomObj(id);
state.dataSource = getGencodeCustomObjEdit?.gencodeCustomFieldList || [];
state.tableVisible = getGencodeCustomObjEdit.type == '0';
await setFieldsValue(getGencodeCustomObjEdit);
break;
}
@ -194,3 +211,12 @@ @@ -194,3 +211,12 @@
}
}
</script>
<style scoped lang="less">
@prefix-cls: ~'@{namespace}-gen-custom-obj';
.@{prefix-cls} {
:deep(.ant-modal) {
top: 40px;
}
}
</style>

7
src/views/system/devtools/genCustomObj/genCustomObj.data.ts

@ -83,7 +83,6 @@ export const formSchema: FormSchema[] = [ @@ -83,7 +83,6 @@ export const formSchema: FormSchema[] = [
label: '排序',
component: 'InputNumber',
colProps: { span: 16 },
defaultValue: 1,
required: true,
componentProps: {
style: { width:'100%' },
@ -96,11 +95,11 @@ export const formSchema: FormSchema[] = [ @@ -96,11 +95,11 @@ export const formSchema: FormSchema[] = [
component: 'RadioGroup',
colProps: { span: 16 },
required: true,
defaultValue: '0',
defaultValue: '1',
componentProps: {
options: [
{ label: '是', value: '0' },
{ label: '否', value: '1' }
{ label: '是', value: '1' },
{ label: '否', value: '0' }
]
}
}

Loading…
Cancel
Save