Преглед изворни кода

feat(组件): 编辑状态更新数据

tangning пре 2 година
родитељ
комит
aa9a4c26f2
1 измењених фајлова са 9 додато и 1 уклоњено
  1. 9 1
      src/views/product/ref.vue

+ 9 - 1
src/views/product/ref.vue

@@ -76,7 +76,7 @@
         },
       ];
 
-      const [registerTable, { expandAll, reload, collapseAll }] = useTable({
+      const [registerTable, { expandAll, reload, collapseAll, getDataSource }] = useTable({
         title: '商品属性',
         api: attributeListApi,
         columns: columns,
@@ -84,6 +84,14 @@
         showIndexColumn: false,
         // rowSelection: { type: 'checkbox' },
         // rowKey: 'id',
+        beforeFetch: async () => {
+          let EditKeyRef = currentEditKeyRef.value;
+          if (EditKeyRef) {
+            let record: EditRecordRow = await getDataSource()?.find((ele) => ele.key == EditKeyRef);
+            record.onEdit?.(false, false);
+            currentEditKeyRef.value = '';
+          }
+        },
         bordered: true,
         fetchSetting: {
           pageField: 'page',