|
|
@@ -89,8 +89,10 @@
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
|
<template #operate="{ row, index }">
|
|
|
- <el-button size="small" @click="openEdit(row)">修改</el-button>
|
|
|
- <el-button size="small" @click="deleteDetail(index)">删除</el-button>
|
|
|
+ <el-button-group size="small">
|
|
|
+ <el-button @click="openEdit(row)">修改</el-button>
|
|
|
+ <el-button @click="deleteDetail(index)">删除</el-button>
|
|
|
+ </el-button-group>
|
|
|
</template>
|
|
|
</app-table>
|
|
|
</div>
|
|
|
@@ -111,6 +113,7 @@ import type { FormInstance, FormRules, UploadFile } from 'element-plus'
|
|
|
import { read, utils } from 'xlsx'
|
|
|
import { useComponent } from '@/hooks/component'
|
|
|
import { validateRules } from '@/constants/regex'
|
|
|
+import { enumStore } from '@/stores'
|
|
|
import { getGZCJAccountTypeList, getGZCJCategoryTypeList, getGZCJDeliveryTypeList, getGZCJShapeTypeName, getGZCJPublishTypeName, getGZCJMarkTypeName, getGZCJServiceTypeName } from '@/constants/customs'
|
|
|
import { useCJJCOrderApply } from '@/business/customs/exit'
|
|
|
import AppDrawer from '@pc/components/base/drawer/index.vue'
|
|
|
@@ -271,8 +274,62 @@ const handleExcel = (uploadFile: UploadFile) => {
|
|
|
fileReader.onload = (ev) => {
|
|
|
const data = ev.target?.result
|
|
|
if (data) {
|
|
|
+ const { getEnumTypeList } = enumStore.actions
|
|
|
+ const shapeTypeList = getEnumTypeList('GZCJShapeType')
|
|
|
+ const markTypeList = getEnumTypeList('GZCJMarkType')
|
|
|
+ const publishType = getEnumTypeList('GZCJPublishType')
|
|
|
+ const serviceType = getEnumTypeList('GZCJServiceType')
|
|
|
+
|
|
|
const workbook = read(data, { type: 'binary' })
|
|
|
- console.log(workbook)
|
|
|
+ const wsname = workbook.SheetNames[0]
|
|
|
+ const list = utils.sheet_to_json(workbook.Sheets[wsname], { header: ['Index', 'GZNo', 'GZCJShapeType', 'Weight', 'Amount', 'GZCJMarkType', 'GZCJPublishType', 'GZCJServiceType', 'OriginCertNo', 'ColorInfo', 'Remark'] })
|
|
|
+
|
|
|
+ clearList()
|
|
|
+ list.forEach((row, index) => {
|
|
|
+ if (index > 0) {
|
|
|
+ const item: Proto.GZCJCategoryDetail = {
|
|
|
+ OrderIndex: 0, // 顺序,必填
|
|
|
+ GZNo: '', // 货物编号,必填
|
|
|
+ GZCJShapeType: 0, // 形状,必填
|
|
|
+ Weight: 0, // 重量(CT),3位小数,必填
|
|
|
+ Amount: 0, // 参考货值(USD),2位小数,必填
|
|
|
+ ColorInfo: '', // 彩钻信息
|
|
|
+ Remark: '', // 备注
|
|
|
+ GZCJMarkType: 0,// 刻印服务,必填
|
|
|
+ GZCJPublishType: 0,// 是否披露处理,必填
|
|
|
+ GZCJServiceType: 0, // 服务类别,必填
|
|
|
+ OriginCertNo: '', // 原证书号
|
|
|
+ }
|
|
|
+ Object.entries(row as { [key: string]: unknown }).forEach(([key, value], index) => {
|
|
|
+ if (index > 0 && Reflect.has(item, key)) {
|
|
|
+ let enumType
|
|
|
+ switch (key) {
|
|
|
+ case 'GZCJShapeType': {
|
|
|
+ enumType = shapeTypeList.find((e) => e.label === value)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'GZCJMarkType': {
|
|
|
+ enumType = markTypeList.find((e) => e.label === value)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'GZCJPublishType': {
|
|
|
+ enumType = publishType.find((e) => e.label === value)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'GZCJServiceType': {
|
|
|
+ enumType = serviceType.find((e) => e.label === value)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ default: {
|
|
|
+ enumType = { value }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Object.defineProperty(item, key, { value: enumType?.value ?? 0 })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ formData.GZCJCategoryDetails?.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|