| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <template>
- <div id="addObjToPlanContainer">
- <el-dialog v-if="showLeftTree" title="添加到督查计划" @close="closeHandler" :visible.sync="dialogFormVisible">
- <nodeTreeWithCheckBox @currentCheckedNodes="currentCheckedNodes"></nodeTreeWithCheckBox>
- <span slot="footer" class="dialog-footer" style="justify-content: flex-end;display: flex;">
- <el-button @click="dialogFormVisible=false">取 消</el-button>
- <el-button type="primary" @click="submitHandler">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import nodeTreeWithCheckBox from '../../../widgets/nodeTreeWithCheckBox.vue'
- import {addDcAndObjRel} from '../../../api/duChaDuiXiang_xsk_API.js'
- export default {
- components:{
- nodeTreeWithCheckBox
- },
- props: ['currentResCode','currentRsName','currentRsLong','currentRsLat'],
- data() {
- return {
- showLeftTree:false,
- dialogFormVisible:false,
- checkedNodes:[],//当前被选中的组
- currentResCode1:'',
- currentRsName1:'',
- currentRsLong1:'',
- currentRsLat1:'',
- };
- },
- watch:{
- currentCheckedNodes(n,o){
- this.checkedNodes = n;
- },
- currentResCode(n,o){
- this.currentResCode1 = n;
- },
- currentRsName(n,o){
- this.currentRsName1 = n;
- },
- currentRsLong(n,o){
- this.currentRsLong1 = n;
- },
- currentRsLat(n,o){
- this.currentRsLat1 = n;
- },
- },
- mounted(){
- this.dialogFormVisible = true;
- this.showLeftTree = true;
- this.currentResCode1 = this.currentResCode;
- this.currentRsName1 = this.currentRsName;
- this.currentRsLong1 = this.currentRsLong;
- this.currentRsLat1 = this.currentRsLat;
- },
- methods:{
- closeHandler(){
- this.showLeftTree = false;
- },
- currentCheckedNodes(item){
- this.checkedNodes = item;
- },
- showDialog(){
- this.dialogFormVisible = true;
- this.showLeftTree = true;
- },
- submitHandler(){
- var _self = this;
- console.log(_self.checkedNodes);
- if(!_self.currentRsLat1 || !_self.currentRsLong1){
- addDcAndObjRel(_self.currentResCode1,
- _self.currentRsName1,
- "",
- "",
- '1',
- _self.checkedNodes[_self.checkedNodes.length - 1].id).then((res)=>{
- if(res.success){
- _self.$message.success("添加成功");
- _self.$emit('addPbjToPlanSucc');
- _self.dialogFormVisible = false;
- }else{
- if(res.code == 201){
- _self.$message.warning(res.message);
- }
- }
- })
- }else{
- addDcAndObjRel(_self.currentResCode1,
- _self.currentRsName1,
- _self.currentRsLat1,
- _self.currentRsLong1,
- '1',
- _self.checkedNodes[_self.checkedNodes.length - 1].id).then((res)=>{
- if(res.success){
- _self.$message.success("添加成功");
- _self.$emit('addPbjToPlanSucc');
- _self.dialogFormVisible = false;
- }else{
- if(res.code == 201){
- _self.$message.warning(res.message);
- }
- }
- })
- }
- }
- }
- };
- </script>
- <style>
- </style>
|