|
@@ -282,10 +282,10 @@
|
|
|
<el-button @click="addEleRow(editEleList)" type="text" icon="el-icon-circle-plus-outline" class="text-icon"></el-button>
|
|
|
</template>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button v-if="scope.row.id" icon="el-icon-remove-outline" type="text" @click="delEleRow(scope.$index,editEleList)" class="text-icon text-icon-danger"></el-button>
|
|
|
+ <el-button v-if="scope.row.id" icon="el-icon-remove-outline" type="text" @click="delEleRowHandle(scope.$index,editEleList)" class="text-icon text-icon-danger"></el-button>
|
|
|
<div class="flex" v-else>
|
|
|
<el-button @click="saveNewEle(scope.row)" type="mini">保存</el-button>
|
|
|
- <el-button icon="el-icon-remove-outline" type="text" @click="delEleRow(scope.$index,editEleList)" class="text-icon text-icon-danger"></el-button>
|
|
|
+ <el-button icon="el-icon-remove-outline" type="text" @click="delEleRowHandle(scope.$index,editEleList)" class="text-icon text-icon-danger"></el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -301,7 +301,7 @@
|
|
|
<script>
|
|
|
import {getLazytree,getDetail,update,selectByNodeTable,
|
|
|
saveFormAndElement,selectFormElements,removeTableById} from "@/api/manager/wbstree";
|
|
|
- import {saveElement} from "@/api/manager/wbsformelement"
|
|
|
+ import {saveElement,remove as removeElement,updateBatchElements} from "@/api/manager/wbsformelement"
|
|
|
import {getDictionary} from "@/api/system/dict";
|
|
|
import {mapGetters} from "vuex";
|
|
|
export default {
|
|
@@ -575,11 +575,59 @@
|
|
|
row.eAllowDeviation = (row.allow?row.allow:'') + (row.deviation?row.deviation:'');
|
|
|
row.fId = this.curEleTable.id;
|
|
|
saveElement(row).then((res)=>{
|
|
|
- row.id = res.data.data.id;
|
|
|
+ if(res.data.data){
|
|
|
+ this.$set(row,'id',res.data.data);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "保存成功!"
|
|
|
+ });
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
+ delEleRowHandle(index,list){
|
|
|
+ let row = list[index];
|
|
|
+ if(row.id){
|
|
|
+ //有id需要请求删除
|
|
|
+ this.$confirm('是否确认删除?', '删除元素', {
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ confirmButtonText: '删除',
|
|
|
+ cancelButtonText: '取消'
|
|
|
+ }).then(() => {
|
|
|
+ removeElement(row.id).then(()=>{
|
|
|
+ list.splice(index,1);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ list.splice(index,1);
|
|
|
+ }
|
|
|
+ },
|
|
|
saveEles(){
|
|
|
-
|
|
|
+ for (let i = 0; i < this.editEleList.length; i++) {
|
|
|
+ if(!this.editEleList[i].id){
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "请先将新增的元素点击保存"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(this.editEleList.length > 0){
|
|
|
+ updateBatchElements(this.editEleList).then(()=>{
|
|
|
+ this.editEleVisible = false;
|
|
|
+ this.updateNodeTable();
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "保存成功!"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.editEleVisible = false;
|
|
|
+ this.updateNodeTable();
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "保存成功!"
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
getDeptCategorylist(){
|