Selaa lähdekoodia

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

许成详 6 vuotta sitten
vanhempi
commit
2a98935d25

+ 46
- 24
src/pages/system/courseManager/courseList/index.vue Näytä tiedosto

@@ -173,7 +173,7 @@
173 173
                 :action='$api.file.image.url'
174 174
                 :show-file-list="false"
175 175
                 :on-success="handleAvatarSuccess">
176
-                <img v-if="editCourseDetail.newImg" :src="editCourseDetail.newImg" class="avatar">
176
+                <img v-if="newImg" :src="newImg" class="avatar">
177 177
                 <i v-else class="el-icon-plus avatar-uploader-icon"></i>
178 178
               </el-upload>
179 179
             </div>
@@ -181,19 +181,19 @@
181 181
           <el-button
182 182
             size="mini"
183 183
             type="success"
184
-            v-if="editCourseDetail.newImg"
184
+            v-if="newImg"
185 185
             @click="addThisImg">确定添加图片</el-button>
186 186
         </li>
187 187
       </ul>
188 188
       <el-table
189
-        :data="currentCourseDetail"
189
+        :data="courseImgs"
190 190
         stripe
191 191
         style="width: 100%">
192 192
         <el-table-column
193 193
           prop="img"
194 194
           label="图片">
195 195
           <template slot-scope="scope">
196
-            <img :src="scope.row.img" alt="">
196
+            <img :src="scope.row.ImgUrl" style="width:100%" alt="">
197 197
           </template>
198 198
         </el-table-column>
199 199
         <el-table-column
@@ -202,8 +202,7 @@
202 202
           <template slot-scope="scope">
203 203
             <el-input
204 204
               placeholder="请输入内容"
205
-              v-model="scope.row.sort"
206
-              :disabled="scope.row.edit ? false : true">
205
+              v-model="scope.row.Sort">
207 206
             </el-input>
208 207
           </template>
209 208
         </el-table-column>
@@ -213,12 +212,6 @@
213 212
             <el-button
214 213
               size="mini"
215 214
               type="success"
216
-              v-if="!scope.row.edit"
217
-              @click="editItem(scope.$index, scope.row)">编辑</el-button>
218
-            <el-button
219
-              size="mini"
220
-              type="success"
221
-              v-if="scope.row.edit"
222 215
               @click="sureSort(scope.$index, scope.row)">确认</el-button>
223 216
             <el-button
224 217
               size="mini"
@@ -241,15 +234,13 @@ export default {
241 234
   name: '',
242 235
   data () {
243 236
     return {
237
+      selCourseId: '',
244 238
       currentCourseDetail: [{
245 239
         img: '',
246 240
         sort: 1,
247 241
         edit: false,
248 242
       }],
249
-      editCourseDetail: {
250
-        newImg: '',
251
-        list: [],
252
-      },
243
+      newImg: '',
253 244
       centerDialogVisible: false, // 课程详情弹窗显隐
254 245
       total: 0,
255 246
       postData: { // 表格搜索条件
@@ -275,6 +266,7 @@ export default {
275 266
     }),
276 267
     ...mapCourseState({
277 268
       courses: x => x.courseList,
269
+      courseImgs: x => x.courseImgs
278 270
     }),
279 271
     ...mapLocationState({
280 272
       location: x => x.location
@@ -290,21 +282,46 @@ export default {
290 282
   },
291 283
   methods: {
292 284
     deleteItem (index, item) { // 删除图片
293
-
285
+      this.$confirm('确认删除此课程?', '提示', {
286
+        confirmButtonText: '确定',
287
+        cancelButtonText: '取消',
288
+        type: 'warning'
289
+      })
290
+        .then(() => {
291
+          this.DelCourseImg({id: item.ImgId, callback: this.afterImgAction})
292
+        })
294 293
     },
295 294
     sureSort (index, item) { // 确认图片排序
296
-      this.currentCourseDetail[index].edit = false
295
+      this.UpdateCourseImg({...item, callback: this.afterImgAction})
297 296
     },
298 297
     editItem (index, item) { // 编辑图片排序
299
-      this.currentCourseDetail[index].edit = true
298
+      let imglist = {...this.courseImgs}
299
+      imglist[index].edit = true
300
+      this.UpdateImgList(imglist)
300 301
     },
301 302
     addThisImg () { // 添加图片到课程详情
302
-
303
+      const data = {
304
+        CourseId: this.selCourseId,
305
+        ImgUrl: this.newImg,
306
+        Sort: 0,
307
+        callback: this.afterImgAction
308
+      }
309
+      this.newImg = ''
310
+      this.AddCourseImg(data)
311
+    },
312
+    afterImgAction () {
313
+      this.$message({
314
+        type: 'success',
315
+        message: '操作成功!'
316
+      })
317
+      this.GetCourseImgs({id: this.selCourseId})
303 318
     },
304 319
     handleAvatarSuccess (res, file) {
305
-      this.editCourseDetail.newImg = res.result.url
320
+      this.newImg = res.result.url
306 321
     },
307
-    addDetail (val) { // 添加课程详情
322
+    addDetail (row) { // 添加课程详情
323
+      this.selCourseId = row.CourseId
324
+      this.GetCourseImgs({id: this.selCourseId})
308 325
       this.centerDialogVisible = true
309 326
     },
310 327
     ...mapCourseActions([
@@ -313,7 +330,12 @@ export default {
313 330
       'UnPublic',
314 331
       'DelCourse',
315 332
       'SetNull',
316
-      'GetCourseByID'
333
+      'GetCourseByID',
334
+      'GetCourseImgs',
335
+      'AddCourseImg',
336
+      'UpdateCourseImg',
337
+      'DelCourseImg',
338
+      'UpdateImgList'
317 339
     ]),
318 340
     ...mapLocationActions([
319 341
       'updateLocationInfo',
@@ -325,7 +347,7 @@ export default {
325 347
       return (this.cases.filter(x => x.CaseId === id)[0] || {}).CaseName
326 348
     },
327 349
     FormatDate (date) {
328
-      return this.toolClass.dateFormat(date, 'yyyy-mm-dd')
350
+      return this.toolClass.dateFormat(date, 'yyyy-MM-dd')
329 351
     },
330 352
     search () { // 搜索
331 353
       this.postData.page = 1

+ 21
- 27
src/pages/system/courseManager/courseTag/index.vue Näytä tiedosto

@@ -2,11 +2,11 @@
2 2
   <div class="subPage">
3 3
     <div class="system-table-box">
4 4
       <el-table
5
-        :data="tableData"
5
+        :data="tags.list"
6 6
         stripe
7 7
         style="width: 100%">
8 8
         <el-table-column
9
-          prop="tagName"
9
+          prop="TagName"
10 10
           label="标签名称">
11 11
         </el-table-column>
12 12
       </el-table>
@@ -15,18 +15,17 @@
15 15
       @size-change="handleSizeChange"
16 16
       @current-change="handleCurrentChange"
17 17
       :current-page.sync="currentPage"
18
-      :page-size="10"
18
+      :page-size="tableSearch.pagesize"
19 19
       layout="prev, pager, next, jumper"
20
-      :total="100">
20
+      :total="tags.pagenum">
21 21
     </el-pagination>
22 22
   </div>
23 23
 </template>
24 24
 
25 25
 <script>
26
-import tableSearch from '@/components/tableSearch/index'
27 26
 import { createNamespacedHelpers } from 'vuex'
28 27
 
29
-const { mapState: mapCaseState } = createNamespacedHelpers('case')
28
+const { mapState: mapCourseTagState, mapActions: mapCourseTagActions } = createNamespacedHelpers('coursetag')
30 29
 
31 30
 export default {
32 31
   name: '',
@@ -34,39 +33,34 @@ export default {
34 33
     return {
35 34
       currentPage: 0, // 当前页码
36 35
       tableSearch: { // 表格搜索条件
37
-        key: '', // 搜索关键字
38
-        caseId: '', // 案场id
36
+        page: 1,
37
+        pagesize: 10,
39 38
       },
40
-      tableData: [{
41
-        tagName: 'xxx'
42
-      }, {
43
-        tagName: 'xxx'
44
-      }, {
45
-        tagName: 'xxx'
46
-      }, {
47
-        tagName: 'xxx'
48
-      }]
49 39
     }
50 40
   },
51 41
   computed: {
52
-    ...mapCaseState({
53
-      caseList: x => x.caseList,
42
+    ...mapCourseTagState({
43
+      tags: x => x.tagList,
54 44
     })
55 45
   },
56
-  components: {
57
-    tableSearch,
58
-  },
59 46
   methods: {
47
+    ...mapCourseTagActions([
48
+      'GetCourseTagList',
49
+    ]),
60 50
     handleSizeChange (val) {
61 51
       console.log(`每页 ${val} 条`)
62 52
     },
63 53
     handleCurrentChange (val) {
64
-      console.log(`当前页: ${val}`)
65
-    },
66
-    searchList (key) { // 搜索列表
67
-      console.log(key)
54
+      this.tableSearch.page = val
55
+      this.getList()
68 56
     },
69
-  }
57
+    getList () {
58
+      this.GetCourseTagList(this.tableSearch)
59
+    }
60
+  },
61
+  mounted () {
62
+    this.getList()
63
+  },
70 64
 }
71 65
 </script>
72 66
 

+ 81
- 46
src/pages/system/courseManager/scheduleManager/edit.vue Näytä tiedosto

@@ -4,16 +4,6 @@
4 4
       <div class="flex-h">
5 5
         <div class="flex-item flex-h"></div>
6 6
         <ul>
7
-          <li>
8
-            <el-select v-model="postData.caseid" placeholder="请选择">
9
-              <el-option
10
-                v-for="item in cases"
11
-                :key="item.CaseId"
12
-                :label="item.CaseName"
13
-                :value="item.CaseId">
14
-              </el-option>
15
-            </el-select>
16
-          </li>
17 7
           <li>
18 8
             <el-input
19 9
               placeholder="请输入课程名称"
@@ -30,7 +20,7 @@
30 20
     </div>
31 21
     <div class="system-table-box">
32 22
       <el-table
33
-        :data="currentList"
23
+        :data="schedules.list"
34 24
         stripe
35 25
         style="width: 100%">
36 26
         <el-table-column
@@ -50,12 +40,18 @@
50 40
           label="已排课时数">
51 41
         </el-table-column>
52 42
         <el-table-column
53
-          prop="LocationId"
54
-          label="课程分类">
43
+          label="课程类别"
44
+          width="150">
45
+          <template slot-scope="scope">
46
+            <label>{{getLocationName(scope.row.LocationId)}}</label>
47
+          </template>
55 48
         </el-table-column>
56 49
         <el-table-column
57
-          prop="CaseName"
58
-          label="所在案场">
50
+          label="所在案场"
51
+          width="150">
52
+          <template slot-scope="scope">
53
+            <label>{{getCaseName(scope.row.CaseId)}}</label>
54
+          </template>
59 55
         </el-table-column>
60 56
         <el-table-column
61 57
           label="操作">
@@ -73,7 +69,7 @@
73 69
       :current-page.sync="postData.page"
74 70
       :page-size="postData.pagesize"
75 71
       layout="prev, pager, next, jumper"
76
-      :total="total">
72
+      :total="schedules.pagenum">
77 73
     </el-pagination>
78 74
     <el-dialog
79 75
       title="设置课时时间"
@@ -86,11 +82,11 @@
86 82
             <span>开始时间:</span>
87 83
             <div class="flex-item">
88 84
               <div>
89
-                <el-date-picker
85
+                <el-time-picker
90 86
                   v-model="currentCourseItem.BeginDate"
91
-                  type="date"
87
+                  value-format="HH:mm:ss"
92 88
                   placeholder="选择开始日期">
93
-                </el-date-picker>
89
+                </el-time-picker>
94 90
               </div>
95 91
             </div>
96 92
           </li>
@@ -98,11 +94,11 @@
98 94
             <span>结束时间:</span>
99 95
             <div class="flex-item">
100 96
               <div>
101
-                <el-date-picker
97
+                <el-time-picker
102 98
                   v-model="currentCourseItem.EndDate"
103
-                  type="date"
99
+                  value-format="HH:mm:ss"
104 100
                   placeholder="选择结束日期">
105
-                </el-date-picker>
101
+                </el-time-picker>
106 102
               </div>
107 103
             </div>
108 104
           </li>
@@ -134,7 +130,7 @@
134 130
         </ul>
135 131
       </div>
136 132
       <span slot="footer" class="dialog-footer">
137
-        <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
133
+        <el-button type="primary" @click="handleDetailSave">确 定</el-button>
138 134
         <el-button type="danger" @click="centerDialogVisible = false">取 消</el-button>
139 135
       </span>
140 136
     </el-dialog>
@@ -142,7 +138,10 @@
142 138
 </template>
143 139
 
144 140
 <script>
145
-import { mapState } from 'vuex'
141
+import { createNamespacedHelpers, mapState } from 'vuex'
142
+
143
+const { mapState: mapScheduleState, mapActions: mapScheduleActions } = createNamespacedHelpers('schedule')
144
+const { mapState: mapLocationState, mapActions: mapLocationActions } = createNamespacedHelpers('cms')
146 145
 
147 146
 export default {
148 147
   name: '',
@@ -153,60 +152,96 @@ export default {
153 152
         EndDate: null,
154 153
         DetailName: null,
155 154
         DetailDesc: null,
155
+        CourseId: '',
156 156
       },
157 157
       centerDialogVisible: false,
158
-      total: 0,
159 158
       postData: { // 表格搜索条件
160 159
         caseid: '', // 案场id
161 160
         page: 1, // 当前页码
162 161
         pagesize: 10, // 请求数据量
163
-        typeid: '', // 课程类型
164 162
         name: '', // 课程名称
163
+        date: '',
165 164
       },
166
-      currentList: [{
167
-        CourseName: 'xxx',
168
-        Price: 'xxx',
169
-        CourseNum: 'xxx',
170
-        ScheduleNum: 'xxx',
171
-        LocationId: 'xxx',
172
-        CaseName: 'xxx',
173
-      }],
174
-      courseTypeList: [],
175 165
     }
176 166
   },
177 167
   mounted () {
168
+    const { date, caseid } = this.$route.query
169
+    if (!date || date === '' || !caseid || caseid === '') {
170
+      this.$message({
171
+        type: 'error',
172
+        message: '请先选择排课时间与案场'
173
+      })
174
+      this.$router.push({ name: 'scheduleManager' })
175
+    }
176
+    this.postData.date = date
177
+    this.postData.caseid = caseid
178
+    this.updateLocationInfo()
178 179
     this.$nextTick(function () {
179 180
       this.getList()
180 181
     })
181 182
   },
182 183
   computed: {
184
+    ...mapScheduleState({
185
+      schedules: x => x.scheduleList
186
+    }),
183 187
     ...mapState({
184 188
       cases: x => x.app.cases.list,
185
-      defaultCaseId: x => x.app.cases.default
189
+      orgid: x => x.app.user.OrgId,
190
+    }),
191
+    ...mapLocationState({
192
+      location: x => x.location
186 193
     }),
187
-    CaseId: {
188
-      get () {
189
-        return this.postData.caseid || this.defaultCaseId
190
-      },
191
-      set (val) {
192
-        this.postData.caseid = val
193
-      }
194
-    }
195 194
   },
196 195
   methods: {
197
-    setCourseDate (target) { // 设置课程时间
196
+    ...mapScheduleActions([
197
+      'GetScheduleList',
198
+      'AddDetail'
199
+    ]),
200
+    ...mapLocationActions([
201
+      'updateLocationInfo',
202
+    ]),
203
+    getLocationName (id) {
204
+      return (this.location.filter(x => x.LocationId === id)[0] || {}).LocationName
205
+    },
206
+    getCaseName (id) {
207
+      return (this.cases.filter(x => x.CaseId === id)[0] || {}).CaseName
208
+    },
209
+    setCourseDate (row) { // 设置课程时间
210
+      this.currentCourseItem.CourseId = row.CourseId
211
+      this.currentCourseItem.BeginDate = null
212
+      this.currentCourseItem.EndDate = null
213
+      this.currentCourseItem.DetailName = null
214
+      this.currentCourseItem.DetailDesc = null
198 215
       this.centerDialogVisible = true
199 216
     },
200 217
     search () { // 搜索
201 218
       this.postData.page = 1
202
-      this.currentList = []
203 219
       this.getList()
204 220
     },
205 221
     getList () { // 获取列表
222
+      this.GetScheduleList({...this.postData})
206 223
     },
207 224
     handleCurrentChange (val) { // 跳转到分页
208 225
       this.getList()
209 226
     },
227
+    handleDetailSave () {
228
+      const item = {...this.currentCourseItem,
229
+        OrgId: this.orgid,
230
+        CaseId: this.postData.caseid,
231
+        BeginDate: this.postData.date + 'T' + this.currentCourseItem.BeginDate,
232
+        EndDate: this.postData.date + 'T' + this.currentCourseItem.EndDate,
233
+        callback: this.afterSave
234
+      }
235
+      this.AddDetail(item)
236
+    },
237
+    afterSave () {
238
+      this.$message({
239
+        type: 'success',
240
+        message: '操作成功!'
241
+      })
242
+      this.search()
243
+      this.centerDialogVisible = false
244
+    },
210 245
   }
211 246
 }
212 247
 </script>

+ 131
- 68
src/pages/system/courseManager/scheduleManager/index.vue Näytä tiedosto

@@ -3,11 +3,23 @@
3 3
     <div class="system-table-search">
4 4
       <div class="flex-h">
5 5
         <div class="flex-item flex-h">
6
-          <el-button size="mini" type="success" @click="addSchedule">新增排课</el-button>
6
+          <!-- <el-button size="mini" type="success" @click="addSchedule">新增排课</el-button> -->
7 7
         </div>
8
+        <ul>
9
+          <li>
10
+            <el-select v-model="CaseId" placeholder="请选择案场">
11
+              <el-option
12
+                v-for="item in cases"
13
+                :key="item.CaseId"
14
+                :label="item.CaseName"
15
+                :value="item.CaseId">
16
+              </el-option>
17
+            </el-select>
18
+          </li>
19
+        </ul>
8 20
       </div>
9 21
       <div class="moreFilter"></div>
10
-      <full-calendar :events="fcEvents" locale="zh" @eventClick="eventClick" @dayClick="dayClick"></full-calendar>
22
+      <full-calendar :events="fcEvents" @changeMonth="changeMonth" locale="en" @eventClick="eventClick" @dayClick="dayClick"></full-calendar>
11 23
     </div>
12 24
     <el-dialog
13 25
       title="课时信息"
@@ -16,21 +28,21 @@
16 28
       center>
17 29
       <div>
18 30
         <ul class="courseDetailForm">
31
+          <li class="flex-h">
32
+            <span>案场名称:</span>
33
+            <span>{{currentCourseItem.CaseName}}</span>
34
+          </li>
35
+          <li class="flex-h">
36
+            <span>案场地址:</span>
37
+            <span>{{currentCourseItem.CaseAddress}}</span>
38
+          </li>
19 39
           <li class="flex-h">
20 40
             <span>课程名称:</span>
21
-            <div class="flex-item">
22
-              <div>
23
-                <el-input
24
-                  placeholder="请输入课程名称"
25
-                  v-model="currentCourseItem.CourseName"
26
-                  clearable>
27
-                </el-input>
28
-              </div>
29
-            </div>
41
+            <span>{{currentCourseItem.CourseName}}</span>
30 42
           </li>
31 43
           <li class="flex-h">
32 44
             <span>课时名称:</span>
33
-            <div class="flex-item">
45
+            <div class="flex-item" v-if="currentCourseItem.CourseStatus===0">
34 46
               <div>
35 47
                 <el-input
36 48
                   placeholder="请输入课时名称"
@@ -39,10 +51,11 @@
39 51
                 </el-input>
40 52
               </div>
41 53
             </div>
54
+            <span v-else>{{currentCourseItem.DetailName}}</span>
42 55
           </li>
43 56
           <li class="flex-h">
44 57
             <span>课时简介:</span>
45
-            <div class="flex-item">
58
+            <div class="flex-item" v-if="currentCourseItem.CourseStatus===0">
46 59
               <div>
47 60
                 <el-input
48 61
                   type="textarea"
@@ -52,107 +65,157 @@
52 65
                 </el-input>
53 66
               </div>
54 67
             </div>
55
-          </li>
56
-          <li class="flex-h">
57
-            <span>案场名称:</span>
58
-            <div class="flex-item">
59
-              <div>
60
-                <el-input
61
-                  placeholder="请输入案场名称"
62
-                  v-model="currentCourseItem.CaseName"
63
-                  clearable>
64
-                </el-input>
65
-              </div>
66
-            </div>
67
-          </li>
68
-          <li class="flex-h">
69
-            <span>案场地址:</span>
70
-            <div class="flex-item">
71
-              <div>
72
-                <el-input
73
-                  placeholder="请输入案场地址"
74
-                  v-model="currentCourseItem.CaseAddress"
75
-                  clearable>
76
-                </el-input>
77
-              </div>
78
-            </div>
68
+            <span v-else>{{currentCourseItem.DetailDesc}}</span>
79 69
           </li>
80 70
           <li class="flex-h">
81 71
             <span>开始时间:</span>
82
-            <div class="flex-item">
72
+            <div class="flex-item" v-if="currentCourseItem.CourseStatus===0">
83 73
               <div>
84 74
                 <el-date-picker
85 75
                   v-model="currentCourseItem.BeginDate"
86
-                  type="date"
87
-                  placeholder="选择开始日期">
76
+                  type="datetime"
77
+                  placeholder="选择开始日期"
78
+                  >
88 79
                 </el-date-picker>
89 80
               </div>
90 81
             </div>
82
+            <span v-else>{{this.toolClass.dateFormat(currentCourseItem.BeginDate, 'yyyy-MM-dd hh:mm')}}</span>
91 83
           </li>
92 84
           <li class="flex-h">
93 85
             <span>结束时间:</span>
94
-            <div class="flex-item">
86
+            <div class="flex-item" v-if="currentCourseItem.CourseStatus===0">
95 87
               <div>
96 88
                 <el-date-picker
97 89
                   v-model="currentCourseItem.EndDate"
98
-                  type="date"
90
+                  type="datetime"
99 91
                   placeholder="选择结束日期">
100 92
                 </el-date-picker>
101 93
               </div>
102 94
             </div>
95
+            <span v-else>{{this.toolClass.dateFormat(currentCourseItem.EndDate, 'yyyy-MM-dd hh:mm')}}</span>
103 96
           </li>
104 97
         </ul>
105 98
       </div>
106
-      <span slot="footer" class="dialog-footer">
107
-        <el-button type="danger" @click="centerDialogVisible = false">删除该课时</el-button>
108
-        <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
99
+      <span slot="footer" class="dialog-footer" v-if="currentCourseItem.CourseStatus===0">
100
+        <el-button type="danger" @click="handlDelDetail">删除该课时</el-button>
101
+        <el-button type="primary" @click="handlUpdateDetail">确 定</el-button>
109 102
       </span>
110 103
     </el-dialog>
111 104
   </div>
112 105
 </template>
113 106
 
114 107
 <script>
108
+import { createNamespacedHelpers, mapState } from 'vuex'
115 109
 import fullCalendar from 'vue-fullcalendar'
116 110
 
111
+const { mapState: mapScheduleState, mapActions: mapScheduleActions } = createNamespacedHelpers('schedule')
112
+
117 113
 export default {
118 114
   name: '',
119 115
   data () {
120 116
     return {
121
-      currentCourseItem: {
122
-        CourseName: 'xxx', // 课程名称
123
-        DetailName: 'xxx', // 课时名称
124
-        DetailDesc: 'xxx', // 课时简介
125
-        CaseName: 'xxx', // 案场名称
126
-        CaseAddress: 'xxx', // 案场地点
127
-        BeginDate: 'xxx', // 开始时间
128
-        EndDate: 'xxx', // 结束时间
129
-      },
117
+      caseid: '',
118
+      seldate: '',
119
+      currentCourseItem: {},
130 120
       centerDialogVisible: false,
131
-      fcEvents: [{
132
-        title: '课程名称',
133
-        start: '2018-09-25',
134
-        end: '2018-09-25',
135
-      }, {
136
-        title: '课程名称1',
137
-        start: '2018-09-25',
138
-        end: '2018-09-25',
139
-      }]
140 121
     }
141 122
   },
123
+  computed: {
124
+    ...mapState({
125
+      cases: x => x.app.cases.list,
126
+      defaultCaseId: x => x.app.cases.default
127
+    }),
128
+    ...mapScheduleState({
129
+      details: x => x.detailList
130
+    }),
131
+    CaseId: {
132
+      get () {
133
+        return this.caseid || this.defaultCaseId
134
+      },
135
+      set (val) {
136
+        this.caseid = val
137
+        this.getList()
138
+      }
139
+    },
140
+    fcEvents () {
141
+      return this.details.map(x => {
142
+        return {
143
+          title: x.DetailName,
144
+          start: x.BeginDate,
145
+          end: x.EndDate,
146
+          id: x.DetailId,
147
+          detail: x,
148
+        }
149
+      })
150
+    },
151
+    CurrentMonth: {
152
+      get () {
153
+        const now = new Date()
154
+        return this.seldate || this.getFullDate(now)
155
+      },
156
+      set (val) {
157
+        this.seldate = val
158
+      }
159
+    },
160
+  },
142 161
   components: {
143 162
     fullCalendar,
144 163
   },
145 164
   methods: {
165
+    ...mapScheduleActions([
166
+      'GetDetailList',
167
+      'UpdateDetail',
168
+      'DelDetail'
169
+    ]),
146 170
     dayClick (day, jsEvent) { // 点击某天进入排课
147
-      console.log('dayClick', day, jsEvent)
148
-    },
149
-    addSchedule () { // 新增排课
150
-      this.$router.push({ name: 'editSchedule', query: {} })
171
+      this.$router.push({ name: 'editSchedule', query: {caseid: this.CaseId, date: this.toolClass.dateFormat(day, 'yyyy-MM-dd')} })
151 172
     },
152 173
     eventClick (event, jsEvent, pos) { // 点击日历
153
-      console.log(event, jsEvent, pos)
174
+      this.currentCourseItem = {...event.detail}
154 175
       this.centerDialogVisible = true
155 176
     },
177
+    changeMonth (start, end, current) {
178
+      this.CurrentMonth = this.toolClass.dateFormat(current, 'yyyy-MM')
179
+      this.getList()
180
+    },
181
+    search () { // 搜索
182
+      this.getList()
183
+    },
184
+    getList () {
185
+      this.GetDetailList({
186
+        caseid: this.CaseId,
187
+        date: this.CurrentMonth,
188
+      })
189
+    },
190
+    handlUpdateDetail () {
191
+      this.UpdateDetail({...this.currentCourseItem,
192
+        BeginDate: this.toolClass.dateFormat(this.currentCourseItem.BeginDate, 'yyyy-MM-ddThh:mm:ss'),
193
+        EndDate: this.toolClass.dateFormat(this.currentCourseItem.EndDate, 'yyyy-MM-ddThh:mm:ss'),
194
+        callback: this.AfterAction})
195
+    },
196
+    AfterAction () {
197
+      this.$message({
198
+        type: 'success',
199
+        message: '操作成功!'
200
+      })
201
+      this.search()
202
+      this.centerDialogVisible = false
203
+    },
204
+    handlDelDetail () {
205
+      this.$confirm('确认删除此课时?', '提示', {
206
+        confirmButtonText: '确定',
207
+        cancelButtonText: '取消',
208
+        type: 'warning'
209
+      })
210
+        .then(() => {
211
+          this.DelDetail({id: this.currentCourseItem.DetailId, callback: this.AfterAction})
212
+        })
213
+    }
214
+  },
215
+  mounted () {
216
+    this.$nextTick(function () {
217
+      this.getList()
218
+    })
156 219
   }
157 220
 }
158 221
 </script>

+ 4
- 2
src/pages/system/systemSet/roleManager/add.vue Näytä tiedosto

@@ -75,10 +75,12 @@ export default {
75 75
       if ((this.detail.RoleId || '') === '') {
76 76
         this.detail.CaseId = this.caseid
77 77
         this.detail.OrgId = this.orgid
78
-        this.AddRole(this.detail)
78
+        this.AddRole({...this.detail, callback: this.afterSave})
79 79
       } else {
80
-        this.UpdateRole(this.detail)
80
+        this.UpdateRole({...this.detail, callback: this.afterSave})
81 81
       }
82
+    },
83
+    afterSave () {
82 84
       this.$message({
83 85
         type: 'success',
84 86
         message: '操作成功'

+ 66
- 1
src/store/course/course.js Näytä tiedosto

@@ -6,6 +6,7 @@ export default {
6 6
   state: {
7 7
     courseList: [],
8 8
     courseInfo: {},
9
+    courseImgs: [],
9 10
   },
10 11
   mutations: {
11 12
     updateList (state, payload) {
@@ -14,6 +15,9 @@ export default {
14 15
     updateInfo (state, payload) {
15 16
       state.courseInfo = payload || {}
16 17
     },
18
+    updateImgList (state, payload) {
19
+      state.courseImgs = payload
20
+    }
17 21
   },
18 22
   actions: {
19 23
     GetCourseList ({ commit }, payload) {
@@ -44,6 +48,9 @@ export default {
44 48
         }
45 49
       }).then(res => {
46 50
         commit('updateInfo', res)
51
+        if (payload.callback) {
52
+          payload.callback()
53
+        }
47 54
       })
48 55
     },
49 56
     UpdateCourse ({ commit }, payload) {
@@ -56,6 +63,9 @@ export default {
56 63
           id: payload.GoodsId,
57 64
         }
58 65
       }).then(res => {
66
+        if (payload.callback) {
67
+          payload.callback()
68
+        }
59 69
       })
60 70
     },
61 71
     DelCourse ({ commit }, { id, callback }) {
@@ -99,6 +109,61 @@ export default {
99 109
     },
100 110
     UpdateInfo ({ commit }, payload) {
101 111
       commit('updateInfo', payload)
102
-    }
112
+    },
113
+    UpdateImgList ({ commit }, payload) {
114
+      commit('updateImgList', payload)
115
+    },
116
+    GetCourseImgs ({ commit }, {id, callback}) {
117
+      ajax(api.course.getimgs.url, {
118
+        method: api.course.getimgs.method,
119
+        urlData: {
120
+          id: id,
121
+        }
122
+      }).then(res => {
123
+        commit('updateImgList', res)
124
+        if (callback) {
125
+          callback()
126
+        }
127
+      })
128
+    },
129
+    AddCourseImg ({ commit }, payload) {
130
+      ajax(api.course.addimgs.url, {
131
+        method: api.course.addimgs.method,
132
+        data: {
133
+          ...payload
134
+        }
135
+      }).then(res => {
136
+        if (payload.callback) {
137
+          payload.callback()
138
+        }
139
+      })
140
+    },
141
+    UpdateCourseImg ({ commit }, payload) {
142
+      ajax(api.course.updateimgs.url, {
143
+        method: api.course.updateimgs.method,
144
+        data: {
145
+          ...payload
146
+        },
147
+        urlData: {
148
+          id: payload.id
149
+        }
150
+      }).then(res => {
151
+        if (payload.callback) {
152
+          payload.callback()
153
+        }
154
+      })
155
+    },
156
+    DelCourseImg ({ commit }, { id, callback }) {
157
+      ajax(api.course.deleteimgs.url, {
158
+        method: api.course.deleteimgs.method,
159
+        urlData: {
160
+          id: id,
161
+        }
162
+      }).then(res => {
163
+        if (callback) {
164
+          callback()
165
+        }
166
+      })
167
+    },
103 168
   }
104 169
 }

+ 93
- 0
src/store/course/schedule.js Näytä tiedosto

@@ -0,0 +1,93 @@
1
+import ajax from '../../util/ajax'
2
+import api from '../../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    detailList: [],
8
+    detailInfo: {},
9
+    scheduleList: [],
10
+  },
11
+  mutations: {
12
+    updateList (state, payload) {
13
+      state.detailList = payload || []
14
+    },
15
+    updatesSheduleList (state, payload) {
16
+      state.scheduleList = payload || []
17
+    },
18
+    updateInfo (state, payload) {
19
+      state.detailInfo = payload || {}
20
+    },
21
+  },
22
+  actions: {
23
+    GetDetailList ({ commit }, payload) {
24
+      ajax(api.course.detail.url, {
25
+        method: api.course.detail.method,
26
+        queryData: {
27
+          ...payload,
28
+        }
29
+      }).then(res => {
30
+        commit('updateList', res)
31
+      })
32
+    },
33
+    GetScheduleList ({ commit }, payload) {
34
+      ajax(api.course.schedule.url, {
35
+        method: api.course.schedule.method,
36
+        queryData: {
37
+          ...payload,
38
+        }
39
+      }).then(res => {
40
+        commit('updatesSheduleList', res)
41
+      })
42
+    },
43
+    GetDetailInfo ({ commit }, { id }) {
44
+      ajax(api.course.info.url, {
45
+        method: api.course.info.method,
46
+        urlData: {
47
+          id: id,
48
+        }
49
+      }).then(res => {
50
+        commit('updateInfo', res)
51
+      })
52
+    },
53
+    AddDetail ({ commit }, payload) {
54
+      ajax(api.course.addDetail.url, {
55
+        method: api.course.addDetail.method,
56
+        data: {
57
+          ...payload
58
+        }
59
+      }).then(res => {
60
+        if (payload.callback) {
61
+          payload.callback()
62
+        }
63
+      })
64
+    },
65
+    UpdateDetail ({ commit }, payload) {
66
+      ajax(api.course.updateDetail.url, {
67
+        method: api.course.updateDetail.method,
68
+        data: {
69
+          ...payload
70
+        },
71
+        urlData: {
72
+          id: payload.DetailId,
73
+        }
74
+      }).then(res => {
75
+        if (payload.callback) {
76
+          payload.callback()
77
+        }
78
+      })
79
+    },
80
+    DelDetail ({ commit }, { id, callback }) {
81
+      ajax(api.course.delDetail.url, {
82
+        method: api.course.delDetail.method,
83
+        urlData: {
84
+          id: id,
85
+        }
86
+      }).then(res => {
87
+        if (callback) {
88
+          callback()
89
+        }
90
+      })
91
+    },
92
+  }
93
+}

+ 1
- 0
src/store/index.js Näytä tiedosto

@@ -20,6 +20,7 @@ export const modules = {
20 20
   goods: () => require('./goods/goods').default,
21 21
   course: () => require('./course/course').default,
22 22
   coursetag: () => require('./course/tag').default,
23
+  schedule: () => require('./course/schedule').default,
23 24
 }
24 25
 
25 26
 Object.keys(modules).forEach((modKey) => {

+ 6
- 0
src/store/system/role.js Näytä tiedosto

@@ -48,6 +48,9 @@ export default {
48 48
         }
49 49
       }).then(res => {
50 50
         commit('updateInfo', res)
51
+        if (payload.callback) {
52
+          payload.callback()
53
+        }
51 54
       })
52 55
     },
53 56
     UpdateRole ({ commit }, payload) {
@@ -57,6 +60,9 @@ export default {
57 60
           ...payload
58 61
         }
59 62
       }).then(res => {
63
+        if (payload.callback) {
64
+          payload.callback()
65
+        }
60 66
       })
61 67
     },
62 68
     DelRole ({ commit }, { id, callback }) {

+ 24
- 0
src/util/api.js Näytä tiedosto

@@ -486,6 +486,30 @@ const $api = {
486 486
       method: 'delete',
487 487
       url: `${baseUrl}${common}/courseimg/:id`
488 488
     },
489
+    schedule: {
490
+      method: 'get',
491
+      url: `${baseUrl}${common}/schedule`
492
+    },
493
+    detail: {
494
+      method: 'get',
495
+      url: `${baseUrl}${common}/detail`
496
+    },
497
+    getDetailByID: {
498
+      method: 'get',
499
+      url: `${baseUrl}${common}/detail/:id`
500
+    },
501
+    addDetail: {
502
+      method: 'post',
503
+      url: `${baseUrl}${common}/detail`
504
+    },
505
+    updateDetail: {
506
+      method: 'put',
507
+      url: `${baseUrl}${common}/detail`
508
+    },
509
+    delDetail: {
510
+      method: 'delete',
511
+      url: `${baseUrl}${common}/detail/:id`
512
+    },
489 513
   }
490 514
 }
491 515
 export default $api

+ 22
- 17
src/util/util.js Näytä tiedosto

@@ -1,25 +1,30 @@
1 1
 const toolClass = {
2
-  dateFormat: (timestamp) => {
3
-    let date = new Date(timestamp)
4
-    let y = date.getFullYear()
5
-    let m = date.getMonth() + 1
6
-    let d = date.getDate()
7
-    let h = date.getHours()
8
-    let min = date.getMinutes()
9
-    if (m < 10) {
10
-      m = '0' + m
2
+  dateFormat: (timestamp, fmt) => {
3
+    if (!fmt) {
4
+      fmt = 'yyyy-MM-dd hh:mm'
11 5
     }
12
-    if (d < 10) {
13
-      d = '0' + d
6
+
7
+    let date = new Date(timestamp)
8
+    var o = {
9
+      'M+': date.getMonth() + 1,
10
+      'd+': date.getDate(),
11
+      'h+': date.getHours(),
12
+      'm+': date.getMinutes(),
13
+      's+': date.getSeconds(),
14
+      'q+': Math.floor((date.getMonth() + 3) / 3),
15
+      'S': date.getMilliseconds()
14 16
     }
15
-    if (h < 10) {
16
-      h = '0' + h
17
+    if (/(y+)/.test(fmt)) {
18
+      fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
17 19
     }
18
-    if (min < 10) {
19
-      min = '0' + min
20
+    for (var k in o) {
21
+      if (new RegExp('(' + k + ')').test(fmt)) {
22
+        fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
23
+      }
20 24
     }
21
-    return y + '-' + m + '-' + d + ' ' + h + ':' + min
22
-  }
25
+    return fmt
26
+  },
27
+
23 28
 }
24 29
 
25 30
 export default toolClass