wangxiao 2 yıl önce
ebeveyn
işleme
1e723cf904

+ 2 - 2
src/api/iot/rule.ts

@@ -76,7 +76,7 @@ export const delForward = (id: string) => {
  * Promise。该数字表示具有指定状态的转发规则的计数。通过以指定状态作为参数向“/forwardRule/count”端点发出 GET 请求来获取计数。
  */
 export const getForwardCount = (status?: boolean) => {
-  return request<number>({
+  return request<any>({
     url: '/forwardRule/count',
     method: 'GET',
     params: { status }
@@ -148,7 +148,7 @@ export const getLinkPage = (params: {page: number, pageSize: number, ruleLabel?:
 }
 
 export const getLinkCount = (params?: {status: boolean}) => {
-  return request<number>({
+  return request<any>({
     url: '/linkRule/count',
     method: 'GET',
     params

+ 2 - 2
src/pages/Iot/dashboard/deviceAccess/index.vue

@@ -123,11 +123,11 @@ const getStatisList = async () => {
   })
 
   RuleController.forwardCount().then(r => {
-    sourceList[1].value = r.data
+    sourceList[1].value = r.data.TOTAL
   })
 
   RuleController.linkCount().then(r => {
-    sourceList[2].value = r.data
+    sourceList[2].value = r.data.TOTAL
     console.log('RuleController:', r.data)
   })
 }

+ 10 - 0
src/pages/Iot/model/models.vue

@@ -14,6 +14,15 @@
     @change="changePage"
   >
   <template #bodyCell="{column, record}">
+      <template v-if="column.key === 'id'" >
+          <a  @click="openModal()">{{record.id}}</a>
+        </template>
+        <template v-if="column.key === 'createAt'" >
+          {{dayjs(record.createAt).format('YYYY/MM/DD HH:MM:ss')}}
+        </template>
+        <template v-if="column.key === 'updateAt'" >
+          {{dayjs(record.updateAt).format('YYYY/MM/DD HH:MM:ss')}}
+        </template>
         <template v-if="column.key === 'action'" >
           <a-space>
             <a >详情</a>
@@ -55,6 +64,7 @@ import { ModelController } from '@/controller'
 import { LeftSquareOutlined } from '@ant-design/icons-vue'
 import { onMounted, reactive } from 'vue'
 import { Form } from 'ant-design-vue'
+import dayjs from 'dayjs'
 
 const columns = [
   {

+ 11 - 8
src/pages/Iot/rule/forwardRule.vue

@@ -8,20 +8,19 @@
     <a-col :span="18" >
     <a-form style="width: 100%;"  :label-col="{span: 5}" >
       <a-row style="width: 100%" :gutter="[8, 8]" >
-
         <a-col :span="6" >
           <a-form-item label="规则ID" >
-            <a-input v-model:value="queryParams.ruleId" ></a-input>
+            <a-input v-model:value="queryParams.ruleId" placeholder="请输入规则id"></a-input>
           </a-form-item>
         </a-col>
         <a-col :span="6">
           <a-form-item label="规则名称" >
-              <a-input v-model:value="queryParams.ruleLabel" ></a-input>
+              <a-input v-model:value="queryParams.ruleLabel" placeholder="请输入规则名称" ></a-input>
             </a-form-item>
         </a-col>
         <a-col :span="6" >
           <a-form-item label="数据来源" >
-              <a-select allowClear v-model:value="queryParams.subjectResource" >
+              <a-select allowClear v-model:value="queryParams.subjectResource"    placeholder="选择数据来源">
                 <a-select-option
                   v-for="item in subjectResourceList"
                   :key="item.key"
@@ -34,7 +33,7 @@
         </a-col>
         <a-col :span="6" >
           <a-form-item label="触发事件" >
-              <a-select allowClear v-model:value="queryParams.subjectEvent" >
+              <a-select allowClear v-model:value="queryParams.subjectEvent"  placeholder="选择触发事件">
                 <a-select-option
                   v-for="item in subjectEventList"
                   :key="item.key"
@@ -78,11 +77,14 @@
     @change="changePage"
   >
     <template #bodyCell="{column, record}" >
+      <template v-if="column.key === 'id'" >
+          <a  @click="openDetailModal(record.id)">{{record.id}}</a>
+        </template>
       <template v-if="column.key === 'subjectResource'" >
-        {{RuleController.SubjectResourceMap.get(record.subjectResource)?.name}}
+        <a-tag >{{RuleController.SubjectResourceMap.get(record.subjectResource)?.name}}</a-tag>
       </template>
       <template v-if="column.key === 'subjectEvent'" >
-        {{RuleController.SubjectEventMap.get(record.subjectEvent)?.name}}
+        <a-tag >{{RuleController.SubjectEventMap.get(record.subjectEvent)?.name}}</a-tag>
       </template>
       <template v-if="column.key === 'status'" >
         <a-switch
@@ -416,7 +418,8 @@ const columns = [
   },
   {
     title: '规则ID',
-    dataIndex: 'id'
+    dataIndex: 'id',
+    key: 'id'
   },
   {
     title: '数据来源',

+ 0 - 688
src/pages/Iot/rule/linkRule.vue

@@ -1,688 +0,0 @@
-<template>
-  <a-card>
-    <a-row justify="space-between" >
-      <a-col>
-      </a-col>
-      <a-col>
-        <a-space>
-          <a-button type="primary" @click="state.visible = true" >创建规则</a-button>
-        </a-space>
-      </a-col>
-    </a-row>
-    <a-table
-      style="margin-top: 20px;"
-      :columns="columns"
-      :data-source="state.dataSource"
-      :loading="state.loading"
-      :pagination="queryParamsState"
-      @change="changePage"
-    >
-    <template #bodyCell="{column, record}" >
-      <template v-if="column.key === 'status'" >
-        <a-switch
-          v-model:checked="record.status"
-          checked-children="运行中"
-          un-checked-children="已停止"
-          @click="changeStatus(record)"
-        />
-      </template>
-      <template  v-if="column.key === 'action'" >
-        <a-space>
-          <!-- <a>编辑</a> -->
-          <a-popconfirm
-                  title="确实要删除吗?"
-                  ok-text="确定"
-                  cancel-text="取消"
-                  @confirm="delLinkRule(record.id)"
-                >
-                  <a>删除</a>
-                </a-popconfirm>
-        </a-space>
-      </template>
-    </template>
-    </a-table>
-  </a-card>
-
-  <modal-pro
-    style="width: 1400px;"
-    label="创建转发规则"
-    :visible="state.visible"
-    @cancel="state.visible = false"
-    @ok="ok"
-  >
-    <div style="height: 750px;overflow: hidden;overflow-y: auto;">
-    <a-card
-      title="基本信息"
-      :bordered="false"
-    >
-      <form-pro
-        :labelCol="{span: 2}"
-        :formProps="formProps"
-        ref="formProRef"
-      />
-    </a-card>
-    <a-card
-      title="触发条件"
-      :bordered="false"
-    >
-      <a-row class="condition" >
-        <a-col span="12" >
-          需满足
-          <a-dropdown >
-            <a class="ant-dropdown-link" @click.prevent>
-              {{bodyParamsState.conditionLogic === 'AND' ? '全部' : '任意一个'}}
-              <DownOutlined />
-            </a>
-            <template #overlay>
-              <a-menu>
-                <a-menu-item @click="changeConditionLogic('AND')" >
-                  <a >全部</a>
-                </a-menu-item>
-                <a-menu-item @click="changeConditionLogic('ALL')">
-                  <a >任意一个</a>
-                </a-menu-item>
-              </a-menu>
-            </template>
-          </a-dropdown>
-          以下条件:
-        </a-col>
-        <a-col class="df" span="12" >
-          <a-button type="primary" @click="addCondition">添加条件</a-button>
-        </a-col>
-        <a-col span="24" >
-          <a-row style="margin-top: 20px;" v-if="bodyParamsState.conditions.length" >
-            <a-col
-              :span="24"
-              style="margin-top: 5px;"
-              v-for="(item, index) in bodyParamsState.conditions"
-              :key="index"
-            >
-              <a-row>
-                <a-col
-                :span="22"
-                >
-                <a-row :gutter="[8, 8]" >
-                  <a-col>
-                  <!-- 选择条件 -->
-                  <a-select
-                    style="width: 170px"
-                    v-model:value="item.conditionType"
-                    @change="changeConditionAndActionType(index, 'conditions')"
-                  >
-                    <a-select-option
-                      v-for="itemType in conditionTypeList"
-                      :key="itemType.key"
-                      :value="itemType.key"
-                    >
-                      {{itemType.name}}
-                    </a-select-option>
-                  </a-select>
-                  </a-col>
-
-                  <a-col>
-                      <!-- 选择产品 -->
-                        <a-select
-                        v-if="['DEVICE_DATA', 'DEVICE_SESSION'].includes(item.conditionType)"
-                        style="width: 170px"
-                        placeholder="请选择产品"
-                        v-model:value="item.modelId"
-                        @change="changeModel"
-                      >
-                        <a-select-option
-                          v-for="model in state.modelList"
-                          :key="model.id"
-                          :value="model.id"
-                        >
-                          {{model.modelLabel}}
-                        </a-select-option>
-                      </a-select>
-                  </a-col>
-
-                  <a-col>
-                    <!-- 选择设备类型 -->
-                    <a-select
-                      v-if="item.modelId"
-                      style="width: 170px"
-                      placeholder="请选择设备"
-                      v-model:value="item.deviceType"
-                    >
-                      <a-select-option
-                        v-for="deviceItem in selectDeviceList"
-                        :key="deviceItem.key"
-                        :value="deviceItem.key"
-                      >
-                        {{deviceItem.name}}
-                      </a-select-option>
-                    </a-select>
-                  </a-col>
-
-                  <a-col>
-                    <span v-if="item.deviceId" >{{item.deviceLabel}}</span>
-                  </a-col>
-
-                  <a-col>
-                    <a-button
-                      type="primary"
-                      v-if="item.deviceType === 'target'"
-                      @click="openDeviceModal(index ,'conditions')"
-                    >
-                      {{item.deviceId ? '重新选择' : '请选择设备'}}
-                    </a-button>
-                  </a-col>
-
-                  <a-col>
-                      <!-- 选择属性key 填写操作符 -->
-                      <a-select
-                          v-if="item.modelId && item.conditionType === 'DEVICE_DATA'"
-                          style="width: 170px"
-                          placeholder="请选择属性key"
-                          v-model:value="item.attributeKey"
-                        >
-                          <a-select-option
-                            v-for="attrItem in state.attrList"
-                            :key="attrItem.attributeKey"
-                            :value="attrItem.attributeKey"
-                          >
-                            {{attrItem.attributeKey}}
-                          </a-select-option>
-                        </a-select>
-                      </a-col>
-                      <a-col>
-                        <a-select
-                          v-if="item.modelId && item.conditionType === 'DEVICE_DATA'"
-                          style="width: 170px"
-                          placeholder="请选择操作符"
-                          v-model:value="item.operator"
-                        >
-                          <a-select-option
-                            v-for="operaItem in operatorList"
-                            :key="operaItem"
-                            :value="operaItem"
-                          >
-                            {{operaItem}}
-                          </a-select-option>
-                        </a-select>
-                      </a-col>
-
-                      <a-col v-if=" item.operator && item.conditionType === 'DEVICE_DATA'">
-                        <a-input v-if="item.operator !== 'BETWEEN'" style="width: 170px;" placeholder="请选择触发值" v-model:value="item.value" ></a-input>
-                        <a-input-group compact v-else >
-                          <a-input v-model:value="item.v1" style="width: 20%" />
-                          <a-input v-model:value="item.v2" style="width: 30%" />
-                        </a-input-group>
-                      </a-col>
-                  <a-col>
-                    <!-- sessionEventType -->
-                    <a-select
-                      v-if="item.deviceType && item.conditionType === 'DEVICE_SESSION'"
-                      style="width: 170px"
-                      placeholder="请选择session"
-                      v-model:value="item.sessionEventType"
-                    >
-                      <a-select-option
-                        v-for="essionEventTypeItem in sessionEventTypeList"
-                        :key="essionEventTypeItem.key"
-                        :value="essionEventTypeItem.key"
-                      >
-                        {{essionEventTypeItem.name}}
-                      </a-select-option>
-                    </a-select>
-                  </a-col>
-
-                    <!-- DAILY_TIMER -->
-                    <span v-if="item.conditionType === 'DAILY_TIMER'" >
-                      <a-space>
-                        <a-checkbox-group v-model:value="item.dayOfWeek" :options="dayOptions" />
-                        <a-time-picker v-model:value="item.time" value-format="HH:mm:ss" />
-                      </a-space>
-                    </span>
-
-                </a-row>
-                  <a-space>
-
-                 </a-space>
-                   <a-divider style="height: 2px;" />
-                </a-col>
-                <a-col :span="2" >
-                  <a-button @click="delConditionAndAction(index, 'conditions')" type="link" danger >删除</a-button>
-                </a-col>
-              </a-row>
-            </a-col>
-
-          </a-row>
-          <div v-else class="content"  >尚未设置条件</div>
-        </a-col>
-      </a-row>
-    </a-card>
-    <a-card
-      title="执行动作"
-      :bordered="false"
-    >
-    <a-row>
-      <a-col :span="24" class="df" ><a-button type="primary" @click="addAction" >添加动作</a-button></a-col>
-      <a-col :span="24" v-if="bodyParamsState.actions.length" >
-        <a-row  style="margin-top: 10px;" >
-          <template
-            v-for="(item, index) in bodyParamsState.actions"
-            :key="index"
-          >
-            <a-col
-              style="margin-top: 10px;"
-              :span="22"
-            >
-            <a-row :gutter="[8, 8]" >
-              <a-col>
-                <a-select
-                style="width: 170px"
-                v-model:value="item.actionType"
-              >
-                  <a-select-option
-                    v-for="actionItem in actionTypeList"
-                    :key="actionItem.key"
-                    :value="actionItem.key"
-                  >
-                  {{actionItem.name}}
-                  </a-select-option>
-              </a-select>
-
-              </a-col>
-              <a-col>
-                <!-- 选择产品 -->
-                  <a-select
-                    v-if="item.actionType === 'DEVICE_CMD'"
-                    style="width: 170px"
-                    placeholder="请选择产品"
-                    v-model:value="item.modelId"
-                    @change="changeModel"
-                  >
-                  <a-select-option
-                    v-for="model in state.modelList"
-                    :key="model.id"
-                    :value="model.id"
-                  >
-                    {{model.modelLabel}}
-                  </a-select-option>
-                </a-select>
-              </a-col>
-              <a-col>
-                <a-select
-                      v-if=" item.actionType !== 'NOTICE'  || (item.actionType === 'DEVICE_CMD' && item.modelId)"
-                      style="width: 170px"
-                      placeholder="请选择设备"
-                      v-model:value="item.deviceType"
-                    >
-                      <a-select-option
-                        v-for="deviceItem in selectDeviceList"
-                        :key="deviceItem.key"
-                        :value="deviceItem.key"
-                      >
-                        {{deviceItem.name}}
-                      </a-select-option>
-                </a-select>
-              </a-col>
-              <a-col>
-                <span v-if="item.deviceId" >{{item.deviceLabel}}</span>
-              </a-col>
-              <a-col>
-                <a-button
-                  type="primary"
-                  v-if="item.deviceType === 'target'"
-                  @click="openDeviceModal(index, 'actions')"
-                >
-                  {{item.deviceId ? '重新选择' : '请选择设备'}}
-                </a-button>
-              </a-col>
-              <!-- 选择设备指令 -->
-              <!-- <a-col v-if="item.actionType === 'DEVICE_CMD'" >
-                <a-select style="width: 170px;" @change="changeCmd(item, index)">
-                  <a-select-option
-                    v-for="cmdItem in state.cmdList"
-                    :key="cmdItem.id"
-                    :value="cmdItem.id"
-                  >
-                  {{cmdItem.cmdLabel}}
-                  </a-select-option>
-                </a-select>
-              </a-col> -->
-              <a-col>
-                <!-- <a-input-group compact v-for="cmdParameter in " >
-                  <a-input v-model:value="item.v1" style="width: 20%" />
-                  <a-input v-model:value="item.v2" style="width: 30%" />
-                 </a-input-group> -->
-              </a-col>
-              <a-col>
-                <span v-if="['REPORT_WARN', 'RESUME_WARN'].includes(item.actionType) && item.deviceType" >
-                  <a-space>
-                    <a-input placeholder="请填写告警名称"  v-model:value="item.warnLabel" ></a-input>
-                    <a-input v-if="item.actionType === 'REPORT_WARN'" placeholder="请填写告警描述" v-model:value="item.warnDescription" ></a-input>
-                    <a-select placeholder="请选择告警级别" style="width: 170px" v-model:value="item.warnSeverity" >
-                      <a-select-option v-for="warnItem in warnSeverityList" :key="warnItem.key" :value ='warnItem.key'>
-                        {{warnItem.name}}
-                      </a-select-option>
-                    </a-select>
-                  </a-space>
-                </span>
-              </a-col>
-              <a-col>
-                <span  v-if="item.actionType ==='NOTICE'">
-                  <a-space>
-                    <a-input placeholder="请填写提示名称" style="width: 170px"  v-model:value="item.noticeLabel" ></a-input>
-                    <a-input  placeholder="请填写提示描述" style="width: 170px" v-model:value="item.noticeDescription" ></a-input>
-                    <a-select placeholder="请选择用户" style="width: 170px" v-model:value="item.userId" >
-                      <a-select-option v-for="warnItem in warnSeverityList" :key="warnItem.key" :value ='warnItem.key'>
-                        {{warnItem.name}}
-                      </a-select-option>
-                    </a-select>
-                  </a-space>
-                </span>
-              </a-col>
-            </a-row>
-            </a-col>
-            <a-col :span="2" >
-              <a-button @click="delConditionAndAction(index, 'actions')" type="link" danger >删除</a-button>
-            </a-col>
-            <a-divider style="height: 2px;" />
-        </template>
-        </a-row>
-      </a-col>
-      <div class="content"  v-else >尚未设置动作</div>
-    </a-row>
-    </a-card>
-  </div>
-  </modal-pro>
-
-  <modal-pro
-    style="width: 700px"
-    label="选择设备"
-    :visible="state.deviceModalVisible"
-    @cancel="state.deviceModalVisible = false"
-    @ok="selectDevice"
-  >
-    <SelectDevice
-      ref="selectDeviceRef"
-    />
-  </modal-pro>
-</template>
-<script lang='ts' setup >
-import { FormItemProps } from '@/components/FormPro/index.vue'
-import { ModelAttrController, ModelCmdController, ModelController, RuleController } from '@/controller'
-import { onMounted, reactive, ref } from 'vue'
-import { DownOutlined } from '@ant-design/icons-vue'
-import SelectDevice from './components/selectDevice.vue'
-
-const columns = [
-  {
-    title: '状态',
-    dataIndex: 'status',
-    key: 'status'
-  },
-  {
-    title: '规则ID',
-    dataIndex: 'id',
-    key: 'id'
-  },
-  {
-    title: '规则名称',
-    dataIndex: 'ruleLabel',
-    key: 'ruleLabel'
-  },
-  {
-    title: '规则描述',
-    dataIndex: 'ruleDescription',
-    key: 'ruleDescription'
-  },
-  {
-    title: '操作',
-    dataIndex: 'action',
-    key: 'action'
-  }
-]
-
-const formProps: FormItemProps[] = [
-  {
-    label: '规则名称',
-    key: 'ruleLabel',
-    value: '',
-    type: 'input',
-    rules: true
-  },
-  {
-    label: '规则描述',
-    key: 'ruleDescription',
-    value: '',
-    type: 'textarea',
-    rules: false
-  }
-]
-
-const conditionTypeList = [
-  { key: 'DEVICE_DATA', name: '设备数据触发' },
-  { key: 'DEVICE_SESSION', name: '设备状态触发' },
-  { key: 'DAILY_TIMER', name: '周期时间条件' }
-]
-
-const selectDeviceList = [
-  { key: 'all', name: '全部设备' },
-  { key: 'target', name: '指定设备' }
-]
-
-const sessionEventTypeList = [
-  { key: 'CONNECT', name: '连接' },
-  { key: 'DISCONNECT', name: '断开连接' }
-]
-
-const dayOptions = [
-  { value: 1, label: '周一' },
-  { value: 2, label: '周二' },
-  { value: 3, label: '周三' },
-  { value: 4, label: '周四' },
-  { value: 5, label: '周五' },
-  { value: 6, label: '周六' },
-  { value: 7, label: '周日' }
-]
-
-const actionTypeList = [
-  { key: 'DEVICE_CMD', name: '设备命令' },
-  { key: 'REPORT_WARN', name: '上报告警' },
-  { key: 'RESUME_WARN', name: '恢复告警' },
-  { key: 'NOTICE', name: '通知' }
-]
-
-const warnSeverityList = [
-  { key: 'NOTICE', name: '提示' },
-  { key: 'MINOR', name: '次要' },
-  { key: 'MJAJOP', name: '重要' },
-  { key: 'EMERGENCY', name: '紧急' }
-]
-
-const operatorList = [
-  'EQ', 'NE', 'GT', 'GE', 'LT', 'LE', 'BETWEEN'
-]
-
-const selectDeviceRef = ref('')
-
-const formProRef = ref('')
-
-const queryParamsState = reactive({
-  page: 1,
-  pageSize: 10,
-  total: 0,
-  ruleLabel: ''
-})
-
-const initConditionsData = reactive({
-  conditionType: 'DEVICE_DATA',
-  modelId: '',
-  deviceType: '',
-  deviceLabel: '',
-  deviceId: '',
-  sessionEventType: 'CONNECT',
-  dayOfWeek: [],
-  time: '',
-  noticeLabel: '',
-  noticeDescription: '',
-  userId: '',
-  attributeKey: '',
-  operator: 'EQ',
-  value: '',
-  v1: '',
-  v2: ''
-})
-
-const initActionsData = {
-  actionType: 'DEVICE_CMD',
-  modelId: '',
-  deviceId: '',
-  deviceType: '',
-  cmdLabel: '',
-  cmdParameters: {},
-  warnLabel: '',
-  warnDescription: '',
-  warnSeverity: ''
-}
-
-const bodyParamsState = reactive<{
-  conditions: any,
-  actions: any,
-  conditionLogic: string
-}>({
-  conditionLogic: 'AND',
-  conditions: [],
-  actions: []
-})
-
-const state = reactive({
-  loading: false,
-  dataSource: [],
-  visible: false,
-  deviceModalVisible: false,
-  opraState: 'add',
-  modelList: [],
-  cmdList: [],
-  attrList: [],
-  opraIndex: 0, // 点击 条件 与 动作 时的下标
-  opraKey: ''
-})
-
-// const cmdDetail = computed(() => {})
-
-const changeCmd = (id: string, index: string) => {
-  console.log(id, index)
-}
-
-const changePage = ({ current }) => {
-  queryParamsState.page = current
-  getLinkPage()
-}
-
-const changeConditionAndActionType = (index: string, key: 'conditions' | 'actions') => {
-  console.log('changeConditionType')
-  bodyParamsState[key].splice(index, initActionsData)
-}
-
-const delConditionAndAction = (index: number, key: string) => {
-  bodyParamsState[key].splice(index, 1)
-}
-
-const openDeviceModal = (index: number, key: 'conditions' | 'actions') => {
-  state.opraIndex = index
-  state.deviceModalVisible = true
-  state.opraKey = key
-}
-
-const addAction = () => {
-  bodyParamsState.actions.push({ ...initActionsData })
-}
-
-const addCondition = () => {
-  bodyParamsState.conditions.push({ ...initConditionsData })
-}
-
-const changeModel = (id: string) => {
-  getAttrList(id)
-  getCmdList(id)
-}
-
-// 获取命令
-const getCmdList = async (id: string) => {
-  const { data } = await ModelCmdController.list({ modelId: id })
-  state.cmdList = data
-}
-// 获取属性
-const getAttrList = async (id: string) => {
-  const { data } = await ModelAttrController.list({ modelId: id })
-  state.attrList = data
-}
-
-const selectDevice = () => {
-  console.log('selectDeviceref.value.rowKey:', selectDeviceRef.value.getSelectDevice())
-  const _device = selectDeviceRef.value.getSelectDevice()
-  state.deviceModalVisible = false
-  bodyParamsState[state.opraKey][state.opraIndex].deviceId = _device.id
-  bodyParamsState[state.opraKey][state.opraIndex].deviceLabel = _device.deviceLabel
-}
-
-const delLinkRule = async (id: string) => {
-  await RuleController.delLink(id)
-  getLinkPage()
-}
-
-const ok = async () => {
-  const r = await formProRef.value.onSubmit()
-  const params: any = {}
-  if (r) {
-    console.log(r)
-    Object.keys(r).forEach(key => params[key] = r[key])
-    bodyParamsState.conditions.forEach(item => {
-      if (item.operator === 'BETWEEN') {
-        item.value = `{${item.v1}, ${item.v2}}`
-      }
-    })
-    await RuleController.addLink({ ...params, ...bodyParamsState })
-    state.visible = false
-  }
-}
-
-const changeConditionLogic = (record: string) => {
-  bodyParamsState.conditionLogic = record
-}
-
-const changeStatus = async (record) => RuleController.updateLinkStatus({ id: record.id, status: record.status })
-
-const getLinkPage = async () => {
-  state.loading = true
-  const { data, sum } = await RuleController.pageLink(queryParamsState)
-  state.dataSource = data
-  queryParamsState.total = sum
-  state.loading = false
-}
-
-const getModelList = async () => {
-  const { data } = await ModelController.list()
-  state.modelList = data
-}
-
-onMounted(() => {
-  getLinkPage()
-  getModelList()
-})
-
-</script>
-<style lang='less' scoped >
-
-.content {
-  width: 100%;
-  height: 45px;
-  background-color: #F2F5FC;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  margin: 20px 0;
-}
-
-.df {
-  display: flex;
-  justify-content: end;
-}
-
-</style>

+ 3 - 0
src/pages/Iot/rule/linkRules.vue

@@ -26,6 +26,9 @@
       @change="changePage"
     >
     <template #bodyCell="{column, record}" >
+      <template v-if="column.key === 'id'" >
+        <a @click="openModal('preview', record)" >{{record.id}}</a>
+        </template>
       <template v-if="column.key === 'status'" >
         <a-switch
           v-model:checked="record.status"

+ 5 - 1
src/pages/Iot/task/manage.vue

@@ -62,6 +62,9 @@
     @change="changePage"
   >
     <template #bodyCell="{column, record}">
+      <template v-if="column.key === 'id'" >
+        <a @click="openModal('update', record.id)" >{{record.id}}</a>
+        </template>
           <template v-if="column.key === 'status'" >
             <a-switch
               @click="changeStatus(record)"
@@ -215,7 +218,8 @@ import SelectDevice from '@/pages/iot/rule/components/selectDevice.vue'
 const columns = [
   {
     title: 'id',
-    dataIndex: 'id'
+    dataIndex: 'id',
+    key: 'id'
   },
   {
     title: '任务名称',

+ 11 - 3
src/pages/Iot/task/track.vue

@@ -1,9 +1,14 @@
 <template>
 <a-card>
   <a-row>
-    <a-col>
-      <a-range-picker v-model:value="time" :format="['DD/MM/YYYY', 'DD/MM/YYYY']"  />
-    </a-col>
+    <a-space>
+     <a-col>
+        <a-range-picker v-model:value="time" :format="['DD/MM/YYYY', 'DD/MM/YYYY']"  />
+      </a-col>
+      <a-col>
+        <a-button type="primary" @click="getTrackTaskList">搜索</a-button>
+     </a-col>
+    </a-space>
   </a-row>
 
   <a-table
@@ -15,6 +20,9 @@
     @change="changePage"
   >
     <template #bodyCell="{column, record}">
+      <template v-if="column.key === 'ts'" >
+          {{dayjs(record.ts).format('YYYY/MM/DD HH:MM:ss')}}
+        </template>
           <template v-if="column.key === 'action'" >
             <a-space>
               <a @click="openModal('preview', record.id)" >详情</a>