szh-new
张同海 4 months ago
parent 9ef9e5f82e
commit 0196e01548

@ -24,7 +24,14 @@
v-model="allCheckL"
:indeterminate="someCheckL"
/>
<hot-table :data="Llist" :settings="Lsettings"> </hot-table>
<hot-table :data="Llist" :settings="Lsettings">
<img
v-show="!Llist.length"
class="hot-tb-no-data"
src="../../../assets/images/nodata.png"
alt=""
/>
</hot-table>
</div>
</div>
<div class="BoxUnit">
@ -39,7 +46,14 @@
v-model="allCheckR"
:indeterminate="someCheckR"
/>
<hot-table :data="Rlist" :settings="Rsettings"></hot-table>
<hot-table :data="Rlist" :settings="Rsettings">
<img
v-show="!Rlist.length"
class="hot-tb-no-data"
src="../../../assets/images/nodata.png"
alt=""
/>
</hot-table>
</div>
</div>
</div>

@ -5,7 +5,7 @@
-->
<template>
<div class="fee-field">
<div class='flex'>
<div class="flex">
<h2>费用字段</h2>
<div>
<a-button type="primary" size="small" @click="addRow"></a-button>
@ -20,35 +20,57 @@
</div>
</div>
<a-spin :spinning="loading">
<div style="position: relative;">
<input class="ds-tb-check" type="checkbox" v-model="allCheck" :indeterminate="someCheck">
<hot-table ref="hotTb" :data="list" :settings="settings"></hot-table>
<div style="position: relative">
<input class="ds-tb-check" type="checkbox" v-model="allCheck" :indeterminate="someCheck" />
<hot-table ref="hotTb" :data="list" :settings="settings">
<img
v-show="!list.length"
class="hot-tb-no-data"
src="../../../../assets/images/nodata.png"
alt=""
/>
</hot-table>
</div>
</a-spin>
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted, defineProps, watch, nextTick, defineComponent, defineExpose, watchEffect, inject } from 'vue'
import {
ref,
onMounted,
defineProps,
watch,
nextTick,
defineComponent,
defineExpose,
watchEffect,
inject,
} from 'vue'
//
import { GetFeeCodeSelectList, GetClientListByCode, GetFeeCurrencySelectList } from '/@/api/common'
import {
GetFeeCodeSelectList,
GetClientListByCode,
GetFeeCurrencySelectList,
} from '/@/api/common'
import { GetFeeTemplateDetailList, BatchDelFeeTemplateDetail } from '../api'
//
import { feeUnitDict } from '/@/hooks/dict/index'
//
import { getDictOption } from '/@/utils/dictUtil'
import { useMessage } from '/@/hooks/web/useMessage'
import { HotTable, HotColumn } from '@handsontable/vue3'
import { HotTable, HotColumn } from '@handsontable/vue3'
import { registerAllModules } from 'handsontable/registry'
import 'handsontable/dist/handsontable.full.min.css'
defineComponent({
HotTable, HotColumn
HotTable,
HotColumn,
})
registerAllModules();
registerAllModules()
const { createMessage, notification } = useMessage()
const props = defineProps({
id: {
type: String
}
type: String,
},
})
//
const currencyDict = ref([])
@ -85,7 +107,7 @@
currency: '',
feeEnName: '',
customerName: '',
customerType: ''
customerType: '',
})
}
//
@ -95,13 +117,15 @@
type: 'checkbox',
title: ' ',
width: 32,
className: "htCenter",
readOnly: false
}, {
className: 'htCenter',
readOnly: false,
},
{
title: '序号',
width: 130,
readOnly: true
}, {
readOnly: true,
},
{
title: '费用名称',
width: 130,
data: 'feeName',
@ -110,12 +134,13 @@
source: async (query, process) => {
const res = feeDict.value.length ? feeDict.value : (await GetFeeCodeSelectList())?.data
if (!feeDict.value.length) feeDict.value = res
const dict = res.map(res => {
const dict = res.map((res) => {
return res.name
})
process(dict)
}
}, {
},
},
{
title: '费用英文名称',
width: 130,
data: 'feeEnName',
@ -123,12 +148,13 @@
source: async (query, process) => {
const res = feeDict.value.length ? feeDict.value : (await GetFeeCodeSelectList())?.data
if (!feeDict.value.length) feeDict.value = res
const dict = res.map(res => {
const dict = res.map((res) => {
return res.enName
})
process(dict)
}
}, {
},
},
{
title: '结算对象',
width: 130,
data: 'customerName',
@ -138,9 +164,9 @@
const rowIndex = hotTb.value.hotInstance.countRows()
const code = list.value[rowIndex - 1].customerType
if (code) {
GetClientListByCode({ code }).then(res => {
GetClientListByCode({ code }).then((res) => {
const { data } = res
data.forEach(item => {
data.forEach((item) => {
item['label'] = item.shortName
item['value'] = item.codeName
})
@ -151,84 +177,95 @@
process(dict)
})
} else {
process([])
process([])
}
},
}, {
},
{
title: '客户类别',
width: 130,
data: 'customerTypeText',
type: 'dropdown',
source: async (query, process) => {
const results = await getDictOption('djy_cust_prop')
const dict = results.map(item => {
const dict = results.map((item) => {
return item.name
})
process(dict)
}
}, {
},
},
{
title: '单位标准',
width: 130,
data: 'unitText',
type: 'dropdown',
source: async (query, process) => {
if (unitDict.value && unitDict.value.length) {
const dict = unitDict.value.map(item => {
const dict = unitDict.value.map((item) => {
return item.name
})
process(dict)
} else {
const results = await feeUnitDict()
unitDict.value = results
const dict = results.map(item => {
const dict = results.map((item) => {
return item.name
})
process(dict)
}
}
}, {
},
},
{
title: '不含税单价',
width: 120,
data: 'noTaxPrice',
type: 'numeric'
}, {
type: 'numeric',
},
{
title: '单价',
width: 120,
data: 'unitPrice',
type: 'numeric',
format: '0.00'
}, {
format: '0.00',
},
{
title: '数量',
width: 120,
data: 'quantity',
type: 'numeric',
format: '0'
}, {
format: '0',
},
{
title: '金额',
width: 120,
data: 'amount',
type: 'numeric'
}, {
type: 'numeric',
},
{
title: '不含税金额',
width: 120,
data: 'noTaxAmount',
type: 'numeric',
format: '0.00'
}, {
format: '0.00',
},
{
title: '税率',
width: 120,
data: 'taxRate',
type: 'numeric'
}, {
type: 'numeric',
},
{
title: '汇率',
width: 120,
data: 'exchangeRate',
type: 'numeric'
}, {
type: 'numeric',
},
{
title: '备注',
width: 120,
data: 'note'
}, {
data: 'note',
},
{
title: '币别',
width: 80,
data: 'currency',
@ -238,40 +275,45 @@
process(currencyDict.value)
} else {
const results = await GetFeeCurrencySelectList()
const dict = results.data?.map(res => {
const dict = results.data?.map((res) => {
return res.codeName
})
currencyDict.value = dict
process(dict)
}
}
}, {
},
},
{
title: '销项税率',
width: 100,
data: 'accTaxRate',
type: 'numeric'
}, {
type: 'numeric',
},
{
title: '是否机密',
width: 100,
data: 'isOpen',
type: 'checkbox'
}, {
type: 'checkbox',
},
{
title: '是否垫付',
width: 100,
data: 'isAdvancedPay',
type: 'checkbox'
}, {
type: 'checkbox',
},
{
title: '是否禁开发票',
width: 120,
data: 'isInvoice',
type: 'checkbox'
}, {
type: 'checkbox',
},
{
title: 'FRT',
width: 120,
data: 'feeFrt',
type: 'dropdown',
source: ['PP', 'CC']
}
source: ['PP', 'CC'],
},
]
//
const settings = {
@ -283,18 +325,18 @@
rowHeights: 32,
fixedColumnsLeft: 1,
//
hiddenColumns: {
hiddenColumns: {
columns: [1],
indicators: true
indicators: true,
},
columnSorting: true,
//
// columnSorting: {
// column: 2, //
// sortOrder: ['asc', 'desc'] //
// },
//
// columnSorting: {
// column: 2, //
// sortOrder: ['asc', 'desc'] //
// },
//
afterValidate: function(isValid, value, row, prop, source) {
afterValidate: function (isValid, value, row, prop, source) {
if (!isValid) {
hotTb.value.hotInstance.setDataAtRowProp(row, prop, '')
}
@ -308,11 +350,11 @@
//
if (source === 'edit' || source === 'Autofill.fill' || source === 'CopyPaste.paste') {
let dict = {}
changes.forEach(res => {
changes.forEach((res) => {
//
if (res[1] === 'feeName') {
//
const item = feeDict.value.filter(item => {
const item = feeDict.value.filter((item) => {
return item.name === changes[0][3]
})
if (item) dict = item[0]
@ -332,12 +374,11 @@
})
//
if (changes[0][1] === 'feeEnName') {
}
//
if (changes[0][1] === 'customerTypeText') {
getDictOption('djy_cust_prop').then(res => {
const item = res.filter(item => {
getDictOption('djy_cust_prop').then((res) => {
const item = res.filter((item) => {
return item.name === changes[0][3]
})
if (item) dict = item[0]
@ -346,7 +387,7 @@
}
//
if (changes[0][1] === 'unitText') {
const item = unitDict.value.filter(item => {
const item = unitDict.value.filter((item) => {
return item.name === changes[0][3]
})
if (item) dict = item[0]
@ -354,7 +395,7 @@
}
//
if (changes[0][1] === 'currencyName') {
const item = currencyDict.value.filter(item => {
const item = currencyDict.value.filter((item) => {
return item.name === changes[0][3]
})
if (item) dict = item[0]
@ -365,20 +406,24 @@
//
if (changes[0][1] === 'noTaxPrice') {
//
list.value[index].unitPrice = (changes[0][3] || 0) * ((list.value[index].taxRate || 0) / 100 + 1)
list.value[index].unitPrice =
(changes[0][3] || 0) * ((list.value[index].taxRate || 0) / 100 + 1)
//
list.value[index].amount = (list.value[index].unitPrice || 0) * (list.value[index].quantity || 0)
list.value[index].amount =
(list.value[index].unitPrice || 0) * (list.value[index].quantity || 0)
//
list.value[index].noTaxAmount = (changes[0][3] || 0) * (list.value[index].quantity || 0)
}
//
if (changes[0][1] === 'unitPrice') {
//
list.value[index].noTaxPrice = (changes[0][3] || 0) / ((list.value[index].taxRate || 0) / 100 + 1)
list.value[index].noTaxPrice =
(changes[0][3] || 0) / ((list.value[index].taxRate || 0) / 100 + 1)
//
list.value[index].amount = (changes[0][3] || 0) * (list.value[index].quantity || 0)
//
list.value[index].noTaxAmount = (list.value[index].noTaxPrice || 0) * (list.value[index].quantity || 0)
list.value[index].noTaxAmount =
(list.value[index].noTaxPrice || 0) * (list.value[index].quantity || 0)
}
//
if (changes[0][1] === 'quantity') {
@ -390,12 +435,14 @@
//
if (changes[0][1] === 'taxRate') {
//
list.value[index].noTaxPrice = ((list.value[index].unitPrice || 0) / ((changes[0][3] || 0) / 100 + 1))
list.value[index].noTaxPrice =
(list.value[index].unitPrice || 0) / ((changes[0][3] || 0) / 100 + 1)
//
list.value[index].noTaxAmount = (list.value[index].noTaxPrice || 0) * (list.value[index].quantity || 0)
list.value[index].noTaxAmount =
(list.value[index].noTaxPrice || 0) * (list.value[index].quantity || 0)
}
}
}
},
}
const setTableData = () => {
const data = inject('temFieldData')
@ -405,13 +452,13 @@
}
}
defineExpose({
validate
validate,
})
onMounted(() => {
setTableData()
const hot = hotTb.value.hotInstance
//
hot.addHook('beforeKeyDown', function(event) {
hot.addHook('beforeKeyDown', function (event) {
// 'Enter'
if (event.key === 'ArrowDown') {
if (hot.getSelected()[0][0] == list.value.length - 1 && !hot.getActiveEditor()?._opened) {
@ -425,10 +472,11 @@
})
})
watch(
list.value, (val) => {
list.value,
(val) => {
let a = 0
let b = 0
val.forEach(item => {
val.forEach((item) => {
if (item.selected) {
a += 1
} else {
@ -446,14 +494,15 @@
} else {
someCheck.value = false
}
}, {
deep: true
}
},
{
deep: true,
},
)
//
//
const deleteRow = async () => {
const ids = []
list.value.forEach(item => {
list.value.forEach((item) => {
if (item.selected && item.id) ids.push(item.id)
})
if (ids.length) {
@ -462,37 +511,40 @@
loading.value = false
createMessage.success(data.message)
}
const res = list.value.filter(item => {
const res = list.value.filter((item) => {
return !item.selected
})
list.value = res
hotTb.value.hotInstance.loadData(res)
}
// idid
watch(() => props.id, async (v) => {
const postData = {
pageCondition: {
pageIndex: 1,
pageSize: 1000,
sortConditions: []
},
queryCondition: JSON.stringify([
{ FieldName: 'TemplateId', FieldValue: v, ConditionalType: 1 }
])
}
const res = await GetFeeTemplateDetailList(postData)
list.value = res.data
hotTb.value.hotInstance.loadData(res.data)
})
watch(
() => props.id,
async (v) => {
const postData = {
pageCondition: {
pageIndex: 1,
pageSize: 1000,
sortConditions: [],
},
queryCondition: JSON.stringify([
{ FieldName: 'TemplateId', FieldValue: v, ConditionalType: 1 },
]),
}
const res = await GetFeeTemplateDetailList(postData)
list.value = res.data
hotTb.value.hotInstance.loadData(res.data)
},
)
watchEffect(() => {
//
if (allCheck.value) {
list.value.forEach(item => {
list.value.forEach((item) => {
item.selected = true
})
} else {
//
list.value.forEach(item => {
//
list.value.forEach((item) => {
item.selected = false
})
}
@ -510,7 +562,7 @@
}
.ant-select {
width: 100%;
text-align: left
text-align: left;
}
.active-td {
border: 1px solid blue;
@ -519,4 +571,4 @@
.handsontableInput {
line-height: 30px;
}
</style>
</style>

@ -15,7 +15,14 @@
<div class="nav"> <i class="iconfont icon-shanchu1"></i><span>删除</span> </div>
</div>
<div class="table-box">
<hot-table ref="hotTb" :data="list" :settings="settings"></hot-table>
<hot-table ref="hotTb" :data="list" :settings="settings">
<img
v-show="!list.length"
class="hot-tb-no-data"
src="../../../assets/images/nodata.png"
alt=""
/>
</hot-table>
</div>
<!--右下角按钮-->
<template #footer>

@ -21,7 +21,14 @@
</a-popconfirm>
</div>
</div>
<hot-table ref="hotTb" :data="list" :settings="settings"></hot-table>
<hot-table ref="hotTb" :data="list" :settings="settings">
<img
v-show="!list.length"
class="hot-tb-no-data"
src="../../../../../../assets/images/nodata.png"
alt=""
/>
</hot-table>
<!--右下角按钮-->
<template #footer>
<a-button

@ -21,7 +21,14 @@
</a-popconfirm>
</div>
</div>
<hot-table ref="hotTb" :data="list" :settings="settings"></hot-table>
<hot-table ref="hotTb" :data="list" :settings="settings">
<img
v-show="!list.length"
class="hot-tb-no-data"
src="../../../../../../assets/images/nodata.png"
alt=""
/>
</hot-table>
</div>
</div>
</a-spin>

@ -4,7 +4,7 @@
<div>
<div class="flex" v-if="!isLockBooking" style="justify-content: space-between">
<div>
<a-button type="link" size="mini" v-show="list.length !== 0" @click="openDialog">
<a-button type="link" size="mini" @click="openDialog">
<span class="iconfont icon-liebiao1"></span>
多品名
</a-button>
@ -88,7 +88,14 @@
:indeterminate="someCheck"
v-if="list.length !== 0"
/>
<hot-table ref="hotmain" :data="list" :settings="settings"></hot-table>
<hot-table ref="hotmain" :data="list" :settings="settings">
<img
v-show="!list.length"
class="hot-tb-no-data"
src="../../../../../assets/images/nodata.png"
alt=""
/>
</hot-table>
</div>
<div class="table-calc">
合计
@ -117,7 +124,14 @@
@cancel="handleModelCancel"
>
<div class="model-content">
<hot-table ref="hotTb" :data="moreTList" :settings="moreTSettings"></hot-table>
<hot-table ref="hotTb" :data="moreTList" :settings="moreTSettings">
<img
v-show="!moreTList.length"
class="hot-tb-no-data"
src="../../../../../assets/images/nodata.png"
alt=""
/>
</hot-table>
<div class="model-botton-box">
<a-button class="btn" type="primary" @click="addChildData"></a-button>
<a-button class="btn btn-delete" @click="removeChildData"></a-button>
@ -136,7 +150,14 @@
:data="moreData[moreSelectNum]"
v-if="moreSelectLoad"
:settings="moreSettings"
></hot-table>
>
<img
v-show="!moreData[moreSelectNum].length"
class="hot-tb-no-data"
src="../../../../../assets/images/nodata.png"
alt=""
/>
</hot-table>
</div>
</a-spin>
</div>
@ -918,26 +939,33 @@
if (nval !== '') {
moreSelectLoad.value = false
let ctnId = moreTList.value[nval].id
GetOpCtnDetailList({
queryCondition: JSON.stringify([
{
FieldName: 'ctnId',
FieldValue: ctnId,
ConditionalType: 1,
},
]),
pageCondition: {
pageIndex: 1,
pageSize: 999,
sortConditions: [],
},
}).then((res) => {
moreData.value[moreSelectNum.value] = res.data
// res.data.forEach(e=>{
console.log(ctnId, 'ctnId', nval)
// })
moreSelectLoad.value = true
})
if (ctnId) {
GetOpCtnDetailList({
queryCondition: JSON.stringify([
{
FieldName: 'ctnId',
FieldValue: ctnId,
ConditionalType: 1,
},
]),
pageCondition: {
pageIndex: 1,
pageSize: 999,
sortConditions: [],
},
}).then((res) => {
moreData.value[moreSelectNum.value] = res.data
moreSelectLoad.value = true
})
} else {
setTimeout(() => {
console.log(moreData.value, moreSelectNum.value, moreData.value[moreSelectNum.value])
moreData.value[moreSelectNum.value].splice(0)
moreSelectLoad.value = true
}, 100)
}
}
})
@ -1380,202 +1408,206 @@
checkboxOption.value.selectedRowKeys = keys
}
function importYarn() {
if (!props.details.id) {
notification.error({ message: '请先保存订舱信息', duration: 3 })
return false
}
YarnLoading.value = true
GetYardData({
id: props.details.id,
isWeb: false,
})
.then((res) => {
if (res.succeeded) {
const data = JSON.parse(res.data)
console.log(data)
// const addTable: any[] = []
// const kindpkgsOld = list.value[0] ? list.value[0].kindPkgs : ''
// list.value = []
// const lastNum =
// list.value.length > 0 ? Number(list.value[list.value.length - 1].rowKey) + 1 : 0
// data.map((item, index) => {
// const _data = {
// rowKey: lastNum + index,
// ctnall: item.CTNALL,
// ctnnum: '1',
// cntrno: item.CNTRNO,
// sealno: item.SEALNO,
// ctncode: item.CtnCode,
// pkgs: item.PKGS,
// kindpkgs: kindpkgsOld || item.KINDPKGS,
// kgs: item.KGS,
// cbm: item.CBM,
// tareweight: item.TAREWEIGHT,
// weightype: '',
// weighkgs: '',
// weighdate: item.WEIGHDATE,
// }
// addTable.push(_data)
// })
notification.warning({ message: '功能开发中...', duration: 3 })
// if (!props.details.id) {
// notification.error({ message: '', duration: 3 })
// return false
// }
// YarnLoading.value = true
// GetYardData({
// id: props.details.id,
// isWeb: false,
// })
// .then((res) => {
// if (res.succeeded) {
// const data = JSON.parse(res.data)
// console.log(data)
// // const addTable: any[] = []
// // const kindpkgsOld = list.value[0] ? list.value[0].kindPkgs : ''
// // list.value = []
// // const lastNum =
// // list.value.length > 0 ? Number(list.value[list.value.length - 1].rowKey) + 1 : 0
// // data.map((item, index) => {
// // const _data = {
// // rowKey: lastNum + index,
// // ctnall: item.CTNALL,
// // ctnnum: '1',
// // cntrno: item.CNTRNO,
// // sealno: item.SEALNO,
// // ctncode: item.CtnCode,
// // pkgs: item.PKGS,
// // kindpkgs: kindpkgsOld || item.KINDPKGS,
// // kgs: item.KGS,
// // cbm: item.CBM,
// // tareweight: item.TAREWEIGHT,
// // weightype: '',
// // weighkgs: '',
// // weighdate: item.WEIGHDATE,
// // }
// // addTable.push(_data)
// // })
// tableData.value = [...tableData.value, ...addTable]
// that.$forceUpdate()
} else {
notification.error({ message: res.message, duration: 3 })
}
YarnLoading.value = false
})
.catch((err) => {
YarnLoading.value = false
})
// // tableData.value = [...tableData.value, ...addTable]
// // that.$forceUpdate()
// } else {
// notification.error({ message: res.message, duration: 3 })
// }
// YarnLoading.value = false
// })
// .catch((err) => {
// YarnLoading.value = false
// })
}
function importsealno() {
sealnoLoading.value = true
GetYardData({
id: props.details.id,
isWeb: false,
})
.then((res) => {
if (res.succeeded) {
let type = true
tableData.value.forEach((item) => {
if (item.sealno || item.cntrno) {
notification.error({ message: '请清空所有箱封号后再引入', duration: 3 })
type = false
}
})
if (type) {
const data = JSON.parse(res.data)
if (data.length == tableData.value.length) {
data.forEach((item, index) => {
tableData.value[index].sealno = item.SEALNO
tableData.value[index].cntrno = item.CNTRNO
tableData.value[index].ctnnum = 1
})
const map = {}
const dest: any[] = []
for (var i = 0; i < tableData.value.length; i++) {
var ai = tableData.value[i]
if (!map[ai.ctnall]) {
dest.push({
ctnall: ai.ctnall,
ctnnum: ai.ctnnum,
})
map[ai.ctnall] = ai
} else {
for (var j = 0; j < dest.length; j++) {
var dj = dest[j]
if (dj.ctnall == ai.ctnall) {
dj.ctnnum = (parseFloat(dj.ctnnum) + parseFloat(ai.ctnnum)).toString()
break
}
}
}
}
changeEmit1(dest)
} else {
notification.error({ message: '箱量与场站不一致', duration: 3 })
}
}
} else {
notification.error({ message: res.message, duration: 3 })
}
sealnoLoading.value = false
})
.catch((err) => {
sealnoLoading.value = false
})
notification.warning({ message: '功能开发中...', duration: 3 })
// sealnoLoading.value = true
// GetYardData({
// id: props.details.id,
// isWeb: false,
// })
// .then((res) => {
// if (res.succeeded) {
// let type = true
// tableData.value.forEach((item) => {
// if (item.sealno || item.cntrno) {
// notification.error({ message: '', duration: 3 })
// type = false
// }
// })
// if (type) {
// const data = JSON.parse(res.data)
// if (data.length == tableData.value.length) {
// data.forEach((item, index) => {
// tableData.value[index].sealno = item.SEALNO
// tableData.value[index].cntrno = item.CNTRNO
// tableData.value[index].ctnnum = 1
// })
// const map = {}
// const dest: any[] = []
// for (var i = 0; i < tableData.value.length; i++) {
// var ai = tableData.value[i]
// if (!map[ai.ctnall]) {
// dest.push({
// ctnall: ai.ctnall,
// ctnnum: ai.ctnnum,
// })
// map[ai.ctnall] = ai
// } else {
// for (var j = 0; j < dest.length; j++) {
// var dj = dest[j]
// if (dj.ctnall == ai.ctnall) {
// dj.ctnnum = (parseFloat(dj.ctnnum) + parseFloat(ai.ctnnum)).toString()
// break
// }
// }
// }
// }
// changeEmit1(dest)
// } else {
// notification.error({ message: '', duration: 3 })
// }
// }
// } else {
// notification.error({ message: res.message, duration: 3 })
// }
// sealnoLoading.value = false
// })
// .catch((err) => {
// sealnoLoading.value = false
// })
}
function importWeight() {
notification.warning({ message: '功能开发中...', duration: 3 })
// if (!props.details.id) {
// notification.error({ message: '', duration: 3 })
// return false
// }
// WeightLoading.value = true
// GetYardData({
// id: props.details.id,
// isWeb: false,
// })
// .then((res) => {
// if (res.succeeded) {
// const data = JSON.parse(res.data)
// const addTable: any[] = []
// const cntrnoArr: any[] = []
// tableData.value.map((item: any, index) => {
// if (!item.cntrno) {
// // delete tableData.value[index]
// tableData.value.splice(index, 1)
// } else {
// cntrnoArr.push(item.cntrno)
// }
// })
// for (let i = tableData.value.length - 1; i >= 0; i--) {
// if (!tableData.value[i].cntrno) {
// tableData.value.splice(i, 1)
// } else {
// cntrnoArr.push(tableData.value[i].cntrno)
// }
// }
// const lastNum =
// tableData.value.length > 0
// ? Number(tableData.value[tableData.value.length - 1].rowKey) + 1
// : 0
// data.map((item, index) => {
// if (cntrnoArr.includes(item.CNTRNO)) {
// const setWeighkgs = calc(
// Number(tableData.value[cntrnoArr.indexOf(item.CNTRNO)].kgs),
// Number(item.TAREWEIGHT),
// '+',
// )
// tableData.value[cntrnoArr.indexOf(item.CNTRNO)] = {
// rowKey: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].rowKey,
// ctnall: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].ctnall,
// ctnnum: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].ctnnum,
// cntrno: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].cntrno,
// sealno: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].sealno,
// pkgs: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].pkgs,
// kindpkgs: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].kindpkgs,
// kgs: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].kgs,
// cbm: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].cbm,
// tareweight: item.TAREWEIGHT,
// weightype: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].weightype,
// weighkgs: setWeighkgs,
// weighdate: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].weighdate,
// }
// } else {
// const _data = {
// rowKey: lastNum + index,
// ctnall: '',
// ctnnum: '1',
// cntrno: '',
// sealno: '',
// pkgs: '',
// kindpkgs: '',
// kgs: '',
// cbm: '',
// tareweight: item.TAREWEIGHT,
// weightype: '',
// weighkgs: '',
// weighdate: '',
// }
// addTable.push(_data)
// }
// })
// tableData.value = [...tableData.value, ...addTable]
// that.$forceUpdate()
// } else {
// notification.error({ message: res.message, duration: 3 })
// }
// WeightLoading.value = false
// })
// .catch((err) => {
// WeightLoading.value = false
// })
}
function changeEmit1(arr) {
emit('changectnall', arr)
}
function importWeight() {
if (!props.details.id) {
notification.error({ message: '请先保存订舱信息', duration: 3 })
return false
}
WeightLoading.value = true
GetYardData({
id: props.details.id,
isWeb: false,
})
.then((res) => {
if (res.succeeded) {
const data = JSON.parse(res.data)
const addTable: any[] = []
const cntrnoArr: any[] = []
tableData.value.map((item: any, index) => {
if (!item.cntrno) {
// delete tableData.value[index]
tableData.value.splice(index, 1)
} else {
cntrnoArr.push(item.cntrno)
}
})
for (let i = tableData.value.length - 1; i >= 0; i--) {
if (!tableData.value[i].cntrno) {
tableData.value.splice(i, 1)
} else {
cntrnoArr.push(tableData.value[i].cntrno)
}
}
const lastNum =
tableData.value.length > 0
? Number(tableData.value[tableData.value.length - 1].rowKey) + 1
: 0
data.map((item, index) => {
if (cntrnoArr.includes(item.CNTRNO)) {
const setWeighkgs = calc(
Number(tableData.value[cntrnoArr.indexOf(item.CNTRNO)].kgs),
Number(item.TAREWEIGHT),
'+',
)
tableData.value[cntrnoArr.indexOf(item.CNTRNO)] = {
rowKey: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].rowKey,
ctnall: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].ctnall,
ctnnum: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].ctnnum,
cntrno: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].cntrno,
sealno: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].sealno,
pkgs: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].pkgs,
kindpkgs: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].kindpkgs,
kgs: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].kgs,
cbm: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].cbm,
tareweight: item.TAREWEIGHT,
weightype: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].weightype,
weighkgs: setWeighkgs,
weighdate: tableData.value[cntrnoArr.indexOf(item.CNTRNO)].weighdate,
}
} else {
const _data = {
rowKey: lastNum + index,
ctnall: '',
ctnnum: '1',
cntrno: '',
sealno: '',
pkgs: '',
kindpkgs: '',
kgs: '',
cbm: '',
tareweight: item.TAREWEIGHT,
weightype: '',
weighkgs: '',
weighdate: '',
}
addTable.push(_data)
}
})
tableData.value = [...tableData.value, ...addTable]
that.$forceUpdate()
} else {
notification.error({ message: res.message, duration: 3 })
}
WeightLoading.value = false
})
.catch((err) => {
WeightLoading.value = false
})
}
function calc(num1, num2, calcStr) {
var str1 //
var str2

@ -944,7 +944,14 @@
</div>
<!-- v-if="preOrderLoad" -->
<div class="table-box">
<hot-table ref="hotTb" :data="list" :settings="settings"></hot-table>
<hot-table ref="hotTb" :data="list" :settings="settings">
<img
v-show="!list.length"
class="hot-tb-no-data"
src="../../../../../assets/images/nodata.png"
alt=""
/>
</hot-table>
</div>
</div>
</a-col>

Loading…
Cancel
Save