From da95c4d9fbfd6910399e18a0a0bf4aa81fc83497 Mon Sep 17 00:00:00 2001
From: 23688nl <329261568@qq.com>
Date: Wed, 21 Sep 2022 17:48:02 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=EF=BC=9A=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E7=AE=A1=E7=90=86=E4=BB=A5=E5=8F=8A=E9=A1=B9=E7=9B=AE=E4=B8=8B?=
=?UTF-8?q?=E5=9C=BA=E6=99=AF=E7=AE=A1=E7=90=86=E4=BB=A3=E7=A0=81=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/iot/project_new.js | 43 ++
src/api/system/attribute.js | 61 ++
src/components/Cards/ETagCard.js | 7 +
src/components/Cards/src/ETagCard/index.js | 46 ++
src/components/Cards/src/ETagCard/style.scss | 22 +
src/layout/components/Sidebar/Logo.vue | 10 +-
src/permission.js | 2 +
src/store/getters.js | 3 +-
src/store/modules/app.js | 2 +-
src/store/modules/permission.js | 17 +-
.../autocontrol/job/profile/deviceParam.vue | 4 -
.../ESceneManage/ESceneTriggers/action.js | 7 +
.../ESceneManage/ESceneTriggers/config.js | 21 +
.../ESceneManage/ESceneTriggers/index.js | 7 +
.../ESceneTriggers/src/EConditionTemp.vue | 60 ++
.../ESceneTriggers/src/EDeviceParam.vue | 440 ++++++++++++++
.../ESceneTriggers/src/ESelect.vue | 37 ++
.../ESceneTriggers/src/ESelectDevice.vue | 247 ++++++++
.../ESceneTriggers/src/conditionTemp.vue | 186 ++++++
.../ESceneTriggers/src/executeAction.js | 209 +++++++
.../ESceneManage/ESceneTriggers/src/index.js | 118 ++++
.../ESceneTriggers/src/style.scss | 60 ++
.../project/profileV2/ESceneManage/index.vue | 566 ++++++++++++++++++
src/views/iot/project/profileV2/details.vue | 14 +
src/views/system/attribute/index.vue | 348 +++++++++++
25 files changed, 2527 insertions(+), 10 deletions(-)
create mode 100644 src/api/system/attribute.js
create mode 100644 src/components/Cards/ETagCard.js
create mode 100644 src/components/Cards/src/ETagCard/index.js
create mode 100644 src/components/Cards/src/ETagCard/style.scss
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/action.js
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/config.js
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/index.js
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/EConditionTemp.vue
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/EDeviceParam.vue
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelect.vue
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelectDevice.vue
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/conditionTemp.vue
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/executeAction.js
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/index.js
create mode 100644 src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/style.scss
create mode 100644 src/views/iot/project/profileV2/ESceneManage/index.vue
create mode 100644 src/views/system/attribute/index.vue
diff --git a/src/api/iot/project_new.js b/src/api/iot/project_new.js
index 59a60780..9f216760 100644
--- a/src/api/iot/project_new.js
+++ b/src/api/iot/project_new.js
@@ -163,3 +163,46 @@ export function projectLeakageTable(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'
+ })
+}
diff --git a/src/api/system/attribute.js b/src/api/system/attribute.js
new file mode 100644
index 00000000..c56b73f5
--- /dev/null
+++ b/src/api/system/attribute.js
@@ -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'
+ })
+}
diff --git a/src/components/Cards/ETagCard.js b/src/components/Cards/ETagCard.js
new file mode 100644
index 00000000..a966986c
--- /dev/null
+++ b/src/components/Cards/ETagCard.js
@@ -0,0 +1,7 @@
+import ETagCard from "./src/ETagCard/index"
+
+ETagCard.install = function install(Vue) {
+ Vue.component(ETagCard.name, ETagCard);
+};
+
+export default ETagCard
diff --git a/src/components/Cards/src/ETagCard/index.js b/src/components/Cards/src/ETagCard/index.js
new file mode 100644
index 00000000..afbbc9a6
--- /dev/null
+++ b/src/components/Cards/src/ETagCard/index.js
@@ -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 (
+
+
+ {
+ $slots.body
+ }
+
+
+ )
+ }
+}
diff --git a/src/components/Cards/src/ETagCard/style.scss b/src/components/Cards/src/ETagCard/style.scss
new file mode 100644
index 00000000..8a62f07c
--- /dev/null
+++ b/src/components/Cards/src/ETagCard/style.scss
@@ -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;
+}
diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue
index 9bd28d97..04fa85b1 100644
--- a/src/layout/components/Sidebar/Logo.vue
+++ b/src/layout/components/Sidebar/Logo.vue
@@ -3,11 +3,11 @@
@@ -16,6 +16,7 @@
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/EDeviceParam.vue b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/EDeviceParam.vue
new file mode 100644
index 00000000..6ed46a40
--- /dev/null
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/EDeviceParam.vue
@@ -0,0 +1,440 @@
+
+
+
+
+ 设备:
+
+
+
+ 分组:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelect.vue b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelect.vue
new file mode 100644
index 00000000..a3f60019
--- /dev/null
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelect.vue
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelectDevice.vue b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelectDevice.vue
new file mode 100644
index 00000000..5cd67731
--- /dev/null
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/ESelectDevice.vue
@@ -0,0 +1,247 @@
+
+
+
+
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/conditionTemp.vue b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/conditionTemp.vue
new file mode 100644
index 00000000..81f192c4
--- /dev/null
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/conditionTemp.vue
@@ -0,0 +1,186 @@
+
+
+
+ 关系:
+
+
+
+ 类型:
+
+
+
+ 条件:
+
+ {{ proVal }}
+
+ 删除此数据
+
+
+
+
+
+ A:
+
+
+
+
+ B:
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/executeAction.js b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/executeAction.js
new file mode 100644
index 00000000..210a3c7e
--- /dev/null
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/executeAction.js
@@ -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 (
+
+ {
+ (dataItem) ?
+
+
+
+ {defaultConfig.actionTitle || '--'}: { dataItem.orderBy }
+ 刪除
+
+
+
+
+
+ {( dataItem.actionType === "NOTIFIER") ?
+
+ : null}
+
+
+ {( dataItem.actionType === "DEVOUTPUT") ?
+
+
+
+ : null}
+
+ { (dataItem.actionType === "NOTIFIER") ?
+
+
: null }
+
+ {
+ (dataItem.actionType === "NOTIFIER" && dataItem.sceneActionNotifierContacts[0].contactsRelList.length === 0) ?
+
* 未选择任何联系人...
+ : null
+ }
+
+ {
+ (dataItem.actionType === "DEVOUTPUT" &&
+ (dataItem.sceneActionDevices[0] &&
+ (!dataItem.sceneActionDevices[0]['cmdKey'] &&
+ !dataItem.sceneActionDevices[0]['cmdKey']))) ?
+
* 未选择设备或者分组...
+ : null
+ }
+
+
+ : null
+ }
+
+ )
+ }
+}
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/index.js b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/index.js
new file mode 100644
index 00000000..f2387177
--- /dev/null
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/index.js
@@ -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 (
+
+ {
+ (dataItem) ?
+
+
+
+ {defaultConfig.title || '--'}: { dataItem.orderBy }
+ 刪除
+
+
+
+
+
+ {
+ dataItem.method === 'DEVICE' ?
+
+ : null
+ }
+
+
+ : null
+ }
+
+ )
+ }
+}
diff --git a/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/style.scss b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/src/style.scss
new file mode 100644
index 00000000..71d3ab05
--- /dev/null
+++ b/src/views/iot/project/profileV2/ESceneManage/ESceneTriggers/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/index.vue b/src/views/iot/project/profileV2/ESceneManage/index.vue
new file mode 100644
index 00000000..949b35e6
--- /dev/null
+++ b/src/views/iot/project/profileV2/ESceneManage/index.vue
@@ -0,0 +1,566 @@
+
+
+
+
+ 新增
+ 刷新
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.sceneName }}
+
+
+
+
+
+
+ {{ scope.row.relation }}
+
+
+
+
+
+
+
+ {{ scope.row.runStatus ? "启用" : "停止" }}
+
+
+
+
+
+
+
+ {{ scope.row.triggerDevices }}
+
+
+
+
+
+ 编辑
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 触发器列表:
+
+
+
+ {
+ form.triggers[idx] = v;
+ }
+ "
+ @handleDel="
+ (v) => {
+ form.triggers.splice(idx, 1);
+ }
+ "
+ >
+
+
+ 新增触发器
+
+
+
+ 执行动作:
+
+
+
+ {
+ form.actions[idx] = v;
+ }
+ "
+ @handleDel="
+ (v) => {
+ form.actions.splice(idx, 1);
+ }
+ "
+ />
+
+
+ 新增动作
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/iot/project/profileV2/details.vue b/src/views/iot/project/profileV2/details.vue
index c6e315cb..26b1ee29 100644
--- a/src/views/iot/project/profileV2/details.vue
+++ b/src/views/iot/project/profileV2/details.vue
@@ -215,6 +215,7 @@ import EEnergyLoad from "./EnergyManage/EEnergyLoad";
import { initMap, gjzCode } from "@/utils/latlngFromAddress";
import ShopLocation from "@/components/Amap/components/shopLocation/index";
+import ESceneManage from './ESceneManage/index'
export default {
name: "projectDetailV2",
@@ -238,6 +239,7 @@ export default {
EElectricity,
EEnergyLoad,
ShopLocation,
+ ESceneManage
},
props: {
sourceId: {
@@ -356,6 +358,18 @@ export default {
},
],
},
+ {
+ label: "综合管理",
+ key: "synthesizeManage",
+ children: [
+ {
+ label: "场景控制",
+ key: "sceneManage",
+ template: "ESceneManage",
+ },
+
+ ],
+ },
],
projectTypeOptions: [],
infoData: {},
diff --git a/src/views/system/attribute/index.vue b/src/views/system/attribute/index.vue
new file mode 100644
index 00000000..a85ee918
--- /dev/null
+++ b/src/views/system/attribute/index.vue
@@ -0,0 +1,348 @@
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+ 新增
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 修改
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+