浏览代码

Admin screen changes WIP

master
George Williams 5 年前
父节点
当前提交
d386aecb3a

+ 99
- 0
src/components/admin/property/propertyTypeEdit.vue 查看文件

@@ -0,0 +1,99 @@
1
+<template>
2
+  <div>
3
+    <section class="intro-single">
4
+      <div class="container">
5
+        <div class="row">
6
+          <div class="col-md-12 col-lg-8">
7
+            <div class="title-single-box">
8
+              <h2 class="title-single">Property Type</h2>
9
+            </div>
10
+          </div>
11
+        </div>
12
+      </div>
13
+    </section>
14
+    <div class="container">
15
+      <div class="row mb-3">
16
+        <div class="col-md-12">
17
+          <form id="mainForm">
18
+            <div class="form-group row">
19
+              <div class="col-md-4">
20
+                <label>Description</label>
21
+                <input
22
+                  class="form-control"
23
+                  type="text"
24
+                  name="description"
25
+                  id="description"
26
+                  v-model="propertyType.description"
27
+                />
28
+              </div>
29
+              <div class="col-md-4">
30
+                <label>Property Type</label>
31
+                <select
32
+                  class="form-control"
33
+                  name="UsageType"
34
+                  id="UsageType"
35
+                  v-model="propertyType.usageType"
36
+                >
37
+                  <option value="0">Residential</option>
38
+                  <option value="1">Commercial</option>
39
+                  <option value="2">Both</option>
40
+                </select>
41
+              </div>
42
+            </div>
43
+          </form>
44
+        </div>
45
+      </div>
46
+    </div>
47
+    <button
48
+      type="button"
49
+      @click="SubmitData()"
50
+      class="btn btn-b-n"
51
+      style="width: 85px; height:40px;"
52
+    >Save</button> |
53
+    <button
54
+      type="button"
55
+      @click="Close()"
56
+      class="btn btn-b-n"
57
+      style="width: 85px; height:40px;"
58
+    >Close</button>
59
+  </div>
60
+</template>
61
+
62
+<script>
63
+import { mapState, mapActions } from 'vuex';
64
+
65
+export default {
66
+  name: 'PropertyType',
67
+  data() {
68
+    return {};
69
+  },
70
+  mounted() {
71
+    this.clearPropertyType();
72
+    if (this.$route.params.id > 0) {
73
+      this.getPropertyType(this.$route.params.id);
74
+    }
75
+  },
76
+  computed: {
77
+    ...mapState('propertyTypes', ['propertyType']),
78
+  },
79
+  methods: {
80
+    ...mapActions('propertyTypes', [
81
+      'getPropertyType',
82
+      'savePropertyType',
83
+      'updatePropertyType',
84
+      'clearPropertyType',
85
+    ]),
86
+    SubmitData() {
87
+      if (this.propertyType.id > 0) {
88
+        this.updatePropertyType(this.propertyType);
89
+      } else {
90
+        this.savePropertyType(this.propertyType);
91
+      }
92
+      this.$router.push('/propertyTypes/list');
93
+    },
94
+    Close() {
95
+      this.$router.push('/propertyTypes/list');
96
+    },
97
+  },
98
+};
99
+</script>

+ 86
- 0
src/components/admin/property/propertyTypeList.vue 查看文件

@@ -0,0 +1,86 @@
1
+<template>
2
+  <!-- eslint-disable max-len -->
3
+  <div>
4
+    <div class="container">
5
+      <section class="intro-single">
6
+        <div class="container">
7
+          <div class="row">
8
+            <div class="col-md-12 col-lg-8">
9
+              <div class="title-single-box">
10
+                <h1 class="title-single">Property Types</h1>
11
+              </div>
12
+            </div>
13
+          </div>
14
+        </div>
15
+      </section>
16
+    </div>
17
+    <div class="container">
18
+      <button type="button" @click="New()" class="btn btn-b-n" style="width: 85px; height:40px;">New</button>
19
+    </div>
20
+    <div class="container">
21
+      <table class="table table-bordered">
22
+        <thead>
23
+          <tr>
24
+            <th>Description</th>
25
+            <th>Property Type</th>
26
+            <th></th>
27
+          </tr>
28
+        </thead>
29
+        <tbody>
30
+          <tr v-for="(item, i) in propertyTypes" :key="i">
31
+            <td>{{ item.description }}</td>
32
+            <td v-if="item.usageType === 0">Residential</td>
33
+            <td v-else-if="item.usageType === 1">Commercial</td>
34
+            <td v-else>Both</td>
35
+            <td>
36
+              <button
37
+                type="button"
38
+                @click="Edit(item.id)"
39
+                class="btn btn-b-n"
40
+                style="width: 85px; height:40px;"
41
+              >Edit</button>
42
+              |
43
+              <button
44
+                type="button"
45
+                @click="Delete(item.id)"
46
+                class="btn btn-b-n"
47
+                style="width: 85px; height:40px;"
48
+              >Delete</button>
49
+            </td>
50
+          </tr>
51
+        </tbody>
52
+      </table>
53
+    </div>
54
+  </div>
55
+</template>
56
+
57
+<script>
58
+import { mapState, mapActions } from 'vuex';
59
+
60
+export default {
61
+  name: 'PropertyTypeList',
62
+  data() {
63
+    return {};
64
+  },
65
+  methods: {
66
+    ...mapActions('propertyTypes', ['getPropertyTypes', 'deletePropertyType']),
67
+    New() {
68
+      this.$router.push('/propertyType/new');
69
+    },
70
+    Edit(itemID) {
71
+      this.$router.push({
72
+        path: `/propertyType/${itemID}`,
73
+      });
74
+    },
75
+    Delete(id) {
76
+      this.deletePropertyType(id);
77
+    },
78
+  },
79
+  mounted() {
80
+    this.getPropertyTypes();
81
+  },
82
+  computed: {
83
+    ...mapState('propertyTypes', ['propertyTypes']),
84
+  },
85
+};
86
+</script>

+ 87
- 0
src/components/admin/property/userDefinedFieldPage.vue 查看文件

@@ -0,0 +1,87 @@
1
+<template>
2
+  <div>
3
+    <section class="intro-single">
4
+      <div class="container">
5
+        <div class="row">
6
+          <div class="col-md-12 col-lg-8">
7
+            <div class="title-single-box">
8
+              <h2 class="title-single">User Defined Field</h2>
9
+            </div>
10
+          </div>
11
+        </div>
12
+      </div>
13
+    </section>
14
+    <div class="container">
15
+      <div class="row mb-3">
16
+        <div class="col-md-12">
17
+          <form id="mainForm">
18
+            <div class="form-group row">
19
+              <div class="col-md-4">
20
+                <label>Field Name</label>
21
+                <input
22
+                  class="form-control"
23
+                  type="text"
24
+                  name="description"
25
+                  id="description"
26
+                  v-model="userField.fieldName"
27
+                />
28
+              </div>
29
+              <div class="col-md-4">
30
+                <label>Field Type</label>
31
+                <select
32
+                  class="form-control"
33
+                  name="UsageType"
34
+                  id="UsageType"
35
+                  v-model="userField.fieldType"
36
+                >
37
+                  <option value="text">Text</option>
38
+                  <option value="number">Numberic</option>
39
+                  <option value="yesno">Yes / No</option>
40
+                </select>
41
+              </div>
42
+              <div class="col-md-4">
43
+                <label>Order</label>
44
+                <input
45
+                  class="form-control"
46
+                  type="number"
47
+                  name="rank"
48
+                  id="rank"
49
+                  v-model="userField.rank"
50
+                />
51
+              </div>
52
+            </div>
53
+          </form>
54
+        </div>
55
+      </div>
56
+    </div>
57
+    <button
58
+      type="button"
59
+      @click="SubmitData()"
60
+      class="btn btn-b-n"
61
+      style="width: 85px; height:40px;"
62
+    >Save</button>
63
+  </div>
64
+</template>
65
+
66
+<script>
67
+export default {
68
+  name: 'UserField',
69
+  data() {
70
+    return {
71
+      userField: {
72
+        fieldName: '',
73
+        fieldType: '',
74
+        rank: 0,
75
+      },
76
+    };
77
+  },
78
+  mounted() {
79
+    this.userField = this.$route.query.field;
80
+  },
81
+  methods: {
82
+    SubmitData() {
83
+      //this.$emit();
84
+    },
85
+  },
86
+};
87
+</script>

+ 186
- 0
src/components/admin/property/userDefinedGroupPage.vue 查看文件

@@ -0,0 +1,186 @@
1
+<template>
2
+  <div>
3
+    <section class="intro-single">
4
+      <div class="container">
5
+        <div class="row">
6
+          <div class="col-md-12 col-lg-8">
7
+            <div class="title-single-box">
8
+              <h2 class="title-single">User Defined Group</h2>
9
+            </div>
10
+          </div>
11
+        </div>
12
+      </div>
13
+    </section>
14
+    <div class="container">
15
+      <div class="row mb-3">
16
+        <div class="col-md-12">
17
+          <form id="mainForm">
18
+            <div v-if="userDefinedGroup" class="form-group row">
19
+              <div class="col-md-4">
20
+                <label>Description</label>
21
+                <input
22
+                  class="form-control"
23
+                  type="text"
24
+                  name="description"
25
+                  id="description"
26
+                  v-model="userDefinedGroup.description"
27
+                />
28
+              </div>
29
+              <div class="col-md-4">
30
+                <label>Property Type</label>
31
+                <select
32
+                  class="form-control"
33
+                  name="UsageType"
34
+                  id="UsageType"
35
+                  v-model="userDefinedGroup.usageType"
36
+                >
37
+                  <option value="0">Residential</option>
38
+                  <option value="1">Commercial</option>
39
+                  <option value="2">Both</option>
40
+                </select>
41
+              </div>
42
+              <div class="col-md-4">
43
+                <label>Order</label>
44
+                <input
45
+                  class="form-control"
46
+                  type="number"
47
+                  name="rank"
48
+                  id="rank"
49
+                  v-model="userDefinedGroup.rank"
50
+                />
51
+              </div>
52
+            </div>
53
+            <div v-if="!userDefinedGroup" class="form-group row">
54
+              <div class="col-md-4">
55
+                <label>Description</label>
56
+                <input
57
+                  class="form-control"
58
+                  type="text"
59
+                  name="description"
60
+                  id="description"
61
+                  v-model="group.description"
62
+                />
63
+              </div>
64
+              <div class="col-md-4">
65
+                <label>Property Type</label>
66
+                <select
67
+                  class="form-control"
68
+                  name="UsageType"
69
+                  id="UsageType"
70
+                  v-model="group.usageType"
71
+                >
72
+                  <option value="0">Residential</option>
73
+                  <option value="1">Commercial</option>
74
+                  <option value="2">Both</option>
75
+                </select>
76
+              </div>
77
+              <div class="col-md-4">
78
+                <label>Order</label>
79
+                <input
80
+                  class="form-control"
81
+                  type="number"
82
+                  name="rank"
83
+                  id="rank"
84
+                  v-model="group.rank"
85
+                />
86
+              </div>
87
+            </div>
88
+          </form>
89
+        </div>
90
+      </div>
91
+    </div>
92
+    <div class="container">
93
+      <button
94
+        type="button"
95
+        @click="newItem()"
96
+        class="btn btn-b-n"
97
+        style="width: 85px; height:40px;"
98
+      >New</button>
99
+      <br />
100
+      <table class="table table-bordered">
101
+        <thead>
102
+          <tr>
103
+            <th>Field Name</th>
104
+            <th>Field Type</th>
105
+            <th>Order</th>
106
+            <th></th>
107
+          </tr>
108
+        </thead>
109
+        <tbody>
110
+          <tr v-for="(item, i) in userFields" :key="i">
111
+            <td>{{item.fieldName}}</td>
112
+            <td>{{item.fieldType}}</td>
113
+            <td>{{item.rank}}</td>
114
+            <td>
115
+              <router-link :to="{ name: 'UserDefinedField', query: { field: item }}">Edit</router-link>
116
+              <!-- <router-link :to="`/userField`">Edit</router-link>| Delete -->
117
+            </td>
118
+          </tr>
119
+        </tbody>
120
+      </table>
121
+    </div>
122
+    <button
123
+      type="button"
124
+      @click="SubmitData()"
125
+      class="btn btn-b-n"
126
+      style="width: 85px; height:40px;"
127
+    >Save</button>
128
+  </div>
129
+</template>
130
+
131
+<script>
132
+import { mapState, mapActions } from 'vuex';
133
+
134
+export default {
135
+  name: 'UserDefinedGroup',
136
+  data() {
137
+    return {
138
+      group: {
139
+        description: '',
140
+        usageType: 0,
141
+        rank: 0,
142
+      },
143
+    };
144
+  },
145
+  mounted() {
146
+    if (this.$route.params.id > 0) {
147
+      this.getUserDefinedGroup(
148
+        Object.assign({}, { id: this.$route.params.id }),
149
+      );
150
+      this.getUserFields(Object.assign({}, { groupId: this.$route.params.id }));
151
+    }
152
+  },
153
+  computed: {
154
+    ...mapState('propertyAdmin', ['userDefinedGroup', 'userFields']),
155
+  },
156
+  methods: {
157
+    ...mapActions('propertyAdmin', [
158
+      'getUserDefinedGroup',
159
+      'getUserFields',
160
+      'saveUserDefinedGroup',
161
+      'updateUserDefinedGroup',
162
+    ]),
163
+    SubmitData() {
164
+      if (this.$route.params.id > 0) {
165
+        this.updateUserDefinedGroup(
166
+          Object.assign({}, { group: this.userDefinedGroup }),
167
+        );
168
+      } else {
169
+        this.saveUserDefinedGroup(Object.assign({}, { group: this.group }));
170
+      }
171
+      this.$router.push('/userDefinedGroups/list');
172
+    },
173
+    newItem() {
174
+      const newField = {
175
+        fieldName: '',
176
+        fieldType: 'Text',
177
+        rank: 0,
178
+      };
179
+      this.$router.push({
180
+        path: '/userField',
181
+        query: { field: newField },
182
+      });
183
+    },
184
+  },
185
+};
186
+</script>

+ 62
- 0
src/components/admin/property/userDefinedGroupsPage.vue 查看文件

@@ -0,0 +1,62 @@
1
+<template>
2
+  <div>
3
+    <section class="intro-single">
4
+      <div class="container">
5
+        <div class="row">
6
+          <div class="col-md-12 col-lg-8">
7
+            <div class="title-single-box">
8
+              <h2 class="title-single">User Defined Groups List</h2>
9
+            </div>
10
+          </div>
11
+        </div>
12
+      </div>
13
+    </section>
14
+    <div class="container">
15
+      <router-link :to="`/userDefinedGroups/userDefinedGroup`">New</router-link>
16
+      <table class="table table-bordered">
17
+        <thead>
18
+          <tr>
19
+            <th>Description</th>
20
+            <th>Property Type</th>
21
+            <th>Order</th>
22
+            <th></th>
23
+            <th></th>
24
+          </tr>
25
+        </thead>
26
+        <tbody>
27
+          <tr v-for="(item, i) in userDefinedGroups" :key="i">
28
+            <td>{{item.description}}</td>
29
+            <td v-if="item.usageType === 0">Residential</td>
30
+            <td v-else-if="item.usageType === 1">Commercial</td>
31
+            <td v-else>Both</td>
32
+            <td>{{item.rank}}</td>
33
+            <td>
34
+              <router-link :to="`/userDefinedGroups/userDefinedGroup/${item.id}`">Edit</router-link>
35
+            </td>
36
+            <td>
37
+              <button>Delete</button>
38
+            </td>
39
+          </tr>
40
+        </tbody>
41
+      </table>
42
+    </div>
43
+  </div>
44
+</template>
45
+<script>
46
+import { mapState, mapActions } from 'vuex';
47
+
48
+export default {
49
+  name: 'UserDefinedGroup',
50
+  created() {
51
+    this.getUserDefinedGroups();
52
+  },
53
+  computed: {
54
+    ...mapState('propertyAdmin', ['userDefinedGroups']),
55
+  },
56
+  methods: {
57
+    ...mapActions('propertyAdmin', ['getUserDefinedGroups']),
58
+  },
59
+};
60
+</script>
61
+<style>
62
+</style>

+ 55
- 0
src/components/admin/region/provincesPage.vue 查看文件

@@ -0,0 +1,55 @@
1
+<template>
2
+  <div>
3
+    <section class="intro-single">
4
+      <div class="container">
5
+        <div class="row">
6
+          <div class="col-md-12 col-lg-8">
7
+            <div class="title-single-box">
8
+              <h2 class="title-single">Unit Configuration List</h2>
9
+            </div>
10
+          </div>
11
+        </div>
12
+      </div>
13
+    </section>
14
+    <div class="container">
15
+      <table class="table table-bordered">
16
+        <thead>
17
+          <tr>
18
+            <th>Id</th>
19
+            <th>Code</th>
20
+            <th>Bedrooms</th>
21
+            <th>Adults</th>
22
+            <th>Children</th>
23
+          </tr>
24
+        </thead>
25
+        <tbody>
26
+          <tr v-for="(item, i) in unitConfigurationList" :key="i">
27
+            <td>{{item.id}}</td>
28
+            <td>{{item.code}}</td>
29
+            <td>{{item.bedrooms}}</td>
30
+            <td>{{item.adults}}</td>
31
+            <td>{{item.children}}</td>
32
+          </tr>
33
+        </tbody>
34
+      </table>
35
+    </div>
36
+  </div>
37
+</template>
38
+<script>
39
+import { mapState, mapActions } from 'vuex';
40
+
41
+export default {
42
+  name: 'UnitConfiguration',
43
+  created() {
44
+    this.getUnitConfigurationList();
45
+  },
46
+  computed: {
47
+    ...mapState('unitConfiguration', ['unitConfigurationList']),
48
+  },
49
+  methods: {
50
+    ...mapActions('unitConfiguration', ['getUnitConfigurationList']),
51
+  },
52
+};
53
+</script>
54
+<style>
55
+</style>

+ 6
- 1
src/components/property/propertyImage.vue 查看文件

@@ -29,6 +29,7 @@
29 29
 export default {
30 30
   props: {
31 31
     loadedImages: Function,
32
+    savedImages: { type: Array, default: () => [] },
32 33
   },
33 34
   data() {
34 35
     return {
@@ -36,7 +37,11 @@ export default {
36 37
       image: [],
37 38
     };
38 39
   },
39
-
40
+  mounted() {
41
+    if (this.savedImages.length > 0) {
42
+      this.image = this.savedImages;
43
+    }
44
+  },
40 45
   methods: {
41 46
     imagesAdd(e) {
42 47
       const files = e.target.files || e.dataTransfer.files;

+ 107
- 0
src/components/property/propertyList.vue 查看文件

@@ -0,0 +1,107 @@
1
+<template>
2
+  <!-- eslint-disable max-len -->
3
+  <div>
4
+    <div class="container">
5
+      <section class="intro-single">
6
+        <div class="container">
7
+          <div class="row">
8
+            <div class="col-md-12 col-lg-8">
9
+              <div class="title-single-box">
10
+                <h1 v-if="user !== 'All'" class="title-single">My {{ propertyType }} Properties</h1>
11
+                <h1 v-else class="title-single">All {{ propertyType }} Properties</h1>
12
+              </div>
13
+            </div>
14
+          </div>
15
+        </div>
16
+      </section>
17
+    </div>
18
+    <div class="container">
19
+      <table class="table table-bordered">
20
+        <thead>
21
+          <tr>
22
+            <th>Name</th>
23
+            <th>Property ID</th>
24
+            <th>Size</th>
25
+            <th>Price</th>
26
+            <th>Type</th>
27
+            <th>Publish</th>
28
+            <th>Status</th>
29
+            <th>Edit</th>
30
+            <th>Delete</th>
31
+          </tr>
32
+        </thead>
33
+        <tbody>
34
+          <tr v-for="(item, i) in properties" :key="i">
35
+            <td v-if="item.propertyType.usageType === 1">{{item.propertyName}}</td>
36
+            <td v-else>{{ item.shortDescription }}</td>
37
+            <td>{{item.id}}</td>
38
+            <td></td>
39
+            <td>{{ item.price }}</td>
40
+            <td>{{ item.propertyType.description }}</td>
41
+            <td>{{ item.publish }}</td>
42
+            <td>Publish</td>
43
+            <td>
44
+              <router-link :to="`/property/${item.id}`">Edit</router-link>
45
+            </td>
46
+            <td>Delete</td>
47
+          </tr>
48
+        </tbody>
49
+      </table>
50
+    </div>
51
+  </div>
52
+</template>
53
+
54
+<script>
55
+import { mapState, mapActions } from 'vuex';
56
+
57
+export default {
58
+  name: 'PropertyList',
59
+  data() {
60
+    return {
61
+      propertyType: '',
62
+      user: '',
63
+    };
64
+  },
65
+  methods: {
66
+    ...mapActions('propertyList', ['getProperties']),
67
+  },
68
+  mounted() {
69
+    this.propertyType = this.$route.params.propertyType;
70
+    this.user = this.$route.params.user;
71
+
72
+    this.getProperties(
73
+      Object.assign(
74
+        {},
75
+        {
76
+          propertyType: this.$route.params.propertyType,
77
+          user: this.$route.params.user,
78
+        },
79
+      ),
80
+    );
81
+  },
82
+  computed: {
83
+    ...mapState('propertyList', ['properties']),
84
+    TypeChanged() {
85
+      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
86
+      this.propertyType = this.$route.params.propertyType;
87
+      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
88
+      this.user = this.$route.params.user;
89
+      this.getProperties(
90
+        Object.assign(
91
+          {},
92
+          {
93
+            propertyType: this.$route.params.propertyType,
94
+            user: this.$route.params.user,
95
+          },
96
+        ),
97
+      );
98
+      return this.propertyType;
99
+    },
100
+  },
101
+  watch: {
102
+    TypeChanged() {
103
+      console.log(this.propertyType);
104
+    },
105
+  },
106
+};
107
+</script>

+ 5
- 4
src/components/property/propertyPage.vue 查看文件

@@ -36,7 +36,7 @@
36 36
                     </div>
37 37
                   </div>
38 38
                 </div>
39
-                <div class="property-description" v-html="property.description" />
39
+                <div class="property-description" v-html="property ? property.description : ''" />
40 40
                 <div v-for="display in property.displayData" :key="display.id">
41 41
                   <div class="row section-t3">
42 42
                     <div class="col-sm-12">
@@ -88,7 +88,8 @@
88 88
                       <li class="d-flex justify-content-between">
89 89
                         <strong>Address:</strong>
90 90
                         <span
91
-                          v-html="formatAddress(property.addressLine1) + formatAddress(property.addressLine2) + formatAddress(property.addressLine3) + formatAddress(property.suburb.description) + formatAddress(property.city.description) + formatAddress(property.province.description) "
91
+                          v-if="property"
92
+                          v-html="formatAddress(property.addressLine1) + formatAddress(property.addressLine2) + formatAddress(property.addressLine3) + formatAddress(property.suburb ? property.suburb.description : '') + formatAddress(property.city ? property.city.description : '') + formatAddress(property.province ? property.province.description : '') "
92 93
                         ></span>
93 94
                       </li>
94 95
                     </ul>
@@ -237,8 +238,8 @@ export default {
237 238
     return {};
238 239
   },
239 240
   mounted() {
240
-    this.getProperty(Object.assign({}, { id: this.$route.params.id }));
241
-    this.getPropertyImages(Object.assign({}, { id: this.$route.params.id }));
241
+    this.getProperty(this.$route.params.id);
242
+    this.getPropertyImages(this.$route.params.id);
242 243
   },
243 244
   computed: {
244 245
     ...mapState('property', ['property', 'propertyImages']),

+ 1
- 1
src/components/property/propertyUserField.vue 查看文件

@@ -39,7 +39,7 @@
39 39
 export default {
40 40
   name: 'UserDefinedField',
41 41
   props: {
42
-    fields: [],
42
+    fields: { type: Array, default: () => [] },
43 43
     SetFieldValue: Function,
44 44
   },
45 45
   data() {

+ 37
- 48
src/components/property/propertyeditPage.vue 查看文件

@@ -25,7 +25,7 @@
25 25
           <form id="mainForm">
26 26
             <div class="form-group row">
27 27
               <div class="col-md-4">
28
-                <label for="Property Type"></label>
28
+                <label>Property Type</label>
29 29
                 <select
30 30
                   class="form-control"
31 31
                   name="propertyType"
@@ -41,21 +41,19 @@
41 41
                 </select>
42 42
               </div>
43 43
               <div v-if="propertyType === 'Commercial'" class="col-md-4">
44
-                <label for="Property Name"></label>
44
+                <label>Property Name</label>
45 45
                 <input
46 46
                   class="form-control"
47 47
                   type="text"
48
-                  placeholder="Property Name"
49 48
                   name="propertyName"
50 49
                   id="propertyName"
51 50
                   v-model="property.propertyName"
52 51
                 />
53 52
               </div>
54 53
               <div v-if="propertyType === 'Commercial'" class="col-md-4">
55
-                <label for="Unit"></label>
54
+                <label>Unit</label>
56 55
                 <input
57 56
                   class="form-control"
58
-                  placeholder="Unit"
59 57
                   type="text"
60 58
                   name="unit"
61 59
                   id="unit"
@@ -65,33 +63,30 @@
65 63
             </div>
66 64
             <div class="form-group row">
67 65
               <div class="col-md-4">
68
-                <label for="Address Line 1"></label>
66
+                <label>Address Line 1</label>
69 67
                 <input
70 68
                   class="form-control"
71 69
                   type="text"
72
-                  placeholder="Address Line 1"
73 70
                   name="address1"
74 71
                   id="address1"
75 72
                   v-model="property.addressLine1"
76 73
                 />
77 74
               </div>
78 75
               <div class="col-md-4">
79
-                <label for="Address Line 2"></label>
76
+                <label>Address Line 2</label>
80 77
                 <input
81 78
                   class="form-control"
82 79
                   type="text"
83
-                  placeholder="Address Line 2"
84 80
                   name="address2"
85 81
                   id="address2"
86 82
                   v-model="property.addressLine2"
87 83
                 />
88 84
               </div>
89 85
               <div class="col-md-4">
90
-                <label for="Address Line 3"></label>
86
+                <label>Address Line 3</label>
91 87
                 <input
92 88
                   class="form-control"
93 89
                   type="text"
94
-                  placeholder="Address Line 3"
95 90
                   name="address3"
96 91
                   id="address3"
97 92
                   v-model="property.addressLine3"
@@ -100,7 +95,7 @@
100 95
             </div>
101 96
             <div class="form-group row">
102 97
               <div class="col-md-4">
103
-                <label for="Province"></label>
98
+                <label>Province</label>
104 99
                 <select
105 100
                   class="form-control"
106 101
                   name="propertyType"
@@ -108,7 +103,7 @@
108 103
                   @change="ProvinceSelected"
109 104
                   v-model="property.provinceId"
110 105
                 >
111
-                  <option value="0">Please select Province</option>
106
+                  <option value="0">Please select</option>
112 107
                   <option
113 108
                     v-for="province in provinces"
114 109
                     :value="province.id"
@@ -117,7 +112,7 @@
117 112
                 </select>
118 113
               </div>
119 114
               <div class="col-md-4">
120
-                <label for="City"></label>
115
+                <label>City</label>
121 116
                 <select
122 117
                   class="form-control"
123 118
                   name="propertyType"
@@ -134,7 +129,7 @@
134 129
                 </select>
135 130
               </div>
136 131
               <div class="col-md-4">
137
-                <label for="Suburb"></label>
132
+                <label>Suburb</label>
138 133
                 <select
139 134
                   class="form-control"
140 135
                   name="propertyType"
@@ -179,7 +174,7 @@
179 174
             </div>
180 175
             <div class="form-group row">
181 176
               <div class="col-md-12">
182
-                <label for="Property Description"></label>
177
+                <label for="Property Description">Description</label>
183 178
                 <TextEditor name="description" v-model="property.description" id="description" />
184 179
                 <br />
185 180
                 <p>* A listing fee of R380 including VAT is payable to list your Property on the Uni-Vate website</p>
@@ -189,7 +184,6 @@
189 184
             <UserField
190 185
               v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
191 186
               :fields="propertyOverviewFields[0].fields"
192
-              :id="overviewProps"
193 187
               @UpdateUserDefinedFields="UpdateUserDefinedFields"
194 188
             ></UserField>
195 189
             <div class="form-group row" />
@@ -215,7 +209,7 @@
215 209
                 </div>
216 210
               </div>
217 211
             </div>
218
-            <ImageLoad :loadedImages="loadedImages" />
212
+            <ImageLoad :loadedImages="loadedImages" :savedImages="propertyImages" />
219 213
             <button
220 214
               type="button"
221 215
               @click="SubmitData()"
@@ -248,23 +242,6 @@ export default {
248 242
       salesType: 'Rental',
249 243
       selectedProvince: '',
250 244
       selectedCity: '',
251
-      property: {
252
-        propertyTypeId: 0,
253
-        propertyName: '',
254
-        unit: '',
255
-        addressLine1: '',
256
-        addressLine2: '',
257
-        addressLine3: '',
258
-        suburbId: 0,
259
-        cityId: 0,
260
-        provinceId: 0,
261
-        price: '',
262
-        per: '',
263
-        description: '',
264
-        isSale: false,
265
-        propertyUserFields: [],
266
-        propertyImages: [],
267
-      },
268 245
       images: [],
269 246
       propertyFieldValues: [],
270 247
     };
@@ -276,6 +253,8 @@ export default {
276 253
       'getPropertyOverviewFields',
277 254
       'getPropertyFields',
278 255
       'saveProperty',
256
+      'getProperty',
257
+      'getPropertyImages',
279 258
     ]),
280 259
     SubmitData() {
281 260
       let isDefault = true;
@@ -288,7 +267,7 @@ export default {
288 267
       });
289 268
       this.property.propertyUserFields = this.propertyFieldValues;
290 269
 
291
-      this.saveProperty(Object.assign({}, { newProperty: this.property }));
270
+      this.saveProperty(this.property);
292 271
 
293 272
       this.$router.push({
294 273
         path: '/property/search',
@@ -337,13 +316,25 @@ export default {
337 316
     this.salesType = this.$route.params.saleType;
338 317
 
339 318
     this.getProvince();
340
-    this.getPropertyTypes(
341
-      Object.assign({}, { propertyType: this.$route.params.propType }),
342
-    );
319
+    this.getPropertyTypes(this.$route.params.propType);
343 320
     this.getPropertyOverviewFields();
344
-    this.getPropertyFields(
345
-      Object.assign({}, { propertyType: this.$route.params.propType }),
346
-    );
321
+    this.getPropertyFields(this.$route.params.propType);
322
+
323
+    // if (this.$route.params.id) {
324
+    //   this.getProperty(this.$route.params.id);
325
+    //   this.getPropertyImages(this.$route.params.id);
326
+    // }
327
+    /*
328
+    if (this.$route.params.id) {
329
+      this.getProperty(this.$route.params.id);
330
+      this.getPropertyImages(this.$route.params.id);
331
+      if (this.property.propertyType.usageType === 0) {
332
+        this.propertyType = 'Residential';
333
+      } else {
334
+        this.propertyType = 'Commercial';
335
+      }
336
+      this.salesType = this.property.isSale ? 'Sale' : 'Rental';
337
+    } */
347 338
   },
348 339
   computed: {
349 340
     ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
@@ -351,6 +342,8 @@ export default {
351 342
       'propertyTypes',
352 343
       'propertyOverviewFields',
353 344
       'propertyFields',
345
+      'property',
346
+      'propertyImages',
354 347
     ]),
355 348
     SalesTypeChanged() {
356 349
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
@@ -358,13 +351,9 @@ export default {
358 351
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
359 352
       this.salesType = this.$route.params.saleType;
360 353
 
361
-      this.getPropertyTypes(
362
-        Object.assign({}, { propertyType: this.$route.params.propType }),
363
-      );
354
+      this.getPropertyTypes(this.$route.params.propType);
364 355
 
365
-      this.getPropertyFields(
366
-        Object.assign({}, { propertyType: this.$route.params.propType }),
367
-      );
356
+      this.getPropertyFields(this.$route.params.propType);
368 357
 
369 358
       return this.propertyType;
370 359
     },

+ 5
- 5
src/components/shared/lightBoxGallery.vue 查看文件

@@ -51,23 +51,23 @@ export default {
51 51
   props: {
52 52
     thumbnails: {
53 53
       type: Array,
54
-      required: true
54
+      default: () => []
55 55
     },
56 56
     largeImages: {
57 57
       type: Array,
58
-      required: true
58
+      default: () => []
59 59
     },
60 60
     captions: {
61 61
       type: Array,
62
-      required: true
62
+      default: () => []
63 63
     },
64 64
     thumbnailsPath: {
65 65
       type: String,
66
-      required: true
66
+      default: ""
67 67
     },
68 68
     largePath: {
69 69
       type: String,
70
-      required: true
70
+      default: ""
71 71
     },
72 72
     caption: true
73 73
   },

+ 12
- 4
src/components/shared/navBar.vue 查看文件

@@ -96,11 +96,11 @@
96 96
               >To Sell</div>
97 97
               <div
98 98
                 class="dropdown-item cursor-pointer"
99
-                @click="routerGoTo('/property/Residential/Sale')"
99
+                @click="routerGoTo('/property/list/Residential/GeorgeW')"
100 100
               >My Residential Properties</div>
101 101
               <div
102 102
                 class="dropdown-item cursor-pointer"
103
-                @click="routerGoTo('/property/Residential/Sale')"
103
+                @click="routerGoTo('/property/list/Residential/All')"
104 104
               >Admin Residential Properties</div>
105 105
             </div>
106 106
           </li>
@@ -129,11 +129,11 @@
129 129
               >To Sell</a>
130 130
               <a
131 131
                 class="dropdown-item cursor-pointer"
132
-                @click="routerGoTo('/property/Commercial/Sale')"
132
+                @click="routerGoTo('/property/list/Commercial/GeorgeW')"
133 133
               >My Commercial Properties</a>
134 134
               <a
135 135
                 class="dropdown-item cursor-pointer"
136
-                @click="routerGoTo('/property/Commercial/Sale')"
136
+                @click="routerGoTo('/property/list/Commercial/All')"
137 137
               >Admin Commercial Properties</a>
138 138
             </div>
139 139
           </li>
@@ -169,6 +169,14 @@
169 169
                 class="dropdown-item cursor-pointer"
170 170
                 @click="routerGoTo('/status/changeLogPage')"
171 171
               >Changes Logs</a>
172
+              <a
173
+                class="dropdown-item cursor-pointer"
174
+                @click="routerGoTo('/userDefinedGroups/list')"
175
+              >Property User Defined Groups</a>
176
+              <a
177
+                class="dropdown-item cursor-pointer"
178
+                @click="routerGoTo('/propertyTypes/list')"
179
+              >Property Types</a>
172 180
             </div>
173 181
           </li>
174 182
           <li class="nav-item">

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

@@ -153,7 +153,7 @@ export default {
153 153
           province: this.selectedProvince,
154 154
           city: this.selectedCity,
155 155
           suburb: this.selectedSuburb,
156
-          propType: this.propertyType,
156
+          propType: this.selectedPropType,
157 157
           keyword: this.keyword,
158 158
         },
159 159
       });

+ 170
- 119
src/router/index.js 查看文件

@@ -13,7 +13,13 @@ import Agency from '../components/user/registerAgencySection.vue';
13 13
 
14 14
 import PropertySearch from '../components/property/propertySearchPage.vue';
15 15
 import PropertyPage from '../components/property/propertyPage.vue';
16
-import PropertyEdit from '../components/property/propertyeditPage.vue';
16
+import PropertyEdit from '../components/property/propertyEditPage.vue';
17
+import PropertyList from '../components/property/propertyList.vue';
18
+import PropertyTypeList from '../components/admin/property/propertyTypeList.vue';
19
+import PropertyType from '../components/admin/property/propertyTypeEdit.vue';
20
+import UserDefinedGroups from '../components/admin/property/userDefinedGroupsPage.vue';
21
+import UserDefinedGroup from '../components/admin/property/userDefinedGroupPage.vue';
22
+import UserField from '../components/admin/property/userDefinedFieldPage.vue';
17 23
 
18 24
 import AboutUs from '../components/about/aboutUsPage.vue';
19 25
 import AboutTimeshare from '../components/about/aboutTimeshare.vue';
@@ -31,126 +37,171 @@ import UnitPage from '../components/timeshare/resort/unitPage.vue';
31 37
 import ContactUs from '../components/misc/contactUs.vue';
32 38
 import PrivacyPolicy from '../components/misc/privacyPolicyPage.vue';
33 39
 
34
-
35 40
 Vue.use(Router);
36 41
 
37 42
 export default new Router({
38
-  routes: [{
39
-    path: '/',
40
-    name: 'Home',
41
-    component: HomePage,
42
-  },
43
-  {
44
-    path: '/about/us',
45
-    name: 'aboutus',
46
-    component: AboutUs,
47
-  },
48
-  {
49
-    path: '/about/timeshare',
50
-    name: 'abouttimeshare',
51
-    component: AboutTimeshare,
52
-  },
53
-  {
54
-    path: '/timeshare/sell',
55
-    name: 'TimeshareSell',
56
-    component: TimeshareSell,
57
-  },
58
-  {
59
-    path: '/timeshare/buy',
60
-    name: 'TimeshareBuy',
61
-    component: TimeshareBuy,
62
-  },
63
-  {
64
-    path: '/timeshare/faq',
65
-    name: 'TimeshareFAQ',
66
-    component: TimeshareFAQ,
67
-  },
68
-  {
69
-    path: '/user/login',
70
-    name: 'Login',
71
-    component: Login,
72
-  },
73
-  {
74
-    path: '/user/register',
75
-    name: 'PrivateIndividual',
76
-    component: PrivateIndividual,
77
-  },
78
-  {
79
-    path: '/user/registeragency',
80
-    name: 'Agency',
81
-    component: Agency,
82
-  },
83
-  {
84
-    path: '/property/property/:id',
85
-    name: 'PropertyPage',
86
-    component: PropertyPage,
87
-  },
88
-  {
89
-    path: '/property/:propertyType/search',
90
-    name: 'PropertySearch',
91
-    component: PropertySearch,
92
-  },
93
-  {
94
-    path: '/property/search',
95
-    name: 'PropertySearchTab',
96
-    component: PropertySearch,
97
-  },
98
-  {
99
-    path: '/property/:propType/:saleType',
100
-    name: 'PropertyEdit',
101
-    component: PropertyEdit,
102
-  },
103
-  {
104
-    path: '/status/list',
105
-    name: 'StatusList',
106
-    component: Status,
107
-  },
108
-  {
109
-    path: '/status/timeshareAdmin',
110
-    name: 'TimeshareAdmin',
111
-    component: timeshareAdminPage,
112
-  },
113
-  {
114
-    path: '/status/tenderWeekAdmin',
115
-    name: 'TenderWeekAdmin',
116
-    component: tenderWeekAdminPage,
117
-  },
118
-  {
119
-    path: '/status/userManagementPage',
120
-    name: 'userManagementPage',
121
-    component: userManagementPage,
122
-  },
123
-  {
124
-    path: '/status/changeLogPage',
125
-    name: 'changeLogPage',
126
-    component: changeLogPage,
127
-  },
128
-  {
129
-    path: '/unitConfiguration/list',
130
-    name: 'UnitConfiguration',
131
-    component: UnitConfiguration,
132
-  },
133
-  {
134
-    path: '/contactus',
135
-    name: 'ContactUs',
136
-    component: ContactUs,
137
-  },
138
-  {
139
-    path: '/privacypolicy',
140
-    name: 'PrivacyPolicy',
141
-    component: PrivacyPolicy,
142
-  },
143
-  {
144
-    path: '/resort/:resortCode',
145
-    name: 'ResortPage',
146
-    component: ResortPage,
147
-    props: true,
148
-  },
149
-  {
150
-    path: '/resort/:resortCode/:weekId',
151
-    name: 'UnitPage',
152
-    component: UnitPage,
153
-    props: true,
154
-  },
43
+  routes: [
44
+    {
45
+      path: '/',
46
+      name: 'Home',
47
+      component: HomePage,
48
+    },
49
+    {
50
+      path: '/about/us',
51
+      name: 'aboutus',
52
+      component: AboutUs,
53
+    },
54
+    {
55
+      path: '/about/timeshare',
56
+      name: 'abouttimeshare',
57
+      component: AboutTimeshare,
58
+    },
59
+    {
60
+      path: '/timeshare/sell',
61
+      name: 'TimeshareSell',
62
+      component: TimeshareSell,
63
+    },
64
+    {
65
+      path: '/timeshare/buy',
66
+      name: 'TimeshareBuy',
67
+      component: TimeshareBuy,
68
+    },
69
+    {
70
+      path: '/timeshare/faq',
71
+      name: 'TimeshareFAQ',
72
+      component: TimeshareFAQ,
73
+    },
74
+    {
75
+      path: '/user/login',
76
+      name: 'Login',
77
+      component: Login,
78
+    },
79
+    {
80
+      path: '/user/register',
81
+      name: 'PrivateIndividual',
82
+      component: PrivateIndividual,
83
+    },
84
+    {
85
+      path: '/user/registeragency',
86
+      name: 'Agency',
87
+      component: Agency,
88
+    },
89
+    {
90
+      path: '/property/property/:id',
91
+      name: 'PropertyPage',
92
+      component: PropertyPage,
93
+    },
94
+    {
95
+      path: '/property/:propertyType/search',
96
+      name: 'PropertySearch',
97
+      component: PropertySearch,
98
+    },
99
+    {
100
+      path: '/property/search',
101
+      name: 'PropertySearchTab',
102
+      component: PropertySearch,
103
+    },
104
+    {
105
+      path: '/property/:propType/:saleType',
106
+      name: 'PropertyNew',
107
+      component: PropertyEdit,
108
+    },
109
+    {
110
+      path: '/property/:id',
111
+      name: 'PropertyEdit',
112
+      component: PropertyEdit,
113
+    },
114
+    {
115
+      path: '/property/list/:propertyType/:user',
116
+      name: 'PropertyList',
117
+      component: PropertyList,
118
+    },
119
+    {
120
+      path: '/propertyTypes/list',
121
+      name: 'PropertyTypeList',
122
+      component: PropertyTypeList,
123
+    },
124
+    {
125
+      path: '/propertyType/new',
126
+      name: 'PropertyTypeNew',
127
+      component: PropertyType,
128
+    },
129
+    {
130
+      path: '/propertyType/:id',
131
+      name: 'PropertyTypeEdit',
132
+      component: PropertyType,
133
+    },
134
+    {
135
+      path: '/userDefinedGroups/list',
136
+      name: 'UserDefinedGroupsList',
137
+      component: UserDefinedGroups,
138
+    },
139
+    {
140
+      path: '/userDefinedGroups/userDefinedGroup/:id',
141
+      name: 'UserDefinedGroupEdit',
142
+      component: UserDefinedGroup,
143
+    },
144
+    {
145
+      path: '/userDefinedGroups/userDefinedGroup',
146
+      name: 'UserDefinedGroupNew',
147
+      component: UserDefinedGroup,
148
+    },
149
+    {
150
+      path: '/userField',
151
+      name: 'UserDefinedField',
152
+      component: UserField,
153
+    },
154
+    {
155
+      path: '/status/list',
156
+      name: 'StatusList',
157
+      component: Status,
158
+    },
159
+    {
160
+      path: '/status/timeshareAdmin',
161
+      name: 'TimeshareAdmin',
162
+      component: timeshareAdminPage,
163
+    },
164
+    {
165
+      path: '/status/tenderWeekAdmin',
166
+      name: 'TenderWeekAdmin',
167
+      component: tenderWeekAdminPage,
168
+    },
169
+    {
170
+      path: '/status/userManagementPage',
171
+      name: 'userManagementPage',
172
+      component: userManagementPage,
173
+    },
174
+    {
175
+      path: '/status/changeLogPage',
176
+      name: 'changeLogPage',
177
+      component: changeLogPage,
178
+    },
179
+    {
180
+      path: '/unitConfiguration/list',
181
+      name: 'UnitConfiguration',
182
+      component: UnitConfiguration,
183
+    },
184
+    {
185
+      path: '/contactus',
186
+      name: 'ContactUs',
187
+      component: ContactUs,
188
+    },
189
+    {
190
+      path: '/privacypolicy',
191
+      name: 'PrivacyPolicy',
192
+      component: PrivacyPolicy,
193
+    },
194
+    {
195
+      path: '/resort/:resortCode',
196
+      name: 'ResortPage',
197
+      component: ResortPage,
198
+      props: true,
199
+    },
200
+    {
201
+      path: '/resort/:resortCode/:weekId',
202
+      name: 'UnitPage',
203
+      component: UnitPage,
204
+      props: true,
205
+    },
155 206
   ],
156 207
 });

+ 6
- 0
src/store/index.js 查看文件

@@ -10,6 +10,9 @@ import SearchTabModule from './modules/searchTab';
10 10
 import ResortModule from './modules/timeshare/resort';
11 11
 import PropertyModule from './modules/property/property';
12 12
 import WeekModule from './modules/timeshare/week';
13
+import PropertyAdminModule from './modules/property/propertyAdmin';
14
+import PropertyList from './modules/property/propertyLists';
15
+import PropertyTypes from './modules/property/propertyTypes';
13 16
 
14 17
 Vue.use(Vuex);
15 18
 /* eslint no-param-reassign: ["error", { "props": false }] */
@@ -24,5 +27,8 @@ export default new Vuex.Store({
24 27
     resort: ResortModule,
25 28
     property: PropertyModule,
26 29
     week: WeekModule,
30
+    propertyAdmin: PropertyAdminModule,
31
+    propertyList: PropertyList,
32
+    propertyTypes: PropertyTypes,
27 33
   },
28 34
 });

+ 28
- 10
src/store/modules/property/property.js 查看文件

@@ -3,7 +3,24 @@ import axios from 'axios';
3 3
 export default {
4 4
   namespaced: true,
5 5
   state: {
6
-    property: null,
6
+    property: {
7
+      id: 0,
8
+      propertyTypeId: 0,
9
+      propertyName: '',
10
+      unit: '',
11
+      addressLine1: '',
12
+      addressLine2: '',
13
+      addressLine3: '',
14
+      suburbId: 0,
15
+      cityId: 0,
16
+      provinceId: 0,
17
+      price: '',
18
+      per: '',
19
+      description: '',
20
+      isSale: false,
21
+      propertyUserFields: [],
22
+      propertyImages: [],
23
+    },
7 24
     propertyImages: [],
8 25
     propertyTypes: [],
9 26
     propertyTypesRes: [],
@@ -43,21 +60,22 @@ export default {
43 60
   },
44 61
   getters: {},
45 62
   actions: {
46
-    getProperty({ commit }, item) {
63
+    getProperty({ commit }, id) {
64
+      console.log(id);
47 65
       axios
48
-        .get(`http://localhost:57260/Property/Property/${item.id}`)
66
+        .get(`http://localhost:57260/Property/Property/${id}`)
49 67
         .then(result => commit('setProperty', result.data))
50 68
         .catch(console.error);
51 69
     },
52
-    getPropertyImages({ commit }, item) {
70
+    getPropertyImages({ commit }, id) {
53 71
       axios
54
-        .get(`http://localhost:57260/property/PropertyImage/getpropertyimages/${item.id}`)
72
+        .get(`http://localhost:57260/property/PropertyImage/getpropertyimages/${id}`)
55 73
         .then(result => commit('setPropertyImages', result.data))
56 74
         .catch(console.error);
57 75
     },
58
-    getPropertyTypes({ commit }, item) {
76
+    getPropertyTypes({ commit }, propertyType) {
59 77
       axios
60
-        .get(`http://localhost:57260/Property/PropertyType/type/${item.propertyType}`)
78
+        .get(`http://localhost:57260/Property/PropertyType/type/${propertyType}`)
61 79
         .then(result => commit('setPropertyTypes', result.data))
62 80
         .catch(console.error);
63 81
     },
@@ -78,14 +96,14 @@ export default {
78 96
         .get('http://localhost:57260/Property/PropertyFields/Property Overview')
79 97
         .then(response => commit('setPropertyOverviewFields', response.data));
80 98
     },
81
-    getPropertyFields({ commit }, item) {
99
+    getPropertyFields({ commit }, propertyType) {
82 100
       axios
83
-        .get(`http://localhost:57260/property/propertyfields/Propertytype/${item.propertyType}`)
101
+        .get(`http://localhost:57260/property/propertyfields/Propertytype/${propertyType}`)
84 102
         .then(response => commit('setPropertyFields', response.data));
85 103
     },
86 104
     saveProperty({ commit }, item) {
87 105
       axios
88
-        .post('http://localhost:57260/Property/Property', item.newProperty)
106
+        .post('http://localhost:57260/Property/Property', item)
89 107
         .then(result => commit('updateCurrentProperty', result.data))
90 108
         .catch(console.error);
91 109
     },

+ 73
- 0
src/store/modules/property/propertyAdmin.js 查看文件

@@ -0,0 +1,73 @@
1
+import axios from 'axios';
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    userDefinedGroups: [],
7
+    userDefinedGroup: null,
8
+    userFields: [],
9
+    userField: null,
10
+  },
11
+  mutations: {
12
+    setUserDefinedGroups(state, groups) {
13
+      state.userDefinedGroups = groups;
14
+    },
15
+    setUserDefinedGroup(state, group) {
16
+      state.userDefinedGroup = group;
17
+    },
18
+    setUserFields(state, fields) {
19
+      state.userFields = fields;
20
+    },
21
+    setUserField(state, field) {
22
+      state.userField = field;
23
+    },
24
+    updateUserDefinedGroups(state, field) {
25
+      state.userDefinedGroups.push(field);
26
+    },
27
+  },
28
+  getters: {},
29
+  actions: {
30
+    getUserDefinedGroups({ commit }) {
31
+      axios
32
+        .get('http://localhost:57260/Property/UserDefinedGroup')
33
+        .then(result => commit('setUserDefinedGroups', result.data))
34
+        .catch(console.error);
35
+    },
36
+    getUserDefinedGroup({ commit }, item) {
37
+      axios
38
+        .get(`http://localhost:57260/Property/UserDefinedGroup/${item.id}`)
39
+        .then(result => commit('setUserDefinedGroup', result.data))
40
+        .catch(console.error);
41
+    },
42
+    getUserFields({ commit }, item) {
43
+      axios
44
+        .get(`http://localhost:57260/Property/UserDefinedField/group/${item.groupId}`)
45
+        .then(result => commit('setUserFields', result.data))
46
+        .catch(console.error);
47
+    },
48
+    getUserField({ commit }, item) {
49
+      axios
50
+        .get(`http://localhost:57260/Property/UserDefinedField/${item.id}`)
51
+        .then(result => commit('setUserField', result.data))
52
+        .catch(console.error);
53
+    },
54
+    saveUserDefinedGroup({ commit }, item) {
55
+      axios
56
+        .post('http://localhost:57260/Property/UserDefinedGroup', item.group)
57
+        .then(response => commit('updateUserDefinedGroups', response.data))
58
+        .catch(console.error);
59
+    },
60
+    updateUserDefinedGroup({ commit }, item) {
61
+      axios
62
+        .put('http://localhost:57260/Property/UserDefinedGroup', item.group)
63
+        .then(response => commit('updateUserDefinedGroups', response.data))
64
+        .catch(console.error);
65
+    },
66
+    // deleteUserDefinedGroup(item) {
67
+    //   axios
68
+    //     .delete(`http://localhost:57260/Property/UserDefinedField/${item.id}`)
69
+    //     .then((response) => {})
70
+    //     .catch(console.error);
71
+    // },
72
+  },
73
+};

+ 22
- 0
src/store/modules/property/propertyLists.js 查看文件

@@ -0,0 +1,22 @@
1
+import axios from 'axios';
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    properties: [],
7
+  },
8
+  mutations: {
9
+    setProperties(state, properties) {
10
+      state.properties = properties;
11
+    },
12
+  },
13
+  getters: {},
14
+  actions: {
15
+    getProperties({ commit }, item) {
16
+      axios
17
+        .get(`http://localhost:57260/Property/property/${item.propertyType}/${item.user}`)
18
+        .then(result => commit('setProperties', result.data))
19
+        .catch(console.error);
20
+    },
21
+  },
22
+};

+ 72
- 0
src/store/modules/property/propertyTypes.js 查看文件

@@ -0,0 +1,72 @@
1
+import axios from 'axios';
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    propertyTypes: [],
7
+    propertyType: {
8
+      description: '',
9
+      usageType: 0,
10
+    },
11
+  },
12
+  mutations: {
13
+    setPropertyTypes(state, types) {
14
+      state.propertyTypes = types;
15
+    },
16
+    setPropertyType(state, type) {
17
+      state.propertyType = type;
18
+    },
19
+    addToPropertyTypes(state, type) {
20
+      state.propertyTypes.push(type);
21
+    },
22
+    updatePropertyTypes(state, type) {
23
+      state.propertyTypes.find(item => item.id === type.id).description = type.description;
24
+      state.propertyTypes.find(item => item.id === type.id).usageType = type.usageType;
25
+    },
26
+    clearPropertyType(state) {
27
+      state.propertyType = {
28
+        description: '',
29
+        usageType: 0,
30
+      };
31
+    },
32
+    removePropertyType(state, id) {
33
+      state.propertyTypes.pop(state.propertyTypes.find(p => p.id === id));
34
+    },
35
+  },
36
+  getters: {},
37
+  actions: {
38
+    getPropertyTypes({ commit }) {
39
+      axios
40
+        .get('http://localhost:57260/Property/PropertyType')
41
+        .then(result => commit('setPropertyTypes', result.data))
42
+        .catch(console.error);
43
+    },
44
+    getPropertyType({ commit }, id) {
45
+      axios
46
+        .get(`http://localhost:57260/Property/PropertyType/${id}`)
47
+        .then(result => commit('setPropertyType', result.data))
48
+        .catch(console.error);
49
+    },
50
+    savePropertyType({ commit }, item) {
51
+      axios
52
+        .post('http://localhost:57260/Property/PropertyType', item)
53
+        .then(result => commit('addToPropertyTypes', result.data))
54
+        .catch(console.error);
55
+    },
56
+    updatePropertyType({ commit }, item) {
57
+      axios
58
+        .put('http://localhost:57260/Property/PropertyType', item)
59
+        .then(result => commit('updatePropertyTypes', item))
60
+        .catch(console.error);
61
+    },
62
+    clearPropertyType({ commit }) {
63
+      commit('clearPropertyType');
64
+    },
65
+    deletePropertyType({ commit }, id) {
66
+      axios
67
+        .delete(`http://localhost:57260/Property/PropertyType/${id}`)
68
+        .then(result => commit('removePropertyType', id))
69
+        .catch(console.error);
70
+    },
71
+  },
72
+};

正在加载...
取消
保存