From df2929ba2e6559a79f510b93a72ffcae54dd4154 Mon Sep 17 00:00:00 2001
From: 23688nl <329261568@qq.com>
Date: Fri, 23 Sep 2022 08:44:29 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=EF=BC=9A=20=E5=9C=BA?=
=?UTF-8?q?=E6=99=AF=E6=8E=A7=E5=88=B6=EF=BC=8C=E5=AE=9A=E6=97=B6=E8=A7=A6?=
=?UTF-8?q?=E5=8F=91=E4=BB=A5=E5=8F=8A=E6=89=8B=E5=8A=A8=E8=A7=A6=E5=8F=91?=
=?UTF-8?q?=E6=96=B9=E5=BC=8F=E6=B7=BB=E5=8A=A0=EF=BC=8C=20=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main.js | 3 +-
src/utils/hciot.js | 13 ++++
.../ESceneManage/ESceneAction/config.js | 15 +++++
.../action.js => ESceneAction/index.js} | 0
.../src/EDeviceParam.vue | 30 ++++------
.../ESceneManage/ESceneAction/src/ESelect.vue | 37 ++++++++++++
.../src/executeAction.js | 3 +-
.../ESceneManage/ESceneAction/src/style.scss | 60 +++++++++++++++++++
.../ESceneManage/ESceneTriggers/config.js | 12 +---
.../ESceneTriggers/src/ESelectDevice.vue | 8 +--
.../ESceneTriggers/src/conditionTemp.vue | 9 ---
.../ESceneManage/ESceneTriggers/src/index.js | 52 ++++++++++------
.../project/profileV2/ESceneManage/index.vue | 22 +++----
13 files changed, 184 insertions(+), 80 deletions(-)
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneAction/config.js
rename src/views/iot/project/profileV2/ESceneManage/{ESceneTriggers/action.js => ESceneAction/index.js} (100%)
rename src/views/iot/project/profileV2/ESceneManage/{ESceneTriggers => ESceneAction}/src/EDeviceParam.vue (95%)
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/ESelect.vue
rename src/views/iot/project/profileV2/ESceneManage/{ESceneTriggers => ESceneAction}/src/executeAction.js (98%)
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneAction/src/style.scss
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 @@
+
+