|  | @@ -1,12 +1,7 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  |    <div>
 | 
	
		
			
				|  |  |      <el-alert title="教材信息" :closable="false" class="alert" type="info" />
 | 
	
		
			
				|  |  | -    <el-form
 | 
	
		
			
				|  |  | -      :model="form"
 | 
	
		
			
				|  |  | -      label-width="120px"
 | 
	
		
			
				|  |  | -      class="form"
 | 
	
		
			
				|  |  | -      ref="form"
 | 
	
		
			
				|  |  | -    >
 | 
	
		
			
				|  |  | +    <el-form :model="form" label-width="120px" class="form" ref="form">
 | 
	
		
			
				|  |  |        <el-form-item
 | 
	
		
			
				|  |  |          label="教材名称"
 | 
	
		
			
				|  |  |          prop="name"
 | 
	
	
		
			
				|  | @@ -18,12 +13,16 @@
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |          ]"
 | 
	
		
			
				|  |  |        >
 | 
	
		
			
				|  |  | -        <el-input v-model="form.name" placeholder="请输入教材名称" style="width: 100%"></el-input>
 | 
	
		
			
				|  |  | +        <el-input
 | 
	
		
			
				|  |  | +          v-model="form.name"
 | 
	
		
			
				|  |  | +          placeholder="请输入教材名称"
 | 
	
		
			
				|  |  | +          style="width: 100%"
 | 
	
		
			
				|  |  | +        ></el-input>
 | 
	
		
			
				|  |  |        </el-form-item>
 | 
	
		
			
				|  |  |        <el-form-item
 | 
	
		
			
				|  |  |          label="音源设置"
 | 
	
		
			
				|  |  |          prop="soundResource"
 | 
	
		
			
				|  |  | -        v-if="level <= 1 && (level == 1 && type != 'create')"
 | 
	
		
			
				|  |  | +        v-if="level <= 1 && level == 1 && type != 'create'"
 | 
	
		
			
				|  |  |          :rules="[
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              required: true,
 | 
	
	
		
			
				|  | @@ -32,7 +31,13 @@
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |          ]"
 | 
	
		
			
				|  |  |        >
 | 
	
		
			
				|  |  | -        <el-select filterable placeholder="请选择音源设置" clearable v-model="form.soundResource" style="width: 100% !important">
 | 
	
		
			
				|  |  | +        <el-select
 | 
	
		
			
				|  |  | +          filterable
 | 
	
		
			
				|  |  | +          placeholder="请选择音源设置"
 | 
	
		
			
				|  |  | +          clearable
 | 
	
		
			
				|  |  | +          v-model="form.soundResource"
 | 
	
		
			
				|  |  | +          style="width: 100% !important"
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  |            <el-option label="NotePerformer音源" value="NOTEPERFORMER"></el-option>
 | 
	
		
			
				|  |  |            <el-option label="标准音源" value="TANG"></el-option>
 | 
	
		
			
				|  |  |            <el-option label="官方音源" value="OFFICIAL"></el-option>
 | 
	
	
		
			
				|  | @@ -57,10 +62,15 @@
 | 
	
		
			
				|  |  |            :imageHeightM="imageHeightM"
 | 
	
		
			
				|  |  |            ref="uploadImg"
 | 
	
		
			
				|  |  |          ></upload> -->
 | 
	
		
			
				|  |  | -        <image-cropper :options="cropperOptions" bucket_name='cloud-coach' :imgSize="2" :imageUrl="form.coverImg" showSize @crop-upload-success="cropSuccess" />
 | 
	
		
			
				|  |  | -        <p style="color: red">
 | 
	
		
			
				|  |  | -          大小2M以内,格式为jpg、png、gif图片
 | 
	
		
			
				|  |  | -        </p>
 | 
	
		
			
				|  |  | +        <image-cropper
 | 
	
		
			
				|  |  | +          :options="cropperOptions"
 | 
	
		
			
				|  |  | +          bucket_name="cloud-coach"
 | 
	
		
			
				|  |  | +          :imgSize="2"
 | 
	
		
			
				|  |  | +          :imageUrl="form.coverImg"
 | 
	
		
			
				|  |  | +          showSize
 | 
	
		
			
				|  |  | +          @crop-upload-success="cropSuccess"
 | 
	
		
			
				|  |  | +        />
 | 
	
		
			
				|  |  | +        <p style="color: red">大小2M以内,格式为jpg、png、gif图片</p>
 | 
	
		
			
				|  |  |        </el-form-item>
 | 
	
		
			
				|  |  |      </el-form>
 | 
	
		
			
				|  |  |      <span slot="footer" class="dialog-footer">
 | 
	
	
		
			
				|  | @@ -71,17 +81,13 @@
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  |  import Upload from "@/components/Upload/index";
 | 
	
		
			
				|  |  | -import ImageCropper from '@/components/ImageCropper'
 | 
	
		
			
				|  |  | -import {
 | 
	
		
			
				|  |  | -  addsysMusicScore,
 | 
	
		
			
				|  |  | -  getSysMusicScoreDetail,
 | 
	
		
			
				|  |  | -  resetsysMusicScore,
 | 
	
		
			
				|  |  | -} from "../api";
 | 
	
		
			
				|  |  | +import ImageCropper from "@/components/ImageCropper";
 | 
	
		
			
				|  |  | +import { addsysMusicScore, getSysMusicScoreDetail, resetsysMusicScore } from "../api";
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |    props: ["type", "activeRow"],
 | 
	
		
			
				|  |  |    components: {
 | 
	
		
			
				|  |  |      Upload,
 | 
	
		
			
				|  |  | -    ImageCropper
 | 
	
		
			
				|  |  | +    ImageCropper,
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
	
		
			
				|  | @@ -109,7 +115,7 @@ export default {
 | 
	
		
			
				|  |  |          previewsCircle: false, //预览图是否是圆形
 | 
	
		
			
				|  |  |          full: true, // 是否输出原图比例的截图
 | 
	
		
			
				|  |  |          enlarge: 2,
 | 
	
		
			
				|  |  | -        title: '教材封面图', //模态框上显示的标题
 | 
	
		
			
				|  |  | +        title: "教材封面图", //模态框上显示的标题
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
	
		
			
				|  | @@ -117,21 +123,23 @@ export default {
 | 
	
		
			
				|  |  |      await this.$store.dispatch("setBranchs");
 | 
	
		
			
				|  |  |      if (this.activeRow?.id) {
 | 
	
		
			
				|  |  |        // 判断是否是根元素处理
 | 
	
		
			
				|  |  | -      if(this.activeRow?.parentId != 0 || this.type == 'create' ) {
 | 
	
		
			
				|  |  | +      if (this.activeRow?.parentId != 0 || this.type == "create") {
 | 
	
		
			
				|  |  |          // this.imageWidthM = 210
 | 
	
		
			
				|  |  |          // this.imageHeightM = 268
 | 
	
		
			
				|  |  | -        this.cropperOptions.autoCropWidth = 210
 | 
	
		
			
				|  |  | -        this.cropperOptions.autoCropHeight = 268
 | 
	
		
			
				|  |  | +        this.cropperOptions.autoCropWidth = 210;
 | 
	
		
			
				|  |  | +        this.cropperOptions.autoCropHeight = 268;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -      console.log(this.activeRow, 'level')
 | 
	
		
			
				|  |  | -      this.level = this.activeRow?.level || 0
 | 
	
		
			
				|  |  | +      console.log(this.activeRow, "level");
 | 
	
		
			
				|  |  | +      this.level = this.activeRow?.level || 0;
 | 
	
		
			
				|  |  |        try {
 | 
	
		
			
				|  |  |          const res = await getSysMusicScoreDetail({ id: this.activeRow.id });
 | 
	
		
			
				|  |  | -        if(this.type == 'create') { // 添加一级分类或子级
 | 
	
		
			
				|  |  | +        if (this.type == "create") {
 | 
	
		
			
				|  |  | +          // 添加一级分类或子级
 | 
	
		
			
				|  |  |            this.form.organId = res.data.organId.split(",").map((item) => {
 | 
	
		
			
				|  |  |              return Number(item);
 | 
	
		
			
				|  |  |            });
 | 
	
		
			
				|  |  | -        } else if(this.type == 'update') { // 修改分类
 | 
	
		
			
				|  |  | +        } else if (this.type == "update") {
 | 
	
		
			
				|  |  | +          // 修改分类
 | 
	
		
			
				|  |  |            this.form.name = res.data.name;
 | 
	
		
			
				|  |  |            this.form.organId = res.data.organId.split(",").map((item) => {
 | 
	
		
			
				|  |  |              return Number(item);
 | 
	
	
		
			
				|  | @@ -146,11 +154,10 @@ export default {
 | 
	
		
			
				|  |  |      formatParentId(id, list, ids = []) {
 | 
	
		
			
				|  |  |        for (const item of list) {
 | 
	
		
			
				|  |  |          if (item.sysMusicScoreCategoriesList) {
 | 
	
		
			
				|  |  | -          const cIds = this.formatParentId(
 | 
	
		
			
				|  |  | -            id,
 | 
	
		
			
				|  |  | -            item.sysMusicScoreCategoriesList,
 | 
	
		
			
				|  |  | -            [...ids, item.id]
 | 
	
		
			
				|  |  | -          );
 | 
	
		
			
				|  |  | +          const cIds = this.formatParentId(id, item.sysMusicScoreCategoriesList, [
 | 
	
		
			
				|  |  | +            ...ids,
 | 
	
		
			
				|  |  | +            item.id,
 | 
	
		
			
				|  |  | +          ]);
 | 
	
		
			
				|  |  |            if (cIds.includes(id)) {
 | 
	
		
			
				|  |  |              return cIds;
 | 
	
		
			
				|  |  |            }
 | 
	
	
		
			
				|  | @@ -165,11 +172,11 @@ export default {
 | 
	
		
			
				|  |  |        this.$refs.form.validate(async (flag) => {
 | 
	
		
			
				|  |  |          if (flag) {
 | 
	
		
			
				|  |  |            let { organId, ...rest } = this.form;
 | 
	
		
			
				|  |  | -          let parentId = 0
 | 
	
		
			
				|  |  | -          if(this.type == 'create') {
 | 
	
		
			
				|  |  | -            parentId = this.activeRow?.id || 0
 | 
	
		
			
				|  |  | -          } else if(this.type == 'update') {
 | 
	
		
			
				|  |  | -            parentId = this.activeRow?.parentId || 0
 | 
	
		
			
				|  |  | +          let parentId = 0;
 | 
	
		
			
				|  |  | +          if (this.type == "create") {
 | 
	
		
			
				|  |  | +            parentId = this.activeRow?.id || 0;
 | 
	
		
			
				|  |  | +          } else if (this.type == "update") {
 | 
	
		
			
				|  |  | +            parentId = this.activeRow?.parentId || 0;
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |            let obj = {
 | 
	
		
			
				|  |  |              ...rest,
 | 
	
	
		
			
				|  | @@ -177,7 +184,7 @@ export default {
 | 
	
		
			
				|  |  |              organId: organId.join(","),
 | 
	
		
			
				|  |  |            };
 | 
	
		
			
				|  |  |            try {
 | 
	
		
			
				|  |  | -            if (this.type == 'update') {
 | 
	
		
			
				|  |  | +            if (this.type == "update") {
 | 
	
		
			
				|  |  |                obj.id = this.activeRow?.id;
 | 
	
		
			
				|  |  |                await resetsysMusicScore(obj);
 | 
	
		
			
				|  |  |                this.$message.success("修改成功");
 | 
	
	
		
			
				|  | @@ -200,13 +207,13 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      //上传操作结束
 | 
	
		
			
				|  |  |      cropClose() {
 | 
	
		
			
				|  |  | -      console.log('上传操作结束')
 | 
	
		
			
				|  |  | +      console.log("上传操作结束");
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      //上传图片成功
 | 
	
		
			
				|  |  |      cropSuccess(data) {
 | 
	
		
			
				|  |  |        // this.imgUrl = data.data.avatar
 | 
	
		
			
				|  |  |        this.form.coverImg = data.data.url;
 | 
	
		
			
				|  |  | -      console.log(this.form.coverImg)
 | 
	
		
			
				|  |  | +      console.log(this.form.coverImg);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    computed: {},
 |