|
@@ -0,0 +1,198 @@
|
|
|
+const mixin = {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 是否推荐
|
|
|
+ recommendOptions: [{
|
|
|
+ value: 0,
|
|
|
+ label: '是'
|
|
|
+ }, {
|
|
|
+ value: 1,
|
|
|
+ label: '否'
|
|
|
+ }],
|
|
|
+ // 当前状态
|
|
|
+ statusOptions: [{
|
|
|
+ value: 1,
|
|
|
+ label: '上架'
|
|
|
+ }, {
|
|
|
+ value: 2,
|
|
|
+ label: '下架'
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const flowPackageMixin = {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 运营商
|
|
|
+ operatorOptions: [{
|
|
|
+ value: 0,
|
|
|
+ label: '移动'
|
|
|
+ }, {
|
|
|
+ value: 1,
|
|
|
+ label: '联通'
|
|
|
+ }, {
|
|
|
+ value: 2,
|
|
|
+ label: '双网双号'
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const musicPackageMixin = {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 资源平台
|
|
|
+ platformOptions: [{
|
|
|
+ value: 1,
|
|
|
+ label: 'QQ音乐'
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+import {
|
|
|
+ list,
|
|
|
+ remove,
|
|
|
+ shelve
|
|
|
+} from '@/api/service/musicPackage'
|
|
|
+const indexMixin = {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: false,
|
|
|
+ // 列表
|
|
|
+ tableData: [],
|
|
|
+ total: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 列表
|
|
|
+ getList() {
|
|
|
+ this.loading = true
|
|
|
+ list(this.form).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.tableData = res.data.records
|
|
|
+ this.total = res.data.total
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 搜索
|
|
|
+ getSearch() {
|
|
|
+ this.form.pageNum = 1
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
+ // 删除
|
|
|
+ getDelete(row) {
|
|
|
+ this.$confirm(`是否删除${row.name}?`, '提示', {
|
|
|
+ 'confirmButtonText': '确定',
|
|
|
+ 'cancelButtonText': '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ remove(row.id).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success('删除成功!')
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+
|
|
|
+ // 下架
|
|
|
+ getChange(row) {
|
|
|
+ this.$confirm(`是否下架${row.name}?`, '提示', {
|
|
|
+ 'confirmButtonText': '确定',
|
|
|
+ 'cancelButtonText': '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ shelve(row.id).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success('下架成功!')
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+
|
|
|
+ // 当前状态
|
|
|
+ statusFormatter(row) {
|
|
|
+ return this.selectDictLabel(this.statusOptions, row.status)
|
|
|
+ },
|
|
|
+ // 是否推荐
|
|
|
+ recommendFormatter(row) {
|
|
|
+ return this.selectDictLabel(this.recommendOptions, row.isRecommend)
|
|
|
+ },
|
|
|
+ // 关联设备
|
|
|
+ devFormatter(row) {
|
|
|
+ return row.deviceIds ? row.deviceIds.split(',').map(i => this.selectDictLabel(this.devOptions, i)).join(',') : ''
|
|
|
+ },
|
|
|
+ },
|
|
|
+}
|
|
|
+
|
|
|
+import {
|
|
|
+ detail,
|
|
|
+ edit,
|
|
|
+ create
|
|
|
+} from '@/api/service/musicPackage'
|
|
|
+const detailMixin = {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 关联设备
|
|
|
+ deviceIds: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ deviceIds(val) {
|
|
|
+ this.form.deviceIds = val.join(',')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ if (this.$route.query.id) {
|
|
|
+ this.form.id = this.$route.query.id
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 详情
|
|
|
+ getList() {
|
|
|
+ detail(this.form.id).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.form = res.data
|
|
|
+ this.deviceIds = res.data.deviceIds.split(',')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 提交
|
|
|
+ getSubmit() {
|
|
|
+ if (this.form.id) {
|
|
|
+ edit(this.form).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success('修改成功!')
|
|
|
+ this.cancel()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ create(this.form).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success('新增成功!')
|
|
|
+ this.cancel()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export {
|
|
|
+ mixin,
|
|
|
+ flowPackageMixin,
|
|
|
+ musicPackageMixin,
|
|
|
+ indexMixin,
|
|
|
+ detailMixin
|
|
|
+}
|