前端页面修改

This commit is contained in:
baiying
2024-07-18 14:07:24 +08:00
parent 6e1cd1eac0
commit 90e9409b7a
7 changed files with 1089 additions and 1222 deletions

View File

@@ -34,10 +34,10 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" <el-button size="small" type="text" style="padding:5px;" icon="el-icon-edit"
@click="handleUpdate(scope.row)" v-hasPermi="['iot:category:query']" @click="handleUpdate(scope.row)" v-hasPermi="['iot:category:query']"
v-if="scope.row.isSys == '0' ? true : !isTenant">修改</el-button> v-if="scope.row.isSys == '0' ? true : !isTenant">修改</el-button>
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" <el-button size="small" type="text" style="padding:5px;" icon="el-icon-delete"
@click="handleDelete(scope.row)" v-hasPermi="['iot:category:remove']" @click="handleDelete(scope.row)" v-hasPermi="['iot:category:remove']"
v-if="scope.row.isSys == '0' ? true : !isTenant">删除</el-button> v-if="scope.row.isSys == '0' ? true : !isTenant">删除</el-button>
<span style="font-size:10px;color:#999;" v-if="scope.row.isSys == '1' && isTenant">系统定义不能修改</span> <span style="font-size:10px;color:#999;" v-if="scope.row.isSys == '1' && isTenant">系统定义不能修改</span>

View File

@@ -33,13 +33,13 @@
<el-table-column label="备注" align="left" header-align="center" prop="remark" /> <el-table-column label="备注" align="left" header-align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="320"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="320">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-hasPermi="['iot:device:query']" size="small" type="warning" style="padding: 5px" <el-button v-hasPermi="['iot:device:query']" size="small" type="text" style="padding: 5px"
icon="el-icon-search" @click="handleViewDevice(scope.row.groupId)">查看设备</el-button> icon="el-icon-search" @click="handleViewDevice(scope.row.groupId)">查看设备</el-button>
<el-button v-hasPermi="['iot:group:add']" size="small" type="success" style="padding: 5px" icon="el-icon-edit" <el-button v-hasPermi="['iot:group:add']" size="small" type="text" style="padding: 5px" icon="el-icon-folder-add"
@click="selectDevice(scope.row)">添加设备</el-button> @click="selectDevice(scope.row)">添加设备</el-button>
<el-button v-hasPermi="['iot:group:edit']" size="small" type="primary" style="padding: 5px" <el-button v-hasPermi="['iot:group:edit']" size="small" type="text" style="padding: 5px"
icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button> icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button v-hasPermi="['iot:group:remove']" size="small" type="danger" style="padding: 5px" <el-button v-hasPermi="['iot:group:remove']" size="small" type="text" style="padding: 5px"
icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button> icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>

View File

@@ -1,68 +1,61 @@
<template> <template>
<div style="padding: 6px"> <div style="padding: 6px">
<el-card style="margin-bottom: 6px"> <el-card style="margin-bottom: 6px">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="60px" style="margin-bottom: -20px"> <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="60px" style="margin-bottom: -20px">
<el-form-item label="设备ID" prop="deviceSipId"> <el-form-item label="设备ID" prop="deviceSipId">
<el-input v-model="queryParams.deviceSipId" placeholder="请输入设备编号" clearable size="small" <el-input v-model="queryParams.deviceSipId" placeholder="请输入设备编号" clearable size="small" @keyup.enter.native="handleQuery" />
@keyup.enter.native="handleQuery" /> </el-form-item>
</el-form-item> <el-form-item label="通道ID" prop="channelSipId">
<el-form-item label="通道ID" prop="channelSipId"> <el-input v-model="queryParams.channelSipId" placeholder="请输入通道ID" clearable size="small" @keyup.enter.native="handleQuery" />
<el-input v-model="queryParams.channelSipId" placeholder="请输入通道ID" clearable size="small" </el-form-item>
@keyup.enter.native="handleQuery" /> <el-form-item label="状态" prop="status">
</el-form-item> <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
<el-form-item label="状态" prop="status"> <el-option v-for="dict in dict.type.sip_gen_status" :key="dict.value" :label="dict.label" :value="dict.value" />
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small"> </el-select>
<el-option v-for="dict in dict.type.sip_gen_status" :key="dict.value" :label="dict.label" </el-form-item>
:value="dict.value" /> <el-form-item>
</el-select> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
</el-form-item> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-form-item> </el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-form-item style="float: right">
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:video:add']" :disabled="isGeneralUser">批量生成</el-button>
</el-form-item> <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple || isGeneralUser" @click="handleDelete" v-hasPermi="['iot:video:remove']">批量删除</el-button>
<el-form-item style="float: right"> </el-form-item>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" </el-form>
v-hasPermi="['iot:video:add']" :disabled="isGeneralUser">批量生成</el-button> </el-card>
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple || isGeneralUser"
@click="handleDelete" v-hasPermi="['iot:video:remove']">批量删除</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-bottom: 5px"> <el-card style="margin-bottom: 5px">
<el-table v-loading="loading" :data="sipidList" @selection-change="handleSelectionChange" <el-table v-loading="loading" :data="sipidList" @selection-change="handleSelectionChange" @cell-dblclick="celldblclick" size="">
@cell-dblclick="celldblclick" size=""> <el-table-column type="selection" :selectable="selectable" width="55" align="center" />
<el-table-column type="selection" :selectable="selectable" width="55" align="center" /> <el-table-column label="设备编号" align="center" prop="deviceSipId">
<el-table-column label="设备编号" align="center" prop="deviceSipId"> <template slot-scope="scope">
<template slot-scope="scope"> <el-link :underline="false" type="primary" @click="handleViewDevice(scope.row.deviceSipId)">{{ scope.row.deviceSipId }}</el-link>
<el-link :underline="false" type="primary" @click="handleViewDevice(scope.row.deviceSipId)">{{ </template>
scope.row.deviceSipId }}</el-link> </el-table-column>
</template> <el-table-column label="通道ID" align="center" prop="channelSipId" />
</el-table-column> <el-table-column label="状态" align="center" prop="status" width="80">
<el-table-column label="通道ID" align="center" prop="channelSipId" /> <template slot-scope="scope">
<el-table-column label="状态" align="center" prop="status" width="80"> <dict-tag :options="dict.type.sip_gen_status" :value="scope.row.status" size="mini" />
<template slot-scope="scope"> </template>
<dict-tag :options="dict.type.sip_gen_status" :value="scope.row.status" size="mini" /> </el-table-column>
</template> <el-table-column label="所属产品" align="center" prop="productName" />
</el-table-column> <el-table-column label="设备类型" align="center" prop="deviceType">
<el-table-column label="所属产品" align="center" prop="productName" /> <template slot-scope="scope">
<el-table-column label="设备类型" align="center" prop="deviceType"> <dict-tag :options="dict.type.video_type" :value="scope.row.deviceType" />
<template slot-scope="scope"> </template>
<dict-tag :options="dict.type.video_type" :value="scope.row.deviceType" /> </el-table-column>
</template> <el-table-column label="通道类型" align="center" prop="channelType">
</el-table-column> <template slot-scope="scope">
<el-table-column label="通道类型" align="center" prop="channelType"> <dict-tag :options="dict.type.channel_type" :value="scope.row.channelType" />
<template slot-scope="scope"> </template>
<dict-tag :options="dict.type.channel_type" :value="scope.row.channelType" /> </el-table-column>
</template> <el-table-column label="行政区域" align="center" prop="citycode" />
</el-table-column> <el-table-column label="注册时间" align="center" prop="registerTime" width="180">
<el-table-column label="行政区域" align="center" prop="citycode" /> <template slot-scope="scope">
<el-table-column label="注册时间" align="center" prop="registerTime" width="180"> <span>{{ parseTime(scope.row.registerTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
<template slot-scope="scope"> </template>
<span>{{ parseTime(scope.row.registerTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span> </el-table-column>
</template> <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
</el-table-column>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row,'remark')" v-hasPermi="['iot:video:edit']">修改 <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row,'remark')" v-hasPermi="['iot:video:edit']">修改
</el-button> </el-button>
@@ -70,57 +63,52 @@
</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="queryParams.pageNum" :limit.sync="queryParams.pageSize" <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
@pagination="getList" /> </el-card>
</el-card>
<el-dialog :title="title" :visible.sync="open" width="450px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="450px" append-to-body :close-on-click-modal="false">
<el-form :model="createForm" label-width="80px" ref="createForm"> <el-form :model="createForm" :rules="createFormrules" label-width="80px" ref="createForm">
<el-form-item label="行政区划"> <el-form-item label="行政区划" prop="city">
<el-cascader :options="cityOptions" v-model="createForm.city" @change="changeProvince" <el-cascader :options="cityOptions" v-model="createForm.city" @change="changeProvince" change-on-select style="width: 330px" :props="{ checkStrictly: false }"></el-cascader>
change-on-select></el-cascader> </el-form-item>
</el-form-item> <el-form-item label="设备类型" prop="deviceType">
<el-form-item label="设备类型" prop="deviceType"> <el-select v-model="createForm.deviceType" placeholder="请选择设备类型" style="width: 330px">
<el-select v-model="createForm.deviceType" placeholder="请选择设备类型"> <el-option v-for="dict in dict.type.video_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
<el-option v-for="dict in dict.type.video_type" :key="dict.value" :label="dict.label" </el-select>
:value="dict.value"></el-option> </el-form-item>
</el-select> <el-form-item label="通道类型" prop="channelType">
</el-form-item> <el-select v-model="createForm.channelType" placeholder="请选择设备类型" style="width: 330px">
<el-form-item label="通道类型" prop="channelType"> <el-option v-for="dict in dict.type.channel_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
<el-select v-model="createForm.channelType" placeholder="请选择设备类型"> </el-select>
<el-option v-for="dict in dict.type.channel_type" :key="dict.value" :label="dict.label" </el-form-item>
:value="dict.value"></el-option> <el-form-item label="所属产品" prop="productName">
</el-select> <el-input readonly v-model="createForm.productName" placeholder="请选择产品">
</el-form-item> <el-button slot="append" @click="selectProduct()">选择</el-button>
<el-form-item label="所属产品" prop="productName"> </el-input>
<el-input readonly v-model="createForm.productName" placeholder="请选择产品"> </el-form-item>
<el-button slot="append" @click="selectProduct()">选择</el-button> <el-form-item label="通道数量" prop="createNum">
</el-input> <el-input-number controls-position="right" v-model="createForm.createNum" :min="1" :max="10" placeholder="请输入生成通道数量" type="number" style="width: 330px" />
</el-form-item> </el-form-item>
<el-form-item label="通道数量" prop="createNum"> </el-form>
<el-input-number controls-position="right" v-model="createForm.createNum" :max="10" placeholder="请输入生成通道数量" <div slot="footer" class="dialog-footer">
type="number" style="width: 330px" /> <el-button type="primary" @click="submitForm"> </el-button>
</el-form-item> <el-button @click="cancel"> </el-button>
</el-form> </div>
<div slot="footer" class="dialog-footer"> </el-dialog>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 选择产品 --> <!-- 选择产品 -->
<product-list ref="productList" @productEvent="getProductData($event)" /> <product-list ref="productList" :productName="createForm.productName" @productEvent="getProductData($event)" />
</div> </div>
</template> </template>
<style> <style>
.createNum { .createNum {
width: 300px; width: 300px;
} }
.createNum input { .createNum input {
width: 260px; width: 260px;
} }
</style> </style>
@@ -131,344 +119,341 @@ import { listChannel, getChannel, delChannel, addChannel } from '@/api/iot/chann
import productList from './product-list.vue'; import productList from './product-list.vue';
export default { export default {
name: 'Sip', name: 'Sip',
dicts: ['sip_gen_status', 'video_type', 'channel_type'], dicts: ['sip_gen_status', 'video_type', 'channel_type'],
components: { components: {
productList, productList,
},
props: {
product: {
type: Object,
default: null,
}, },
}, props: {
watch: { product: {
// 获取到父组件传递的productId后刷新列表 type: Object,
product: function (newVal, oldVal) { default: null,
this.productInfo = newVal;
if (this.productInfo && this.productInfo.productId != 0) {
this.queryParams.productId = this.productInfo.productId;
this.deviceParams.productId = this.productInfo.productId;
this.getList();
}
},
},
data() {
return {
// 是否普通用户
isGeneralUser: true,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// sipid表格数据
sipidList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
deviceSipId: null,
deviceChannelId: null,
status: null,
},
// 表单参数
createForm: {
city: '',
deviceType: '',
channelType: '',
createNum: 1,
remark: '',
area: '',
},
form: {},
// 产品
productInfo: {},
// 城市
cityOptions: regionData,
city: '',
// 表单校验
rules: {
protocol: [
{
required: true,
message: '默认播放协议不能为空',
trigger: 'blur',
},
],
ip: [
{
required: true,
message: '服务器ip不能为空',
trigger: 'blur',
},
],
domain: [
{
required: true,
message: '服务器域名不能为空',
trigger: 'blur',
},
],
secret: [
{
required: true,
message: '流媒体密钥不能为空',
trigger: 'blur',
},
],
portHttp: [
{
required: true,
message: 'http端口不能为空',
trigger: 'blur',
},
],
portHttps: [
{
required: true,
message: 'https端口不能为空',
trigger: 'blur',
},
],
portRtmp: [
{
required: true,
message: 'rtmp端口不能为空',
trigger: 'blur',
},
],
portRtsp: [
{
required: true,
message: 'rtsp端口不能为空',
trigger: 'blur',
},
],
rtpPortRange: [
{
required: true,
message: 'rtp端口范围不能为空',
trigger: 'blur',
},
],
delFlag: [
{
required: true,
message: '删除标志不能为空',
trigger: 'blur',
},
],
createBy: [
{
required: true,
message: '创建者不能为空',
trigger: 'blur',
},
],
createTime: [
{
required: true,
message: '创建时间不能为空',
trigger: 'blur',
},
],
},
};
},
created() {
// 普通用户只能查看自己的通道
if (this.$store.state.user.roles.indexOf('general') === -1) {
this.isGeneralUser = false;
}
this.getList();
},
methods: {
/** 查看设备操作 */
handleViewDevice(serialNumber) {
this.$router.push({
path: '/iot/device',
query: {
t: Date.now(),
sn: serialNumber,
}, },
});
}, },
/**选择产品 */ watch: {
selectProduct() { // 获取到父组件传递的productId后刷新列表
this.open = false; product: function (newVal, oldVal) {
this.$refs.productList.open = true; this.productInfo = newVal;
this.$refs.productList.getList(); if (this.productInfo && this.productInfo.productId != 0) {
}, this.queryParams.productId = this.productInfo.productId;
/**获取选中的产品 */ this.deviceParams.productId = this.productInfo.productId;
getProductData(product) { this.getList();
this.open = true; }
this.createForm.productId = product.productId;
this.createForm.productName = product.productName;
this.createForm.tenantId = product.tenantId;
this.createForm.tenantName = product.tenantName;
},
/** 行政区划改变 **/
changeProvince(data) {
if (data && data[0] != null && data[1] != null && data[2] != null) {
const str = CodeToText[data[0]] + '/' + CodeToText[data[1]] + '/' + CodeToText[data[2]];
this.createForm.citycode = str;
}
},
/**获取设备详情*/
getDeviceBySerialNumber(serialNumber) {
this.openDevice = true;
getDeviceBySerialNumber(serialNumber).then((response) => {
this.device = response.data;
});
},
/** 查询通道列表 */
getList() {
listChannel(this.queryParams).then((response) => {
this.sipidList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.createForm = {
id: null,
deviceSipId: null,
channelSipId: null,
status: 0,
registertime: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
createNum: 1,
};
this.resetForm('createForm');
},
/** 搜索按钮操作 */
handleQuery() {
this.loading = true;
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.multiple = !selection.length;
},
/** 批量新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '生成设备通道';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
console.log(row);
getChannel(id).then((response) => {
this.createForm = response.data;
this.open = true;
this.title = '修改产品分类';
});
},
/** 提交按钮 */
submitForm() {
if (this.createForm.createNum < 1) {
this.$modal.alertError('通道数量至少一个');
return;
}
if (!this.createForm.productId || this.createForm.productId == 0) {
this.$modal.alertError('请选择所属产品');
return;
}
this.createForm.deviceSipId = this.createForm.city[2] + '0000' + this.createForm.deviceType + '0';
this.createForm.channelSipId = this.createForm.city[2] + '0000' + this.createForm.channelType + '0';
if (this.createForm.deviceType !== '' && this.createForm.channelType !== '' && this.createForm.city.length === 3) {
console.log(this.createForm);
addChannel(this.createForm.createNum, this.createForm).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
} else {
this.$message({
type: 'error',
message: '请选择地区,设备类型,通道类型!!',
});
}
},
/** 删除按钮操作 */
handleDelete(row) {
const sipIds = row.id || this.ids;
this.$modal
.confirm('是否确认删除ID为"' + sipIds + '"的数据项?')
.then(function () {
return delChannel(sipIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => { });
},
//禁用有绑定设备的复选框,status:1=未使用2=已使用
selectable(row) {
if (row.status == 2 || this.isGeneralUser) {
return false;
}
return true;
},
//表格增加复制功能
celldblclick(row, column, cell, event) {
this.$copyText(row[column.property]).then(
(e) => {
this.onCopy();
}, },
function (e) { },
this.onError(); data() {
return {
// 是否普通用户
isGeneralUser: true,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// sipid表格数据
sipidList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
deviceSipId: null,
deviceChannelId: null,
status: null,
},
// 表单参数
createForm: {
city: '',
deviceType: '',
channelType: '',
createNum: 1,
remark: '',
area: '',
},
form: {},
// 产品
productInfo: {},
// 城市
cityOptions: regionData,
city: '',
// 表单校验
//createForm表单校验
createFormrules: {
city: [{ required: true, message: '行政区划不能为空', trigger: 'change' }],
deviceType: [{ required: true, message: '设备类型不饿能为空', trigger: 'change' }],
channelType: [{ required: true, message: '通道类型不能为空', trigger: 'change' }],
productName: [{ required: true, message: '产品类型不能为空', trigger: 'blur' }],
createNum: [{ required: true, message: '请输入生成通道数量', trigger: 'change' }],
},
rules: {
protocol: [
{
required: true,
message: '默认播放协议不能为空',
trigger: 'blur',
},
],
ip: [
{
required: true,
message: '服务器ip不能为空',
trigger: 'blur',
},
],
domain: [
{
required: true,
message: '服务器域名不能为空',
trigger: 'blur',
},
],
secret: [
{
required: true,
message: '流媒体密钥不能为空',
trigger: 'blur',
},
],
portHttp: [
{
required: true,
message: 'http端口不能为空',
trigger: 'blur',
},
],
portHttps: [
{
required: true,
message: 'https端口不能为空',
trigger: 'blur',
},
],
portRtmp: [
{
required: true,
message: 'rtmp端口不能为空',
trigger: 'blur',
},
],
portRtsp: [
{
required: true,
message: 'rtsp端口不能为空',
trigger: 'blur',
},
],
rtpPortRange: [
{
required: true,
message: 'rtp端口范围不能为空',
trigger: 'blur',
},
],
delFlag: [
{
required: true,
message: '删除标志不能为空',
trigger: 'blur',
},
],
createBy: [
{
required: true,
message: '创建者不能为空',
trigger: 'blur',
},
],
createTime: [
{
required: true,
message: '创建时间不能为空',
trigger: 'blur',
},
],
},
};
},
created() {
// 普通用户只能查看自己的通道
if (this.$store.state.user.roles.indexOf('general') === -1) {
this.isGeneralUser = false;
} }
); this.getList();
}, },
onCopy() { methods: {
this.$notify({ /** 查看设备操作 */
title: '成功', handleViewDevice(serialNumber) {
message: '复制成功!', this.$router.push({
type: 'success', path: '/iot/device',
offset: 50, query: {
duration: 2000, t: Date.now(),
}); sn: serialNumber,
},
});
},
/**选择产品 */
selectProduct() {
//this.open = false;
this.$refs.productList.open = true;
this.$refs.productList.getList();
},
/**获取选中的产品 */
getProductData(product) {
//this.open = true;
this.createForm.productId = product.productId;
this.createForm.productName = product.productName;
this.createForm.tenantId = product.tenantId;
this.createForm.tenantName = product.tenantName;
this.$refs.createForm.clearValidate('productName');
this.$forceUpdate(); // 强制更新视图
},
/** 行政区划改变 **/
changeProvince(data) {
if (data && data[0] != null && data[1] != null && data[2] != null) {
const str = CodeToText[data[0]] + '/' + CodeToText[data[1]] + '/' + CodeToText[data[2]];
this.createForm.citycode = str;
}
},
/**获取设备详情*/
getDeviceBySerialNumber(serialNumber) {
this.openDevice = true;
getDeviceBySerialNumber(serialNumber).then((response) => {
this.device = response.data;
});
},
/** 查询通道列表 */
getList() {
listChannel(this.queryParams).then((response) => {
this.sipidList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.createForm = {
id: null,
deviceSipId: null,
channelSipId: null,
status: 0,
registertime: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
createNum: 1,
};
this.resetForm('createForm');
},
/** 搜索按钮操作 */
handleQuery() {
this.loading = true;
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.multiple = !selection.length;
},
/** 批量新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '生成设备通道';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
console.log(row);
getChannel(id).then((response) => {
this.createForm = response.data;
this.open = true;
this.title = '修改产品分类';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['createForm'].validate((valid) => {
if (valid) {
this.createForm.deviceSipId = this.createForm.city[2] + '0000' + this.createForm.deviceType + '0';
this.createForm.channelSipId = this.createForm.city[2] + '0000' + this.createForm.channelType + '0';
addChannel(this.createForm.createNum, this.createForm).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const sipIds = row.id || this.ids;
this.$modal
.confirm('是否确认删除ID为"' + sipIds + '"的数据项?')
.then(function () {
return delChannel(sipIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
//禁用有绑定设备的复选框,status:1=未使用2=已使用
selectable(row) {
if (row.status == 2 || this.isGeneralUser) {
return false;
}
return true;
},
//表格增加复制功能
celldblclick(row, column, cell, event) {
this.$copyText(row[column.property]).then(
(e) => {
this.onCopy();
},
function (e) {
this.onError();
}
);
},
onCopy() {
this.$notify({
title: '成功',
message: '复制成功!',
type: 'success',
offset: 50,
duration: 2000,
});
},
onError() {
this.$notify({
title: '失败',
message: '复制失败!',
type: 'error',
offset: 50,
duration: 2000,
});
},
}, },
onError() {
this.$notify({
title: '失败',
message: '复制失败!',
type: 'error',
offset: 50,
duration: 2000,
});
},
},
}; };
</script> </script>

View File

@@ -1,60 +1,58 @@
<template> <template>
<el-dialog title="选择产品" :visible.sync="open" width="600px" append-to-body> <el-dialog title="选择产品" :visible.sync="open" width="600px" append-to-body>
<div style="margin-top:-55px;"> <div style="margin-top: -55px">
<el-divider style="margin-top:-30px;"></el-divider> <el-divider style="margin-top: -30px"></el-divider>
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
<el-form-item label="产品名称" prop="productName"> <el-form-item label="产品名称" prop="productName">
<el-input v-model="queryParams.productName" placeholder="请输入产品名称" clearable size="small" @keyup.enter.native="handleQuery" /> <el-input v-model="queryParams.productName" placeholder="请输入产品名称" clearable size="small" @keyup.enter.native="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table v-loading="loading" ref="singleTable" :data="productList" @row-click="rowClick" highlight-current-row size="mini"> <el-table v-loading="loading" ref="singleTable" :data="productList" @row-click="rowClick" highlight-current-row size="mini">
<el-table-column label="选择" width="50" align="center"> <el-table-column label="选择" width="50" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<input type="radio" :checked="scope.row.isSelect" name="product" /> <input type="radio" :checked="scope.row.isSelect" name="product" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="产品名称" align="center" prop="productName" /> <el-table-column label="产品名称" align="center" prop="productName" />
<el-table-column label="分类名称" align="center" prop="categoryName" /> <el-table-column label="分类名称" align="center" prop="categoryName" />
<el-table-column label="租户名称" align="center" prop="tenantName" /> <el-table-column label="租户名称" align="center" prop="tenantName" />
<el-table-column label="联网方式" align="center" prop="networkMethod"> <el-table-column label="联网方式" align="center" prop="networkMethod">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.iot_network_method" :value="scope.row.networkMethod" /> <dict-tag :options="dict.type.iot_network_method" :value="scope.row.networkMethod" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="100"> <el-table-column label="创建时间" align="center" prop="createTime" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="confirmSelectProduct" type="primary">确定</el-button> <el-button @click="confirmSelectProduct" type="primary">确定</el-button>
<el-button @click="closeDialog" type="info"> </el-button> <el-button @click="closeDialog" type="info"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { import { listProduct } from '@/api/iot/product';
listProduct,
} from "@/api/iot/product";
export default { export default {
name: "SipProductList", name: 'SipProductList',
dicts: ['iot_vertificate_method', 'iot_network_method'], dicts: ['iot_vertificate_method', 'iot_network_method'],
props: { props: {
productId: { productId: {
type: Number, type: Number,
default: 0 default: 0,
} },
}, },
data() { data() {
return { return {
@@ -67,7 +65,7 @@ export default {
// 产品列表 // 产品列表
productList: [], productList: [],
// 选中的产品 // 选中的产品
product: {}, product: null,
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@@ -84,14 +82,12 @@ export default {
}, },
}; };
}, },
created() { created() {},
},
methods: { methods: {
/** 查询产品列表 */ /** 查询产品列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listProduct(this.queryParams).then(response => { listProduct(this.queryParams).then((response) => {
//产品列表初始化isSelect值用于单选 //产品列表初始化isSelect值用于单选
for (let i = 0; i < response.rows.length; i++) { for (let i = 0; i < response.rows.length; i++) {
response.rows[i].isSelect = false; response.rows[i].isSelect = false;
@@ -111,7 +107,7 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm('queryForm');
this.handleQuery(); this.handleQuery();
}, },
/** 单选数据 */ /** 单选数据 */
@@ -133,13 +129,18 @@ export default {
}, },
/**确定选择产品,产品传递给父组件 */ /**确定选择产品,产品传递给父组件 */
confirmSelectProduct() { confirmSelectProduct() {
if (this.product == null) {
this.$message.error('请选择产品');
return;
}
this.$emit('productEvent', this.product); this.$emit('productEvent', this.product);
this.open = false; this.open = false;
this.product = null;
}, },
/**关闭对话框 */ /**关闭对话框 */
closeDialog() { closeDialog() {
this.open = false; this.open = false;
} },
} },
}; };
</script> </script>

View File

@@ -1,58 +1,54 @@
<template> <template>
<el-dialog :title="title" :visible.sync="open" width="400px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="400px" append-to-body :close-on-click-modal="false">
<el-form ref="createForm" :model="createForm" label-width="100px"> <el-form ref="createForm" :model="createForm" label-width="100px" :rules="rules">
<el-form-item label="行政区划"> <el-form-item label="行政区划" prop="city">
<el-cascader :options="cityOptions" v-model="createForm.city" @change="changeProvince" change-on-select> <el-cascader :options="cityOptions" v-model="createForm.city" @change="changeProvince" change-on-select :props="{ checkStrictly: false }"></el-cascader>
</el-cascader> </el-form-item>
</el-form-item> <el-form-item label="设备类型" prop="deviceType">
<el-form-item label="设备类型" prop="deviceType"> <el-select v-model="createForm.deviceType" placeholder="请选择设备类型">
<el-select v-model="createForm.deviceType" placeholder="请选择设备类型"> <el-option v-for="dict in dict.type.video_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
<el-option v-for="dict in dict.type.video_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option> </el-select>
</el-select> </el-form-item>
</el-form-item> <el-form-item label="通道类型" prop="channelType">
<el-form-item label="通道类型" prop="channelType"> <el-select v-model="createForm.channelType" placeholder="请选择设备类型">
<el-select v-model="createForm.channelType" placeholder="请选择设备类型"> <el-option v-for="dict in dict.type.channel_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
<el-option v-for="dict in dict.type.channel_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option> </el-select>
</el-select> </el-form-item>
</el-form-item> <el-form-item label="通道数量" prop="createNum">
<el-form-item label="通道数量" prop="createNum"> <el-input-number controls-position="right" :min="1" :max="10" v-model="createForm.createNum" placeholder="请输入生成通道数量" type="number" style="width: 220px" />
<el-input-number controls-position="right" v-model="createForm.createNum" placeholder="请输入生成通道数量" type="number" style="width:220px;" /> </el-form-item>
</el-form-item> </el-form>
</el-form> <div slot="footer" class="dialog-footer">
<div slot="footer" class="dialog-footer"> <el-button type="primary" @click="submitForm"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button> <el-button @click="closeDialog"> </el-button>
<el-button @click="closeDialog"> </el-button> </div>
</div> </el-dialog>
</el-dialog>
</template> </template>
<script> <script>
import { import { regionData, CodeToText } from 'element-china-area-data';
regionData,
CodeToText
} from 'element-china-area-data'
import {addChannel} from "@/api/iot/channel"; import { addChannel } from '@/api/iot/channel';
export default { export default {
name: "SipidDialog", name: 'SipidDialog',
dicts: ['video_type', 'channel_type'], dicts: ['video_type', 'channel_type'],
props: { props: {
product: { product: {
type: Object, type: Object,
default: null default: null,
} },
}, },
data() { data() {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: true,
title: "生成设备编号和通道", title: '生成设备编号和通道',
// 总条数 // 总条数
total: 0, total: 0,
// 打开选择产品对话框 // 打开选择产品对话框
open: false, open: false,
devsipid: "", devsipid: '',
createForm: { createForm: {
city: '', city: '',
deviceType: '', deviceType: '',
@@ -63,11 +59,17 @@ export default {
cityOptions: regionData, cityOptions: regionData,
city: '', city: '',
cityCode: '', cityCode: '',
// 表单校验
rules: {
city: [{ required: true, message: '行政区划不能为空', trigger: 'change' }],
deviceType: [{ required: true, message: '设备类型不能为空', trigger: 'change' }],
channelType: [{ required: true, message: '通道类型不能为空', trigger: 'change' }],
createNum: [{ required: true, message: '请输入生成通道数量', trigger: 'change' }],
},
}; };
}, },
created() { created() {},
},
methods: { methods: {
/** 行政区划改变 **/ /** 行政区划改变 **/
changeProvince(data) { changeProvince(data) {
@@ -78,29 +80,21 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
if (this.createForm.createNum < 1) { this.$refs.createForm.validate((valid) => {
this.$modal.alertError("通道数量至少一个"); if (valid) {
return; this.createForm.productId = this.product.productId;
} this.createForm.productName = this.product.productName;
this.createForm.productId = this.product.productId; this.createForm.tenantId = this.product.tenantId;
this.createForm.productName = this.product.productName; this.createForm.tenantName = this.product.tenantName;
this.createForm.tenantId = this.product.tenantId; this.createForm.deviceSipId = this.createForm.city[2] + '0000' + this.createForm.deviceType + '0';
this.createForm.tenantName = this.product.tenantName; this.createForm.channelSipId = this.createForm.city[2] + '0000' + this.createForm.channelType + '0';
this.createForm.deviceSipId = this.createForm.city[2] + "0000" + this.createForm.deviceType + "0" addChannel(this.createForm.createNum, this.createForm).then((response) => {
this.createForm.channelSipId = this.createForm.city[2] + "0000" + this.createForm.channelType + "0" this.$modal.msgSuccess('已生成设备编号和通道');
if (this.createForm.deviceType !== "" && this.createForm.channelType !== "" && this.createForm.city.length === 3) { this.devsipid = response.data;
addChannel(this.createForm.createNum, this.createForm).then(response => { this.confirmSelectProduct();
this.$modal.msgSuccess("已生成设备编号和通道"); });
this.devsipid = response.data; }
this.confirmSelectProduct(); });
});
} else {
this.$message({
type: 'error',
message: '请选择地区,设备类型,通道类型!!'
});
}
}, },
confirmSelectProduct() { confirmSelectProduct() {
this.open = false; this.open = false;
@@ -109,11 +103,9 @@ export default {
/**关闭对话框 */ /**关闭对话框 */
closeDialog() { closeDialog() {
this.open = false; this.open = false;
} },
} },
} };
</script> </script>
<style scoped> <style scoped></style>
</style>

View File

@@ -71,12 +71,12 @@
<el-table-column label="排序" align="center" prop="modelOrder" width="80" /> <el-table-column label="排序" align="center" prop="modelOrder" width="80" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="small" type="primary" style="padding: 5px" icon="el-icon-edit" <el-button size="small" type="text" style="padding: 5px" icon="el-icon-edit"
@click="handleUpdate(scope.row)" v-hasPermi="['iot:template:query']" @click="handleUpdate(scope.row)" v-hasPermi="['iot:template:query']"
v-if="scope.row.isSys == '0' ? true : !isTenant"> v-if="scope.row.isSys == '0' ? true : !isTenant">
修改 修改
</el-button> </el-button>
<el-button size="small" type="danger" style="padding: 5px" icon="el-icon-delete" <el-button size="small" type="text" style="padding: 5px" icon="el-icon-delete"
@click="handleDelete(scope.row)" v-hasPermi="['iot:template:remove']" @click="handleDelete(scope.row)" v-hasPermi="['iot:template:remove']"
v-if="scope.row.isSys == '0' ? true : !isTenant"> v-if="scope.row.isSys == '0' ? true : !isTenant">
删除 删除

File diff suppressed because it is too large Load Diff