|
@@ -7,6 +7,7 @@ import { type VxeGridInstance, type VxeGridProps } from 'vxe-table'
|
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
|
|
|
|
|
|
|
+const allData = ref<any>({})
|
|
|
const loading = ref(false)
|
|
const loading = ref(false)
|
|
|
const generalInfo = ref({
|
|
const generalInfo = ref({
|
|
|
baseInfo: [
|
|
baseInfo: [
|
|
@@ -51,48 +52,37 @@ const generalInfo = ref({
|
|
|
is_send: false
|
|
is_send: false
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
|
|
+const testValue = ref('')
|
|
|
const tableRef = ref<VxeGridInstance | null>(null)
|
|
const tableRef = ref<VxeGridInstance | null>(null)
|
|
|
const tableData = ref<VxeGridProps<any>>({
|
|
const tableData = ref<VxeGridProps<any>>({
|
|
|
minHeight: 70,
|
|
minHeight: 70,
|
|
|
border: true,
|
|
border: true,
|
|
|
round: true,
|
|
round: true,
|
|
|
- columns: [
|
|
|
|
|
- // {
|
|
|
|
|
- // title: 'VGM Weight',
|
|
|
|
|
- // field: 'vgm_weight',
|
|
|
|
|
- // width: 150,
|
|
|
|
|
- // editRender: {
|
|
|
|
|
- // name: 'vInput'
|
|
|
|
|
- // },
|
|
|
|
|
- // slots: {
|
|
|
|
|
- // edit: 'vInput'
|
|
|
|
|
- // }
|
|
|
|
|
- // },
|
|
|
|
|
- // {
|
|
|
|
|
- // title: 'VGM Unit',
|
|
|
|
|
- // field: 'vgm_unit',
|
|
|
|
|
- // width: 150,
|
|
|
|
|
- // editRender: {
|
|
|
|
|
- // name: 'vSelect'
|
|
|
|
|
- // },
|
|
|
|
|
- // slots: {
|
|
|
|
|
- // edit: 'vSelect'
|
|
|
|
|
- // }
|
|
|
|
|
- // },
|
|
|
|
|
- // {
|
|
|
|
|
- // title: 'VGM Date',
|
|
|
|
|
- // field: 'vgm_date',
|
|
|
|
|
- // width: 150,
|
|
|
|
|
- // editRender: {
|
|
|
|
|
- // name: 'editDate'
|
|
|
|
|
- // },
|
|
|
|
|
- // slots: {
|
|
|
|
|
- // edit: 'editDate'
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ columns: [],
|
|
|
|
|
+ data: [
|
|
|
|
|
+ {
|
|
|
|
|
+ container_no: '123',
|
|
|
|
|
+ carrier_booking_no: '123',
|
|
|
|
|
+ size: '123',
|
|
|
|
|
+ vgm_weight: '123',
|
|
|
|
|
+ vgm_kg_lg: '12311111111111111111111111111',
|
|
|
|
|
+ vgm_time: '',
|
|
|
|
|
+ vgm_method: '123',
|
|
|
|
|
+ cargo_weight_kg: '123',
|
|
|
|
|
+ cargo_weight_lb: '123'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ container_no: '123',
|
|
|
|
|
+ carrier_booking_no: '123',
|
|
|
|
|
+ size: '123',
|
|
|
|
|
+ vgm_weight: '123',
|
|
|
|
|
+ vgm_kg_lg: '123',
|
|
|
|
|
+ vgm_time: '',
|
|
|
|
|
+ vgm_method: '123',
|
|
|
|
|
+ cargo_weight_kg: '123',
|
|
|
|
|
+ cargo_weight_lb: '123'
|
|
|
|
|
+ }
|
|
|
],
|
|
],
|
|
|
- data: [],
|
|
|
|
|
scrollY: { enabled: true, oSize: 20, gt: 30 },
|
|
scrollY: { enabled: true, oSize: 20, gt: 30 },
|
|
|
stripe: true,
|
|
stripe: true,
|
|
|
emptyText: ' ',
|
|
emptyText: ' ',
|
|
@@ -118,7 +108,7 @@ const handleColumns = (columns: any) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 添加编辑插槽
|
|
// 添加编辑插槽
|
|
|
- if (item.type === 'input') {
|
|
|
|
|
|
|
+ if (item.edit_type === 'input') {
|
|
|
curColumn = {
|
|
curColumn = {
|
|
|
...curColumn,
|
|
...curColumn,
|
|
|
editRender: {
|
|
editRender: {
|
|
@@ -128,38 +118,41 @@ const handleColumns = (columns: any) => {
|
|
|
edit: 'vInput'
|
|
edit: 'vInput'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } else if (item.type === 'select') {
|
|
|
|
|
|
|
+ } else if (item.edit_type === 'dateTime') {
|
|
|
curColumn = {
|
|
curColumn = {
|
|
|
...curColumn,
|
|
...curColumn,
|
|
|
editRender: {
|
|
editRender: {
|
|
|
- name: 'vSelect'
|
|
|
|
|
|
|
+ name: 'editDate'
|
|
|
},
|
|
},
|
|
|
slots: {
|
|
slots: {
|
|
|
- edit: 'vSelect'
|
|
|
|
|
|
|
+ edit: 'editDate'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } else if (item.type === 'dateTime') {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (item.title === 'VGM Weight') {
|
|
|
curColumn = {
|
|
curColumn = {
|
|
|
...curColumn,
|
|
...curColumn,
|
|
|
editRender: {
|
|
editRender: {
|
|
|
- name: 'editDate'
|
|
|
|
|
|
|
+ name: 'vWeightSelect'
|
|
|
},
|
|
},
|
|
|
slots: {
|
|
slots: {
|
|
|
- edit: 'editDate'
|
|
|
|
|
|
|
+ edit: 'vWeightSelect'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- // 格式化
|
|
|
|
|
- if (item.formatter === 'date') {
|
|
|
|
|
|
|
+ } else if (item.title === 'VGM Method') {
|
|
|
curColumn = {
|
|
curColumn = {
|
|
|
...curColumn,
|
|
...curColumn,
|
|
|
- sortBy: ({ row, column }: any) => {
|
|
|
|
|
- return dayjs(row[column.field]).unix()
|
|
|
|
|
|
|
+ editRender: {
|
|
|
|
|
+ name: 'vMethodSelect'
|
|
|
},
|
|
},
|
|
|
- formatter: ({ cellValue }: any) =>
|
|
|
|
|
- cellValue ? dayjs(cellValue).format('MMM-YYYY-DD ') : '--'
|
|
|
|
|
|
|
+ slots: {
|
|
|
|
|
+ edit: 'vMethodSelect'
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- } else if (item.formatter === 'dateTime') {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ // 格式化
|
|
|
|
|
+ if (item.edit_type === 'dateTime') {
|
|
|
curColumn = {
|
|
curColumn = {
|
|
|
...curColumn,
|
|
...curColumn,
|
|
|
formatter: ({ cellValue }: any) =>
|
|
formatter: ({ cellValue }: any) =>
|
|
@@ -232,17 +225,19 @@ const getData = () => {
|
|
|
})
|
|
})
|
|
|
.then((res: any) => {
|
|
.then((res: any) => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
- // 获取数据
|
|
|
|
|
|
|
+ allData.value = res.data
|
|
|
convertData(res.data?.general_information)
|
|
convertData(res.data?.general_information)
|
|
|
tableData.value.columns = handleColumns(
|
|
tableData.value.columns = handleColumns(
|
|
|
res.data?.detail_information?.detail_information_column
|
|
res.data?.detail_information?.detail_information_column
|
|
|
)
|
|
)
|
|
|
- tableData.value.data = res.data?.detail_information?.detail_information_data
|
|
|
|
|
|
|
+ // tableData.value.data = res.data?.detail_information?.detail_information_data
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
|
tableData.value.columns.forEach((item) => {
|
|
tableData.value.columns.forEach((item) => {
|
|
|
if (item.title === 'SN') {
|
|
if (item.title === 'SN') {
|
|
|
item.width = 50
|
|
item.width = 50
|
|
|
|
|
+ } else if (item.title === 'VGM Time') {
|
|
|
|
|
+ item.width = 190
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
@@ -255,7 +250,36 @@ const getData = () => {
|
|
|
getData()
|
|
getData()
|
|
|
|
|
|
|
|
const handleGoBack = () => {
|
|
const handleGoBack = () => {
|
|
|
- router.push({ path: '/tracking' })
|
|
|
|
|
|
|
+ router.push({ name: 'Tracking' })
|
|
|
|
|
+}
|
|
|
|
|
+const handleSave = () => {
|
|
|
|
|
+ const generalData = {
|
|
|
|
|
+ all_carrier_booking: generalInfo.value.baseInfo['Carrier Booking No.'],
|
|
|
|
|
+ submitter: generalInfo.value.formData.Submitter,
|
|
|
|
|
+ signature: generalInfo.value.formData.signature,
|
|
|
|
|
+ authorized_email: generalInfo.value.formData.authorized_email,
|
|
|
|
|
+ authorized_tel: generalInfo.value.formData.authorized_tel,
|
|
|
|
|
+ is_send: generalInfo.value.formData.is_send
|
|
|
|
|
+ }
|
|
|
|
|
+ const tableRowData = tableData.value.data.map((item) => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...item
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const variableList = Object.keys(tableRowData[0])
|
|
|
|
|
+ const tableInfo = {}
|
|
|
|
|
+ variableList.forEach((item) => {
|
|
|
|
|
+ if (item === '_X_ROW_KEY') return
|
|
|
|
|
+ Object.assign(tableInfo, {
|
|
|
|
|
+ [item]: tableRowData.map((row) => row[item])
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ // $api.saveVGMData({
|
|
|
|
|
+ // serial_no: allData.value.serial_no,
|
|
|
|
|
+ // _schemas: allData.value.schemas,
|
|
|
|
|
+ // ...generalData
|
|
|
|
|
+ // })
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
@@ -267,7 +291,7 @@ const handleGoBack = () => {
|
|
|
<el-button class="el-button--default" @click="handleGoBack"
|
|
<el-button class="el-button--default" @click="handleGoBack"
|
|
|
><span class="font_family icon-icon_return_b"></span> Cancel</el-button
|
|
><span class="font_family icon-icon_return_b"></span> Cancel</el-button
|
|
|
>
|
|
>
|
|
|
- <el-button class="el-button--main">
|
|
|
|
|
|
|
+ <el-button class="el-button--main" @click="handleSave">
|
|
|
<span class="font_family icon-icon_save_b"></span>
|
|
<span class="font_family icon-icon_save_b"></span>
|
|
|
Save</el-button
|
|
Save</el-button
|
|
|
>
|
|
>
|
|
@@ -355,32 +379,39 @@ const handleGoBack = () => {
|
|
|
></el-input>
|
|
></el-input>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
- <template #vSelect="{ row, column }">
|
|
|
|
|
|
|
+ <template #vWeightSelect="{ row, column }">
|
|
|
<vxe-select v-model="row[column.field]" placeholder="Please select..." clearable>
|
|
<vxe-select v-model="row[column.field]" placeholder="Please select..." clearable>
|
|
|
<vxe-option label="KGS" value="KGS"></vxe-option>
|
|
<vxe-option label="KGS" value="KGS"></vxe-option>
|
|
|
<vxe-option label="LBS" value="LBS"></vxe-option>
|
|
<vxe-option label="LBS" value="LBS"></vxe-option>
|
|
|
</vxe-select>
|
|
</vxe-select>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
+ <template #vMethodSelect="{ row, column }">
|
|
|
|
|
+ <vxe-select v-model="row[column.field]" placeholder="Please select..." clearable>
|
|
|
|
|
+ <vxe-option label="SM1" value="SM1"></vxe-option>
|
|
|
|
|
+ <vxe-option label="SM2" value="SM2"></vxe-option>
|
|
|
|
|
+ </vxe-select>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
<template #editDate="{ row, column }">
|
|
<template #editDate="{ row, column }">
|
|
|
- <!-- <el-date-picker
|
|
|
|
|
|
|
+ <el-date-picker
|
|
|
v-model="row[column.field]"
|
|
v-model="row[column.field]"
|
|
|
type="datetime"
|
|
type="datetime"
|
|
|
- style="width: 100%"
|
|
|
|
|
|
|
+ style="width: 170px"
|
|
|
placeholder="Pick a Date"
|
|
placeholder="Pick a Date"
|
|
|
- date-format="MM/DD/YYYY"
|
|
|
|
|
- value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
- format="MM/YYYY/DD HH:mm:ss"
|
|
|
|
|
- /> -->
|
|
|
|
|
- <a-date-picker
|
|
|
|
|
|
|
+ format="MMM-DD-DD HH:mm:ss"
|
|
|
|
|
+ date-format="MMM-DD-DD"
|
|
|
|
|
+ time-format="HH:mm:ss"
|
|
|
|
|
+ />
|
|
|
|
|
+ <!-- <a-date-picker
|
|
|
:showNow="false"
|
|
:showNow="false"
|
|
|
class="test-date-picker"
|
|
class="test-date-picker"
|
|
|
placement="topLeft"
|
|
placement="topLeft"
|
|
|
v-model:value="row[column.field]"
|
|
v-model:value="row[column.field]"
|
|
|
- format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
|
|
+ format="MMM-DD-YYYY HH:mm:ss"
|
|
|
:getPopupContainer="(target) => target.parentElement"
|
|
:getPopupContainer="(target) => target.parentElement"
|
|
|
:show-time="{ defaultValue: dayjs('00:00:00', 'HH:mm:ss') }"
|
|
:show-time="{ defaultValue: dayjs('00:00:00', 'HH:mm:ss') }"
|
|
|
- />
|
|
|
|
|
|
|
+ /> -->
|
|
|
</template>
|
|
</template>
|
|
|
</vxe-grid>
|
|
</vxe-grid>
|
|
|
</div>
|
|
</div>
|
|
@@ -507,10 +538,11 @@ const handleGoBack = () => {
|
|
|
color: #202020;
|
|
color: #202020;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-.vgm-table {
|
|
|
|
|
- .vxe-grid .vxe-grid--table-wrapper,
|
|
|
|
|
- div.vxe-table--body-wrapper {
|
|
|
|
|
- overflow: visible;
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
+
|
|
|
|
|
+// .vgm-table {
|
|
|
|
|
+// .vxe-grid .vxe-grid--table-wrapper,
|
|
|
|
|
+// div.vxe-table--body-wrapper {
|
|
|
|
|
+// overflow: visible;
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
</style>
|
|
</style>
|