Bläddra i källkod

Merge branch 'develop5.0-tmd' of http://106.12.23.251:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

zhouj1203@hotmail.com 3 år sedan
förälder
incheckning
a83adcea40
1 ändrade filer med 50 tillägg och 25 borttagningar
  1. 50 25
      TEAMModelOS/ClientApp/src/components/selflearn/NewChooseContent.vue

+ 50 - 25
TEAMModelOS/ClientApp/src/components/selflearn/NewChooseContent.vue

@@ -73,7 +73,7 @@
                         <Input v-model="keyWord" class="seach-input light-iview-input" suffix="ios-search" :placeholder="$t('selflearn.choose.searchHolder')" clearable style="width: 240px" size="small" @on-change="searchKeyWord" />
                     </div>
                     <div class="file-content-wrap">
-                        <Table ref="fileTable" :columns="fileColumns" :data="fileListShow" max-height="660" class="animated fadeIn" @on-select="selectFile" @on-select-cancel="cancelSelectFile" @on-select-all="selectAllFile" @on-select-all-cancel="cancelSelectAllFile">
+                        <Table ref="fileTable" :columns="fileColumns" :data="fileListShow" max-height="520" class="animated fadeIn" @on-select="selectFile" @on-select-cancel="cancelSelectFile" @on-select-all="selectAllFile" @on-select-all-cancel="cancelSelectAllFile">
                             <template slot-scope="{ row, index }" slot="size">
                                 <div>
                                     {{row.size/1024 > 1024 ? (row.size/1024/1024).toFixed(1) + 'M': (row.size/1024).toFixed(1) + 'KB'}}
@@ -84,6 +84,11 @@
                                     {{formatDate(row.createTime)}}
                                 </div>
                             </template>
+                            <template slot-scope="{ row, index }" slot="period">
+                                <div>
+                                    {{getPdName(row.periodId)}}
+                                </div>
+                            </template>
                             <template slot-scope="{ row, index }" slot="name">
                                 <div>
                                     <div class="file-icon">
@@ -124,6 +129,7 @@
     </div>
 </template>
 <script>
+import { mapGetters } from 'vuex'
 import JSONPath from 'jsonpath'
 import BlobTool from '@/utils/blobTool.js'
 import ExerciseList from '@/components/selflearn/ExerciseList.vue'
@@ -277,13 +283,19 @@ export default {
             {
                 title: this.$t('teachContent.tableC6'),
                 slot: 'createTime',
-                width: 200,
+                width: 120,
                 sortable: true
             }
             ],
         }
     },
     methods: {
+        getPdName(ids) {
+            let p = this.periods.filter(item => {
+                return ids.includes(item.id)
+            })
+            return p.map(item => { return item.name }).join(',')
+        },
         onPreviewPaper(paper) {
             this.$emit('previewPaper', paper)
         },
@@ -515,26 +527,6 @@ export default {
                 } else if (this.contentFilter.scope == 'school') {
                     sasRes = await this.$tools.getSchoolSas()
                 }
-                // if (sasRes) {
-                //     let op1 = new BlobTool(sasRes.url, sasRes.name, sasRes.sas, this.contentFilter.scope)
-                //     op1.listBlob({
-                //         prefix: this.contentFilter.fileType
-                //     }).then(
-                //         (res) => {
-                //             this.fileList[this.contentFilter.scope][this.contentFilter.fileType] = res.blobList
-                //             this.fileListShow = this.fileList[this.contentFilter.scope][this.contentFilter
-                //                 .fileType
-                //             ]
-                //             this.searchBefore = [...this.fileListShow]
-                //             this.handleCheckStatus()
-                //         },
-                //         (err) => {
-                //             this.$Message.error('API Error')
-                //         }
-                //     )
-                // } else {
-                //     this.$Message.error('API ERROR')
-                // }
                 let params = {
                     name: this.contentFilter.scope == 'private' ? this.$store.state.userInfo.TEAMModelId : this.$store.state.userInfo.schoolCode,
                     periodId: "",
@@ -543,10 +535,9 @@ export default {
                 }
                 this.$api.blob.listBlobInfo(params, sasRes.url).then(
                     (res) => {
+                        console.log('资源信息', res)
                         this.fileList[this.contentFilter.scope][this.contentFilter.fileType] = res
-                        this.fileListShow = this.fileList[this.contentFilter.scope][this.contentFilter
-                            .fileType
-                        ]
+                        this.fileListShow = this.fileList[this.contentFilter.scope][this.contentFilter.fileType]
                         this.searchBefore = [...this.fileListShow]
                         this.handleCheckStatus()
                     },
@@ -658,6 +649,9 @@ export default {
         this.getSchoolBaseInfo()
     },
     computed: {
+        ...mapGetters({
+            periods: 'user/getPeriods', // 學制s
+        }),
         hasSchool() {
             return this.$store.state.userInfo.hasSchool;
         }
@@ -670,6 +664,37 @@ export default {
             },
             deep: true,
             immediate: true
+        },
+        'contentFilter.scope': {
+            handler(n, o) {
+                if (n == 'school') {
+                    let data = []
+                    this.periods.forEach(item => {
+                        data.push({
+                            label: item.name,
+                            value: item.id
+                        })
+                    })
+                    this.fileColumns.splice(2, 0, {
+                        title: this.$t('teachContent.applyPd'),
+                        slot: 'period',
+                        width: 150,
+                        align: 'center',
+                        filters: data,
+                        filterMultiple: false,
+                        filterMethod(value, row) {
+                            console.log(arguments)
+                            if (value === 'all') {
+                                return true
+                            } else {
+                                return row.periodId.includes(value)
+                            }
+                        }
+                    })
+                } else {
+                    this.fileColumns.splice(2,1)
+                }
+            }
         }
     }
 }