|
@@ -1,44 +1,104 @@
|
|
|
|
+<!-- 音频管理 资源平台 -->
|
|
<template>
|
|
<template>
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="getDialog()"
|
|
|
|
- v-hasPermi="['music:platform:add']">新增</el-button>
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ icon="el-icon-plus"
|
|
|
|
+ size="mini"
|
|
|
|
+ @click="getDialog()"
|
|
|
|
+ v-hasPermi="['music:platform:add']"
|
|
|
|
+ >新增</el-button
|
|
|
|
+ >
|
|
<!-- 列表 -->
|
|
<!-- 列表 -->
|
|
<el-table :data="tableData" v-loading="loading">
|
|
<el-table :data="tableData" v-loading="loading">
|
|
<el-table-column type="index" label="序号" align="center" />
|
|
<el-table-column type="index" label="序号" align="center" />
|
|
<el-table-column label="资源平台" prop="name" align="center" />
|
|
<el-table-column label="资源平台" prop="name" align="center" />
|
|
- <el-table-column label="音频类型" prop="audioType" align="center" :formatter="audioFormatter" />
|
|
|
|
- <el-table-column label="对接方式" prop="joinType" align="center" :formatter="joinTypeFormatter" />
|
|
|
|
|
|
+ <el-table-column
|
|
|
|
+ label="音频类型"
|
|
|
|
+ prop="audioType"
|
|
|
|
+ align="center"
|
|
|
|
+ :formatter="audioFormatter"
|
|
|
|
+ />
|
|
|
|
+ <el-table-column
|
|
|
|
+ label="对接方式"
|
|
|
|
+ prop="joinType"
|
|
|
|
+ align="center"
|
|
|
|
+ :formatter="joinTypeFormatter"
|
|
|
|
+ />
|
|
<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="getDialog(scope.row.id)" v-hasPermi="['music:platform:edit']">编辑
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="text"
|
|
|
|
+ @click="getDialog(scope.row.id)"
|
|
|
|
+ v-hasPermi="['music:platform:edit']"
|
|
|
|
+ >编辑
|
|
</el-button>
|
|
</el-button>
|
|
- <el-button type="delete" @click="getDelete(scope.row)" v-hasPermi="['music:platform:delete']">删除
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="delete"
|
|
|
|
+ @click="getDelete(scope.row)"
|
|
|
|
+ v-hasPermi="['music:platform:delete']"
|
|
|
|
+ >删除
|
|
</el-button>
|
|
</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
- <pagination v-show="total>0" :total="total" :page.sync="form.pageNum" :limit.sync="form.pageSize"
|
|
|
|
- @pagination="getList" />
|
|
|
|
|
|
+ <pagination
|
|
|
|
+ v-show="total > 0"
|
|
|
|
+ :total="total"
|
|
|
|
+ :page.sync="form.pageNum"
|
|
|
|
+ :limit.sync="form.pageSize"
|
|
|
|
+ @pagination="getList"
|
|
|
|
+ />
|
|
|
|
|
|
<!-- 弹窗 -->
|
|
<!-- 弹窗 -->
|
|
- <el-dialog :visible.sync="dialogVisible" :title="title" width="500px" :before-close="cancel">
|
|
|
|
- <el-form :model="dialogForm" :rules="rules" ref="dialogForm" label-width="100px">
|
|
|
|
|
|
+ <el-dialog
|
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
|
+ :title="title"
|
|
|
|
+ width="500px"
|
|
|
|
+ :before-close="cancel"
|
|
|
|
+ >
|
|
|
|
+ <el-form
|
|
|
|
+ :model="dialogForm"
|
|
|
|
+ :rules="rules"
|
|
|
|
+ ref="dialogForm"
|
|
|
|
+ label-width="100px"
|
|
|
|
+ >
|
|
<el-form-item label="资源平台:" prop="name">
|
|
<el-form-item label="资源平台:" prop="name">
|
|
- <el-input v-model="dialogForm.name" placeholder="请输入资源平台名称" />
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="dialogForm.name"
|
|
|
|
+ placeholder="请输入资源平台名称"
|
|
|
|
+ />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="音频类型:" prop="audioType">
|
|
<el-form-item label="音频类型:" prop="audioType">
|
|
- <el-select v-model="dialogForm.audioType" multiple placeholder="请选择音频类型">
|
|
|
|
- <el-option v-for="item in audioOptions" :key="item.value" :value="item.value.toString()"
|
|
|
|
- :label="item.label" />
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="dialogForm.audioType"
|
|
|
|
+ multiple
|
|
|
|
+ placeholder="请选择音频类型"
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in audioOptions"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :value="item.value.toString()"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="对接方式:" prop="joinType">
|
|
<el-form-item label="对接方式:" prop="joinType">
|
|
- <el-select v-model="dialogForm.joinType" multiple placeholder="请选择资源对接方式">
|
|
|
|
- <el-option v-for="item in joinTypeOptions" :key="item.value" :value="item.value.toString()"
|
|
|
|
- :label="item.label" :disabled="item.disabled" />
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="dialogForm.joinType"
|
|
|
|
+ multiple
|
|
|
|
+ placeholder="请选择资源对接方式"
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in joinTypeOptions"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :value="item.value.toString()"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :disabled="item.disabled"
|
|
|
|
+ />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item style="text-align: right;">
|
|
|
|
|
|
+ <el-form-item style="text-align: right">
|
|
<el-button @click="cancel">取消</el-button>
|
|
<el-button @click="cancel">取消</el-button>
|
|
<el-button type="primary" @click="getSubmit">确定</el-button>
|
|
<el-button type="primary" @click="getSubmit">确定</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -48,8 +108,9 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { list, submit, detail, remove } from '@/api/music/platform'
|
|
|
|
-import { audioMixin } from '@/mixin/index'
|
|
|
|
|
|
+import { detail, list, remove, submit } from "@/api/music/platform";
|
|
|
|
+import { audioMixin } from "@/mixin/index";
|
|
|
|
+import { dialogCallBack } from "@/utils/DialogUtil";
|
|
export default {
|
|
export default {
|
|
mixins: [audioMixin],
|
|
mixins: [audioMixin],
|
|
data() {
|
|
data() {
|
|
@@ -59,7 +120,7 @@ export default {
|
|
// 列表表单
|
|
// 列表表单
|
|
form: {
|
|
form: {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
- pageSize: 10
|
|
|
|
|
|
+ pageSize: 10,
|
|
},
|
|
},
|
|
// 总数
|
|
// 总数
|
|
total: 0,
|
|
total: 0,
|
|
@@ -67,82 +128,103 @@ export default {
|
|
tableData: [],
|
|
tableData: [],
|
|
// 弹窗
|
|
// 弹窗
|
|
dialogVisible: false,
|
|
dialogVisible: false,
|
|
- title: '',
|
|
|
|
|
|
+ title: "",
|
|
// 提交表单
|
|
// 提交表单
|
|
dialogForm: {
|
|
dialogForm: {
|
|
- name: '',
|
|
|
|
|
|
+ name: "",
|
|
audioType: [],
|
|
audioType: [],
|
|
- joinType: []
|
|
|
|
|
|
+ joinType: [],
|
|
},
|
|
},
|
|
// 校验
|
|
// 校验
|
|
rules: {
|
|
rules: {
|
|
- name: [{
|
|
|
|
- required: true, message: '请输入资源平台名称', trigger: 'blur'
|
|
|
|
- }, {
|
|
|
|
- max: 20, message: '名称不得超过20个字符', trigger: 'blur'
|
|
|
|
- }],
|
|
|
|
- audioType: [{
|
|
|
|
- required: true, message: '请选择音频类型', trigger: 'change'
|
|
|
|
- }],
|
|
|
|
- joinType: [{
|
|
|
|
- required: true, message: '请选择资源对接方式', trigger: 'change'
|
|
|
|
- }]
|
|
|
|
|
|
+ name: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请输入资源平台名称",
|
|
|
|
+ trigger: "blur",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ max: 20,
|
|
|
|
+ message: "名称不得超过20个字符",
|
|
|
|
+ trigger: "blur",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ audioType: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请选择音频类型",
|
|
|
|
+ trigger: "change",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ joinType: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请选择资源对接方式",
|
|
|
|
+ trigger: "change",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
},
|
|
},
|
|
// 对接方式
|
|
// 对接方式
|
|
- joinTypeOptions: [{
|
|
|
|
- value: 1,
|
|
|
|
- label: 'API接口'
|
|
|
|
- }, {
|
|
|
|
- value: 2,
|
|
|
|
- label: '本地管理'
|
|
|
|
- }, {
|
|
|
|
- value: 3,
|
|
|
|
- label: '小程序'
|
|
|
|
- }]
|
|
|
|
- }
|
|
|
|
|
|
+ joinTypeOptions: [
|
|
|
|
+ {
|
|
|
|
+ value: 1,
|
|
|
|
+ label: "API接口",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ value: 2,
|
|
|
|
+ label: "本地管理",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ value: 3,
|
|
|
|
+ label: "小程序",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ };
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
- 'dialogForm.joinType'(val) {
|
|
|
|
|
|
+ "dialogForm.joinType"(val) {
|
|
if (val) {
|
|
if (val) {
|
|
- this.joinTypeOptions[1].disabled = val.findIndex(i => i === '1') !== -1 ? true : false
|
|
|
|
- this.joinTypeOptions[0].disabled = val.findIndex(i => i === '2') !== -1 ? true : false
|
|
|
|
|
|
+ this.joinTypeOptions[1].disabled =
|
|
|
|
+ val.findIndex((i) => i === "1") !== -1 ? true : false;
|
|
|
|
+ this.joinTypeOptions[0].disabled =
|
|
|
|
+ val.findIndex((i) => i === "2") !== -1 ? true : false;
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- this.getList()
|
|
|
|
|
|
+ this.getList();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// 列表
|
|
// 列表
|
|
getList() {
|
|
getList() {
|
|
- this.loading = true
|
|
|
|
- list(this.form).then(res => {
|
|
|
|
|
|
+ this.loading = true;
|
|
|
|
+ list(this.form).then((res) => {
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
- this.tableData = res.data.records
|
|
|
|
- this.total = res.data.total
|
|
|
|
- this.loading = false
|
|
|
|
|
|
+ this.tableData = res.data.records;
|
|
|
|
+ this.total = res.data.total;
|
|
|
|
+ this.loading = false;
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 弹窗
|
|
// 弹窗
|
|
getDialog(id) {
|
|
getDialog(id) {
|
|
- this.dialogVisible = true
|
|
|
|
- this.title = id ? '编辑' : '新增'
|
|
|
|
|
|
+ this.dialogVisible = true;
|
|
|
|
+ this.title = id ? "编辑" : "新增";
|
|
if (id) {
|
|
if (id) {
|
|
- detail(id).then(res => {
|
|
|
|
|
|
+ detail(id).then((res) => {
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
- this.dialogForm = res.data
|
|
|
|
- this.dialogForm.audioType = res.data.audioType.split(',')
|
|
|
|
- this.dialogForm.joinType = res.data.joinType.split(',')
|
|
|
|
|
|
+ this.dialogForm = res.data;
|
|
|
|
+ this.dialogForm.audioType = res.data.audioType.split(",");
|
|
|
|
+ this.dialogForm.joinType = res.data.joinType.split(",");
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
// 取消
|
|
// 取消
|
|
cancel() {
|
|
cancel() {
|
|
- this.dialogVisible = false
|
|
|
|
- this.dialogForm = {}
|
|
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
+ this.dialogForm = {};
|
|
this.$refs.dialogForm.resetFields();
|
|
this.$refs.dialogForm.resetFields();
|
|
},
|
|
},
|
|
|
|
|
|
@@ -150,44 +232,64 @@ export default {
|
|
getSubmit() {
|
|
getSubmit() {
|
|
this.$refs.dialogForm.validate((valid) => {
|
|
this.$refs.dialogForm.validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- this.dialogForm.audioType = this.dialogForm.audioType.join(',')
|
|
|
|
- this.dialogForm.joinType = this.dialogForm.joinType.join(',')
|
|
|
|
- submit(this.dialogForm).then(res => {
|
|
|
|
- if (res.code === 0) {
|
|
|
|
- this.$message.success(`${this.title}成功!`)
|
|
|
|
- this.dialogVisible = false
|
|
|
|
- this.getList()
|
|
|
|
- }
|
|
|
|
- }).catch(() => {
|
|
|
|
- this.dialogForm.id ? this.dialogVisible = false : this.$refs.dialogForm.resetFields()
|
|
|
|
- })
|
|
|
|
|
|
+ this.dialogForm.audioType = this.dialogForm.audioType.join(",");
|
|
|
|
+ this.dialogForm.joinType = this.dialogForm.joinType.join(",");
|
|
|
|
+ submit(this.dialogForm)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ this.$message.success(`${this.title}成功!`);
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
+ this.getList();
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.dialogForm.id
|
|
|
|
+ ? (this.dialogVisible = false)
|
|
|
|
+ : this.$refs.dialogForm.resetFields();
|
|
|
|
+ });
|
|
} else {
|
|
} else {
|
|
- return false
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
},
|
|
},
|
|
|
|
|
|
// 删除
|
|
// 删除
|
|
getDelete(row) {
|
|
getDelete(row) {
|
|
- this.$confirm(`是否要删除${row.name}?`, '警告', {
|
|
|
|
- type: 'warning'
|
|
|
|
- }).then(() => {
|
|
|
|
- remove(row.id).then(res => {
|
|
|
|
- if (res.code === 0) {
|
|
|
|
- this.$message.success('删除成功')
|
|
|
|
- this.getList()
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }).catch(() => { })
|
|
|
|
|
|
+ var that = this;
|
|
|
|
+ dialogCallBack(that, function () {
|
|
|
|
+ that
|
|
|
|
+ .$confirm(`是否删除${row.name}?`, "提示:", {
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ remove(row.id).then((res) => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ that.$message.success("删除成功");
|
|
|
|
+ that.getList();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
|
|
+ });
|
|
},
|
|
},
|
|
|
|
|
|
// 字典翻译
|
|
// 字典翻译
|
|
audioFormatter(row) {
|
|
audioFormatter(row) {
|
|
- return row.audioType ? row.audioType.split(',').map(i => this.selectDictLabel(this.audioOptions, i)).join(',') : '/'
|
|
|
|
|
|
+ return row.audioType
|
|
|
|
+ ? row.audioType
|
|
|
|
+ .split(",")
|
|
|
|
+ .map((i) => this.selectDictLabel(this.audioOptions, i))
|
|
|
|
+ .join(",")
|
|
|
|
+ : "/";
|
|
},
|
|
},
|
|
joinTypeFormatter(row) {
|
|
joinTypeFormatter(row) {
|
|
- return row.joinType ? row.joinType.split(',').map(i => this.selectDictLabel(this.joinTypeOptions, i)).join(',') : '/'
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ return row.joinType
|
|
|
|
+ ? row.joinType
|
|
|
|
+ .split(",")
|
|
|
|
+ .map((i) => this.selectDictLabel(this.joinTypeOptions, i))
|
|
|
|
+ .join(",")
|
|
|
|
+ : "/";
|
|
|
|
+ },
|
|
|
|
+ },
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|