quanyawei
2024-04-22 b487b91abd2a0d769b82ddf90924f93afe9b05b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<template>
<a-form style="margin-top: 8px" :form="form">
    <a-modal class="modelSize" title="配置坐标" destroyOnClose :visible="visible" @cancel="handleCancel">
        <!-- <div id="map"></div> -->
        <BaiduMap class="bm-view" :center="center" :zoom="zoom" @ready="handler" ak="9FrZ6v3P8xS290ygi40M5Ik3Fgwes4KY"></BaiduMap>
        <template slot="footer">
            <a-button key="cancel" @click="handleCancel">
                取消
            </a-button>
            <a-button key="forward" type="primary" @click="handleOk">
                完成
            </a-button>
        </template>
    </a-modal>
</a-form>
</template>
 
<script lang="ts">
 
import {
    Component,
    Prop,
    Vue,
    Emit,
    Model,
    Watch,
} from 'vue-property-decorator';
import { get, post } from "@/util/request";
import BaiduMap from 'vue-baidu-map/components/map/Map.vue'
@Component({
    components: {
        BaiduMap
    },
})
export default class UpdateTaskForm extends Vue {
    @Prop({
        type: Boolean,
        default: false,
    })
 
 
 
    private visible!: boolean;
 
    private defaultSelectedKeys:any;
    private defaultCheckedKeys:any;
 
    private replaceFields:any =  {
        children: 'child',
        title: 'name',
    }
 
    private center:any = null
 
    private zoom:any = null
 
    // 地图初始信息
    private mapInfo:any = {
        center: {lng: 116.404, lat: 39.915},
        zoom: 8
    }
 
    // 地图初始化
    // private initMap(){
 
    // }
    private handler (BMap:any, map:any) {
        setTimeout(()=>{
            this.mapInfo.center.lng = 116.404
            this.mapInfo.center.lat = 39.915
            this.mapInfo.zoom = 8
        },3000)
    }
 
    private idList:any;
 
    @Prop({
        type: Object,
        default() {
            return {};
        },
    })
    private record!: any;
 
    private form: any = null;
 
    private formVals: any = {
        target: '0',
        template: '0',
        type: '1',
        time: '',
        frequency: 'month',
    };
 
    private currentStep: number = 0;
 
    private formLayout = {
        labelCol: {
            span: 7,
        },
        wrapperCol: {
            span: 13,
        },
    };
 
 
    private onCheck(checkedKeys: any, info: any) {
      this.idList = checkedKeys
    }
 
    private handleBackward(): void {
        this.currentStep--;
    }
 
    private handleNext(): void {
        this.form.validateFields((err: any, fieldsValue: any) => {
            if (err) {
                return;
            }
            this.formVals = { ...this.formVals, ...fieldsValue };
            this.currentStep++;
        });
    }
 
    private handleCancel(): void {
        this.updateVisible(false);
        this.defaultSelectedKeys = []
        this.defaultCheckedKeys = []
    }
 
    private handleOk(): void {
        post('manageRole/updateRoleMenu', {menuIds:this.idList,id:this.record.id}).then((res) => {
            this.updateVisible(false);
            this.onOk();
            this.defaultSelectedKeys = []
            this.defaultCheckedKeys = []
        });
    }
 
    @Emit('ok')
    private onOk() {
 
    }
 
    private updateVisible(visible: boolean): void {
        this.$emit('update:visible', visible);
    }
 
    private mounted(): void {
    }
 
    @Watch('record', {
        immediate: true,
        deep: true,
    })
    private recordChange(value: any, oldValue: any): void {
        this.formVals = {
            ...value,
            ...this.formVals,
        };
        this.currentStep = 0;
    }
 
}
</script>
 
<style lang="less">
    .bm-view {
        width: 750px;
        height: 600px;
    }
    .modelSize{
        .ant-modal-content{
            width: 800px;
        }
        // .ant-form-item{
 
        // }
    }
</style>