Explorar el Código

货物查询修改

zhongxiaoyu hace 2 años
padre
commit
ba98bd1aa5

+ 1 - 1
public/config.js

@@ -54,7 +54,7 @@ var DATACONTENT_ID = {
   /***-----数据查询------***/
   flightDataQuery: 1803439, //数据查询-航班-表格
   waybillDataQuery: 1803441, //数据查询-运单-表格
-  freightDataQuery: 1803560, //数据查询-货物-表格
+  freightDataQuery: 1803440, //数据查询-货物-表格
 
   /***-----高级查询------***/
   baggageTypeId: 86, //高级查询-特殊行李类型下拉选项查询-id

+ 1 - 0
src/components/SimpleTable/index.vue

@@ -29,6 +29,7 @@
           v-model:sort-rule="sortRuleMap[column.columnName]"
           :label="column.columnLabel"
           :desc="column.columnDescribe"
+          :show-desc="column.showDesc"
           :filter-options="filterOptionMap[column.columnName]"
           :sortable="!!column.needSort"
           filter-style="arrow"

+ 6 - 4
src/components/TableHeaderCell/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-tooltip :disabled="!desc" :content="desc">
+  <el-tooltip :disabled="!showDesc" :content="desc">
     <div
       :class="[
         'table-header-cell',
@@ -17,12 +17,12 @@
             :class="['filter-button', { 'filter-button-active': active }]"
             ref="buttonRef"
             v-click-outside="clickOutsideHandler"
-            >{{ `${desc ? '*' : ''}${label}` }}</span
+            >{{ `${showDesc ? '*' : ''}${label}` }}</span
           >
         </span>
       </template>
       <template v-else>
-        <span style="flex: 1">{{ `${desc ? '*' : ''}${label}` }}</span>
+        <span style="flex: 1">{{ `${showDesc ? '*' : ''}${label}` }}</span>
       </template>
       <div
         v-if="(filterable && filterStyle === 'arrow') || sortable"
@@ -101,6 +101,9 @@ const props = defineProps({
     type: String,
     default: ''
   },
+  showDesc: {
+    type: Boolean,
+  },
   filterStyle: {
     type: String as PropType<'arrow' | 'underline'>,
     default: 'arrow',
@@ -113,7 +116,6 @@ const props = defineProps({
   },
   sortable: {
     type: Boolean,
-    default: false,
   },
   sortRule: {
     type: String,

+ 2 - 2
src/router/routes/routes-file-five.ts

@@ -12,13 +12,13 @@ const HomeRoutes = {
       path: '/dataQuery/flightQuery',
       name: 'FlightQuery',
       meta: { title: '航班查询', roles: ['flight_query_page'] },
-      component: () => import('@/views/dataQuery/flightQuery/index.vue'),
+      component: () => import('@/views/dataQuery/flight/index.vue'),
     },
     {
       path: '/dataQuery/waybillQuery',
       name: 'WaybillQuery',
       meta: { title: '运单查询', roles: ['waybill_query_page'] },
-      component: () => import('@/views/dataQuery/waybillQuery/index.vue'),
+      component: () => import('@/views/dataQuery/waybill/index.vue'),
     },
     {
       path: '/dataQuery/freightQuery',

+ 26 - 5
src/views/dataQuery/components/DataQueryView/index.vue

@@ -56,11 +56,18 @@
         @checked-submit="columnChecked"
       />
     </div>
-    <div class="data-query-table">
+    <div
+      v-loading="loading"
+      element-loading-text="拼命加载中"
+      element-loading-spinner="el-icon-loading"
+      element-loading-background="rgba(0, 0, 0, 0.8)"
+      class="data-query-table"
+    >
       <SimpleTable
         ref="tableRef"
         :data="tableData"
         :columns="filteredColumns"
+        :column-props="{ formatter }"
       />
     </div>
   </div>
@@ -74,6 +81,7 @@ import { ElMessage, FormInstance } from 'element-plus'
 import { parseTime } from '@/utils/validate'
 import { useTable } from './useTable'
 import { useTableColumnSet } from '@/hooks/useTableColumnSet'
+import { CommonTableFormatter } from '~/common'
 
 const props = defineProps({
   name: {
@@ -127,12 +135,12 @@ const keyWordsValidator = (rule: any, value: any, callback: any) => {
     return callback(new Error(`请输入${searchTitle}`))
   }
   const regsMap: { [x: string]: RegExp[] } = {
-    flight: [],
-    waybill: [],
+    flight: [/^[A-Za-z0-9][A-Za-z][0-9]{4}$/],
+    waybill: [/^[0-9]{3}\-[0-9]{8}/],
     freight: [/^[0-9]{5}$/, /^[0-9]{3}\-[0-9]{8}\-[0-9]{5}$/],
   }
   const regs = regsMap[props.name] ?? []
-  const notMatched = regs.every(reg => !reg.test(value))
+  const notMatched = regs.length && regs.every(reg => !reg.test(value))
   if (notMatched) {
     return callback(new Error(`请输入正确的${searchTitle}`))
   }
@@ -152,9 +160,22 @@ const dataQuery = () => {
   })
 }
 
-const { tableColumns, tableData, getTableData } = useTable(props.name, formData)
+const loading = ref(false)
+const { tableColumns, tableData, getTableData } = useTable(
+  props.name,
+  formData,
+  loading
+)
 
 const { filteredColumns, columnChecked } = useTableColumnSet(tableColumns)
+
+const formatter: CommonTableFormatter = (row, column, cellValue, index) => {
+  const value = String(cellValue ?? '')
+  if (column.property.includes('Time')) {
+    return value.replace('T', '\n')
+  }
+  return value
+}
 </script>
 
 <style lang="scss" scoped>

+ 16 - 51
src/views/dataQuery/components/DataQueryView/useTable.ts

@@ -1,69 +1,30 @@
 import { Query } from '@/api/webApi'
+import { Ref } from 'vue'
 import { CommonData, CommonTableColumn } from '~/common'
 
 const idGetter = (name: string) => DATACONTENT_ID[name + 'DataQuery']
 
-const tableColumnsMap: {
-  [tableName: string]: ({
-    columnLabel: string
-    columnName: string
-  } & { [x: string]: any })[]
-} = {
-  flight: [],
-  waybill: [],
-  freight: [
-    { columnLabel: '起飞航站', columnName: 'departureAirport' },
-    { columnLabel: '目的航站', columnName: 'arriveAirport' },
-    { columnLabel: '航班号', columnName: 'flightAllNO' },
-    { columnLabel: '航班日期', columnName: 'flightDate' },
-    { columnLabel: '直达/中转', columnName: 'ynTrans' },
-    { columnLabel: '货物牌号', columnName: 'pcsCode' },
-    { columnLabel: '特殊货物类型', columnName: 'specialType' },
-    { columnLabel: '位置', columnName: 'nodeCode' },
-    { columnLabel: '状态', columnName: 'status' },
-    { columnLabel: '运单号', columnName: 'stockCode' },
-    { columnLabel: '值机号', columnName: 'checkNo' },
-    { columnLabel: '安检序号', columnName: 'securityNo' },
-    { columnLabel: '货代', columnName: 'cargoCompany' },
-    { columnLabel: '货代等级', columnName: 'Grade' },
-    { columnLabel: '批次号', columnName: 'batchNo' },
-  ],
-}
-
-export function useTable(tableName: string, formData: CommonData) {
+export function useTable(
+  tableName: string,
+  formData: CommonData,
+  loading?: Ref<boolean>
+) {
   const tableColumns = ref<CommonTableColumn[]>([])
   const tableData = ref<CommonData[]>([])
-  const getTableColumns = () => {
-    if (!tableColumnsMap[tableName]) {
-      return
-    }
-    tableColumns.value = tableColumnsMap[tableName].map(column => ({
-      columnDescribe: '',
-      dataType: '',
-      listqueryTemplateID: null,
-      needCount: null,
-      needFilters: null,
-      needGroup: null,
-      needSearch: null,
-      needShow: 1,
-      needSort: null,
-      orderNumber: null,
-      queryTemplateColumnSetID: null,
-      queryTemplateID: null,
-      ...column,
-    }))
-  }
 
   const getTableData = async () => {
     if (!idGetter(tableName)) {
       return
     }
+    if (loading) {
+      loading.value = true
+    }
     try {
       const { startDate, endDate, keyWords } = formData
-      const dataContent = [startDate, endDate, keyWords]
+      const dataContent = [startDate, endDate, keyWords || null]
       const {
         code,
-        returnData: { listValues },
+        returnData: { columnSet, listValues },
         message,
       } = await Query<CommonData>({
         id: idGetter(tableName),
@@ -72,6 +33,7 @@ export function useTable(tableName: string, formData: CommonData) {
       if (Number(code) !== 0) {
         throw new Error(message || '失败')
       }
+      tableColumns.value = columnSet
       tableData.value = listValues.filter(
         row =>
           !Object.values(row).some(
@@ -82,10 +44,13 @@ export function useTable(tableName: string, formData: CommonData) {
     } catch (error) {
       console.error(error)
     }
+    if (loading) {
+      loading.value = false
+    }
   }
 
   onMounted(() => {
-    getTableColumns()
+    getTableData()
   })
 
   return {

+ 1 - 1
src/views/dataQuery/waybill/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <DataQueryView name="waybill" title="货物查询" />
+  <DataQueryView name="waybill" title="运单查询" />
 </template>
 
 <script lang="ts">

+ 1 - 0
src/views/realTime/components/AirportView/index.vue

@@ -141,6 +141,7 @@ const customRendererColumns = computed(() => [
         v-model:sortRule={sortRuleMap[column.columnName]}
         label={tableColumnFormatter(column.columnLabel)}
         desc={column.columnDescribe}
+        showDesc={Boolean(column.columnDescribe)}
         filterOptions={filterOptionMap[column.columnName]}
         sortable={Boolean(column.needSort)}
         filterStyle="arrow"

+ 11 - 5
src/views/realTime/components/FlightView/ContainerWaybillDialog.vue

@@ -21,7 +21,12 @@ import Dialog from '@/components/dialog/index.vue'
 import SimpleTable from '@/components/SimpleTable/index.vue'
 import { Query } from '@/api/webApi'
 import { PropType } from 'vue'
-import { CommonData, CommonTableColumn, CommonValue } from '~/common'
+import {
+  CommonData,
+  CommonTableColumn,
+  CommonTableFormatter,
+  CommonValue,
+} from '~/common'
 
 const props = defineProps({
   flag: {
@@ -157,11 +162,12 @@ watch(
   }
 )
 
-const formatter = (row, column, cellValue, index) => {
-  if (column.property.includes('Time') && typeof cellValue === 'string') {
-    return cellValue.replace('T', '\n')
+const formatter: CommonTableFormatter = (row, column, cellValue, index) => {
+  const value = String(cellValue ?? '')
+  if (column.property.includes('Time')) {
+    return value.replace('T', '\n')
   }
-  return String(cellValue ?? '')
+  return value
 }
 </script>
 

+ 22 - 16
src/views/realTime/components/FlightView/index.vue

@@ -92,6 +92,7 @@ import { useTableStyle } from '../../hooks/useTableStyle'
 import { useTableCellClick } from '../../hooks/useTableCellClick'
 import { useFlightInfo } from './useFlightInfo'
 import { useLoop } from '@/hooks/useLoop'
+import { CommonTableFormatter } from '~/common'
 
 const props = defineProps({
   name: {
@@ -138,25 +139,30 @@ const {
   getTableData: getWaybillTableData,
 } = useTable(`${props.name}Waybill`, dataContent)
 
-const tableFormatter = (row, column, cellValue, index) => {
+const tableFormatter: CommonTableFormatter = (
+  row,
+  column,
+  cellValue,
+  index
+) => {
+  const value = String(cellValue ?? '')
   if (
-    (column.property.includes('Time') ||
-      [
-        'tally',
-        'pull',
-        'wait',
-        'stowage',
-        'depot',
-        'resure',
-        'planeDown',
-        'loadPlane',
-        'pullSure',
-      ].includes(column.property)) &&
-    typeof cellValue === 'string'
+    column.property.includes('Time') ||
+    [
+      'tally',
+      'pull',
+      'wait',
+      'stowage',
+      'depot',
+      'resure',
+      'planeDown',
+      'loadPlane',
+      'pullSure',
+    ].includes(column.property)
   ) {
-    return cellValue.slice(5, -3).replace('T', '\n')
+    return value.slice(5, -3).replace('T', '\n')
   }
-  return String(cellValue ?? '')
+  return value
 }
 
 useLoop([getFlightInfo, getContainerTableData, getWaybillTableData], 'flight')

+ 2 - 2
src/views/realTime/components/WaybillView/index.vue

@@ -106,7 +106,7 @@ import { useTableExport } from '../../hooks/useTableExport'
 import { useTableStyle } from '../../hooks/useTableStyle'
 import { useTableCellClick } from '../../hooks/useTableCellClick'
 import { useWaybillInfo } from './useWaybillInfo'
-import { CommonData } from '~/common'
+import { CommonData, CommonTableFormatter } from '~/common'
 import { useLoop } from '@/hooks/useLoop'
 
 const props = defineProps({
@@ -212,7 +212,7 @@ const tableData = computed(() => {
   }, [])
 })
 
-const formatter = (row, column, cellValue, index) => {
+const formatter: CommonTableFormatter = (row, column, cellValue, index) => {
   const value = String(cellValue ?? '').split('\n')
   if (value[2]) {
     value[2] = value[2].split('T')[1].slice(0, -3)

+ 1 - 1
src/views/systemSettings/serviceManagement/serviceEdit.vue

@@ -428,7 +428,6 @@
           <div
             v-loading="logTableLoading"
             element-loading-text="拼命加载中"
-            stripe
             element-loading-spinner="el-icon-loading"
             element-loading-background="rgba(0, 0, 0, 0.8)"
             class="interfaceLog_content flex-wrap"
@@ -437,6 +436,7 @@
               :data="logTableData"
               class="table"
               height="500px"
+              stripe
               border
               style="width: 100%; margin-top: 20px"
             >

+ 10 - 2
typings/common.d.ts

@@ -1,13 +1,14 @@
 //common type file, you can not export the type in common.d.ts
 //not export can use
-import { Ref } from 'vue'
+import { Ref, VNode } from 'vue'
 
 interface ObjTy {
   [propName: string]: any
 }
 
-/*axiosReq请求配置*/
 import { AxiosRequestConfig } from 'axios'
+import { TableColumnCtx } from 'element-plus/es/components/table/src/table-column/defaults'
+/*axiosReq请求配置*/
 interface AxiosReqTy extends AxiosRequestConfig {
   url?: string
   method?: string
@@ -84,6 +85,13 @@ interface CommonData {
   [x: string]: CommonValue
 }
 
+type CommonTableFormatter = (
+  row: CommonData,
+  column: TableColumnCtx<CommonData>,
+  cellValue: CommonValue,
+  index: number
+) => VNode | string
+
 interface SelectOption {
   k: string
   setlabel: string