riku
2024-11-14 2a04ae9a602c88c1c8a16da154c3a51075e88d86
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
const app = getApp();
const Towns = {
  // 静安区
  310106: [
    { label: '大宁路街道', value: '    310106019' },
    { label: '彭浦新村街道', value: '    310106020' },
    { label: '临汾路街道', value: '    310106021' },
    { label: '芷江西路街道', value: '    310106022' },
    { label: '彭浦镇', value: '    310106101' },
    { label: '江宁路街道', value: '    310106006' },
    { label: '石门二路街道', value: '    310106011' },
    { label: '南京西路街道', value: '    310106012' },
    { label: '静安寺街道', value: '    310106013' },
    { label: '曹家渡街道', value: '    310106014' },
    { label: '天目西路街道', value: '    310106015' },
    { label: '北站街道', value: '    310106016' },
    { label: '宝山路街道', value: '    310106017' },
    { label: '共和新路街道', value: '    310106018' },
  ],
  // 徐汇区
  310104: [
    { label: '漕河泾新兴技术开发区', value: '    310104501' },
    { label: '湖南路街道', value: '    310104004' },
    { label: '天平路街道', value: '    310104003' },
    { label: '虹梅路街道', value: '    310104012' },
    { label: '枫林路街道', value: '    310104008' },
    { label: '斜土路街道', value: '    310104007' },
    { label: '长桥街道', value: '    310104010' },
    { label: '田林街道', value: '    310104011' },
    { label: '康健新村街道', value: '    310104013' },
    { label: '徐家汇街道', value: '    310104014' },
    { label: '凌云路街道', value: '    310104015' },
    { label: '龙华街道', value: '    310104016' },
    { label: '漕河泾街道', value: '    310104017' },
    { label: '华泾镇', value: '    310104103' },
  ],
  // 金山区
  310116: [
    { label: '张堰镇', value: '    310116103' },
    { label: '亭林镇', value: '    310116104' },
    { label: '吕巷镇', value: '    310116105' },
    { label: '廊下镇', value: '    310116107' },
    { label: '高新区', value: '    310116503' },
    { label: '金山卫镇', value: '    310116109' },
    { label: '漕泾镇', value: '    310116112' },
    { label: '山阳镇', value: '    310116113' },
    { label: '石化街道', value: '    310116001' },
    { label: '朱泾镇', value: '    310116101' },
    { label: '枫泾镇', value: '    310116102' },
    { label: '碳谷绿湾', value: '    9000' },
  ],
  // 普陀区
  310107: [
    { label: '曹杨新村街道', value: '    310107005' },
    { label: '万里街道', value: '    310107021' },
    { label: '真如镇街道', value: '    310107022' },
    { label: '长征镇', value: '    310107102' },
    { label: '桃浦镇', value: '    310107103' },
    { label: '石泉路街道', value: '    310107017' },
    { label: '甘泉路街道', value: '    310107016' },
    { label: '长寿路街道', value: '    310107015' },
    { label: '长风新村街道', value: '    310107014' },
    { label: '宜川路街道', value: '    310107020' },
  ],
  // 闵行区
  310112: [
    { label: '江川路街道', value: '    310112001' },
    { label: '古美街道', value: '    310112006' },
    { label: '新虹街道', value: '    310112008' },
    { label: '浦锦街道', value: '    310112009' },
    { label: '莘庄镇', value: '    310112101' },
    { label: '七宝镇', value: '    310112102' },
    { label: '颛桥镇', value: '    310112103' },
    { label: '华漕镇', value: '    310112106' },
    { label: '虹桥镇', value: '    310112107' },
    { label: '梅陇镇', value: '    310112108' },
    { label: '吴泾镇', value: '    310112110' },
    { label: '马桥镇', value: '    310112112' },
    { label: '浦江镇', value: '    310112114' },
    { label: '莘庄工业区', value: '    310112501' },
  ],
};
 
function choseTownList(districtCode) {
  let towns = [];
  let code = districtCode ? districtCode : '310106';
  let bInfo = app.globalData.userConfig;
  if (bInfo && bInfo.ucTownCode) {
    towns.push({
      label: bInfo.ucTownName,
      value: bInfo.ucTownCode,
    });
  } else if (bInfo && (bInfo.ucArea || bInfo.ucManagementCompany)) {
    towns.unshift({ label: '全部', value: null });
  } else {
    Towns[districtCode].forEach(d => {
      towns.push(d);
    });
    towns.unshift({ label: '全部', value: null });
  }
  return towns;
}
 
function toLabel(value) {
  for (const iterator of Towns) {
    let r = iterator.value.find(item => {
      return item.value == value;
    });
    if (r) {
      return r.label;
    }
  }
}
 
function toValue(label) {
  for (const iterator of Towns) {
    let r = iterator.value.find(item => {
      return item.label == label;
    });
    if (r) {
      return r.value;
    }
  }
}
 
export { Towns, choseTownList, toLabel, toValue };