e379cfed by lihua

优化新增采集任务,数据源与导入重名的问题

1 parent ba1bb492
......@@ -267,7 +267,7 @@ const dialogInfo = ref({
footer: {
btns: [
{ type: "default", label: "取消", value: "cancel" },
{ type: "primary", label: "确定", value: "submit" },
{ type: "primary", label: "确定", value: "submit", loading: false },
],
},
});
......@@ -403,11 +403,13 @@ const tableBtnClick = (scope, btn) => {
})
} else if (type == "edit") {
dialogInfo.value.header.title = '编辑采集任务';
dialogInfo.value.type = type
dialogInfo.value.type = type;
oldOriginValue.value = {};
setDetailInfo(scope.row);
formInfo.value.formInfo.items[6].default = '';
formRules.value.collectTaskName = [required('请填写采集任务名称'), checkExistName(checkedInfo.value, checkMetaDataTask, currTableData.value, 'collectTaskName')];
dialogInfo.value.contents[0].formInfo.rules = formRules.value;
formItems.value[2].disabled = true;
} else if (type == "delete") {
proxy.$openMessageBox("此操作将永久删除, 是否继续?", () => {
let guids = [currTableData.value.guid]
......@@ -451,6 +453,7 @@ const tableBtnClick = (scope, btn) => {
const loadDrawer = () => {
collectType.value = 1
oldOriginValue.value = {};
setFormItems()
setGroup()
formInfo.value.formInfo.items[5].default = '0 00 00 01 * ? '
......@@ -461,6 +464,7 @@ const loadDrawer = () => {
checkedInfo.value = {};
formItems.value[0].default = '1';
formItems.value[0].disabled = false;
formItems.value[2].disabled = false;
};
const setDetailInfo = (row) => {
......@@ -502,30 +506,7 @@ const scheduleChange = (val, rowValue) => {
const databaseNameEn = ref<any>('')
const selectChange = (val, row, info) => {
// dataSourceList.value
console.log(val, row, info)
let data: any = dataSourceList.value.find((item: any) => item.guid == val)
if (data) {
databaseNameEn.value = data.databaseNameEn
checkDataSource({
databaseNameEn: databaseNameEn.value,
}).then((res: any) => {
if (res.code == proxy.$passCode) {
if (!res.data) {
proxy.$ElMessage({
type: 'warning',
message: '已存在导入数据源,请确认是否覆盖!',
})
}
} else {
proxy.$ElMessage({
type: 'error',
message: res.msg,
})
}
})
}
// console.log(val, row, info)
}
// 切换结构类型 设置选项显隐
......@@ -552,22 +533,53 @@ const dialogBtnClick = (btn, info) => {
// params.taskState = 1;
params.databaseNameEn = databaseNameEn.value
if (dialogInfo.value.type == 'add') {
params.taskState = 1;
addMetaDataTask(params).then((res: any) => {
if (res.code == proxy.$passCode) {
page.value.curr = 1;
getTableData();
proxy.$ElMessage({
type: 'success',
message: '添加采集任务成功'
})
dialogInfo.value.visible = false;
} else {
proxy.$ElMessage.error(res.msg);
}
})
let addTask = () => {
params.taskState = 1;
dialogInfo.value.footer.btns[1].loading = true;
addMetaDataTask(params).then((res: any) => {
dialogInfo.value.footer.btns[1].loading = false;
if (res.code == proxy.$passCode) {
page.value.curr = 1;
getTableData();
proxy.$ElMessage({
type: 'success',
message: '添加采集任务成功'
})
dialogInfo.value.visible = false;
} else {
proxy.$ElMessage.error(res.msg);
}
})
}
let data: any = dataSourceList.value.find((item: any) => item.guid == params.dataSourceGuid)
if (data) {
dialogInfo.value.footer.btns[1].loading = true;
databaseNameEn.value = data.databaseNameEn;
checkDataSource({
databaseNameEn: databaseNameEn.value,
}).then((res: any) => {
dialogInfo.value.footer.btns[1].loading = false;
if (res.code == proxy.$passCode) {
if (!res.data) {
proxy.$openMessageBox('该数据源在导入数据源中已存在,确定覆盖吗?', () => {
addTask();
}, () => {
proxy.$ElMessage.info("已取消");
});
} else {
addTask();
}
} else {
proxy.$ElMessage({
type: 'error',
message: res.msg,
})
}
})
} else {
addTask();
}
} else {
params.guid = currTableData.value.guid
updateMetaDataTask(params).then((res: any) => {
if (res.code == proxy.$passCode) {
getTableData();
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!