|
@@ -103,13 +103,28 @@ const setStatus = async (row: any, status: number) => {
|
|
|
|
|
|
const edit = async (row: any) => {
|
|
|
localStorage.setItem('auth-tokens', `{"access_token":"${Session.get('token')}"}`);
|
|
|
- const url =
|
|
|
- window.location.protocol + '//' + window.location.hostname + ':1880/rule-engine?access_token=' + Session.get('token') + '#flow/' + row.flowId;
|
|
|
- // const url = '/rule-engine/#flow/' + row.flowId;
|
|
|
+ // const url = window.location.protocol + '//' + window.location.hostname + ':1880/rule-engine?access_token=' + Session.get('token') + '#flow/' + row.flowId;
|
|
|
+ const url = '/rule-engine/#flow/' + row.flowId;
|
|
|
window.open(url);
|
|
|
};
|
|
|
|
|
|
-const onDel = (row: any) => {
|
|
|
+const onDel = async (row: any) => {
|
|
|
+ // 找到所有规则
|
|
|
+ const { data: flows } = await axios.get(flowsUrl, { headers });
|
|
|
+
|
|
|
+ const flowIndex = flows.findIndex((item: any) => item.id === row.flowId);
|
|
|
+
|
|
|
+ if (!flowIndex) {
|
|
|
+ ElMessage.error('规则不存在');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除指定规则
|
|
|
+ flows.splice(flowIndex, 1);
|
|
|
+
|
|
|
+ // 设置规则状态
|
|
|
+ await axios.post(flowsUrl, flows, { headers });
|
|
|
+
|
|
|
ElMessageBox.confirm(`此操作将删除:“${row.name}”,是否继续?`, '提示', {
|
|
|
confirmButtonText: '确认',
|
|
|
cancelButtonText: '取消',
|