fix bug for edit project add replica feature

This commit is contained in:
Eleven 2021-01-14 10:45:07 +08:00
parent 39211f1fd5
commit 914466a800
3 changed files with 65 additions and 24 deletions

View File

@ -35,6 +35,34 @@ export function editDispatch(params) {
})
}
/**
* 编辑分发项目
* @param {
* id: 分发 ID
* name: 分发名称
* reqId: 请求 ID
* type: 类型 add | edit
* afterOpt: 发布后操作
* runMode: 运行方式
* mainClass: 启动类
* javaExtDirsCp: 目录地址
* whitelistDirectory: 白名单地址
* lib: lib
* add_xxx: xxx 表示添加的节点信息
* xxx_token: xxx 节点的 webhook 地址
* xxx_jvm: jvm 参数
* xxx_args: args 参数
* xxx_javaCopyIds: xxx 节点副本 ID 如果有副本还需要加上 xxx_jvm_${副本ID} | xxx_args_${副本ID} 参数
* } params
*/
export function editDispatchProject(params) {
return axios({
url: '/outgiving/save_project',
method: 'post',
data: params
})
}
/**
* 删除分发
* @param {*} id 分发 ID

View File

@ -20,7 +20,8 @@
</template>
<template slot="operation" slot-scope="text, record">
<a-button type="primary" @click="handleDispatch(record)">分发文件</a-button>
<a-button type="primary" @click="handleEdit(record)">编辑</a-button>
<a-button type="primary" v-if="record.outGivingProject" @click="handleEditDispatchProject(record)">编辑</a-button>
<a-button type="primary" v-else @click="handleEditDispatch(record)">编辑</a-button>
<a-button type="danger" @click="handleDelete(record)">删除</a-button>
</template>
<!-- 嵌套表格 -->
@ -109,6 +110,7 @@
<a-select-option :key="3">顺序重启(有重启失败将继续)</a-select-option>
</a-select>
</a-form-model-item>
</a-form-model>
</a-modal>
<!-- 项目文件组件 -->
@ -126,7 +128,7 @@
<script>
import File from '../node/node-layout/project/project-file';
import Console from '../node/node-layout/project/project-console';
import { getDishPatchList, getReqId, editDispatch, getDispatchWhiteList, deleteDisPatch } from '../../api/dispatch';
import { getDishPatchList, getReqId, editDispatch, /*editDispatchProject,*/ getDispatchWhiteList, deleteDisPatch } from '../../api/dispatch';
import { getNodeProjectList } from '../../api/node'
export default {
components: {
@ -270,7 +272,7 @@ export default {
this.loadData();
this.loadNodeProjectList();
},
//
//
handleLink() {
this.temp = {
type: 'add'
@ -278,28 +280,22 @@ export default {
this.loadReqId();
this.linkDispatchVisible = true;
},
//
handleEdit(record) {
//
handleEditDispatch(record) {
this.temp = Object.assign({}, record)
this.temp.type = 'edit';
//
if (this.temp.outGivingProject) {
this.loadAccesList();
this.editDispatchVisible = true;
} else {
this.targetKeys = [];
//
record.outGivingNodeProjectList.forEach(ele => {
if (!this.temp.projectId) {
this.temp.projectId = ele.projectId;
}
this.targetKeys.push(ele.nodeId);
})
this.loadReqId();
this.linkDispatchVisible = true;
}
this.targetKeys = [];
//
record.outGivingNodeProjectList.forEach(ele => {
if (!this.temp.projectId) {
this.temp.projectId = ele.projectId;
}
this.targetKeys.push(ele.nodeId);
})
this.loadReqId();
this.linkDispatchVisible = true;
},
//
//
handleAdd() {
this.temp = {
type: 'add'
@ -307,6 +303,14 @@ export default {
this.loadAccesList();
this.editDispatchVisible = true;
},
//
handleEditDispatchProject(record) {
this.temp = Object.assign({}, record)
this.temp.type = 'edit';
this.loadAccesList();
this.loadReqId();
this.editDispatchVisible = true;
},
//
selectProject(value) {
this.targetKeys = [];

View File

@ -292,8 +292,16 @@ export default {
}
getProjectById(params).then(res => {
if (res.code === 200) {
this.temp = res.data;
this.temp.type = 'edit';
this.temp = {
...res.data,
type: 'edit'
};
if (!this.temp.javaCopyItemList) {
this.temp = {
...this.temp,
javaCopyItemList: []
};
}
this.editProjectVisible = true;
}
})
@ -313,6 +321,7 @@ export default {
args: '',
deleteAble: true
})
console.log(this.temp)
},
//
handleDeleteReplica(reeplica) {