123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <template>
- <Dialog
- :flag="flag"
- width="1440px"
- :msg-title="msgTitle"
- :with-footer="false"
- @reset-form="dialogHide"
- >
- <div class="dialog-content">
- <SimpleTable
- :data="tableData"
- :columns="tableColumns"
- :column-props="{ formatter }"
- />
- </div>
- </Dialog>
- </template>
- <script setup lang="ts">
- 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'
- const props = defineProps({
- flag: {
- type: Boolean,
- required: true,
- },
- dataContent: {
- type: Array as PropType<CommonValue[]>,
- required: true,
- },
- isDeparture: {
- type: Boolean,
- default: true,
- },
- })
- const emit = defineEmits(['update:flag'])
- const dialogHide = () => {
- emit('update:flag', false)
- }
- const tableColumnsMap = {
- departure: [
- { columnLabel: '运单号', columnName: 'stockCode', width: 120 },
- // { columnLabel: '集装器数量', columnName: 'stowageNum', needCount: 1 },
- {
- columnLabel: '品名',
- columnName: 'typeCode',
- width: 300,
- showOverflowTooltip: true,
- },
- { columnLabel: '特货信息', columnName: 'speCargoInfo' },
- { columnLabel: '货物件数', columnName: 'luggageCount', needCount: 1 },
- { columnLabel: '拉下件数', columnName: 'pullNum', needCount: 1 },
- { columnLabel: '退运件数', columnName: 'returnNum', needCount: 1 },
- { columnLabel: '最新节点', columnName: 'nodeCode' },
- { columnLabel: '最新位置', columnName: 'execPosition' },
- { columnLabel: '处理结果', columnName: 'execResult' },
- { columnLabel: '处理时间', columnName: 'execTime', width: 130 },
- ],
- arrival: [
- { columnLabel: '运单号', columnName: 'stockCode', width: 120 },
- {
- columnLabel: '品名',
- columnName: 'typeCode',
- width: 300,
- showOverflowTooltip: true,
- },
- { columnLabel: '特货信息', columnName: 'speCargoInfo', needCount: 1 },
- {
- columnLabel: '进港报文货物件数',
- columnName: 'messageCargos_in',
- needCount: 1,
- },
- {
- columnLabel: '进港实际货物件数',
- columnName: 'acCargos_in',
- needCount: 1,
- },
- { columnLabel: '最新节点', columnName: 'nodeCode' },
- { columnLabel: '最新位置', columnName: 'execPosition' },
- { columnLabel: '处理结果', columnName: 'execResult' },
- { columnLabel: '处理时间', columnName: 'execTime', width: 130 },
- ],
- }
- const msgTitle = computed(() => props.dataContent.join('-'))
- const tableColumns = ref<CommonTableColumn[]>([])
- const getTableColumns = () => {
- tableColumns.value = tableColumnsMap[
- props.isDeparture ? 'departure' : 'arrival'
- ].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 tableData = ref<CommonData[]>([])
- const getTableData = async () => {
- try {
- const {
- code,
- returnData: { listValues },
- message,
- } = await Query<CommonData>({
- id:
- DATACONTENT_ID[
- `${props.isDeparture ? 'departure' : 'arrival'}ContainerWaybill`
- ],
- dataContent: props.dataContent,
- })
- if (Number(code) !== 0) {
- throw new Error(message || '失败')
- }
- tableData.value = listValues.filter(
- row =>
- !Object.values(row).some(
- cellValue =>
- typeof cellValue === 'string' && cellValue.includes('undefined')
- )
- )
- } catch (error) {
- console.error(error)
- }
- }
- const resetTable = () => {
- tableColumns.value = []
- tableData.value = []
- }
- watch(
- () => props.flag,
- val => {
- resetTable()
- if (val) {
- getTableColumns()
- getTableData()
- }
- }
- )
- const formatter = (row, column, cellValue, index) => {
- if (column.property.includes('Time') && typeof cellValue === 'string') {
- return cellValue.replace('T', '\n')
- }
- return String(cellValue ?? '')
- }
- </script>
- <style scoped lang="scss">
- .dialog-content {
- padding: 0 22px;
- min-height: 300px;
- }
- </style>
|