|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<!-- 新增 -->
|
|
|
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="getDialog()"
|
|
|
+ <el-button type="primary" icon="el-icon-plus" size="mini" @click="getDialog('新增')"
|
|
|
v-hasPermi="['operation:channel:add']">
|
|
|
新增频道配置
|
|
|
</el-button>
|
|
@@ -13,7 +13,8 @@
|
|
|
<el-table-column label="设备" prop="deviceIds" align="center" :formatter="devFormatter" show-overflow-tooltip />
|
|
|
<el-table-column label="操作" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" @click="getDialog(scope.row, scope.$index)"
|
|
|
+ <el-button type="text" @click="getDialog('查看', scope.row, scope.$index, true)">查看</el-button>
|
|
|
+ <el-button type="text" @click="getDialog('编辑', scope.row, scope.$index)"
|
|
|
v-hasPermi="['operation:channel:edit']">编辑</el-button>
|
|
|
<el-button v-if="scope.$index !== 0" type="delete" @click="getDelete(scope.row)"
|
|
|
v-hasPermi="['operation:channel:delete']">
|
|
@@ -23,18 +24,18 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<!-- 弹窗 -->
|
|
|
- <el-dialog :visible.sync="dialogVisible" :title="title" width="950px">
|
|
|
+ <el-dialog :visible.sync="dialogVisible" :title="title" width="950px" :before-close="cancel">
|
|
|
<el-form label-width="auto">
|
|
|
<el-form-item v-if="index !== 1" label="频道配置名称:" style="width: 300px">
|
|
|
- <el-input v-model="dialogForm.name" placeholder="请输入规则名称" />
|
|
|
+ <el-input v-model="dialogForm.name" placeholder="请输入规则名称" :disabled="disabled" />
|
|
|
</el-form-item>
|
|
|
<el-form-item v-if="index !== 1" label="关联设备:">
|
|
|
- <el-select v-model="ids" filterable multiple placeholder="请选择关联设备">
|
|
|
+ <el-select v-model="ids" filterable multiple placeholder="请选择关联设备" :disabled="disabled">
|
|
|
<el-option v-for="item in devOptions" :key="item.clientTypeId" :value="item.clientTypeId.toString()"
|
|
|
:label="item.name" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="title === '编辑'" label="内容列表:" style="height: 500px; overflow-y: auto;">
|
|
|
+ <el-form-item v-if="title !== '新增'" label="内容列表:" style="height: 500px; overflow-y: auto;">
|
|
|
<el-table :data="list" v-loading="dialog_loading" lazy :default-sort="{ prop: 'sort' }">
|
|
|
<el-table-column label="序号" prop="sort" align="center" width="100px" />
|
|
|
<el-table-column label="频道数" prop="channelId" align="center" width="100px" />
|
|
@@ -47,11 +48,12 @@
|
|
|
<el-table-column label="频道简介" prop="description" align="center" show-overflow-tooltip />
|
|
|
<el-table-column label="操作" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" @click="edit(scope)">编辑</el-button>
|
|
|
+ <el-button type="text" @click="edit(scope, true)">查看</el-button>
|
|
|
+ <el-button type="text" @click="edit(scope)" :disabled="disabled">编辑</el-button>
|
|
|
<el-button v-if="scope.row.sort > 3" type="text" icon="el-icon-caret-top"
|
|
|
- @click="getChange(scope.row.id, scope.row.sort - 1)" />
|
|
|
+ @click="getChange(scope.row.id, scope.row.sort - 1)" :disabled="disabled" />
|
|
|
<el-button v-if="scope.row.sort > 2 && scope.row.sort < 12" type="text" icon="el-icon-caret-bottom"
|
|
|
- @click="getChange(scope.row.id, scope.row.sort + 1)" />
|
|
|
+ @click="getChange(scope.row.id, scope.row.sort + 1)" :disabled="disabled" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -100,7 +102,9 @@ export default {
|
|
|
}, {
|
|
|
value: 1,
|
|
|
label: '绑定特定设备'
|
|
|
- }]
|
|
|
+ }],
|
|
|
+ // 只读
|
|
|
+ disabled: false
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -140,14 +144,15 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 编辑
|
|
|
- edit(e) {
|
|
|
+ edit(e, boolean) {
|
|
|
this.dialogVisible = false
|
|
|
this.$router.push({
|
|
|
path: `/operation/channel/detail`,
|
|
|
query: {
|
|
|
channelId: e.row.id,
|
|
|
audioType: e.row.channelType,
|
|
|
- index: e.$index
|
|
|
+ index: e.$index,
|
|
|
+ boolean: boolean
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -167,31 +172,28 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 弹窗
|
|
|
- getDialog(row, index) {
|
|
|
+ getDialog(title, row, index, boolean) {
|
|
|
this.dialogVisible = true
|
|
|
+ this.title = title
|
|
|
this.index = index + 1
|
|
|
this.obj = row
|
|
|
+ this.disabled = boolean
|
|
|
// 新增 / 编辑时的设备
|
|
|
devList(0).then(res => {
|
|
|
if (res.code === 0) {
|
|
|
this.devOptions = res.data
|
|
|
- if (this.title === '编辑') {
|
|
|
+ if (this.title !== '新增') {
|
|
|
this.devOptions.unshift.apply(this.devOptions, row.deviceList)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- if (row) {
|
|
|
- this.title = '编辑'
|
|
|
+ if (title !== '新增') {
|
|
|
this.dialogForm = row
|
|
|
if (this.index !== 1) {
|
|
|
this.ids = this.dialogForm.deviceIds.split(',')
|
|
|
}
|
|
|
this.getPage(row)
|
|
|
- } else {
|
|
|
- this.ids = []
|
|
|
- this.dialogForm = {}
|
|
|
- this.title = '新增'
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -246,6 +248,8 @@ export default {
|
|
|
// 取消
|
|
|
cancel() {
|
|
|
this.dialogVisible = false
|
|
|
+ this.ids = []
|
|
|
+ this.dialogForm = {}
|
|
|
this.getList()
|
|
|
},
|
|
|
|