Kaynağa Gözat

feat:修改接口

AmandaG 10 ay önce
ebeveyn
işleme
392e53dcf1

+ 1 - 1
src/api/module/system.ts

@@ -22,7 +22,7 @@ export const getsubscribe = (params: any, config: any) => {
  * 提交subscribe数据
  */
 export const Savesubscribe = (params: any, config: any) => {
-  return HttpAxios.get(
+  return HttpAxios.post(
     `${baseUrl}`,
     {
       action: 'system_setting',

+ 83 - 1
src/views/SystemSettings/src/SystemSettings.vue

@@ -60,12 +60,82 @@ const UnsavedCollapse = () => {
   CollapseActive.value = ''
 }
 
+// 表格列
+const AddedRulesColumns = ref([
+  {
+    field: 'Event',
+    title: 'Event',
+    type: 'normal',
+    formatter: ''
+  },
+  {
+    field: 'Event Details',
+    title: 'Event Details',
+    type: 'normal',
+    formatter: ''
+  },
+  {
+    field: 'Frequency',
+    title: 'Frequency',
+    type: 'normal',
+    formatter: ''
+  },
+  {
+    field: 'Methods',
+    title: 'Methods',
+    type: 'normal',
+    formatter: ''
+  }
+])
+const SubShipmentsColumns = ref([
+  {
+    field: 'h_bol',
+    title: 'HBOL/HAWB',
+    type: 'normal',
+    formatter: ''
+  },
+  {
+    field: 'shipper',
+    title: 'Shipper',
+    type: 'normal',
+    formatter: ''
+  },
+  {
+    field: 'consignee',
+    title: 'Consignee',
+    type: 'normal',
+    formatter: ''
+  },
+  {
+    field: 'etd',
+    title: 'ETD',
+    type: 'date',
+    formatter: ''
+  },
+  {
+    field: 'eta',
+    title: 'ETA',
+    type: 'date',
+    formatter: ''
+  },
+  {
+    field: 'recent_milestone',
+    title: 'Recent Milestone',
+    type: 'normal',
+    formatter: ''
+  }
+])
+
 // System Settings初始数据
+const SubShipmentsTable = ref()
+const AddRulesTable = ref()
 const subscribeInit = ref()
 const getsubscribe = () => {
   $api.getsubscribe({}).then((res: any) => {
     if (res.code === 200) {
       subscribeInit.value = res.data
+      SubShipmentsTable.value.getTableData(res.data.subscribeShipmentWithPage)
+      AddRulesTable.value.getTableData(res.data.addedRules)
     }
   })
 }
@@ -157,7 +227,16 @@ onMounted(() => {
         </el-collapse>
       </div>
       <div class="TableTitle">Added Rules</div>
-      <AddRSettingTableules></AddRSettingTableules>
+      <AddRSettingTableules
+        :propsType="true"
+        ref="AddRulesTable"
+        :ColumnsList="AddedRulesColumns"
+      ></AddRSettingTableules>
+      <div class="TableTitle subscribetitle">Subscribed Shipments</div>
+      <AddRSettingTableules
+        :ColumnsList="SubShipmentsColumns"
+        ref="SubShipmentsTable"
+      ></AddRSettingTableules>
     </el-tab-pane>
     <el-tab-pane label="Monitoring Settings" name="Monitoring Settings">
       <div class="subscribedTitle">Added Rules</div>
@@ -180,6 +259,9 @@ onMounted(() => {
   font-weight: 700;
   padding: 21px 24px 13px 24px;
 }
+.subscribetitle {
+  padding-top: 7px;
+}
 .SubscribeCollapse {
   padding: 0 24px 24px 24px;
   border-bottom: 1px solid var(--color-select-border);

+ 27 - 51
src/views/SystemSettings/src/components/SettingTable/src/SettingTable.vue

@@ -2,42 +2,20 @@
 import { type VxeGridInstance, type VxeGridProps } from 'vxe-table'
 import { useRowClickStyle } from '@/hooks/rowClickStyle'
 import dayjs from 'dayjs'
-import { ref, onMounted } from 'vue'
+import { ref, onMounted, watch } from 'vue'
+interface ColumnsListItem {
+  field: String
+  title: String
+  type: String
+  formatter: String
+}
+const props = defineProps({
+  propsType: Boolean,
+  ColumnsList: Array<ColumnsListItem>
+})
+
+const columnstest = ref(props.ColumnsList)
 
-const columnstest = ref([
-  {
-    field: 'Event',
-    title: 'Event',
-    type: 'normal',
-    formatter: ''
-  },
-  {
-    field: 'Event Details',
-    title: 'Event Details',
-    type: 'normal',
-    formatter: ''
-  },
-  {
-    field: 'Frequency',
-    title: 'Frequency',
-    type: 'normal',
-    formatter: ''
-  },
-  {
-    field: 'Methods',
-    title: 'Methods',
-    type: 'normal',
-    formatter: ''
-  }
-])
-const datatest = ref([
-  {
-    Event: '123',
-    ['Event Details']: '123',
-    Frequency: '123',
-    Methods: '123'
-  }
-])
 const visible = ref(false)
 const tableData = ref<VxeGridProps<any>>({
   border: true,
@@ -81,24 +59,20 @@ const handleColumns = (columns: any) => {
 // 获取表格列
 const getTableColumns = async () => {
   tableData.value.columns = handleColumns(columnstest.value)
-  // await $api.getBookingTableColumns().then((res: any) => {
-  //   if (res.code === 200) {
-  //     tableData.value.columns = [
-  //       ...handleColumns(res.data.BookingTableColumns)
-  //     ]
-  tableData.value.columns.push({
-    title: 'Action',
-    fixed: 'right',
-    width: 80,
-    slots: { default: 'action' }
-  })
-  //   }
-  // })
+  if (props.propsType) {
+    tableData.value.columns.push({
+      title: 'Action',
+      fixed: 'right',
+      width: 80,
+      slots: { default: 'action' }
+    })
+  }
 }
 // 获取表格数据
-const getTableData = async () => {
+const getTableData = (val: any) => {
+  tableData.value.data = val.tableData
   // 保存页长以及当前页码
-  tableData.value.data = datatest.value
+  // tableData.value.data = datatest.value
   // await $api
   //   .getBookingTableData({
   //     other_filed: '',
@@ -124,7 +98,9 @@ const handleDelete = (row: any) => {
 
 onMounted(() => {
   getTableColumns()
-  getTableData()
+})
+defineExpose({
+  getTableData
 })
 </script>