提交: 优化配置管理更改后 刷新页面生效改为实时生效。优化 场景管理页中一些问题, 添加开启/停止,场景 操作
This commit is contained in:
parent
df2929ba2e
commit
af48e107ee
|
@ -206,3 +206,12 @@ export function projectSceneDelete(siteId) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询 场景控制 修改状态
|
||||||
|
export function projectSceneChangeStatus(data) {
|
||||||
|
return request({
|
||||||
|
url: '/iot/scene/changeStatus',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@
|
||||||
:total="queryOption.page.total"
|
:total="queryOption.page.total"
|
||||||
:page.sync="queryOption.page.pageNum"
|
:page.sync="queryOption.page.pageNum"
|
||||||
:limit.sync="queryOption.page.pageSize"
|
:limit.sync="queryOption.page.pageSize"
|
||||||
@pagination="handleQuery2"
|
@pagination="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
@ -219,7 +219,7 @@ export default {
|
||||||
},
|
},
|
||||||
updated() {
|
updated() {
|
||||||
if (this.optionTrue && this.tableList.length <= 0) {
|
if (this.optionTrue && this.tableList.length <= 0) {
|
||||||
this.handleQuery2();
|
this.handleQuery();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -239,13 +239,8 @@ export default {
|
||||||
this.optionTrue = false
|
this.optionTrue = false
|
||||||
this.getList(this.queryOption.page, this.queryOption.params);
|
this.getList(this.queryOption.page, this.queryOption.params);
|
||||||
},
|
},
|
||||||
handleQuery2() {
|
|
||||||
this.optionTrue = false
|
|
||||||
this.getList(this.queryOption.page, this.queryOption.params);
|
|
||||||
},
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.dataList = [];
|
|
||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
this.queryOption.page.pageNum = 1;
|
this.queryOption.page.pageNum = 1;
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
|
@ -275,12 +270,16 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.params = this.queryOption.params;
|
this.params = this.queryOption.params;
|
||||||
this.handleQuery2();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
tableList(value) {
|
tableList: {
|
||||||
this.dataList = value;
|
handler(val) {
|
||||||
|
console.log('tableList--updata', val);
|
||||||
|
this.dataList = [...val];
|
||||||
this.tableOption.loading = false;
|
this.tableOption.loading = false;
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,9 +19,9 @@ 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) => {
|
SET_ATTRIBUTE: (state, atribute) => {
|
||||||
state.attribute = size
|
state.attribute = atribute
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
// 生成路由
|
// 生成路由
|
||||||
|
@ -34,6 +34,14 @@ const permission = {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 根据对象 属性更新
|
||||||
|
SetAttributeByKey({ commit, state }, params) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
// 向后端请求路由数据
|
||||||
|
console.log('請求--GetAttribute')
|
||||||
|
commit('SET_ATTRIBUTE', Object.assign(state.attribute, params))
|
||||||
|
})
|
||||||
|
},
|
||||||
// 生成路由
|
// 生成路由
|
||||||
GenerateRoutes({ commit }) {
|
GenerateRoutes({ commit }) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
|
|
@ -217,26 +217,30 @@ export default {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: left;
|
-webkit-box-pack: left;
|
||||||
|
-ms-flex-pack: left;
|
||||||
border: 1px solid #e9e9e9;
|
border: 1px solid #e9e9e9;
|
||||||
border-radius: 0 50% 50% 0;
|
border-radius: 50%;
|
||||||
position: relative;
|
position: relative;
|
||||||
left: 40px;
|
font-size: 14px;
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
border-left: 0;
|
top: -10px;
|
||||||
top: -14px;
|
justify-content: center;
|
||||||
|
background: #ffffff;
|
||||||
}
|
}
|
||||||
.e-shrink:hover {
|
.e-shrink:hover {
|
||||||
border-color: #4395ff;
|
border-color: #4395ff;
|
||||||
color: #4395ff;
|
color: #4395ff;
|
||||||
}
|
}
|
||||||
.is-shrink-true {
|
.is-shrink-true {
|
||||||
left: 40px;
|
left: 30px;
|
||||||
}
|
}
|
||||||
.is-shrink-false {
|
.is-shrink-false {
|
||||||
left: 100%;
|
left: 100%;
|
||||||
|
left: calc(100% - 10px);
|
||||||
}
|
}
|
||||||
.nav-menu-item {
|
.nav-menu-item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -11,5 +11,7 @@ export const defaultConfig = {
|
||||||
|
|
||||||
export const notifierType = {
|
export const notifierType = {
|
||||||
SMS: '短信',
|
SMS: '短信',
|
||||||
WEEXIN: '微信'
|
WECHAT: '微信',
|
||||||
|
EMAIL: '邮件',
|
||||||
|
VOICE: '语音'
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(keys, valus) in strtoJson(paramsItem.funObj)"
|
v-for="(keys, valus) in strtoJson(paramsItem.funObj)"
|
||||||
:key="getGuid()"
|
:key="valus + getGuid()"
|
||||||
:label="keys"
|
:label="keys"
|
||||||
:value="valus"
|
:value="valus"
|
||||||
></el-option>
|
></el-option>
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="选择"
|
title="选择设备"
|
||||||
:visible.sync="selectTableShow"
|
:visible.sync="selectTableShow"
|
||||||
width="75%"
|
width="75%"
|
||||||
top="10vh"
|
top="10vh"
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
v-if="selectTableShow"
|
v-if="selectTableShow"
|
||||||
:tableOption="tableSelectOption.tableOpt"
|
:tableOption="tableSelectOption.tableOpt"
|
||||||
:queryOption="tableSelectOption.queryOpt"
|
:queryOption="tableSelectOption.queryOpt"
|
||||||
:tableList="tableSelectOption.tableList"
|
:tableList="tableList"
|
||||||
@parentGetList="childGetList($event)"
|
@parentGetList="childGetList($event)"
|
||||||
:otherOption="tableSelectOption.otherOption"
|
:otherOption="tableSelectOption.otherOption"
|
||||||
@returnEvent="returnEvent($event)"
|
@returnEvent="returnEvent($event)"
|
||||||
|
@ -161,7 +161,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
SelectTableWrap,
|
SelectTableWrap,
|
||||||
},
|
},
|
||||||
props: ["paramsDevcie", "tempIndex", "deleteButtonD", "disabled"],
|
props: ["paramsDevcie", "tempIndex", "deleteButtonD", "disabled", 'sourceId'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableSelectOption: {},
|
tableSelectOption: {},
|
||||||
|
@ -171,6 +171,7 @@ export default {
|
||||||
comdlistOption: [],
|
comdlistOption: [],
|
||||||
cmdKey: "",
|
cmdKey: "",
|
||||||
ctlJson: {},
|
ctlJson: {},
|
||||||
|
tableList: [],
|
||||||
farstInput: true,
|
farstInput: true,
|
||||||
form: {
|
form: {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
|
@ -289,6 +290,7 @@ export default {
|
||||||
labelWidth: "68px",
|
labelWidth: "68px",
|
||||||
params: {
|
params: {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
|
projectId: this.sourceId
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -403,6 +405,7 @@ export default {
|
||||||
deviceChildList(data) {
|
deviceChildList(data) {
|
||||||
getDeviceList(Object.assign(data.page, data.param)).then((res) => {
|
getDeviceList(Object.assign(data.page, data.param)).then((res) => {
|
||||||
this.tableSelectOption.tableList = res.rows;
|
this.tableSelectOption.tableList = res.rows;
|
||||||
|
this.tableList = res.rows;
|
||||||
this.tableSelectOption.queryOpt.page.total = Number(res.total);
|
this.tableSelectOption.queryOpt.page.total = Number(res.total);
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
});
|
});
|
||||||
|
@ -412,8 +415,8 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.e-scene-param {
|
.e-scene-param {
|
||||||
padding: 10px 5px;
|
padding: 0 5px 10px 5px;
|
||||||
background-color: #e4e3e3;
|
// background-color: #e4e3e3;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
.param-wrap {
|
.param-wrap {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
|
@ -14,7 +14,11 @@ export default {
|
||||||
inputWidth: {
|
inputWidth: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '200'
|
default: '200'
|
||||||
}
|
},
|
||||||
|
sourceId: {
|
||||||
|
type: [Number, String],
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: { ESelect, EDeviceParam },
|
components: { ESelect, EDeviceParam },
|
||||||
data() {
|
data() {
|
||||||
|
@ -132,7 +136,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
const { dataItem, inputWidth } = this;
|
const { dataItem, inputWidth, sourceId } = this;
|
||||||
return (
|
return (
|
||||||
<div class="e-scene-action">
|
<div class="e-scene-action">
|
||||||
{
|
{
|
||||||
|
@ -166,6 +170,7 @@ export default {
|
||||||
<e-device-param
|
<e-device-param
|
||||||
ref="paramsWrap"
|
ref="paramsWrap"
|
||||||
disabled={false}
|
disabled={false}
|
||||||
|
sourceId={sourceId}
|
||||||
deleteButtonD={false}
|
deleteButtonD={false}
|
||||||
paramsDevcie={dataItem.sceneActionDevices[0] || {}}
|
paramsDevcie={dataItem.sceneActionDevices[0] || {}}
|
||||||
onChange={this.handleParamsChange}
|
onChange={this.handleParamsChange}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<easy-cron
|
||||||
|
:hideSecond="false"
|
||||||
|
:disabled="false"
|
||||||
|
style="width: 100%;"
|
||||||
|
v-model="stateValue"
|
||||||
|
:exeStartTime="exeStartTime"
|
||||||
|
></easy-cron>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import EasyCron from "@/components/EasyCron";
|
||||||
|
import CronValidator from "@/components/EasyCron/validator";
|
||||||
|
export default {
|
||||||
|
name: 'ECronForm',
|
||||||
|
components: {
|
||||||
|
EasyCron,
|
||||||
|
CronValidator
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
exeStartTime: {
|
||||||
|
type: [Number, String, Date],
|
||||||
|
default: () => {
|
||||||
|
this.parseTime(new Date(), "{y}-{m}-{d} {h}:{i}:{s}")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value() {
|
||||||
|
this.stateValue = this.value || '* * * * * ? *';
|
||||||
|
},
|
||||||
|
stateValue() {
|
||||||
|
this.$emit('change', this.stateValue);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
stateValue: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
|
@ -2,7 +2,7 @@
|
||||||
<div>
|
<div>
|
||||||
<div :style="`width: ${pwidth};`" @click="openTableSelectDialog">
|
<div :style="`width: ${pwidth};`" @click="openTableSelectDialog">
|
||||||
<el-input
|
<el-input
|
||||||
placeholder="点击选择站点"
|
placeholder="点击选择设备"
|
||||||
v-model="form['deviceName']"
|
v-model="form['deviceName']"
|
||||||
:clearable="pclearable"
|
:clearable="pclearable"
|
||||||
:size="psize"
|
:size="psize"
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="选择站点"
|
title="选择设备"
|
||||||
:visible.sync="selectTableShow"
|
:visible.sync="selectTableShow"
|
||||||
width="75%"
|
width="75%"
|
||||||
top="10vh"
|
top="10vh"
|
||||||
|
@ -70,6 +70,11 @@ export default {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {},
|
default: {},
|
||||||
},
|
},
|
||||||
|
param: {
|
||||||
|
type: Object,
|
||||||
|
require: false,
|
||||||
|
default: {}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -3,8 +3,7 @@ import { triggerMethod, defaultConfig } from "../config"
|
||||||
import selectMethod from './ESelect'
|
import selectMethod from './ESelect'
|
||||||
import ESelectDevice from './ESelectDevice'
|
import ESelectDevice from './ESelectDevice'
|
||||||
import EConditionTemp from './EConditionTemp'
|
import EConditionTemp from './EConditionTemp'
|
||||||
import EasyCron from "@/components/EasyCron";
|
import ECronForm from './ECronForm'
|
||||||
import CronValidator from "@/components/EasyCron/validator";
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -16,13 +15,18 @@ export default {
|
||||||
inputWidth: {
|
inputWidth: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '200'
|
default: '200'
|
||||||
}
|
|
||||||
},
|
},
|
||||||
components: { selectMethod, ESelectDevice, EConditionTemp, EasyCron },
|
sourceId: {
|
||||||
|
type: [Number, String],
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: { selectMethod, ESelectDevice, EConditionTemp, ECronForm },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
method: 'DEVICE',
|
method: 'DEVICE',
|
||||||
exeStartTime: "",
|
exeStartTime: "",
|
||||||
|
open: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -68,9 +72,15 @@ export default {
|
||||||
handleDelTrigger() {
|
handleDelTrigger() {
|
||||||
this.$emit('handleDel')
|
this.$emit('handleDel')
|
||||||
},
|
},
|
||||||
|
handleCronSubmit() {
|
||||||
|
if (!this.dataItem['execScript']) {
|
||||||
|
this.dataItem['execScript'] = '* * * * * ? *';
|
||||||
|
}
|
||||||
|
this.open = false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
const { dataItem, inputWidth } = this;
|
const { dataItem, inputWidth, sourceId } = this;
|
||||||
return (
|
return (
|
||||||
<div class="e-scene-trigger">
|
<div class="e-scene-trigger">
|
||||||
{
|
{
|
||||||
|
@ -95,6 +105,7 @@ export default {
|
||||||
<div class="b-select-device">
|
<div class="b-select-device">
|
||||||
<e-select-device
|
<e-select-device
|
||||||
form={dataItem.sceneTriggerDevices[0] || {}}
|
form={dataItem.sceneTriggerDevices[0] || {}}
|
||||||
|
param={{projectId: sourceId}}
|
||||||
onInput={this.handleDeviceChange}
|
onInput={this.handleDeviceChange}
|
||||||
pwidth={inputWidth}/>
|
pwidth={inputWidth}/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -115,15 +126,35 @@ export default {
|
||||||
{
|
{
|
||||||
dataItem.method === 'TIMER' ?
|
dataItem.method === 'TIMER' ?
|
||||||
<div>
|
<div>
|
||||||
<easy-cron
|
<el-input placeholder="请输入内容" v-model={dataItem['execScript']}>
|
||||||
hideSecond={false}
|
<el-button slot="append" onClick={() => { this.open = true}} icon="el-icon-connection"></el-button>
|
||||||
disabled={false}
|
</el-input>
|
||||||
style="width: 100%;"
|
|
||||||
v-model={dataItem['execScript']}
|
|
||||||
exeStartTime={this.exeStartTime}
|
|
||||||
></easy-cron>
|
|
||||||
</div> : null
|
</div> : null
|
||||||
}
|
}
|
||||||
|
<el-dialog
|
||||||
|
title="cron-表达式"
|
||||||
|
visible={this.open}
|
||||||
|
onClose={() => {this.open = false}}
|
||||||
|
class="eldialog-wrap"
|
||||||
|
width="880px"
|
||||||
|
append-to-body
|
||||||
|
close-on-click-modal={true}
|
||||||
|
>
|
||||||
|
<e-cron-form
|
||||||
|
ref="eCronForm"
|
||||||
|
style="margin: 20px;"
|
||||||
|
value={dataItem['execScript']}
|
||||||
|
onChange={(e) => {
|
||||||
|
dataItem['execScript'] = e;
|
||||||
|
}}
|
||||||
|
exeStartTime={this.exeStartTime}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer" style="padding-right: 10px;">
|
||||||
|
<el-button type="primary" size="mini" onClick={this.handleCronSubmit} >确 定</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
: null
|
: null
|
||||||
|
|
|
@ -40,6 +40,18 @@
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="场景编码"
|
||||||
|
align="left"
|
||||||
|
width="200"
|
||||||
|
prop="sceneCode"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.sceneCode">
|
||||||
|
{{ scope.row.sceneCode }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="场景模式"
|
label="场景模式"
|
||||||
align="left"
|
align="left"
|
||||||
|
@ -55,7 +67,6 @@
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="状态"
|
label="状态"
|
||||||
width="150px"
|
|
||||||
align="center"
|
align="center"
|
||||||
prop="runStatus"
|
prop="runStatus"
|
||||||
>
|
>
|
||||||
|
@ -66,13 +77,21 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="执行设备" align="left" prop="triggerDevices">
|
<el-table-column label="创建时间" align="center" width="160px" prop="createTime">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.createTime">
|
||||||
|
{{ scope.row.createTime }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<!-- <el-table-column label="执行设备" align="left" prop="triggerDevices">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span class="lay-table-textarea" :title="scope.row.triggerDevices">
|
<span class="lay-table-textarea" :title="scope.row.triggerDevices">
|
||||||
{{ scope.row.triggerDevices }}
|
{{ scope.row.triggerDevices }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="操作"
|
label="操作"
|
||||||
align="center"
|
align="center"
|
||||||
|
@ -88,6 +107,14 @@
|
||||||
>编辑</el-button
|
>编辑</el-button
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
:icon="scope.row.runStatus ? 'el-icon-video-pause' : 'el-icon-video-play'"
|
||||||
|
@click="handleChangeStatus(scope.row)"
|
||||||
|
>{{ scope.row.runStatus ? '停止' : '启用' }}</el-button
|
||||||
|
>
|
||||||
|
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -122,7 +149,13 @@
|
||||||
append-to-body
|
append-to-body
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
>
|
>
|
||||||
<el-form ref="form" :model="form" style="padding-right: 20px;" :rules="rules" label-width="100px">
|
<el-form
|
||||||
|
ref="form"
|
||||||
|
:model="form"
|
||||||
|
style="padding-right: 20px"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="场景名称:" prop="sceneName">
|
<el-form-item label="场景名称:" prop="sceneName">
|
||||||
|
@ -173,6 +206,7 @@
|
||||||
<e-scene-triggers
|
<e-scene-triggers
|
||||||
slot="body"
|
slot="body"
|
||||||
:dataItem="item"
|
:dataItem="item"
|
||||||
|
:sourceId="sourceId"
|
||||||
@change="
|
@change="
|
||||||
(v) => {
|
(v) => {
|
||||||
form.triggers[idx] = v;
|
form.triggers[idx] = v;
|
||||||
|
@ -219,6 +253,7 @@
|
||||||
<e-scene-action
|
<e-scene-action
|
||||||
slot="body"
|
slot="body"
|
||||||
:dataItem="item"
|
:dataItem="item"
|
||||||
|
:sourceId="sourceId"
|
||||||
@change="
|
@change="
|
||||||
(v) => {
|
(v) => {
|
||||||
form.actions[idx] = v;
|
form.actions[idx] = v;
|
||||||
|
@ -242,7 +277,9 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" size="mini" @click="submitForm">确 定</el-button>
|
<el-button type="primary" size="mini" @click="submitForm"
|
||||||
|
>确 定</el-button
|
||||||
|
>
|
||||||
<el-button @click="cancel" size="mini">取 消</el-button>
|
<el-button @click="cancel" size="mini">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
@ -255,7 +292,8 @@ import {
|
||||||
projectSceneAdd,
|
projectSceneAdd,
|
||||||
projectSceneUpdate,
|
projectSceneUpdate,
|
||||||
projectSceneDetail,
|
projectSceneDetail,
|
||||||
projectSceneDelete
|
projectSceneDelete,
|
||||||
|
projectSceneChangeStatus
|
||||||
} from "@/api/iot/project_new";
|
} from "@/api/iot/project_new";
|
||||||
import DialogTemplate from "@/components/DialogTemplate";
|
import DialogTemplate from "@/components/DialogTemplate";
|
||||||
import ESceneTriggers from "./ESceneTriggers/index";
|
import ESceneTriggers from "./ESceneTriggers/index";
|
||||||
|
@ -297,6 +335,8 @@ export default {
|
||||||
page: {
|
page: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
orderByColumn: "createTime",
|
||||||
|
isAsc: "desc"
|
||||||
},
|
},
|
||||||
title: "新增场景",
|
title: "新增场景",
|
||||||
total: 0,
|
total: 0,
|
||||||
|
@ -311,7 +351,11 @@ export default {
|
||||||
{ required: true, message: "场景名称不能为空", trigger: "change" },
|
{ required: true, message: "场景名称不能为空", trigger: "change" },
|
||||||
],
|
],
|
||||||
sceneCode: [
|
sceneCode: [
|
||||||
{ required: true, validator: this.chenking_sceneCode, trigger: "change" },
|
{
|
||||||
|
required: true,
|
||||||
|
validator: this.chenking_sceneCode,
|
||||||
|
trigger: "change",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -369,10 +413,10 @@ export default {
|
||||||
orderBy: triggersPop ? triggersPop.orderBy + 1 : 1,
|
orderBy: triggersPop ? triggersPop.orderBy + 1 : 1,
|
||||||
method: "",
|
method: "",
|
||||||
conditions: [],
|
conditions: [],
|
||||||
intervalVal: '',
|
intervalVal: "",
|
||||||
intervalUnit: "SECONDS",
|
intervalUnit: "SECONDS",
|
||||||
sceneTriggerDevices: [],
|
sceneTriggerDevices: [],
|
||||||
execScript: ''
|
execScript: "",
|
||||||
};
|
};
|
||||||
this.form.triggers.push(obj);
|
this.form.triggers.push(obj);
|
||||||
},
|
},
|
||||||
|
@ -383,16 +427,19 @@ export default {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var isTrue = true;
|
var isTrue = true;
|
||||||
this.form.triggers.forEach(e => {
|
this.form.triggers.forEach((e) => {
|
||||||
if (!e.method) {
|
if (!e.method) {
|
||||||
this.msgError("设备触发__至少选择一种类型!");
|
this.msgError("设备触发__至少选择一种类型!");
|
||||||
isTrue = false;
|
isTrue = false;
|
||||||
}
|
}
|
||||||
if (e.method === 'DEVICE' && (!e.conditions || e.conditions.length <= 0 )) {
|
if (
|
||||||
|
e.method === "DEVICE" &&
|
||||||
|
(!e.conditions || e.conditions.length <= 0)
|
||||||
|
) {
|
||||||
this.msgError("设备触发__至少选择一条设备以及触发条件!");
|
this.msgError("设备触发__至少选择一条设备以及触发条件!");
|
||||||
isTrue = false;
|
isTrue = false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
return isTrue && this.validateAction();
|
return isTrue && this.validateAction();
|
||||||
},
|
},
|
||||||
// 验证 执行条件
|
// 验证 执行条件
|
||||||
|
@ -402,19 +449,25 @@ export default {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var isTrue = true;
|
var isTrue = true;
|
||||||
this.form.actions.forEach(e => {
|
this.form.actions.forEach((e) => {
|
||||||
if (e.actionType === 'DEVOUTPUT' && (
|
if (
|
||||||
e.sceneActionDevices[0] && (!e.sceneActionDevices[0]['cmdKey'] || !e.sceneActionDevices[0]['deviceKey'] )
|
e.actionType === "DEVOUTPUT" &&
|
||||||
)) {
|
e.sceneActionDevices[0] &&
|
||||||
|
(!e.sceneActionDevices[0]["cmdKey"] ||
|
||||||
|
!e.sceneActionDevices[0]["deviceKey"])
|
||||||
|
) {
|
||||||
this.msgError("执行条件中有条件未选择设备或者分组!");
|
this.msgError("执行条件中有条件未选择设备或者分组!");
|
||||||
isTrue = false;
|
isTrue = false;
|
||||||
}
|
}
|
||||||
if (e.actionType === 'NOTIFIER' &&
|
if (
|
||||||
(!e.sceneActionNotifierContacts[0] || !e.sceneActionNotifierContacts[0]['contactsRelList'])) {
|
e.actionType === "NOTIFIER" &&
|
||||||
|
(!e.sceneActionNotifierContacts[0] ||
|
||||||
|
!e.sceneActionNotifierContacts[0]["contactsRelList"])
|
||||||
|
) {
|
||||||
this.msgError("执行条件中有条件未选择联系人!");
|
this.msgError("执行条件中有条件未选择联系人!");
|
||||||
isTrue = false;
|
isTrue = false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
return isTrue;
|
return isTrue;
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
@ -422,13 +475,21 @@ export default {
|
||||||
this.$refs["form"].validate((valid) => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid && this.validateTrigger()) {
|
if (valid && this.validateTrigger()) {
|
||||||
if (this.form.recordId != null) {
|
if (this.form.recordId != null) {
|
||||||
projectSceneUpdate(this.form).then((response) => {
|
projectSceneUpdate(
|
||||||
|
Object.assign(this.form, {
|
||||||
|
projectId: this.sourceId,
|
||||||
|
})
|
||||||
|
).then((response) => {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
projectSceneAdd(this.form).then((response) => {
|
projectSceneAdd(
|
||||||
|
Object.assign(this.form, {
|
||||||
|
projectId: this.sourceId,
|
||||||
|
})
|
||||||
|
).then((response) => {
|
||||||
this.msgSuccess("新增成功");
|
this.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
|
@ -454,12 +515,29 @@ export default {
|
||||||
this.title = "编辑场景";
|
this.title = "编辑场景";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleChangeStatus(row) {
|
||||||
|
this.$confirm(row.runStatus ? '是否停止场景?' : '是否开启场景?', "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return projectSceneChangeStatus({
|
||||||
|
recordId: row.recordId,
|
||||||
|
runStatus: row.runStatus ? false : true
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.handleQuery();
|
||||||
|
this.msgSuccess("成功");
|
||||||
|
});
|
||||||
|
},
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const projectIds = row.recordId;
|
const projectIds = row.recordId;
|
||||||
this.$confirm("是否删除该选项?", "警告", {
|
this.$confirm("是否删除该选项?", "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
return projectSceneDelete(projectIds);
|
return projectSceneDelete(projectIds);
|
||||||
|
@ -510,7 +588,7 @@ export default {
|
||||||
this.tableLoading = false;
|
this.tableLoading = false;
|
||||||
this.total = res.total;
|
this.total = res.total;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -296,17 +296,27 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.recordId != null) {
|
if (this.form.recordId != null) {
|
||||||
updateAttribute(this.form).then((response) => {
|
updateAttribute(this.form).then((response) => {
|
||||||
this.$router.go(0);
|
if (response.msg === '操作成功') {
|
||||||
|
this.$store.dispatch("SetAttributeByKey", {
|
||||||
|
[this.form.enterpriseAttribute]: this.form.attributeValue
|
||||||
|
})
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
// this.getList();
|
} else {
|
||||||
|
this.msgError(response.msg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addAttribute(this.form).then((response) => {
|
addAttribute(this.form).then((response) => {
|
||||||
this.$router.go(0);
|
if (response.msg === '操作成功') {
|
||||||
this.msgSuccess("新增成功");
|
this.$store.dispatch("SetAttributeByKey", {
|
||||||
|
[this.form.enterpriseAttribute]: this.form.attributeValue
|
||||||
|
})
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
// this.getList();
|
} else {
|
||||||
|
this.msgError(response.msg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue