Browse Source

feat:修改台账设置

DESKTOP-USV654P\pc 4 months ago
parent
commit
c4792a3824

+ 2 - 2
.env.development

@@ -15,8 +15,8 @@ VITE_DROP_CONSOLE = false
 
 # 接口地址
 # 如果没有跨域问题,直接在这里配置即可
-# VITE_GLOB_API_URL=http://localhost:8080
- VITE_GLOB_API_URL=http://10.150.10.139:8888/api
+VITE_GLOB_API_URL=http://localhost:8080
+#  VITE_GLOB_API_URL=http://10.150.10.139:8888/api
 
 #VITE_GLOB_API_URL=http://172.21.92.28:8080
 # 文件上传接口  可选

+ 32 - 7
src/views/ledger/design/components/stepButtonConfig.vue

@@ -13,7 +13,7 @@
             <a-input
               v-model:value="record[column.key]"
               placeholder="输入接口地址"
-              @change="handelInput(index, 1, record[column.key])"
+              @change="handelInput(index, 1, record[column.key], column.key)"
             />
           </template>
         </template>
@@ -22,7 +22,10 @@
     <div style="height: 50%">
       <BasicTable @register="registerTableItem">
         <template #toolbar>
-          <div> 删除、作废 url 填表名</div>
+          <div class="flex items-center">
+            <div> 删除、作废 url 填表名</div>
+            <a-button class="ml-4" type="dashed" @click="addDetailRow(2)"> 添加 </a-button>
+          </div>
         </template>
         <template #bodyCell="{ column, record, index }">
           <template v-if="column.key === 'use'">
@@ -31,11 +34,18 @@
               @change="handelChecked(index, 2, $event)"
             />
           </template>
+          <template v-if="column.key === 'label'">
+            <a-input
+              v-model:value="record[column.key]"
+              placeholder="名称"
+              @change="handelInput(index, 2, record[column.key], column.key)"
+            />
+          </template>
           <template v-if="column.key === 'url'">
             <a-input
               v-model:value="record[column.key]"
               placeholder="输入接口地址"
-              @change="handelInput(index, 2, record[column.key])"
+              @change="handelInput(index, 2, record[column.key], column.key)"
             />
           </template>
         </template>
@@ -92,7 +102,7 @@
     pagination: false,
   });
 
-  const [registerTableItem] = useTable({
+  const [registerTableItem, { setTableData: setTableDataItem }] = useTable({
     title: '列表功能',
     columns: columns,
     dataSource: dataSourceItem,
@@ -112,11 +122,11 @@
       dataSourceItem.value[index]['use'] = checked;
     }
   };
-  const handelInput = (index: number, type: number, value: string) => {
+  const handelInput = (index: number, type: number, value: string, key: string) => {
     if (type === 1) {
-      dataSource.value[index]['url'] = value;
+      dataSource.value[index][key] = value;
     } else {
-      dataSourceItem.value[index]['url'] = value;
+      dataSourceItem.value[index][key] = value;
     }
   };
 
@@ -157,6 +167,21 @@
     dataSourceItem.value = cloneDeep(buttonConfigs.item);
   };
 
+  const addDetailRow = (type: number) => {
+    const newData: LedgerButtonItemConfigs = {
+      use: false,
+      label: '名称',
+      value: 'update',
+      url: '',
+    };
+    if (type === 1) {
+      dataSource.value.push(newData);
+    } else {
+      dataSourceItem.value.push(newData);
+      setTableDataItem([...dataSourceItem.value]);
+    }
+  };
+
   defineExpose({ validateStep, setTableData });
 </script>
 

+ 11 - 6
src/views/ledger/template/index.vue

@@ -52,6 +52,7 @@
     deleteLedgerLedgerCustom,
     putLedgerLedgerCustom,
   } from '/@/services/apis/LedgerCustomController';
+  import { defHttp } from '/@/utils/http/axios';
 
   const { currentRoute } = useRouter();
   const { setTitle } = useTabs();
@@ -167,7 +168,7 @@
             datasourceType: item.bindObject,
             params: { itemId: item.bindValue },
             labelField: 'name',
-            valueField: 'code',
+            valueField: 'value',
             getPopupContainer: () => document.body,
           };
         }
@@ -228,11 +229,15 @@
   };
 
   const handelUpdate = async (record: any, url: string) => {
-    await putLedgerLedgerCustom({
-      enabledMark: 0,
-      tableName: url,
-      id: record.id,
-    });
+    if (url.startsWith('/')) {
+      await defHttp.post({ url: url, data: { id: record.id } });
+    } else {
+      await putLedgerLedgerCustom({
+        enabledMark: 0,
+        tableName: url,
+        id: record.id,
+      });
+    }
     reload();
   };