Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-baoshen-excel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
何远江
topsun-baoshen-excel
Commits
60bd2c30
Commit
60bd2c30
authored
Nov 28, 2024
by
何远江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单变量导出修改
parent
e1ccd40a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
7 deletions
+62
-7
var.ts
src/api/var.ts
+11
-0
excel.ts
src/utils/excel.ts
+47
-3
Variables.vue
src/views/var/variables/Variables.vue
+4
-4
No files found.
src/api/var.ts
View file @
60bd2c30
...
...
@@ -136,6 +136,17 @@ export const apiOrderVarGetNewVars = (orderItemId: any) => {
});
};
/**
* 根据标量模板文件ID获取转换后变量
* @param orderItemId
* @returns
*/
export
const
apiOrderVarGetOrderNewVars
=
(
orderItemId
:
any
)
=>
{
return
axios
.
get
(
"/api/orderVar/getOrderNewVars"
,
{
params
:
{
orderItemId
}
});
};
/**
* 获取变量下拉数据
* @param orderItemId
...
...
src/utils/excel.ts
View file @
60bd2c30
...
...
@@ -278,7 +278,7 @@ export function filterRunData(data: any, config: boolean = false) {
Reflect
.
set
(
rw
,
itm
.
title
,
itm
.
value
)
titles
.
add
(
itm
.
title
)
if
(
!
Reflect
.
has
(
configs
,
itm
.
title
)
&&
config
)
{
configs
[
itm
.
title
]
=
{
...
structuredClone
(
temConf
),
title
:
itm
.
title
,
}
configs
[
itm
.
title
]
=
{
...
structuredClone
(
temConf
),
title
:
itm
.
title
}
}
})
// 是否有附加信息
...
...
@@ -308,7 +308,6 @@ export function filterRunData(data: any, config: boolean = false) {
}
}
/**
* 解析后数据,处理表头和表格数据
* @param data
...
...
@@ -331,7 +330,7 @@ export function filterRunData2(data: any, config: boolean = false) {
Reflect
.
set
(
rw
,
itm
.
title
,
itm
.
value
)
titles
.
add
(
itm
.
title
)
if
(
!
Reflect
.
has
(
configs
,
itm
.
title
)
&&
config
)
{
configs
[
itm
.
title
]
=
{
...
structuredClone
(
temConf
),
title
:
itm
.
title
,
}
configs
[
itm
.
title
]
=
{
...
structuredClone
(
temConf
),
title
:
itm
.
title
}
}
})
...
...
@@ -344,6 +343,51 @@ export function filterRunData2(data: any, config: boolean = false) {
}
}
export
function
filterVarData
(
data
:
any
)
{
const
res
:
Recordable
[]
=
[]
const
titles
:
Set
<
string
>
=
new
Set
()
const
baseFieldMap
=
{
imageName
:
'底图名称'
,
orderCodeNo
:
'销售单号+行项次'
,
orderNum
:
'参考数'
,
brandName
:
'品牌名称'
,
customerName
:
'客户名称'
,
quarter
:
'季度'
,
productCode
:
'产品编码'
}
titles
.
add
(
'底图名称'
)
.
add
(
'销售单号+行项次'
)
.
add
(
'参考数'
)
.
add
(
'品牌名称'
)
.
add
(
'客户名称'
)
.
add
(
'季度'
)
.
add
(
'产品编码'
)
data
.
forEach
((
row
:
any
)
=>
{
const
rw
:
Recordable
=
{}
Reflect
.
set
(
rw
,
'底图名称'
,
row
[
'imageName'
])
Reflect
.
set
(
rw
,
'销售单号+行项次'
,
row
[
'orderCodeNo'
])
Reflect
.
set
(
rw
,
'参考数'
,
row
[
'orderNum'
])
Reflect
.
set
(
rw
,
'品牌名称'
,
row
[
'brandName'
])
Reflect
.
set
(
rw
,
'客户名称'
,
row
[
'customerName'
])
Reflect
.
set
(
rw
,
'季度'
,
row
[
'quarter'
])
Reflect
.
set
(
rw
,
'产品编码'
,
row
[
'productCode'
])
// 变量信息
row
.
varOrder
.
order
.
forEach
((
itm
:
any
)
=>
{
Reflect
.
set
(
rw
,
itm
.
title
,
itm
.
value
)
titles
.
add
(
itm
.
title
)
})
res
.
push
(
rw
)
})
return
{
res
,
titles
:
[...
titles
]
}
}
/**比较两个单元格是否是同一个 */
export
function
compareSameCell
(
c1
,
c2
)
{
return
c1
.
sheet
==
c2
.
sheet
&&
c1
.
row
==
c2
.
row
&&
c1
.
colum
==
c2
.
colum
...
...
src/views/var/variables/Variables.vue
View file @
60bd2c30
...
...
@@ -122,13 +122,13 @@ import { nextTick, onMounted, reactive, ref } from 'vue'
import
{
apiOrderVarPage
,
apiOrderVarGetVars
,
apiOrderVarGetNewVars
,
apiOrderVarGet
Order
NewVars
,
apiOrderVarSaveUpload
,
apiOrderVarRun
}
from
'@/api/var'
import
type
{
VxeTableInstance
}
from
'vxe-table'
import
TemplateVariable
from
'./components/TemplateVariable.vue'
import
{
filter
RunData2
}
from
'@/utils/excel'
import
{
filter
VarData
}
from
'@/utils/excel'
import
{
uploadFile
}
from
'@/api/excel'
import
{
ElLoading
,
ElMessage
}
from
'element-plus'
import
{
exportExcel
}
from
'@/utils/export-excel'
...
...
@@ -159,8 +159,8 @@ const detailVariable = ref({
const
currentRow
=
ref
()
const
handleShowVarRun
=
async
(
row
:
any
)
=>
{
currentRow
.
value
=
row
const
{
data
}
=
await
apiOrderVarGetNewVars
(
row
.
orderItemId
)
const
{
res
,
titles
}
=
filter
RunData2
(
data
.
result
||
[],
false
)
const
{
data
}
=
await
apiOrderVarGet
Order
NewVars
(
row
.
orderItemId
)
const
{
res
,
titles
}
=
filter
VarData
(
data
.
result
||
[]
)
detailVariable
.
value
.
titles
=
titles
detailVariable
.
value
.
data
=
res
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment