@@ -23,6 +23,11 @@ import { useEventListener } from '@vueuse/core';
import themes from './themes';
const props = defineProps({
+ // mounted时,是否执行init方法
+ mountInit: {
+ type: Boolean,
+ default: true,
+ },
/**
* 初始化执行命令
*/
@@ -65,9 +70,9 @@ const state = reactive({
});
onMounted(() => {
- nextTick(() => {
+ if (props.mountInit) {
init();
- });
+ }
});
watch(
@@ -94,6 +99,13 @@ function init() {
console.log('重新连接...');
close();
}
+ nextTick(() => {
+ initTerm();
+ initSocket();
+ });
+}
+
+function initTerm() {
term = new Terminal({
fontSize: themeConfig.value.terminalFontSize || 15,
fontWeight: themeConfig.value.terminalFontWeight || 'normal',
@@ -107,25 +119,11 @@ function init() {
term.open(terminalRef.value);
- // 注册 terminal 事件
- term.onResize((event) => sendResize(event.cols, event.rows));
- term.onData((event) => sendCmd(event));
-
- // 注册自定义快捷键
- term.attachCustomKeyEventHandler((event: KeyboardEvent) => {
- // 注册搜索键 ctrl + f
- if (event.key === 'f' && (event.ctrlKey || event.metaKey) && event.type === 'keydown') {
- event.preventDefault();
- terminalSearchRef.value.open();
- }
-
- return true;
- });
-
// 注册自适应组件
const fitAddon = new FitAddon();
state.addon.fit = fitAddon;
term.loadAddon(fitAddon);
+ fitTerminal();
// 注册搜索组件
const searchAddon = new SearchAddon();
@@ -137,12 +135,21 @@ function init() {
state.addon.weblinks = weblinks;
term.loadAddon(weblinks);
- initSocket();
+ // 注册自定义快捷键
+ term.attachCustomKeyEventHandler((event: KeyboardEvent) => {
+ // 注册搜索键 ctrl + f
+ if (event.key === 'f' && (event.ctrlKey || event.metaKey) && event.type === 'keydown') {
+ event.preventDefault();
+ terminalSearchRef.value.open();
+ }
+
+ return true;
+ });
}
function initSocket() {
if (props.socketUrl) {
- socket = new WebSocket(`${props.socketUrl}`);
+ socket = new WebSocket(`${props.socketUrl}&rows=${term?.rows}&cols=${term?.cols}`);
}
// 监听socket连接
@@ -151,11 +158,13 @@ function initSocket() {
pingInterval = setInterval(sendPing, 15000);
state.status = TerminalStatus.Connected;
+ // 注册 terminal 事件
+ term.onResize((event) => sendResize(event.cols, event.rows));
+ term.onData((event) => sendCmd(event));
+
// // 注册窗口大小监听器
useEventListener('resize', debounce(fitTerminal, 400));
focus();
- fitTerminal();
- sendResize(term.cols, term.rows);
// 如果有初始要执行的命令,则发送执行命令
if (props.cmd) {
@@ -261,7 +270,6 @@ defineExpose({ init, fitTerminal, focus, clear, close, getStatus, sendResize });
-@/router/staticRouter
diff --git a/mayfly_go_web/src/views/flow/ProcdefEdit.vue b/mayfly_go_web/src/views/flow/ProcdefEdit.vue
new file mode 100755
index 00000000..a4b40d62
--- /dev/null
+++ b/mayfly_go_web/src/views/flow/ProcdefEdit.vue
@@ -0,0 +1,211 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 审批节点
+
+
+
+
+
+ 节点名称
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取 消
+ 确 定
+
+
+
+
+
+
+
+
diff --git a/mayfly_go_web/src/views/flow/ProcdefList.vue b/mayfly_go_web/src/views/flow/ProcdefList.vue
new file mode 100644
index 00000000..7bd88236
--- /dev/null
+++ b/mayfly_go_web/src/views/flow/ProcdefList.vue
@@ -0,0 +1,141 @@
+
+
+
+
+ 添加
+ 删除
+
+
+
+
+
+
+
+ 编辑
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mayfly_go_web/src/views/flow/ProcinstDetail.vue b/mayfly_go_web/src/views/flow/ProcinstDetail.vue
new file mode 100755
index 00000000..ed2435be
--- /dev/null
+++ b/mayfly_go_web/src/views/flow/ProcinstDetail.vue
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+
+
+
流程信息
+
+ {{ procinst.procdefName }}
+
+
+
+
+ {{ procinst.creator }}
+ {{ dateFormat(procinst.createTime) }}
+
+
+ {{ formatTime(procinst.duration) }}
+ {{ dateFormat(procinst.endTime) }}
+
+
+
+
+
+
+
+
+
+
+ {{ procinst.remark }}
+
+
+
+
+
+
+
+ 业务信息
+
+
+
+
+ 审批表单
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取 消
+ 确 定
+
+
+
+
+
+
+
+
diff --git a/mayfly_go_web/src/views/flow/ProcinstList.vue b/mayfly_go_web/src/views/flow/ProcinstList.vue
new file mode 100644
index 00000000..509d5bdc
--- /dev/null
+++ b/mayfly_go_web/src/views/flow/ProcinstList.vue
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+ 查看
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mayfly_go_web/src/views/flow/ProcinstTaskList.vue b/mayfly_go_web/src/views/flow/ProcinstTaskList.vue
new file mode 100644
index 00000000..3e0a9288
--- /dev/null
+++ b/mayfly_go_web/src/views/flow/ProcinstTaskList.vue
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+ 查看
+ 审核
+
+
+
+
+
+
+
+
+
diff --git a/mayfly_go_web/src/views/flow/api.ts b/mayfly_go_web/src/views/flow/api.ts
new file mode 100644
index 00000000..a0d61dcf
--- /dev/null
+++ b/mayfly_go_web/src/views/flow/api.ts
@@ -0,0 +1,20 @@
+import Api from '@/common/Api';
+
+export const procdefApi = {
+ list: Api.newGet('/flow/procdefs'),
+ getByKey: Api.newGet('/flow/procdefs/{key}'),
+ save: Api.newPost('/flow/procdefs'),
+ del: Api.newDelete('/flow/procdefs/{id}'),
+};
+
+export const procinstApi = {
+ list: Api.newGet('/flow/procinsts'),
+ detail: Api.newGet('/flow/procinsts/{id}'),
+ cancel: Api.newPost('/flow/procinsts/{id}/cancel'),
+ tasks: Api.newGet('/flow/procinsts/tasks'),
+ completeTask: Api.newPost('/flow/procinsts/tasks/complete'),
+ backTask: Api.newPost('/flow/procinsts/tasks/back'),
+ rejectTask: Api.newPost('/flow/procinsts/tasks/reject'),
+ save: Api.newPost('/flow/procdefs'),
+ del: Api.newDelete('/flow/procdefs/{id}'),
+};
diff --git a/mayfly_go_web/src/views/flow/components/ProcdefSelectFormItem.vue b/mayfly_go_web/src/views/flow/components/ProcdefSelectFormItem.vue
new file mode 100644
index 00000000..dc57acc6
--- /dev/null
+++ b/mayfly_go_web/src/views/flow/components/ProcdefSelectFormItem.vue
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
diff --git a/mayfly_go_web/src/views/flow/components/ProcdefTasks.vue b/mayfly_go_web/src/views/flow/components/ProcdefTasks.vue
new file mode 100755
index 00000000..1c053137
--- /dev/null
+++ b/mayfly_go_web/src/views/flow/components/ProcdefTasks.vue
@@ -0,0 +1,136 @@
+
+
+
+
+ {{ `${task.accountUsername}(${task.accountName})` }}
+ {{ `${dateFormat(task.completeTime)}` }}
+ {{ task.remark }}
+
+
+
+
+
+
+
diff --git a/mayfly_go_web/src/views/flow/enums.ts b/mayfly_go_web/src/views/flow/enums.ts
new file mode 100644
index 00000000..013c805c
--- /dev/null
+++ b/mayfly_go_web/src/views/flow/enums.ts
@@ -0,0 +1,33 @@
+import { EnumValue } from '@/common/Enum';
+
+export const ProcdefStatus = {
+ Enable: EnumValue.of(1, '启用').setTagType('success'),
+ Disable: EnumValue.of(-1, '禁用').setTagType('warning'),
+};
+
+export const ProcinstStatus = {
+ Active: EnumValue.of(1, '执行中').setTagType('primary'),
+ Completed: EnumValue.of(2, '完成').setTagType('success'),
+ Suspended: EnumValue.of(-1, '挂起').setTagType('warning'),
+ Terminated: EnumValue.of(-2, '终止').setTagType('danger'),
+ Cancelled: EnumValue.of(-3, '取消').setTagType('warning'),
+};
+
+export const ProcinstBizStatus = {
+ Wait: EnumValue.of(1, '待处理').setTagType('primary'),
+ Success: EnumValue.of(2, '处理成功').setTagType('success'),
+ Fail: EnumValue.of(-2, '处理失败').setTagType('danger'),
+ No: EnumValue.of(-1, '不处理').setTagType('warning'),
+};
+
+export const ProcinstTaskStatus = {
+ Process: EnumValue.of(1, '待处理').setTagType('primary'),
+ Pass: EnumValue.of(2, '通过').setTagType('success'),
+ Reject: EnumValue.of(-1, '拒绝').setTagType('danger'),
+ Back: EnumValue.of(-2, '驳回').setTagType('warning'),
+ Canceled: EnumValue.of(-3, '取消').setTagType('warning'),
+};
+
+export const FlowBizType = {
+ DbSqlExec: EnumValue.of('db_sql_exec_flow', 'DBMS-执行SQL'),
+};
diff --git a/mayfly_go_web/src/views/flow/flowbiz/DbSqlExecBiz.vue b/mayfly_go_web/src/views/flow/flowbiz/DbSqlExecBiz.vue
new file mode 100755
index 00000000..b03d7c92
--- /dev/null
+++ b/mayfly_go_web/src/views/flow/flowbiz/DbSqlExecBiz.vue
@@ -0,0 +1,79 @@
+
+
+
+ {{ db?.name }}
+ {{ db?.id }}
+
+
+
+ {{ `${db?.host}:${db?.port}` }}
+
+ {{ db?.type }}
+
+ {{ db?.username }}
+
+ {{ sqlExec.db }}
+
+ {{ sqlExec.table }}
+
+
+ {{ EnumValue.getLabelByValue(DbSqlExecTypeEnum, sqlExec.type) }}
+
+
+
+
+
+
+
+
+
+
diff --git a/mayfly_go_web/src/views/ops/component/ResourceTag.vue b/mayfly_go_web/src/views/ops/component/ResourceTag.vue
deleted file mode 100644
index 6eab7e6d..00000000
--- a/mayfly_go_web/src/views/ops/component/ResourceTag.vue
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- {{ tag.tagPath }}
-
-
-
-
-
-
-
diff --git a/mayfly_go_web/src/views/ops/component/ResourceTags.vue b/mayfly_go_web/src/views/ops/component/ResourceTags.vue
new file mode 100644
index 00000000..68ff5dc8
--- /dev/null
+++ b/mayfly_go_web/src/views/ops/component/ResourceTags.vue
@@ -0,0 +1,33 @@
+
+
+
+
+ {{ tag.tagPath }}
+
+
+
+
+
+
+
+
+
+ {{ i.tagPath }}
+
+
+
+
+
+
+
+
+
diff --git a/mayfly_go_web/src/views/ops/component/TagTreeSelect.vue b/mayfly_go_web/src/views/ops/component/TagTreeSelect.vue
index ef061778..4e3dc7c2 100644
--- a/mayfly_go_web/src/views/ops/component/TagTreeSelect.vue
+++ b/mayfly_go_web/src/views/ops/component/TagTreeSelect.vue
@@ -2,13 +2,13 @@
@@ -75,6 +74,8 @@
+
+
@@ -92,8 +93,8 @@ import { toRefs, reactive, watch, ref } from 'vue';
import { dbApi } from './api';
import { ElMessage } from 'element-plus';
import TagTreeSelect from '../component/TagTreeSelect.vue';
-import { TagResourceTypeEnum } from '@/common/commonEnum';
import type { CheckboxValueType } from 'element-plus';
+import ProcdefSelectFormItem from '@/views/flow/components/ProcdefSelectFormItem.vue';
const props = defineProps({
visible: {
@@ -163,6 +164,7 @@ const state = reactive({
database: '',
remark: '',
instanceId: null as any,
+ flowProcdefKey: '',
},
instances: [] as any,
});
@@ -178,7 +180,7 @@ watch(props, async (newValue: any) => {
}
if (newValue.db) {
state.form = { ...newValue.db };
-
+ state.form.tagId = newValue.db.tags.map((t: any) => t.tagId);
// 将数据库名使用空格切割,获取所有数据库列表
state.dbNamesSelected = newValue.db.database.split(' ');
} else {
diff --git a/mayfly_go_web/src/views/ops/db/DbList.vue b/mayfly_go_web/src/views/ops/db/DbList.vue
index a2e5673f..6f1b2a42 100644
--- a/mayfly_go_web/src/views/ops/db/DbList.vue
+++ b/mayfly_go_web/src/views/ops/db/DbList.vue
@@ -39,7 +39,7 @@
-
+
@@ -164,23 +164,30 @@
-
+
-
{{ infoDialog.data?.name }}
{{ infoDialog.data?.id }}
- {{ infoDialog.data?.database }}
- {{ infoDialog.data?.remark }}
- {{ dateFormat(infoDialog.data?.createTime) }}
- {{ infoDialog.data?.creator }}
- {{ dateFormat(infoDialog.data?.updateTime) }}
- {{ infoDialog.data?.modifier }}
+
{{ infoDialog.instance?.name }}
+
{{ infoDialog.instance?.host }}
{{ infoDialog.instance?.port }}
+
{{ infoDialog.instance?.username }}
- {{ infoDialog.instance?.type }}
+
+ {{ infoDialog.instance?.type }}
+
+
+ {{ infoDialog.data?.database }}
+ {{ infoDialog.data?.remark }}
+
+ {{ dateFormat(infoDialog.data?.createTime) }}
+ {{ infoDialog.data?.creator }}
+
+ {{ dateFormat(infoDialog.data?.updateTime) }}
+ {{ infoDialog.data?.modifier }}
@@ -196,7 +203,6 @@ import config from '@/common/config';
import { joinClientParams } from '@/common/request';
import { isTrue } from '@/common/assert';
import { dateFormat } from '@/common/utils/date';
-import ResourceTag from '../component/ResourceTag.vue';
import PageTable from '@/components/pagetable/PageTable.vue';
import { TableColumn } from '@/components/pagetable';
import { hasPerms } from '@/components/auth/auth';
@@ -210,6 +216,7 @@ import { SearchItem } from '@/components/SearchForm';
import DbBackupList from './DbBackupList.vue';
import DbBackupHistoryList from './DbBackupHistoryList.vue';
import DbRestoreList from './DbRestoreList.vue';
+import ResourceTags from '../component/ResourceTags.vue';
const DbEdit = defineAsyncComponent(() => import('./DbEdit.vue'));
@@ -224,12 +231,13 @@ const perms = {
const searchItems = [getTagPathSearchItem(TagResourceTypeEnum.Db.value), SearchItem.slot('instanceId', '实例', 'instanceSelect')];
const columns = ref([
+ TableColumn.new('tags[0].tagPath', '关联标签').isSlot('tagPath').setAddWidth(20),
TableColumn.new('name', '名称'),
TableColumn.new('type', '类型').isSlot().setAddWidth(-15).alignCenter(),
TableColumn.new('instanceName', '实例名'),
TableColumn.new('host', 'ip:port').isSlot().setAddWidth(40),
TableColumn.new('username', 'username'),
- TableColumn.new('tagPath', '关联标签').isSlot().setAddWidth(10).alignCenter(),
+ TableColumn.new('flowProcdefKey', '关联流程'),
TableColumn.new('remark', '备注'),
]);
diff --git a/mayfly_go_web/src/views/ops/db/DbSqlExecLog.vue b/mayfly_go_web/src/views/ops/db/DbSqlExecLog.vue
index 9eb62edd..281c6e9a 100644
--- a/mayfly_go_web/src/views/ops/db/DbSqlExecLog.vue
+++ b/mayfly_go_web/src/views/ops/db/DbSqlExecLog.vue
@@ -17,7 +17,10 @@
import { onMounted, reactive, Ref, ref, toRefs, watch } from 'vue';
import { dbApi } from './api';
-import { DbSqlExecTypeEnum } from './enums';
+import { DbSqlExecTypeEnum, DbSqlExecStatusEnum } from './enums';
import PageTable from '@/components/pagetable/PageTable.vue';
import { TableColumn } from '@/components/pagetable';
import { SearchItem } from '@/components/SearchForm';
@@ -66,9 +69,11 @@ const columns = ref([
TableColumn.new('type', '类型').typeTag(DbSqlExecTypeEnum).setAddWidth(10),
TableColumn.new('creator', '执行人'),
TableColumn.new('sql', 'SQL').canBeautify(),
- TableColumn.new('oldValue', '原值').canBeautify(),
- TableColumn.new('createTime', '执行时间').isTime(),
TableColumn.new('remark', '备注'),
+ TableColumn.new('status', '执行状态').typeTag(DbSqlExecStatusEnum),
+ TableColumn.new('res', '执行结果'),
+ TableColumn.new('createTime', '执行时间').isTime(),
+ TableColumn.new('oldValue', '原值').canBeautify(),
TableColumn.new('action', '操作').isSlot().setMinWidth(90).fixedRight().alignCenter(),
]);
@@ -80,6 +85,7 @@ const state = reactive({
dbId: 0,
db: '',
table: '',
+ status: [DbSqlExecStatusEnum.Success.value, DbSqlExecStatusEnum.Fail.value].join(','),
type: null,
pageNum: 1,
pageSize: 10,
diff --git a/mayfly_go_web/src/views/ops/db/SqlExec.vue b/mayfly_go_web/src/views/ops/db/SqlExec.vue
index d9ea447b..d36079aa 100644
--- a/mayfly_go_web/src/views/ops/db/SqlExec.vue
+++ b/mayfly_go_web/src/views/ops/db/SqlExec.vue
@@ -143,6 +143,7 @@
:db-id="dt.params.id"
:db="dt.params.db"
:db-type="dt.params.type"
+ :flow-procdef-key="dt.params.flowProcdefKey"
:height="state.tablesOpHeight"
/>
@@ -157,6 +158,7 @@
:dbId="tableCreateDialog.dbId"
:db="tableCreateDialog.db"
:dbType="tableCreateDialog.dbType"
+ :flow-procdef-key="tableCreateDialog.flowProcdefKey"
:data="tableCreateDialog.data"
v-model:visible="tableCreateDialog.visible"
@submit-sql="onSubmitEditTableSql"
@@ -225,7 +227,18 @@ const SqlIcon = {
const nodeClickChangeDb = (nodeData: TagTreeNode) => {
const params = nodeData.params;
if (params.db) {
- changeDb({ id: params.id, host: `${params.host}`, name: params.name, type: params.type, tagPath: params.tagPath, databases: params.dbs }, params.db);
+ changeDb(
+ {
+ id: params.id,
+ host: `${params.host}`,
+ name: params.name,
+ type: params.type,
+ tagPath: params.tagPath,
+ databases: params.dbs,
+ flowProcdefKey: params.flowProcdefKey,
+ },
+ params.db
+ );
}
};
@@ -263,6 +276,7 @@ const NodeTypeDbInst = new NodeType(SqlExecNodeType.DbInst).withLoadNodesFunc((p
host: `${params.host}:${params.port}`,
dbs: dbs,
db: x,
+ flowProcdefKey: params.flowProcdefKey,
})
.withIcon(DbIcon);
});
@@ -322,7 +336,7 @@ const NodeTypeTableMenu = new NodeType(SqlExecNodeType.TableMenu)
])
.withLoadNodesFunc(async (parentNode: TagTreeNode) => {
const params = parentNode.params;
- let { id, db, type } = params;
+ let { id, db, type, flowProcdefKey } = params;
// 获取当前库的所有表信息
let tables = await DbInst.getInst(id).loadTables(db, state.reloadStatus);
state.reloadStatus = false;
@@ -337,6 +351,7 @@ const NodeTypeTableMenu = new NodeType(SqlExecNodeType.TableMenu)
id,
db,
type,
+ flowProcdefKey: flowProcdefKey,
key: key,
parentKey: parentNode.key,
tableName: x.tableName,
@@ -417,6 +432,7 @@ const state = reactive({
dbId: 0,
db: '',
dbType: '',
+ flowProcdefKey: '',
data: {},
parentKey: '',
},
@@ -639,7 +655,7 @@ const reloadNode = (nodeKey: string) => {
};
const onEditTable = async (data: any) => {
- let { db, id, tableName, tableComment, type, parentKey, key } = data.params;
+ let { db, id, tableName, tableComment, type, parentKey, key, flowProcdefKey } = data.params;
// data.label就是表名
if (tableName) {
state.tableCreateDialog.title = '修改表';
@@ -654,15 +670,16 @@ const onEditTable = async (data: any) => {
state.tableCreateDialog.parentKey = key;
}
- state.tableCreateDialog.visible = true;
state.tableCreateDialog.activeName = '1';
state.tableCreateDialog.dbId = id;
state.tableCreateDialog.db = db;
state.tableCreateDialog.dbType = type;
+ state.tableCreateDialog.flowProcdefKey = flowProcdefKey;
+ state.tableCreateDialog.visible = true;
};
const onDeleteTable = async (data: any) => {
- let { db, id, tableName, parentKey } = data.params;
+ let { db, id, tableName, parentKey, flowProcdefKey } = data.params;
await ElMessageBox.confirm(`此操作是永久性且无法撤销,确定删除【${tableName}】? `, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -670,6 +687,10 @@ const onDeleteTable = async (data: any) => {
});
// 执行sql
dbApi.sqlExec.request({ id, db, sql: `drop table ${tableName}` }).then(() => {
+ if (flowProcdefKey) {
+ ElMessage.success('工单提交成功');
+ return;
+ }
ElMessage.success('删除成功');
setTimeout(() => {
parentKey && reloadNode(parentKey);
@@ -728,6 +749,7 @@ const getNowDbInfo = () => {
name: di.name,
type: di.type,
host: di.host,
+ flowProcdefKey: di.flowProcdefKey,
dbName: state.db,
};
};
diff --git a/mayfly_go_web/src/views/ops/db/api.ts b/mayfly_go_web/src/views/ops/db/api.ts
index 218a6f9b..8b5888f7 100644
--- a/mayfly_go_web/src/views/ops/db/api.ts
+++ b/mayfly_go_web/src/views/ops/db/api.ts
@@ -35,7 +35,7 @@ export const dbApi = {
getSqlNames: Api.newGet('/dbs/{id}/sql-names'),
deleteDbSql: Api.newDelete('/dbs/{id}/sql'),
// 获取数据库sql执行记录
- getSqlExecs: Api.newGet('/dbs/{dbId}/sql-execs'),
+ getSqlExecs: Api.newGet('/dbs/sql-execs'),
instances: Api.newGet('/instances'),
getInstance: Api.newGet('/instances/{instanceId}'),
@@ -84,3 +84,8 @@ export const dbApi = {
stopDatasyncTask: Api.newPost('/datasync/tasks/{taskId}/stop'),
datasyncLogs: Api.newGet('/datasync/tasks/{taskId}/logs'),
};
+
+export const dbSqlExecApi = {
+ // 根据业务key获取sql执行信息
+ getSqlExecByBizKey: Api.newGet('/dbs/sql-execs'),
+};
diff --git a/mayfly_go_web/src/views/ops/db/component/sqleditor/DbSqlEditor.vue b/mayfly_go_web/src/views/ops/db/component/sqleditor/DbSqlEditor.vue
index 9a948ae6..45b6897e 100644
--- a/mayfly_go_web/src/views/ops/db/component/sqleditor/DbSqlEditor.vue
+++ b/mayfly_go_web/src/views/ops/db/component/sqleditor/DbSqlEditor.vue
@@ -297,13 +297,16 @@ const onRunSql = async (newTab = false) => {
sql = sql.replace(/(^\s*)/g, '');
let execRemark = '';
let canRun = true;
+
+ // 简单截取前十个字符
+ const sqlPrefix = sql.slice(0, 10).toLowerCase();
if (
- sql.startsWith('update') ||
- sql.startsWith('UPDATE') ||
- sql.startsWith('INSERT') ||
- sql.startsWith('insert') ||
- sql.startsWith('DELETE') ||
- sql.startsWith('delete')
+ sqlPrefix.startsWith('update') ||
+ sqlPrefix.startsWith('insert') ||
+ sqlPrefix.startsWith('delete') ||
+ sqlPrefix.startsWith('alert') ||
+ sqlPrefix.startsWith('drop') ||
+ sqlPrefix.startsWith('create')
) {
const res: any = await ElMessageBox.prompt('请输入备注', 'Tip', {
confirmButtonText: '确定',
@@ -320,6 +323,18 @@ const onRunSql = async (newTab = false) => {
return;
}
+ // 启用工单审批
+ if (execRemark && getNowDbInst().flowProcdefKey) {
+ try {
+ await getNowDbInst().runSql(props.dbName, sql, execRemark);
+ ElMessage.success('工单提交成功');
+ return;
+ } catch (e) {
+ ElMessage.success('工单提交失败');
+ return;
+ }
+ }
+
let execRes: ExecResTab;
let i = 0;
let id;
diff --git a/mayfly_go_web/src/views/ops/db/component/sqleditor/SqlExecBox.ts b/mayfly_go_web/src/views/ops/db/component/sqleditor/SqlExecBox.ts
index b026a8c1..d06aa87f 100644
--- a/mayfly_go_web/src/views/ops/db/component/sqleditor/SqlExecBox.ts
+++ b/mayfly_go_web/src/views/ops/db/component/sqleditor/SqlExecBox.ts
@@ -6,6 +6,7 @@ export type SqlExecProps = {
dbId: number;
db: string;
dbType?: string;
+ flowProcdefKey?: string;
runSuccessCallback?: Function;
cancelCallback?: Function;
};
diff --git a/mayfly_go_web/src/views/ops/db/component/sqleditor/SqlExecDialog.vue b/mayfly_go_web/src/views/ops/db/component/sqleditor/SqlExecDialog.vue
index 22cc9934..a02d50a4 100644
--- a/mayfly_go_web/src/views/ops/db/component/sqleditor/SqlExecDialog.vue
+++ b/mayfly_go_web/src/views/ops/db/component/sqleditor/SqlExecDialog.vue
@@ -3,6 +3,12 @@
+
+
+