|
@@ -2,13 +2,13 @@
|
|
<div class="app-container">
|
|
<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('新增')">
|
|
- 新增频道
|
|
|
|
|
|
+ 新增规则
|
|
</el-button>
|
|
</el-button>
|
|
<!-- 列表 -->
|
|
<!-- 列表 -->
|
|
<el-table :data="tableData" v-loading="loading">
|
|
<el-table :data="tableData" v-loading="loading">
|
|
- <el-table-column label="频道名称" align="center" />
|
|
|
|
- <el-table-column label="部署形式" align="center" />
|
|
|
|
- <el-table-column label="设备" align="center" />
|
|
|
|
|
|
+ <el-table-column label="规则名称" prop="name" align="center" />
|
|
|
|
+ <el-table-column label="部署形式" prop="type" align="center" :formatter="typeFormatter" />
|
|
|
|
+ <el-table-column label="设备" prop="deviceIds" 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="getDialog('编辑', scope.row.id)">编辑</el-button>
|
|
<el-button type="text" @click="getDialog('编辑', scope.row.id)">编辑</el-button>
|
|
@@ -19,11 +19,11 @@
|
|
<el-dialog :visible.sync="dialogVisible" :title="title" width="950px">
|
|
<el-dialog :visible.sync="dialogVisible" :title="title" width="950px">
|
|
<el-form label-width="100px">
|
|
<el-form label-width="100px">
|
|
<el-form-item label="规则名称:" style="width: 300px">
|
|
<el-form-item label="规则名称:" style="width: 300px">
|
|
- <el-input placeholder="请输入规则名称" />
|
|
|
|
|
|
+ <el-input v-model="dialogForm.name" placeholder="请输入规则名称" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="关联设备:">
|
|
<el-form-item label="关联设备:">
|
|
- <el-select placeholder="请选择关联设备">
|
|
|
|
- <el-option />
|
|
|
|
|
|
+ <el-select v-model="dialogForm.deviceIds" multiple placeholder="请选择关联设备">
|
|
|
|
+ <el-option v-for="item in devOptions" :key="item.name" :value="item.clientTypeId" :label="item.name" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item v-if="title === '编辑'" label="内容列表:">
|
|
<el-form-item v-if="title === '编辑'" label="内容列表:">
|
|
@@ -46,34 +46,58 @@
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer">
|
|
<div slot="footer">
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
- <el-button type="primary">确定</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="getSubmit">确定</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { getChannelPage } from '@/api/channel/custom'
|
|
|
|
|
|
+import { channelPage, page, create } from '@/api/channel/custom'
|
|
|
|
+import { devList } from '@/api/device/list'
|
|
export default {
|
|
export default {
|
|
|
|
+ dicts: ['deployment_form'],
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
// 遮罩层
|
|
// 遮罩层
|
|
loading: false,
|
|
loading: false,
|
|
dialog_loading: false,
|
|
dialog_loading: false,
|
|
// 列表
|
|
// 列表
|
|
- tableData: [{
|
|
|
|
- value: 1
|
|
|
|
- }],
|
|
|
|
|
|
+ tableData: [],
|
|
list: [],
|
|
list: [],
|
|
// 弹窗
|
|
// 弹窗
|
|
dialogVisible: false,
|
|
dialogVisible: false,
|
|
- title: ''
|
|
|
|
|
|
+ title: '',
|
|
|
|
+ // 表单
|
|
|
|
+ form: {
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 10
|
|
|
|
+ },
|
|
|
|
+ // 关联设备列表
|
|
|
|
+ devOptions: [],
|
|
|
|
+ dialogForm: {}
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
-
|
|
|
|
|
|
+ devList().then(res => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ this.devOptions = res.data
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.getList()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 列表
|
|
|
|
+ getList() {
|
|
|
|
+ page(this.form).then(res => {
|
|
|
|
+ console.log(res);
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ this.tableData = res.data
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 编辑
|
|
edit(row) {
|
|
edit(row) {
|
|
this.$router.push({
|
|
this.$router.push({
|
|
path: `/channel/custom/detail`,
|
|
path: `/channel/custom/detail`,
|
|
@@ -82,16 +106,34 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ // 弹窗
|
|
getDialog(key, id) {
|
|
getDialog(key, id) {
|
|
this.dialogVisible = true
|
|
this.dialogVisible = true
|
|
this.title = key
|
|
this.title = key
|
|
this.dialog_loading = true
|
|
this.dialog_loading = true
|
|
- getChannelPage().then(res => {
|
|
|
|
|
|
+ channelPage().then(res => {
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
this.list = res.data
|
|
this.list = res.data
|
|
this.dialog_loading = false
|
|
this.dialog_loading = false
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 创建
|
|
|
|
+ getSubmit() {
|
|
|
|
+ let ids = this.dialogForm.deviceIds.join(',')
|
|
|
|
+ create({
|
|
|
|
+ name: this.dialogForm.name,
|
|
|
|
+ deviceIds: ids
|
|
|
|
+ }).then(res => {
|
|
|
|
+ console.log(res);
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 字典翻译
|
|
|
|
+ typeFormatter(row) {
|
|
|
|
+ return this.selectDictLabel(this.dict.type.deployment_form, row.type)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
};
|
|
};
|