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
476e5fd5
Commit
476e5fd5
authored
Feb 21, 2023
by
刘泽志
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
最终版本
parent
4062c2ef
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
199 additions
and
49 deletions
+199
-49
DataField.js
src/api/emport/DataField.js
+25
-0
ExcelData.js
src/api/emport/ExcelData.js
+33
-4
index.vue
src/views/emport/emport/index.vue
+141
-45
No files found.
src/api/emport/DataField.js
View file @
476e5fd5
...
...
@@ -132,3 +132,28 @@ export function getMetaFieldDict() {
method
:
'get'
,
})
}
/**
* 字段同步查询
* @returns {*}
*/
export
function
querySyncField
(
templateId
)
{
return
request
({
url
:
`
${
prefix
}
/querySyncField`
,
method
:
'get'
,
params
:{
templateId
}
})
}
/**
* 字段同步
* @returns {*}
*/
export
function
syncField
(
data
)
{
return
request
({
url
:
`
${
prefix
}
/syncField`
,
method
:
'post'
,
data
})
}
src/api/emport/ExcelData.js
View file @
476e5fd5
import
request
from
"@/utils/request"
;
import
request
from
'@/utils/request'
const
prefix
=
'/data/excel'
...
...
@@ -58,14 +58,43 @@ export async function blobValidate(data) {
/**
* 获取机构数据
* @param
orgN
ame
* @param
n
ame
* @param year
* @returns {*}
*/
export
function
queryArea
(
orgN
ame
,
year
)
{
export
function
queryArea
(
n
ame
,
year
)
{
return
request
({
url
:
`
${
prefix
}
/queryArea`
,
method
:
'get'
,
params
:{
orgName
,
year
}
params
:{
name
,
year
}
})
}
/**
* 更新机构数据
* @param data
* @returns {*}
*/
export
function
updateArea
(
data
){
return
request
({
url
:
`
${
prefix
}
/updateArea`
,
method
:
'post'
,
data
})
}
/**
* 导出修改后的excel
* @param name
* @param year
* @returns {*}
*/
export
function
exportExcel
(
name
,
year
)
{
return
request
({
url
:
`
${
prefix
}
/export`
,
method
:
'get'
,
params
:{
name
,
year
},
headers
:
{
"Content-Type"
:
"application/x-www-form-urlencoded"
},
responseType
:
"blob"
,
})
}
src/views/emport/emport/index.vue
View file @
476e5fd5
...
...
@@ -116,7 +116,8 @@
<el-date-picker
format=
"yyyy"
value-format=
"yyyy"
v-model=
"yearDialog.data.value"
type=
"year"
>
type=
"year"
>
</el-date-picker>
</el-form-item>
</el-form>
...
...
@@ -212,10 +213,11 @@
</el-form-item>
<el-form-item
label=
"数据库字段"
prop=
"field"
>
<el-select
v-model=
"fieldDialog.data.field"
:popper-append-to-body=
"false"
filterable
clearable
>
<el-option
v-for=
"item in metaFieldDict"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
<el-option
v-for=
"item in metaFieldDict"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
></el-option>
</el-select>
<!-- <el-autocomplete v-model="fieldDialog.data.field" :fetch-suggestions="fetchSuggestions">
<!-- <el-autocomplete v-model="fieldDialog.data.field" :fetch-suggestions="fetchSuggestions">
</el-autocomplete>-->
</el-form-item>
</el-form>
...
...
@@ -250,10 +252,15 @@
</el-button>
<el-button
type=
"success"
@
click=
"openFieldDialog"
>
新增
</el-button>
<el-button
type=
"warning"
@
click=
"openQuicklyBind"
>
快速绑定
</el-button>
<el-button
type=
"warning"
@
click=
"openSwitchYear('template')"
:disabled=
"!fieldDrawer.template.excelId"
>
模板初始化
</el-button>
<el-button
:disabled=
"!fieldDrawer.template.excelId"
type=
"warning"
@
click=
"openSwitchYear('template')"
>
模板初始化
</el-button>
<el-button
type=
"warning"
@
click=
"openSwitchYear('rule')"
>
规则同步
</el-button>
<el-button
type=
"info"
@
click=
"createTable"
>
物理表生成
</el-button>
<el-button
type=
"info"
@
click=
"querySyncField"
>
字段同步
</el-button>
</el-form-item>
</el-form>
<el-table
v-loading=
"fieldDrawer.queryFieldLoading"
:data=
"fieldDrawer.fieldList"
...
...
@@ -262,7 +269,9 @@
<el-table-column
align=
"center"
label=
"代码"
prop=
"code"
show-overflow-tooltip
width=
"120"
/>
<el-table-column
align=
"center"
label=
"指标名称"
min-width=
"200"
prop=
"title"
show-overflow-tooltip
/>
<el-table-column
align=
"center"
label=
"数据坐标"
prop=
"coordinate"
show-overflow-tooltip
width=
"100"
/>
<el-table-column
align=
"center"
label=
"数据库字段名"
min-width=
"150"
prop=
"fieldName"
show-overflow-tooltip
/>
<el-table-column
align=
"center"
label=
"数据库字段名"
min-width=
"150"
prop=
"fieldName"
show-overflow-tooltip
/>
<el-table-column
align=
"center"
label=
"计量单位"
prop=
"unit"
show-overflow-tooltip
width=
"90"
/>
<el-table-column
align=
"center"
label=
"操作"
width=
"150"
>
<
template
slot-scope=
"scope"
>
...
...
@@ -356,7 +365,8 @@
<el-table-column
align=
"center"
label=
"规则名称"
prop=
"name"
show-overflow-tooltip
width=
"180"
/>
<el-table-column
align=
"center"
label=
"验证模式"
prop=
"mode"
show-overflow-tooltip
width=
"120"
/>
<el-table-column
:formatter=
"contentFormat"
align=
"center"
label=
"验证内容"
min-width=
"200"
prop=
"content"
<el-table-column
:formatter=
"contentFormat"
align=
"center"
label=
"验证内容"
min-width=
"200"
prop=
"content"
show-overflow-tooltip
/>
<el-table-column
align=
"center"
label=
"操作"
width=
"120"
>
...
...
@@ -406,7 +416,8 @@
>
<el-form
size=
"small"
>
<el-form-item>
<el-button
icon=
"el-icon-plus"
type=
"success"
@
click=
"openAddOrgListDialog"
>
添加
</el-button>
<el-button
v-if=
"false"
icon=
"el-icon-plus"
type=
"success"
@
click=
"openAddOrgListDialog"
>
添加
</el-button>
<el-button
:loading=
"orgDictDialog.loading"
icon=
"el-icon-plus"
type=
"success"
@
click=
"exportExcel"
>
导出
</el-button>
</el-form-item>
</el-form>
<el-table
v-loading=
"orgDictDialog.loading"
:data=
"orgDictDialog.orgList"
...
...
@@ -419,15 +430,12 @@
<el-table-column
align=
"center"
label=
"机构地址"
prop=
"MAILING_ADDRESS"
show-overflow-tooltip
/>
<el-table-column
align=
"center"
label=
"行政区划代码"
prop=
"AREA_NUMBER_CODE"
show-overflow-tooltip
/>
<el-table-column
v-if=
"false"
align=
"center"
label=
"所属市"
prop=
"CITY"
show-overflow-tooltip
/>
<el-table-column
align=
"center"
label=
"所属区
"
prop=
"AREA"
show-overflow-tooltip
/>
<el-table-column
align=
"center"
label=
"操作"
width=
"
12
0"
>
<el-table-column
align=
"center"
label=
"对应区名称
"
prop=
"AREA"
show-overflow-tooltip
/>
<el-table-column
align=
"center"
label=
"操作"
width=
"
8
0"
>
<
template
slot-scope=
"scope"
>
<el-button
circle
icon=
"el-icon-edit"
plain
size=
"small"
type=
"primary"
@
click
.
stop=
"openUpdateOrgListDialog(scope.row)"
></el-button>
<el-button
circle
icon=
"el-icon-delete"
plain
size=
"small"
type=
"danger"
@
click
.
stop=
"deleteOrgList(scope.row)"
></el-button>
</
template
>
</el-table-column>
</el-table>
...
...
@@ -437,26 +445,20 @@
append-to-body
width=
"500px"
>
<el-form
ref=
"orgListForm"
:model=
"orgListDialog.data"
label-width=
"100px"
>
<el-form-item
label=
"标识"
prop=
"value"
required
>
<el-input
v-model=
"orgListDialog.data.value"
size=
"small"
/>
</el-form-item>
<el-form-item
label=
"机构类型"
prop=
"orgType"
required
>
<el-input
v-model=
"orgListDialog.data.orgType"
size=
"small"
/>
</el-form-item>
<el-form-item
label=
"机构名称"
prop=
"label"
required
>
<el-input
v-model=
"orgListDialog.data.label"
size=
"small"
/>
<el-form-item
label=
"标识"
prop=
"ROWCODE"
required
>
<el-input
v-model=
"orgListDialog.data.ROWCODE"
disabled
size=
"small"
/>
</el-form-item>
<el-form-item
label=
"机构
地址"
prop=
"address
"
>
<el-input
v-model=
"orgListDialog.data.
address"
size=
"small"
/>
<el-form-item
label=
"机构
类型"
prop=
"ORG_TYPE
"
>
<el-input
v-model=
"orgListDialog.data.
ORG_TYPE"
disabled
size=
"small"
/>
</el-form-item>
<el-form-item
label=
"
行政区划代码"
prop=
"unifiedCode"
>
<el-input
v-model=
"orgListDialog.data.
unifiedCode
"
size=
"small"
/>
<el-form-item
label=
"
机构名称"
prop=
"ORG_NAME"
required
>
<el-input
v-model=
"orgListDialog.data.
ORG_NAME
"
size=
"small"
/>
</el-form-item>
<el-form-item
label=
"
所属市"
prop=
"city
"
>
<el-input
v-model=
"orgListDialog.data.
city"
size=
"small
"
/>
<el-form-item
label=
"
机构地址"
prop=
"MAILING_ADDRESS
"
>
<el-input
v-model=
"orgListDialog.data.
MAILING_ADDRESS"
autosize
size=
"small"
type=
"textarea
"
/>
</el-form-item>
<el-form-item
label=
"
所属区"
prop=
"region
"
>
<el-input
v-model=
"orgListDialog.data.
region
"
size=
"small"
/>
<el-form-item
label=
"
行政区划代码"
prop=
"AREA_NUMBER_CODE
"
>
<el-input
v-model=
"orgListDialog.data.
AREA_NUMBER_CODE
"
size=
"small"
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
...
@@ -468,13 +470,32 @@
<el-dialog
title=
"请选择同步年份"
:visible
.
sync=
"otherYearDialog.show"
append-to-body
width=
"300px"
v-loading=
"otherYearDialog.loading"
>
<el-select
v-model=
"otherYearDialog.year"
>
<el-select
v-model=
"otherYearDialog.year"
>
<el-option
v-for=
"item in otherYearDialog.list"
:key=
"item"
:value=
"item"
:label=
"item"
></el-option>
</el-select>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitOtherYear"
>
确 定
</el-button>
</div>
</el-dialog>
<!-- 字段同步 -->
<el-dialog
:visible
.
sync=
"syncFieldDialog.show"
append-to-body
close-on-click-modal
title=
"字段同步"
width=
"80%"
>
<el-form
size=
"small"
>
<el-form-item>
<el-button
:loading=
"syncFieldDialog.loading"
icon=
"el-icon-plus"
type=
"success"
@
click=
"syncField"
>
同步新增数据库字段
</el-button>
</el-form-item>
</el-form>
<el-table
v-loading=
"syncFieldDialog.loading"
:data=
"syncFieldDialog.list"
border
height=
"500px"
max-height=
"500px"
stripe
@
selection-change=
"handleSelectionChange"
>
<el-table-column
align=
"center"
type=
"selection"
width=
"50"
/>
<el-table-column
align=
"center"
label=
"代码"
prop=
"code"
show-overflow-tooltip
/>
<el-table-column
align=
"center"
label=
"指标名称"
prop=
"title"
show-overflow-tooltip
/>
<el-table-column
align=
"center"
label=
"字段名称"
prop=
"fieldName"
show-overflow-tooltip
/>
<el-table-column
align=
"center"
label=
"字段类型"
prop=
"fieldType"
show-overflow-tooltip
/>
</el-table>
</el-dialog>
</div>
</template>
...
...
@@ -507,7 +528,7 @@ export default {
dataSourceList
:
[],
// 数据源列表
tableList
:
[],
// 表列表
fieldDict
:
[],
// 字段字典
metaFieldDict
:[],
// 元字段字典
metaFieldDict
:
[],
// 元字段字典
yearDialog
:
{
// 年份dialog
title
:
''
,
show
:
false
,
...
...
@@ -570,7 +591,8 @@ export default {
orgDictDialog
:
{
// 机构字典弹出框
loading
:
false
,
show
:
false
,
orgList
:
[]
orgList
:
[],
areaDict
:
[]
},
orgListDialog
:
{
// 模板规则数据
show
:
false
,
...
...
@@ -584,13 +606,19 @@ export default {
title
:
''
,
data
:
{}
},
otherYearDialog
:{
// 模板重置选择年份数据
otherYearDialog
:
{
// 模板重置选择年份数据
year
:
''
,
show
:
false
,
loading
:
false
,
list
:[],
list
:
[],
type
:
''
},
syncFieldDialog
:{
// 字段同步
show
:
false
,
loading
:
false
,
list
:
[],
checked
:[]
},
importLoading
:
false
,
// 导入数据loading
queryTemplateLoading
:
false
,
// 模板查询loading
queryTableLoading
:
false
,
// 查询数据表loading
...
...
@@ -664,12 +692,12 @@ export default {
})
},
// 初始化元字段字典
initMetaFieldDict
(){
DataField
.
getMetaFieldDict
().
then
(
res
=>
{
this
.
metaFieldDict
=
res
.
data
.
map
(
item
=>
{
initMetaFieldDict
()
{
DataField
.
getMetaFieldDict
().
then
(
res
=>
{
this
.
metaFieldDict
=
res
.
data
.
map
(
item
=>
{
return
{
value
:
item
.
id
,
label
:
StringUtil
.
mergeStr
(
item
.
fieldName
,
item
.
fieldComment
)
label
:
StringUtil
.
mergeStr
(
item
.
fieldName
,
item
.
fieldComment
)
}
})
})
...
...
@@ -1123,18 +1151,18 @@ export default {
}).
finally
(
_
=>
this
.
initTemplateDialog
.
loading
=
false
)
},
// 打开年份选择框
openSwitchYear
(
type
){
openSwitchYear
(
type
)
{
this
.
otherYearDialog
.
show
=
true
this
.
otherYearDialog
.
type
=
type
this
.
otherYearDialog
.
year
=
null
DataTemplate
.
queryOtherYears
(
this
.
fieldDrawer
.
template
)
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
otherYearDialog
.
list
=
res
.
data
})
},
// 提交同步年份信息
submitOtherYear
()
{
if
(
this
.
otherYearDialog
.
type
===
'template'
){
if
(
this
.
otherYearDialog
.
type
===
'template'
)
{
this
.
otherYearDialog
.
loading
=
true
DataField
.
resetField
(
this
.
fieldDrawer
.
template
.
excelId
,
this
.
otherYearDialog
.
year
).
then
(
res
=>
{
...
...
@@ -1144,8 +1172,8 @@ export default {
this
.
queryFieldList
()
}
}).
finally
(
_
=>
this
.
otherYearDialog
.
loading
=
false
)
}
else
{
if
(
this
.
otherYearDialog
.
year
){
}
else
{
if
(
this
.
otherYearDialog
.
year
)
{
this
.
otherYearDialog
.
loading
=
true
DataRule
.
syncRuleByYear
(
this
.
fieldDrawer
.
template
.
id
,
this
.
otherYearDialog
.
year
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
...
...
@@ -1370,11 +1398,23 @@ export default {
//this.initOrgList()
this
.
orgDictDialog
.
show
=
true
this
.
orgDictDialog
.
loading
=
true
ExcelData
.
queryArea
(
this
.
queryForm
.
orgName
,
this
.
queryForm
.
year
).
then
(
res
=>
{
// 查询机构字典
DictData
.
queryDict
(
'area'
).
then
(
res
=>
{
this
.
orgDictDialog
.
areaDict
=
res
.
data
ExcelData
.
queryArea
(
this
.
queryForm
.
orgName
,
this
.
queryForm
.
year
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
this
.
orgDictDialog
.
orgList
=
res
.
data
this
.
orgDictDialog
.
orgList
=
res
.
data
.
map
(
item
=>
{
if
(
item
.
AREA_NUMBER_CODE
)
{
let
temp
=
this
.
orgDictDialog
.
areaDict
.
find
(
area
=>
area
.
value
===
item
.
AREA_NUMBER_CODE
)
if
(
temp
)
{
item
.
AREA
=
temp
.
label
}
}
return
item
})
}
}).
finally
(
_
=>
this
.
orgDictDialog
.
loading
=
false
)
})
},
openAddOrgListDialog
()
{
this
.
orgListDialog
.
title
=
'新增机构'
...
...
@@ -1413,7 +1453,7 @@ export default {
submitOrgList
()
{
this
.
$refs
.
orgListForm
.
validate
(
valid
=>
{
if
(
valid
)
{
let
data
=
{
/*
let data = {
id: this.orgListDialog.data.id,
type: 'orgList',
label: this.orgListDialog.data.label,
...
...
@@ -1438,10 +1478,66 @@ export default {
this.orgListDialog.show = false
this.initOrgList()
})
} */
ExcelData
.
updateArea
({
...
this
.
orgListDialog
.
data
,
name
:
this
.
queryForm
.
orgName
,
year
:
this
.
queryForm
.
year
})
.
then
(
res
=>
{
this
.
orgListDialog
.
show
=
false
this
.
orgDictDialog
.
loading
=
true
// 查询机构字典
ExcelData
.
queryArea
(
this
.
queryForm
.
orgName
,
this
.
queryForm
.
year
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
this
.
orgDictDialog
.
orgList
=
res
.
data
.
map
(
item
=>
{
if
(
item
.
AREA_NUMBER_CODE
)
{
let
temp
=
this
.
orgDictDialog
.
areaDict
.
find
(
area
=>
area
.
value
===
item
.
AREA_NUMBER_CODE
)
if
(
temp
)
{
item
.
AREA
=
temp
.
label
}
}
return
item
})
}
}).
finally
(
_
=>
this
.
orgDictDialog
.
loading
=
false
)
})
}
})
},
// 导出修改后的excel
exportExcel
(){
this
.
orgDictDialog
.
loading
=
true
ExcelData
.
exportExcel
(
this
.
queryForm
.
orgName
,
this
.
queryForm
.
year
).
then
(
async
res
=>
{
const
isFile
=
await
ExcelData
.
blobValidate
(
res
)
if
(
isFile
)
{
saveAs
(
res
,
this
.
queryForm
.
orgName
+
this
.
queryForm
.
year
+
"年.xlsx"
)
}
}).
finally
(
_
=>
this
.
orgDictDialog
.
loading
=
false
)
},
// 字段同步
querySyncField
(){
this
.
syncFieldDialog
.
show
=
true
this
.
syncFieldDialog
.
loading
=
true
this
.
syncFieldDialog
.
checked
=
[]
DataField
.
querySyncField
(
this
.
fieldDrawer
.
template
.
id
).
then
(
res
=>
{
this
.
syncFieldDialog
.
list
=
res
.
data
}).
finally
(
_
=>
this
.
syncFieldDialog
.
loading
=
false
)
},
syncField
(){
if
(
this
.
syncFieldDialog
.
checked
&&
this
.
syncFieldDialog
.
checked
.
length
>
0
){
this
.
syncFieldDialog
.
loading
=
true
DataField
.
syncField
(
this
.
syncFieldDialog
.
checked
).
then
(
res
=>
{
if
(
res
.
code
===
200
){
this
.
$message
.
success
(
"新增字段成功"
)
this
.
syncFieldDialog
.
show
=
false
}
}).
finally
(
_
=>
this
.
syncFieldDialog
.
loading
=
false
)
}
},
handleSelectionChange
(
val
){
this
.
syncFieldDialog
.
checked
=
val
},
}
}
</
script
>
...
...
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