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
653a7eb6
Commit
653a7eb6
authored
Mar 24, 2025
by
何远江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加过滤字段
parent
b19ae215
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
120 additions
and
23 deletions
+120
-23
var.ts
src/api/var.ts
+9
-0
excel.ts
src/stores/excel.ts
+9
-0
VarChange.vue
src/views/var/varChange/VarChange.vue
+6
-1
ConfigForm1.vue
src/views/var/varChange/components/ConfigForm1.vue
+3
-6
ConfigFormItem.vue
src/views/var/varChange/components/ConfigFormItem.vue
+93
-16
No files found.
src/api/var.ts
View file @
653a7eb6
...
@@ -158,6 +158,15 @@ export const getVarSpecList = (productCode: any) => {
...
@@ -158,6 +158,15 @@ export const getVarSpecList = (productCode: any) => {
});
});
};
};
/**
* 获取过滤映射字段
* @param orderItemId
* @returns
*/
export
const
getFilterMapField
=
()
=>
{
return
axios
.
get
(
"/api/completeOrder/getClassFiledsList"
);
};
/**
/**
* checkOrder
* checkOrder
...
...
src/stores/excel.ts
View file @
653a7eb6
...
@@ -96,6 +96,7 @@ type ExcelChangeStore = {
...
@@ -96,6 +96,7 @@ type ExcelChangeStore = {
orderFieldList
:
Recordable
[]
orderFieldList
:
Recordable
[]
usedFieldList
:
Recordable
[]
usedFieldList
:
Recordable
[]
specList
?:
Recordable
[]
specList
?:
Recordable
[]
filterMapField
?:
Recordable
[]
}
}
export
const
useExcelChangeStore
=
defineStore
(
'excelChangeStore'
,
{
export
const
useExcelChangeStore
=
defineStore
(
'excelChangeStore'
,
{
...
@@ -160,6 +161,7 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore
...
@@ -160,6 +161,7 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore
scriptList
:
[],
// 脚本
scriptList
:
[],
// 脚本
orderFieldList
:
[],
// 订单字段
orderFieldList
:
[],
// 订单字段
usedFieldList
:
[],
// 当前编辑column使用过的映射字段
usedFieldList
:
[],
// 当前编辑column使用过的映射字段
filterMapField
:
[]
// 变量映射过滤字段
}),
}),
getters
:
{
getters
:
{
getAllMapConfigs
():
Recordable
{
getAllMapConfigs
():
Recordable
{
...
@@ -191,6 +193,10 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore
...
@@ -191,6 +193,10 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore
},
},
getSpecList
():
any
{
getSpecList
():
any
{
return
this
.
specList
return
this
.
specList
},
getFilterMapFieldsList
():
any
{
// 是否禁用
return
this
.
filterMapField
}
}
},
},
actions
:
{
actions
:
{
...
@@ -211,6 +217,9 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore
...
@@ -211,6 +217,9 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore
},
},
setSpecList
(
list
:
any
)
{
setSpecList
(
list
:
any
)
{
this
.
specList
=
list
this
.
specList
=
list
},
setFilterMapField
(
list
:
any
)
{
this
.
filterMapField
=
list
}
}
}
}
})
})
\ No newline at end of file
src/views/var/varChange/VarChange.vue
View file @
653a7eb6
...
@@ -187,7 +187,8 @@ import {
...
@@ -187,7 +187,8 @@ import {
apiVarTemplateGetConf
,
apiVarTemplateGetConf
,
apiVarTemplateConvert
,
apiVarTemplateConvert
,
apiVarTemplateSaveConf
,
apiVarTemplateSaveConf
,
getVarSpecList
getVarSpecList
,
getFilterMapField
}
from
'@/api/var'
}
from
'@/api/var'
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
import
type
{
VxeTableInstance
}
from
'vxe-table'
import
type
{
VxeTableInstance
}
from
'vxe-table'
...
@@ -372,10 +373,14 @@ const toDetail = async (row: any) => {
...
@@ -372,10 +373,14 @@ const toDetail = async (row: any) => {
const
{
data
}
=
await
apiVarTemplateGetVars
(
row
.
varTemplateDetailId
)
const
{
data
}
=
await
apiVarTemplateGetVars
(
row
.
varTemplateDetailId
)
const
{
data
:
cdata
}
=
await
apiVarTemplateGetConf
(
row
.
varTemplateDetailId
)
const
{
data
:
cdata
}
=
await
apiVarTemplateGetConf
(
row
.
varTemplateDetailId
)
const
{
data
:
specData
}
=
await
getVarSpecList
(
row
.
productCode
)
const
{
data
:
specData
}
=
await
getVarSpecList
(
row
.
productCode
)
// 获取过滤字段
const
{
data
:
filterData
}
=
await
getFilterMapField
()
const
{
res
,
titles
,
configs
}
=
filterRunData2
(
data
.
result
,
true
)
const
{
res
,
titles
,
configs
}
=
filterRunData2
(
data
.
result
,
true
)
excelChangeStore
.
setSpecList
(
specData
.
result
)
excelChangeStore
.
setSpecList
(
specData
.
result
)
excelChangeStore
.
setFilterMapField
(
filterData
.
result
)
cdata
.
result
?.
forEach
((
item
)
=>
{
cdata
.
result
?.
forEach
((
item
)
=>
{
Reflect
.
set
(
configs
[
item
.
title
],
'filedConfs'
,
item
.
filedConfs
)
Reflect
.
set
(
configs
[
item
.
title
],
'filedConfs'
,
item
.
filedConfs
)
...
...
src/views/var/varChange/components/ConfigForm1.vue
View file @
653a7eb6
...
@@ -38,7 +38,9 @@ const addFormItem = () => {
...
@@ -38,7 +38,9 @@ const addFormItem = () => {
time
:
Date
.
now
(),
time
:
Date
.
now
(),
mapField
:
''
,
mapField
:
''
,
orderFiled
:
{},
orderFiled
:
{},
scripts
:
[]
scripts
:
[],
filterFiled
:
''
,
filterScripts
:
[]
})
})
}
}
const
removeMapField
=
(
index
:
number
)
=>
{
const
removeMapField
=
(
index
:
number
)
=>
{
...
@@ -49,10 +51,6 @@ const getScriptList = async () => {
...
@@ -49,10 +51,6 @@ const getScriptList = async () => {
const
{
data
}
=
await
apiGetScript
()
const
{
data
}
=
await
apiGetScript
()
excelChangeStore
.
setScriptList
(
data
.
result
)
excelChangeStore
.
setScriptList
(
data
.
result
)
}
}
const
getOrderFields
=
async
()
=>
{
const
{
data
}
=
await
apiGetOrderField
()
excelChangeStore
.
setOrderFieldList
(
data
.
result
)
}
watch
(
watch
(
...
@@ -78,6 +76,5 @@ watch(
...
@@ -78,6 +76,5 @@ watch(
onMounted
(()
=>
{
onMounted
(()
=>
{
getScriptList
()
getScriptList
()
getOrderFields
()
})
})
</
script
>
</
script
>
src/views/var/varChange/components/ConfigFormItem.vue
View file @
653a7eb6
<
template
>
<
template
>
<!-- 字段映射设置 -->
<!-- 字段映射设置 -->
<el-col>
<el-col>
<el-form-item
label=
"
对应
字段"
prop=
"mapField"
>
<el-form-item
label=
"
映射
字段"
prop=
"mapField"
>
<el-select
<el-select
v-model=
"item.mapField"
v-model=
"item.mapField"
style=
"width: 260px"
style=
"width: 260px"
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
<!-- 脚本设置 -->
<!-- 脚本设置 -->
<el-col
:span=
"24"
v-if=
"item.mapField"
>
<el-col
:span=
"24"
v-if=
"item.mapField"
>
<template
v-for=
"(sitem, idx) in item.scripts"
>
<template
v-for=
"(sitem, idx) in item.scripts"
>
<el-form-item
:label=
"'脚本' + (idx ? idx + 1 : '')"
>
<el-form-item
:label=
"'
映射
脚本' + (idx ? idx + 1 : '')"
>
<el-row>
<el-row>
<el-col>
<el-col>
<el-select
<el-select
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
></el-option>
></el-option>
</el-select>
</el-select>
<span
class=
"ml-1"
>
<span
class=
"ml-1"
>
<el-button
v-if=
"idx == 0"
@
click=
"addScript"
type=
"primary"
circle
<el-button
v-if=
"idx == 0"
@
click=
"addScript
('scripts')
"
type=
"primary"
circle
><el-icon><Plus
/></el-icon
><el-icon><Plus
/></el-icon
></el-button>
></el-button>
<el-button
v-if=
"idx != 0"
@
click=
"removeScript(idx)"
type=
"danger"
plain
circle
<el-button
v-if=
"idx != 0"
@
click=
"removeScript(idx)"
type=
"danger"
plain
circle
...
@@ -70,6 +70,78 @@
...
@@ -70,6 +70,78 @@
</el-form-item>
</el-form-item>
</
template
>
</
template
>
</el-col>
</el-col>
<!-- 过滤字段映射设置 -->
<el-col>
<el-form-item
label=
"过滤字段"
prop=
"filterFiled"
>
<el-select
v-model=
"item.filterFiled"
style=
"width: 260px"
filterable
placeholder=
"请选择"
clearable
>
<el-option-group
v-for=
"group in getFilterMapFieldsList"
:key=
"group.groupTitle"
:label=
"group.groupTitle"
>
<el-option
v-for=
"itm in group.filedPojos"
:key=
"itm.filedName"
:label=
"itm.fliedTitle"
:value=
"itm.filedName"
/>
</el-option-group>
</el-select>
</el-form-item>
</el-col>
<!-- 过滤脚本设置 -->
<el-col
:span=
"24"
v-if=
"item.filterFiled"
>
<
template
v-for=
"(sitem, idx) in item.filterScripts"
>
<el-form-item
:label=
"'过滤脚本' + (idx ? idx + 1 : '')"
>
<el-row>
<el-col>
<el-select
style=
"width: 260px"
v-model=
"sitem.scriptName"
@
change=
"(e) => scriptChange(sitem, e)"
clearable
>
<el-option
v-for=
"item in getScriptList"
:key=
"item.srciptName"
:value=
"item.srciptName"
:label=
"item.srciptName"
></el-option>
</el-select>
<span
class=
"ml-1"
>
<el-button
v-if=
"idx == 0"
@
click=
"addScript('filterScripts')"
type=
"primary"
circle
><el-icon><Plus
/></el-icon
></el-button>
<el-button
v-if=
"idx != 0"
@
click=
"removeScript(idx, 'filterScripts')"
type=
"danger"
plain
circle
><el-icon><Minus
/></el-icon
></el-button>
</span>
</el-col>
<el-col
v-if=
"sitem.scriptName"
class=
"mt-1"
>
<el-input
type=
"textarea"
style=
"width: 270px"
rows=
"5"
v-model=
"sitem.content"
></el-input>
</el-col>
</el-row>
</el-form-item>
</
template
>
</el-col>
</template>
</template>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
...
@@ -81,9 +153,7 @@ import { onMounted, ref, watch } from 'vue'
...
@@ -81,9 +153,7 @@ import { onMounted, ref, watch } from 'vue'
const
props
=
defineProps
<
{
item
?:
any
;
index
:
number
}
>
()
const
props
=
defineProps
<
{
item
?:
any
;
index
:
number
}
>
()
const
emits
=
defineEmits
([
'remove'
])
const
emits
=
defineEmits
([
'remove'
])
const
excelChangeStore
=
useVariableExcelChangeStore
()
const
excelChangeStore
=
useVariableExcelChangeStore
()
const
{
getScriptList
,
getSpecList
}
=
storeToRefs
(
excelChangeStore
)
const
{
getScriptList
,
getSpecList
,
getFilterMapFieldsList
}
=
storeToRefs
(
excelChangeStore
)
const
isVariable
=
ref
(
false
)
const
scriptChange
=
(
sitem
,
e
)
=>
{
const
scriptChange
=
(
sitem
,
e
)
=>
{
if
(
e
)
{
if
(
e
)
{
...
@@ -93,17 +163,11 @@ const scriptChange = (sitem, e) => {
...
@@ -93,17 +163,11 @@ const scriptChange = (sitem, e) => {
}
}
}
}
const
checkboxChange
=
(
e
)
=>
{
const
removeScript
=
(
index
:
number
,
type
=
'scripts'
)
=>
{
// 设置一个属性
props
.
item
[
type
].
splice
(
index
,
1
)
props
.
item
.
isVariable
=
isVariable
.
value
props
.
item
.
mapField
=
''
props
.
item
.
orderFiled
=
null
}
const
removeScript
=
(
index
:
number
)
=>
{
props
.
item
.
scripts
.
splice
(
index
,
1
)
}
}
const
addScript
=
()
=>
{
const
addScript
=
(
type
=
'script'
)
=>
{
props
.
item
.
scripts
.
push
({
props
.
item
[
type
]
.
push
({
content
:
''
,
content
:
''
,
scriptName
:
''
scriptName
:
''
})
})
...
@@ -126,5 +190,18 @@ watch(
...
@@ -126,5 +190,18 @@ watch(
}
}
}
}
)
)
watch
(
()
=>
props
.
item
.
filterFiled
,
(
val
)
=>
{
// 如果有值,添加脚本
if
(
val
&&
props
.
item
.
filterScripts
.
length
==
0
)
{
props
.
item
.
filterScripts
.
push
({
content
:
''
,
scriptName
:
''
})
}
}
)
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
></
style
>
<
style
lang=
"scss"
scoped
></
style
>
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