提交 c1ca690c 编写于 作者: RedPig97's avatar RedPig97

update: 表格重置项

上级 5f9130ef
...@@ -32,5 +32,17 @@ ...@@ -32,5 +32,17 @@
aggMode: "{{item.aggMode}}", aggMode: "{{item.aggMode}}",
{{/if}} {{/if}}
{{/eq}} {{/eq}}
{{#if item.enableRowEdit}}
{{#each ctrl.psDEGridEditItems as | editColumn | }}
{{#if (eq editColumn.codeName item.codeName)}}
{{#if editColumn.resetItemName}}
resetItemName: "{{editColumn.resetItemName}}",
{{/if}}
{{#if editColumn.valueItemName}}
valueItemName: "{{editColumn.valueItemName}}",
{{/if}}
{{/if}}
{{/each}}
{{/if}}
}, },
{{/unless}} {{/unless}}
...@@ -56,7 +56,7 @@ interface DropdownListProps { ...@@ -56,7 +56,7 @@ interface DropdownListProps {
/** /**
* @description 代码表标识 * @description 代码表标识
*/ */
codeListTag?: string; codeListTag: string;
/** /**
* @description 代码表类型 * @description 代码表类型
...@@ -81,10 +81,7 @@ const props = withDefaults(defineProps<DropdownListProps>(), { ...@@ -81,10 +81,7 @@ const props = withDefaults(defineProps<DropdownListProps>(), {
const emit = defineEmits<EditorEmit>() const emit = defineEmits<EditorEmit>()
const { handleEditorNavParams, loadCodeListData } = new EditorBase(); const { handleEditorNavParams, loadCodeListData } = new EditorBase();
const { navContext, navViewParam } = handleEditorNavParams(props); const { navContext, navViewParam } = handleEditorNavParams(props);
let curValue: Ref<any> = ref( let curValue : Ref<any> = computed(() => props.multiple ? props.value?.split(props.valueSeparator) : props.value);
props.multiple ?
props.value?.split(props.valueSeparator) : props.value
);
let items: Ref<IParam[]> = ref([]); let items: Ref<IParam[]> = ref([]);
const onChange = (select: any, option: any) => { const onChange = (select: any, option: any) => {
const value = typeOf(select) == 'array' ? select.join(props.valueSeparator) : select; const value = typeOf(select) == 'array' ? select.join(props.valueSeparator) : select;
......
...@@ -158,6 +158,7 @@ export class GridControl extends MDControl { ...@@ -158,6 +158,7 @@ export class GridControl extends MDControl {
if (items.value[rowIndex][tag] !== data) { if (items.value[rowIndex][tag] !== data) {
items.value[rowIndex][tag] = data; items.value[rowIndex][tag] = data;
items.value[rowIndex]["rowDataState"] = "update"; items.value[rowIndex]["rowDataState"] = "update";
this.resetGridData(tag,data,rowIndex);
this.validateField(tag, data, rowIndex); this.validateField(tag, data, rowIndex);
} }
break; break;
...@@ -166,6 +167,26 @@ export class GridControl extends MDControl { ...@@ -166,6 +167,26 @@ export class GridControl extends MDControl {
} }
} }
/**
* @description 重置表格数据
* @param {string} name
* @param {*} data
* @param {number} rowIndex
* @memberof GridControl
*/
public resetGridData(name: string, data: any, rowIndex: number) {
const { columnsModel } = this.state;
if (columnsModel && columnsModel.length > 0) {
columnsModel.forEach((column: any) => {
if (column.resetItemName && Object.is(name, column.resetItemName)) {
this.onEditorEvent({tag: column.dataIndex, action: 'valueChange', data: null},rowIndex);
if (column.valueItemName) {
this.onEditorEvent({tag: column.valueItemName, action: 'valueChange', data: null},rowIndex);
}
}
})
}
}
/** /**
* *
......
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
} }
.ant-card-body { .ant-card-body {
text-align: left; text-align: left;
padding: 16px;
} }
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册