41b1530a475aa13283cab1c8d95925e0a201f8ab.svn-base 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. console.log(_self.checkedNodes);
  70. if(!_self.currentRsLat1 || !_self.currentRsLong1){
  71. addDcAndObjRel(_self.currentResCode1,
  72. _self.currentRsName1,
  73. "",
  74. "",
  75. '1',
  76. _self.checkedNodes[_self.checkedNodes.length - 1].id).then((res)=>{
  77. if(res.success){
  78. _self.$message.success("添加成功");
  79. _self.$emit('addPbjToPlanSucc');
  80. _self.dialogFormVisible = false;
  81. }else{
  82. if(res.code == 201){
  83. _self.$message.warning(res.message);
  84. }
  85. }
  86. })
  87. }else{
  88. addDcAndObjRel(_self.currentResCode1,
  89. _self.currentRsName1,
  90. _self.currentRsLat1,
  91. _self.currentRsLong1,
  92. '1',
  93. _self.checkedNodes[_self.checkedNodes.length - 1].id).then((res)=>{
  94. if(res.success){
  95. _self.$message.success("添加成功");
  96. _self.$emit('addPbjToPlanSucc');
  97. _self.dialogFormVisible = false;
  98. }else{
  99. if(res.code == 201){
  100. _self.$message.warning(res.message);
  101. }
  102. }
  103. })
  104. }
  105. }
  106. }
  107. };
  108. </script>
  109. <style>
  110. </style>