ef9e86a01e315d09f636bd5591626aab33c02257.svn-base 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div id="addObjToPlanContainer">
  3. <el-dialog v-if="showLeftTree" title="添加到督查计划" @close="closeHandler" :visible.sync="dialogFormVisible">
  4. <nodeTreeWithCheckBox @currentCheckedNodes="currentCheckedNodes"></nodeTreeWithCheckBox>
  5. <span slot="footer" class="dialog-footer" style="justify-content: flex-end;display: flex;">
  6. <el-button @click="dialogFormVisible=false">取 消</el-button>
  7. <el-button type="primary" @click="submitHandler">确 定</el-button>
  8. </span>
  9. </el-dialog>
  10. </div>
  11. </template>
  12. <script>
  13. import nodeTreeWithCheckBox from '../../../widgets/nodeTreeWithCheckBox.vue'
  14. import {addDcAndObjRel} from '../../../api/duChaDuiXiang_xsk_API.js'
  15. export default {
  16. components:{
  17. nodeTreeWithCheckBox
  18. },
  19. props: ['currentResCode','currentRsName','currentRsLong','currentRsLat'],
  20. data() {
  21. return {
  22. showLeftTree:false,
  23. dialogFormVisible:false,
  24. checkedNodes:[],//当前被选中的组
  25. currentResCode1:'',
  26. currentRsName1:'',
  27. currentRsLong1:'',
  28. currentRsLat1:'',
  29. };
  30. },
  31. watch:{
  32. currentCheckedNodes(n,o){
  33. this.checkedNodes = n;
  34. },
  35. currentResCode(n,o){
  36. this.currentResCode1 = n;
  37. },
  38. currentRsName(n,o){
  39. this.currentRsName1 = n;
  40. },
  41. currentRsLong(n,o){
  42. this.currentRsLong1 = n;
  43. },
  44. currentRsLat(n,o){
  45. this.currentRsLat1 = n;
  46. },
  47. },
  48. mounted(){
  49. this.dialogFormVisible = true;
  50. this.showLeftTree = true;
  51. this.currentResCode1 = this.currentResCode;
  52. this.currentRsName1 = this.currentRsName;
  53. this.currentRsLong1 = this.currentRsLong;
  54. this.currentRsLat1 = this.currentRsLat;
  55. },
  56. methods:{
  57. closeHandler(){
  58. this.showLeftTree = false;
  59. },
  60. currentCheckedNodes(item){
  61. this.checkedNodes = item;
  62. },
  63. showDialog(){
  64. this.dialogFormVisible = true;
  65. this.showLeftTree = true;
  66. },
  67. submitHandler(){
  68. var _self = this;
  69. for(var i=0;i<_self.checkedNodes.length;i++){
  70. addDcAndObjRel(_self.currentResCode1,
  71. _self.currentRsName1,
  72. _self.currentRsLat1,
  73. _self.currentRsLong1,
  74. '1',
  75. _self.checkedNodes[i].id).then((res)=>{
  76. if(res.success){
  77. _self.$message.success("添加成功");
  78. _self.$emit('addPbjToPlanSucc');
  79. _self.dialogFormVisible = false;
  80. }else{
  81. if(res.code == 201){
  82. _self.$message.warning(res.message);
  83. }
  84. }
  85. })
  86. }
  87. }
  88. }
  89. };
  90. </script>
  91. <style>
  92. </style>