|
|
|
@ -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> |
|
|
|
|