Skip to content

Commit

Permalink
feat(rule): optimize SQL and support the selection of all devices
Browse files Browse the repository at this point in the history
  • Loading branch information
h7ml committed May 7, 2022
1 parent 81469c0 commit 62a18d4
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
* (message) Lightweight Tips ([4d0c608](https://github.com/dgiot/dgiot-dashboard/commit/4d0c608ce097c4c00f177674c58f1b3d31db9c92))
* add plant modal ([3425782](https://github.com/dgiot/dgiot-dashboard/commit/34257829b6c45ad1017c7def5c5c9c3a319991d5))
* **api:** replace API interface ([04593e7](https://github.com/dgiot/dgiot-dashboard/commit/04593e7de3175de1d218d7b343ba8dc483488a46))
* **channel:** adaptive acquisition channel single selection ([81469c0](https://github.com/dgiot/dgiot-dashboard/commit/81469c032bbc4b1d2885eb27816b6cbcd24707cf))
* create factory ([811ebc9](https://github.com/dgiot/dgiot-dashboard/commit/811ebc9edbc7234c5422ebdeeab509b85dcbcc98))
* dashboard json ([5476603](https://github.com/dgiot/dgiot-dashboard/commit/5476603dad0ac1230ef13407f2055f58e6a75927))
* **dashboardid:** jump to dashboard with fixed ID ([65d09b4](https://github.com/dgiot/dgiot-dashboard/commit/65d09b47f1ed25fef34993575e0a97662472a3bb))
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
* (message) Lightweight Tips ([4d0c608](https://github.com/dgiot/dgiot-dashboard/commit/4d0c608ce097c4c00f177674c58f1b3d31db9c92))
* add plant modal ([3425782](https://github.com/dgiot/dgiot-dashboard/commit/34257829b6c45ad1017c7def5c5c9c3a319991d5))
* **api:** replace API interface ([04593e7](https://github.com/dgiot/dgiot-dashboard/commit/04593e7de3175de1d218d7b343ba8dc483488a46))
* **channel:** adaptive acquisition channel single selection ([81469c0](https://github.com/dgiot/dgiot-dashboard/commit/81469c032bbc4b1d2885eb27816b6cbcd24707cf))
* create factory ([811ebc9](https://github.com/dgiot/dgiot-dashboard/commit/811ebc9edbc7234c5422ebdeeab509b85dcbcc98))
* dashboard json ([5476603](https://github.com/dgiot/dgiot-dashboard/commit/5476603dad0ac1230ef13407f2055f58e6a75927))
* **dashboardid:** jump to dashboard with fixed ID ([65d09b4](https://github.com/dgiot/dgiot-dashboard/commit/65d09b47f1ed25fef34993575e0a97662472a3bb))
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
* (message) Lightweight Tips ([4d0c608](https://github.com/dgiot/dgiot-dashboard/commit/4d0c608ce097c4c00f177674c58f1b3d31db9c92))
* add plant modal ([3425782](https://github.com/dgiot/dgiot-dashboard/commit/34257829b6c45ad1017c7def5c5c9c3a319991d5))
* **api:** replace API interface ([04593e7](https://github.com/dgiot/dgiot-dashboard/commit/04593e7de3175de1d218d7b343ba8dc483488a46))
* **channel:** adaptive acquisition channel single selection ([81469c0](https://github.com/dgiot/dgiot-dashboard/commit/81469c032bbc4b1d2885eb27816b6cbcd24707cf))
* create factory ([811ebc9](https://github.com/dgiot/dgiot-dashboard/commit/811ebc9edbc7234c5422ebdeeab509b85dcbcc98))
* dashboard json ([5476603](https://github.com/dgiot/dgiot-dashboard/commit/5476603dad0ac1230ef13407f2055f58e6a75927))
* **dashboardid:** jump to dashboard with fixed ID ([65d09b4](https://github.com/dgiot/dgiot-dashboard/commit/65d09b47f1ed25fef34993575e0a97662472a3bb))
Expand Down
66 changes: 44 additions & 22 deletions src/views/CloudFunction/engine/components/DynamicForms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
>
<el-row :gutter="24">
<el-col :lg="4" :md="6" :sm="8" :xl="8" :xs="8">
<el-form-item label-width="60px" :label="'方式' + (Number(index)+1)" :prop="item+'.uri'"
<el-form-item label-width="60px" :label="'方式' + (Number(index)+1)" :prop="item+'.uri'"
:rules="[{ required: true, message: '请选择触发方式', trigger: 'change' }]">
<el-select
v-model="item.uri"
Expand Down Expand Up @@ -45,7 +45,8 @@
v-if="item.uri == 'trigger/mqtt/event'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="mqtt事件" :prop="item+'.params.mqtt'" :rules="[{ required: true, message: '请选择mqtt事件', trigger: 'change' }]">
<el-form-item label="mqtt事件" :prop="item+'.params.mqtt'"
:rules="[{ required: true, message: '请选择mqtt事件', trigger: 'change' }]">
<el-select
v-model="item.params.mqtt"
placeholder="请选择mqtt事件"
Expand All @@ -64,7 +65,8 @@
v-if="item.uri === 'trigger/product/event' || item.uri === 'trigger/mqtt/event'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="产品信息" :prop="item+'.params.productKey'" :rules="[{ required: true, message: '请选择产品信息', trigger: 'change' }]">
<el-form-item label="产品信息" :prop="item+'.params.productKey'"
:rules="[{ required: true, message: '请选择产品信息', trigger: 'change' }]">
<el-select
v-model="item.params.productKey"
placeholder="请选择产品信息"
Expand All @@ -82,7 +84,7 @@
v-if="item.uri === 'trigger/product/event'||item.uri === 'trigger/mqtt/event'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="设备信息" :prop="item+'.params.deviceName'" :rules="[{ required: true, message: '请选择设备信息', trigger: 'change' }]">
<el-form-item label="设备信息" :prop="item+'.params.deviceName'">
<el-select
v-model="item.params.deviceName"
placeholder="请选择设备信息"
Expand All @@ -102,7 +104,8 @@
v-if="item.uri === 'trigger/product/event' ||item.uri === 'trigger/mqtt/event'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="事件" :prop="item+'.params.propertyName'" :rules="[{ required: true, message: '请选择物模型事件', trigger: 'change' }]" label-width="80px">
<el-form-item label="事件" :prop="item+'.params.propertyName'"
:rules="[{ required: true, message: '请选择物模型事件', trigger: 'change' }]" label-width="80px">
<el-select
v-model="item.params.propertyName"
placeholder="请选择物模型事件"
Expand All @@ -126,7 +129,8 @@
v-if="item.uri == 'trigger/product/property'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="产品信息" :prop="item+'.params.productKey'" :rules="[{ required: true, message: '请选择产品信息', trigger: 'change' }]" >
<el-form-item label="产品信息" :prop="item+'.params.productKey'"
:rules="[{ required: true, message: '请选择产品信息', trigger: 'change' }]">
<el-select
v-model="item.params.productKey"
placeholder="请选择产品信息"
Expand All @@ -144,7 +148,8 @@
v-if="item.uri == 'trigger/product/property'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="设备信息" :prop="item+'.params.deviceName'" :rules="[{ required: true, message: '请选择设备信息', trigger: 'change' }]" >
<el-form-item label="设备信息" :prop="item+'.params.deviceName'"
:rules="[{ required: true, message: '请选择设备信息', trigger: 'change' }]">
<el-select
v-model="item.params.deviceName"
placeholder="请选择设备信息"
Expand All @@ -164,7 +169,8 @@
v-if="item.uri === 'trigger/product/property'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="属性" label-width="80px" :prop="item+'.params.propertyName'" :rules="[{ required: true, message: '请选择物模型属性', trigger: 'change' }]" >
<el-form-item label="属性" label-width="80px" :prop="item+'.params.propertyName'"
:rules="[{ required: true, message: '请选择物模型属性', trigger: 'change' }]">
<el-select
v-model="item.params.propertyName"
placeholder="请选择物模型属性"
Expand All @@ -187,7 +193,8 @@
v-if="item.uri === 'trigger/product/property'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="条件" label-width="80px" :prop="item+'.params.compareType'" :rules="[{ required: true, message: '请选择比较条件', trigger: 'change' }]" >
<el-form-item label="条件" label-width="80px" :prop="item+'.params.compareType'"
:rules="[{ required: true, message: '请选择比较条件', trigger: 'change' }]">
<el-select
v-model="item.params.compareType"
placeholder="请选择比较条件"
Expand All @@ -207,7 +214,8 @@
v-if="item.uri === 'trigger/product/property'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="" label-width="80px" :prop="item+'.params.compareValue'" :rules="[{ required: true, message: '请输入物模型比较值', trigger: 'blur' }]" >
<el-form-item label="" label-width="80px" :prop="item+'.params.compareValue'"
:rules="[{ required: true, message: '请输入物模型比较值', trigger: 'blur' }]">
<el-input
v-model="item.params.compareValue"
placeholder="物模型比较值"
Expand Down Expand Up @@ -250,7 +258,7 @@
</el-row>
</el-col>
</el-row>
<el-divider/>
<el-divider />

<el-divider content-position="left">执行条件(Conditions)</el-divider>
<el-row :gutter="24">
Expand All @@ -261,7 +269,8 @@
>
<el-row :gutter="24">
<el-col :lg="4" :md="6" :sm="8" :xl="8" :xs="8">
<el-form-item label-width="60px" :label="'条件' + (Number(_index)+1)" :prop="condition+'.uri'" :rules="[{ required: true, message: '请选择执行条件', trigger: 'change' }]">
<el-form-item label-width="60px" :label="'条件' + (Number(_index)+1)" :prop="condition+'.uri'"
:rules="[{ required: true, message: '请选择执行条件', trigger: 'change' }]">
<el-select
v-model="condition.uri"
placeholder="请选择执行条件"
Expand All @@ -277,7 +286,8 @@
</el-col>
<!-- 状态持续时长判断-->
<el-col :lg="4" :md="6" :sm="8" :xl="8" :xs="8" v-if="condition.uri=='condition/device/stateContinue'">
<el-form-item label="设备状态" :prop="condition+'.params.state'" :rules="[{ required: true, message: '请选择设备状态', trigger: 'change' }]" >
<el-form-item label="设备状态" :prop="condition+'.params.state'"
:rules="[{ required: true, message: '请选择设备状态', trigger: 'change' }]">
<el-select
v-model="condition.params.state"
placeholder="请选择设备状态"
Expand All @@ -294,7 +304,8 @@
<!-- 状态持续时长判断-->
<el-col :lg="4" :md="6" :sm="8" :xl="8" :xs="8"
v-if="condition.uri=='condition/device/stateContinue'">
<el-form-item label="持续时长" :prop="condition+'.params.times'" :rules="[{ required: true, message: '请选择设备状态', trigger: 'change' }]" >
<el-form-item label="持续时长" :prop="condition+'.params.times'"
:rules="[{ required: true, message: '请选择设备状态', trigger: 'change' }]">
<el-input
v-model="condition.params.times"
placeholder="请选择"
Expand All @@ -308,7 +319,8 @@
v-if="condition.uri == 'condition/device/deviceState'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="产品信息" :prop="condition+'.params.productKey'" :rules="[{ required: true, message: '请选择产品信息', trigger: 'change' }]" >
<el-form-item label="产品信息" :prop="condition+'.params.productKey'"
:rules="[{ required: true, message: '请选择产品信息', trigger: 'change' }]">
<el-select
v-model="condition.params.productKey"
placeholder="请选择产品信息"
Expand All @@ -327,7 +339,8 @@
v-if="condition.uri == 'condition/device/deviceState'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="设备信息" :prop="condition+'.params.deviceName'" :rules="[{ required: true, message: '请选择设备信息', trigger: 'change' }]" >
<el-form-item label="设备信息" :prop="condition+'.params.deviceName'"
:rules="[{ required: false, message: '请选择设备信息', trigger: 'change' }]">
<el-select
v-model="condition.params.deviceName"
placeholder="请选择设备信息"
Expand All @@ -348,7 +361,8 @@
v-if="condition.uri === 'condition/device/deviceState'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="属性" :prop="condition+'.params.propertyName'" :rules="[{ required: true, message: '请选择设备属性', trigger: 'change' }]" label-width="80px">
<el-form-item label="属性" :prop="condition+'.params.propertyName'"
:rules="[{ required: true, message: '请选择设备属性', trigger: 'change' }]" label-width="80px">
<el-select
v-model="condition.params.propertyName"
placeholder="请选择设备属性"
Expand All @@ -371,7 +385,8 @@
v-if="condition.uri === 'condition/device/deviceState'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="条件" :prop="condition+'.params.compareType'" :rules="[{ required: true, message: '请选择条件', trigger: 'change' }]" label-width="80px">
<el-form-item label="条件" :prop="condition+'.params.compareType'"
:rules="[{ required: true, message: '请选择条件', trigger: 'change' }]" label-width="80px">
<el-select
v-model="condition.params.compareType"
placeholder="请选择条件"
Expand All @@ -391,7 +406,8 @@
v-if="condition.uri === 'condition/device/deviceState'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="" :prop="condition+'.params.compareValue'" :rules="[{ required: true, message: '请选择物模型比较值', trigger: 'change' }]" label-width="80px">
<el-form-item label="" :prop="condition+'.params.compareValue'"
:rules="[{ required: true, message: '请选择物模型比较值', trigger: 'change' }]" label-width="80px">
<el-input
v-model="condition.params.compareValue"
placeholder="物模型比较值"
Expand All @@ -404,7 +420,8 @@
v-if="condition.uri === 'condition/device/time'"
:lg="4" :md="6" :sm="8" :xl="8" :xs="8"
>
<el-form-item label="起止时间" :prop="condition+'.params.compareValue'" :rules="[{ required: true, message: '请选择起止时间', trigger: 'change' }]" label-width="80px">
<el-form-item label="起止时间" :prop="condition+'.params.compareValue'"
:rules="[{ required: true, message: '请选择起止时间', trigger: 'change' }]" label-width="80px">
<el-date-picker
v-model="condition.params.time"
value-format="timestamp"
Expand Down Expand Up @@ -499,7 +516,7 @@
uri: 'action/device/setProperty',
params: {
productKey: '',
deviceName: '',
deviceName: '#',
propertyItems: {
Direction: '',
},
Expand Down Expand Up @@ -535,9 +552,14 @@
if (index !== -1) items.splice(index, 1)
},
filtersDevice(productId) {
return _.filter(this.options.Device, (o) => {
let arr = _.filter(this.options.Device, (o) => {
return o.product.objectId == productId
})
arr.push({
objectId: '#',
name: '所有设备',
})
return arr
},
filtersProperty(productId) {
let res = []
Expand Down

0 comments on commit 62a18d4

Please sign in to comment.