jill
2020-09-25 2a7fef27a7c8a5652f5c94210f751bcaaaa20388
修改馆分课和排课删除bug
1 files added
6 files modified
561 ■■■■■ changed files
debug.log 1 ●●●● patch | view | raw | blame | history
src/apis/teachCenter/lesson/index.js 15 ●●●●● patch | view | raw | blame | history
src/components/teachCenter/Arrange.vue 8 ●●●● patch | view | raw | blame | history
src/views/teachCenter/branch/branchList.vue 2 ●●● patch | view | raw | blame | history
src/views/teachCenter/grade/GradeCheck.vue 21 ●●●●● patch | view | raw | blame | history
src/views/teachCenter/lesson/AssignCourses.vue 503 ●●●●● patch | view | raw | blame | history
src/views/teachCenter/lesson/router.js 11 ●●●●● patch | view | raw | blame | history
debug.log
@@ -1,3 +1,4 @@
[0714/170936.467:ERROR:scoped_process_suspend.cc(31)] NtSuspendProcess: 已尝试访问正在退出的过程。 (0xc000010a)
[0714/170936.478:ERROR:process_info.cc(118)] ReadProcessMemory bool __cdecl crashpad::(anonymous namespace)::ReadStruct(HANDLE, crashpad::WinVMAddress, T *) [T = crashpad::process_types::PEB<crashpad::process_types::internal::Traits64>]: 仅完成部分的 ReadProcessMemory 或 WriteProcessMemory 请求。 (0x12B)
[0714/170936.487:ERROR:process_info.cc(551)] ReadProcessData failed
[0925/051411.023:ERROR:crash_report_database_win.cc(428)] unexpected header
src/apis/teachCenter/lesson/index.js
@@ -14,6 +14,8 @@
const courseSaveAddUrl = '/api/v1/TeCourse/courseSaveAdd';
// 课程详情
const courseInfoUrl = '/api/v1/TeCourse/courseInfo';
// 馆分配课程
const organizeAddUrl = '/api/v1/Organize/organizeAdd';
// 接口
const productsList = (classMode,courseClassifyId) => network.post(productsListUrl, {classMode,courseClassifyId});
/**
@@ -94,6 +96,16 @@
    classMode,
    courseName
})
/**
 * 馆分配课程
 * @param {*} courseId
 * @param {*} orgId
 */
const organizeAdd = (courseId, orgId) => network.post(organizeAddUrl, {
    courseId,
    orgId
})
// cuimuhua end
export {
    // liufeibo
@@ -107,6 +119,7 @@
    // cuimuhua
    getClassType,
    getCourseList
    getCourseList,
    organizeAdd
    // cuimuhua
}
src/components/teachCenter/Arrange.vue
@@ -233,6 +233,8 @@
      dialogTeacherData: [],
      feekIdStr: '',
      classNumber: '',
      // 多个次数
      classNumbers: [],
      feekId: [],
      // 教师数据
      eyeOption: [],
@@ -386,6 +388,10 @@
        this.selectAllData = val;
        this.selectData = val[0];
        this.classNumber = val[0].classNumber;
        this.classNumbers = [];
        val.forEach(item => {
          this.classNumbers.push(item.classNumber);
        })
        this.feekId = [];
        for (let v of val) {
          this.feekId.push(v.id);
@@ -480,7 +486,7 @@
          confirmButtonText: "删除",
          type: "warning"
        }).then(() => {
          this.$emit("emitDelete", this.feekIdStr);
          this.$emit("emitDelete", this.feekIdStr, this.classNumbers.toString());
        });
      }
src/views/teachCenter/branch/branchList.vue
@@ -203,7 +203,7 @@
      obj.label = row.OrgName;
      obj.key = row.id;
      this.$router.push({
        path: "/teachCenter/lesson/addDouble",
        path: "/teachCenter/lesson/AssignCourses",
        query: {
          branchName: JSON.stringify(obj),
        },
src/views/teachCenter/grade/GradeCheck.vue
@@ -374,16 +374,21 @@
    emitHour (val) {
      this.editClassHour(val);
    },
    emitDelete (val) {
      this.getRecode(val);
    /*
    * classNumber次数 第几次
    */
    emitDelete (val, classNumber) {
      this.getRecode(val, classNumber);
    },
    emitTwoDelete (val) {
      this.getRecodeDelete(val);
    emitTwoDelete (val, classNumber) {
      this.getRecodeDelete(val, classNumber);
    },
    async getRecodeDelete (val) {
    async getRecodeDelete (val, classNumber) {
      let data = {
        id: val
        id: val,
        classCode: this.classCode,
        classNumber: classNumber
      }
      let res = await getRecodeDelete(data);
      if (Object.is(res.code, 1)) {
@@ -393,7 +398,7 @@
        this.$refs.classArr.hideDialogDelete();
      }
    },
    async getRecode (val) {
    async getRecode (val, classNumber) {
      let data = {
        classCode: this.infoData.classCode,
        coursetableId: val
@@ -401,7 +406,7 @@
      let res = await getRecode(data);
      if (Object.is(res.code, 1)) {
        if (Object.is(res.data, 1)) {
          this.getRecodeDelete(val);
          this.getRecodeDelete(val, classNumber);
        } else {
          this.$refs.classArr.showDialogDelete();
        }
src/views/teachCenter/lesson/AssignCourses.vue
New file
@@ -0,0 +1,503 @@
<template>
  <div class="add-double">
    <bread-crumb :breadList="breadList"></bread-crumb>
    <div class="v-box">
      <div class="hd">
        <h2 class="square">课程基本信息</h2>
      </div>
      <div class="basic-box">
        <ul class="s-query mart25">
          <li>
            <div class="th">
              <span class="xing">*</span>是否上架:
            </div>
            <div class="td">
              <!-- <el-tooltip :content="upperAndLower" placement="top" v-loading="loading"> -->
              <el-switch
                v-model="isUpper"
                active-color="#FF8C15"
                inactive-color="#DCDFE6"
                active-value="0"
                inactive-value="1"
              ></el-switch>
              <!-- </el-tooltip> -->
            </div>
          </li>
          <li>
            <div class="th">
              <span class="xing">*</span>上课方式:
            </div>
            <div class="td">
              <el-select v-model="form.classType" @change="classTypeChange">
                <el-option
                  v-for="(item,index) in classTypeOption"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </div>
          </li>
          <li>
            <div class="th">
              <span class="xing">*</span>课程分类:
            </div>
            <div class="td">
              <el-select
                v-model="form.classification"
                value-key="id"
                :class="{'warning':warning.classification}"
                placeholder="请选择"
                @change="addstate"
              >
                <el-option
                  v-for="item in classificationOption"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                ></el-option>
              </el-select>
            </div>
          </li>
          <li>
            <div class="th">
              <span class="xing">*</span>选择课程:
            </div>
            <div class="td">
              <el-select filterable v-model="form.telClass" value-key="id" @change="telClassChange">
                <el-option
                  v-for="(item) in relatedCourses"
                  :key="item.id"
                  :label="item.courseName"
                  :value="item"
                ></el-option>
              </el-select>
            </div>
          </li>
        </ul>
        <div>
          <div class="radio-box">
            <span class="xing">*</span>指定分馆:
          </div>
          <el-radio v-model="radio" label="1" disabled>全部</el-radio>
        </div>
        <div class="radio2">
          <el-radio v-model="radio" label="2">指定分配</el-radio>
          <span class="suline" v-if="this.radio == 2"></span>
          <el-button
            type="warning"
            size="mini"
            plain
            class="marl30"
            @click="dakai()"
            v-if="this.radio == 2"
          >选择分馆</el-button>
        </div>
        <div class="choice-box" v-if="list.length && this.radio == 2">
          <el-button type="text" @click="open" class="choice-title">清除全部</el-button>
          <ul class="ul-box">
            <li class="li-text" v-for="(item, index) in list" :key="index">
              {{item.label}}
              <span class="el-icon-close fork" @click="Fork(index)"></span>
              <!-- <span class="li-line"></span> -->
            </li>
          </ul>
        </div>
        <ul class="s-query mart25">
          <li>
            <div class="th">分配时间:</div>
            <el-radio v-model="radio2" label="0" @change="selectionTime">不限</el-radio>
            <el-radio v-model="radio2" label="1" @change="selectionTime">限制</el-radio>
          </li>
          <li class="li-time" v-if="this.radio2 == 1">
            <el-date-picker
              v-model="startDndTime"
              type="datetimerange"
              start-placeholder="开始日期"
              format="yyyy-MM-dd HH:mm:ss"
              value-format="yyyy-MM-dd HH:mm:ss"
              end-placeholder="结束日期"
              :default-time="['12:00:00']"
            ></el-date-picker>
          </li>
        </ul>
        <div class="footer">
          <button class="hollow-btn hollow-btn-default" @click="cancel">取消</button>
          <button class="btn btn-orange-bg" @click="submit">确定</button>
        </div>
      </div>
    </div>
    <popup ref="dialog" :persons="persons" @func="getMsgFormSon"></popup>
  </div>
</template>
<script>
import { Utils } from "@/assets/js/utils";
import popup from "@/components/common/popup";
import {
  productsList,
  getclassList,
  getClassType,
  getCourseList,
  organizeAdd
} from "@/apis/teachCenter/lesson";
let utils = new Utils();
export default {
  name: "AddDouble",
  data() {
    return {
      props: {
        multiple: true,
      },
      breadList: [
        {
          bread_name: "课程列表",
          bread_url: "/teachCenter/lesson",
        },
        {
          bread_name: "分配",
          bread_url: "",
        },
      ],
      classificationOption: [],
      persons: 1,
      classTypeOption: [
        { label: "双线课", value: "2" },
        { label: "面授课", value: "3" },
      ],
      classification: "",
      relatedCourses: [],
      telClassOption: [],
      hiddenClassName: "",
      form: {
        // 关联课程
        curriculum: [],
        curriculum2: [],
        telClass: "",
        // 课程分类
        classification: "",
        // 课程名称
        className: "",
        classType: "",
      },
      productsId: "",
      childrenId: "",
      list: [
        // { label: "深圳福田安妮花土豆馆妮花土豆馆", key: 1 },
        // { name: "深圳福田安妮花土豆馆妮花土豆馆", id: 2 },
        // { name: "深圳福田安妮", id: 3 }
      ],
      isUpper: "0",
      radio: this.$route.query.branchName == undefined ? "1" : "2",
      radio2: "0",
      startDndTime: "",
      // 必填项校验
      warning: {
        curriculum: false,
        classification: false,
        className: false,
      },
      // formRules: {
      //   money: [{ required: false, tigger: "blur", validator: validateMoney }]
      // }
    };
  },
  components: {
    popup,
  },
  methods: {
    addstate() {
      this.form.telClass='';
      this.productsList();
    },
    open() {
      this.$confirm("确定清空全部分馆吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.list = [];
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消清空全部分馆",
          });
        });
    },
    elCascader(value) {
      //let nodesObj = this.$refs['cascader'].getCheckedNodes()
      let nodesObj = this.form.curriculum;
      let childrenId = [],
        productsId = [],
        products = "";
      // console.log(this.form.curriculum);
      for (let i = 0; i < nodesObj.length; i++) {
        childrenId.push(nodesObj[i][1]);
        productsId.push(nodesObj[i][0]);
      }
      this.productsId = String(productsId);
      this.childrenId = String(childrenId);
    },
    // 选中时间
    selectionTime() {
      // console.log(this.radio2)
      if (this.radio2 == 0) {
        this.startDndTime = "";
      }
    },
    /* new
     * 课程列表
     * 页数暂时固定
    */
    async productsList() {
      let { data } = await getCourseList(1, 10000, this.form.classification, this.form.classType);
      this.relatedCourses = data.list;
    },
    // 课程分类
    async getclassList() {
      let classMode = this.form.classType;
      let { data } = await getClassType(classMode);
      this.classificationOption = data;
    },
    // 子组件内容
    getMsgFormSon(data) {
      this.list = this.list.concat(data);
      this.list = [...new Set(this.list)];
    },
    dakai() {
      this.$nextTick(() => {
        this.$refs.dialog.open();
      });
    },
    // 删除
    Fork(index) {
      this.list.splice(index, 1);
    },
    /**
     * input 验证规则
     */
    iptVerify(key) {
      this.form[key] = this.form[key].replace(/[^0-9]/g, "");
    },
    /**
     * 取消
     */
    cancel() {
      this.$router.push({
        path: "/teachCenter/branch",
      });
    },
    /**
     * 确定
     */
    submit() {
      console.log(this.radio2);
      let isSub = this.verify();
      if (isSub != "-1") {
        this.tip("请完善必填项信息!", "提示");
      } else if (this.radio == 2 && !this.list.length) {
        this.tip("请完善指定分馆!", "提示");
      } else if (
        (this.radio2 == 1 && this.startDndTime == "") ||
        this.startDndTime == null
      ) {
        this.tip("请完善分配时间!", "提示");
      } else {
        this.organizeAdd();
      }
    },
    priceTest() {
      var reg = new RegExp(
        "^(((\\d{1,2})[.]((\\d{1,2})?))|100|(?:0|[1-9][0-9]?)|100.00|100.0)$"
      );
      if (!reg.test(this.form.price)) {
        this.form.price = "";
        return false;
      }
    },
    classTypeChange() {
      this.form.classification = "";
      this.form.telClass='';
      this.getclassList();
    },
    /* new */
    async organizeAdd() {
      let courseId = this.form.telClass.id,
          orgIds = [];
      this.list.forEach(item => {
        orgIds.push(item.key);
      })
      let { code, data } = await organizeAdd(
        courseId,
        orgIds.toString()
      );
      if (code == 1) {
        if(orgIds.length == 1){
          this.$router.push({
            path: "/teachCenter/branch/branchCheckPath",
            query: {
              id: orgIds.toString()
            }
          });
        }else{
          this.$router.push({
            path: "/teachCenter/branch"
          });
        }
      }
    },
    telClassChange() {
      this.hiddenClassName = this.form.telClass.productTitle;
    },
    verify() {
      let { telClass, classification } = this.form;
      let verify = {
        telClass,
        classification
      };
      return utils.handleRequired(verify, this.warning);
    },
  },
  created() {
    if (!Object.is(this.$route.query.branchName, undefined)) {
      let queryData = JSON.parse(this.$route.query.branchName);
      if (Array.isArray(queryData)) {
        for (let item of queryData) {
          this.list.push(item);
        }
      } else {
        this.list.push(JSON.parse(this.$route.query.branchName));
      }
    }
    // this.getclassList();
  },
};
</script>
<style lang="less" scoped>
.basic-box {
  padding: 27px 26px;
  box-sizing: border-box;
  background-color: #fff;
}
.xing {
  color: #f56c6c;
  position: absolute;
  font-size: 20px;
  top: 4px;
  left: 2px;
}
.mart25 {
  margin-top: 25px;
}
.s-query {
  > li {
    float: inherit;
    margin-bottom: 20px;
    position: relative;
    .th {
      width: 100px;
      height: 40px;
      text-align: right;
    }
  }
  .age-box {
    width: 160px;
    font-size: 14px;
    color: #303133;
  }
}
.price {
  width: 120px;
}
.radio-box {
  position: relative;
  width: 100px;
  height: 40px;
  text-align: right;
  font-size: 16px;
  color: #303133;
  line-height: 40px;
  display: inline-block;
}
.radio2 {
  margin-left: 100px;
  display: flex;
  align-items: center;
}
.suline {
  width: 1px;
  height: 13px;
  background: #dcdfe6;
  display: inline-block;
}
.marl30 {
  margin-left: 30px;
}
.choice-box {
  width: 644px;
  padding: 16px 32px;
  box-sizing: border-box;
  background-color: #fffaf1;
  margin-left: 110px;
  margin-top: 15px;
  position: relative;
}
.choice-title {
  color: #ff8c15;
  font-size: 13px;
  position: absolute;
  top: 16px;
  right: 32px;
}
.ul-box {
  margin-top: 33px;
}
.li-text {
  width: 50%;
  height: 20px;
  line-height: 20px;
  display: inline-block;
}
.fork {
  margin-left: 13px;
  cursor: pointer;
}
.li-time {
  margin-left: 100px;
}
// .footer {
//   margin-left: 100px;
// }
.el-icon-close:hover {
  color: #ff0000;
}
</style>
src/views/teachCenter/lesson/router.js
@@ -10,6 +10,8 @@
const EditDouble = () => import("./EditDouble.vue")
// 编辑面授
const EditFace = () => import("./EditFace.vue")
// 分配课程
const AssignCourses = () => import("./AssignCourses.vue")
const lesson = [
    {
        path: 'lesson',
@@ -59,6 +61,15 @@
                    auth: true,
                    title: '编辑面授课'
                }
            },
            {
                path: 'assignCourses',
                name: 'AssignCourses',
                component: AssignCourses,
                meta: {
                    auth: true,
                    title: '分配课程'
                }
            }
        ]
    }