eff44138 by xukangle

update:修改元数据采集任务

1 parent d41c7c0b
...@@ -196,6 +196,11 @@ export const getDatabase = (params) => request({ ...@@ -196,6 +196,11 @@ export const getDatabase = (params) => request({
196 method: 'post', 196 method: 'post',
197 data: params 197 data: params
198 }) 198 })
199 // 检验是否存在导入数据源
200 export const checkDataSource = (params) => request({
201 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/meta-collect-task/check-exist-import-database?databaseNameEn=${params.databaseNameEn}`,
202 method: 'get',
203 })
199 204
200 /** 源数据分析报告 */ 205 /** 源数据分析报告 */
201 /**查询列表 */ 206 /**查询列表 */
......
...@@ -14,9 +14,10 @@ import { ...@@ -14,9 +14,10 @@ import {
14 checkMetaDataTask, 14 checkMetaDataTask,
15 executeMetaDataTask, 15 executeMetaDataTask,
16 getDatabase, 16 getDatabase,
17 checkDatabaseIsExist 17 checkDatabaseIsExist,
18 checkDataSource
18 } from '@/api/modules/dataMetaService'; 19 } from '@/api/modules/dataMetaService';
19 import { 20 import {
20 getCronExecTime 21 getCronExecTime
21 } from '@/api/modules/queryService'; 22 } from '@/api/modules/queryService';
22 import { TableColumnWidth } from '@/utils/enum'; 23 import { TableColumnWidth } from '@/utils/enum';
...@@ -79,12 +80,12 @@ const page = ref({ ...@@ -79,12 +80,12 @@ const page = ref({
79 80
80 const tableInfo = ref({ 81 const tableInfo = ref({
81 id: 'data-source-table', 82 id: 'data-source-table',
82 // multiple:true, 83 // multiple:true,
83 fields: [ 84 fields: [
84 { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" }, 85 { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
85 { label: "采集任务名称", field: "collectTaskName", width: 140 }, 86 { label: "采集任务名称", field: "collectTaskName", width: 140 },
86 { label: "元模型", field: "metadataModelChName", width: 140 }, 87 { label: "元模型", field: "metadataModelChName", width: 140 },
87 { label: "数据源名称", field: "datasourceName", width: 160,type: 'text_btn', value: 'datasourceName',columClass:"text_btn" }, 88 { label: "数据源名称", field: "datasourceName", width: 160, type: 'text_btn', value: 'datasourceName', columClass: "text_btn" },
88 { label: '任务状态', field: 'taskState', type: 'switch', activeText: '上线', inactiveText: '下线', activeValue: 1, inactiveValue: 0, switchWidth: 56, width: 100, align: 'center' }, 89 { label: '任务状态', field: 'taskState', type: 'switch', activeText: '上线', inactiveText: '下线', activeValue: 1, inactiveValue: 0, switchWidth: 56, width: 100, align: 'center' },
89 { label: "执行计划", field: "collectType", type: 'filter', width: 90 }, 90 { label: "执行计划", field: "collectType", type: 'filter', width: 90 },
90 { label: "同步策略", field: "collectMode", type: 'filter', width: 90 }, 91 { label: "同步策略", field: "collectMode", type: 'filter', width: 90 },
...@@ -126,17 +127,17 @@ const tableInfo = ref({ ...@@ -126,17 +127,17 @@ const tableInfo = ref({
126 const collectType = ref(1) 127 const collectType = ref(1)
127 128
128 const formItems: any = ref([ 129 const formItems: any = ref([
129 { 130 {
130 label: '元模型', 131 label: '元模型',
131 type: 'select', 132 type: 'select',
132 placeholder: '请选择', 133 placeholder: '请选择',
133 field: 'metadataModel', 134 field: 'metadataModel',
134 default: '1', 135 default: '1',
135 options:[ 136 options: [
136 { label:"数据库表", value:'1' }, 137 { label: "数据库表", value: '1' },
137 // {label:"BI报表",value:2,}, 138 // {label:"BI报表",value:2,},
138 // {label:"数据服务",value:3,}, 139 // {label:"数据服务",value:3,},
139 { label:"ETL工具",value:'4' }, 140 { label: "ETL工具", value: '4' },
140 // {label:"数据处理",value:5,} 141 // {label:"数据处理",value:5,}
141 ], 142 ],
142 clearable: true, 143 clearable: true,
...@@ -425,25 +426,25 @@ const tableBtnClick = (scope, btn) => { ...@@ -425,25 +426,25 @@ const tableBtnClick = (scope, btn) => {
425 } 426 }
426 }); 427 });
427 }) 428 })
428 } else if(type=="datasourceName"){ 429 } else if (type == "datasourceName") {
429 if (row.metadataModel == '4') { 430 if (row.metadataModel == '4') {
430 proxy.$ElMessage.warning("元模型为ETL工具的采集任务无元数据详情!") 431 proxy.$ElMessage.warning("元模型为ETL工具的采集任务无元数据详情!")
431 return; 432 return;
432 } 433 }
433 checkDatabaseIsExist(row.dataSourceGuid).then((res:any)=>{ 434 checkDatabaseIsExist(row.dataSourceGuid).then((res: any) => {
434 if(res.code===proxy.$passCode){ 435 if (res.code === proxy.$passCode) {
435 if(res.data){ 436 if (res.data) {
436 router.push({ 437 router.push({
437 name:"metadataQuery", 438 name: "metadataQuery",
438 query:{ 439 query: {
439 dataSourceGuid:row.dataSourceGuid, 440 dataSourceGuid: row.dataSourceGuid,
440 datasourceName:row.datasourceName, 441 datasourceName: row.datasourceName,
441 } 442 }
442 }) 443 })
443 } else { 444 } else {
444 proxy.$ElMessage.warning("该任务暂未执行成功过!") 445 proxy.$ElMessage.warning("该任务暂未执行成功过!")
445 }
446 } 446 }
447 }
447 }) 448 })
448 } 449 }
449 }; 450 };
...@@ -498,6 +499,35 @@ const scheduleChange = (val, rowValue) => { ...@@ -498,6 +499,35 @@ const scheduleChange = (val, rowValue) => {
498 formInfo.value.formInfo.items = formItems.value 499 formInfo.value.formInfo.items = formItems.value
499 } 500 }
500 501
502 const databaseNameEn = ref<any>('')
503 const selectChange = (val, row, info) => {
504 // dataSourceList.value
505 console.log(val, row, info)
506
507 let data: any = dataSourceList.value.find((item: any) => item.guid == val)
508 if (data) {
509 databaseNameEn.value = data.databaseNameEn
510 checkDataSource({
511 databaseNameEn: databaseNameEn.value,
512 }).then((res: any) => {
513 if (res.code == proxy.$passCode) {
514 if (!res.data) {
515 proxy.$ElMessage({
516 type: 'warning',
517 message: '已存在导入数据源,请确认是否覆盖!',
518 })
519 }
520 } else {
521 proxy.$ElMessage({
522 type: 'error',
523 message: res.msg,
524 })
525 }
526 })
527 }
528
529 }
530
501 // 切换结构类型 设置选项显隐 531 // 切换结构类型 设置选项显隐
502 const setGroup = () => { 532 const setGroup = () => {
503 if (collectType.value == 2) { 533 if (collectType.value == 2) {
...@@ -518,8 +548,9 @@ const taskCreateDialogRef = ref(); ...@@ -518,8 +548,9 @@ const taskCreateDialogRef = ref();
518 548
519 const dialogBtnClick = (btn, info) => { 549 const dialogBtnClick = (btn, info) => {
520 if (btn.value == 'submit') { 550 if (btn.value == 'submit') {
521 let params = { ...info ,} 551 let params = { ...info, }
522 // params.taskState = 1; 552 // params.taskState = 1;
553 params.databaseNameEn = databaseNameEn.value
523 if (dialogInfo.value.type == 'add') { 554 if (dialogInfo.value.type == 'add') {
524 params.taskState = 1; 555 params.taskState = 1;
525 addMetaDataTask(params).then((res: any) => { 556 addMetaDataTask(params).then((res: any) => {
...@@ -552,7 +583,7 @@ const dialogBtnClick = (btn, info) => { ...@@ -552,7 +583,7 @@ const dialogBtnClick = (btn, info) => {
552 } 583 }
553 } else if (btn.value == 'cancel') { 584 } else if (btn.value == 'cancel') {
554 dialogInfo.value.visible = false; 585 dialogInfo.value.visible = false;
555 } else if (btn.value = 'cron') { 586 } else if (btn.value = 'cron') {
556 let vInfo = taskCreateDialogRef.value.dialogFormRef[0].formInline; 587 let vInfo = taskCreateDialogRef.value.dialogFormRef[0].formInline;
557 if (!vInfo.execCycle) { 588 if (!vInfo.execCycle) {
558 return; 589 return;
...@@ -573,13 +604,13 @@ const dialogBtnClick = (btn, info) => { ...@@ -573,13 +604,13 @@ const dialogBtnClick = (btn, info) => {
573 604
574 const importMeta = () => { 605 const importMeta = () => {
575 let query: any = { 606 let query: any = {
576 isfileImport: '4' 607 isfileImport: '4'
577 } 608 }
578 // 打开导入文件. 609 // 打开导入文件.
579 router.push({ 610 router.push({
580 name: 'importFileMeta', 611 name: 'importFileMeta',
581 query: query 612 query: query
582 }); 613 });
583 } 614 }
584 615
585 onActivated(() => { 616 onActivated(() => {
...@@ -594,7 +625,7 @@ onBeforeMount(() => { ...@@ -594,7 +625,7 @@ onBeforeMount(() => {
594 <template> 625 <template>
595 <div class="container_wrap"> 626 <div class="container_wrap">
596 <div class="table_tool_wrap"> 627 <div class="table_tool_wrap">
597 <!-- 头部搜索 --> 628 <!-- 头部搜索 -->
598 <TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" :init="false" /> 629 <TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" :init="false" />
599 <div class="tools_btns"> 630 <div class="tools_btns">
600 <el-button type="primary" @click="loadDrawer">新建</el-button> 631 <el-button type="primary" @click="loadDrawer">新建</el-button>
...@@ -603,17 +634,16 @@ onBeforeMount(() => { ...@@ -603,17 +634,16 @@ onBeforeMount(() => {
603 </div> 634 </div>
604 <div class="table_panel_wrap"> 635 <div class="table_panel_wrap">
605 <!-- 右侧采集任务表格 --> 636 <!-- 右侧采集任务表格 -->
606 <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" 637 <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tablePageChange="tablePageChange"
607 @tablePageChange="tablePageChange" @tableSwitchBeforeChange="tableSwitchBeforeChange" /> 638 @tableSwitchBeforeChange="tableSwitchBeforeChange" />
608 </div> 639 </div>
609 <!-- 新建编辑采集任务对话框 --> 640 <!-- 新建编辑采集任务对话框 -->
610 <Dialog ref="taskCreateDialogRef" :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @radioGroupChange="radioGroupChange" 641 <Dialog ref="taskCreateDialogRef" :dialogInfo="dialogInfo" @btnClick="dialogBtnClick"
611 @scheduleChange="scheduleChange" /> 642 @radioGroupChange="radioGroupChange" @scheduleChange="scheduleChange" @selectChange="selectChange" />
612 </div> 643 </div>
613 </template> 644 </template>
614 645
615 <style scoped lang="scss"> 646 <style scoped lang="scss">
616
617 .table_tool_wrap { 647 .table_tool_wrap {
618 width: 100%; 648 width: 100%;
619 height: 84px !important; 649 height: 84px !important;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!