Explorar o código

整合store至frame项目

lrf402788946 %!s(int64=5) %!d(string=hai) anos
pai
achega
9a6ac1676d

+ 0 - 38
src/store/bedroom.js

@@ -1,38 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/bedroom`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 44
src/store/classes.js

@@ -1,44 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/class`,
-  divide: `/api/train/class/divide`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-  //分班
-  async divide({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.divide}`, payload);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 38
src/store/dept.js

@@ -1,38 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/department`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 38
src/store/director.js

@@ -1,38 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/headteacher`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 38
src/store/duty.js

@@ -1,38 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/duty`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 15 - 15
src/store/index.js

@@ -1,20 +1,20 @@
 import Vue from 'vue';
 import Vuex from 'vuex';
-import classes from './classes';
-import dept from './dept';
-import location from './location';
-import bedroom from './bedroom';
-import director from './director';
-import student from './student';
-import task from './task';
-import subject from './subject';
-import question from './question';
-import questionnaire from './questionnaire';
-import teacher from './teacher';
-import trainplan from './trainplan';
-import duty from './duty';
-import school from './school';
-import schPlan from '@school/src/store/sch-plan';
+import classes from '@frame/store/classes';
+import dept from '@frame/store/dept';
+import location from '@frame/store/location';
+import bedroom from '@frame/store/bedroom';
+import director from '@frame/store/director';
+import student from '@frame/store/student';
+import task from '@frame/store/task';
+import subject from '@frame/store/subject';
+import question from '@frame/store/question';
+import questionnaire from '@frame/store/questionnaire';
+import teacher from '@frame/store/teacher';
+import trainplan from '@frame/store/trainplan';
+import duty from '@frame/store/duty';
+import school from '@frame/store/school';
+import schPlan from '@frame/store/sch-plan';
 
 Vue.use(Vuex);
 

+ 0 - 38
src/store/location.js

@@ -1,38 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/location`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 38
src/store/question.js

@@ -1,38 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/question`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/show/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 38
src/store/questionnaire.js

@@ -1,38 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/questionnaire`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/show/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 38
src/store/school.js

@@ -1,38 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/school`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 43
src/store/student.js

@@ -1,43 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/student`,
-  noClass: '/api/train/student/seek',
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-  async noClass({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.noClass}`, payload);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 38
src/store/subject.js

@@ -1,38 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/subject`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 38
src/store/task.js

@@ -1,38 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/task`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/show/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/teacher.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/teacher`,
-  interfaceEdit: id => `/api/train/teacher/update/${id}`,
-  // interfaceSelect: id => `/api/teacher/show/${id}`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/show/${payload}`);
-    return res;
-  },
-
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 38
src/store/trainplan.js

@@ -1,38 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  interface: `/api/train/trainplan`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.interface}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 49 - 24
src/views/plan/lesson-plan.vue

@@ -36,35 +36,40 @@
           <template #label>
             <span style="zoom:1.3">{{ form.name }}</span>
           </template>
-          <data-form :data="form" :fields="formFields" :rules="rules" @save="handleSave" :isNew="false">
-            <template #custom="{item, form}">
-              <template v-if="item.model === 'subid'">
-                <el-select v-model="form[item.model]" @change="getTeacherList">
-                  <el-option v-for="(item, index) in subjectList" :key="`subject${index}`" :label="item.name" :value="item.id"></el-option>
-                </el-select>
-              </template>
-              <template v-if="item.model === 'teacherid'">
-                <el-select v-model="form[item.model]" placeholder="请先选择科目">
-                  <el-option v-for="(item, index) in teacherList" :key="`teacher${index}`" :label="item.name" :value="item.id"></el-option>
-                </el-select>
-              </template>
-            </template>
-            <template #radios="{item, form}">
-              <template v-if="item.model === 'day'">
+          <el-form ref="form" :model="form" label-width="120px" size="mini" :rules="rules">
+            <el-form-item label="时间" prop="date">
+              {{ form.date }}
+            </el-form-item>
+            <el-form-item label="星期" prop="week">
+              {{ form.week }}
+            </el-form-item>
+            <el-form-item label="所授科目" prop="subid" required>
+              <el-select v-model="form.subid">
+                <el-option v-for="(item, index) in subjectList" :key="`subject${index}`" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="任课教师" prop="teacherid" required>
+              <el-input v-model="form.teacher_name" :readonly="true" placeholder="点击选择教师" @click="toChooseTeacher"></el-input>
+            </el-form-item>
+            <el-form-item label="时长" prop="day" required>
+              <el-radio-group v-model="form.day">
                 <el-radio v-for="(i, index) in dayList" :key="index" :label="i.label"></el-radio>
-              </template>
-            </template>
-          </data-form>
+              </el-radio-group>
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" @click="toSaveDrawer">保存</el-button>
+            </el-form-item>
+          </el-form>
         </el-tab-pane>
       </el-tabs>
     </el-drawer>
+    <el-dialog :visible.sync="dialog" title="选择教师"></el-dialog>
   </div>
 </template>
 
 <script>
 import _ from 'lodash';
 import dataTable from '@frame/components/data-table';
-import dataForm from '@frame/components/form';
 export default {
   name: 'lesson-plan',
   props: {
@@ -75,11 +80,13 @@ export default {
     subjectList: { type: Array, default: () => [] },
     lyTeacherList: { type: Array, default: () => [] },
     teacherList: { type: Array, default: () => [] },
+    applyTeacherList: { type: Array, default: () => [] },
   },
-  components: { dataTable, dataForm },
+  components: { dataTable },
   data: () => ({
     activeName: '0',
     drawer: false,
+    dialog: false,
     dateList: [],
     classList: [],
     fields: [
@@ -103,7 +110,11 @@ export default {
       { label: '时长', model: 'day', type: 'radio' },
     ],
     dayList: [{ label: '一天' }, { label: '半天' }],
-    rules: {},
+    rules: {
+      subid: [{ required: true, message: '请选择科目' }],
+      teacherid: [{ required: true, message: '请选择任课教师' }],
+      day: [{ required: true, message: '请选择时长' }],
+    },
     form: {},
   }),
   created() {
@@ -146,15 +157,29 @@ export default {
       // 1先查询课程列表
       // 2先查询arr中,是否有选择的课程,有则查询教师列表
       this.$set(this, `form`, { ...sClass, ...arrange });
+      this.form.day ? '' : (this.form.day = '一天');
       this.drawer = true;
     },
     handleSave({ data, isNew }) {
       console.log(data);
       //根据data.id(班级id)找出是那条数据,然后根据data.date找到那条数据,将课程,教师,时长显示出来
     },
-    getTeacherList(subjectId) {
-      console.log(subjectId);
-      this.$emit('getTeacher', subjectId);
+    toChooseTeacher() {
+      //TODO 根据科目id,查询教师和申请授课教师两个列表
+      if (this.form.subid) {
+        this.dialog = true;
+        this.$emit('getTeacher', this.form.subid);
+      }
+    },
+    toSaveDrawer() {
+      this.$refs['form'].validate(valid => {
+        if (valid) {
+          console.log(this.form);
+        } else {
+          console.warn('form validate error!!!');
+          return false;
+        }
+      });
     },
   },
   computed: {

+ 2 - 0
src/views/plan/lesson.vue

@@ -67,6 +67,7 @@ export default {
     subjectList: [],
     lyTeacherList: [],
     teacherList: [],
+    applyTeacherList: [],
   }),
   created() {
     this.search();
@@ -112,6 +113,7 @@ export default {
       if (this.$checkRes(res)) this.$set(this, `lyTeacherList`, res.data);
     },
     async toGetTeacherList(subjectId) {
+      //applyTeacherList
       let res = await this.getTeacherList({ subid: subjectId });
       if (this.$checkRes(res)) this.$set(this, `teacherList`, res.data);
     },