|
@@ -102,11 +102,13 @@
|
|
|
accordion
|
|
|
ref="tree"
|
|
|
:props="treeProps"
|
|
|
- :allow-drop="allowDrop"
|
|
|
+ :allow-drop="allowDrop"
|
|
|
>
|
|
|
>
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }">
|
|
|
- <span :class="node.level == 1?'title':''">{{ node.label }}</span>
|
|
|
+ <span :class="node.level == 1 ? 'title' : ''">{{
|
|
|
+ node.label
|
|
|
+ }}</span>
|
|
|
<span>
|
|
|
<i class="el-icon-edit" @click="() => editItem(data)"></i>
|
|
|
<i
|
|
@@ -127,7 +129,11 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import Upload from "@/components/Upload/index";
|
|
|
-import { addsysMusicScore, getSysMusicScoreDetail,resetsysMusicScore } from "../api";
|
|
|
+import {
|
|
|
+ addsysMusicScore,
|
|
|
+ getSysMusicScoreDetail,
|
|
|
+ resetsysMusicScore,
|
|
|
+} from "../api";
|
|
|
export default {
|
|
|
props: ["activeRow"],
|
|
|
components: {
|
|
@@ -140,6 +146,7 @@ export default {
|
|
|
name: null,
|
|
|
coverImg: "",
|
|
|
sysMusicScoreCategoriesList: [],
|
|
|
+ delCategoriesIds: [],
|
|
|
},
|
|
|
index: 0,
|
|
|
treeProps: {
|
|
@@ -167,10 +174,8 @@ export default {
|
|
|
methods: {
|
|
|
// 递归遍历数组
|
|
|
recursionDate(arr) {
|
|
|
-
|
|
|
// 这里来了
|
|
|
if (arr.length > 0) {
|
|
|
-
|
|
|
let newArr = [];
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
let obj = {
|
|
@@ -219,8 +224,13 @@ export default {
|
|
|
removeItem(node, data) {
|
|
|
const parent = node.parent;
|
|
|
const children = parent.data.sysMusicScoreCategoriesList || parent.data;
|
|
|
- const index = children.findIndex((d) => d.id === data.id);
|
|
|
+
|
|
|
+ const index = children.findIndex((d) => {
|
|
|
+ this.form.delCategoriesIds.push(data.id)
|
|
|
+ return d.id === data.id;
|
|
|
+ });
|
|
|
children.splice(index, 1);
|
|
|
+ this.form.delCategoriesIds=[... new Set(this.form.delCategoriesIds)]
|
|
|
},
|
|
|
editItem(data) {
|
|
|
this.$prompt("请输入修改的教材曲目名称", "提示", {
|
|
@@ -258,25 +268,27 @@ export default {
|
|
|
addSubmit() {
|
|
|
this.$refs.form.validate(async (flag) => {
|
|
|
if (flag) {
|
|
|
- let { organId, ...rest } = this.form;
|
|
|
+ let { organId,delCategoriesIds, ...rest } = this.form;
|
|
|
let obj = {
|
|
|
...rest,
|
|
|
organId: organId.join(","),
|
|
|
+ delCategoriesIds:delCategoriesIds.join(',')
|
|
|
};
|
|
|
try {
|
|
|
- if( this.activeRow?.id){
|
|
|
- obj.id = this.activeRow.id
|
|
|
- const resut = await resetsysMusicScore(obj)
|
|
|
- this.$message.success('修改成功')
|
|
|
- }else{
|
|
|
- const resut = await addsysMusicScore(obj);
|
|
|
- this.$message.success('添加成功')
|
|
|
- this.$emit("getList");
|
|
|
- this.$emit("close");
|
|
|
+ if (this.activeRow?.id) {
|
|
|
+ obj.id = this.activeRow.id;
|
|
|
+ const resut = await resetsysMusicScore(obj);
|
|
|
+ this.$message.success("修改成功");
|
|
|
+ this.$emit("getList");
|
|
|
+ this.$emit("close");
|
|
|
+ } else {
|
|
|
+ const resut = await addsysMusicScore(obj);
|
|
|
+ this.$message.success("添加成功");
|
|
|
+ this.$emit("getList");
|
|
|
+ this.$emit("close");
|
|
|
}
|
|
|
-
|
|
|
} catch (e) {
|
|
|
- console.log(e)
|
|
|
+ console.log(e);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -284,13 +296,13 @@ export default {
|
|
|
uploadImg() {
|
|
|
this.$refs.uploadImg.$refs.upload.submit();
|
|
|
},
|
|
|
- allowDrop(draggingNode, dropNode, type){
|
|
|
- if(dropNode.level == 1){
|
|
|
- return true
|
|
|
- }else{
|
|
|
- return false
|
|
|
+ allowDrop(draggingNode, dropNode, type) {
|
|
|
+ if (dropNode.level == 1) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
computed: {},
|
|
|
};
|