Browse Source

close #2014 区级资源平台管理

liqk 2 years ago
parent
commit
6cad98c994
1 changed files with 81 additions and 39 deletions
  1. 81 39
      TEAMModelOS/ClientApp/src/view/mgtPlatform/MgtPlatform.vue

+ 81 - 39
TEAMModelOS/ClientApp/src/view/mgtPlatform/MgtPlatform.vue

@@ -2,24 +2,41 @@
     <div class="mgt-platform-container">
     <div class="mgt-platform-container">
         <vuescroll>
         <vuescroll>
             <div>
             <div>
-                <Draggable class="platform-list-wrap" handle=".mover" ghost-class="ghost" group="platform" :list="schoolPlatform.links" :animation='200' @end="handleDragEnd">
-                    <!-- 区级资源平台 -->
-                    <div class="platform-item" v-for="(item,index) in areaPlatform.links" :key="item.name" @click="openAreaPlatform(index)">
-                        <span class="platform-type-label">
-                            {{$t('train.mgt.areaLabel')}}
-                        </span>
-                        <span class="delete-platform-icon" @click.stop="delAreaPlatform(index)" v-show="isArea">
-                            <Icon type="md-close" class="add-member-icon" />
-                        </span>
-                        <div class="platform-img" :style="{backgroundImage: `url(${item.thum}?${areaSas})`}"></div>
-                        <p class="img-text">
-                            <span>{{$t('platform.platform')}}</span>
-                            {{item.name}}
-                        </p>
+                <p class="block-title" v-if="!isArea">区级资源平台</p>
+                <Draggable :disabled="!isArea" class="platform-list-wrap" handle=".mover" ghost-class="ghost" group="platform" :list="areaPlatform.links" :animation='200' @end="handleDragEnd">
+                    <div class="platform-item mover" v-for="(item,index) in areaPlatform.links" :key="item.name" @click="openAreaPlatform(index)">
+                        <div :class="['pf-item-box',isArea ? 'handle-hover' : '']">
+                            <span class="platform-type-label">
+                                {{$t('train.mgt.areaLabel')}}
+                            </span>
+                            <div class="platform-img" :style="{backgroundImage: `url(${item.thum}?${areaSas})`}"></div>
+                            <p class="img-text">
+                                <span>{{$t('platform.platform')}}</span>
+                                {{item.name}}
+                            </p>
+                            <!-- 操作区域 -->
+                            <div class="platform-action-wrap" v-if="isArea">
+                                <span class="pf-action-btn" @click.stop="editPlatform(item,index)">
+                                    <Icon type="md-create" />
+                                    {{$t('common.edit')}}
+                                </span>
+                                <span class="pf-action-btn" @click.stop="delSchoolPlatform(index)">
+                                    <Icon type="md-trash" />
+                                    {{$t('common.delete')}}
+                                </span>
+                            </div>
+                        </div>
                     </div>
                     </div>
+                    <div class="add-platform-box" @click="toAddPlatform" v-if="isArea">
+                        <Icon type="md-add-circle" class="add-platform-icon" />
+                        <p class="add-platform-text">{{$t('platform.addPlatform')}}</p>
+                    </div>
+                </Draggable>
+                <p class="block-title" v-if="!isArea">校级资源平台</p>
+                <Draggable v-if="!isArea" class="platform-list-wrap" handle=".mover" ghost-class="ghost" group="platform" :list="schoolPlatform.links" :animation='200' @end="handleDragEnd">
                     <!-- 校级资源平台 -->
                     <!-- 校级资源平台 -->
                     <div class="platform-item mover" v-for="(item,index) in schoolPlatform.links" :key="item.name" @click="openSchoolPlatform(index)">
                     <div class="platform-item mover" v-for="(item,index) in schoolPlatform.links" :key="item.name" @click="openSchoolPlatform(index)">
-                        <div class="pf-item-box">
+                        <div class="pf-item-box handle-hover">
                             <span class="platform-type-label school-type">
                             <span class="platform-type-label school-type">
                                 {{$t('train.mgt.schoolLabel')}}
                                 {{$t('train.mgt.schoolLabel')}}
                             </span>
                             </span>
@@ -147,19 +164,35 @@ export default {
             this.addStatus = true
             this.addStatus = true
         },
         },
         handleDragEnd() {
         handleDragEnd() {
-            let params = {
-                schoolId: this.$store.state.userInfo.schoolCode,
-                opt: 'UpsertThird',
-                third: [this.schoolPlatform]
-            }
-            this.$api.schoolSetting.upsertSchoolSetting(params).then(
-                res => {
-                    this.$Message.success(this.$t('platform.saveOk'))
-                },
-                err => {
-                    this.$Message.error(this.$t('platform.saveErr'))
+            if (this.isArea) {
+                this.fullData.third = [this.areaPlatform]
+                this.$api.ability.upsertResAndPolicy(this.fullData).then(
+                    res => {
+                        this.$Message.success(this.$t('platform.saveOk'))
+                        this.fullData = res.file
+                        this.areaPlatform = this.fullData.third.find(item => item.tag == 'default')
+                        this.addStatus = false
+                        this.$refs['platform'].resetFields()
+                    },
+                    err => {
+                        this.$Message.error(this.$t('platform.saveErr'))
+                    }
+                )
+            } else {
+                let params = {
+                    schoolId: this.$store.state.userInfo.schoolCode,
+                    opt: 'UpsertThird',
+                    third: [this.schoolPlatform]
                 }
                 }
-            )
+                this.$api.schoolSetting.upsertSchoolSetting(params).then(
+                    res => {
+                        this.$Message.success(this.$t('platform.saveOk'))
+                    },
+                    err => {
+                        this.$Message.error(this.$t('platform.saveErr'))
+                    }
+                )
+            }
         },
         },
         openAreaPlatform(index) {
         openAreaPlatform(index) {
             let url = this.areaPlatform.links[index].url
             let url = this.areaPlatform.links[index].url
@@ -384,6 +417,14 @@ export default {
 }
 }
 </script>
 </script>
 <style lang="less" scoped>
 <style lang="less" scoped>
+.block-title {
+    background: #fafafa;
+    margin-bottom: 10px;
+    padding: 4px 5px;
+    font-weight: 600;
+    color: #2d8cf0;
+    border-left: 2px solid #2d8cf0;
+}
 .pf-action-btn {
 .pf-action-btn {
     margin-right: 15px;
     margin-right: 15px;
     cursor: pointer;
     cursor: pointer;
@@ -509,6 +550,18 @@ export default {
     margin-bottom: 25px;
     margin-bottom: 25px;
     margin-right: 30px;
     margin-right: 30px;
 }
 }
+.handle-hover:hover {
+    z-index: 99;
+    box-shadow: 0 20px 30px -20px #000;
+    padding-bottom: 46px;
+    // top: -8px;
+    .delete-platform-icon {
+        display: block;
+    }
+    .platform-action-wrap {
+        display: block;
+    }
+}
 .pf-item-box {
 .pf-item-box {
     overflow: hidden;
     overflow: hidden;
     width: 300px;
     width: 300px;
@@ -520,18 +573,7 @@ export default {
     position: relative;
     position: relative;
     top: 0px;
     top: 0px;
     transition: all 0.2s ease 0s;
     transition: all 0.2s ease 0s;
-    &:hover {
-        z-index: 99;
-        box-shadow: 0 20px 30px -20px #000;
-        padding-bottom: 46px;
-        // top: -8px;
-        .delete-platform-icon {
-            display: block;
-        }
-        .platform-action-wrap {
-            display: block;
-        }
-    }
+
     .platform-img {
     .platform-img {
         transition: all 0.3s;
         transition: all 0.3s;
         width: 300px;
         width: 300px;