Explorar o código

12/09 17:26

11
mo %!s(int64=4) %!d(string=hai) anos
pai
achega
662892f75e

+ 37 - 0
src/api/specialSetting.js

@@ -298,3 +298,40 @@ export function deleteOrganizationCourseUnitPrice (data) {
     data
   })
 }
+
+// 查询课程时长
+export function getOrganizationCourseDurationSettings(data) {
+  return request2({
+    url: api + `/organizationCourseDurationSettings/queryPage`,
+    method: 'get',
+    data:{},
+    params: data,
+  })
+}
+
+// 修改课程时长
+export function resetOrganizationCourseDurationSettings(data) {
+  return request2({
+    url: api + `/organizationCourseDurationSettings/update`,
+    method: 'post',
+    params:data,
+  })
+}
+
+// 新增课程时长
+export function addOrganizationCourseDurationSettings(data) {
+  return request2({
+    url: api + `/organizationCourseDurationSettings/insert`,
+    method: 'post',
+    data:data,
+  })
+}
+
+//删除课程时长
+export function delOrganizationCourseDurationSettings(data) {
+  return request2({
+    url: api + `/organizationCourseDurationSettings/del`,
+    method: 'post',
+    data:data,
+  })
+} 

+ 1 - 0
src/utils/searchArray.js

@@ -27,6 +27,7 @@ export const musicCourseType = [
   { label: "集训单技课", value: "TRAINING_SINGLE" },
   { label: "集训合奏课", value: "TRAINING_MIX" },
   { label: "课堂课", value: "CLASSROOM" },
+  { label: "综合课", value: "COMPREHENSIVE" },
 ]
 
 export const courseListType = [

+ 1 - 1
src/views/categroyManager/generalSettings/vipParameterManager.vue

@@ -150,7 +150,7 @@
         <el-button @click="closeVipStatus">取 消</el-button>
         <el-button type="primary"
                    @click="addVipStatus">确 定</el-button>
-      </div>
+      </div> 
     </el-dialog>
 
     <!-- 周期循环新增弹窗 -->

+ 2 - 2
src/views/categroyManager/globalConfig.vue

@@ -27,10 +27,10 @@
                      v-if="permissionList.typesManager">
           <typesManager v-if="activeIndex == 2" />
         </el-tab-pane>
-          <el-tab-pane label="课程时长"
+          <el-tab-pane label="课程时长设置"
           lazy
                      name="11"
-                     v-if="permissionList.musicalManagerOut">
+                     v-if="permissionList.courseTimerSetting">
           <courseTimerSetting v-if="activeIndex == 11" />
         </el-tab-pane>
         <el-tab-pane label="商品折扣和声部设置"

+ 204 - 9
src/views/categroyManager/specialSetup/courseTimerSetting.vue

@@ -1,17 +1,212 @@
 <template>
-    <div>
-        课程时长设置
+  <div class="m-core">
+    <save-form
+      :inline="true"
+      class="searchForm"
+      ref="searchForm"
+      :model.sync="searchForm"
+    >
+      <el-form-item :rules="[]">
+        <el-select
+          class="multiple"
+          v-model.trim="searchForm.organId"
+          filterable
+          clearable
+          placeholder="请选择分部"
+        >
+          <el-option
+            v-for="(item, index) in selects.branchs"
+            :key="index"
+            :label="item.name"
+            :value="item.id"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-select
+          class="multiple"
+          v-model.trim="searchForm.courseScheduleType"
+          filterable
+          clearable
+          placeholder="课程类型"
+        >
+          <el-option
+            v-for="(item, index) in courseType"
+            :key="index"
+            :label="item.label"
+            :value="item.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button @click="search" type="primary">搜索</el-button>
+        <el-button @click="reset" type="danger">重置</el-button>
+      </el-form-item>
+    </save-form>
+    <div
+      class="newBand"
+      v-permission="'courseHomeworkTemplate/add'"
+      @click="openJob('create')"
+    >
+      添加
     </div>
+    <!-- 列表 -->
+    <div class="tableWrap">
+      <el-table
+        :data="tableList"
+        :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
+      >
+        <el-table-column align="center" prop="organ.name" label="分部名称">
+        </el-table-column>
+        <el-table-column
+          align="center"
+          prop="classGroupTypeName"
+          label="课程形式"
+        >
+          <template slot-scope="scope">
+            <div>
+              {{ scope.row.courseType | coursesType }}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="课程课时" prop="duration">
+          <!-- <template slot-scope="scope">
+            {{ scope.row.subjectName ? scope.row.subjectName : "无" }}
+          </template> -->
+        </el-table-column>
+        <el-table-column align="center" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="resetCourseTime(scope.row)"
+              v-permission="'courseHomeworkTemplate/update'"
+              type="text"
+              >修改</el-button
+            >
+            <!-- <el-button
+              @click="delCourseTime(scope.row)"
+              v-permission="'courseHomeworkTemplate/del'"
+              type="text"
+              >删除</el-button> -->
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        sync
+        :total.sync="pageInfo.total"
+        :page.sync="pageInfo.page"
+        :limit.sync="pageInfo.limit"
+        :page-sizes="pageInfo.page_size"
+        @pagination="getList"
+      />
+    </div>
+    <el-dialog
+      :title="isAdd ? '新增课程时长' : '修改课程时长'"
+      class="courseMask"
+      width="500px"
+      :visible.sync="courseVisible"
+    >
+      <courseTimeForm
+        ref="courseTimeForm"
+        :activeRow="activeRow"
+        v-if="courseVisible"
+        :organList="selects.branchs"
+        :courseType="courseType"
+        @close="close"
+      />
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="courseVisible = false">取 消</el-button>
+        <el-button type="primary" @click="submitInfo">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 <script>
+import pagination from "@/components/Pagination/index";
+import { musicCourseType } from "@/utils/searchArray";
+import { getOrganizationCourseDurationSettings,delOrganizationCourseDurationSettings } from "@/api/specialSetting";
+import courseTimeForm from "./modals/courseTimeForm";
+const initSearch = {
+  courseScheduleType: null,
+  organId: null,
+};
 export default {
-    data(){
-        return{
-
-        }
-    }
-}
+  components: { pagination, courseTimeForm },
+  data() {
+    return {
+      tableList: [],
+      pageInfo: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 0, // 总条数
+        page_size: [10, 20, 40, 50], // 选择限制显示条数
+      },
+      searchForm: { ...initSearch },
+      courseType: musicCourseType,
+      isAdd: true,
+      courseVisible: false,
+      activeRow: null,
+    };
+  },
+  mounted() {
+    this.$store.dispatch("setBranchs");
+    this.getList();
+  },
+  methods: {
+    async getList() {
+      try {
+        const res = await getOrganizationCourseDurationSettings({
+          ...this.searchForm,
+          page: this.pageInfo.page,
+          rows: this.pageInfo.limit,
+        });
+        this.pageInfo.total = res.data.total;
+        this.tableList = res.data.rows;
+      } catch (e) {}
+    },
+    search() {
+      this.pageInfo.page = 1;
+      this.$refs.searchForm.save(this.searchForm);
+      this.$refs.searchForm.save(this.pageInfo, "page");
+      this.getList();
+    },
+    reset() {
+      this.searchForm = { ...initSearch };
+      this.search();
+    },
+    resetCourseTime(row) {
+      this.isAdd = false;
+      this.activeRow = row;
+      this.courseVisible = true;
+    },
+    submitInfo() {
+      const str = this.isAdd ? "create" : "update";
+      this.$refs.courseTimeForm.submitInfo(str);
+    },
+    close() {
+      this.courseVisible = false;
+      this.getList();
+    },
+    openJob() {
+      this.isAdd = true;
+      this.activeRow = null;
+      this.courseVisible = true;
+    },
+    async delCourseTime(row) {
+      this.$confirm("是否删除?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then( async() => {
+        try{
+         const res =   await delOrganizationCourseDurationSettings({ id:row.id})
+         this.$message.success('删除成功')
+         this.getList()
+        }catch{}
+      });
+    },
+  },
+};
 </script>
 <style lang="scss" scoped>
-    
 </style>

+ 186 - 0
src/views/categroyManager/specialSetup/modals/courseTimeForm.vue

@@ -0,0 +1,186 @@
+<template>
+  <div>
+    <el-form :model="courseTimeForm" ref="courseTimeForm">
+      <el-form-item
+        label="分部"
+        prop="organId"
+        :label-width="formLabelWidth"
+        :rules="[{ required: true, message: '请选择分部', trigger: 'blur' }]"
+      >
+        <el-select
+          style="width: 100% !important"
+          class="multiple"
+          v-model.trim="courseTimeForm.organId"
+          filterable
+          clearable
+          placeholder="请选择分部"
+        >
+          <el-option
+            v-for="(item, index) in organList"
+            :key="index"
+            :label="item.name"
+            :value="item.id"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        label="课程类型"
+        prop="courseType"
+        :label-width="formLabelWidth"
+        :rules="[
+          { required: true, message: '请选择课程类型', trigger: 'blur' },
+        ]"
+      >
+        <el-select
+          style="width: 100% !important"
+          class="multiple"
+          v-model.trim="courseTimeForm.courseType"
+          filterable
+          clearable
+          placeholder="课程类型"
+        >
+          <el-option
+            v-for="(item, index) in courseType"
+            :key="index"
+            :label="item.label"
+            :value="item.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="课程课时" prop="timer" :label-width="formLabelWidth">
+        <el-tag
+          :key="index"
+          effect="dark"
+          type="info"
+          v-for="(tag, index) in dynamicTags"
+          closable
+          :disable-transitions="false"
+          @close="handleClose(tag)"
+        >
+          {{ tag }}
+        </el-tag>
+        <el-input
+          class="input-new-tag"
+          v-if="inputVisible"
+          v-model.trim="inputValue"
+          ref="saveTagInput"
+          style="width: 100px"
+          size="small"
+          @keyup.enter.native="handleInputConfirm"
+        >
+        </el-input>
+        <el-button
+          v-if="!inputVisible"
+          class="button-new-tag"
+          size="small"
+          @click="showInput"
+          >+ 添加</el-button
+        >
+        <el-button
+          v-if="inputVisible"
+          class="button-new-tag"
+          size="small"
+          @click="handleInputConfirm"
+          >保存</el-button
+        >
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+<script>
+import { resetOrganizationCourseDurationSettings,addOrganizationCourseDurationSettings } from "@/api/specialSetting";
+export default {
+  props: ["activeRow", "organList", "courseType"],
+  data() {
+    return {
+      courseTimeForm: {
+        organId: "",
+        courseType: "",
+        timer: [],
+        id: "",
+      },
+      inputVisible: false,
+      formLabelWidth: "80px",
+      dynamicTags: [],
+      inputValue: "",
+    };
+  },
+  mounted() {
+    console.log(this.activeRow);
+    if (this.activeRow) {
+      this.courseTimeForm.organId = this.activeRow.organId;
+      this.courseTimeForm.timer = this.activeRow.duration.split(",");
+      this.dynamicTags = this.activeRow.duration.split(",");
+      this.courseTimeForm.courseType = this.activeRow.courseType;
+      this.courseTimeForm.id = this.activeRow.id;
+    }
+  },
+  methods: {
+    handleInputConfirm() {
+      let inputValue = this.inputValue;
+      if (inputValue) {
+        this.dynamicTags.push(inputValue);
+      }
+      this.inputVisible = false;
+      this.inputValue = "";
+    },
+    handleClose(tag) {
+      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
+    },
+
+    showInput() {
+      this.inputVisible = true;
+      this.$nextTick((_) => {
+        this.$refs.saveTagInput.$refs.input.focus();
+      });
+    },
+    async submitInfo(str) {
+      console.log(str);
+      this.$refs.courseTimeForm.validate(async (_) => {
+        if (_) {
+          if (this.dynamicTags.length <= 0) {
+            this.$message.error("请至少填写一个课程课时");
+            return;
+          }
+          if (str == "update") {
+            try {
+              const res = await resetOrganizationCourseDurationSettings({
+                organId: this.courseTimeForm.organId,
+                duration: this.dynamicTags.join(","),
+                courseType: this.courseTimeForm.courseType,
+                id: this.courseTimeForm.id,
+              });
+                this.$message.success("修改成功");
+                this.$emit('close')
+            } catch {}
+          }else if(str == "create"){
+                   try {
+              const res = await addOrganizationCourseDurationSettings({
+                organId: this.courseTimeForm.organId,
+                duration: this.dynamicTags.join(","),
+                courseType: this.courseTimeForm.courseType,
+              });
+                this.$message.success("新建成功");
+                this.$emit('close')
+            } catch {}
+          }
+        }
+      });
+
+    
+    },
+  },
+  watch: {
+    dynamicTags(val) {
+      this.courseTimeForm.timer = val;
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.courseMask {
+  .el-tag.el-tag--info {
+    margin-right: 4px;
+  }
+}
+</style>