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
2a31a6d9
Commit
2a31a6d9
authored
Dec 31, 2024
by
何远江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加复制功能,解析列表添加查询条件
parent
dcc27a62
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
172 additions
and
7 deletions
+172
-7
commentExcel.ts
src/stores/commentExcel.ts
+17
-2
ExcelOperate.vue
...ws/comment-excel/components/ExcelOperate/ExcelOperate.vue
+65
-2
OrderChange.vue
src/views/order/orderChange/OrderChange.vue
+27
-1
ExcelOperate.vue
...ews/var/varExcel/components/ExcelOperate/ExcelOperate.vue
+63
-2
No files found.
src/stores/commentExcel.ts
View file @
2a31a6d9
import
type
{
Recordable
}
from
'@/types/global'
import
{
ElMessage
}
from
'element-plus'
import
{
defineStore
}
from
'pinia'
type
StoreState
=
{
fileInfo
:
Recordable
fileInfo
:
Recordable
,
copyFileId
:
undefined
|
string
}
export
const
useCommentExcel
=
defineStore
(
'CommentExcel'
,
{
state
:
():
StoreState
=>
({
fileInfo
:
{}
fileInfo
:
{},
copyFileId
:
undefined
}),
getters
:
{
getFileInfo
():
Recordable
{
return
this
.
fileInfo
},
isSameFile
():
boolean
{
return
this
.
fileInfo
?.
orderFileId
===
this
.
copyFileId
},
isSameVarFile
():
boolean
{
return
this
.
fileInfo
?.
varFileId
===
this
.
copyFileId
}
},
actions
:
{
setFileInfo
(
data
:
any
)
{
this
.
fileInfo
=
data
},
setCopyFileId
()
{
if
(
!
this
.
fileInfo
?.
orderFileId
||
this
.
fileInfo
?.
varFileId
)
{
return
ElMessage
(
'请选择正确的复制对象!'
)
}
this
.
copyFileId
=
this
.
fileInfo
?.
orderFileId
||
this
.
fileInfo
?.
varFileId
}
}
})
src/views/comment-excel/components/ExcelOperate/ExcelOperate.vue
View file @
2a31a6d9
...
...
@@ -94,6 +94,15 @@
</div>
<el-button
type=
"primary"
size=
"small"
@
click=
"toRun"
>
执行解析
</el-button>
<el-button
type=
"primary"
size=
"small"
@
click=
"copy"
>
复制
</el-button>
<el-button
v-if=
"commentExcelStore.copyFileId"
:loading=
"pasteLoading"
type=
"primary"
size=
"small"
@
click=
"pasteConfig"
>
引入
</el-button
>
</div>
</el-scrollbar>
...
...
@@ -227,6 +236,7 @@ import {
}
from
'@/constants/excelConfig'
import
{
flatten
,
cloneDeep
}
from
'lodash-es'
import
{
useCommentExcel
}
from
'@/stores/commentExcel'
import
{
useExcelChangeStore
}
from
'@/stores/excel'
import
{
storeToRefs
}
from
'pinia'
import
{
isFunction
}
from
'@/utils/is'
import
{
ElLoading
,
ElMessage
,
ElMessageBox
}
from
'element-plus'
...
...
@@ -237,7 +247,8 @@ import {
getExcelAreaByFileId
,
getExcelConnectByFileId
,
removeExcelArea
,
removeExcelAreaConnect
removeExcelAreaConnect
,
addExcelArea
}
from
'@/api/excel'
import
type
{
Recordable
}
from
'@/types/global'
import
{
filterRunData
,
getRangetxt
,
setRangeBackground
}
from
'@/utils/excel'
...
...
@@ -245,6 +256,7 @@ import type { VxeTableInstance } from 'vxe-table'
import
EditArea
from
'../EditArea/EditArea.vue'
import
{
deleteExcelProdFileConfByIds
,
getExcelProdFileConfPage
}
from
'@/api/product'
const
pasteLoading
=
ref
(
false
)
const
connectVisible
=
ref
(
false
)
const
showProdCompare
=
ref
(
false
)
const
xTableConnect
=
ref
<
VxeTableInstance
>
()
...
...
@@ -257,8 +269,9 @@ const compareParams = reactive({
customerId
:
''
})
const
luckysheet
=
(
window
as
any
).
luckysheet
const
excelChangeStore
=
useExcelChangeStore
()
const
commentExcelStore
=
useCommentExcel
()
const
{
getFileInfo
}
=
storeToRefs
(
commentExcelStore
)
const
{
getFileInfo
,
isSameFile
}
=
storeToRefs
(
commentExcelStore
)
const
connectList
=
ref
<
any
[]
>
([])
const
chooseVisible
=
ref
(
false
)
const
editVisible
=
ref
(
false
)
...
...
@@ -742,6 +755,56 @@ const toDelete = async (row) => {
}
}
/**
* 复制
*/
const
copy
=
()
=>
{
if
(
areaList
.
value
?.
length
)
{
commentExcelStore
.
setCopyFileId
()
}
ElMessage
(
'该文件还未设置标注信息!'
)
}
/**
* 引入复制的配置
*/
const
pasteConfig
=
async
()
=>
{
// 是否是当前文件
if
(
isSameFile
.
value
)
{
return
ElMessage
(
'请在其他文件引入!'
)
}
pasteLoading
.
value
=
true
try
{
// 1、获取复制文件id
const
{
data
}
=
await
getExcelAreaByFileId
(
commentExcelStore
.
copyFileId
as
string
)
// 2、去除id
data
.
result
.
forEach
((
item
)
=>
{
item
.
fileId
=
commentExcelStore
.
fileInfo
.
orderFileId
delete
item
.
excelAreaId
})
// 3、自动保存
await
addExcelArea
(
data
.
result
)
// 4、刷新
ElMessage
({
type
:
'success'
,
message
:
'引入成功!重新加载...'
,
})
// 5、刷新当前页 or 刷新当前excel
setTimeout
(()
=>
{
window
.
location
.
reload
();
},
1500
);
}
catch
{
ElMessage
.
error
(
'引入失败!'
)
}
pasteLoading
.
value
=
false
}
onMounted
(()
=>
{
loadExcel
()
getCompareList
()
...
...
src/views/order/orderChange/OrderChange.vue
View file @
2a31a6d9
...
...
@@ -12,6 +12,16 @@
</
template
>
</el-select>
</el-form-item>
<el-form-item
label=
"创建时间"
>
<el-date-picker
v-model=
"queryParams.createTime"
type=
"date"
value-format=
"YYYY-MM-DD"
placeholder=
"选择创建时间"
></el-date-picker>
</el-form-item>
<el-form-item
label=
"创建人"
>
<el-input
v-model=
"queryParams.createby_dict"
placeholder=
""
>
<
template
#
append
>
<el-button
:icon=
"MoreFilled"
@
click=
"visibleUserModal = true"
></el-button>
</
template
>
</el-input>
</el-form-item>
<el-form-item>
<el-button
type=
"default"
@
click=
"onReset"
>
重置
</el-button>
...
...
@@ -36,7 +46,7 @@
:data=
"tableData"
>
<vxe-column
type=
"checkbox"
width=
"50"
></vxe-column>
<vxe-column
field=
"fileId_dictText"
title=
"文件名称"
>
<vxe-column
field=
"fileId_dictText"
title=
"文件名称"
minWidth=
"300"
>
<
template
#
default=
"{ row }"
>
<el-link
target=
"_blank"
:href=
"'/preview-excel?fileId=' + row.fileId"
>
{{
row
.
fileId_dictText
...
...
@@ -45,6 +55,7 @@
</vxe-column>
<vxe-column
field=
"status_dictText"
title=
"订单状态"
width=
"120"
></vxe-column>
<vxe-column
field=
"createTime"
title=
"创建时间"
width=
"180"
></vxe-column>
<vxe-column
field=
"createby_dict"
title=
"创建人"
width=
"180"
></vxe-column>
<vxe-column
field=
"action"
title=
"操作"
width=
"140"
>
<
template
#
default=
"{ row }"
>
<el-link
style=
"font-size: 12px"
type=
"primary"
@
click=
"toDetail(row)"
>
查看
</el-link>
...
...
@@ -202,6 +213,8 @@
</vxe-modal>
<CustomerModal
v-model:visible=
"visible"
@
confirm=
"confirmCustomer"
/>
<UserModal
v-model:visible=
"visibleUserModal"
@
confirm=
"confirmUser"
/>
</template>
<
script
lang=
"ts"
setup
>
...
...
@@ -236,8 +249,10 @@ import { storeToRefs } from 'pinia'
import
{
saveAs
}
from
'file-saver'
import
{
uploadFile
}
from
'@/api/excel'
import
CustomerModal
from
'@/components/CustomerModal/CustomerModal.vue'
import
UserModal
from
'@/components/UserModal/UserModal.vue'
const
visible
=
ref
(
false
)
const
visibleUserModal
=
ref
(
false
)
const
uploadRef
=
ref
<
UploadInstance
>
()
const
importFormInstance
=
ref
<
FormInstance
>
()
const
loading
=
ref
(
false
)
...
...
@@ -247,6 +262,9 @@ const { getAllMapConfigs } = storeToRefs(excelChangeStore)
/**查询参数 */
const
queryParams
=
reactive
({
status
:
''
,
createTime
:
''
,
createBy
:
''
,
createby_dict
:
''
,
currentPage
:
1
,
pageSize
:
10
,
total
:
0
,
...
...
@@ -506,6 +524,14 @@ const submitImport = async () => {
}
}
const
confirmUser
=
(
list
:
any
)
=>
{
const
[
user
]
=
list
if
(
user
)
{
queryParams
.
createBy
=
user
.
userId
queryParams
.
createby_dict
=
user
.
nickName
}
}
const
onReset
=
()
=>
{
queryParams
.
status
=
''
}
...
...
src/views/var/varExcel/components/ExcelOperate/ExcelOperate.vue
View file @
2a31a6d9
...
...
@@ -94,6 +94,15 @@
</div>
<el-button
type=
"primary"
size=
"small"
@
click=
"toRun"
>
执行解析
</el-button>
<el-button
type=
"primary"
size=
"small"
@
click=
"copy"
>
复制
</el-button>
<el-button
v-if=
"commentExcelStore.copyFileId"
:loading=
"pasteLoading"
type=
"primary"
size=
"small"
@
click=
"pasteConfig"
>
引入
</el-button
>
</div>
</el-scrollbar>
...
...
@@ -237,7 +246,8 @@ import {
getExcelAreaByFileId
,
getExcelConnectByFileId
,
removeExcelArea
,
removeExcelAreaConnect
removeExcelAreaConnect
,
addExcelArea
}
from
'@/api/varExcel'
import
type
{
Recordable
}
from
'@/types/global'
import
{
filterRunData2
,
getRangetxt
,
setRangeBackground
}
from
'@/utils/excel'
...
...
@@ -245,6 +255,7 @@ import type { VxeTableInstance } from 'vxe-table'
import
EditArea
from
'../EditArea/EditArea.vue'
import
{
deleteExcelProdFileConfByIds
,
getExcelProdFileConfPage
}
from
'@/api/product'
const
pasteLoading
=
ref
(
false
);
const
connectVisible
=
ref
(
false
)
const
showProdCompare
=
ref
(
false
)
const
xTableConnect
=
ref
<
VxeTableInstance
>
()
...
...
@@ -258,7 +269,7 @@ const compareParams = reactive({
})
const
luckysheet
=
(
window
as
any
).
luckysheet
const
commentExcelStore
=
useCommentExcel
()
const
{
getFileInfo
}
=
storeToRefs
(
commentExcelStore
)
const
{
getFileInfo
,
isSameVarFile
}
=
storeToRefs
(
commentExcelStore
)
const
connectList
=
ref
<
any
[]
>
([])
const
chooseVisible
=
ref
(
false
)
const
editVisible
=
ref
(
false
)
...
...
@@ -742,6 +753,56 @@ const toDelete = async (row) => {
}
}
/**
* 复制
*/
const
copy
=
()
=>
{
if
(
areaList
.
value
?.
length
)
{
commentExcelStore
.
setCopyFileId
()
}
ElMessage
(
'该文件还未设置标注信息!'
)
}
/**
* 引入复制的配置
*/
const
pasteConfig
=
async
()
=>
{
// 是否是当前文件
if
(
isSameVarFile
.
value
)
{
return
ElMessage
(
'请在其他文件引入!'
)
}
pasteLoading
.
value
=
true
try
{
// 1、获取复制文件id
const
{
data
}
=
await
getExcelAreaByFileId
(
commentExcelStore
.
copyFileId
as
string
)
// 2、去除id
data
.
result
.
forEach
((
item
)
=>
{
item
.
fileId
=
commentExcelStore
.
fileInfo
.
varFileId
delete
item
.
varAreaId
})
// 3、自动保存
await
addExcelArea
(
data
.
result
)
// 4、刷新
ElMessage
({
type
:
'success'
,
message
:
'引入成功!重新加载...'
,
})
// 5、刷新当前页 or 刷新当前excel
setTimeout
(()
=>
{
window
.
location
.
reload
();
},
1500
);
}
catch
{
ElMessage
.
error
(
'引入失败!'
)
}
pasteLoading
.
value
=
false
}
onMounted
(()
=>
{
loadExcel
()
getCompareList
()
...
...
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