|
@@ -39,7 +39,7 @@
|
|
<el-table-column label="操作" align="center">
|
|
<el-table-column label="操作" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<Audio :src="scope.row.progaramUrl" />
|
|
<Audio :src="scope.row.progaramUrl" />
|
|
- <el-button type="delete" :disabled="disabled">删除</el-button>
|
|
|
|
|
|
+ <el-button type="delete" :disabled="disabled" @click="getDelete(scope.$index)">删除</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -75,7 +75,10 @@
|
|
<el-table-column label="播放时长" prop="playTime" align="center" />
|
|
<el-table-column label="播放时长" prop="playTime" align="center" />
|
|
<el-table-column label="操作" align="center">
|
|
<el-table-column label="操作" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-button type="text" @click="getChecked(scope.row)">选择</el-button>
|
|
|
|
|
|
+ <el-button type="text" @click="getChecked(scope.row)"
|
|
|
|
+ :disabled="form.programList.findIndex(i => i.id === scope.row.id) === -1 ? false : true">
|
|
|
|
+ 选择
|
|
|
|
+ </el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -108,8 +111,6 @@ export default {
|
|
status: 1,
|
|
status: 1,
|
|
type: 2
|
|
type: 2
|
|
},
|
|
},
|
|
- // 添加的歌曲Id
|
|
|
|
- ids: [],
|
|
|
|
// 校验
|
|
// 校验
|
|
rules: {
|
|
rules: {
|
|
name: [{
|
|
name: [{
|
|
@@ -164,9 +165,6 @@ export default {
|
|
detail(this.form.id).then(res => {
|
|
detail(this.form.id).then(res => {
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
this.form = res.data
|
|
this.form = res.data
|
|
- res.data.programList.map(i => {
|
|
|
|
- this.ids.push(i.id)
|
|
|
|
- })
|
|
|
|
this.form_loading = false
|
|
this.form_loading = false
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -211,33 +209,41 @@ export default {
|
|
|
|
|
|
// 选择
|
|
// 选择
|
|
getChecked(row) {
|
|
getChecked(row) {
|
|
- if (this.form.programList.findIndex(i => i.id === row.id) === -1) {
|
|
|
|
- this.form.programList.push({
|
|
|
|
- id: row.id,
|
|
|
|
- name: row.name,
|
|
|
|
- singerName: row.singerName,
|
|
|
|
- playTime: row.playTime,
|
|
|
|
- status: row.status,
|
|
|
|
- progaramUrl: row.progaramUrl
|
|
|
|
- })
|
|
|
|
- this.ids.push(row.id)
|
|
|
|
- this.$message.success('添加成功!')
|
|
|
|
- } else {
|
|
|
|
- this.$message.error('您已添加过该歌曲!')
|
|
|
|
- }
|
|
|
|
|
|
+ this.form.programList.push({
|
|
|
|
+ id: row.id,
|
|
|
|
+ name: row.name,
|
|
|
|
+ singerName: row.singerName,
|
|
|
|
+ playTime: row.playTime,
|
|
|
|
+ status: row.status,
|
|
|
|
+ progaramUrl: row.progaramUrl
|
|
|
|
+ })
|
|
|
|
+ this.$message.success('添加成功!')
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 删除已选歌曲
|
|
|
|
+ getDelete(index) {
|
|
|
|
+ this.form.programList.splice(index, 1)
|
|
},
|
|
},
|
|
|
|
|
|
// 确定
|
|
// 确定
|
|
getSubmit() {
|
|
getSubmit() {
|
|
this.$refs.form.validate((valid) => {
|
|
this.$refs.form.validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ let arr = []
|
|
|
|
+ this.form.programList.map(i => {
|
|
|
|
+ arr.push(i.id)
|
|
|
|
+ })
|
|
|
|
+ this.form.programList = arr
|
|
this.form_loading = true
|
|
this.form_loading = true
|
|
- this.form.programList = this.ids
|
|
|
|
let title = this.form.id ? '编辑成功!' : '新增成功!'
|
|
let title = this.form.id ? '编辑成功!' : '新增成功!'
|
|
submit(this.form).then(res => {
|
|
submit(this.form).then(res => {
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
this.$message.success(`${title}`)
|
|
this.$message.success(`${title}`)
|
|
- this.cancel()
|
|
|
|
|
|
+ if (this.form.id) {
|
|
|
|
+ this.getDetail()
|
|
|
|
+ } else {
|
|
|
|
+ this.cancel()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|