|
@@ -126,6 +126,34 @@ export default function TableEdit(props: {
|
|
|
};
|
|
|
|
|
|
const columns: ProColumns[] = [
|
|
|
+ {
|
|
|
+ title: "操作",
|
|
|
+ valueType: "option",
|
|
|
+ width: 120,
|
|
|
+ render: (_text, record, _, action) =>
|
|
|
+ record.isPreDefined
|
|
|
+ ? []
|
|
|
+ : [
|
|
|
+ <a
|
|
|
+ key="editable"
|
|
|
+ onClick={() => {
|
|
|
+ action?.startEditable?.(record.id);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 编辑
|
|
|
+ </a>,
|
|
|
+ <a
|
|
|
+ key="delete"
|
|
|
+ onClick={() => {
|
|
|
+ setDataSource(
|
|
|
+ dataSource.filter((item) => item.id !== record.id)
|
|
|
+ );
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </a>,
|
|
|
+ ],
|
|
|
+ },
|
|
|
{
|
|
|
title: "字段代码",
|
|
|
dataIndex: "schemaName",
|
|
@@ -160,7 +188,6 @@ export default function TableEdit(props: {
|
|
|
renderFormItem: (_schema, config, form) => {
|
|
|
const model = config.record;
|
|
|
const rowKey = config.recordKey;
|
|
|
- console.log(model);
|
|
|
return (
|
|
|
<span>
|
|
|
<LangInput
|
|
@@ -209,7 +236,7 @@ export default function TableEdit(props: {
|
|
|
},
|
|
|
render: (text, record) => {
|
|
|
return record.type === DataType.Decimal
|
|
|
- ? `${record.precision},${record.scale}`
|
|
|
+ ? `${record.precision}${record.scale ? `,${record.scale}` : ""}`
|
|
|
: text;
|
|
|
},
|
|
|
renderFormItem: (_schema, config, form) => {
|
|
@@ -285,37 +312,14 @@ export default function TableEdit(props: {
|
|
|
{
|
|
|
title: "预定义字段",
|
|
|
dataIndex: "isPreDefined",
|
|
|
- renderText: (text, record) => {
|
|
|
+ valueType: "switch",
|
|
|
+ readonly: true,
|
|
|
+ render: (text, record) => {
|
|
|
return record.isPreDefined ? "是" : "否";
|
|
|
},
|
|
|
- },
|
|
|
- {
|
|
|
- title: "操作",
|
|
|
- valueType: "option",
|
|
|
- width: 120,
|
|
|
- render: (_text, record, _, action) =>
|
|
|
- record.isPreDefined
|
|
|
- ? []
|
|
|
- : [
|
|
|
- <a
|
|
|
- key="editable"
|
|
|
- onClick={() => {
|
|
|
- action?.startEditable?.(record.id);
|
|
|
- }}
|
|
|
- >
|
|
|
- 编辑
|
|
|
- </a>,
|
|
|
- <a
|
|
|
- key="delete"
|
|
|
- onClick={() => {
|
|
|
- setDataSource(
|
|
|
- dataSource.filter((item) => item.id !== record.id)
|
|
|
- );
|
|
|
- }}
|
|
|
- >
|
|
|
- 删除
|
|
|
- </a>,
|
|
|
- ],
|
|
|
+ renderFormItem: (schema, config) => {
|
|
|
+ return config.record.isPreDefined ? "是" : "否";
|
|
|
+ },
|
|
|
},
|
|
|
];
|
|
|
|