Browse Source

Merge branch 'dev' of http://git.ycjcjy.com/SpaceOfCheng/admin into dev

yuantianjiao 6 years ago
parent
commit
c0eb6c168e

+ 85
- 22
src/pages/system/caseManager/caseAreaManager/add.vue View File

8
             <div style="width:50%">
8
             <div style="width:50%">
9
               <el-input
9
               <el-input
10
                 placeholder="请输入区域名"
10
                 placeholder="请输入区域名"
11
-                v-model="postData.areaName"
11
+                v-model="postData.AreaName"
12
                 clearable>
12
                 clearable>
13
               </el-input>
13
               </el-input>
14
             </div>
14
             </div>
18
           <span>案场:</span>
18
           <span>案场:</span>
19
           <div class="flex-item">
19
           <div class="flex-item">
20
             <div style="width:50%">
20
             <div style="width:50%">
21
-              <el-select v-model="postData.case" placeholder="请选择">
21
+              <el-select v-model="CaseId" placeholder="请选择">
22
                 <el-option
22
                 <el-option
23
-                  v-for="item in caseList"
24
-                  :key="item.value"
25
-                  :label="item.label"
26
-                  :value="item.value">
23
+                  v-for="item in cases"
24
+                  :key="item.CaseId"
25
+                  :label="item.CaseName"
26
+                  :value="item.CaseId">
27
                 </el-option>
27
                 </el-option>
28
               </el-select>
28
               </el-select>
29
             </div>
29
             </div>
33
           <span>图片:</span>
33
           <span>图片:</span>
34
           <div class="flex-item">
34
           <div class="flex-item">
35
             <div>
35
             <div>
36
-              <a class="formImg">
37
-                <img src="" class="centerLabel contain" alt="">
38
-                <i class="iconfont icon-quxiao"></i>
39
-              </a>
40
-              <el-button type="success" size="mini">上传图片</el-button>
36
+              <el-upload
37
+                class="avatar-uploader"
38
+                :action='$api.file.image.url'
39
+                :show-file-list="false"
40
+                :on-success="handleAvatarSuccess">
41
+                <img v-if="postData.AreaIcon" :src="postData.AreaIcon" class="avatar">
42
+                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
43
+              </el-upload>
41
             </div>
44
             </div>
42
           </div>
45
           </div>
43
         </li>
46
         </li>
45
           <span>黑白图片:</span>
48
           <span>黑白图片:</span>
46
           <div class="flex-item">
49
           <div class="flex-item">
47
             <div>
50
             <div>
48
-              <a class="formImg">
49
-                <img src="" class="centerLabel contain" alt="">
50
-                <i class="iconfont icon-quxiao"></i>
51
-              </a>
52
-              <el-button type="success" size="mini">上传图片</el-button>
51
+              <el-upload
52
+                class="avatar-uploader"
53
+                :action='$api.file.image.url'
54
+                :show-file-list="false"
55
+                :on-success="handleAvatarSuccesser">
56
+                <img v-if="postData.AreaIconWhite" :src="postData.AreaIconWhite" class="avatar">
57
+                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
58
+              </el-upload>
53
             </div>
59
             </div>
54
           </div>
60
           </div>
55
         </li>
61
         </li>
63
 </template>
69
 </template>
64
 
70
 
65
 <script>
71
 <script>
72
+import { mapState } from 'vuex'
73
+
66
 export default {
74
 export default {
67
   name: '',
75
   name: '',
68
   data () {
76
   data () {
69
     return {
77
     return {
70
       postData: {
78
       postData: {
71
-        areaName: '',
72
-        case: ''
79
+        AreaId: '', // 区域id
80
+        CaseId: '', // 案场id
81
+        OrgId: '', // 机构id
82
+        AreaName: '', // 区域名称
83
+        AreaIcon: '', // 区域图标
84
+        AreaIconWhite: '', // 区域图标灰白
73
       },
85
       },
74
       caseList: [{
86
       caseList: [{
75
         value: '0',
87
         value: '0',
83
       }],
95
       }],
84
     }
96
     }
85
   },
97
   },
98
+  computed: {
99
+    ...mapState({
100
+      cases: x => x.app.cases.list,
101
+      defaultCaseId: x => x.app.cases.default
102
+    }),
103
+    CaseId: {
104
+      get () {
105
+        return this.postData.CaseId || this.defaultCaseId
106
+      },
107
+      set (val) {
108
+        this.postData.CaseId = val
109
+      }
110
+    }
111
+  },
86
   components: {},
112
   components: {},
87
   methods: {
113
   methods: {
88
-    submit () {
89
-      console.log(this.postData)
114
+    handleAvatarSuccesser (res, file) {
115
+      this.postData.AreaIconWhite = res.result.url
116
+    },
117
+    handleAvatarSuccess (res, file) {
118
+      this.postData.AreaIcon = res.result.url
119
+    },
120
+    submit () { // 提交数据
121
+      if (this.postData.AreaName === '') {
122
+        this.$message({
123
+          type: 'error',
124
+          message: '区域名称不能为空'
125
+        })
126
+        return false
127
+      }
128
+      if (this.postData.AreaIcon === '') {
129
+        this.$message({
130
+          type: 'error',
131
+          message: '区域图标不能为空'
132
+        })
133
+        return false
134
+      }
135
+      if (this.postData.AreaIconWhite === '') {
136
+        this.$message({
137
+          type: 'error',
138
+          message: '区域图标灰白不能为空'
139
+        })
140
+        return false
141
+      }
142
+      this.postData.OrgId = this.OrgId
143
+      this.$ajax(this.$api.caseManager.addCaseArea.url, {
144
+        method: this.$api.caseManager.addCaseArea.method,
145
+        queryData: { ...this.postData, CaseId: this.CaseId }
146
+      }).then(res => {
147
+        this.$message({
148
+          type: 'success',
149
+          message: '操作成功!'
150
+        })
151
+        this.$router.push({name: 'caseAreaManager'})
152
+      })
90
     },
153
     },
91
     cancel () {
154
     cancel () {
92
-      this.$router.go(-1)
155
+      this.$router.push({name: 'caseAreaManager'})
93
     }
156
     }
94
   },
157
   },
95
-  mounted () {}
158
+  mounted () { }
96
 }
159
 }
97
 </script>
160
 </script>
98
 
161
 

+ 57
- 53
src/pages/system/caseManager/caseAreaManager/index.vue View File

8
         <ul>
8
         <ul>
9
           <li>
9
           <li>
10
             <span>选择案场:</span>
10
             <span>选择案场:</span>
11
-            <el-select v-model="tableSearch.caseId" placeholder="请选择">
11
+            <el-select v-model="CaseId" placeholder="请选择">
12
               <el-option
12
               <el-option
13
-                v-for="item in caseList"
14
-                :key="item.value"
15
-                :label="item.label"
16
-                :value="item.value">
13
+                v-for="item in cases"
14
+                :key="item.CaseId"
15
+                :label="item.CaseName"
16
+                :value="item.CaseId">
17
               </el-option>
17
               </el-option>
18
             </el-select>
18
             </el-select>
19
           </li>
19
           </li>
20
         </ul>
20
         </ul>
21
-        <tableSearch value="请输入区域名" @exportSearchKey="searchList"></tableSearch>
21
+        <el-button
22
+          size="mini"
23
+          type="primary" @click="search">搜索</el-button>
22
       </div>
24
       </div>
23
       <div class="moreFilter"></div>
25
       <div class="moreFilter"></div>
24
     </div>
26
     </div>
25
     <div class="system-table-box">
27
     <div class="system-table-box">
26
       <el-table
28
       <el-table
27
-        :data="tableData"
29
+        :data="currentList"
28
         stripe
30
         stripe
29
         style="width: 100%">
31
         style="width: 100%">
30
         <el-table-column
32
         <el-table-column
31
-          prop="areaName"
33
+          prop="AreaName"
32
           label="区域名">
34
           label="区域名">
33
         </el-table-column>
35
         </el-table-column>
34
         <el-table-column
36
         <el-table-column
35
-          prop="icon"
37
+          prop="AreaIcon"
36
           label="图标">
38
           label="图标">
37
           <template slot-scope="scope">
39
           <template slot-scope="scope">
38
             <a class="tableImg">
40
             <a class="tableImg">
39
-              <img src="" class="centerLabel contain" alt="">
41
+              <img :src="scope.row" class="centerLabel contain" alt="">
40
             </a>
42
             </a>
41
           </template>
43
           </template>
42
         </el-table-column>
44
         </el-table-column>
43
         <el-table-column
45
         <el-table-column
44
-          prop="case"
46
+          prop="CaseName"
45
           label="案场">
47
           label="案场">
46
         </el-table-column>
48
         </el-table-column>
47
         <el-table-column label="操作">
49
         <el-table-column label="操作">
59
       </el-table>
61
       </el-table>
60
     </div>
62
     </div>
61
     <el-pagination
63
     <el-pagination
62
-      @size-change="handleSizeChange"
63
       @current-change="handleCurrentChange"
64
       @current-change="handleCurrentChange"
64
-      :current-page.sync="currentPage"
65
-      :page-size="10"
65
+      :current-page.sync="postData.page"
66
+      :page-size="postData.pagesize"
66
       layout="prev, pager, next, jumper"
67
       layout="prev, pager, next, jumper"
67
-      :total="100">
68
+      :total="total">
68
     </el-pagination>
69
     </el-pagination>
69
   </div>
70
   </div>
70
 </template>
71
 </template>
71
 
72
 
72
 <script>
73
 <script>
73
-import { createNamespacedHelpers } from 'vuex'
74
-import tableSearch from '@/components/tableSearch/index'
75
-
76
-const { mapState: mapCaseState } = createNamespacedHelpers('case')
74
+import { mapState } from 'vuex'
77
 
75
 
78
 export default {
76
 export default {
79
   name: '',
77
   name: '',
80
   data () {
78
   data () {
81
     return {
79
     return {
82
-      currentPage: 0, // 当前页码
83
-      tableSearch: { // 表格搜索条件
84
-        key: '', // 搜索关键字
85
-        caseId: '', // 案场id
80
+      total: 0,
81
+      postData: { // 表格搜索条件
82
+        CaseId: '', // 案场id
83
+        page: 1, // 当前页码
84
+        pagesize: 10, // 请求数据量
86
       },
85
       },
87
-      tableData: [{
88
-        areaName: 'xxx',
89
-        icon: 'xxx',
90
-        case: 'xxx'
91
-      }, {
92
-        areaName: 'xxx',
93
-        icon: 'xxx',
94
-        case: 'xxx'
95
-      }, {
96
-        areaName: 'xxx',
97
-        icon: 'xxx',
98
-        case: 'xxx'
99
-      }, {
100
-        areaName: 'xxx',
101
-        icon: 'xxx',
102
-        case: 'xxx'
103
-      }]
86
+      currentList: [],
104
     }
87
     }
105
   },
88
   },
106
-  computed: {
107
-    ...mapCaseState({
108
-      caseList: x => x.caseList,
109
-    })
89
+  created () {
90
+    this.getList()
110
   },
91
   },
111
-  components: {
112
-    tableSearch,
92
+  computed: {
93
+    ...mapState({
94
+      cases: x => x.app.cases.list,
95
+      defaultCaseId: x => x.app.cases.default
96
+    }),
97
+    CaseId: {
98
+      get () {
99
+        return this.postData.CaseId || this.defaultCaseId
100
+      },
101
+      set (val) {
102
+        this.postData.CaseId = val
103
+      }
104
+    }
113
   },
105
   },
114
   methods: {
106
   methods: {
115
-    handleSizeChange (val) {
116
-      console.log(`每页 ${val} 条`)
107
+    search () { // 搜索
108
+      this.postData.page = 1
109
+      this.currentList = []
110
+      this.getList()
111
+    },
112
+    getList () { // 获取列表
113
+      this.$ajax(this.$api.caseManager.getCaseAreaList.url, {
114
+        method: this.$api.caseManager.getCaseAreaList.method,
115
+        queryData: { ...this.postData, CaseId: this.CaseId }
116
+      }).then(res => {
117
+        for (var n = 0; n < res.list.length; n++) {
118
+          res.list[n].CaseName = this.cases.filter(x => x.CaseId === res.list[n].CaseId)[0].CaseName
119
+        }
120
+        this.currentList = res.list
121
+        this.postData.page = res.page
122
+        this.total = res.pagenum
123
+      })
117
     },
124
     },
118
-    handleCurrentChange (val) {
119
-      console.log(`当前页: ${val}`)
125
+    handleCurrentChange (val) { // 跳转到分页
126
+      this.getList()
120
     },
127
     },
121
     editItem (index, row) { // 编辑
128
     editItem (index, row) { // 编辑
122
       console.log(index, row)
129
       console.log(index, row)
140
         })
147
         })
141
       })
148
       })
142
     },
149
     },
143
-    searchList (key) { // 搜索列表
144
-      console.log(key)
145
-    },
146
     addCaseArea () {
150
     addCaseArea () {
147
       this.$router.push({ name: 'addCaseArea' })
151
       this.$router.push({ name: 'addCaseArea' })
148
     }
152
     }

+ 86
- 34
src/pages/system/caseManager/caseInfo/addCase/index.vue View File

3
     <form class="mainForm">
3
     <form class="mainForm">
4
       <ul>
4
       <ul>
5
         <li class="flex-h">
5
         <li class="flex-h">
6
-          <span>案场名称:</span>
6
+          <span>案场名称:<em>*</em></span>
7
           <div class="flex-item">
7
           <div class="flex-item">
8
             <div style="width:50%">
8
             <div style="width:50%">
9
               <el-input
9
               <el-input
10
-                placeholder="请输入内容"
11
-                v-model="postData.name"
10
+                placeholder="请输入名称"
11
+                v-model="postData.CaseName"
12
                 clearable>
12
                 clearable>
13
               </el-input>
13
               </el-input>
14
             </div>
14
             </div>
22
                 type="textarea"
22
                 type="textarea"
23
                 :autosize="{ minRows: 3, maxRows: 5}"
23
                 :autosize="{ minRows: 3, maxRows: 5}"
24
                 placeholder="请填写详细地址"
24
                 placeholder="请填写详细地址"
25
-                v-model="postData.address">
25
+                v-model="postData.CaseAddress">
26
               </el-input>
26
               </el-input>
27
             </div>
27
             </div>
28
           </div>
28
           </div>
29
         </li>
29
         </li>
30
         <li class="flex-h">
30
         <li class="flex-h">
31
-          <span>案场头像:</span>
31
+          <span>案场描述:</span>
32
           <div class="flex-item">
32
           <div class="flex-item">
33
             <div>
33
             <div>
34
-              <a class="formImg">
35
-                <img src="" class="centerLabel contain" alt="">
36
-                <i class="iconfont icon-quxiao"></i>
37
-              </a>
38
-              <el-button type="success" size="mini">上传图片</el-button>
34
+              <el-input
35
+                type="textarea"
36
+                :autosize="{ minRows: 3, maxRows: 5}"
37
+                placeholder="请填写详细描述"
38
+                v-model="postData.CaseDesc">
39
+              </el-input>
39
             </div>
40
             </div>
40
           </div>
41
           </div>
41
         </li>
42
         </li>
42
         <li class="flex-h">
43
         <li class="flex-h">
43
-          <span>案场负责人:</span>
44
+          <span>案场电话:</span>
44
           <div class="flex-item">
45
           <div class="flex-item">
45
             <div style="width:50%">
46
             <div style="width:50%">
46
               <el-input
47
               <el-input
47
-                placeholder="真实姓名,可包含汉字、英文"
48
-                v-model="postData.leaderName"
48
+                placeholder="限中国地区有效号码"
49
+                v-model="postData.CaseTel"
49
                 clearable>
50
                 clearable>
50
               </el-input>
51
               </el-input>
51
             </div>
52
             </div>
52
           </div>
53
           </div>
53
         </li>
54
         </li>
54
         <li class="flex-h">
55
         <li class="flex-h">
55
-          <span>负责人手机号:</span>
56
+          <span>案场头像:</span>
56
           <div class="flex-item">
57
           <div class="flex-item">
57
-            <div style="width:50%">
58
-              <el-input
59
-                placeholder="限中国地区有效手机号"
60
-                v-model="postData.leaderPhone"
61
-                clearable>
62
-              </el-input>
58
+            <div>
59
+              <!-- <a class="formImg">
60
+                <img :src="postData.CaseIcon" class="centerLabel contain" alt="">
61
+                <i class="iconfont icon-quxiao"></i>
62
+              </a> -->
63
+              <el-upload
64
+                class="avatar-uploader"
65
+                :action='$api.file.image.url'
66
+                :show-file-list="false"
67
+                :on-success="handleAvatarSuccess">
68
+                <img v-if="postData.CaseIcon" :src="postData.CaseIcon" class="avatar">
69
+                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
70
+              </el-upload>
63
             </div>
71
             </div>
64
           </div>
72
           </div>
65
         </li>
73
         </li>
66
         <li class="flex-h">
74
         <li class="flex-h">
67
-          <span>左击地图获取经纬度:</span>
68
-          <div class="flex-item">
75
+          <span>左击地图获取经纬度:<em>*</em></span>
76
+          <div class="flex-item" style="margin-left: 10px;">
69
             <div style="width:50%">
77
             <div style="width:50%">
70
               <el-input
78
               <el-input
71
                 placeholder=""
79
                 placeholder=""
72
-                v-model="postData.atitudeAndLongitude"
80
+                v-model="postData.Coordinate"
73
                 clearable>
81
                 clearable>
74
               </el-input>
82
               </el-input>
75
             </div>
83
             </div>
97
 </template>
105
 </template>
98
 
106
 
99
 <script>
107
 <script>
108
+import { mapState, mapActions } from 'vuex'
100
 
109
 
101
 export default {
110
 export default {
102
   name: '',
111
   name: '',
104
     var _self = this
113
     var _self = this
105
     return {
114
     return {
106
       postData: {
115
       postData: {
107
-        name: '', // 案场名称
108
-        address: '', // 案场地址
109
-        leaderName: '', // 负责人
110
-        leaderPhone: '', // 负责人手机号
111
-        atitudeAndLongitude: '',
116
+        OrgId: '', // 机构id
117
+        CaseId: '', // 案场id
118
+        CaseName: '', // 案场名称
119
+        CaseDesc: '', // 案场描述
120
+        CaseIcon: '', // 案场图标
121
+        CaseAddress: '', // 案场地址
122
+        CaseTel: '', // 案场电话
123
+        Coordinate: '', // 经纬度
124
+        Status: '', // 状态
125
+        CreatDate: '', // 创建日期
126
+        CreatUser: '', // 创建人
112
       },
127
       },
113
       markers: [],
128
       markers: [],
114
       searchOption: {
129
       searchOption: {
118
       mapCenter: [118.789509, 32.019989],
133
       mapCenter: [118.789509, 32.019989],
119
       events: {
134
       events: {
120
         click: (e) => {
135
         click: (e) => {
121
-          _self.postData.atitudeAndLongitude = e.lnglat.lat + ',' + e.lnglat.lng
136
+          _self.postData.Coordinate = e.lnglat.lat + ',' + e.lnglat.lng
122
         }
137
         }
123
       },
138
       },
124
     }
139
     }
125
   },
140
   },
141
+  computed: {
142
+    ...mapState({
143
+      OrgId: x => x.app.user.OrgId,
144
+    }),
145
+  },
126
   components: {},
146
   components: {},
127
   methods: {
147
   methods: {
128
-    onSearchResult (pois) {
148
+    ...mapActions([
149
+      'updateSystemInfo'
150
+    ]),
151
+    handleAvatarSuccess (res, file) {
152
+      this.postData.CaseIcon = res.result.url
153
+    },
154
+    onSearchResult (pois) { // 搜索地图
129
       let latSum = 0
155
       let latSum = 0
130
       let lngSum = 0
156
       let lngSum = 0
131
       if (pois.length > 0) {
157
       if (pois.length > 0) {
142
         this.mapCenter = [center.lng, center.lat]
168
         this.mapCenter = [center.lng, center.lat]
143
       }
169
       }
144
     },
170
     },
145
-    submit () {
146
-      console.log(this.postData)
171
+    submit () { // 提交数据
172
+      if (this.postData.CaseName === '') {
173
+        this.$message({
174
+          type: 'error',
175
+          message: '案场名称不能为空'
176
+        })
177
+        return false
178
+      }
179
+      if (this.postData.Coordinate === '') {
180
+        this.$message({
181
+          type: 'error',
182
+          message: '案场经纬度不能为空'
183
+        })
184
+        return false
185
+      }
186
+      this.postData.OrgId = this.OrgId
187
+      this.$ajax(this.$api.caseManager.addCase.url, {
188
+        method: this.$api.caseManager.addCase.method,
189
+        data: this.postData
190
+      }).then(res => {
191
+        this.$message({
192
+          type: 'success',
193
+          message: '操作成功'
194
+        })
195
+        this.updateSystemInfo().then(() => {
196
+          this.$router.push({ name: 'caseInfo' })
197
+        })
198
+      })
147
     },
199
     },
148
-    cancel () {
149
-      this.$router.go(-1)
200
+    cancel () { // 取消
201
+      this.$router.push({ name: 'caseInfo' })
150
     }
202
     }
151
   }
203
   }
152
 }
204
 }

+ 5
- 1
src/pages/system/caseManager/caseInfo/addCase/page.scss View File

1
-
1
+span{
2
+  em{
3
+    color: red;
4
+  }
5
+}
2
 .map{
6
 .map{
3
   height: 500px;
7
   height: 500px;
4
   background: #eee;
8
   background: #eee;

+ 97
- 34
src/pages/system/caseManager/caseInfo/editCase/index.vue View File

3
     <form class="mainForm">
3
     <form class="mainForm">
4
       <ul>
4
       <ul>
5
         <li class="flex-h">
5
         <li class="flex-h">
6
-          <span>案场名称:</span>
6
+          <span>案场名称:<em>*</em></span>
7
           <div class="flex-item">
7
           <div class="flex-item">
8
             <div style="width:50%">
8
             <div style="width:50%">
9
               <el-input
9
               <el-input
10
-                placeholder="请输入内容"
11
-                v-model="postData.name"
10
+                placeholder="请输入名称"
11
+                v-model="postData.CaseName"
12
                 clearable>
12
                 clearable>
13
               </el-input>
13
               </el-input>
14
             </div>
14
             </div>
22
                 type="textarea"
22
                 type="textarea"
23
                 :autosize="{ minRows: 3, maxRows: 5}"
23
                 :autosize="{ minRows: 3, maxRows: 5}"
24
                 placeholder="请填写详细地址"
24
                 placeholder="请填写详细地址"
25
-                v-model="postData.address">
25
+                v-model="postData.CaseAddress">
26
               </el-input>
26
               </el-input>
27
             </div>
27
             </div>
28
           </div>
28
           </div>
29
         </li>
29
         </li>
30
         <li class="flex-h">
30
         <li class="flex-h">
31
-          <span>案场头像:</span>
31
+          <span>案场描述:</span>
32
           <div class="flex-item">
32
           <div class="flex-item">
33
             <div>
33
             <div>
34
-              <a class="formImg">
35
-                <img src="" class="centerLabel contain" alt="">
36
-                <i class="iconfont icon-quxiao"></i>
37
-              </a>
38
-              <el-button type="success" size="mini">上传图片</el-button>
34
+              <el-input
35
+                type="textarea"
36
+                :autosize="{ minRows: 3, maxRows: 5}"
37
+                placeholder="请填写详细描述"
38
+                v-model="postData.CaseDesc">
39
+              </el-input>
39
             </div>
40
             </div>
40
           </div>
41
           </div>
41
         </li>
42
         </li>
42
         <li class="flex-h">
43
         <li class="flex-h">
43
-          <span>案场负责人:</span>
44
+          <span>案场电话:</span>
44
           <div class="flex-item">
45
           <div class="flex-item">
45
             <div style="width:50%">
46
             <div style="width:50%">
46
               <el-input
47
               <el-input
47
-                placeholder="真实姓名,可包含汉字、英文"
48
-                v-model="postData.leaderName"
48
+                placeholder="限中国地区有效号码"
49
+                v-model="postData.CaseTel"
49
                 clearable>
50
                 clearable>
50
               </el-input>
51
               </el-input>
51
             </div>
52
             </div>
52
           </div>
53
           </div>
53
         </li>
54
         </li>
54
         <li class="flex-h">
55
         <li class="flex-h">
55
-          <span>负责人手机号:</span>
56
+          <span>案场头像:</span>
56
           <div class="flex-item">
57
           <div class="flex-item">
57
-            <div style="width:50%">
58
-              <el-input
59
-                placeholder="限中国地区有效手机号"
60
-                v-model="postData.leaderPhone"
61
-                clearable>
62
-              </el-input>
58
+            <div>
59
+              <!-- <a class="formImg">
60
+                <img :src="postData.CaseIcon" class="centerLabel contain" alt="">
61
+                <i class="iconfont icon-quxiao"></i>
62
+              </a> -->
63
+              <el-upload
64
+                class="avatar-uploader"
65
+                :action='$api.file.image.url'
66
+                :show-file-list="false"
67
+                :on-success="handleAvatarSuccess">
68
+                <img v-if="postData.CaseIcon" :src="postData.CaseIcon" class="avatar">
69
+                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
70
+              </el-upload>
63
             </div>
71
             </div>
64
           </div>
72
           </div>
65
         </li>
73
         </li>
66
         <li class="flex-h">
74
         <li class="flex-h">
67
-          <span>左击地图获取经纬度:</span>
68
-          <div class="flex-item">
75
+          <span>左击地图获取经纬度:<em>*</em></span>
76
+          <div class="flex-item" style="margin-left: 10px;">
69
             <div style="width:50%">
77
             <div style="width:50%">
70
               <el-input
78
               <el-input
71
                 placeholder=""
79
                 placeholder=""
72
-                v-model="postData.atitudeAndLongitude"
80
+                v-model="postData.Coordinate"
73
                 clearable>
81
                 clearable>
74
               </el-input>
82
               </el-input>
75
             </div>
83
             </div>
97
 </template>
105
 </template>
98
 
106
 
99
 <script>
107
 <script>
108
+import { mapState, mapActions } from 'vuex'
100
 
109
 
101
 export default {
110
 export default {
102
   name: '',
111
   name: '',
104
     var _self = this
113
     var _self = this
105
     return {
114
     return {
106
       postData: {
115
       postData: {
107
-        name: '', // 案场名称
108
-        address: '', // 案场地址
109
-        leaderName: '', // 负责人
110
-        leaderPhone: '', // 负责人手机号
111
-        atitudeAndLongitude: '',
116
+        OrgId: '', // 机构id
117
+        CaseId: '', // 案场id
118
+        CaseName: '', // 案场名称
119
+        CaseDesc: '', // 案场描述
120
+        CaseIcon: '', // 案场图标
121
+        CaseAddress: '', // 案场地址
122
+        CaseTel: '', // 案场电话
123
+        Coordinate: '', // 经纬度
124
+        Status: '', // 状态
125
+        CreatDate: '', // 创建日期
126
+        CreatUser: '', // 创建人
112
       },
127
       },
113
       markers: [],
128
       markers: [],
114
       searchOption: {
129
       searchOption: {
118
       mapCenter: [118.789509, 32.019989],
133
       mapCenter: [118.789509, 32.019989],
119
       events: {
134
       events: {
120
         click: (e) => {
135
         click: (e) => {
121
-          _self.postData.atitudeAndLongitude = e.lnglat.lat + ',' + e.lnglat.lng
136
+          _self.postData.Coordinate = e.lnglat.lat + ',' + e.lnglat.lng
122
         }
137
         }
123
       },
138
       },
124
     }
139
     }
125
   },
140
   },
141
+  computed: {
142
+    ...mapState({
143
+      OrgId: x => x.app.user.OrgId,
144
+    }),
145
+  },
146
+  created () {
147
+    this.getCaseInfoById()
148
+  },
126
   components: {},
149
   components: {},
127
   methods: {
150
   methods: {
128
-    onSearchResult (pois) {
151
+    ...mapActions([
152
+      'updateSystemInfo'
153
+    ]),
154
+    getCaseInfoById () { // 获取案场信息
155
+      this.$ajax(this.$api.caseManager.getCaseInfo.url, {
156
+        method: this.$api.caseManager.getCaseInfo.method,
157
+        urlData: { id: this.$route.query.id }
158
+      }).then(res => {
159
+        this.postData = res
160
+      })
161
+    },
162
+    handleAvatarSuccess (res, file) {
163
+      this.postData.CaseIcon = res.result.url
164
+    },
165
+    onSearchResult (pois) { // 搜索地图
129
       let latSum = 0
166
       let latSum = 0
130
       let lngSum = 0
167
       let lngSum = 0
131
       if (pois.length > 0) {
168
       if (pois.length > 0) {
142
         this.mapCenter = [center.lng, center.lat]
179
         this.mapCenter = [center.lng, center.lat]
143
       }
180
       }
144
     },
181
     },
145
-    submit () {
146
-      console.log(this.postData)
182
+    submit () { // 提交数据
183
+      if (this.postData.CaseName === '') {
184
+        this.$message({
185
+          type: 'error',
186
+          message: '案场名称不能为空'
187
+        })
188
+        return false
189
+      }
190
+      if (this.postData.Coordinate === '') {
191
+        this.$message({
192
+          type: 'error',
193
+          message: '案场经纬度不能为空'
194
+        })
195
+        return false
196
+      }
197
+      this.postData.OrgId = this.OrgId
198
+      this.$ajax(this.$api.caseManager.addCase.url, {
199
+        method: this.$api.caseManager.addCase.method,
200
+        data: this.postData
201
+      }).then(res => {
202
+        this.$message({
203
+          type: 'success',
204
+          message: '操作成功'
205
+        })
206
+        this.updateSystemInfo().then(() => {
207
+          this.$router.push({ name: 'caseInfo' })
208
+        })
209
+      })
147
     },
210
     },
148
-    cancel () {
149
-      this.$router.go(-1)
211
+    cancel () { // 取消
212
+      this.$router.push({ name: 'caseInfo' })
150
     }
213
     }
151
   }
214
   }
152
 }
215
 }

+ 5
- 1
src/pages/system/caseManager/caseInfo/editCase/page.scss View File

1
-
1
+span{
2
+  em{
3
+    color: red;
4
+  }
5
+}
2
 .map{
6
 .map{
3
   height: 500px;
7
   height: 500px;
4
   background: #eee;
8
   background: #eee;

+ 4
- 4
src/pages/system/caseManager/caseInfo/index.vue View File

3
     <div class="system-table-search">
3
     <div class="system-table-search">
4
       <div class="flex-h">
4
       <div class="flex-h">
5
         <div class="flex-item flex-h">
5
         <div class="flex-item flex-h">
6
-          <el-button size="mini" type="success" @click="redirection('addIndexCase')">新增案场</el-button>
6
+          <el-button size="mini" type="success" @click="redirection('addCase')">新增案场</el-button>
7
         </div>
7
         </div>
8
         <tableSearch value="请输入案场名称" @exportSearchKey="searchList"></tableSearch>
8
         <tableSearch value="请输入案场名称" @exportSearchKey="searchList"></tableSearch>
9
       </div>
9
       </div>
60
       total: 0,
60
       total: 0,
61
       postData: { // 表格搜索条件
61
       postData: { // 表格搜索条件
62
         name: '', // 案场名称
62
         name: '', // 案场名称
63
-        page: 0, // 当前页码
63
+        page: 1, // 当前页码
64
         pagesize: 10, // 请求数据量
64
         pagesize: 10, // 请求数据量
65
       },
65
       },
66
       currentList: []
66
       currentList: []
94
     },
94
     },
95
     editItem (index, row) { // 修改
95
     editItem (index, row) { // 修改
96
       // console.log(index, row)
96
       // console.log(index, row)
97
-      this.$router.push({ name: 'editIndexCase', query: { id: row.id } })
97
+      this.$router.push({ name: 'editCase', query: { id: row.CaseId } })
98
     },
98
     },
99
     keyManager (index, row) { // 钥匙管理
99
     keyManager (index, row) { // 钥匙管理
100
       console.log(index, row)
100
       console.log(index, row)
102
     searchList (key) { // 搜索列表
102
     searchList (key) { // 搜索列表
103
       this.postData.name = key
103
       this.postData.name = key
104
       this.currentList = []
104
       this.currentList = []
105
-      this.postData.page = 0
105
+      this.postData.page = 1
106
       this.getList()
106
       this.getList()
107
     }
107
     }
108
   }
108
   }

+ 50
- 49
src/pages/system/caseManager/keyManager/index.vue View File

6
         <ul>
6
         <ul>
7
           <li>
7
           <li>
8
             <span>选择案场:</span>
8
             <span>选择案场:</span>
9
-            <el-select v-model="tableSearch.caseId" placeholder="请选择">
9
+            <el-select v-model="CaseId" placeholder="请选择">
10
               <el-option
10
               <el-option
11
-                v-for="item in caseList"
12
-                :key="item.value"
13
-                :label="item.label"
14
-                :value="item.value">
11
+                v-for="item in cases"
12
+                :key="item.CaseId"
13
+                :label="item.CaseName"
14
+                :value="item.CaseId">
15
               </el-option>
15
               </el-option>
16
             </el-select>
16
             </el-select>
17
           </li>
17
           </li>
18
         </ul>
18
         </ul>
19
-        <tableSearch value="请输入锁柜编号" @exportSearchKey="searchList"></tableSearch>
19
+        <el-button
20
+          size="mini"
21
+          type="primary" @click="search">搜索</el-button>
20
       </div>
22
       </div>
21
       <div class="moreFilter"></div>
23
       <div class="moreFilter"></div>
22
     </div>
24
     </div>
23
     <div class="system-table-box">
25
     <div class="system-table-box">
24
       <el-table
26
       <el-table
25
-        :data="tableData"
27
+        :data="currentList"
26
         stripe
28
         stripe
27
         style="width: 100%">
29
         style="width: 100%">
28
         <el-table-column
30
         <el-table-column
52
       </el-table>
54
       </el-table>
53
     </div>
55
     </div>
54
     <el-pagination
56
     <el-pagination
55
-      @size-change="handleSizeChange"
56
       @current-change="handleCurrentChange"
57
       @current-change="handleCurrentChange"
57
-      :current-page.sync="currentPage"
58
-      :page-size="10"
58
+      :current-page.sync="postData.page"
59
+      :page-size="postData.pagesize"
59
       layout="prev, pager, next, jumper"
60
       layout="prev, pager, next, jumper"
60
-      :total="100">
61
+      :total="total">
61
     </el-pagination>
62
     </el-pagination>
62
     <el-dialog title="钥匙绑定" :visible.sync="dialogTableVisible">
63
     <el-dialog title="钥匙绑定" :visible.sync="dialogTableVisible">
63
       <ul class="cutBindType">
64
       <ul class="cutBindType">
89
 </template>
90
 </template>
90
 
91
 
91
 <script>
92
 <script>
92
-import { createNamespacedHelpers } from 'vuex'
93
-import tableSearch from '@/components/tableSearch/index'
94
-
95
-const { mapState: mapCaseState } = createNamespacedHelpers('case')
93
+import { mapState } from 'vuex'
96
 
94
 
97
 export default {
95
 export default {
98
   name: '',
96
   name: '',
119
         name: '王小虎',
117
         name: '王小虎',
120
         address: '上海市普陀区金沙江路 1518 弄'
118
         address: '上海市普陀区金沙江路 1518 弄'
121
       }],
119
       }],
122
-      currentPage: 0, // 当前页码
123
-      tableSearch: { // 表格搜索条件
124
-        key: '', // 搜索关键字
125
-        caseId: '', // 案场id
120
+      total: 0,
121
+      postData: { // 表格搜索条件
122
+        CaseId: '', // 案场id
123
+        page: 1, // 当前页码
124
+        pagesize: 10, // 请求数据量
126
       },
125
       },
127
-      tableData: [{
128
-        lockersId: 'xxx',
129
-        currentUser: 'xxx',
130
-        status: 'xxx'
131
-      }, {
132
-        lockersId: 'xxx',
133
-        currentUser: 'xxx',
134
-        status: 'xxx'
135
-      }, {
136
-        lockersId: 'xxx',
137
-        currentUser: 'xxx',
138
-        status: 'xxx'
139
-      }, {
140
-        lockersId: 'xxx',
141
-        currentUser: 'xxx',
142
-        status: 'xxx'
143
-      }]
126
+      currentList: [],
144
     }
127
     }
145
   },
128
   },
146
-  computed: {
147
-    ...mapCaseState({
148
-      caseList: x => x.caseList,
149
-    })
129
+  created () {
130
+    this.getList()
150
   },
131
   },
151
-  components: {
152
-    tableSearch,
132
+  computed: {
133
+    ...mapState({
134
+      cases: x => x.app.cases.list,
135
+      defaultCaseId: x => x.app.cases.default
136
+    }),
137
+    CaseId: {
138
+      get () {
139
+        return this.postData.CaseId || this.defaultCaseId
140
+      },
141
+      set (val) {
142
+        this.postData.CaseId = val
143
+      }
144
+    }
153
   },
145
   },
154
   methods: {
146
   methods: {
155
     sureBindPhone () { // 确认绑定手机号
147
     sureBindPhone () { // 确认绑定手机号
156
       this.showCardList = true
148
       this.showCardList = true
157
     },
149
     },
158
-    handleSizeChange (val) {
159
-      console.log(`每页 ${val} 条`)
150
+    search () { // 搜索
151
+      this.postData.page = 1
152
+      this.currentList = []
153
+      this.getList()
160
     },
154
     },
161
-    handleCurrentChange (val) {
162
-      console.log(`当前页: ${val}`)
155
+    getList () { // 获取列表
156
+      this.$ajax(this.$api.caseManager.getKeyList.url, {
157
+        method: this.$api.caseManager.getKeyList.method,
158
+        queryData: { ...this.postData, CaseId: this.CaseId }
159
+      }).then(res => {
160
+        this.currentList = res.list
161
+        this.postData.page = res.page
162
+        this.total = res.pagenum
163
+      })
164
+    },
165
+    handleCurrentChange (val) { // 跳转到分页
166
+      this.getList()
163
     },
167
     },
164
     bindItem (index, row) { // 绑定
168
     bindItem (index, row) { // 绑定
165
       console.log(index, row)
169
       console.log(index, row)
183
         })
187
         })
184
       })
188
       })
185
     },
189
     },
186
-    searchList (key) { // 搜索列表
187
-      console.log(key)
188
-    }
189
   }
190
   }
190
 }
191
 }
191
 </script>
192
 </script>

+ 2
- 3
src/pages/system/channelManager/channelList/index.vue View File

71
       total: 0,
71
       total: 0,
72
       postData: { // 表格搜索条件
72
       postData: { // 表格搜索条件
73
         CaseId: '', // 案场id
73
         CaseId: '', // 案场id
74
-        page: 0, // 当前页码
74
+        page: 1, // 当前页码
75
         pagesize: 10, // 请求数据量
75
         pagesize: 10, // 请求数据量
76
       },
76
       },
77
       currentList: []
77
       currentList: []
96
   },
96
   },
97
   methods: {
97
   methods: {
98
     search () { // 搜索
98
     search () { // 搜索
99
-      this.postData.page = 0
99
+      this.postData.page = 1
100
       this.currentList = []
100
       this.currentList = []
101
       this.getList()
101
       this.getList()
102
     },
102
     },
114
       })
114
       })
115
     },
115
     },
116
     handleCurrentChange (val) { // 跳转到分页
116
     handleCurrentChange (val) { // 跳转到分页
117
-      this.postData.page = val - 1
118
       this.getList()
117
       this.getList()
119
     },
118
     },
120
     handleEdit (index, row) { // 编辑
119
     handleEdit (index, row) { // 编辑

+ 3
- 3
src/pages/system/goodsManager/goodsSpecManager/index.vue View File

67
       total: 0,
67
       total: 0,
68
       postData: { // 表格搜索条件
68
       postData: { // 表格搜索条件
69
         CaseId: '', // 案场id
69
         CaseId: '', // 案场id
70
-        page: 0, // 当前页码
71
-        pagesize: 10, // 请求数据量
70
+        page: 1, // 当前页码
71
+        pagesize: 3, // 请求数据量
72
       },
72
       },
73
       currentList: []
73
       currentList: []
74
     }
74
     }
92
   },
92
   },
93
   methods: {
93
   methods: {
94
     search () { // 搜索
94
     search () { // 搜索
95
-      this.postData.page = 0
95
+      this.postData.page = 1
96
       this.currentList = []
96
       this.currentList = []
97
       this.getList()
97
       this.getList()
98
     },
98
     },

+ 2
- 2
src/pages/system/goodsManager/goodsTypeManager/index.vue View File

71
       total: 0,
71
       total: 0,
72
       postData: { // 表格搜索条件
72
       postData: { // 表格搜索条件
73
         CaseId: '', // 案场id
73
         CaseId: '', // 案场id
74
-        page: 0, // 当前页码
74
+        page: 1, // 当前页码
75
         pagesize: 10, // 请求数据量
75
         pagesize: 10, // 请求数据量
76
       },
76
       },
77
       currentList: []
77
       currentList: []
96
   },
96
   },
97
   methods: {
97
   methods: {
98
     search () { // 搜索
98
     search () { // 搜索
99
-      this.postData.page = 0
99
+      this.postData.page = 1
100
       this.currentList = []
100
       this.currentList = []
101
       this.getList()
101
       this.getList()
102
     },
102
     },

+ 7
- 4
src/store/app.js View File

87
   },
87
   },
88
   actions: {
88
   actions: {
89
     updateSystemInfo (context) { // 这里的context和我们使用的$store拥有相同的对象和方法
89
     updateSystemInfo (context) { // 这里的context和我们使用的$store拥有相同的对象和方法
90
-      this.$ajax(this.$api.system.init.url, {
91
-        method: this.$api.system.init.method
92
-      }).then(res => {
93
-        context.commit('init', res)
90
+      return new Promise((resolve) => {
91
+        this.$ajax(this.$api.system.init.url, {
92
+          method: this.$api.system.init.method
93
+        }).then(res => {
94
+          context.commit('init', res)
95
+          resolve()
96
+        })
94
       })
97
       })
95
     }
98
     }
96
   }
99
   }

+ 24
- 0
src/util/api.js View File

23
       method: 'get',
23
       method: 'get',
24
       url: `${baseUrl}/common/case/info`
24
       url: `${baseUrl}/common/case/info`
25
     },
25
     },
26
+    addCase: { // 新增案场
27
+      method: 'post',
28
+      url: `${baseUrl}/common/case/info`
29
+    },
30
+    getCaseInfo: { // 查询案场
31
+      method: 'get',
32
+      url: `${baseUrl}/common/case/info/:id`
33
+    },
34
+    editCase: { // 编辑案场
35
+      method: 'put',
36
+      url: `${baseUrl}/common/case/info/:id`
37
+    },
38
+    getKeyList: { // 获取钥匙列表
39
+      method: 'get',
40
+      url: `${baseUrl}/common/case/key`
41
+    },
42
+    getCaseAreaList: { // 获取案场区域列表
43
+      method: 'get',
44
+      url: `${baseUrl}/common/case/area`
45
+    },
46
+    addCaseArea: { // 新增案场区域
47
+      method: 'post',
48
+      url: `${baseUrl}/common/case/area`
49
+    },
26
   },
50
   },
27
   goodsManager: {
51
   goodsManager: {
28
     getGoodsSpecList: { // 商品规格列表
52
     getGoodsSpecList: { // 商品规格列表