浏览代码

Editign, Login and Users

master
Lene Scholtz 5 年前
父节点
当前提交
7bb9cb2351

+ 10
- 2
src/assets/staticData/maritalStatus.js 查看文件

@@ -1,4 +1,12 @@
1
-const items = ['ICOP (In Community of Property)', 'OCOP (Out of Community of Property)', 'Other',
2
-  'Traditional Wedding', 'Single', 'Divorced', 'Widow', 'Committed Relationship', 'Partner',
1
+const items = [
2
+  { id: 1, description: 'ICOP (In Community of Property)' },
3
+  { id: 2, description: 'OCOP (Out of Community of Property)' },
4
+  { id: 3, description: 'Other' },
5
+  { id: 4, description: 'Traditional Wedding' },
6
+  { id: 5, description: 'Single' },
7
+  { id: 6, description: 'Divorced' },
8
+  { id: 7, description: 'Widow' },
9
+  { id: 8, description: 'Committed Relationship' },
10
+  { id: 9, description: 'Partner' },
3 11
 ];
4 12
 export default items;

+ 5
- 2
src/components/admin/status/agentsUserManagementPage.vue 查看文件

@@ -53,7 +53,7 @@
53 53
       <table class="table table-bordered">
54 54
         <thead>
55 55
           <tr>
56
-            <td colspan="10">
56
+            <td colspan="11">
57 57
               <div class="myWell">
58 58
                 <h4>Agents</h4>
59 59
               </div>
@@ -90,6 +90,9 @@
90 90
             <th>
91 91
               <b>Remove</b>
92 92
             </th>
93
+            <th>
94
+              <b>Soft Delete</b>
95
+            </th>
93 96
           </tr>
94 97
         </thead>
95 98
         <tbody>
@@ -121,6 +124,7 @@
121 124
                 style="width: 85px; height:40px; color:#60CBEB"
122 125
               >Delete</button>
123 126
             </td>
127
+            <td>{{ item.isDeleted}}</td>
124 128
           </tr>
125 129
         </tbody>
126 130
       </table>
@@ -169,7 +173,6 @@ export default {
169 173
       visibleItemsPerPageCount: 0,
170 174
       currentPage: 1,
171 175
       item: {},
172
-      delete: false,
173 176
     };
174 177
   },
175 178
   methods: {

+ 5
- 1
src/components/admin/status/userManagementPage.vue 查看文件

@@ -35,7 +35,7 @@
35 35
       <table class="table table-bordered">
36 36
         <thead>
37 37
           <tr>
38
-            <td colspan="10">
38
+            <td colspan="11">
39 39
               <div class="myWell">
40 40
                 <h4>Private Users</h4>
41 41
               </div>
@@ -72,6 +72,9 @@
72 72
             <th>
73 73
               <b>Remove</b>
74 74
             </th>
75
+            <th>
76
+              <b>Soft Delete</b>
77
+            </th>
75 78
           </tr>
76 79
         </thead>
77 80
         <tbody>
@@ -103,6 +106,7 @@
103 106
                 style="margin:2px; color: #60CBEB"
104 107
               >Delete</button>
105 108
             </td>
109
+            <td>{{ item.isDeleted }}</td>
106 110
           </tr>
107 111
         </tbody>
108 112
       </table>

+ 113
- 80
src/components/misc/address.vue 查看文件

@@ -10,102 +10,67 @@
10 10
       <div class="row" style="text-align:left">
11 11
         <div class="col-md-6" style="margin-bottom: 1em">
12 12
           <label>Street Number *</label>
13
-          <div class="input-group-prepend">
14
-            <span class="input-group-text">
15
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
16
-            </span>
17
-            <input
18
-              class="form-control"
19
-              type="text"
20
-              name="streetnumber"
21
-              v-model="address.streetNumber"
22
-            />
23
-          </div>
13
+          <prop-field
14
+            :display="address.streetNumber"
15
+            :editType="'text'"
16
+            :propertyName="'streetNumber'"
17
+            :mayEdit="true"
18
+            @UpdateValue="UpdateValue"
19
+          />
24 20
         </div>
25 21
         <div class="col-md-6" style="margin-bottom: 1em">
26 22
           <label>Street Name *</label>
27
-          <div class="input-group-prepend">
28
-            <span class="input-group-text">
29
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
30
-            </span>
31
-            <input class="form-control" type="text" name="streetname" v-model="address.streetName" />
32
-          </div>
23
+          <prop-field
24
+            :display="address.street"
25
+            :editType="'text'"
26
+            :propertyName="'street'"
27
+            :mayEdit="true"
28
+            @UpdateValue="UpdateValue"
29
+          />
33 30
         </div>
34 31
         <div class="col-md-6" style="margin-bottom: 1em">
35 32
           <label>Province *</label>
36
-          <div class="input-group-prepend">
37
-            <span class="input-group-text">
38
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
39
-            </span>
40
-            <select
41
-              class="form-control"
42
-              name="propertyType"
43
-              id="propertyType"
44
-              @change="ProvinceSelected"
45
-              v-model="address.province"
46
-            >
47
-              <option value="0">Please select province</option>
48
-              <option
49
-                v-for="province in provinces"
50
-                :value="province.id"
51
-                :key="province.description"
52
-              >{{ province.description }}</option>
53
-            </select>
54
-          </div>
33
+          <propField
34
+            :display="address.province"
35
+            :editType="'selector'"
36
+            :arrayObject="provinces"
37
+            :propertyName="'province'"
38
+            :mayEdit="true"
39
+            @UpdateValue="UpdateValue"
40
+          />
55 41
         </div>
56 42
 
57 43
         <div class="col-md-6" style="margin-bottom: 1em">
58 44
           <label>City *</label>
59
-          <div class="input-group-prepend">
60
-            <span class="input-group-text">
61
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
62
-            </span>
63
-            <select
64
-              class="form-control"
65
-              name="propertyType"
66
-              id="propertyType"
67
-              @change="CitySelected"
68
-              v-model="address.city"
69
-            >
70
-              <option value="0">Please select city</option>
71
-              <option
72
-                v-for="city in cities"
73
-                :value="city.description"
74
-                :key="city.id"
75
-              >{{ city.description }}</option>
76
-            </select>
77
-          </div>
45
+          <propField
46
+            :display="address.city"
47
+            :editType="'selector'"
48
+            :arrayObject="cities"
49
+            :propertyName="'city'"
50
+            :mayEdit="true"
51
+            @UpdateValue="UpdateValue"
52
+          />
78 53
         </div>
79 54
         <div class="col-md-6" style="margin-bottom: 1em">
80 55
           <label>Suburb *</label>
81
-          <div class="input-group-prepend">
82
-            <span class="input-group-text">
83
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
84
-            </span>
85
-            <select
86
-              class="form-control"
87
-              name="propertyType"
88
-              id="suburbselector"
89
-              v-model="address.suburb"
90
-              @change="getPostalCode"
91
-            >
92
-              <option value="0">Please select suburb</option>
93
-              <option
94
-                v-for="suburb in suburbs"
95
-                :value="suburb.description"
96
-                :key="suburb.description"
97
-              >{{ suburb.description }}</option>
98
-            </select>
99
-          </div>
56
+          <propField
57
+            :display="address.suburb"
58
+            :editType="'selector'"
59
+            :arrayObject="suburbs"
60
+            :propertyName="'suburb'"
61
+            :mayEdit="true"
62
+            @UpdateValue="UpdateValue"
63
+          />
100 64
         </div>
101 65
         <div class="col-md-6" style="margin-bottom: 1em">
102 66
           <label>Postal Code *</label>
103
-          <div class="input-group-prepend">
104
-            <span class="input-group-text">
105
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
106
-            </span>
107
-            <input class="form-control" type="text" name="postalcode" v-model="address.postalCode" />
108
-          </div>
67
+          <propField
68
+            :display="address.postalCode"
69
+            :editType="'text'"
70
+            :propertyName="'postalCode'"
71
+            :mayEdit="true"
72
+            @UpdateValue="UpdateValue"
73
+          />
109 74
         </div>
110 75
       </div>
111 76
     </div>
@@ -114,8 +79,12 @@
114 79
 
115 80
 <script>
116 81
 import { mapState, mapActions } from 'vuex';
82
+import propField from '../property/propertyFieldEditor.vue';
117 83
 
118 84
 export default {
85
+  components: {
86
+    propField,
87
+  },
119 88
   data() {
120 89
     return {
121 90
       propertyType: 'Residential',
@@ -155,6 +124,70 @@ export default {
155 124
         item.target.options.selectedIndex - 1
156 125
       ].postalCode;
157 126
     },
127
+    UpdateValue(item) {
128
+      if (item.fieldName) {
129
+        if (item.fieldName === 'streetNumber') {
130
+          this.address.streetNumber = item.value;
131
+        }
132
+        if (item.fieldName === 'street') {
133
+          this.address.street = item.value;
134
+        }
135
+        if (item.fieldName === 'province') {
136
+          if (item.value !== '') {
137
+            this.address.province = item.value;
138
+            this.getCities(Object.assign({}, { province: item.value }));
139
+            this.address.city = null;
140
+            this.address.suburb = null;
141
+            this.address.postalCode = '';
142
+          } else {
143
+            this.address.province = null;
144
+            this.address.city = null;
145
+            this.address.suburb = null;
146
+            this.address.postalCode = '';
147
+            this.cities = [];
148
+            this.suburbs = [];
149
+          }
150
+        }
151
+        if (item.fieldName === 'city') {
152
+          if (item.value !== '') {
153
+            this.address.city = item.value;
154
+            // this.address.city = newCity;
155
+            // this.address.cityId = newCity.id;
156
+            this.getSuburbs(
157
+              Object.assign(
158
+                {},
159
+                {
160
+                  province: item.value,
161
+                  city: item.value,
162
+                },
163
+              ),
164
+            );
165
+            this.address.suburb = null;
166
+            this.address.postalCode = '';
167
+          } else {
168
+            this.address.city = null;
169
+            this.address.suburb = null;
170
+            this.address.postalCode = '';
171
+            this.suburbs = [];
172
+          }
173
+        }
174
+        if (item.fieldName === 'suburb') {
175
+          if (item.value !== '') {
176
+            // const newSuburb = this.suburbs.find(
177
+            //   p => p.description === item.value,
178
+            // );
179
+            // this.address.suburb = newSuburb;
180
+            // this.address.suburbId = newSuburb.id;
181
+            console.log(item.value);
182
+            this.address.suburb = item.value;
183
+            this.address.postalCode = this.address.suburb.postalCode;
184
+          } else {
185
+            this.address.suburb = null;
186
+            this.address.postalCode = '';
187
+          }
188
+        }
189
+      }
190
+    },
158 191
   },
159 192
   mounted() {
160 193
     this.getProvince();

+ 41
- 18
src/components/shared/bankAccount.vue 查看文件

@@ -10,30 +10,33 @@
10 10
       <div class="row" style="text-align:left">
11 11
         <div class="col-md-6" style="margin-bottom: 1em">
12 12
           <label>Bank *</label>
13
-          <div class="input-group-prepend">
14
-            <span class="input-group-text">
15
-              <eva-icon name="behance-outline" fill="#60CBEB"></eva-icon>
16
-            </span>
17
-            <input class="form-control" type="text" name="bank" v-model="bank.bank" />
18
-          </div>
13
+          <prop-field
14
+            :display="bank.bank"
15
+            :editType="'text'"
16
+            :propertyName="'bankID'"
17
+            :mayEdit="true"
18
+            @UpdateValue="UpdateValue"
19
+          />
19 20
         </div>
20 21
         <div class="col-md-6" style="margin-bottom: 1em">
21 22
           <label>Account Number *</label>
22
-          <div class="input-group-prepend">
23
-            <span class="input-group-text">
24
-              <eva-icon name="navigation-outline" fill="#60CBEB"></eva-icon>
25
-            </span>
26
-            <input class="form-control" type="text" name="accountnumber" v-model="bank.accNumber" />
27
-          </div>
23
+          <prop-field
24
+            :display="bank.accNumber"
25
+            :editType="'text'"
26
+            :propertyName="'accountNumber'"
27
+            :mayEdit="true"
28
+            @UpdateValue="UpdateValue"
29
+          />
28 30
         </div>
29 31
         <div class="col-md-6" style="margin-bottom: 1em">
30 32
           <label>Account Holder *</label>
31
-          <div class="input-group-prepend">
32
-            <span class="input-group-text">
33
-              <eva-icon name="person-done-outline" fill="#60CBEB"></eva-icon>
34
-            </span>
35
-            <input class="form-control" type="text" name="accountholder" v-model="bank.accHolder" />
36
-          </div>
33
+          <prop-field
34
+            :display="bank.accHolder"
35
+            :editType="'text'"
36
+            :propertyName="'accountHolder'"
37
+            :mayEdit="true"
38
+            @UpdateValue="UpdateValue"
39
+          />
37 40
         </div>
38 41
       </div>
39 42
     </div>
@@ -41,8 +44,13 @@
41 44
 </template>
42 45
 
43 46
 <script>
47
+import propField from '../property/propertyFieldEditor.vue';
48
+
44 49
 export default {
45 50
   name: 'BankAccount',
51
+  components: {
52
+    propField,
53
+  },
46 54
   props: {
47 55
     bank: {
48 56
       bank: undefined,
@@ -50,6 +58,21 @@ export default {
50 58
       accHolder: undefined,
51 59
     },
52 60
   },
61
+  methods: {
62
+    UpdateValue(item) {
63
+      if (item.fieldName) {
64
+        if (item.fieldName === 'bank') {
65
+          this.bank.bank = item.value;
66
+        }
67
+        if (item.fieldName === 'accNumber') {
68
+          this.bank.accNumber = item.value;
69
+        }
70
+        if (item.fieldName === 'accHolder') {
71
+          this.bank.accHolder = item.value;
72
+        }
73
+      }
74
+    },
75
+  },
53 76
 };
54 77
 </script>
55 78
 

+ 3
- 1
src/components/shared/listView.vue 查看文件

@@ -145,12 +145,14 @@ export default {
145 145
     title: {
146 146
       default: undefined,
147 147
     },
148
+    sortKey: {
149
+      default: 'id',
150
+    },
148 151
   },
149 152
   data() {
150 153
     return {
151 154
       selectedItems: [],
152 155
       showControl: false,
153
-      sortKey: '',
154 156
       reverse: false,
155 157
       searchItem: '',
156 158
       itemsPerPageList: ItemsPerPageList,

+ 0
- 2
src/components/user/loginPage.vue 查看文件

@@ -33,7 +33,6 @@
33 33
                   <input
34 34
                     class="form-control"
35 35
                     type="text"
36
-                    name="username"
37 36
                     placeholder="Username"
38 37
                     v-model="username"
39 38
                     value
@@ -51,7 +50,6 @@
51 50
                     v-model="password"
52 51
                     id="password"
53 52
                     placeholder="Password"
54
-                    name="password"
55 53
                     value
56 54
                   />
57 55
                   <div class="input-group-append">

+ 198
- 66
src/components/user/timeshareIndividual.vue 查看文件

@@ -11,92 +11,84 @@
11 11
       <div class="row" style="text-align:left">
12 12
         <div class="col-md-6">
13 13
           <label>Name *</label>
14
-          <div class="input-group-prepend">
15
-            <span class="input-group-text">
16
-              <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
17
-            </span>
18
-            <input class="form-control" type="text" name="name" v-model="currentUser.name" />
19
-          </div>
14
+          <prop-field
15
+            :display="currentUser.name"
16
+            :editType="'text'"
17
+            :propertyName="'name'"
18
+            :mayEdit="true"
19
+            @UpdateValue="UpdateValue"
20
+          />
20 21
         </div>
21 22
         <div class="col-md-6" style="margin-bottom: 1em">
22 23
           <label>Surname *</label>
23
-          <div class="input-group-prepend">
24
-            <span class="input-group-text">
25
-              <eva-icon name="book-outline" fill="#60CBEB"></eva-icon>
26
-            </span>
27
-            <input class="form-control" type="text" name="surname" v-model="currentUser.surname" />
28
-          </div>
24
+          <prop-field
25
+            :display="currentUser.surname"
26
+            :editType="'text'"
27
+            :propertyName="'surname'"
28
+            :mayEdit="true"
29
+            @UpdateValue="UpdateValue"
30
+          />
29 31
         </div>
30 32
         <div class="col-md-6" style="margin-bottom: 1em">
31 33
           <label>ID Number *</label>
32
-          <div class="input-group-prepend">
33
-            <span class="input-group-text">
34
-              <eva-icon name="archive" fill="#60CBEB"></eva-icon>
35
-            </span>
36
-            <input class="form-control" type="text" name="idnumber" v-model="currentUser.idNumber" />
37
-          </div>
34
+          <prop-field
35
+            :display="currentUser.idNumber"
36
+            :editType="'text'"
37
+            :propertyName="'idNumber'"
38
+            :mayEdit="true"
39
+            @UpdateValue="UpdateValue"
40
+          />
38 41
         </div>
39 42
         <div class="col-md-6" style="margin-bottom: 1em">
40 43
           <label>Company Reg Number *</label>
41
-          <div class="input-group-prepend">
42
-            <span class="input-group-text">
43
-              <eva-icon name="npm-outline" fill="#60CBEB"></eva-icon>
44
-            </span>
45
-            <input
46
-              class="form-control"
47
-              type="text"
48
-              name="companyregnumber"
49
-              v-model="currentUser.companyRegNumber"
50
-            />
51
-          </div>
44
+          <prop-field
45
+            :display="currentUser.companyRegNumber"
46
+            :editType="'text'"
47
+            :propertyName="'companyRegNumber'"
48
+            :mayEdit="true"
49
+            @UpdateValue="UpdateValue"
50
+          />
52 51
         </div>
53 52
         <div class="col-md-6" style="margin-bottom: 1em">
54 53
           <label>Marital Status *</label>
55
-          <div class="input-group-prepend">
56
-            <span class="input-group-text">
57
-              <eva-icon name="people-outline" fill="#60CBEB"></eva-icon>
58
-            </span>
59
-            <select class="form-control" name="maritalstatus" v-model="currentUser.maritalStatus">
60
-              <option v-for="(item, i) in maritalStatus" :key="i">{{item}}</option>
61
-            </select>
62
-          </div>
54
+          <prop-field
55
+            :display="currentUser.maritalStatus"
56
+            :arrayObject="maritalStatus"
57
+            :editType="'selector'"
58
+            :propertyName="'maritalStatus'"
59
+            :mayEdit="true"
60
+            @UpdateValue="UpdateValue"
61
+          />
63 62
         </div>
64 63
         <div class="col-md-6" style="margin-bottom: 1em">
65 64
           <label>Email Address *</label>
66
-          <div class="input-group-prepend">
67
-            <span class="input-group-text">
68
-              <eva-icon name="email-outline" fill="#60CBEB"></eva-icon>
69
-            </span>
70
-            <input class="form-control" type="text" name="email" v-model="currentUser.emailAddress" />
71
-          </div>
65
+          <prop-field
66
+            :display="currentUser.emailAddress"
67
+            :editType="'text'"
68
+            :propertyName="'email'"
69
+            :mayEdit="true"
70
+            @UpdateValue="UpdateValue"
71
+          />
72 72
         </div>
73 73
         <div class="col-md-6" style="margin-bottom: 1em">
74 74
           <label>Cell Number *</label>
75
-          <div class="input-group-prepend">
76
-            <span class="input-group-text">
77
-              <eva-icon name="smartphone-outline" fill="#60CBEB"></eva-icon>
78
-            </span>
79
-            <input
80
-              class="form-control"
81
-              type="text"
82
-              name="cellnumber"
83
-              v-model="currentUser.cellNumber"
84
-            />
85
-          </div>
75
+          <prop-field
76
+            :display="currentUser.cellNumber"
77
+            :editType="'text'"
78
+            :propertyName="'cellNumber'"
79
+            :mayEdit="true"
80
+            @UpdateValue="UpdateValue"
81
+          />
86 82
         </div>
87 83
         <div class="col-md-6" style="margin-bottom: 1em">
88 84
           <label>Landline Number *</label>
89
-          <div class="input-group-prepend">
90
-            <span class="input-group-text">
91
-              <eva-icon name="phone-outline" fill="#60CBEB"></eva-icon>
92
-            </span>
93
-            <input
94
-              class="form-control"
95
-              type="text"
96
-              name="landline"
97
-              v-model="currentUser.landlineNumber"
98
-            />
99
-          </div>
85
+          <prop-field
86
+            :display="currentUser.landlineNumber"
87
+            :editType="'text'"
88
+            :propertyName="'landlineNumber'"
89
+            :mayEdit="true"
90
+            @UpdateValue="UpdateValue"
91
+          />
100 92
         </div>
101 93
       </div>
102 94
     </div>
@@ -108,6 +100,14 @@
108 100
       <hr />
109 101
       <BankAccount :bank="currentUser ? currentUser.bankingDetails : {}" />
110 102
     </div>
103
+    <div class="row">
104
+      <div class="col-md-2 offset-3">
105
+        <button @click="SubmitData()" type="button" class="btn btn-b-n">Save</button>
106
+      </div>
107
+      <div class="col-md-2 offset-3">
108
+        <button @click="Close()" type="button" class="btn btn-b-n">Close</button>
109
+      </div>
110
+    </div>
111 111
   </div>
112 112
 </template>
113 113
 
@@ -116,12 +116,15 @@ import { mapState, mapGetters, mapActions } from 'vuex';
116 116
 import BankAccount from '../shared/bankAccount.vue';
117 117
 import Address from '../misc/address.vue';
118 118
 import SelectIndividual from './selectIndividual.vue';
119
+import propField from '../property/propertyFieldEditor.vue';
120
+import items from '../../assets/staticData/itemsPerPage';
119 121
 
120 122
 export default {
121 123
   components: {
122 124
     BankAccount,
123 125
     Address,
124 126
     SelectIndividual,
127
+    propField,
125 128
   },
126 129
   data() {
127 130
     return {
@@ -151,15 +154,144 @@ export default {
151 154
   },
152 155
   computed: {
153 156
     ...mapState('timeshare', ['maritalStatus']),
157
+    ...mapState('individual', ['indiv']),
158
+    ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
154 159
     ...mapGetters({
155 160
       user: 'authentication/getUser',
156 161
     }),
157 162
   },
158 163
   methods: {
159
-    ...mapActions('individual', ['getIndividual']),
164
+    ...mapActions('individual', ['getIndividual', 'updateIndividual']),
165
+    ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
160 166
     onSelectedItemItemChange(item) {
161 167
       this.currentUser = item;
162 168
     },
169
+    ProvinceSelected(item) {
170
+      if (item.target.options.selectedIndex > 0) {
171
+        this.selectedProvince = this.provinces[
172
+          item.target.options.selectedIndex - 1
173
+        ].description;
174
+        this.getCities(Object.assign({}, { province: this.selectedProvince }));
175
+      }
176
+    },
177
+    CitySelected(item) {
178
+      if (item.target.options.selectedIndex > 0) {
179
+        this.selectedCity = this.cities[
180
+          item.target.options.selectedIndex - 1
181
+        ].description;
182
+        this.getSuburbs(
183
+          Object.assign(
184
+            {},
185
+            { province: this.selectedProvince, city: this.selectedCity },
186
+          ),
187
+        );
188
+      }
189
+    },
190
+    getPostalCode(item) {
191
+      this.address.postalCode = this.suburbs[
192
+        item.target.options.selectedIndex - 1
193
+      ].postalCode;
194
+    },
195
+    UpdateValue(item) {
196
+      if (item.fieldName) {
197
+        if (item.fieldName === 'name') {
198
+          this.currentUser.name = item.value;
199
+        }
200
+        if (item.fieldName === 'surname') {
201
+          this.currentUser.surname = item.value;
202
+        }
203
+        if (item.fieldName === 'idNumber') {
204
+          this.currentUser.idNumber = item.value;
205
+        }
206
+        if (item.fieldName === 'companyRegNumber') {
207
+          this.currentUser.companyRegNumber = item.value;
208
+        }
209
+        if (item.fieldName === 'maritalStatus') {
210
+          this.currentUser.maritalStatus = item.value;
211
+        }
212
+        if (item.fieldName === 'email') {
213
+          this.currentUser.emailAddress = item.value;
214
+        }
215
+        if (item.fieldName === 'cellNumber') {
216
+          this.currentUser.cellNumber = item.value;
217
+        }
218
+        if (item.fieldName === 'landlineNumber') {
219
+          this.currentUser.landlineNumber = item.value;
220
+        }
221
+        if (item.fieldName === 'streetNumber') {
222
+          this.currentUser.address.streetNumber = item.value;
223
+        }
224
+        if (item.fieldName === 'street') {
225
+          this.currentUser.address.street = item.value;
226
+        }
227
+        if (item.fieldName === 'province') {
228
+          if (item.value !== '') {
229
+            this.address.province = this.provinces.find(
230
+              p => p.description === item.value,
231
+            );
232
+            this.address.provinceId = this.address.province.id;
233
+            this.getCities(Object.assign({}, { province: item.value }));
234
+            this.address.city = null;
235
+            this.address.suburb = null;
236
+            this.address.postalCode = '';
237
+          } else {
238
+            this.address.province = null;
239
+            this.address.city = null;
240
+            this.address.suburb = null;
241
+            this.address.postalCode = '';
242
+            this.cities = [];
243
+            this.suburbs = [];
244
+          }
245
+        }
246
+        if (item.fieldName === 'city') {
247
+          if (item.value !== '') {
248
+            const newCity = this.cities.find(p => p.description === item.value);
249
+            this.address.city = newCity;
250
+            this.address.cityId = newCity.id;
251
+            this.getSuburbs(
252
+              Object.assign(
253
+                {},
254
+                {
255
+                  province: this.address.province.description,
256
+                  city: item.value,
257
+                },
258
+              ),
259
+            );
260
+            this.address.suburb = null;
261
+            this.address.postalCode = '';
262
+          } else {
263
+            this.address.city = null;
264
+            this.address.suburb = null;
265
+            this.address.postalCode = '';
266
+            this.suburbs = [];
267
+          }
268
+        }
269
+        if (item.fieldName === 'suburb') {
270
+          if (item.value !== '') {
271
+            const newSuburb = this.suburbs.find(
272
+              p => p.description === item.value,
273
+            );
274
+            this.address.suburb = newSuburb;
275
+            this.address.suburbId = newSuburb.id;
276
+            this.address.postalCode = this.address.suburb.postalCode;
277
+          } else {
278
+            this.address.suburb = null;
279
+            this.address.postalCode = '';
280
+          }
281
+        }
282
+      }
283
+    },
284
+    SubmitData() {
285
+      console.log(this.currentUser);
286
+      this.updateIndividual(this.currentUser);
287
+      this.$router.push('/status/userManagementPage');
288
+    },
289
+    Close() {
290
+      this.$router.push('/status/userManagementPage');
291
+    },
292
+  },
293
+  mounted() {
294
+    this.getProvince();
163 295
   },
164 296
 };
165 297
 </script>

+ 5
- 4
src/components/user/updateProfileInfo.vue 查看文件

@@ -15,7 +15,8 @@
15 15
           enctype="multipart/form-data"
16 16
         >
17 17
           <div class="col-md-12" style="text-align:left"></div>
18
-          <DetailIndividual :currentUser="sellItem.owner" :showBank="true" :showAddress="true" />
18
+          <DetailIndividual :currentUser="user" :showBank="true" :showAddress="true" />
19
+          <br />
19 20
         </form>
20 21
       </div>
21 22
     </div>
@@ -29,7 +30,7 @@ import DetailIndividual from './timeshareIndividual.vue';
29 30
 export default {
30 31
   name: 'UpdateInfo',
31 32
   data() {
32
-    return { selectedItem: {} };
33
+    return { selectedItem: {}, individual: {} };
33 34
   },
34 35
   props: {},
35 36
   components: {
@@ -53,7 +54,7 @@ export default {
53 54
       'agents',
54 55
     ]),
55 56
     ...mapState('individual', ['indiv']),
56
-    ...mapState('authentication', ['isLoggedIn']),
57
+    ...mapState('authentication', ['isLoggedIn', 'user']),
57 58
     ...mapGetters({
58 59
       user: 'authentication/getUser',
59 60
       person: 'authentication/getPerson',
@@ -63,7 +64,7 @@ export default {
63 64
     },
64 65
   },
65 66
   methods: {
66
-    ...mapActions('individual', ['getIndividual']),
67
+    ...mapActions('individual', ['getIndividual', 'updateIndividual']),
67 68
     onSelectedItemItemChange(item) {
68 69
       this.currentUser = item;
69 70
     },

+ 15
- 4
src/store/modules/user/individual.js 查看文件

@@ -26,19 +26,30 @@ export default {
26 26
       } else id = userId;
27 27
       axios
28 28
         .get(`/api/individual/getIndividual/${id}`)
29
-        .then(r => commit('setItem', {
29
+        .then((r) => {
30
+          console.log(JSON.stringify(r));
31
+          commit('setItem', {
30 32
             name: 'indiv',
31 33
             value: r.data,
32
-          }),)
34
+          });
35
+        })
33 36
         .catch(console.error);
34 37
     },
35 38
     getAllIndividuals({ commit }) {
36 39
       axios
37 40
         .get('/api/individual/getAllIndividuals')
38
-        .then(x => commit('setItem', {
41
+        .then((x) => {
42
+          commit('setItem', {
39 43
             name: 'items',
40 44
             value: x.data,
41
-          }),)
45
+          });
46
+        })
47
+        .catch(console.error);
48
+    },
49
+    updateIndividual({ commit }, item) {
50
+      axios
51
+        .put('/api/individual', item)
52
+        .then(result => commit('setItem', item))
42 53
         .catch(console.error);
43 54
     },
44 55
   },

正在加载...
取消
保存