Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
emport-web
Overview
Overview
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
刘泽志
emport-web
Commits
bb8f553e
Commit
bb8f553e
authored
Feb 10, 2023
by
刘泽志
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
动态解析模板
parent
8ddee006
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
18 deletions
+61
-18
Emport.js
src/api/emport/Emport.js
+14
-0
AutoUpload.vue
src/views/emport/emport/AutoUpload.vue
+5
-1
index.vue
src/views/emport/emport/index.vue
+42
-17
No files found.
src/api/emport/Emport.js
View file @
bb8f553e
...
@@ -330,3 +330,17 @@ export function uploadExcel(data) {
...
@@ -330,3 +330,17 @@ export function uploadExcel(data) {
}
}
})
})
}
}
/**
* 根据基础模板重置字段
* @param excelId
* @returns {*}
*/
export
function
resetField
(
excelId
){
return
request
({
url
:
`
${
prefix
}
/field/reset`
,
method
:
'get'
,
params
:{
excelId
}
})
}
src/views/emport/emport/AutoUpload.vue
View file @
bb8f553e
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
</el-upload>
</el-upload>
</div>
</div>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"upload"
>
上传
</el-button>
<el-button
type=
"primary"
@
click=
"upload"
:loading=
"loading"
>
上传
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</div>
</el-dialog>
</el-dialog>
...
@@ -33,6 +33,10 @@ export default {
...
@@ -33,6 +33,10 @@ export default {
type
:
String
,
type
:
String
,
default
:
''
default
:
''
},
},
loading
:
{
type
:
Boolean
,
default
:
false
},
width
:
{
width
:
{
type
:
String
,
type
:
String
,
default
:
'400px'
default
:
'400px'
...
...
src/views/emport/emport/index.vue
View file @
bb8f553e
...
@@ -227,12 +227,15 @@
...
@@ -227,12 +227,15 @@
<el-input
v-model=
"fieldDrawer.queryForm.coordinate"
/>
<el-input
v-model=
"fieldDrawer.queryForm.coordinate"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
""
>
<el-form-item
label=
""
>
<el-button
:loading=
"fieldDrawer.queryFieldLoading"
icon=
"el-icon-search"
plain
type=
"primary"
<el-button
:loading=
"fieldDrawer.queryFieldLoading"
icon=
"el-icon-search"
type=
"primary"
@
click=
"queryFieldList"
@
click=
"queryFieldList"
>
查询
>
查询
</el-button>
</el-button>
<el-button
plain
type=
"primary"
@
click=
"openFieldDialog"
>
新增
</el-button>
<el-button
type=
"success"
@
click=
"openFieldDialog"
>
新增
</el-button>
<el-button
plain
type=
"primary"
@
click=
"openQuicklyBind"
>
快速绑定
</el-button>
<el-button
type=
"warning"
@
click=
"openQuicklyBind"
>
快速绑定
</el-button>
<el-button
type=
"warning"
@
click=
"resetField"
:loading=
"fieldDrawer.resetFieldLoading"
:disabled=
"!fieldDrawer.template.excelId"
>
模板初始化
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<el-table
v-loading=
"fieldDrawer.queryFieldLoading"
:data=
"fieldDrawer.fieldList"
<el-table
v-loading=
"fieldDrawer.queryFieldLoading"
:data=
"fieldDrawer.fieldList"
...
@@ -311,6 +314,7 @@
...
@@ -311,6 +314,7 @@
:open
.
sync=
"initTemplateDialog.show"
:open
.
sync=
"initTemplateDialog.show"
title=
"初始模板上传"
title=
"初始模板上传"
@
upload=
"initTemplateUpload"
@
upload=
"initTemplateUpload"
:loading=
"initTemplateDialog.loading"
/>
/>
</div>
</div>
</template>
</template>
...
@@ -319,10 +323,11 @@
...
@@ -319,10 +323,11 @@
import
*
as
Emport
from
'@/api/emport/Emport'
import
*
as
Emport
from
'@/api/emport/Emport'
import
StringUtil
from
'@/utils/document/StringUtil'
import
StringUtil
from
'@/utils/document/StringUtil'
import
AutoUpload
from
'@/views/emport/emport/AutoUpload.vue'
import
AutoUpload
from
'@/views/emport/emport/AutoUpload.vue'
import
{
resetField
}
from
"@/api/emport/Emport"
;
export
default
{
export
default
{
name
:
'Emport'
,
name
:
'Emport'
,
components
:
{
AutoUpload
},
components
:
{
AutoUpload
},
data
()
{
data
()
{
return
{
return
{
// 页面查询字段
// 页面查询字段
...
@@ -364,7 +369,7 @@ export default {
...
@@ -364,7 +369,7 @@ export default {
fieldId
:
null
fieldId
:
null
},
},
fieldDrawer
:
{
// 字段抽屉
fieldDrawer
:
{
// 字段抽屉
template
:
null
,
template
:
{}
,
show
:
false
,
show
:
false
,
fieldList
:
[],
fieldList
:
[],
queryForm
:
{
queryForm
:
{
...
@@ -377,7 +382,8 @@ export default {
...
@@ -377,7 +382,8 @@ export default {
pageSize
:
10
,
pageSize
:
10
,
total
:
0
total
:
0
},
},
queryFieldLoading
:
false
queryFieldLoading
:
false
,
resetFieldLoading
:
false
},
},
quicklyBindDialog
:
{
// 字段dialog
quicklyBindDialog
:
{
// 字段dialog
show
:
false
,
show
:
false
,
...
@@ -386,7 +392,8 @@ export default {
...
@@ -386,7 +392,8 @@ export default {
},
},
initTemplateDialog
:
{
initTemplateDialog
:
{
template
:
null
,
template
:
null
,
show
:
false
show
:
false
,
loading
:
false
},
},
importLoading
:
false
,
// 导入数据loading
importLoading
:
false
,
// 导入数据loading
queryTemplateLoading
:
false
,
// 模板查询loading
queryTemplateLoading
:
false
,
// 模板查询loading
...
@@ -395,6 +402,7 @@ export default {
...
@@ -395,6 +402,7 @@ export default {
}
}
},
},
created
()
{
created
()
{
this
.
queryTemplateLoading
=
true
this
.
initYearDict
(()
=>
{
this
.
initYearDict
(()
=>
{
let
now
=
new
Date
()
let
now
=
new
Date
()
this
.
queryForm
.
year
=
now
.
getFullYear
()
+
''
this
.
queryForm
.
year
=
now
.
getFullYear
()
+
''
...
@@ -508,7 +516,7 @@ export default {
...
@@ -508,7 +516,7 @@ export default {
// 打开年份字典编辑框
// 打开年份字典编辑框
editYearDialog
(
data
)
{
editYearDialog
(
data
)
{
this
.
yearDialog
.
title
=
'编辑年份'
this
.
yearDialog
.
title
=
'编辑年份'
this
.
yearDialog
.
data
=
{
...
data
}
this
.
yearDialog
.
data
=
{
...
data
}
this
.
yearDialog
.
show
=
true
this
.
yearDialog
.
show
=
true
},
},
// 提交年份dialog
// 提交年份dialog
...
@@ -532,7 +540,7 @@ export default {
...
@@ -532,7 +540,7 @@ export default {
})
})
},
},
// 删除年份字典
// 删除年份字典
deleteYear
({
id
,
label
})
{
deleteYear
({
id
,
label
})
{
this
.
$confirm
(
`是否删除数据项
${
label
}
?`
,
'删除'
,
this
.
$confirm
(
`是否删除数据项
${
label
}
?`
,
'删除'
,
{
{
type
:
'warning'
,
type
:
'warning'
,
...
@@ -554,13 +562,13 @@ export default {
...
@@ -554,13 +562,13 @@ export default {
// 打开机构类型字典新增框
// 打开机构类型字典新增框
openOrgDialog
()
{
openOrgDialog
()
{
this
.
orgDialog
.
title
=
'新增机构类型'
this
.
orgDialog
.
title
=
'新增机构类型'
this
.
orgDialog
.
data
=
{
type
:
'org'
,
value
:
''
}
this
.
orgDialog
.
data
=
{
type
:
'org'
,
value
:
''
}
this
.
orgDialog
.
show
=
true
this
.
orgDialog
.
show
=
true
},
},
// 打开机构类型字典编辑框
// 打开机构类型字典编辑框
editOrgDialog
(
data
)
{
editOrgDialog
(
data
)
{
this
.
orgDialog
.
title
=
'编辑机构类型'
this
.
orgDialog
.
title
=
'编辑机构类型'
this
.
orgDialog
.
data
=
{
...
data
}
this
.
orgDialog
.
data
=
{
...
data
}
this
.
orgDialog
.
show
=
true
this
.
orgDialog
.
show
=
true
},
},
// 提交机构类型dialog
// 提交机构类型dialog
...
@@ -590,7 +598,7 @@ export default {
...
@@ -590,7 +598,7 @@ export default {
})
})
},
},
// 删除机构类型字典
// 删除机构类型字典
deleteOrg
({
id
,
label
})
{
deleteOrg
({
id
,
label
})
{
this
.
$confirm
(
`是否删除数据项
${
label
}
?`
,
'删除'
,
this
.
$confirm
(
`是否删除数据项
${
label
}
?`
,
'删除'
,
{
{
type
:
'warning'
,
type
:
'warning'
,
...
@@ -626,7 +634,7 @@ export default {
...
@@ -626,7 +634,7 @@ export default {
this
.
queryForm
.
file
=
fileList
[
0
]
this
.
queryForm
.
file
=
fileList
[
0
]
},
},
// 文件上传方法
// 文件上传方法
fileUpload
({
file
,
onError
,
onProgress
,
onSuccess
})
{
fileUpload
({
file
,
onError
,
onProgress
,
onSuccess
})
{
this
.
importLoading
=
true
this
.
importLoading
=
true
let
formData
=
new
FormData
()
let
formData
=
new
FormData
()
formData
.
append
(
'file'
,
file
)
formData
.
append
(
'file'
,
file
)
...
@@ -702,7 +710,7 @@ export default {
...
@@ -702,7 +710,7 @@ export default {
// 打开模板编辑框
// 打开模板编辑框
editTemplateDialog
(
row
)
{
editTemplateDialog
(
row
)
{
this
.
templateDialog
.
title
=
'编辑模板'
this
.
templateDialog
.
title
=
'编辑模板'
this
.
templateDialog
.
data
=
{
...
row
}
this
.
templateDialog
.
data
=
{
...
row
}
this
.
templateDialog
.
show
=
true
this
.
templateDialog
.
show
=
true
},
},
// 删除模板
// 删除模板
...
@@ -747,7 +755,7 @@ export default {
...
@@ -747,7 +755,7 @@ export default {
},
},
// 打开字段抽屉
// 打开字段抽屉
openFieldDrawer
(
row
)
{
openFieldDrawer
(
row
)
{
this
.
fieldDrawer
.
template
=
{
...
row
}
this
.
fieldDrawer
.
template
=
{
...
row
}
this
.
fieldDrawer
.
queryForm
=
{
this
.
fieldDrawer
.
queryForm
=
{
templateId
:
row
.
id
,
templateId
:
row
.
id
,
code
:
''
,
code
:
''
,
...
@@ -783,7 +791,7 @@ export default {
...
@@ -783,7 +791,7 @@ export default {
// 打开修改字段的dialog
// 打开修改字段的dialog
editFieldDialog
(
row
)
{
editFieldDialog
(
row
)
{
this
.
fieldDialog
.
title
=
'修改字段'
this
.
fieldDialog
.
title
=
'修改字段'
this
.
fieldDialog
.
data
=
{
...
row
}
this
.
fieldDialog
.
data
=
{
...
row
}
this
.
fieldDialog
.
show
=
true
this
.
fieldDialog
.
show
=
true
},
},
// 删除字段
// 删除字段
...
@@ -864,13 +872,14 @@ export default {
...
@@ -864,13 +872,14 @@ export default {
this
.
initTemplateDialog
.
show
=
true
this
.
initTemplateDialog
.
show
=
true
},
},
// 初始化模板上上传方法
// 初始化模板上上传方法
initTemplateUpload
({
file
,
onSuccess
})
{
initTemplateUpload
({
file
,
onSuccess
})
{
let
formData
=
new
FormData
()
let
formData
=
new
FormData
()
formData
.
append
(
'file'
,
file
)
formData
.
append
(
'file'
,
file
)
formData
.
append
(
'type'
,
'2'
)
formData
.
append
(
'type'
,
'2'
)
formData
.
append
(
'templateId'
,
this
.
initTemplateDialog
.
template
.
id
)
formData
.
append
(
'templateId'
,
this
.
initTemplateDialog
.
template
.
id
)
formData
.
append
(
'year'
,
this
.
initTemplateDialog
.
template
.
year
)
formData
.
append
(
'year'
,
this
.
initTemplateDialog
.
template
.
year
)
formData
.
append
(
'orgName'
,
this
.
initTemplateDialog
.
template
.
orgName
)
formData
.
append
(
'orgName'
,
this
.
initTemplateDialog
.
template
.
orgName
)
this
.
initTemplateDialog
.
loading
=
true
Emport
.
uploadExcel
(
formData
).
then
(
res
=>
{
Emport
.
uploadExcel
(
formData
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
if
(
res
.
code
===
200
)
{
onSuccess
()
onSuccess
()
...
@@ -878,6 +887,22 @@ export default {
...
@@ -878,6 +887,22 @@ export default {
this
.
initTemplateDialog
.
show
=
false
this
.
initTemplateDialog
.
show
=
false
this
.
initTemplate
()
this
.
initTemplate
()
}
}
}).
finally
(
_
=>
this
.
initTemplateDialog
.
loading
=
false
)
},
// 重置字段信息
resetField
()
{
this
.
$confirm
(
'此操作将覆盖原来设置的字段信息重新生成, 是否继续?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
this
.
fieldDrawer
.
resetFieldLoading
=
true
Emport
.
resetField
(
this
.
fieldDrawer
.
template
.
excelId
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
this
.
$message
.
success
(
"字段初始化成功"
)
this
.
queryFieldList
()
}
}).
finally
(
_
=>
this
.
fieldDrawer
.
resetFieldLoading
=
false
)
})
})
}
}
}
}
...
...
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