diff --git a/src/main.js b/src/main.js
index 6441e178..d99b6075 100644
--- a/src/main.js
+++ b/src/main.js
@@ -17,7 +17,7 @@ import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree, selectDictDesc } from "@/utils/smartpower";
-import { pluginsCope } from "@/utils/hciot";
+import { pluginsCope, getGuid } from "@/utils/hciot";
import Pagination from "@/components/Pagination";
import VueClipboard from 'vue-clipboard2'
@@ -41,6 +41,7 @@ Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.prototype.copeFu = pluginsCope
Vue.prototype.selectDictDesc = selectDictDesc
+Vue.prototype.getGuid = getGuid
Vue.prototype.msgSuccess = function (msg) {
this.$message({ showClose: true, message: msg, type: "success" });
diff --git a/src/utils/hciot.js b/src/utils/hciot.js
index f9ec4290..8d906b99 100644
--- a/src/utils/hciot.js
+++ b/src/utils/hciot.js
@@ -299,3 +299,16 @@ export const timeDiff = ($begin_time, $end_time ) => {
return $res
}
+/**
+ * 获取一个 随机 guid 值;
+ * @returns
+ */
+export const getGuid = () => {
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
+ c
+ ) {
+ var r = (Math.random() * 16) | 0,
+ v = c == "x" ? r : (r & 0x3) | 0x8;
+ return v.toString(16);
+ });
+}
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneAction/config.js b/src/views/iot/project/profileV2/ESceneManage/ESceneAction/config.js
new file mode 100644
index 00000000..e41f4de1
--- /dev/null
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneAction/config.js
@@ -0,0 +1,15 @@
+
+export const actionType = {
+ NOTIFIER: '消息通知',
+ DEVOUTPUT: '设备输出',
+}
+
+export const defaultConfig = {
+ title: '触发器',
+ actionTitle: '执行动作'
+}
+
+export const notifierType = {
+ SMS: '短信',
+ WEEXIN: '微信'
+}
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/action.js b/src/views/iot/project/profileV2/ESceneManage/ESceneAction/index.js
similarity index 100%
rename from src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/action.js
rename to src/views/iot/project/profileV2/ESceneManage/ESceneAction/index.js
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/EDeviceParam.vue b/src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/EDeviceParam.vue
similarity index 95%
rename from src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/EDeviceParam.vue
rename to src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/EDeviceParam.vue
index 68e7bec7..f64b8393 100644
--- a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/EDeviceParam.vue
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/EDeviceParam.vue
@@ -175,7 +175,7 @@ export default {
form: {
deviceName: "",
deviceId: "",
- prodId: "",
+ prodKey: "",
guid: "",
cmdKey: "",
ctlJson: "",
@@ -200,16 +200,15 @@ export default {
},
deep: true,
},
- // paramsDevcie: {
- // handler(val, oldVal) {
- // this.form = this.paramsDevcie;
- // },
- // 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) {
@@ -370,7 +369,7 @@ export default {
if (data.type === "dblclick") {
this.form.deviceName = data.value.deviceName;
this.form.deviceId = data.value.deviceId;
- this.form.prodId = data.value.prodKey;
+ this.form.prodKey = data.value.prodKey;
this.form.deviceKey = data.value.deviceKey;
this.selectTableShow = false;
this.form.cmdKey = "";
@@ -381,7 +380,7 @@ export default {
this.selectResult = {};
this.selectResult.deviceId = data.value.deviceId;
this.selectResult.deviceName = data.value.deviceName;
- this.selectResult.prodId = data.value.prodKey;
+ this.selectResult.prodKey = data.value.prodKey;
this.selectResult.deviceKey = data.value.deviceKey;
}
},
@@ -389,7 +388,7 @@ export default {
resuleClick() {
this.form.deviceName = this.selectResult.deviceName;
this.form.deviceId = this.selectResult.deviceId;
- this.form.prodId = this.selectResult.prodKey;
+ this.form.prodKey = this.selectResult.prodKey;
this.form.deviceKey = this.selectResult.deviceKey;
this.selectTableShow = false;
this.form.cmdKey = "";
@@ -408,15 +407,6 @@ export default {
this.$forceUpdate();
});
},
- getGuid() {
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
- c
- ) {
- var r = (Math.random() * 16) | 0,
- v = c == "x" ? r : (r & 0x3) | 0x8;
- return v.toString(16);
- });
- },
},
};
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/ESelect.vue b/src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/ESelect.vue
new file mode 100644
index 00000000..a3f60019
--- /dev/null
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/ESelect.vue
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/executeAction.js b/src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/executeAction.js
similarity index 98%
rename from src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/executeAction.js
rename to src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/executeAction.js
index 210a3c7e..2e111ef9 100644
--- a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/executeAction.js
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/executeAction.js
@@ -2,7 +2,6 @@ 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'
@@ -17,7 +16,7 @@ export default {
default: '200'
}
},
- components: { ESelect, ESelectDevice, EDeviceParam },
+ components: { ESelect, EDeviceParam },
data() {
return {
method: 'DEVICE',
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/style.scss b/src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/style.scss
new file mode 100644
index 00000000..71d3ab05
--- /dev/null
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/style.scss
@@ -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;
+}
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/config.js b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/config.js
index 6a6f715d..601ab969 100644
--- a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/config.js
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/config.js
@@ -2,20 +2,10 @@ export const triggerMethod = {
MANUAL: '手动触发',
TIMER: '定时触发',
DEVICE: '设备触发',
- SCENE: '场景触发',
-}
-
-export const actionType = {
- NOTIFIER: '消息通知',
- DEVOUTPUT: '设备输出',
+ // SCENE: '场景触发',
}
export const defaultConfig = {
title: '触发器',
actionTitle: '执行动作'
}
-
-export const notifierType = {
- SMS: '短信',
- WEEXIN: '微信'
-}
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelectDevice.vue b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelectDevice.vue
index 5cd67731..4e935ad8 100644
--- a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelectDevice.vue
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelectDevice.vue
@@ -217,8 +217,8 @@ export default {
} else if (data.type === "click") {
if (data.otherOption.tableType === "device") {
this.selectResult = {
- id: data.value.deviceId,
- name: data.value.deviceName,
+ deviceId: data.value.deviceId,
+ deviceName: data.value.deviceName,
};
}
this.selectResult.tableType = data.otherOption.tableType;
@@ -236,8 +236,8 @@ export default {
// close 数据
close() {
this.form = {
- id: "",
- name: "",
+ deviceId: "",
+ deviceName: "",
netType: 0,
};
this.$forceUpdate();
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/conditionTemp.vue b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/conditionTemp.vue
index ee00ad33..1f8a06e0 100644
--- a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/conditionTemp.vue
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/conditionTemp.vue
@@ -165,15 +165,6 @@ export default {
this.triggerMinInput = true;
}
},
- getGuid() {
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
- c
- ) {
- var r = (Math.random() * 16) | 0,
- v = c == "x" ? r : (r & 0x3) | 0x8;
- return v.toString(16);
- });
- },
},
};
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/index.js b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/index.js
index f2387177..4e9ee8be 100644
--- a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/index.js
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/index.js
@@ -3,6 +3,8 @@ import { triggerMethod, defaultConfig } from "../config"
import selectMethod from './ESelect'
import ESelectDevice from './ESelectDevice'
import EConditionTemp from './EConditionTemp'
+import EasyCron from "@/components/EasyCron";
+import CronValidator from "@/components/EasyCron/validator";
export default {
@@ -16,16 +18,18 @@ export default {
default: '200'
}
},
- components: { selectMethod, ESelectDevice, EConditionTemp },
+ components: { selectMethod, ESelectDevice, EConditionTemp, EasyCron },
data() {
return {
- method: 'DEVICE'
+ method: 'DEVICE',
+ exeStartTime: "",
}
},
mounted() {
if (this.$refs.eCondition && this.dataItem.sceneTriggerDevices[0]['deviceId']) {
this.$refs.eCondition.getcomdlist(this.dataItem.sceneTriggerDevices[0]['deviceId']);
};
+ this.exeStartTime = this.parseTime(new Date(), "{y}-{m}-{d} {h}:{i}:{s}");
},
methods: {
methodChange(v) {
@@ -33,7 +37,7 @@ export default {
// 切换类型 必定制空其他选择项;
this.dataItem.sceneTriggerDevices = [];
this.dataItem.conditions = [];
-
+ this.dataItem.execScript = v === 'TIMER' ? '* * * * * ? *' : '';
this.$forceUpdate();
this.$emit('change', this.dataItem);
},
@@ -89,26 +93,38 @@ export default {
dataItem.method === 'DEVICE' ?
+
+
+ 添加
+
: null
}
+ {
+ dataItem.method === 'TIMER' ?
+
+
+
: null
+ }
+
: null
}
diff --git a/src/views/iot/project/profileV2/ESceneManage/index.vue b/src/views/iot/project/profileV2/ESceneManage/index.vue
index 0231a947..80b11789 100644
--- a/src/views/iot/project/profileV2/ESceneManage/index.vue
+++ b/src/views/iot/project/profileV2/ESceneManage/index.vue
@@ -120,8 +120,9 @@
class="eldialog-wrap"
width="880px"
append-to-body
+ :close-on-click-modal="false"
>
-
+
@@ -241,15 +242,14 @@