lrf402788946 há 5 anos atrás
pai
commit
9d53b3823c

+ 4 - 0
.env

@@ -0,0 +1,4 @@
+VUE_APP_AXIOS_BASE_URL = ''
+VUE_APP_ROOT_URL=/admin/
+VUE_APP_MODULE='director'
+VUE_APP_LIMIT = 10

+ 33 - 0
.eslintrc.js

@@ -0,0 +1,33 @@
+// https://eslint.org/docs/user-guide/configuring
+
+module.exports = {
+  root: true,
+  env: {
+    node: true,
+  },
+  extends: ['plugin:vue/essential', '@vue/prettier'],
+  plugins: ['vue'],
+  rules: {
+    'max-len': [
+      'warn',
+      {
+        code: 250,
+      },
+    ],
+    'no-unused-vars': 'off',
+    'no-console': 'off',
+    'prettier/prettier': [
+      'warn',
+      {
+        singleQuote: true,
+        trailingComma: 'es5',
+        bracketSpacing: true,
+        jsxBracketSameLine: true,
+        printWidth: 160,
+      },
+    ],
+  },
+  parserOptions: {
+    parser: 'babel-eslint',
+  },
+};

+ 1 - 1
.gitignore

@@ -1,7 +1,7 @@
 .DS_Store
 node_modules
 /dist
-
+package-lock.json
 # local env files
 .env.local
 .env.*.local

+ 12 - 2
package.json

@@ -1,5 +1,5 @@
 {
-  "name": "train-tutor",
+  "name": "train-director",
   "version": "0.1.0",
   "private": true,
   "scripts": {
@@ -8,10 +8,20 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
+    "@fullcalendar/core": "^4.3.1",
+    "@fullcalendar/daygrid": "^4.3.0",
+    "@fullcalendar/interaction": "^4.3.0",
+    "@fullcalendar/vue": "^4.3.1",
+    "axios": "^0.19.2",
     "core-js": "^3.4.4",
+    "element-ui": "^2.13.0",
+    "lodash": "^4.17.15",
+    "naf-core": "^0.1.2",
     "vue": "^2.6.10",
+    "vue-meta": "^2.3.2",
     "vue-router": "^3.1.3",
-    "vuex": "^3.1.2"
+    "vuex": "^3.1.2",
+    "wangeditor": "^3.1.1"
   },
   "devDependencies": {
     "@vue/cli-plugin-babel": "^4.1.0",

+ 17 - 22
src/App.vue

@@ -1,32 +1,27 @@
 <template>
   <div id="app">
-    <div id="nav">
-      <router-link to="/">Home</router-link> |
-      <router-link to="/about">About</router-link>
-    </div>
     <router-view />
   </div>
 </template>
+<script>
+export default {
+  name: 'App',
+  components: {},
+};
+</script>
 
 <style lang="less">
-#app {
-  font-family: "Avenir", Helvetica, Arial, sans-serif;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-  text-align: center;
-  color: #2c3e50;
-}
-
-#nav {
-  padding: 30px;
-
-  a {
-    font-weight: bold;
-    color: #2c3e50;
-
-    &.router-link-exact-active {
-      color: #42b983;
-    }
+html {
+  overflow: hidden;
+  body {
+    margin: 0;
+    padding: 0;
+  }
+  margin: 0;
+  padding: 0;
+  p {
+    margin: 0;
+    padding: 0;
   }
 }
 </style>

+ 10 - 7
src/main.js

@@ -1,12 +1,15 @@
-import Vue from "vue";
-import App from "./App.vue";
-import router from "./router";
-import store from "./store";
-
+import Vue from 'vue';
+import App from './App.vue';
+import router from './router';
+import store from './store';
+import '@/plugins/meta';
+import '@/plugins/axios';
+import '@/plugins/check-res';
+import '@/plugins/element';
 Vue.config.productionTip = false;
 
 new Vue({
   router,
   store,
-  render: h => h(App)
-}).$mount("#app");
+  render: h => h(App),
+}).$mount('#app');

+ 1 - 0
src/plugins/README.md

@@ -0,0 +1 @@
+### 框架使用的 vue plugin

+ 24 - 0
src/plugins/axios.js

@@ -0,0 +1,24 @@
+/* eslint-disable no-console */
+/* eslint-disable no-param-reassign */
+
+import Vue from 'vue';
+import AxiosWrapper from '@frame/utils/axios-wrapper';
+
+const Plugin = {
+  install(vue, options) {
+    // 3. 注入组件
+    vue.mixin({
+      created() {
+        if (this.$store && !this.$store.$axios) {
+          this.$store.$axios = this.$axios;
+          this.$store.$limit = process.env.VUE_APP_LIMIT;
+        }
+      },
+    });
+    // 4. 添加实例方法
+    vue.prototype.$axios = new AxiosWrapper(options);
+    vue.prototype.$limit = process.env.VUE_APP_LIMIT;
+  },
+};
+
+Vue.use(Plugin, { baseUrl: process.env.VUE_APP_AXIOS_BASE_URL, unwrap: true });

+ 40 - 0
src/plugins/check-res.js

@@ -0,0 +1,40 @@
+/* eslint-disable no-underscore-dangle */
+/* eslint-disable no-param-reassign */
+/* eslint-disable no-unused-vars */
+/* eslint-disable no-shadow */
+import Vue from 'vue';
+import _ from 'lodash';
+import { Message } from 'element-ui';
+
+const vm = new Vue({});
+const Plugin = {
+  install(Vue, options) {
+    // 4. 添加实例方法
+    Vue.prototype.$checkRes = (res, okText, errText) => {
+      let _okText = okText;
+      let _errText = errText;
+      if (!_.isFunction(okText) && _.isObject(okText) && okText != null) {
+        ({ okText: _okText, errText: _errText } = okText);
+      }
+      const { errcode = 0, errmsg } = res || {};
+      if (errcode === 0) {
+        if (_.isFunction(_okText)) {
+          return _okText();
+        }
+        if (_okText) {
+          Message.success(_okText);
+          // Message({ message: _okText, type: 'success', duration: 60000 });
+        }
+        return true;
+      }
+      if (_.isFunction(_errText)) {
+        return _errText();
+      }
+      Message.error(_errText || errmsg);
+      // Message({ message: _errText || errmsg, duration: 60000 });
+      return false;
+    };
+  },
+};
+
+Vue.use(Plugin);

+ 5 - 0
src/plugins/element.js

@@ -0,0 +1,5 @@
+import Vue from 'vue';
+import Element from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css';
+// 注册element-ui组件
+Vue.use(Element);

+ 4 - 0
src/plugins/meta.js

@@ -0,0 +1,4 @@
+import Vue from 'vue';
+import Meta from 'vue-meta';
+
+Vue.use(Meta);

+ 26 - 0
src/plugins/naf-dict.js

@@ -0,0 +1,26 @@
+/**
+ * 字典数据处理插件
+ */
+
+import Vue from 'vue';
+import _ from 'lodash';
+import assert from 'assert';
+
+const Plugin = {
+  install(vue, options) {
+    // 4. 添加实例方法
+    vue.prototype.$dict = function(codeType, code) {
+      assert(_.isString(codeType));
+      const state = this.$store.state.naf.dict;
+      if (!state) {
+        throw new Error("can't find store for naf dict");
+      }
+      if (_.isString(code)) {
+        return (state.codes[codeType] && state.codes[codeType][code]) || code;
+      } else {
+        return state.items[codeType];
+      }
+    };
+  },
+};
+Vue.use(Plugin);

+ 6 - 0
src/plugins/nut-ui.js

@@ -0,0 +1,6 @@
+import Vue from 'vue';
+import { Toast } from '@nutui/nutui';
+// import '@nutui/nutui/dist/nutui.css';
+
+// 注册nut-ui组件
+Toast.install(Vue); // 按需加载

+ 65 - 0
src/plugins/stomp.js

@@ -0,0 +1,65 @@
+/**
+ * 基于WebStomp的消息处理插件
+ */
+
+import Vue from 'vue';
+import _ from 'lodash';
+import assert from 'assert';
+import { Client } from '@stomp/stompjs/esm5/client';
+
+const Plugin = {
+  install(Vue, options) {
+    assert(_.isObject(options));
+    if (options.debug && !_.isFunction(options.debug)) {
+      options.debug = str => {
+        console.log(str);
+      };
+    }
+    assert(_.isString(options.brokerURL));
+    if (!options.brokerURL.startsWith('ws://')) {
+      options.brokerURL = `ws://${location.host}${options.brokerURL}`;
+    }
+
+    // 3. 注入组件
+    Vue.mixin({
+      beforeDestroy: function() {
+        if (this.$stompClient) {
+          this.$stompClient.deactivate();
+          delete this.$stompClient;
+        }
+      },
+    });
+
+    // 4. 添加实例方法
+    Vue.prototype.$stomp = function(subscribes = {}) {
+      // connect to mq
+      const client = new Client(options);
+      client.onConnect = frame => {
+        // Do something, all subscribes must be done is this callback
+        // This is needed because this will be executed after a (re)connect
+        console.log('[stomp] connected');
+        Object.keys(subscribes)
+          .filter(p => _.isFunction(subscribes[p]))
+          .forEach(key => {
+            client.subscribe(key, subscribes[key]);
+          });
+      };
+
+      client.onStompError = frame => {
+        // Will be invoked in case of error encountered at Broker
+        // Bad login/passcode typically will cause an error
+        // Complaint brokers will set `message` header with a brief message. Body may contain details.
+        // Compliant brokers will terminate the connection after any error
+        console.log('Broker reported error: ' + frame.headers['message']);
+        console.log('Additional details: ' + frame.body);
+      };
+
+      client.activate();
+
+      this.$stompClient = client;
+    };
+  },
+};
+export default () => {
+  Vue.use(Plugin, Vue.config.stomp);
+};

+ 22 - 18
src/router/index.js

@@ -1,30 +1,34 @@
-import Vue from "vue";
-import VueRouter from "vue-router";
-import Home from "../views/Home.vue";
+import Vue from 'vue';
+import VueRouter from 'vue-router';
 
 Vue.use(VueRouter);
 
 const routes = [
   {
-    path: "/",
-    name: "home",
-    component: Home
+    path: '/',
+    name: 'frame',
+    component: () => import('@/views/index.vue'),
+    children: [
+      {
+        path: '/plan/index',
+        name: 'plan_list',
+        meta: { title: '计划', sub: '管理' },
+        component: () => import('@/views/plan/index.vue'),
+      },
+      {
+        path: '/plan/detail',
+        name: 'plan_detail',
+        meta: { title: '计划', sub: '详情' },
+        component: () => import('@/views/plan/detail.vue'),
+      },
+    ],
   },
-  {
-    path: "/about",
-    name: "about",
-    // route level code-splitting
-    // this generates a separate chunk (about.[hash].js) for this route
-    // which is lazy-loaded when the route is visited.
-    component: () =>
-      import(/* webpackChunkName: "about" */ "../views/About.vue")
-  }
 ];
 
 const router = new VueRouter({
-  mode: "history",
-  base: process.env.BASE_URL,
-  routes
+  mode: 'history',
+  base: process.env.NODE_ENV === 'development' ? '' : process.env.VUE_APP_ROOT_URL + 'school',
+  routes,
 });
 
 export default router;

+ 3 - 3
src/store/index.js

@@ -1,5 +1,5 @@
-import Vue from "vue";
-import Vuex from "vuex";
+import Vue from 'vue';
+import Vuex from 'vuex';
 
 Vue.use(Vuex);
 
@@ -7,5 +7,5 @@ export default new Vuex.Store({
   state: {},
   mutations: {},
   actions: {},
-  modules: {}
+  modules: {},
 });

+ 0 - 5
src/views/About.vue

@@ -1,5 +0,0 @@
-<template>
-  <div class="about">
-    <h1>This is an about page</h1>
-  </div>
-</template>

+ 0 - 18
src/views/Home.vue

@@ -1,18 +0,0 @@
-<template>
-  <div class="home">
-    <img alt="Vue logo" src="../assets/logo.png" />
-    <HelloWorld msg="Welcome to Your Vue.js App" />
-  </div>
-</template>
-
-<script>
-// @ is an alias to /src
-import HelloWorld from "@/components/HelloWorld.vue";
-
-export default {
-  name: "home",
-  components: {
-    HelloWorld
-  }
-};
-</script>

+ 60 - 0
src/views/index.vue

@@ -0,0 +1,60 @@
+<template>
+  <div id="admin-index">
+    <div class="app-wrapper">
+      <admin-menu class="sidebar-container"></admin-menu>
+      <div class="main-container">
+        <admin-bar></admin-bar>
+        <fw-admin class="display"></fw-admin>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import adminMenu from '@frame/layout/admin/admin-menu.vue';
+import adminBar from '@frame/layout/admin/navBar.vue';
+import fwAdmin from '@frame/layout/admin/fw-admin.vue';
+import { devMenu } from '@frame/config/menu-config';
+export default {
+  name: 'admin-index',
+  metaInfo: { title: ' 双困生培训系统' },
+  props: {},
+  components: {
+    fwAdmin,
+    adminMenu,
+    adminBar,
+    // breadcrumb,
+  },
+  data: () => ({
+    devMenu,
+  }),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+.display {
+  height: ~'calc(100% - 30px)';
+  padding: 0.3rem;
+}
+
+.app-wrapper {
+  position: relative;
+  height: 100%;
+  width: 100%;
+  &:after {
+    content: '';
+    display: table;
+    clear: both;
+  }
+}
+
+.main-container {
+  min-height: 100vh;
+  transition: margin-left 0.28s;
+  margin-left: 12rem;
+  background-color: #f0f2f5;
+}
+</style>

+ 335 - 0
src/views/plan/detail.vue

@@ -0,0 +1,335 @@
+<template>
+  <div id="detail">
+    <detail-frame :title="mainTitle" returns="/plan/index">
+      <el-row :gutter="10" type="flex">
+        <el-col :span="12">
+          <el-card header="全年计划信息">
+            <el-form :model="info" label-width="60px" size="small" @submit.native.prevent>
+              <el-form-item label="年份">
+                {{ info.year }}
+              </el-form-item>
+              <el-form-item label="标题" prop="title">
+                {{ info.title }}
+              </el-form-item>
+              <el-form-item label="备注" prop="remark">
+                <el-input v-model="info.remark" type="textarea" :autosize="{ minRows: 3, maxRows: 5 }"></el-input>
+              </el-form-item>
+
+              <el-collapse v-model="collapse" accordion>
+                <el-collapse-item title="无法带班时间列表" name="1">
+                  <data-table :fields="fields" :data="selected" :opera="opera" @delete="toDelete" :height="heights"></data-table>
+                </el-collapse-item>
+              </el-collapse>
+              <el-form-item>
+                <el-row type="flex" align="middle" justify="space-around" style="margin-top:20px">
+                  <el-col :span="6">
+                    <el-button type="primary" @click="savePlan">上报时间</el-button>
+                  </el-col>
+                </el-row>
+              </el-form-item>
+            </el-form>
+          </el-card>
+        </el-col>
+        <el-col :span="16" :style="`width:${widths}px`">
+          <el-card ref="card">
+            <calendar @draft="selectDate" @eventClick="eventClick" :events="events"></calendar>
+          </el-card>
+        </el-col>
+      </el-row>
+    </detail-frame>
+  </div>
+</template>
+
+<script>
+import detailFrame from '@frame/layout/admin/detail-frame';
+import calendar from '@frame/components/calendar';
+import dataTable from '@frame/components/data-table';
+import _ from 'lodash';
+import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  metaInfo: { title: '计划详情' },
+  name: 'detail',
+  props: {},
+  components: { detailFrame, calendar, dataTable },
+  data: () => ({
+    info: {
+      year: '',
+      termnum: {
+        batchnum: [],
+      },
+    },
+
+    form: {},
+    events: [],
+    collapse: '1',
+    fields: [
+      { label: '期数', prop: 'term' },
+      { label: '班级类型', prop: 'type', format: item => (item === '0' ? '正常班级' : '特殊班级') },
+    ],
+    opera: [
+      {
+        label: '删除',
+        icon: 'el-icon-delete',
+        method: 'delete',
+        confirm: true,
+      },
+    ],
+    heights: 250,
+    selected: [],
+    axiosData: {
+      termnum: [
+        {
+          term: '1',
+          batchnum: [
+            {
+              start: '2020-01-01',
+              end: '2020-01-09',
+              type: '0',
+              number: '56',
+              color: '#0BEB95',
+              batch: '1',
+              class: '1',
+              title: '第1期第1批次',
+              id: 'p1580869239498',
+            },
+            {
+              start: '2020-01-01',
+              end: '2020-01-09',
+              type: '1',
+              number: '56',
+              color: '#409EFF',
+              name: '第一期特殊1班',
+              title: '第一期特殊1班',
+              id: 'p1580869422722',
+            },
+          ],
+          classnum: 2,
+        },
+        {
+          term: '2',
+          batchnum: [
+            {
+              start: '2020-01-01',
+              end: '2020-01-09',
+              type: '0',
+              number: '56',
+              color: '#0BEB95',
+              batch: '1',
+              class: '1',
+              title: '第2期第1批次',
+              id: 'p1580869239490',
+            },
+            {
+              start: '2020-01-01',
+              end: '2020-01-09',
+              type: '1',
+              number: '56',
+              color: '#409EFF',
+              name: '第二期特殊1班',
+              title: '第二期特殊1班',
+              id: 'p1580869422723',
+            },
+            {
+              start: '2020-01-01',
+              end: '2020-01-09',
+              type: '1',
+              number: '56',
+              color: '#409EFF',
+              name: '第二期特殊2班',
+              title: '第二期特殊2班',
+              id: 'p1580869422726',
+            },
+          ],
+          classnum: 3,
+        },
+        {
+          term: '3',
+          batchnum: [
+            {
+              start: '2020-01-01',
+              end: '2020-01-09',
+              type: '0',
+              number: '56',
+              color: '#ff4444',
+              batch: '1',
+              class: '1',
+              title: '第3期第1批次',
+              id: 'p1580869239499',
+            },
+          ],
+          classnum: 1,
+        },
+        {
+          term: '4',
+          batchnum: [
+            {
+              start: '2020-02-01',
+              end: '2020-02-09',
+              type: '0',
+              number: '56',
+              color: '#ff4444',
+              batch: '1',
+              class: '1',
+              title: '第4期第1批次',
+              id: 'p1580869239468',
+            },
+          ],
+          classnum: 1,
+        },
+      ],
+      title: 'test',
+      year: 2020,
+    },
+  }),
+  created() {
+    if (this.isNew) this.$set(this.info, `year`, new Date().getFullYear());
+  },
+  mounted() {},
+  methods: {
+    // ...mapClass(['fetch', 'create', 'update']),
+    //查询计划
+    async search() {
+      // const res = await this.fetch(this.id);
+      // if (this.$checkRes(res)) this.$set(this, `info`, res.data);
+      // this.loading = false;
+      let events = [];
+      events = _.flatten(
+        this.axiosData.termnum.map(item => {
+          item.batchnum.map(i => {
+            i.term = item.term;
+            return i;
+          });
+          return item.batchnum;
+        })
+      );
+      let { termnum, year, title } = this.axiosData;
+      this.$set(this, `events`, events);
+      this.$set(this, `info`, { title, year });
+    },
+    selectDate(arg) {
+      let start = arg.startStr;
+      let end = arg.endStr;
+      let res = this.events.filter(fil => this.inEvents(fil.start, fil.end, start, end));
+      let arr = JSON.parse(JSON.stringify(this.selected));
+      arr = _.uniqBy(arr.concat(res), `id`);
+      this.$set(this, `selected`, arr);
+    },
+    //日历事件点击事件
+    eventClick({ event }) {
+      let arr = this.events.filter(fil => fil.id == event.id);
+      let object = {};
+      if (arr.length > 0) object = arr[0];
+      else {
+        console.warn(`无对应id事件`);
+        return;
+      }
+      let { term, type, name, termid, number } = object;
+      //查重,先查期数一致,再查类型
+      //期数没有,则加入;期数有,则看类型,如果是普通班级,则不加入;如果是特殊班级,则查该期是否有特殊班级的id,没有就加入
+      let data = object;
+      let re = () => {
+        this.$notify({
+          title: '重复添加该期',
+        });
+      };
+      let push = data => {
+        this.selected.push(data);
+        this.$notify({
+          title: '已添加',
+        });
+      };
+      if (_.findIndex(this.selected, i => i.term === term) >= 0) {
+        //重复加入
+        if (type === '0') re();
+        else {
+          // TODO此处需要根据实际有没有id可以区分开每期特殊班和特殊班,目前用name来区分
+          let res = _.findIndex(this.selected, i => {
+            if (i.name) return i.name === name;
+            else return false;
+          });
+          //特殊班重复加入
+          if (res > 0) re();
+          else push(data); //加入
+        }
+      } else push(data);
+    },
+    //列表删除事件
+    toDelete({ data, index }) {
+      this.selected.splice(index, 1);
+    },
+    //保存计划事件
+    savePlan() {
+      // 获取已选择的时间
+      let arr = JSON.parse(JSON.stringify(this.selected));
+      //TODO整理数据
+      let data = { ...this.info };
+      data.nobatchid = arr.map(i => i.batchId || `no id ${new Date().getTime()}`);
+      //最后加入班主任id
+      //TODO 连接接口
+    },
+    setHeight() {
+      let heights = this.$refs.card.$el.clientHeight * 0.63;
+      this.$set(this, `heights`, heights);
+    },
+    inEvents(start, end, selectStart, selectEnd) {
+      //选中的开始时间和结束时间任意一个时间在事件的范围内,则视为无法上课
+      //前提:开始时间,结束时间都是不能带班的;逐个事件判断,无需考虑当前事件之外的事件
+      //case1: 开始时间<事件开始时间;但是: 1,事件开始时间<=结束时间; 2,事件开始时间<=结束时间<=事件结束时间; 3,事件结束时间<结束时间 => 不能带班
+      //case2: 事件开始时间<=开始时间<=事件结束时间 => 不能带班
+      let s = new Date(start).getTime(), //事件的开始时间
+        e = new Date(end).getTime(), //事件的结束时间
+        ss = new Date(selectStart).getTime(), //选取的开始时间
+        se = new Date(selectEnd).setDate(new Date(selectEnd).getDate() - 1); //选取的结束时间
+      //-1:天是因为我认为教师画到哪天,其实之后那一天就没事了.不过组件 就返回选择结束的下一天,所以才出现-1天的问题
+      let res = s <= ss && ss <= e;
+      if (res) return true;
+      //case2
+      else if (ss < s) {
+        // 开始时间<事件开始时间
+        let res2 = s <= se;
+        //case1
+        if (res2) return true;
+        else return false;
+      } else return false;
+    },
+  },
+  watch: {
+    isNew: {
+      immediate: true,
+      handler(val) {
+        if (val) this.loading = false;
+        else this.search();
+      },
+    },
+  },
+  computed: {
+    widths() {
+      let width = (document.body.clientWidth - 200) * 0.5;
+      return width > 400 ? width : 400;
+    },
+    id() {
+      return this.$route.query.id;
+    },
+    isNew() {
+      return this.$route.query.id ? true : false; //false : true;
+    },
+    mainTitle() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      let sub = meta.sub || '';
+      return `${main}${sub}`;
+    },
+    keyWord() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      return main;
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+/deep/.el-divider--horizontal {
+  margin: 5px 0;
+}
+</style>

+ 77 - 0
src/views/plan/index.vue

@@ -0,0 +1,77 @@
+<template>
+  <div id="index">
+    <list-frame :title="mainTitle" @query="search" :total="total" :needFilter="false" :needAdd="false">
+      <data-table :fields="fields" :data="list" :opera="opera" @edit="toEdit" @update="toUpdate"></data-table>
+    </list-frame>
+  </div>
+</template>
+
+<script>
+import listFrame from '@frame/layout/admin/list-frame';
+import dataTable from '@frame/components/data-table';
+import { createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('dept');
+export default {
+  metaInfo: { title: '计划管理' },
+  name: 'index',
+  props: {},
+  components: { listFrame, dataTable },
+  data: () => ({
+    opera: [
+      {
+        label: '查看全年计划',
+        icon: 'el-icon-date',
+        method: 'edit',
+      },
+      {
+        label: '上报时间',
+        icon: 'el-icon-document',
+        method: 'update',
+      },
+    ],
+    fields: [
+      { label: '计划标题', prop: 'name' },
+      { label: '时间', prop: 'time' },
+    ],
+    list: [{ name: '2020年计划', time: '2020-2021' }],
+    total: 0,
+  }),
+  created() {},
+  computed: {
+    mainTitle() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      let sub = meta.sub || '';
+      let title = main + sub;
+      return title;
+    },
+    keyWord() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      return main;
+    },
+  },
+  methods: {
+    ...mapActions(['query', 'delete']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    toEdit({ data }) {
+      //TODO 该把详情做成什么样的比较好,是和大日历在一起选择还是其他形式
+      this.$router.push({ path: '/plan/detail', query: { id: data.id } });
+    },
+
+    async toUpdate({ data }) {
+      // const res = await this.delete(data.id);
+      // this.$checkRes(res, '删除成功', '删除失败');
+      // this.search();
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 60 - 1
vue.config.js

@@ -1,3 +1,62 @@
+const path = require('path');
+const frame = path.resolve(__dirname, '../frame');
+const center = path.resolve(__dirname, '../train-center');
 module.exports = {
-  lintOnSave: false
+  publicPath: process.env.NODE_ENV === 'development' ? '/' : process.env.VUE_APP_ROOT_URL + 'center',
+  configureWebpack: {
+    // externals: {
+    //   'element-ui': 'Element',
+    //   vue: 'Vue',
+    // },
+    // 开发生产共同配置
+    resolve: {
+      alias: {
+        '@': path.resolve(__dirname, './src'),
+        '@c': path.resolve(__dirname, './src/components'),
+        '@a': path.resolve(__dirname, './src/assets'),
+        '@frame': frame,
+        '@center': center,
+      },
+    },
+  },
+  devServer: {
+    port: '8002',
+    //api地址前缀
+    proxy: {
+      '/api': {
+        target: 'http://10.16.9.108:8001',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/files': {
+        target: 'http://smart.cc-lotus.info',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/ws': {
+        target: 'http://smart.cc-lotus.info',
+        ws: true,
+      },
+      '/weixin': {
+        target: 'http://smart.cc-lotus.info',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/admin/center': {
+        target: 'http://localhost:8001',
+      },
+      '/admin/director': {
+        target: 'http://localhost:8002',
+      },
+      '/admin/teacher': {
+        target: 'http://localhost:8003',
+      },
+      '/admin/student': {
+        target: 'http://localhost:8004',
+      },
+      '/admin/school': {
+        target: 'http://localhost:8005',
+      },
+    },
+  },
 };