sunlupeng 1 год назад
Родитель
Сommit
f67c84e2d5
4 измененных файлов с 107 добавлено и 2 удалено
  1. 17 0
      src/api/trainManage.js
  2. 3 2
      src/permission.js
  3. 1 0
      src/router/index.js
  4. 86 0
      src/views/trainManage/upLoadFileRules.vue

+ 17 - 0
src/api/trainManage.js

@@ -1,5 +1,22 @@
 import request from '@/utils/request'
 
+//获取材料备注详情
+export function fileRulesDetail(query) {
+  return request({
+    url: '/news/mall/getNotice',
+    method: 'get',
+    params: query
+  })
+}
+//修改材料备注
+export function updateFileRules(query) {
+  return request({
+    url: '/news/update',
+    method: 'post',
+    data: query
+  })
+}
+
 
 // 培训列表
 export function trainList(query) {

+ 3 - 2
src/permission.js

@@ -75,6 +75,7 @@ const myRoles = [
   'ceoCiteList',
 
   'trainManage', 
+  'upLoadFileRules',
   'trainList',
   'operateTrainList',
   'ceoTrainList',
@@ -118,8 +119,8 @@ router.beforeEach((to, from, next) => {
       if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息
         store.dispatch('GetUserInfo').then(res => {
           store.dispatch('GetUserMenus').then(res => { // 拉取user_info
-            const roles = res.data.data // note: roles must be a array! such as: ['editor','develop']
-            // const roles = myRoles;
+            // const roles = res.data.data // note: roles must be a array! such as: ['editor','develop']
+            const roles = myRoles;
             store.dispatch('GenerateRoutes', { roles }).then(() => { // 根据roles权限生成可访问的路由表
               router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表
               next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record

+ 1 - 0
src/router/index.js

@@ -251,6 +251,7 @@ export const asyncRouterMap = [
       icon: 'xunzhang'
     },
     children: [
+      { path: 'upLoadFileRules', component: _import('trainManage/upLoadFileRules'), name: 'upLoadFileRules', meta: { title: '培训材料备注', noCache: true }},
       { path: 'trainList', component: _import('trainManage/trainList'), name: 'trainList', meta: { title: '培训列表', noCache: true }},
       { path: 'operateTrainList', component: _import('trainManage/operateTrainList'), name: 'operateTrainList', meta: { title: '培训审批列表', noCache: true }},
       { path: 'ceoTrainList', component: _import('trainManage/ceoTrainList'), name: 'ceoTrainList', meta: { title: '培训确认列表', noCache: true }},

+ 86 - 0
src/views/trainManage/upLoadFileRules.vue

@@ -0,0 +1,86 @@
+<template>
+    <div class="app-container calendar-list-container" style="padding-bottom: 80px;">
+        <el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 85%; margin-left:50px;'>
+         <el-form-item  label="标题" prop="title">
+              <el-input v-model="dataForm.title"></el-input>
+            </el-form-item>
+            <el-form-item
+              style="width: 100%"
+              label="内容"
+              prop="content"
+            >
+              <tinymce v-model="dataForm.content" ref="tinymce"></tinymce>
+            </el-form-item>
+  
+        </el-form>
+        <el-button style="float: right;margin-right: 120px;" type="primary" @click="updateData">修改</el-button>
+    
+        
+    </div>
+   
+  </template>
+  
+  <style>
+    
+  </style>
+  
+  
+  <script>
+   import {fileRulesDetail, updateFileRules} from "@/api/trainManage";
+    import waves from "@/directive/waves"; // 水波纹指令
+    import Tinymce from '@/components/Tinymce'
+    export default {
+    name: 'giftExchangeRules',
+    components: { Tinymce },
+    directives: { waves },
+    data() {
+      return {
+        dataForm: {
+          type:'trainrule',
+          title: '',
+          content: "",
+        },
+        dialogFormVisible: false,
+        rules: {
+            title: [{ required: true, message: "标题不能为空", trigger: "blur" }],
+            content: [{ required: true, message: "积分规则不能为空", trigger: "blur" }],
+        },
+      }
+    },
+    created() {
+        this.getDetail();
+    },
+    methods: {
+    
+      getDetail() {
+          this.loading = true
+          fileRulesDetail({noticeType:'trainrule'}).then(response => {
+            this.dataForm.title = response.data.data.title;
+            this.dataForm.content = response.data.data.content;
+            this.dataForm.id = response.data.data.id;
+            this.loading = false;
+          }).catch(() => {})
+      },
+      updateData() {
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true;
+            updateFileRules(this.dataForm).then(() => {
+              this.loading = false;
+                this.$notify({
+                  title: '成功',
+                  message: '更新成功',
+                  type: 'success',
+                  duration: 2000
+                })
+                this.getDetail()
+              }) 
+          }
+        })
+      },
+  
+      
+    }
+  }
+  </script>
+