Commit daf149b9 by 刘泽志

机构字典功能

添加区域管理页面
parent 32d5b974
...@@ -60,13 +60,14 @@ export async function blobValidate(data) { ...@@ -60,13 +60,14 @@ export async function blobValidate(data) {
* 获取机构数据 * 获取机构数据
* @param name * @param name
* @param year * @param year
* @param type
* @returns {*} * @returns {*}
*/ */
export function queryArea(name,year) { export function queryArea(name,year,type = '0') {
return request({ return request({
url: `${prefix}/queryArea`, url: `${prefix}/queryArea`,
method: 'get', method: 'get',
params:{name,year} params:{name,year,type}
}) })
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<el-menu-item index="/emport">数据导入</el-menu-item> <el-menu-item index="/emport">数据导入</el-menu-item>
<el-menu-item index="/field">元字段管理</el-menu-item> <el-menu-item index="/field">元字段管理</el-menu-item>
<el-menu-item index="/rule">规则管理</el-menu-item> <el-menu-item index="/rule">规则管理</el-menu-item>
<el-menu-item index="/area">区域管理</el-menu-item>
<el-menu-item index="/datasource">数据源管理</el-menu-item> <el-menu-item index="/datasource">数据源管理</el-menu-item>
</el-menu> </el-menu>
<!--快捷功能操作区--> <!--快捷功能操作区-->
......
...@@ -60,6 +60,12 @@ export const constantRoutes = [ ...@@ -60,6 +60,12 @@ export const constantRoutes = [
name: 'Field', name: 'Field',
meta: { title: '字段管理', icon: '' } meta: { title: '字段管理', icon: '' }
}, },
{
path: 'area',
component: () => import('@/views/emport/area/index'),
name: 'Area',
meta: { title: '区域管理', icon: '' }
},
] ]
}, },
{ {
......
<template>
<div class="container">
<el-form inline label-width="80px">
<el-form-item label="字段名">
<el-input v-model="queryParam.fieldName" class="mr input" clearable placeholder="输入名称搜索"
size="small"
/>
</el-form-item>
<el-form-item label="字段类型">
<el-input v-model="queryParam.fieldType" class="mr input" clearable placeholder="输入名称搜索"
size="small"
/>
</el-form-item>
<el-form-item label="字段注释">
<el-input v-model="queryParam.fieldComment" class="mr input" clearable placeholder="输入名称搜索"
size="small"
/>
</el-form-item>
<el-form-item>
<el-button :loading="queryLoading" class="mr" icon="el-icon-search" size="mini" type="primary"
@click="clearPageToSearch"
>
查询
</el-button>
<el-button class="mr" size="mini" type="success" @click="addMetaFieldDialog">
新增
</el-button>
<el-button class="mr" size="mini" type="success" @click="errFieldCheck">
异常字段检测
</el-button>
</el-form-item>
</el-form>
<el-table v-loading="queryLoading" :data="metaFieldList" border max-height="500" stripe>
<el-table-column :show-overflow-tooltip="true" align="center" label="字段名" prop="fieldName" width="400"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="字段类型" prop="fieldType"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="字段注释" prop="fieldComment"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="备注" prop="remarks"/>
<el-table-column align="center" label="操作" show-overflow-tooltip width="150">
<template slot-scope="scope">
<el-button circle icon="el-icon-edit" plain size="small" type="primary"
@click.stop="editMetaFieldDialog(scope.row)"
></el-button>
<el-button circle icon="el-icon-delete" plain size="small" type="danger"
@click.stop="deleteMetaRule(scope.row)"
></el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="queryParam.total > 0" :limit.sync="queryParam.pageSize" :page.sync="queryParam.pageNum"
:total="queryParam.total" @pagination="queryMetaFieldList"
/>
<!--字段增改-->
<el-dialog :close-on-click-modal="false" :title="metaFieldDialog.title" :visible.sync="metaFieldDialog.show"
append-to-body width="400px"
>
<el-form ref="metaFieldForm" :model="metaFieldDialog.data" label-width="80px">
<el-form-item label="字段名" prop="fieldName" required>
<el-input v-model="metaFieldDialog.data.fieldName" maxlength="30" show-word-limit size="small" type="text"/>
</el-form-item>
<el-form-item label="字段类型" prop="fieldType" required>
<el-input v-model="metaFieldDialog.data.fieldType" placeholder="例如 VARCHAR2(64) ,NUMBER(8,1), DATE(7)等等" size="small"/>
<!-- <el-select v-model="metaFieldDialog.data.fieldType" size="small" style="width: 160px">
</el-select>-->
</el-form-item>
<el-form-item label="指标名称" prop="fieldComment" required>
<el-input v-model="metaFieldDialog.data.fieldComment" size="small"/>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="metaFieldDialog.data.remarks" placeholder="备注" type="textarea"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMetaField">确 定</el-button>
<el-button @click="metaFieldDialog.show = false">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import * as DataField from '@/api/emport/DataField'
export default {
name: 'Field',
data() {
return {
queryParam: {
pageNum: 1,
pageSize: 20,
total: 0,
fieldName: '',
fieldType: '',
fieldComment: ''
},
queryLoading: false,
metaFieldList: [],
metaFieldDialog: {
title: '',
show: false,
data: {}
}
}
},
created() {
this.queryMetaFieldList()
},
methods: {
// 查询元字段信息
queryMetaFieldList() {
this.queryLoading = true
DataField.queryMetaField({ ...this.queryParam }).then(res => {
if (res.code === 200) {
this.metaFieldList = res.rows
this.queryParam.total = res.total
}
}).finally(_ => this.queryLoading = false)
},
// 清除分页再查询
clearPageToSearch() {
this.queryParam.total = 0
this.queryParam.pageNum = 1
this.queryMetaFieldList()
},
// 异常字段检测
errFieldCheck(){
this.queryParam.total = 0
this.queryParam.pageNum = 1
this.queryLoading = true
DataField.queryMetaField({
total: 0,
pageNum: 1,
errorType: 'length'
}).then(res => {
if (res.code === 200) {
this.metaFieldList = res.rows
this.queryParam.total = res.total
}
}).finally(_ => this.queryLoading = false)
},
// 打开添加弹框
addMetaFieldDialog() {
this.metaFieldDialog.title = '新增字段'
this.metaFieldDialog.data = {}
this.metaFieldDialog.show = true
},
// 打开编辑弹框
editMetaFieldDialog(data) {
this.metaFieldDialog.title = '编辑字段'
this.metaFieldDialog.data = { ...data }
this.metaFieldDialog.show = true
},
// 删除字段
deleteMetaRule(data) {
this.$confirm(`是否删除字段 ${data.fieldName} ?`, '删除',
{
type: 'warning',
confirmButtonText: '确定',
cancelButtonText: '取消',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
DataField.deleteMetaField(data.id).then(res => {
done()
this.queryMetaFieldList()
})
} else {
done()
}
}
}
)
},
// 提交字段信息
submitMetaField() {
this.$refs.metaFieldForm.validate(validate => {
if (validate) {
if (this.metaFieldDialog.title === '新增字段') {
DataField.addMetaField(this.metaFieldDialog.data).then(res => {
this.metaFieldDialog.show = false
this.queryMetaFieldList()
})
} else {
DataField.updateMetaField(this.metaFieldDialog.data).then(res => {
this.metaFieldDialog.show = false
this.queryMetaFieldList()
})
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
.app-container {
box-shadow: none;
}
.header-operator {
display: flex;
flex-wrap: wrap;
align-items: center;
.mr {
margin-right: 8px;
margin-left: 0;
margin-bottom: 8px;
}
.input {
width: 250px;
}
}
</style>
...@@ -429,11 +429,20 @@ ...@@ -429,11 +429,20 @@
<el-dialog :visible.sync="orgDictDialog.show" append-to-body close-on-click-modal title="设置机构字典" <el-dialog :visible.sync="orgDictDialog.show" append-to-body close-on-click-modal title="设置机构字典"
width="80%" width="80%"
> >
<el-form size="small"> <el-form inline size="small">
<el-form-item> <el-form-item>
<el-button v-if="false" 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-button :loading="orgDictDialog.loading" icon="el-icon-plus" type="success" @click="exportExcel">导出</el-button>
</el-form-item> </el-form-item>
<el-form-item label="查询全部">
<el-switch
v-model="orgDictDialog.type"
active-color="#13ce66"
active-value="1"
inactive-value="0"
@change="typeChange">
</el-switch>
</el-form-item>
</el-form> </el-form>
<el-table v-loading="orgDictDialog.loading" :data="orgDictDialog.orgList" <el-table v-loading="orgDictDialog.loading" :data="orgDictDialog.orgList"
border height="500px" max-height="500px" stripe border height="500px" max-height="500px" stripe
...@@ -445,7 +454,7 @@ ...@@ -445,7 +454,7 @@
<el-table-column align="center" label="机构地址" prop="MAILING_ADDRESS" show-overflow-tooltip/> <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 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 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 :formatter="AREAFormatter" align="center" label="对应区名称" prop="AREA" show-overflow-tooltip/>
<el-table-column align="center" label="操作" width="80"> <el-table-column align="center" label="操作" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button circle icon="el-icon-edit" plain <el-button circle icon="el-icon-edit" plain
...@@ -634,7 +643,8 @@ export default { ...@@ -634,7 +643,8 @@ export default {
loading: false, loading: false,
show: false, show: false,
orgList: [], orgList: [],
areaDict: [] areaDict: [],
type: '0'
}, },
orgListDialog: { // 模板规则数据 orgListDialog: { // 模板规则数据
show: false, show: false,
...@@ -1321,10 +1331,10 @@ export default { ...@@ -1321,10 +1331,10 @@ export default {
// 清空数据 // 清空数据
clearTemp() { clearTemp() {
let template = this.templateList.find(item => item.orgName === this.queryForm.orgName) let template = this.templateList.find(item => item.orgName === this.queryForm.orgName)
if (!template || !this.queryForm.file || this.queryForm.file.status !== 'success') { /* if (!template || !this.queryForm.file || this.queryForm.file.status !== 'success') {
this.$message.warning('请先导入数据') this.$message.warning('请先导入数据')
return return
} } */
this.clearTempLoading = true this.clearTempLoading = true
DataImport.clearTemp(template).then(res => { DataImport.clearTemp(template).then(res => {
if (res.code === 200) { if (res.code === 200) {
...@@ -1336,10 +1346,10 @@ export default { ...@@ -1336,10 +1346,10 @@ export default {
// 一键导入正式库 // 一键导入正式库
syncDb() { syncDb() {
let template = this.templateList.find(item => item.orgName === this.queryForm.orgName) let template = this.templateList.find(item => item.orgName === this.queryForm.orgName)
if (!template || !this.queryForm.file || this.queryForm.file.status !== 'success') { /* if (!template || !this.queryForm.file || this.queryForm.file.status !== 'success') {
this.$message.warning('请先导入数据') this.$message.warning('请先导入数据')
return return
} } */
this.syncDbLoading = true this.syncDbLoading = true
DataImport.syncDb(template).then(res => { DataImport.syncDb(template).then(res => {
if (res.code === 200) { if (res.code === 200) {
...@@ -1466,6 +1476,7 @@ export default { ...@@ -1466,6 +1476,7 @@ export default {
//this.initOrgList() //this.initOrgList()
this.orgDictDialog.show = true this.orgDictDialog.show = true
this.orgDictDialog.loading = true this.orgDictDialog.loading = true
this.orgDictDialog.type = '0'
// 查询机构字典 // 查询机构字典
DictData.queryDict('area').then(res => { DictData.queryDict('area').then(res => {
this.orgDictDialog.areaDict = res.data.map(item=>{ this.orgDictDialog.areaDict = res.data.map(item=>{
...@@ -1474,7 +1485,7 @@ export default { ...@@ -1474,7 +1485,7 @@ export default {
suggestion: StringUtil.mergeStr(item.label,item.value) suggestion: StringUtil.mergeStr(item.label,item.value)
} }
}) })
ExcelData.queryArea(this.queryForm.orgName, this.queryForm.year).then(res => { ExcelData.queryArea(this.queryForm.orgName, this.queryForm.year,this.orgDictDialog.type).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.orgDictDialog.orgList = res.data.map(item => { this.orgDictDialog.orgList = res.data.map(item => {
if (item.AREA_NUMBER_CODE) { if (item.AREA_NUMBER_CODE) {
...@@ -1489,6 +1500,21 @@ export default { ...@@ -1489,6 +1500,21 @@ export default {
}).finally(_ => this.orgDictDialog.loading = false) }).finally(_ => this.orgDictDialog.loading = false)
}) })
}, },
typeChange(){
this.orgDictDialog.loading = true
ExcelData.queryArea(this.queryForm.orgName, this.queryForm.year,this.orgDictDialog.type).then(res => {
if (res.code === 200) {
this.orgDictDialog.orgList = res.data
}
}).finally(_ => this.orgDictDialog.loading = false)
},
AREAFormatter(row){
if (row.AREA_NUMBER_CODE){
let temp = this.orgDictDialog.areaDict.find(area => area.value === row.AREA_NUMBER_CODE)
return temp ? temp.label : ''
}
return ''
},
openAddOrgListDialog() { openAddOrgListDialog() {
this.orgListDialog.title = '新增机构' this.orgListDialog.title = '新增机构'
this.orgListDialog.data = {} this.orgListDialog.data = {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment