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
| <template>
| <div>
| <el-cascader
| v-model="newRegion"
| placeholder="选择省/市"
| :options="options"
| clearable
| style="flex:1"
| />
| </div>
| </template>
|
| <script>
| export default {
| data() {
| return {
| form: {
| name: '',
| region: '',
| date1: '',
| date2: '',
| delivery: false,
| type: [],
| resource: '',
| desc: ''
| },
| options: [],
| newRegion: []
| }
| },
| watch: {
| newRegion(n, o) {
| this.$emit('regionCode', n[this.newRegion.length - 1])
| }
| },
| created() {
| const runAsync = new Promise((resolve, reject) => {
| this.$request({
| url: '/organization/getMapPath',
| method: 'get',
| params: {
| organizationId: this.$store.state.orgId
| }
| }).then(res => {
| // console.log(res)
| const data = res.data
| for (let i = 0; i < data.length; i++) {
| this.options.push({
| value: data[i].provinceCode,
| label: data[i].provinceName
| })
| this.options[i].children = []
| for (let j = 0; j < data[i].cities.length; j++) {
| this.options[i].children.push({
| value: data[i].cities[j].cityCode,
| label: data[i].cities[j].cityName
| })
| }
| }
| resolve() // 执行resolve函数后,会执行 then函数
| }
| )
| .catch(err => {
| console.log('请求Region失败')
| console.log(err)
| })
| })
| runAsync.then(() => {
| this.newRegion = [Number(this.$store.state.regionCode.toString().substr(0, 2) + '0000'),
| Number(this.$store.state.regionCode.toString().substr(0, 4) + '00')]
| })
| }
| }
| </script>
|
| <style scoped>
| .line{
| text-align: center;
| }
| </style>
|
|