commit
6678d34e95
@ -781,6 +781,8 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (f.getDeExtractType() == 4) { // 处理 tinyint
|
||||
stringBuilder.append("concat(`").append(f.getOriginName()).append("`,'') AS ").append(f.getDataeaseName());
|
||||
} if (f.getDeExtractType() == 1 && f.getType().equalsIgnoreCase("YEAR")) { // 处理 YEAR
|
||||
stringBuilder.append("").append(String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + f.getOriginName() + ",'-01-01')", MySQLConstants.DEFAULT_DATE_FORMAT)).append(" AS ").append(f.getDataeaseName());
|
||||
} else {
|
||||
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ public class DatasourceService {
|
||||
}
|
||||
return ResultHolder.success(datasourceDTO);
|
||||
} catch (Exception e) {
|
||||
return ResultHolder.error(Translator.get("I18N_DS_INVALID"), e.getMessage());
|
||||
return ResultHolder.error(Translator.get("I18N_DS_INVALID") + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,7 +350,7 @@ public class DatasourceService {
|
||||
return ResultHolder.success("Success");
|
||||
} catch (Exception e) {
|
||||
datasourceStatus = "Error";
|
||||
return ResultHolder.error(Translator.get("I18N_DS_INVALID"), e.getMessage());
|
||||
return ResultHolder.error(Translator.get("I18N_DS_INVALID") + ": " + e.getMessage());
|
||||
} finally {
|
||||
Datasource record = new Datasource();
|
||||
record.setStatus(datasourceStatus);
|
||||
|
||||
@ -239,3 +239,24 @@ RETURN concat(chartName,'-copy(',chartNameCount,')');
|
||||
END
|
||||
;;
|
||||
delimiter ;
|
||||
|
||||
|
||||
delete from sys_auth where (auth_source in ('6','700','710','810','910') and auth_source_type='menu' and auth_target='1' and auth_target_type='role');
|
||||
delete from sys_auth_detail where auth_id in (select id from sys_auth where auth_source in ('6','700','710','810','910') and auth_source_type='menu' and auth_target='1' and auth_target_type='role');
|
||||
COMMIT;
|
||||
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`, `copy_from`, `copy_id`) VALUES ('0c045d89-85ea-4676-8b5e-4b3dae5a734d', '700', 'menu', '1', 'role', 1664521306828, NULL, 'admin', NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`, `copy_from`, `copy_id`) VALUES ('1a18aa12-8daa-4f47-b5eb-999e473273df', '6', 'menu', '1', 'role', 1630482450994, NULL, 'admin', NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`, `copy_from`, `copy_id`) VALUES ('37457802-97a6-4303-be89-cf82b4059db1', '910', 'menu', '1', 'role', 1664521307265, NULL, 'admin', NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`, `copy_from`, `copy_id`) VALUES ('9019e9e4-8ea6-47ea-9279-98d10be107fc', '710', 'menu', '1', 'role', 1664521307460, NULL, 'admin', NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`, `copy_from`, `copy_id`) VALUES ('d2368c49-33b0-46b2-894d-b182d1c03bd4', '810', 'menu', '1', 'role', 1664521307050, NULL, 'admin', NULL, NULL, NULL);
|
||||
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('bfddec25-408d-11ed-8009-0242ac130005', '0c045d89-85ea-4676-8b5e-4b3dae5a734d', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1664521307000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('bfddf2e8-408d-11ed-8009-0242ac130005', '0c045d89-85ea-4676-8b5e-4b3dae5a734d', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1664521307000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('bfffbd09-408d-11ed-8009-0242ac130005', 'd2368c49-33b0-46b2-894d-b182d1c03bd4', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1664521307000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('bfffbf74-408d-11ed-8009-0242ac130005', 'd2368c49-33b0-46b2-894d-b182d1c03bd4', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1664521307000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('c01e6d09-408d-11ed-8009-0242ac130005', '37457802-97a6-4303-be89-cf82b4059db1', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1664521307000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('c01e6fb3-408d-11ed-8009-0242ac130005', '37457802-97a6-4303-be89-cf82b4059db1', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1664521307000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('c03c0af2-408d-11ed-8009-0242ac130005', '9019e9e4-8ea6-47ea-9279-98d10be107fc', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1664521307000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('c03c0dc3-408d-11ed-8009-0242ac130005', '9019e9e4-8ea6-47ea-9279-98d10be107fc', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1664521307000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('ddec6eab-0af8-11ec-a2b0-0242ac130003', '1a18aa12-8daa-4f47-b5eb-999e473273df', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482453000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('ddeccfa8-0af8-11ec-a2b0-0242ac130003', '1a18aa12-8daa-4f47-b5eb-999e473273df', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482453000, NULL, NULL, NULL);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -222,13 +222,13 @@ I18N_START_TIME=Start time
|
||||
I18N_END_TIME=End time
|
||||
I18N_STATUS=Status
|
||||
I18N_DATA=Data
|
||||
I18N_SYNC_LOG=Sync log
|
||||
I18N_SYNC_LOG=Sync logI18N_DS_INVALID
|
||||
|
||||
I18N_USER_DONOT_EXIST=User does not exist
|
||||
I18N_USER_SOURCE_PWD_ERROR=Source password error
|
||||
I18N_USER_PWD_FORMAT_ERROR=Password format error
|
||||
|
||||
I18N_DS_INVALID=Datasource is invalid.
|
||||
I18N_DS_INVALID=Datasource is invalid
|
||||
I18N_DS_INVALID_TABLE=Datasource has invalid tables
|
||||
|
||||
|
||||
|
||||
@ -228,7 +228,7 @@ I18N_USER_DONOT_EXIST=\u7528\u6237\u4E0D\u5B58\u5728
|
||||
I18N_USER_SOURCE_PWD_ERROR=\u539F\u59CB\u5BC6\u7801\u9519\u8BEF
|
||||
I18N_USER_PWD_FORMAT_ERROR=\u5BC6\u7801\u683C\u5F0F\u9519\u8BEF
|
||||
|
||||
I18N_DS_INVALID=\u6570\u636E\u6E90\u65E0\u6548.
|
||||
I18N_DS_INVALID=\u6570\u636E\u6E90\u65E0\u6548
|
||||
I18N_DS_INVALID_TABLE=\u6570\u636E\u6E90\u4E2D\u6709\u65E0\u6548\u7684\u8868
|
||||
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@ I18N_USER_DONOT_EXIST=\u7528\u6236\u4E0D\u5B58\u5728
|
||||
I18N_USER_SOURCE_PWD_ERROR=\u539F\u59CB\u5BC6\u78BC\u932F\u8AA4
|
||||
I18N_USER_PWD_FORMAT_ERROR=\u5BC6\u78BC\u683C\u5F0F\u932F\u8AA4
|
||||
|
||||
I18N_DS_INVALID=\u6578\u64DA\u6E90\u7121\u6548.
|
||||
I18N_DS_INVALID=\u6578\u64DA\u6E90\u7121\u6548
|
||||
I18N_DS_INVALID_TABLE=\u6578\u64DA\u6E90\u4E2D\u6709\u7121\u6548\u7684\u8868
|
||||
|
||||
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
<el-dropdown-item v-if="linkageSettingShow" icon="el-icon-link" @click.native="linkageSetting">{{ $t('panel.linkage_setting') }}</el-dropdown-item>
|
||||
<el-dropdown-item v-if="'de-tabs'===curComponent.type" icon="el-icon-plus" @click.native="addTab">{{ $t('panel.add_tab') }}</el-dropdown-item>
|
||||
<el-dropdown-item v-if="linkJumpSetShow" icon="el-icon-connection" @click.native="linkJumpSet">{{ $t('panel.setting_jump') }}</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-magic-stick" @click.native="boardSet">{{ $t('panel.component_style') }}</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="hyperlinksSet">
|
||||
<el-dropdown-item v-if="curComponent.type != 'custom-button'" icon="el-icon-magic-stick" @click.native="boardSet">{{ $t('panel.component_style') }}</el-dropdown-item>
|
||||
<el-dropdown-item v-if="curComponent.type != 'custom-button'" @click.native="hyperlinksSet">
|
||||
<i class="icon iconfont icon-font icon-chaolianjie1" />
|
||||
{{ $t('panel.hyperlinks') }}
|
||||
</el-dropdown-item>
|
||||
|
||||
@ -380,7 +380,11 @@ export function adaptCurThemeCommonStyle(component) {
|
||||
} else if (isTabComponent(component.component)) {
|
||||
const tabStyle = store.state.canvasStyleData.chartInfo.tabStyle
|
||||
for (const styleKey in tabStyle) {
|
||||
Vue.set(component.style, styleKey, tabStyle[styleKey])
|
||||
if(typeof tabStyle[styleKey] === 'string'){
|
||||
Vue.set(component.style, styleKey, tabStyle[styleKey])
|
||||
}else{
|
||||
Vue.set(component.style, styleKey, null)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (component.style.color) {
|
||||
|
||||
@ -596,6 +596,7 @@ export default {
|
||||
handler() {
|
||||
if (hasDataPermission('manage', this.param.privileges)) {
|
||||
this.listTask()
|
||||
this.getIncrementalConfig()
|
||||
}
|
||||
this.listTaskLog()
|
||||
},
|
||||
@ -792,19 +793,6 @@ export default {
|
||||
return false
|
||||
// !hasDataPermission('manage',task.privileges)
|
||||
},
|
||||
deleteTask(task) {
|
||||
const options = {
|
||||
title: '确定删除该任务吗?',
|
||||
type: 'primary',
|
||||
cb: () => {
|
||||
post('/dataset/task/delete/' + task.id, null).then((response) => {
|
||||
this.openMessageSuccess('commons.delete_success')
|
||||
this.initSearch()
|
||||
})
|
||||
}
|
||||
}
|
||||
this.handlerConfirm(options)
|
||||
},
|
||||
selectDataset(row) {
|
||||
this.disableForm = this.disableEdit(row)
|
||||
this.addTask(row)
|
||||
@ -869,6 +857,23 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
getIncrementalConfig() {
|
||||
post('/dataset/table/incrementalConfig', { tableId: this.table.id }).then(response => {
|
||||
this.incrementalConfig = response.data
|
||||
if (this.incrementalConfig.incrementalAdd.length === 0 && this.incrementalConfig.incrementalDelete.length === 0) {
|
||||
this.incrementalUpdateType = 'incrementalAdd'
|
||||
this.sql = ''
|
||||
return
|
||||
}
|
||||
if (this.incrementalConfig.incrementalAdd.length > 0) {
|
||||
this.incrementalUpdateType = 'incrementalAdd'
|
||||
this.sql = this.incrementalConfig.incrementalAdd
|
||||
} else {
|
||||
this.incrementalUpdateType = 'incrementalDelete'
|
||||
this.sql = this.incrementalConfig.incrementalDelete
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteTask(task) {
|
||||
this.$confirm(
|
||||
this.$t('dataset.confirm_delete'),
|
||||
|
||||
@ -243,7 +243,7 @@
|
||||
"
|
||||
:label="$t('datasource.extra_params')"
|
||||
>
|
||||
<el-input :placeholder="$t('fu.search_bar.please_input') + $t('datasource.extra_params')" v-model="form.configuration.extraParams" autocomplete="off" />
|
||||
<el-input v-model="form.configuration.extraParams" :placeholder="$t('fu.search_bar.please_input') + $t('datasource.extra_params')" autocomplete="off" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
@ -566,19 +566,19 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
<span class="select-svg-icon">
|
||||
<span v-if="scope.row.deType === 0">
|
||||
<svg-icon
|
||||
icon-class="field_text"
|
||||
class="field-icon-text"
|
||||
/>
|
||||
</span>
|
||||
<span v-if="[ 2, 3 ].includes(scope.row.deType)">
|
||||
<svg-icon
|
||||
icon-class="field_value"
|
||||
class="field-icon-value"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
<span v-if="scope.row.deType === 0">
|
||||
<svg-icon
|
||||
icon-class="field_text"
|
||||
class="field-icon-text"
|
||||
/>
|
||||
</span>
|
||||
<span v-if="[ 2, 3 ].includes(scope.row.deType)">
|
||||
<svg-icon
|
||||
icon-class="field_value"
|
||||
class="field-icon-value"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -725,7 +725,8 @@ export default {
|
||||
{
|
||||
required: true,
|
||||
validator: this.nameRepeat,
|
||||
trigger: 'blur'
|
||||
trigger: 'blur',
|
||||
message: i18n.t('commons.input_name')
|
||||
}
|
||||
],
|
||||
desc: [
|
||||
@ -969,20 +970,24 @@ export default {
|
||||
})
|
||||
},
|
||||
nameRepeat(rule, value, callback) {
|
||||
if (!value) {
|
||||
callback(new Error(i18n.t('commons.input_name')))
|
||||
return
|
||||
}
|
||||
let hasRepeatName = false
|
||||
this.form.apiConfiguration.forEach((item) => {
|
||||
if (
|
||||
item.name === this.apiItem.name &&
|
||||
this.form.apiConfiguration.forEach((item) => {
|
||||
if (
|
||||
item.name === this.apiItem.name &&
|
||||
item.serialNumber !== this.apiItem.serialNumber
|
||||
) {
|
||||
hasRepeatName = true
|
||||
}
|
||||
})
|
||||
if (hasRepeatName) {
|
||||
callback(new Error(i18n.t('theme.name_repeat')));
|
||||
return
|
||||
) {
|
||||
hasRepeatName = true
|
||||
}
|
||||
callback();
|
||||
})
|
||||
if (hasRepeatName) {
|
||||
callback(new Error(i18n.t('theme.name_repeat')))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
next() {
|
||||
if (this.active === 1) {
|
||||
|
||||
@ -163,10 +163,10 @@
|
||||
<span
|
||||
v-if="scope.row.lastExecStatus"
|
||||
:class="[`de-${scope.row.lastExecStatus}-pre`, 'de-status']"
|
||||
>{{
|
||||
$t(`dataset.${scope.row.lastExecStatus.toLocaleLowerCase()}`)
|
||||
}}
|
||||
<svg-icon style="cursor: pointer;" v-if="scope.row.lastExecStatus === 'Error'" @click="showErrorMassage(scope.row.msg)" icon-class="icon-maybe" class="field-icon-location" />
|
||||
>{{
|
||||
$t(`dataset.${scope.row.lastExecStatus.toLocaleLowerCase()}`)
|
||||
}}
|
||||
<svg-icon v-if="scope.row.lastExecStatus === 'Error'" style="cursor: pointer;" icon-class="icon-maybe" class="field-icon-location" @click="showErrorMassage(scope.row.msg)" />
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
@ -202,8 +202,9 @@
|
||||
:label="$t('dataset.task.task_status')"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span :class="[`de-${scope.row.status}-result`, 'de-status']"
|
||||
>{{ $t(`dataset.task.${scope.row.status.toLocaleLowerCase()}`) }}
|
||||
<span
|
||||
:class="[`de-${scope.row.status}-result`, 'de-status']"
|
||||
>{{ $t(`dataset.task.${scope.row.status.toLocaleLowerCase()}`) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -589,12 +590,13 @@ export default {
|
||||
},
|
||||
selectDataset(row) {
|
||||
if (row) {
|
||||
const { datasetName, id } = row
|
||||
const { datasetName, id, tableId } = row
|
||||
this.$router.push({
|
||||
path: '/task-ds-form',
|
||||
query: {
|
||||
datasetName,
|
||||
id
|
||||
id,
|
||||
tableId
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<de-layout-content :header="header" backPath="/system/system-task/dataset">
|
||||
<de-layout-content :header="header" back-path="/system/system-task/dataset">
|
||||
<div class="dataset-editer-form">
|
||||
<div class="w600">
|
||||
<el-form
|
||||
@ -12,9 +12,9 @@
|
||||
:rules="taskFormRules"
|
||||
>
|
||||
<el-form-item
|
||||
@click.native="selectDataset"
|
||||
:label="$t('chart.select_dataset')"
|
||||
prop="datasetName"
|
||||
@click.native="selectDataset"
|
||||
>
|
||||
<el-input
|
||||
v-model="taskForm.datasetName"
|
||||
@ -37,11 +37,10 @@
|
||||
$t("dataset.all_scope")
|
||||
}}</el-radio>
|
||||
<el-radio label="add_scope">
|
||||
{{ $t("dataset.add_scope") }}</el-radio
|
||||
>
|
||||
{{ $t("dataset.add_scope") }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div class="add-scope-cont" v-if="taskForm.type === 'add_scope'">
|
||||
<div v-if="taskForm.type === 'add_scope'" class="add-scope-cont">
|
||||
<el-form-item
|
||||
prop="type"
|
||||
:label="$t('dataset.incremental_update_type')"
|
||||
@ -65,16 +64,14 @@
|
||||
type="text"
|
||||
size="small"
|
||||
@click="insertParamToCodeMirror('${__last_update_time__}')"
|
||||
>{{ $t("dataset.last_update_time") }}</el-button
|
||||
>
|
||||
>{{ $t("dataset.last_update_time") }}</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
size="small"
|
||||
@click="
|
||||
insertParamToCodeMirror('${__current_update_time__}')
|
||||
"
|
||||
>{{ $t("dataset.current_update_time") }}</el-button
|
||||
>
|
||||
>{{ $t("dataset.current_update_time") }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="codemirror-cont">
|
||||
@ -102,7 +99,7 @@
|
||||
}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div class="execute-rate-cont" v-if="taskForm.rate !== 'SIMPLE'">
|
||||
<div v-if="taskForm.rate !== 'SIMPLE'" class="execute-rate-cont">
|
||||
<el-form-item
|
||||
v-if="taskForm.rate === 'SIMPLE_CRON'"
|
||||
:label="$t('dataset.execute_rate')"
|
||||
@ -116,7 +113,7 @@
|
||||
:min="1"
|
||||
size="small"
|
||||
@change="onSimpleCronChange()"
|
||||
></el-input-number>
|
||||
/>
|
||||
<el-select
|
||||
v-model="taskForm.extraData.simple_cron_type"
|
||||
filterable
|
||||
@ -131,14 +128,14 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
prop="cron"
|
||||
v-if="taskForm.rate === 'CRON' && showCron"
|
||||
prop="cron"
|
||||
:label="$t('emailtask.cron_exp')"
|
||||
>
|
||||
<el-popover v-model="cronEdit">
|
||||
<cron
|
||||
:isRate="taskForm.rate === 'CRON'"
|
||||
v-model="taskForm.cron"
|
||||
:is-rate="taskForm.rate === 'CRON'"
|
||||
@close="cronEdit = false"
|
||||
/>
|
||||
<el-input
|
||||
@ -161,8 +158,7 @@
|
||||
type="datetime"
|
||||
:placeholder="$t('dataset.start_time')"
|
||||
size="small"
|
||||
>
|
||||
</el-date-picker>
|
||||
/>
|
||||
<svg-icon icon-class="icon_calendar_outlined" class="icon-calendar-outlined" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
@ -188,13 +184,13 @@
|
||||
</el-form>
|
||||
<table-selector
|
||||
ref="tableSelector"
|
||||
previewForTask="true"
|
||||
preview-for-task="true"
|
||||
privileges="manage"
|
||||
@getTableId="getTableId"
|
||||
:mode="1"
|
||||
:clear-empty-dir="true"
|
||||
:custom-type="['db', 'sql', 'api']"
|
||||
show-mode="datasetTask"
|
||||
@getTableId="getTableId"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="!disableForm" class="de-foot-layout">
|
||||
@ -210,30 +206,30 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { post } from "@/api/dataset/dataset";
|
||||
import DeLayoutContent from "@/components/business/DeLayoutContent";
|
||||
import { hasDataPermission } from "@/utils/permission";
|
||||
import msgCfm from "@/components/msgCfm/index";
|
||||
import { post } from '@/api/dataset/dataset'
|
||||
import DeLayoutContent from '@/components/business/DeLayoutContent'
|
||||
import { hasDataPermission } from '@/utils/permission'
|
||||
import msgCfm from '@/components/msgCfm/index'
|
||||
|
||||
import cron from "@/components/cron/cron";
|
||||
import { codemirror } from "vue-codemirror";
|
||||
import "codemirror/lib/codemirror.css";
|
||||
import "codemirror/theme/eclipse.css";
|
||||
import "codemirror/mode/sql/sql.js";
|
||||
import "codemirror/addon/selection/active-line.js";
|
||||
import "codemirror/addon/edit/closebrackets.js";
|
||||
import "codemirror/mode/clike/clike.js";
|
||||
import "codemirror/addon/edit/matchbrackets.js";
|
||||
import "codemirror/addon/comment/comment.js";
|
||||
import "codemirror/addon/dialog/dialog.js";
|
||||
import "codemirror/addon/dialog/dialog.css";
|
||||
import "codemirror/addon/search/searchcursor.js";
|
||||
import "codemirror/addon/search/search.js";
|
||||
import "codemirror/keymap/emacs.js";
|
||||
import "codemirror/addon/hint/show-hint.css";
|
||||
import "codemirror/addon/hint/sql-hint";
|
||||
import "codemirror/addon/hint/show-hint";
|
||||
import TableSelector from "./TableSelector";
|
||||
import cron from '@/components/cron/cron'
|
||||
import { codemirror } from 'vue-codemirror'
|
||||
import 'codemirror/lib/codemirror.css'
|
||||
import 'codemirror/theme/eclipse.css'
|
||||
import 'codemirror/mode/sql/sql.js'
|
||||
import 'codemirror/addon/selection/active-line.js'
|
||||
import 'codemirror/addon/edit/closebrackets.js'
|
||||
import 'codemirror/mode/clike/clike.js'
|
||||
import 'codemirror/addon/edit/matchbrackets.js'
|
||||
import 'codemirror/addon/comment/comment.js'
|
||||
import 'codemirror/addon/dialog/dialog.js'
|
||||
import 'codemirror/addon/dialog/dialog.css'
|
||||
import 'codemirror/addon/search/searchcursor.js'
|
||||
import 'codemirror/addon/search/search.js'
|
||||
import 'codemirror/keymap/emacs.js'
|
||||
import 'codemirror/addon/hint/show-hint.css'
|
||||
import 'codemirror/addon/hint/sql-hint'
|
||||
import 'codemirror/addon/hint/show-hint'
|
||||
import TableSelector from './TableSelector'
|
||||
|
||||
export default {
|
||||
components: { cron, codemirror, TableSelector, DeLayoutContent },
|
||||
@ -242,80 +238,80 @@ export default {
|
||||
return {
|
||||
disableForm: false,
|
||||
table: {
|
||||
name: "",
|
||||
id: "",
|
||||
name: '',
|
||||
id: ''
|
||||
},
|
||||
showCron: false,
|
||||
taskForm: {
|
||||
name: "",
|
||||
type: "all_scope",
|
||||
startTime: "",
|
||||
tableId: "",
|
||||
rate: "SIMPLE",
|
||||
cron: "",
|
||||
endTime: "",
|
||||
end: "0",
|
||||
name: '',
|
||||
type: 'all_scope',
|
||||
startTime: '',
|
||||
tableId: '',
|
||||
rate: 'SIMPLE',
|
||||
cron: '',
|
||||
endTime: '',
|
||||
end: '0',
|
||||
extraData: {
|
||||
simple_cron_type: "hour",
|
||||
simple_cron_value: 1,
|
||||
},
|
||||
simple_cron_type: 'hour',
|
||||
simple_cron_value: 1
|
||||
}
|
||||
},
|
||||
taskFormRules: {
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("dataset.required"),
|
||||
trigger: "change",
|
||||
message: this.$t('dataset.required'),
|
||||
trigger: 'change'
|
||||
},
|
||||
{
|
||||
min: 2,
|
||||
max: 50,
|
||||
message: this.$t("datasource.input_limit_2_50", [2, 50]),
|
||||
trigger: "blur",
|
||||
},
|
||||
message: this.$t('datasource.input_limit_2_50', [2, 50]),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
type: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("dataset.required"),
|
||||
trigger: "change",
|
||||
},
|
||||
message: this.$t('dataset.required'),
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
startTime: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("components.time_is_required"),
|
||||
trigger: "change",
|
||||
},
|
||||
message: this.$t('components.time_is_required'),
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
rate: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("dataset.required"),
|
||||
trigger: "change",
|
||||
},
|
||||
message: this.$t('dataset.required'),
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
end: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("dataset.required"),
|
||||
trigger: "change",
|
||||
},
|
||||
message: this.$t('dataset.required'),
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
cron: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("dataset.required"),
|
||||
trigger: "change",
|
||||
},
|
||||
message: this.$t('dataset.required'),
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
datasetName: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("components.data_set_required"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
message: this.$t('components.data_set_required'),
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
},
|
||||
cronEdit: false,
|
||||
sqlOption: {
|
||||
@ -323,230 +319,231 @@ export default {
|
||||
styleActiveLine: true,
|
||||
lineNumbers: true,
|
||||
line: true,
|
||||
mode: "text/x-sql",
|
||||
theme: "eclipse",
|
||||
mode: 'text/x-sql',
|
||||
theme: 'eclipse',
|
||||
hintOptions: {
|
||||
// 自定义提示选项
|
||||
completeSingle: false, // 当匹配只有一项的时候是否自动补全
|
||||
},
|
||||
completeSingle: false // 当匹配只有一项的时候是否自动补全
|
||||
}
|
||||
},
|
||||
incrementalConfig: {},
|
||||
sql: "",
|
||||
incrementalUpdateType: "incrementalAdd",
|
||||
};
|
||||
sql: '',
|
||||
incrementalUpdateType: 'incrementalAdd'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
header() {
|
||||
return this.disableForm
|
||||
? "查看任务"
|
||||
? '查看任务'
|
||||
: this.taskDetail.id
|
||||
? "编辑任务"
|
||||
: "添加任务";
|
||||
},
|
||||
? '编辑任务'
|
||||
: '添加任务'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const { datasetName, id } = this.$route.query;
|
||||
this.taskDetail = { datasetName, id };
|
||||
const { datasetName, id, tableId } = this.$route.query
|
||||
this.taskDetail = { datasetName, id, tableId }
|
||||
if (!id) {
|
||||
this.taskForm.startTime = new Date()
|
||||
return;
|
||||
};
|
||||
this.getTaskDetail(id);
|
||||
return
|
||||
}
|
||||
this.getTaskDetail(id)
|
||||
this.getIncrementalConfig(tableId)
|
||||
},
|
||||
methods: {
|
||||
getTaskDetail(id) {
|
||||
post(`/dataset/task/detail/${id}`, {}).then((res) => {
|
||||
if (res.data.extraData) {
|
||||
res.data.extraData = JSON.parse(res.data.extraData);
|
||||
res.data.extraData = JSON.parse(res.data.extraData)
|
||||
}
|
||||
this.taskForm = res.data;
|
||||
this.taskForm = res.data
|
||||
this.showCron = this.taskForm.rate === 'CRON'
|
||||
this.disableForm = this.disableEdit();
|
||||
});
|
||||
this.disableForm = this.disableEdit()
|
||||
})
|
||||
},
|
||||
selectDataset() {
|
||||
if (this.taskForm.id) return;
|
||||
this.$refs.tableSelector.init();
|
||||
if (this.taskForm.id) return
|
||||
this.$refs.tableSelector.init()
|
||||
},
|
||||
getTableId(id, name) {
|
||||
this.taskForm.tableId = id;
|
||||
this.$set(this.taskForm, "datasetName", name);
|
||||
this.taskForm.tableId = id
|
||||
this.$set(this.taskForm, 'datasetName', name)
|
||||
},
|
||||
onRateChange() {
|
||||
if (this.taskForm.rate === "SIMPLE") {
|
||||
this.taskForm.end = "0";
|
||||
this.taskForm.endTime = "";
|
||||
this.taskForm.cron = "";
|
||||
this.showCron = false;
|
||||
if (this.taskForm.rate === 'SIMPLE') {
|
||||
this.taskForm.end = '0'
|
||||
this.taskForm.endTime = ''
|
||||
this.taskForm.cron = ''
|
||||
this.showCron = false
|
||||
}
|
||||
if (this.taskForm.rate === "SIMPLE_CRON") {
|
||||
this.taskForm.cron = "0 0 0/1 * * ? *";
|
||||
this.showCron = false;
|
||||
if (this.taskForm.rate === 'SIMPLE_CRON') {
|
||||
this.taskForm.cron = '0 0 0/1 * * ? *'
|
||||
this.showCron = false
|
||||
}
|
||||
if (this.taskForm.rate === "CRON") {
|
||||
this.taskForm.cron = "00 00 * ? * * *";
|
||||
if (this.taskForm.rate === 'CRON') {
|
||||
this.taskForm.cron = '00 00 * ? * * *'
|
||||
this.$nextTick(() => {
|
||||
this.showCron = true;
|
||||
});
|
||||
this.showCron = true
|
||||
})
|
||||
}
|
||||
},
|
||||
disableEdit() {
|
||||
const { privileges, rate, status } = this.taskForm;
|
||||
const { privileges, rate, status } = this.taskForm
|
||||
return (
|
||||
rate === "SIMPLE" ||
|
||||
status === "Stopped" ||
|
||||
!hasDataPermission("manage", privileges)
|
||||
);
|
||||
rate === 'SIMPLE' ||
|
||||
status === 'Stopped' ||
|
||||
!hasDataPermission('manage', privileges)
|
||||
)
|
||||
},
|
||||
onCmReady(cm) {
|
||||
// this.codemirror.setSize("-webkit-fill-available", "auto");
|
||||
},
|
||||
onCmFocus(cm) {},
|
||||
onCmCodeChange(newCode) {
|
||||
this.sql = newCode;
|
||||
this.$emit("codeChange", this.sql);
|
||||
this.sql = newCode
|
||||
this.$emit('codeChange', this.sql)
|
||||
},
|
||||
closeTask() {
|
||||
this.$router.back();
|
||||
this.$router.back()
|
||||
},
|
||||
onSimpleCronChange() {
|
||||
if (this.taskForm.extraData.simple_cron_type === "minute") {
|
||||
if (this.taskForm.extraData.simple_cron_type === 'minute') {
|
||||
if (
|
||||
this.taskForm.extraData.simple_cron_value < 1 ||
|
||||
this.taskForm.extraData.simple_cron_value > 59
|
||||
) {
|
||||
this.$message({
|
||||
message: this.$t("cron.minute_limit"),
|
||||
type: "warning",
|
||||
showClose: true,
|
||||
});
|
||||
this.taskForm.extraData.simple_cron_value = 59;
|
||||
message: this.$t('cron.minute_limit'),
|
||||
type: 'warning',
|
||||
showClose: true
|
||||
})
|
||||
this.taskForm.extraData.simple_cron_value = 59
|
||||
}
|
||||
this.taskForm.cron =
|
||||
"0 0/" + this.taskForm.extraData.simple_cron_value + " * * * ? *";
|
||||
return;
|
||||
'0 0/' + this.taskForm.extraData.simple_cron_value + ' * * * ? *'
|
||||
return
|
||||
}
|
||||
if (this.taskForm.extraData.simple_cron_type === "hour") {
|
||||
if (this.taskForm.extraData.simple_cron_type === 'hour') {
|
||||
if (
|
||||
this.taskForm.extraData.simple_cron_value < 1 ||
|
||||
this.taskForm.extraData.simple_cron_value > 23
|
||||
) {
|
||||
this.$message({
|
||||
message: this.$t("cron.hour_limit"),
|
||||
type: "warning",
|
||||
showClose: true,
|
||||
});
|
||||
this.taskForm.extraData.simple_cron_value = 23;
|
||||
message: this.$t('cron.hour_limit'),
|
||||
type: 'warning',
|
||||
showClose: true
|
||||
})
|
||||
this.taskForm.extraData.simple_cron_value = 23
|
||||
}
|
||||
this.taskForm.cron =
|
||||
"0 0 0/" + this.taskForm.extraData.simple_cron_value + " * * ? *";
|
||||
return;
|
||||
'0 0 0/' + this.taskForm.extraData.simple_cron_value + ' * * ? *'
|
||||
return
|
||||
}
|
||||
if (this.taskForm.extraData.simple_cron_type === "day") {
|
||||
if (this.taskForm.extraData.simple_cron_type === 'day') {
|
||||
if (
|
||||
this.taskForm.extraData.simple_cron_value < 1 ||
|
||||
this.taskForm.extraData.simple_cron_value > 31
|
||||
) {
|
||||
this.$message({
|
||||
message: this.$t("cron.day_limit"),
|
||||
type: "warning",
|
||||
showClose: true,
|
||||
});
|
||||
this.taskForm.extraData.simple_cron_value = 31;
|
||||
message: this.$t('cron.day_limit'),
|
||||
type: 'warning',
|
||||
showClose: true
|
||||
})
|
||||
this.taskForm.extraData.simple_cron_value = 31
|
||||
}
|
||||
this.taskForm.cron =
|
||||
"0 0 0 1/" + this.taskForm.extraData.simple_cron_value + " * ? *";
|
||||
return;
|
||||
'0 0 0 1/' + this.taskForm.extraData.simple_cron_value + ' * ? *'
|
||||
return
|
||||
}
|
||||
},
|
||||
insertParamToCodeMirror(param) {
|
||||
const pos1 = this.$refs.myCm.codemirror.getCursor();
|
||||
const pos2 = {};
|
||||
pos2.line = pos1.line;
|
||||
pos2.ch = pos1.ch;
|
||||
this.$refs.myCm.codemirror.replaceRange(param, pos2);
|
||||
const pos1 = this.$refs.myCm.codemirror.getCursor()
|
||||
const pos2 = {}
|
||||
pos2.line = pos1.line
|
||||
pos2.ch = pos1.ch
|
||||
this.$refs.myCm.codemirror.replaceRange(param, pos2)
|
||||
},
|
||||
saveTask(task) {
|
||||
this.$refs.taskForm.validate((valid) => {
|
||||
if (valid) {
|
||||
if (task.rate !== "SIMPLE") {
|
||||
if (this.incrementalUpdateType === "incrementalAdd") {
|
||||
this.incrementalConfig.incrementalAdd = this.sql;
|
||||
if (task.rate !== 'SIMPLE') {
|
||||
if (this.incrementalUpdateType === 'incrementalAdd') {
|
||||
this.incrementalConfig.incrementalAdd = this.sql
|
||||
} else {
|
||||
this.incrementalConfig.incrementalDelete = this.sql;
|
||||
this.incrementalConfig.incrementalDelete = this.sql
|
||||
}
|
||||
this.incrementalConfig.tableId = task.tableId;
|
||||
this.incrementalConfig.tableId = task.tableId
|
||||
}
|
||||
task.startTime = new Date(task.startTime).getTime();
|
||||
task.endTime = new Date(task.endTime).getTime();
|
||||
const form = JSON.parse(JSON.stringify(task));
|
||||
form.extraData = JSON.stringify(form.extraData);
|
||||
task.startTime = new Date(task.startTime).getTime()
|
||||
task.endTime = new Date(task.endTime).getTime()
|
||||
const form = JSON.parse(JSON.stringify(task))
|
||||
form.extraData = JSON.stringify(form.extraData)
|
||||
const dataSetTaskRequest = {
|
||||
datasetTableTask: form,
|
||||
datasetTableIncrementalConfig:
|
||||
task.type === "add_scope" ? this.incrementalConfig : undefined,
|
||||
};
|
||||
post("/dataset/task/save", dataSetTaskRequest).then((response) => {
|
||||
this.openMessageSuccess("dataset.save_success");
|
||||
this.closeTask();
|
||||
});
|
||||
task.type === 'add_scope' ? this.incrementalConfig : undefined
|
||||
}
|
||||
post('/dataset/task/save', dataSetTaskRequest).then((response) => {
|
||||
this.openMessageSuccess('dataset.save_success')
|
||||
this.closeTask()
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
getIncrementalConfig(tableId) {
|
||||
post("/dataset/table/incrementalConfig", { tableId: tableId }).then(
|
||||
post('/dataset/table/incrementalConfig', { tableId: tableId }).then(
|
||||
(response) => {
|
||||
this.incrementalConfig = response.data;
|
||||
this.incrementalConfig = response.data
|
||||
|
||||
if (
|
||||
this.incrementalConfig.incrementalAdd.length === 0 &&
|
||||
this.incrementalConfig.incrementalDelete.length === 0
|
||||
) {
|
||||
this.incrementalUpdateType = "incrementalAdd";
|
||||
this.sql = "";
|
||||
return;
|
||||
this.incrementalUpdateType = 'incrementalAdd'
|
||||
this.sql = ''
|
||||
return
|
||||
}
|
||||
if (this.incrementalConfig.incrementalAdd.length > 0) {
|
||||
this.incrementalUpdateType = "incrementalAdd";
|
||||
this.sql = this.incrementalConfig.incrementalAdd;
|
||||
this.incrementalUpdateType = 'incrementalAdd'
|
||||
this.sql = this.incrementalConfig.incrementalAdd
|
||||
} else {
|
||||
this.incrementalUpdateType = "incrementalDelete";
|
||||
this.sql = this.incrementalConfig.incrementalDelete;
|
||||
this.incrementalUpdateType = 'incrementalDelete'
|
||||
this.sql = this.incrementalConfig.incrementalDelete
|
||||
}
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
incrementalUpdateTypeChange: function () {
|
||||
if (this.incrementalUpdateType === "incrementalAdd") {
|
||||
incrementalUpdateTypeChange: function() {
|
||||
if (this.incrementalUpdateType === 'incrementalAdd') {
|
||||
if (this.sql) {
|
||||
this.incrementalConfig.incrementalDelete = this.sql;
|
||||
this.incrementalConfig.incrementalDelete = this.sql
|
||||
} else {
|
||||
this.incrementalConfig.incrementalDelete = "";
|
||||
this.incrementalConfig.incrementalDelete = ''
|
||||
}
|
||||
if (this.incrementalConfig.incrementalAdd) {
|
||||
this.sql = this.incrementalConfig.incrementalAdd;
|
||||
this.sql = this.incrementalConfig.incrementalAdd
|
||||
} else {
|
||||
this.sql = "";
|
||||
this.sql = ''
|
||||
}
|
||||
}
|
||||
|
||||
if (this.incrementalUpdateType === "incrementalDelete") {
|
||||
if (this.incrementalUpdateType === 'incrementalDelete') {
|
||||
if (this.sql) {
|
||||
this.incrementalConfig.incrementalAdd = this.sql;
|
||||
this.incrementalConfig.incrementalAdd = this.sql
|
||||
} else {
|
||||
this.incrementalConfig.incrementalAdd = "";
|
||||
this.incrementalConfig.incrementalAdd = ''
|
||||
}
|
||||
if (this.incrementalConfig.incrementalDelete) {
|
||||
this.sql = this.incrementalConfig.incrementalDelete;
|
||||
this.sql = this.incrementalConfig.incrementalDelete
|
||||
} else {
|
||||
this.sql = "";
|
||||
this.sql = ''
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@ -648,4 +645,4 @@ export default {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user