提交:配置管理以及项目下场景管理代码。
This commit is contained in:
parent
44873df769
commit
da95c4d9fb
|
@ -163,3 +163,46 @@ export function projectLeakageTable(query) {
|
||||||
params: query
|
params: query
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询 场景控制 列表
|
||||||
|
export function projectSceneList(query) {
|
||||||
|
return request({
|
||||||
|
url: "/iot/scene/list",
|
||||||
|
method: "get",
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询 场景控制 新增
|
||||||
|
export function projectSceneAdd(query) {
|
||||||
|
return request({
|
||||||
|
url: "/iot/scene/add",
|
||||||
|
method: "post",
|
||||||
|
data: query
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询 场景控制 修改
|
||||||
|
export function projectSceneUpdate(data) {
|
||||||
|
return request({
|
||||||
|
url: '/iot/scene/edit',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询 场景控制 详细
|
||||||
|
export function projectSceneDetail(id) {
|
||||||
|
return request({
|
||||||
|
url: '/iot/scene/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询 场景控制 删除
|
||||||
|
export function projectSceneDelete(siteId) {
|
||||||
|
return request({
|
||||||
|
url: '/iot/scene/del/' + siteId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询企业属性列表
|
||||||
|
export function listAttribute(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/attribute/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询企业属性详细
|
||||||
|
export function getAttribute(enterpriseAttribute) {
|
||||||
|
return request({
|
||||||
|
url: '/system/attribute/' + enterpriseAttribute,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增企业属性
|
||||||
|
export function addAttribute(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/attribute',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改企业属性
|
||||||
|
export function updateAttribute(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/attribute',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除企业属性
|
||||||
|
export function delAttribute(enterpriseAttribute) {
|
||||||
|
return request({
|
||||||
|
url: '/system/attribute/' + enterpriseAttribute,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出企业属性
|
||||||
|
export function exportAttribute(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/attribute/export',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询企业属性详细
|
||||||
|
export function getAttributeConfig() {
|
||||||
|
return request({
|
||||||
|
url: '/system/attribute/getAttribute',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import ETagCard from "./src/ETagCard/index"
|
||||||
|
|
||||||
|
ETagCard.install = function install(Vue) {
|
||||||
|
Vue.component(ETagCard.name, ETagCard);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ETagCard
|
|
@ -0,0 +1,46 @@
|
||||||
|
import './style.scss'
|
||||||
|
export default {
|
||||||
|
name: 'ETagCard',
|
||||||
|
props: {
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '100%'
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: String,
|
||||||
|
default: '100%'
|
||||||
|
},
|
||||||
|
bodyClassName: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
returnClass() {
|
||||||
|
switch(this.type) {
|
||||||
|
case 'success':
|
||||||
|
return 'e-tag--success';
|
||||||
|
case 'success':
|
||||||
|
return 'e-tag--info';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
render() {
|
||||||
|
const { $slots } = this;
|
||||||
|
return (
|
||||||
|
<div class={['e-tag-card', this.returnClass()] }>
|
||||||
|
<div class="e-tag-card__body">
|
||||||
|
{
|
||||||
|
$slots.body
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
.e-tag-card {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #ecf5ff;
|
||||||
|
border: 1px solid #d9ecff;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.e-tag-card .e-tag-card__body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.e-tag--success {
|
||||||
|
background-color: #f0f9eb;
|
||||||
|
border-color: #e1f3d8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.e-tag--info {
|
||||||
|
background-color: #f4f4f5;
|
||||||
|
border-color: #e9e9eb;
|
||||||
|
}
|
|
@ -3,11 +3,11 @@
|
||||||
<transition name="sidebarLogoFade">
|
<transition name="sidebarLogoFade">
|
||||||
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
||||||
<!-- <img v-if="logo" :src="logo" class="sidebar-logo"> -->
|
<!-- <img v-if="logo" :src="logo" class="sidebar-logo"> -->
|
||||||
<h1 class="sidebar-title" :style="{ color: this.themeTextColor()}">{{ title }} </h1>
|
<h1 class="sidebar-title" :style="{ color: this.themeTextColor()}">{{ attribute }} </h1>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
||||||
<!-- <img v-if="logo" :src="logo" class="sidebar-logo"> -->
|
<!-- <img v-if="logo" :src="logo" class="sidebar-logo"> -->
|
||||||
<h1 class="sidebar-title" :style="{ color: this.themeTextColor() }">{{ title }} </h1>
|
<h1 class="sidebar-title" :style="{ color: this.themeTextColor() }">{{ attribute }} </h1>
|
||||||
</router-link>
|
</router-link>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
<script>
|
<script>
|
||||||
import logoImg from '@/assets/logo/logo.png'
|
import logoImg from '@/assets/logo/logo.png'
|
||||||
import variables from '@/assets/styles/variables.scss'
|
import variables from '@/assets/styles/variables.scss'
|
||||||
|
import defaultConfig from '@/settings.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SidebarLogo',
|
name: 'SidebarLogo',
|
||||||
|
@ -29,8 +30,11 @@ export default {
|
||||||
variables() {
|
variables() {
|
||||||
return variables;
|
return variables;
|
||||||
},
|
},
|
||||||
sideTheme() {
|
sideTheme() {
|
||||||
return this.$store.state.settings.sideTheme
|
return this.$store.state.settings.sideTheme
|
||||||
|
},
|
||||||
|
attribute() {
|
||||||
|
return this.$store.getters.attributeInfo['logoTitle'] || this.title;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
|
@ -24,6 +24,8 @@ router.beforeEach((to, from, next) => {
|
||||||
store.dispatch('GetInfo').then(res => {
|
store.dispatch('GetInfo').then(res => {
|
||||||
// 拉取user_info
|
// 拉取user_info
|
||||||
const roles = res.roles
|
const roles = res.roles
|
||||||
|
// 拉取 配置信息
|
||||||
|
store.dispatch('GetAttribute');
|
||||||
store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => {
|
store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => {
|
||||||
// 根据roles权限生成可访问的路由表
|
// 根据roles权限生成可访问的路由表
|
||||||
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
||||||
|
|
|
@ -16,6 +16,7 @@ const getters = {
|
||||||
sidebarRouters:state => state.permission.sidebarRouters,
|
sidebarRouters:state => state.permission.sidebarRouters,
|
||||||
userId: state => state.user.userId,
|
userId: state => state.user.userId,
|
||||||
attributeList: state => state.attribute.attributeList,
|
attributeList: state => state.attribute.attributeList,
|
||||||
groupList: state => state.attribute.groupList
|
groupList: state => state.attribute.groupList,
|
||||||
|
attributeInfo: state => state.permission.attribute
|
||||||
}
|
}
|
||||||
export default getters
|
export default getters
|
||||||
|
|
|
@ -6,7 +6,7 @@ const state = {
|
||||||
withoutAnimation: false
|
withoutAnimation: false
|
||||||
},
|
},
|
||||||
device: 'desktop',
|
device: 'desktop',
|
||||||
size: Cookies.get('size') || 'medium'
|
size: Cookies.get('size') || 'medium',
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
|
|
|
@ -2,12 +2,14 @@ import { constantRoutes } from '@/router'
|
||||||
import { getRouters } from '@/api/menu'
|
import { getRouters } from '@/api/menu'
|
||||||
import Layout from '@/layout/index'
|
import Layout from '@/layout/index'
|
||||||
import ParentView from '@/components/ParentView';
|
import ParentView from '@/components/ParentView';
|
||||||
|
import { getAttributeConfig } from '@/api/system/attribute'
|
||||||
|
|
||||||
const permission = {
|
const permission = {
|
||||||
state: {
|
state: {
|
||||||
routes: [],
|
routes: [],
|
||||||
addRoutes: [],
|
addRoutes: [],
|
||||||
sidebarRouters: []
|
sidebarRouters: [],
|
||||||
|
attribute: {},
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
SET_ROUTES: (state, routes) => {
|
SET_ROUTES: (state, routes) => {
|
||||||
|
@ -17,8 +19,21 @@ const permission = {
|
||||||
SET_SIDEBAR_ROUTERS: (state, routers) => {
|
SET_SIDEBAR_ROUTERS: (state, routers) => {
|
||||||
state.sidebarRouters = constantRoutes.concat(routers)
|
state.sidebarRouters = constantRoutes.concat(routers)
|
||||||
},
|
},
|
||||||
|
SET_ATTRIBUTE: (state, size) => {
|
||||||
|
state.attribute = size
|
||||||
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
// 生成路由
|
||||||
|
GetAttribute({ commit }) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
// 向后端请求路由数据
|
||||||
|
console.log('請求--GetAttribute')
|
||||||
|
getAttributeConfig().then(res => {
|
||||||
|
commit('SET_ATTRIBUTE', res.data)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
// 生成路由
|
// 生成路由
|
||||||
GenerateRoutes({ commit }) {
|
GenerateRoutes({ commit }) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
|
|
@ -126,10 +126,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { listDevice } from "@/api/iot/device";
|
import { listDevice } from "@/api/iot/device";
|
||||||
import SelectTableWrap from "@/components/SelectTable/index";
|
import SelectTableWrap from "@/components/SelectTable/index";
|
||||||
|
|
||||||
import axios from "axios";
|
|
||||||
import { getToken } from "@/utils/auth";
|
|
||||||
import { basePlatformUrl } from '@/config/env'
|
|
||||||
import { getDeviceFunList, getDeviceCmdList } from "@/api/iot/device";
|
import { getDeviceFunList, getDeviceCmdList } from "@/api/iot/device";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
import EExecuteAction from "./src/executeAction"
|
||||||
|
|
||||||
|
EExecuteAction.install = function install(Vue) {
|
||||||
|
Vue.component(EExecuteAction.name, EExecuteAction);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EExecuteAction
|
|
@ -0,0 +1,21 @@
|
||||||
|
export const triggerMethod = {
|
||||||
|
MANUAL: '手动触发',
|
||||||
|
TIMER: '定时触发',
|
||||||
|
DEVICE: '设备触发',
|
||||||
|
SCENE: '场景触发',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const actionType = {
|
||||||
|
NOTIFIER: '消息通知',
|
||||||
|
DEVOUTPUT: '设备输出',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultConfig = {
|
||||||
|
title: '触发器',
|
||||||
|
actionTitle: '执行动作'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const notifierType = {
|
||||||
|
SMS: '短信',
|
||||||
|
WEEXIN: '微信'
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import ESceneTrigger from "./src/index"
|
||||||
|
|
||||||
|
ESceneTrigger.install = function install(Vue) {
|
||||||
|
Vue.component(ESceneTrigger.name, ESceneTrigger);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ESceneTrigger
|
|
@ -0,0 +1,60 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<condition-temp
|
||||||
|
@EventDel="eventDel"
|
||||||
|
:tempIndex="index"
|
||||||
|
:info="item"
|
||||||
|
v-for="(item, index) in conditionList"
|
||||||
|
:key="index"
|
||||||
|
:propertyList="propertyList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import ConditionTemp from "./conditionTemp";
|
||||||
|
import { getDeviceFunList } from "@/api/iot/device";
|
||||||
|
export default {
|
||||||
|
name: "EConditionTemp",
|
||||||
|
props: {
|
||||||
|
conditionList: {
|
||||||
|
type: Array
|
||||||
|
},
|
||||||
|
sourceId: {
|
||||||
|
type: [String, Number]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: { ConditionTemp },
|
||||||
|
watch: {
|
||||||
|
sourceId() {
|
||||||
|
if (this.sourceId !== null && this.sourceId !== undefined) {
|
||||||
|
this.getcomdlist(this.sourceId);
|
||||||
|
} else {
|
||||||
|
this.propertyList = [];
|
||||||
|
};
|
||||||
|
this.conditionList = [];
|
||||||
|
this.$emit('change', []);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
propertyList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 查询产品参数列表
|
||||||
|
getcomdlist(id) {
|
||||||
|
this.propertyList = [];
|
||||||
|
getDeviceFunList({
|
||||||
|
deviceId: id
|
||||||
|
}).then(res => {
|
||||||
|
this.propertyList = res.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
eventDel(data) {
|
||||||
|
this.conditionList.splice(data, 1);
|
||||||
|
this.$emit('change', this.conditionList);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -0,0 +1,440 @@
|
||||||
|
<template>
|
||||||
|
<div class="e-scene-param">
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="11">
|
||||||
|
<span>设备:</span>
|
||||||
|
<el-input
|
||||||
|
style="width: 80%"
|
||||||
|
:disabled="disabled"
|
||||||
|
v-model="form.deviceName"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
@focus="deviceFocus"
|
||||||
|
></el-input>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="11">
|
||||||
|
<span>分组:</span>
|
||||||
|
<el-select
|
||||||
|
v-model="form.cmdKey"
|
||||||
|
:disabled="disabled"
|
||||||
|
style="width: 85%"
|
||||||
|
@change="cmdChange"
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in cmdListOption"
|
||||||
|
:key="item.cmdKey"
|
||||||
|
:label="item.cmdName"
|
||||||
|
:value="item.cmdKey"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2">
|
||||||
|
<!-- <el-button
|
||||||
|
@click="delThisInfo()"
|
||||||
|
v-show="disabled === false"
|
||||||
|
:disabled="deleteButtonD"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete-solid"
|
||||||
|
style="
|
||||||
|
font-size: 20px;
|
||||||
|
margin-top: 0px;
|
||||||
|
padding-bottom: 1px;
|
||||||
|
color: #f36464;
|
||||||
|
"
|
||||||
|
></el-button> -->
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-show="comdlistOption && comdlistOption.length > 0">
|
||||||
|
<div class="param-wrap">
|
||||||
|
<el-form
|
||||||
|
:model="ctlJson"
|
||||||
|
v-if="comdlistOption && comdlistOption.length > 0"
|
||||||
|
ref="loginForm"
|
||||||
|
label-width="120px"
|
||||||
|
width="100%"
|
||||||
|
>
|
||||||
|
<el-col
|
||||||
|
:span="comdlistOption.length === 1 ? 24 : 12"
|
||||||
|
v-for="paramsItem in comdlistOption"
|
||||||
|
:key="paramsItem.funId"
|
||||||
|
>
|
||||||
|
<el-form-item
|
||||||
|
:label="paramsItem.funName + ':'"
|
||||||
|
:prop="paramsItem.funKey"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
:disabled="disabled"
|
||||||
|
style="width: 100%"
|
||||||
|
v-model="ctlJson[paramsItem.funKey]"
|
||||||
|
v-if="paramsItem.funValidType === 'ENUM'"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="(keys, valus) in strtoJson(paramsItem.funObj)"
|
||||||
|
:key="valus"
|
||||||
|
:label="keys"
|
||||||
|
:value="valus"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-input-number
|
||||||
|
style="width: 100%"
|
||||||
|
:disabled="disabled"
|
||||||
|
v-model="ctlJson[paramsItem.funKey]"
|
||||||
|
v-else-if="
|
||||||
|
paramsItem.funValidType === 'RANGE' &&
|
||||||
|
(paramsItem.funDataType === 'FLOAT' ||
|
||||||
|
paramsItem.funDataType === 'INT32')
|
||||||
|
"
|
||||||
|
:max="paramsItem.funValMax || 0"
|
||||||
|
:min="paramsItem.funValMin || 0"
|
||||||
|
clearable
|
||||||
|
></el-input-number>
|
||||||
|
|
||||||
|
<el-input-number
|
||||||
|
style="width: 100%"
|
||||||
|
clearable
|
||||||
|
:disabled="disabled"
|
||||||
|
v-model="ctlJson[paramsItem.funKey]"
|
||||||
|
v-else-if="
|
||||||
|
paramsItem.funValidType === 'NOT' &&
|
||||||
|
(paramsItem.funDataType === 'FLOAT' ||
|
||||||
|
paramsItem.funDataType === 'INT32')
|
||||||
|
"
|
||||||
|
></el-input-number>
|
||||||
|
<el-input
|
||||||
|
clearable
|
||||||
|
style="width: 100%"
|
||||||
|
:disabled="disabled"
|
||||||
|
v-else-if="paramsItem.funDataType === 'TEXT'"
|
||||||
|
v-model="ctlJson[paramsItem.funKey]"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="选择"
|
||||||
|
:visible.sync="selectTableShow"
|
||||||
|
width="75%"
|
||||||
|
top="10vh"
|
||||||
|
class="select-table-dialog"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
|
<select-table-wrap
|
||||||
|
v-if="selectTableShow"
|
||||||
|
:tableOption="tableSelectOption.tableOpt"
|
||||||
|
:queryOption="tableSelectOption.queryOpt"
|
||||||
|
:tableList="tableSelectOption.tableList"
|
||||||
|
@parentGetList="childGetList($event)"
|
||||||
|
:otherOption="tableSelectOption.otherOption"
|
||||||
|
@returnEvent="returnEvent($event)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button size="mini" type="primary" @click="resuleClick"
|
||||||
|
>确 定</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
selectTableShow = false;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>取 消</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
// import { listDevice } from "@/api/iot/device";
|
||||||
|
import SelectTableWrap from "@/components/SelectTable/index";
|
||||||
|
import { getDeviceFunList, getDeviceCmdList } from "@/api/iot/device";
|
||||||
|
import { getDeviceList } from "@/api/app";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "EDeviceParam",
|
||||||
|
components: {
|
||||||
|
SelectTableWrap,
|
||||||
|
},
|
||||||
|
props: ["paramsDevcie", "tempIndex", "deleteButtonD", "disabled"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tableSelectOption: {},
|
||||||
|
selectResult: {},
|
||||||
|
selectTableShow: false,
|
||||||
|
cmdListOption: [],
|
||||||
|
comdlistOption: [],
|
||||||
|
cmdKey: "",
|
||||||
|
ctlJson: {},
|
||||||
|
farstInput: true,
|
||||||
|
form: {
|
||||||
|
deviceName: "",
|
||||||
|
deviceId: "",
|
||||||
|
prodId: "",
|
||||||
|
guid: "",
|
||||||
|
cmdKey: "",
|
||||||
|
ctlJson: "",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
ctlJson: {
|
||||||
|
handler(val, oldVal) {
|
||||||
|
if (this.ctlJson) {
|
||||||
|
this.form.ctlJson = JSON.stringify(this.ctlJson);
|
||||||
|
} else {
|
||||||
|
this.form.ctlJson = "";
|
||||||
|
}
|
||||||
|
this.reultEventFu();
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
handler(val, oldVal) {
|
||||||
|
this.reultEventFu();
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
paramsDevcie: {
|
||||||
|
handler(val, oldVal) {
|
||||||
|
this.form = this.paramsDevcie;
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.form = this.paramsDevcie;
|
||||||
|
console.log('form---', this.form)
|
||||||
|
if (this.form.deviceId) {
|
||||||
|
this.farstInput = false;
|
||||||
|
if (this.form.ctlJson) {
|
||||||
|
this.ctlJson = JSON.parse(this.form.ctlJson);
|
||||||
|
}
|
||||||
|
this.getCmdList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
reultEventFu() {
|
||||||
|
this.form.guid = this.tempIndex;
|
||||||
|
this.$emit("change", { result: this.form, index: this.tempIndex });
|
||||||
|
},
|
||||||
|
delThisInfo() {
|
||||||
|
if (this.deleteButtonD === true) {
|
||||||
|
this.msgError("至少需要一条设备数据!");
|
||||||
|
} else {
|
||||||
|
this.form.guid = this.tempIndex;
|
||||||
|
this.$emit("delInfo", this.tempIndex);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
strtoJson(str) {
|
||||||
|
return str ? JSON.parse(str.replace(/\\\"/g, '"')) : {};
|
||||||
|
},
|
||||||
|
cmdChange(val) {
|
||||||
|
this.cmdKey = val;
|
||||||
|
this.getcomdlistOption();
|
||||||
|
},
|
||||||
|
getcomdlistOption() {
|
||||||
|
this.comdlistOption = [];
|
||||||
|
const params = {
|
||||||
|
deviceId: this.form.deviceId,
|
||||||
|
cmdKey: this.cmdKey,
|
||||||
|
cmdType: "2",
|
||||||
|
};
|
||||||
|
getDeviceFunList(params).then((res) => {
|
||||||
|
var result = {};
|
||||||
|
this.comdlistOption = res.data;
|
||||||
|
if (this.farstInput) {
|
||||||
|
this.ctlJson = {};
|
||||||
|
this.comdlistOption.forEach((v) => {
|
||||||
|
if (!result[v.funKey]) {
|
||||||
|
result[v.funKey] = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.ctlJson = result;
|
||||||
|
} else {
|
||||||
|
this.ctlJson = JSON.parse(this.form.ctlJson);
|
||||||
|
this.farstInput = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 根据产品id获取分组信息 基础平台
|
||||||
|
getCmdList() {
|
||||||
|
const params = {
|
||||||
|
deviceId: this.form.deviceId,
|
||||||
|
cmdType: "2",
|
||||||
|
};
|
||||||
|
getDeviceCmdList(params).then((res) => {
|
||||||
|
debugger
|
||||||
|
this.cmdListOption = res.data;
|
||||||
|
if (this.form.cmdKey) {
|
||||||
|
this.cmdChange(this.form.cmdKey);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
deviceFocus() {
|
||||||
|
this.openTableSelectDialog();
|
||||||
|
},
|
||||||
|
// 打开设备选择窗口 ——表格
|
||||||
|
openTableSelectDialog() {
|
||||||
|
this.selectResult = {};
|
||||||
|
this.tableSelectOption = {
|
||||||
|
otherOption: {
|
||||||
|
tableType: "device",
|
||||||
|
},
|
||||||
|
queryOpt: {
|
||||||
|
disable: false,
|
||||||
|
labelWidth: "68px",
|
||||||
|
params: {
|
||||||
|
deviceName: "",
|
||||||
|
},
|
||||||
|
page: {
|
||||||
|
pageSize: 10,
|
||||||
|
pageNum: 1,
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
inline: true,
|
||||||
|
queryChilds: [
|
||||||
|
{
|
||||||
|
style: "",
|
||||||
|
placeholder: "设备名称",
|
||||||
|
clearable: true,
|
||||||
|
label: "设备名称",
|
||||||
|
type: "input",
|
||||||
|
key: "deviceName",
|
||||||
|
size: "small",
|
||||||
|
value: "",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
tableOpt: {
|
||||||
|
loading: false,
|
||||||
|
rowKey: "deviceId",
|
||||||
|
selection: false,
|
||||||
|
maxHeight: "45vh",
|
||||||
|
childs: [
|
||||||
|
{
|
||||||
|
style: "",
|
||||||
|
label: "所属型号",
|
||||||
|
type: "",
|
||||||
|
prop: "modelName",
|
||||||
|
align: "left",
|
||||||
|
width: "",
|
||||||
|
"show-overflow-tooltip": false,
|
||||||
|
tempType: "span",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
style: "",
|
||||||
|
label: "设备名称",
|
||||||
|
type: "",
|
||||||
|
prop: "deviceName",
|
||||||
|
align: "left",
|
||||||
|
width: "",
|
||||||
|
"show-overflow-tooltip": false,
|
||||||
|
tempType: "span",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
style: "",
|
||||||
|
label: "设备Key",
|
||||||
|
type: "",
|
||||||
|
prop: "deviceKey",
|
||||||
|
align: "left",
|
||||||
|
width: "",
|
||||||
|
"show-overflow-tooltip": false,
|
||||||
|
tempType: "span",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
style: "",
|
||||||
|
label: "创建时间",
|
||||||
|
type: "time",
|
||||||
|
prop: "createTime",
|
||||||
|
align: "center",
|
||||||
|
width: "160",
|
||||||
|
"show-overflow-tooltip": false,
|
||||||
|
tempType: "span",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
tableList: {
|
||||||
|
type: Array,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tableList: [],
|
||||||
|
};
|
||||||
|
this.selectTableShow = true;
|
||||||
|
},
|
||||||
|
// 点击或者双击数据回调
|
||||||
|
returnEvent(data) {
|
||||||
|
if (data.type === "dblclick") {
|
||||||
|
this.form.deviceName = data.value.deviceName;
|
||||||
|
this.form.deviceId = data.value.deviceId;
|
||||||
|
this.form.prodId = data.value.prodKey;
|
||||||
|
this.form.deviceKey = data.value.deviceKey;
|
||||||
|
this.selectTableShow = false;
|
||||||
|
this.form.cmdKey = "";
|
||||||
|
this.ctlJson = {};
|
||||||
|
this.comdlistOption = [];
|
||||||
|
this.getCmdList();
|
||||||
|
} else if (data.type === "click") {
|
||||||
|
this.selectResult = {};
|
||||||
|
this.selectResult.deviceId = data.value.deviceId;
|
||||||
|
this.selectResult.deviceName = data.value.deviceName;
|
||||||
|
this.selectResult.prodId = data.value.prodKey;
|
||||||
|
this.selectResult.deviceKey = data.value.deviceKey;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 点击确定按钮
|
||||||
|
resuleClick() {
|
||||||
|
this.form.deviceName = this.selectResult.deviceName;
|
||||||
|
this.form.deviceId = this.selectResult.deviceId;
|
||||||
|
this.form.prodId = this.selectResult.prodKey;
|
||||||
|
this.form.deviceKey = this.selectResult.deviceKey;
|
||||||
|
this.selectTableShow = false;
|
||||||
|
this.form.cmdKey = "";
|
||||||
|
this.ctlJson = {};
|
||||||
|
this.comdlistOption = [];
|
||||||
|
this.getCmdList();
|
||||||
|
},
|
||||||
|
// 查询回调
|
||||||
|
childGetList(data) {
|
||||||
|
this.deviceChildList(data);
|
||||||
|
},
|
||||||
|
deviceChildList(data) {
|
||||||
|
getDeviceList(Object.assign(data.page, data.param)).then((res) => {
|
||||||
|
this.tableSelectOption.tableList = res.rows;
|
||||||
|
this.tableSelectOption.queryOpt.page.total = Number(res.total);
|
||||||
|
this.$forceUpdate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.e-scene-param {
|
||||||
|
padding: 10px 5px;
|
||||||
|
background-color: #e4e3e3;
|
||||||
|
margin-top: 5px;
|
||||||
|
.param-wrap {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
// max-height: 200px;
|
||||||
|
overflow: auto;
|
||||||
|
/* border: 1px solid red; */
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-box-pack: start;
|
||||||
|
-ms-flex-pack: start;
|
||||||
|
justify-content: flex-start;
|
||||||
|
-ms-flex-wrap: wrap;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 10px;
|
||||||
|
margin-top: 10px;
|
||||||
|
background: #99e4f59e;
|
||||||
|
box-shadow: 0px 0px 4px #6a6c6d9e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-select v-model="value" :width="pwidth" @change="handleChange" placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="(value, keys) in optionMethod"
|
||||||
|
:key="keys"
|
||||||
|
:label="value"
|
||||||
|
:value="keys"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'selectMethod',
|
||||||
|
props: {
|
||||||
|
optionMethod:{
|
||||||
|
type: Object,
|
||||||
|
default: {}
|
||||||
|
},
|
||||||
|
pwidth: {
|
||||||
|
type: String
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: String
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleChange(v) {
|
||||||
|
this.$emit('change', v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,247 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div :style="`width: ${pwidth};`" @click="openTableSelectDialog">
|
||||||
|
<el-input
|
||||||
|
placeholder="点击选择站点"
|
||||||
|
v-model="form['deviceName']"
|
||||||
|
:clearable="pclearable"
|
||||||
|
:size="psize"
|
||||||
|
:width="pwidth"
|
||||||
|
suffix-icon="el-icon-caret-bottom"
|
||||||
|
>
|
||||||
|
</el-input>
|
||||||
|
</div>
|
||||||
|
<el-dialog
|
||||||
|
title="选择站点"
|
||||||
|
:visible.sync="selectTableShow"
|
||||||
|
width="75%"
|
||||||
|
top="10vh"
|
||||||
|
class="select-table-dialog"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
|
<select-table-wrap
|
||||||
|
v-if="selectTableShow"
|
||||||
|
:tableOption="tableSelectOption.tableOpt"
|
||||||
|
:queryOption="tableSelectOption.queryOpt"
|
||||||
|
:tableList="tableSelectOption.tableList"
|
||||||
|
@parentGetList="childGetList($event)"
|
||||||
|
:otherOption="tableSelectOption.otherOption"
|
||||||
|
@returnEvent="returnEvent($event)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button size="mini" type="primary" @click="handleSubmit"
|
||||||
|
>确 定</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
selectTableShow = false;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>取 消</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import SelectTableWrap from "@/components/SelectTable/index";
|
||||||
|
import { getDeviceList } from "@/api/app";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "ESelectDevice",
|
||||||
|
components: { SelectTableWrap },
|
||||||
|
props: {
|
||||||
|
pclearable: {
|
||||||
|
type: [Boolean, String],
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
pwidth: {
|
||||||
|
type: [String, Number],
|
||||||
|
},
|
||||||
|
psize: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
type: Object,
|
||||||
|
default: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selectTableShow: false,
|
||||||
|
selectResult: {},
|
||||||
|
selectId: null,
|
||||||
|
inputValueName: "",
|
||||||
|
slectList: [],
|
||||||
|
selectTableShow: false,
|
||||||
|
tableSelectOption: {
|
||||||
|
otherOption: {
|
||||||
|
tableType: "device",
|
||||||
|
},
|
||||||
|
queryOpt: {
|
||||||
|
disable: false,
|
||||||
|
labelWidth: "68px",
|
||||||
|
params: {
|
||||||
|
deviceName: "",
|
||||||
|
},
|
||||||
|
page: {
|
||||||
|
pageSize: 10,
|
||||||
|
pageNum: 1,
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
inline: true,
|
||||||
|
queryChilds: [
|
||||||
|
{
|
||||||
|
style: "",
|
||||||
|
placeholder: "设备名称",
|
||||||
|
clearable: true,
|
||||||
|
label: "设备名称",
|
||||||
|
type: "input",
|
||||||
|
key: "deviceName",
|
||||||
|
size: "small",
|
||||||
|
value: "",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
tableOpt: {
|
||||||
|
loading: false,
|
||||||
|
rowKey: "deviceId",
|
||||||
|
selection: false,
|
||||||
|
maxHeight: "45vh",
|
||||||
|
childs: [
|
||||||
|
{
|
||||||
|
style: "",
|
||||||
|
label: "所属型号",
|
||||||
|
type: "",
|
||||||
|
prop: "modelName",
|
||||||
|
align: "left",
|
||||||
|
width: "",
|
||||||
|
"show-overflow-tooltip": false,
|
||||||
|
tempType: "span",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
style: "",
|
||||||
|
label: "设备名称",
|
||||||
|
type: "",
|
||||||
|
prop: "deviceName",
|
||||||
|
align: "left",
|
||||||
|
width: "",
|
||||||
|
"show-overflow-tooltip": false,
|
||||||
|
tempType: "span",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
style: "",
|
||||||
|
label: "设备Key",
|
||||||
|
type: "",
|
||||||
|
prop: "deviceKey",
|
||||||
|
align: "left",
|
||||||
|
width: "",
|
||||||
|
"show-overflow-tooltip": false,
|
||||||
|
tempType: "span",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
style: "",
|
||||||
|
label: "创建时间",
|
||||||
|
type: "time",
|
||||||
|
prop: "createTime",
|
||||||
|
align: "center",
|
||||||
|
width: "160",
|
||||||
|
"show-overflow-tooltip": false,
|
||||||
|
tempType: "span",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
tableList: {
|
||||||
|
type: Array,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tableList: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
let params = {
|
||||||
|
page: {
|
||||||
|
pageSize: 10,
|
||||||
|
pageNum: 1,
|
||||||
|
},
|
||||||
|
param: Object.assign(
|
||||||
|
{
|
||||||
|
deviceName: "",
|
||||||
|
},
|
||||||
|
this.param
|
||||||
|
),
|
||||||
|
otherOption: {
|
||||||
|
tableType: "device",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
this.getSiteChildList(params, "init");
|
||||||
|
},
|
||||||
|
// 开启 筛选表格
|
||||||
|
openTableSelectDialog() {
|
||||||
|
this.selectResult = {};
|
||||||
|
this.selectTableShow = true;
|
||||||
|
},
|
||||||
|
// 查询回调
|
||||||
|
childGetList(data) {
|
||||||
|
if (data.otherOption.tableType === "device") {
|
||||||
|
this.getSiteChildList(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 查询站点列表接口
|
||||||
|
getSiteChildList(data, type) {
|
||||||
|
getDeviceList(Object.assign(data.param, this.param, data.page)).then(
|
||||||
|
(response) => {
|
||||||
|
if (response.rows.length > 0) {
|
||||||
|
this.tableSelectOption.tableList = response.rows;
|
||||||
|
this.tableSelectOption.queryOpt.page.total = Number(response.total);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
// 点击或者双击数据回调
|
||||||
|
returnEvent(data) {
|
||||||
|
this.selectResult = {};
|
||||||
|
if (data.type === "dblclick") {
|
||||||
|
if (data.otherOption.tableType === "device") {
|
||||||
|
this.form.deviceId = data.value.deviceId;
|
||||||
|
this.form.deviceName = data.value.deviceName;
|
||||||
|
}
|
||||||
|
this.selectTableShow = false;
|
||||||
|
this.$emit("input", this.form);
|
||||||
|
} else if (data.type === "click") {
|
||||||
|
if (data.otherOption.tableType === "device") {
|
||||||
|
this.selectResult = {
|
||||||
|
id: data.value.deviceId,
|
||||||
|
name: data.value.deviceName,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
this.selectResult.tableType = data.otherOption.tableType;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 点击确定按钮
|
||||||
|
handleSubmit() {
|
||||||
|
if (this.selectResult.tableType === "device") {
|
||||||
|
this.form.deviceId = this.selectResult.deviceId;
|
||||||
|
this.form.deviceName = this.selectResult.deviceName;
|
||||||
|
}
|
||||||
|
this.selectTableShow = false;
|
||||||
|
this.$emit("input", this.form);
|
||||||
|
},
|
||||||
|
// close 数据
|
||||||
|
close() {
|
||||||
|
this.form = {
|
||||||
|
id: "",
|
||||||
|
name: "",
|
||||||
|
netType: 0,
|
||||||
|
};
|
||||||
|
this.$forceUpdate();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -0,0 +1,186 @@
|
||||||
|
<template>
|
||||||
|
<div class="e-condition-temp">
|
||||||
|
<div class="top-info">
|
||||||
|
<span style="margin: 0px 8px">关系:</span>
|
||||||
|
<el-select
|
||||||
|
v-model="info.relationType"
|
||||||
|
style="width: 150px"
|
||||||
|
size="small"
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="(lable, val) in relationOptions"
|
||||||
|
:label="lable"
|
||||||
|
:value="val"
|
||||||
|
:key="val"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
<span style="margin: 0px 8px">类型:</span>
|
||||||
|
<el-select
|
||||||
|
v-model="info.funKey"
|
||||||
|
placeholder="请选择"
|
||||||
|
@change="propertChangeFu"
|
||||||
|
style="width: 150px"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="opt in propertyList"
|
||||||
|
:label="opt.funName"
|
||||||
|
:value="opt.funKey"
|
||||||
|
:key="opt.funKey"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
<span style="margin: 0px 8px"> 条件:</span>
|
||||||
|
<el-select
|
||||||
|
v-model="info.conditionType"
|
||||||
|
placeholder="请选择"
|
||||||
|
size="small"
|
||||||
|
style="width: 150px"
|
||||||
|
@change="changeTriggerCondFu(info.conditionType)"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="(proVal, proName) in trigCondEnumOptions"
|
||||||
|
:label="proVal"
|
||||||
|
:value="proName"
|
||||||
|
:key="proVal"
|
||||||
|
>{{ proVal }}</el-option
|
||||||
|
>
|
||||||
|
</el-select>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
type="danger"
|
||||||
|
style="margin-left: 5px"
|
||||||
|
plain
|
||||||
|
@click="delItemFun"
|
||||||
|
>删除此数据</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="val-info">
|
||||||
|
<div style="padding-top: 10px">
|
||||||
|
<div
|
||||||
|
v-show="info.conditionType !== 'GTB'"
|
||||||
|
style="
|
||||||
|
float: left;
|
||||||
|
margin-right: 20px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
padding-left: 10px;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
   A:
|
||||||
|
<!-- <el-input-number
|
||||||
|
v-model="info.value1"
|
||||||
|
placeholder="A"
|
||||||
|
controls-position="right"
|
||||||
|
style="width: 220px;margin-left: 5px;"
|
||||||
|
></el-input-number> -->
|
||||||
|
<el-input
|
||||||
|
v-model="info.value1"
|
||||||
|
placeholder="A"
|
||||||
|
style="width: 220px; margin-left: 5px"
|
||||||
|
></el-input>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-show="
|
||||||
|
info.conditionType === 'GTB' ||
|
||||||
|
info.conditionType === 'GTA_AND_LTB' ||
|
||||||
|
info.conditionType === 'LTA_OR_GTB'
|
||||||
|
"
|
||||||
|
style="float: left; margin-left: 5px"
|
||||||
|
>
|
||||||
|
   B:
|
||||||
|
<!-- <el-input-number
|
||||||
|
v-model="info.value2"
|
||||||
|
placeholder="B"
|
||||||
|
controls-position="right"
|
||||||
|
style="width: 220px;margin-left: 5px; "
|
||||||
|
></el-input-number> -->
|
||||||
|
<el-input
|
||||||
|
v-model="info.value2"
|
||||||
|
placeholder="B"
|
||||||
|
style="width: 220px; margin-left: 5px"
|
||||||
|
></el-input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const relationOptions = {
|
||||||
|
AND: "并且",
|
||||||
|
OR: "或者",
|
||||||
|
};
|
||||||
|
const trigCondEnumOptions = {
|
||||||
|
LTA: "数值低于A",
|
||||||
|
GTB: "数值高于B",
|
||||||
|
GTA_AND_LTB: "数值介于AB之间",
|
||||||
|
LTA_OR_GTB: "数值高于B低于A",
|
||||||
|
EQA: "数值等于A",
|
||||||
|
};
|
||||||
|
export default {
|
||||||
|
name: "ConditionTemp",
|
||||||
|
props: ["info", "propertyList", "tempIndex"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
relationOptions,
|
||||||
|
trigCondEnumOptions,
|
||||||
|
triggerMinInput: false,
|
||||||
|
triggerMaxInput: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.triggerCondFu();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
delItemFun() {
|
||||||
|
this.$emit("EventDel", this.tempIndex);
|
||||||
|
},
|
||||||
|
propertChangeFu(val) {
|
||||||
|
this.propertyList.forEach((v) => {
|
||||||
|
if (v.funKey === val) {
|
||||||
|
// this.info.funDataType = v.funDataType;
|
||||||
|
this.info.funId = v.funId;
|
||||||
|
this.info.funName = v.funName;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
changeTriggerCondFu(val) {
|
||||||
|
this.triggerCondFu(val);
|
||||||
|
},
|
||||||
|
triggerCondFu(val) {
|
||||||
|
this.triggerMaxInput = false;
|
||||||
|
this.triggerMinInput = false;
|
||||||
|
if (val === "LTA") {
|
||||||
|
this.triggerMinInput = true;
|
||||||
|
}
|
||||||
|
if (val === "GTB") {
|
||||||
|
this.triggerMaxInput = true;
|
||||||
|
}
|
||||||
|
if (val === "GTA_AND_LTB" || val === "LTA_OR_GTB") {
|
||||||
|
this.triggerMaxInput = true;
|
||||||
|
this.triggerMinInput = true;
|
||||||
|
}
|
||||||
|
if (val === "EQA") {
|
||||||
|
this.triggerMinInput = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.e-condition-temp {
|
||||||
|
width: calc(100%);
|
||||||
|
position: relative;
|
||||||
|
border: 1px solid #c6c6c6;
|
||||||
|
padding: 5px;
|
||||||
|
height: 110px;
|
||||||
|
overflow: auto;
|
||||||
|
margin-top: 10px;
|
||||||
|
.top-info {
|
||||||
|
border-bottom: 1px dotted #898788;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,209 @@
|
||||||
|
import './style.scss'
|
||||||
|
import { actionType, defaultConfig, notifierType } from "../config"
|
||||||
|
import { listContacts } from "@/api/iot/contacts";
|
||||||
|
import ESelect from './ESelect'
|
||||||
|
import ESelectDevice from './ESelectDevice'
|
||||||
|
import EDeviceParam from './EDeviceParam'
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'EExecuteAction',
|
||||||
|
props: {
|
||||||
|
dataItem: {
|
||||||
|
type: [Object]
|
||||||
|
},
|
||||||
|
inputWidth: {
|
||||||
|
type: String,
|
||||||
|
default: '200'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: { ESelect, ESelectDevice, EDeviceParam },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
method: 'DEVICE',
|
||||||
|
alarmContactList: [],
|
||||||
|
contactsList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
dataItem: {
|
||||||
|
handler(val, oldVal) {
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
contactsList: {
|
||||||
|
handler(val) {
|
||||||
|
if(val && val.length > 0) {
|
||||||
|
this.dataItem.sceneActionNotifierContacts[0].contactsRelList = val.map(v => {
|
||||||
|
return {
|
||||||
|
'contactsId': v
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.dataItem.sceneActionNotifierContacts[0].contactsRelList = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
if (this.dataItem && this.dataItem['actionType'] === 'NOTIFIER') {
|
||||||
|
this.contactsList = this.dataItem.sceneActionNotifierContacts[0].contactsRelList.map(v => {
|
||||||
|
return v['contactsId'];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (this.$refs.eCondition && this.dataItem.sceneTriggerDevices[0]['deviceId']) {
|
||||||
|
this.$refs.eCondition.getcomdlist(this.dataItem.sceneTriggerDevices[0]['deviceId']);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getAlarmContAct()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
methodChange(v) {
|
||||||
|
this.dataItem.actionType = v;
|
||||||
|
// 切换类型 必定制空其他选择项;
|
||||||
|
switch(v) {
|
||||||
|
case 'NOTIFIER':
|
||||||
|
this.dataItem.sceneActionDevices = [];
|
||||||
|
let notifierObj = {
|
||||||
|
msgType: 'SMS',
|
||||||
|
"msgServer": "电信",
|
||||||
|
"msgTemplate": "报警模板",
|
||||||
|
"actionId": null,
|
||||||
|
"sceneId": null,
|
||||||
|
"recordStatus": 0,
|
||||||
|
contactsRelList: []
|
||||||
|
}
|
||||||
|
this.dataItem.sceneActionNotifierContacts = [notifierObj];
|
||||||
|
break;
|
||||||
|
case 'DEVOUTPUT':
|
||||||
|
let devObj = {
|
||||||
|
"recordId": null,
|
||||||
|
"sceneId": null,
|
||||||
|
"ctlId": null,
|
||||||
|
"prodKey": '',
|
||||||
|
"deviceId": '',
|
||||||
|
"deviceKey": '',
|
||||||
|
"ctlJson": '',
|
||||||
|
"cmdKey": '',
|
||||||
|
"deviceName": '',
|
||||||
|
"actionId": null,
|
||||||
|
"orderBy": 0
|
||||||
|
}
|
||||||
|
this.dataItem.sceneActionDevices = [devObj];
|
||||||
|
this.dataItem.sceneActionNotifierContacts = [];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$forceUpdate();
|
||||||
|
this.$emit('change', this.dataItem);
|
||||||
|
},
|
||||||
|
handleDeviceChange(dev) {
|
||||||
|
this.dataItem.sceneActionDevices[0] = dev;
|
||||||
|
this.dataItem.conditions = [];
|
||||||
|
this.$forceUpdate();
|
||||||
|
this.$emit('change', this.dataItem);
|
||||||
|
},
|
||||||
|
handleConditionChange(ev) {
|
||||||
|
this.dataItem.conditions = [...ev];
|
||||||
|
},
|
||||||
|
notifierChange(e) {
|
||||||
|
this.dataItem.sceneActionNotifierContacts[0]['msgType'] = e;
|
||||||
|
},
|
||||||
|
// 获取报警联系人列表
|
||||||
|
getAlarmContAct() {
|
||||||
|
listContacts().then(response => {
|
||||||
|
this.alarmContactList = [];
|
||||||
|
response.rows.forEach(value => {
|
||||||
|
this.alarmContactList.push({
|
||||||
|
key: value.id,
|
||||||
|
label: value.name,
|
||||||
|
disabled: value.status === "0" ? false : true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleParamsChange(e) {
|
||||||
|
this.dataItem.sceneActionDevices[0] = e.result;
|
||||||
|
this.$forceUpdate();
|
||||||
|
this.$emit('change', this.dataItem);
|
||||||
|
},
|
||||||
|
handleDelAction() {
|
||||||
|
this.$emit('handleDel')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
render() {
|
||||||
|
const { dataItem, inputWidth } = this;
|
||||||
|
return (
|
||||||
|
<div class="e-scene-action">
|
||||||
|
{
|
||||||
|
(dataItem) ?
|
||||||
|
<div class="e-action-block">
|
||||||
|
|
||||||
|
<div class="e-block-title">
|
||||||
|
{defaultConfig.actionTitle || '--'}: { dataItem.orderBy }
|
||||||
|
<el-button type="text" class="e-button-del" onClick={this.handleDelAction}>刪除</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="action-method">
|
||||||
|
<e-select
|
||||||
|
style="margin-right: 10px;"
|
||||||
|
value={dataItem.actionType}
|
||||||
|
onChange={this.methodChange}
|
||||||
|
pwidth={inputWidth}
|
||||||
|
optionMethod={actionType} />
|
||||||
|
|
||||||
|
{( dataItem.actionType === "NOTIFIER") ?
|
||||||
|
<e-select
|
||||||
|
value={dataItem.sceneActionNotifierContacts[0]['msgType']}
|
||||||
|
onChange={this.notifierChange}
|
||||||
|
pwidth={inputWidth}
|
||||||
|
optionMethod={notifierType}
|
||||||
|
/>
|
||||||
|
: null}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{( dataItem.actionType === "DEVOUTPUT") ? <div class="action-device-param">
|
||||||
|
<e-device-param
|
||||||
|
ref="paramsWrap"
|
||||||
|
disabled={false}
|
||||||
|
deleteButtonD={false}
|
||||||
|
paramsDevcie={dataItem.sceneActionDevices[0] || {}}
|
||||||
|
onChange={this.handleParamsChange}
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
: null}
|
||||||
|
|
||||||
|
{ (dataItem.actionType === "NOTIFIER") ? <div class="action-contacts-transfer">
|
||||||
|
<el-transfer
|
||||||
|
titles={['待选', '已选']}
|
||||||
|
filterable
|
||||||
|
filter-placeholder="请输入名称"
|
||||||
|
v-model={this.contactsList}
|
||||||
|
data={this.alarmContactList}
|
||||||
|
></el-transfer>
|
||||||
|
</div> : null }
|
||||||
|
|
||||||
|
{
|
||||||
|
(dataItem.actionType === "NOTIFIER" && dataItem.sceneActionNotifierContacts[0].contactsRelList.length === 0) ?
|
||||||
|
<span class="e-form-item__error">* 未选择任何联系人...</span>
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
(dataItem.actionType === "DEVOUTPUT" &&
|
||||||
|
(dataItem.sceneActionDevices[0] &&
|
||||||
|
(!dataItem.sceneActionDevices[0]['cmdKey'] &&
|
||||||
|
!dataItem.sceneActionDevices[0]['cmdKey']))) ?
|
||||||
|
<span class="e-form-item__error">* 未选择设备或者分组...</span>
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
import './style.scss'
|
||||||
|
import { triggerMethod, defaultConfig } from "../config"
|
||||||
|
import selectMethod from './ESelect'
|
||||||
|
import ESelectDevice from './ESelectDevice'
|
||||||
|
import EConditionTemp from './EConditionTemp'
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ESceneTriggers',
|
||||||
|
props: {
|
||||||
|
dataItem: {
|
||||||
|
type: [Object]
|
||||||
|
},
|
||||||
|
inputWidth: {
|
||||||
|
type: String,
|
||||||
|
default: '200'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: { selectMethod, ESelectDevice, EConditionTemp },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
method: 'DEVICE'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
if (this.$refs.eCondition && this.dataItem.sceneTriggerDevices[0]['deviceId']) {
|
||||||
|
this.$refs.eCondition.getcomdlist(this.dataItem.sceneTriggerDevices[0]['deviceId']);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
methodChange(v) {
|
||||||
|
this.dataItem.method = v;
|
||||||
|
// 切换类型 必定制空其他选择项;
|
||||||
|
this.dataItem.sceneTriggerDevices = [];
|
||||||
|
this.dataItem.conditions = [];
|
||||||
|
|
||||||
|
this.$forceUpdate();
|
||||||
|
this.$emit('change', this.dataItem);
|
||||||
|
},
|
||||||
|
handleDeviceChange(dev) {
|
||||||
|
this.dataItem.sceneTriggerDevices[0] = dev;
|
||||||
|
this.dataItem.conditions = [];
|
||||||
|
this.handleAddCondition();
|
||||||
|
this.$forceUpdate();
|
||||||
|
this.$emit('change', this.dataItem);
|
||||||
|
},
|
||||||
|
handleConditionChange(ev) {
|
||||||
|
this.dataItem.conditions = [...ev];
|
||||||
|
},
|
||||||
|
handleAddCondition() {
|
||||||
|
let form = {
|
||||||
|
"triggerId": this.dataItem.triggerId || undefined,
|
||||||
|
"relationType": "AND",
|
||||||
|
"conditionType": "GTB",
|
||||||
|
"value1": "",
|
||||||
|
"value2": "",
|
||||||
|
"funId": null,
|
||||||
|
"funKey": '',
|
||||||
|
"funName": "",
|
||||||
|
orderBy: this.dataItem.conditions.length || 1
|
||||||
|
}
|
||||||
|
this.dataItem.conditions.push(form);
|
||||||
|
},
|
||||||
|
handleDelTrigger() {
|
||||||
|
this.$emit('handleDel')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
render() {
|
||||||
|
const { dataItem, inputWidth } = this;
|
||||||
|
return (
|
||||||
|
<div class="e-scene-trigger">
|
||||||
|
{
|
||||||
|
(dataItem) ?
|
||||||
|
<div class="e-trigger-block">
|
||||||
|
|
||||||
|
<div class="e-trigger-title">
|
||||||
|
{defaultConfig.title || '--'}: { dataItem.orderBy }
|
||||||
|
<el-button type="text" class="e-button-del" onClick={this.handleDelTrigger}>刪除</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="b-method">
|
||||||
|
<select-method
|
||||||
|
value={dataItem.method}
|
||||||
|
onChange={this.methodChange}
|
||||||
|
pwidth={inputWidth}
|
||||||
|
optionMethod={triggerMethod} />
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
dataItem.method === 'DEVICE' ?
|
||||||
|
<div>
|
||||||
|
<div class="b-select-device">
|
||||||
|
<e-select-device
|
||||||
|
form={dataItem.sceneTriggerDevices[0] || {}}
|
||||||
|
onInput={this.handleDeviceChange}
|
||||||
|
pwidth={inputWidth}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="b-condition">
|
||||||
|
<e-condition-temp
|
||||||
|
ref="eCondition"
|
||||||
|
conditionList={dataItem.conditions}
|
||||||
|
sourceId={ dataItem.sceneTriggerDevices[0] ? dataItem.sceneTriggerDevices[0]['deviceId'] : ''}
|
||||||
|
onChange={this.handleConditionChange}
|
||||||
|
/>
|
||||||
|
<el-button type="text" onClick={this.handleAddCondition}>添加</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
.e-scene-trigger {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
font-size: 14px;
|
||||||
|
font-family: 'Source Han Sans CN';
|
||||||
|
font-weight: 400;
|
||||||
|
color: #344567;
|
||||||
|
}
|
||||||
|
.e-scene-trigger.e-trigger-block {
|
||||||
|
min-height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.e-block-title {
|
||||||
|
height: 35px;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.b-method {
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.b-select-device {
|
||||||
|
margin: 5px 0;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.e-scene-action {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
.e-scene-action .action-method {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
.e-scene-action .action-contacts-transfer {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.e-scene-action .action-device-param {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.e-form-item__error {
|
||||||
|
color: #ff4949;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.e-button-del {
|
||||||
|
color: #ff4949;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
|
@ -0,0 +1,566 @@
|
||||||
|
<template>
|
||||||
|
<div class="e-scene-manage">
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
<el-button @click="handleQuery" size="mini">刷新</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<div class="e-alarm-table">
|
||||||
|
<el-table
|
||||||
|
v-loading="tableLoading"
|
||||||
|
:data="tableList"
|
||||||
|
:height="total > 0 ? '530px' : '270px'"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
type="index"
|
||||||
|
label="序号"
|
||||||
|
align="center"
|
||||||
|
:index="indexFormatter"
|
||||||
|
width="80px"
|
||||||
|
></el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="场景名称"
|
||||||
|
width="200px"
|
||||||
|
align="left"
|
||||||
|
prop="sceneName"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.sceneName">
|
||||||
|
{{ scope.row.sceneName }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="场景模式"
|
||||||
|
align="left"
|
||||||
|
width="120"
|
||||||
|
prop="relation"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.relation">
|
||||||
|
{{ scope.row.relation }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="状态"
|
||||||
|
width="150px"
|
||||||
|
align="center"
|
||||||
|
prop="runStatus"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea">
|
||||||
|
{{ scope.row.runStatus ? "启用" : "停止" }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="执行设备" align="left" prop="triggerDevices">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.triggerDevices">
|
||||||
|
{{ scope.row.triggerDevices }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
width="200"
|
||||||
|
prop="alarmTime"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
>编辑</el-button
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
|
|
||||||
|
<!-- <el-button size="mini" type="text" icon="el-icon-search"
|
||||||
|
>详情</el-button
|
||||||
|
> -->
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="page.pageNum"
|
||||||
|
:limit.sync="page.pageSize"
|
||||||
|
@pagination="getTableList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="e-dialog">
|
||||||
|
<!-- 添加或修改建筑类型对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
:title="title"
|
||||||
|
:visible="open"
|
||||||
|
@close="open = false"
|
||||||
|
class="eldialog-wrap"
|
||||||
|
width="880px"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="场景名称:" prop="sceneName">
|
||||||
|
<el-input
|
||||||
|
v-model="form.sceneName"
|
||||||
|
placeholder="请输入场景名称"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="场景编码:" prop="sceneCode">
|
||||||
|
<el-input
|
||||||
|
v-model="form.sceneCode"
|
||||||
|
placeholder="请输入场景编码"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="24">
|
||||||
|
<el-form-item label="描述" prop="buildingTypeName">
|
||||||
|
<el-input
|
||||||
|
v-model="form.buildingTypeName"
|
||||||
|
placeholder="请输入类型名称"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col> -->
|
||||||
|
<el-col :span="24">
|
||||||
|
<span
|
||||||
|
class="e-form-item__label"
|
||||||
|
style="
|
||||||
|
text-align: right;
|
||||||
|
vertical-align: middle;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
width: 80px;
|
||||||
|
word-break: break-all;
|
||||||
|
font-weight: 600;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
触发器列表:
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<e-tag-card
|
||||||
|
style="margin-top: 5px"
|
||||||
|
v-for="(item, idx) in form.triggers"
|
||||||
|
:key="idx"
|
||||||
|
type="info"
|
||||||
|
>
|
||||||
|
<e-scene-triggers
|
||||||
|
slot="body"
|
||||||
|
:dataItem="item"
|
||||||
|
@change="
|
||||||
|
(v) => {
|
||||||
|
form.triggers[idx] = v;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
@handleDel="
|
||||||
|
(v) => {
|
||||||
|
form.triggers.splice(idx, 1);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
></e-scene-triggers>
|
||||||
|
</e-tag-card>
|
||||||
|
</div>
|
||||||
|
<el-button
|
||||||
|
icon="el-icon-plus"
|
||||||
|
type="text"
|
||||||
|
@click="handleAddTrigger"
|
||||||
|
>新增触发器</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<div>
|
||||||
|
<span
|
||||||
|
class="e-form-item__label"
|
||||||
|
style="
|
||||||
|
text-align: right;
|
||||||
|
vertical-align: middle;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
width: 80px;
|
||||||
|
word-break: break-all;
|
||||||
|
font-weight: 600;
|
||||||
|
"
|
||||||
|
>执行动作:</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<e-tag-card
|
||||||
|
style="margin-top: 5px"
|
||||||
|
v-for="(item, idx) in form.actions"
|
||||||
|
:key="idx"
|
||||||
|
type="info"
|
||||||
|
>
|
||||||
|
<e-scene-action
|
||||||
|
slot="body"
|
||||||
|
:dataItem="item"
|
||||||
|
@change="
|
||||||
|
(v) => {
|
||||||
|
form.actions[idx] = v;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
@handleDel="
|
||||||
|
(v) => {
|
||||||
|
form.actions.splice(idx, 1);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</e-tag-card>
|
||||||
|
</div>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="handleAddAction"
|
||||||
|
>新增动作</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
projectSceneList,
|
||||||
|
projectSceneAdd,
|
||||||
|
projectSceneUpdate,
|
||||||
|
projectSceneDetail,
|
||||||
|
projectSceneDelete
|
||||||
|
} from "@/api/iot/project_new";
|
||||||
|
import DialogTemplate from "@/components/DialogTemplate";
|
||||||
|
import ESceneTriggers from "./ESceneTriggers/index";
|
||||||
|
import ETagCard from "@/components/Cards/ETagCard";
|
||||||
|
import ESceneAction from "./ESceneTriggers/action";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "ESceneManage",
|
||||||
|
props: {
|
||||||
|
projectInfo: {
|
||||||
|
type: Object,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
sourceId: {
|
||||||
|
type: [Number, String],
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
tempType: {
|
||||||
|
type: String,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
isFoldRight: {
|
||||||
|
type: Boolean,
|
||||||
|
default: () => {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
isShrink: {
|
||||||
|
type: Boolean,
|
||||||
|
default: () => {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: { DialogTemplate, ESceneTriggers, ETagCard, ESceneAction },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
queryParams: {},
|
||||||
|
page: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
title: "新增场景",
|
||||||
|
total: 0,
|
||||||
|
tableList: [],
|
||||||
|
tableLoading: false,
|
||||||
|
open: false,
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
sceneName: [
|
||||||
|
{ required: true, message: "场景名称不能为空", trigger: "change" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
isFoldRight() {
|
||||||
|
this.$forceUpdate();
|
||||||
|
},
|
||||||
|
isShrink() {
|
||||||
|
this.$forceUpdate();
|
||||||
|
},
|
||||||
|
sourceId(val) {
|
||||||
|
if (val !== null && val !== undefined) {
|
||||||
|
this.handleQuery();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tempType(val) {
|
||||||
|
if (val) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
created() {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleAddAction() {
|
||||||
|
let obj = {
|
||||||
|
orderBy: this.form.actions.length + 1 || 1,
|
||||||
|
recordStatus: 0,
|
||||||
|
actionId: null,
|
||||||
|
sceneId: this.form.recordId || null,
|
||||||
|
actionType: "DEVOUTPUT",
|
||||||
|
actionAttr: null,
|
||||||
|
sceneActionDevices: [],
|
||||||
|
sceneActionNotifierContacts: [],
|
||||||
|
};
|
||||||
|
this.form.actions.push(obj);
|
||||||
|
},
|
||||||
|
handleAddTrigger() {
|
||||||
|
let obj = {
|
||||||
|
orderBy: this.form.triggers.length + 1 || 1,
|
||||||
|
method: "",
|
||||||
|
conditions: [],
|
||||||
|
intervalVal: 61,
|
||||||
|
intervalUnit: "SECONDS",
|
||||||
|
sceneTriggerDevices: [],
|
||||||
|
};
|
||||||
|
this.form.triggers.push(obj);
|
||||||
|
},
|
||||||
|
// 验证 触发器 条件
|
||||||
|
validateTrigger() {
|
||||||
|
if (!this.form.triggers || this.form.triggers.length <= 0) {
|
||||||
|
this.msgError("至少有一条触发器!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.form.triggers.forEach(e => {
|
||||||
|
if (e.method === 'DEVICE' && (!e.conditions || e.conditions.length <= 0 )) {
|
||||||
|
this.msgError("设备触发__至少选择一条设备以及触发条件!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
// 验证 执行条件
|
||||||
|
validateAction() {
|
||||||
|
if (!this.form.actions || this.form.actions.length <= 0) {
|
||||||
|
this.msgError("至少有一执行条件!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.form.actions.forEach(e => {
|
||||||
|
if (e.actionType === 'DEVOUTPUT' && (
|
||||||
|
e.sceneActionDevices[0] && (!e.sceneActionDevices[0]['cmdKey'] || !e.sceneActionDevices[0]['deviceKey'] )
|
||||||
|
)) {
|
||||||
|
this.msgError("执行条件中有条件未选择设备或者分组!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (e.actionType === 'NOTIFIER' &&
|
||||||
|
(!e.sceneActionNotifierContacts[0] || !e.sceneActionNotifierContacts[0]['contactsRelList'])) {
|
||||||
|
this.msgError("执行条件中有条件未选择联系人!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
submitForm() {
|
||||||
|
console.log("submit---", this.form);
|
||||||
|
this.$refs["form"].validate((valid) => {
|
||||||
|
if (valid && this.validateTrigger() && this.validateAction()) {
|
||||||
|
if (this.form.recordId != null) {
|
||||||
|
projectSceneUpdate(this.form).then((response) => {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.handleQuery();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
projectSceneAdd(this.form).then((response) => {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.handleQuery();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
indexFormatter(val) {
|
||||||
|
return val + 1 + (this.page.pageNum - 1) * this.page.pageSize;
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.title = "新增场景";
|
||||||
|
this.open = true;
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
projectSceneDetail(row.recordId).then((response) => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "编辑场景";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
const projectIds = row.recordId;
|
||||||
|
this.$confirm("是否删除该选项?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
.then(function() {
|
||||||
|
return projectSceneDelete(projectIds);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.handleQuery();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
recordId: null,
|
||||||
|
recordStatus: 0,
|
||||||
|
buildingTypeCode: null,
|
||||||
|
buildingTypeName: null,
|
||||||
|
triggers: [],
|
||||||
|
actions: [],
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
init() {
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
this.page.pageNum = 1;
|
||||||
|
this.getTableList();
|
||||||
|
},
|
||||||
|
// 查询 表格 数据
|
||||||
|
getTableList() {
|
||||||
|
this.tableLoading = true;
|
||||||
|
let query = JSON.parse(JSON.stringify(this.queryParams));
|
||||||
|
projectSceneList(
|
||||||
|
Object.assign(
|
||||||
|
query,
|
||||||
|
{
|
||||||
|
projectId: this.sourceId,
|
||||||
|
},
|
||||||
|
this.page
|
||||||
|
)
|
||||||
|
).then((res) => {
|
||||||
|
this.tableList = res.rows;
|
||||||
|
this.tableLoading = false;
|
||||||
|
this.total = res.total;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.e-scene-manage {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
.e-alarm-heard {
|
||||||
|
width: 100%;
|
||||||
|
height: 40px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
.heard-query {
|
||||||
|
width: 50%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
.data-type {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
background: #f4f5f7;
|
||||||
|
border-radius: 50%;
|
||||||
|
font-size: 14px;
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #6b778c;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
margin: 0 5px;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
.data-type-selected {
|
||||||
|
background: #1890ff;
|
||||||
|
color: #f4f5f7;
|
||||||
|
}
|
||||||
|
.other-query {
|
||||||
|
display: flex;
|
||||||
|
width: 420px;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.other-print {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
.other-print:hover {
|
||||||
|
color: #1890ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.e-alarm-echarts {
|
||||||
|
width: 100%;
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
.e-alarm-table {
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
.pagination-container {
|
||||||
|
margin-top: 5px;
|
||||||
|
height: 35px;
|
||||||
|
}
|
||||||
|
.e-form-item__label {
|
||||||
|
text-align: right;
|
||||||
|
vertical-align: middle;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
width: 80px;
|
||||||
|
word-break: break-all;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -215,6 +215,7 @@ import EEnergyLoad from "./EnergyManage/EEnergyLoad";
|
||||||
|
|
||||||
import { initMap, gjzCode } from "@/utils/latlngFromAddress";
|
import { initMap, gjzCode } from "@/utils/latlngFromAddress";
|
||||||
import ShopLocation from "@/components/Amap/components/shopLocation/index";
|
import ShopLocation from "@/components/Amap/components/shopLocation/index";
|
||||||
|
import ESceneManage from './ESceneManage/index'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "projectDetailV2",
|
name: "projectDetailV2",
|
||||||
|
@ -238,6 +239,7 @@ export default {
|
||||||
EElectricity,
|
EElectricity,
|
||||||
EEnergyLoad,
|
EEnergyLoad,
|
||||||
ShopLocation,
|
ShopLocation,
|
||||||
|
ESceneManage
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
sourceId: {
|
sourceId: {
|
||||||
|
@ -356,6 +358,18 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "综合管理",
|
||||||
|
key: "synthesizeManage",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
label: "场景控制",
|
||||||
|
key: "sceneManage",
|
||||||
|
template: "ESceneManage",
|
||||||
|
},
|
||||||
|
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
projectTypeOptions: [],
|
projectTypeOptions: [],
|
||||||
infoData: {},
|
infoData: {},
|
||||||
|
|
|
@ -0,0 +1,348 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<!-- <el-form-item label="记录id" prop="recordId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.recordId"
|
||||||
|
placeholder="请输入记录id"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item> -->
|
||||||
|
<!-- <el-form-item label="记录状态" prop="recordStatus">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.recordStatus"
|
||||||
|
placeholder="请选择记录状态"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option label="请选择字典生成" value="" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="属性值" prop="attributeValue">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.attributeValue"
|
||||||
|
placeholder="请输入属性值"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<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-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:attribute:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:attribute:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
</el-col> -->
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:attribute:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:attribute:export']"
|
||||||
|
>导出</el-button
|
||||||
|
>
|
||||||
|
</el-col> -->
|
||||||
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="attributeList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
|
<!-- <el-table-column label="序号" align="center" prop="index" width="50" /> -->
|
||||||
|
<!-- <el-table-column label="记录id" align="center" prop="recordId" /> -->
|
||||||
|
<!-- <el-table-column label="记录状态" align="center" prop="recordStatus" /> -->
|
||||||
|
<el-table-column
|
||||||
|
label="属性KEY"
|
||||||
|
align="center"
|
||||||
|
prop="enterpriseAttribute"
|
||||||
|
/>
|
||||||
|
<el-table-column label="属性值" align="center" prop="attributeValue" />
|
||||||
|
<!-- <el-table-column label="租户id" align="center" prop="tenantId" /> -->
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
width="200"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:attribute:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:attribute:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改企业属性对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" class="eldialog-wrap" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="属性KEY" prop="enterpriseAttribute">
|
||||||
|
<el-input v-model="form.enterpriseAttribute" placeholder="请输入属性KEY" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="属性值" prop="attributeValue">
|
||||||
|
<el-input v-model="form.attributeValue" placeholder="请输入属性值" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
listAttribute,
|
||||||
|
getAttribute,
|
||||||
|
delAttribute,
|
||||||
|
addAttribute,
|
||||||
|
updateAttribute,
|
||||||
|
exportAttribute,
|
||||||
|
} from "@/api/system/attribute";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Attribute",
|
||||||
|
components: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 企业属性表格数据
|
||||||
|
attributeList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
recordId: null,
|
||||||
|
recordStatus: null,
|
||||||
|
attributeValue: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
enterpriseAttribute: [
|
||||||
|
{ required: true, message: "属性KEY不能为空", trigger: "change" },
|
||||||
|
],
|
||||||
|
attributeValue: [
|
||||||
|
{ required: true, message: "属性值不能为空", trigger: "change" },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询企业属性列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listAttribute(this.queryParams).then((response) => {
|
||||||
|
this.attributeList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
recordId: null,
|
||||||
|
recordStatus: 0,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
enterpriseAttribute: null,
|
||||||
|
attributeValue: null,
|
||||||
|
tenantId: null,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map((item) => item.recordId);
|
||||||
|
this.single = selection.length !== 1;
|
||||||
|
this.multiple = !selection.length;
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加企业属性";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const enterpriseAttribute = row.recordId || this.ids;
|
||||||
|
getAttribute(enterpriseAttribute).then((response) => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改企业属性";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.recordId != null) {
|
||||||
|
updateAttribute(this.form).then((response) => {
|
||||||
|
this.$router.go(0);
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
// this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addAttribute(this.form).then((response) => {
|
||||||
|
this.$router.go(0);
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
// this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const enterpriseAttributes = row.recordId || this.ids;
|
||||||
|
this.$confirm("是否删除该选项?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return delAttribute(enterpriseAttributes);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
const queryParams = this.queryParams;
|
||||||
|
this.$confirm("是否确认导出所有企业属性数据项?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return exportAttribute(queryParams);
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
this.download(response.msg);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in New Issue