lvkun996 hace 2 años
padre
commit
0c7897ec60

+ 49 - 49
src/App.vue

@@ -1,49 +1,49 @@
-<template>
-    <a-config-provider
-      :locale="zhCN"
-      :theme="{
-        algorithm: designStore.theme,
-      }"
-    >
-      <router-view/>
-    </a-config-provider>
-    <div id="teleport-full-container" >
-
-    </div>
-</template>
-<script setup lang="ts" >
-import zhCN from 'ant-design-vue/es/locale/zh_CN'
-import dayjs from 'dayjs'
-import 'dayjs/locale/zh-cn'
-import { useDesignStore } from '@/store'
-import { useRouter } from 'vue-router'
-
-dayjs.locale('zh-cn')
-
-const designStore = useDesignStore()
-
-function closeTeleport () {
-  // console.log(this)
-}
-// theme.defaultAlgorithm
-
-</script>
-<style lang="less">
-@import '~@/styles/theme.less';
-
-#teleport-full-container {
-    position: fixed;
-    top: 0;
-    right: 0;
-    left: 0;
-    bottom: 0;
-    background-color: #fff;
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    z-index: -1;
-    pointer-events: 'none'
-
-}
-
-</style>
+<template>
+    <a-config-provider
+      :locale="zhCN"
+      :theme="{
+        algorithm: designStore.theme,
+      }"
+    >
+      <router-view/>
+    </a-config-provider>
+    <div id="teleport-full-container" >
+
+    </div>
+</template>
+<script setup lang="ts" >
+import zhCN from 'ant-design-vue/es/locale/zh_CN'
+import dayjs from 'dayjs'
+import 'dayjs/locale/zh-cn'
+import { useDesignStore } from '@/store'
+import { useRouter } from 'vue-router'
+
+dayjs.locale('zh-cn')
+
+const designStore = useDesignStore()
+
+function closeTeleport () {
+  // console.log(this)
+}
+// theme.defaultAlgorithm
+
+</script>
+<style lang="less">
+@import '~@/styles/theme.less';
+
+#teleport-full-container {
+    position: fixed;
+    top: 0;
+    right: 0;
+    left: 0;
+    bottom: 0;
+    background-color: #fff;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    z-index: -1;
+    pointer-events: 'none'
+
+}
+
+</style>

+ 48 - 47
src/components/RealView/index.less

@@ -1,48 +1,49 @@
-
-.real-view {
-  width: 100%;
-  height: 100%;
-  position: absolute;
-  top: -24px;
-  left: 0;
-  z-index: 99;
-  background-color: #f7f7f9;
-  .header {
-    height: 48px;
-    display: flex;
-    align-items: center;
-    padding-left: 18px;
-    background-color: #fff;
-    .back-button {
-      display: flex;
-      align-items: center;
-      cursor: pointer;
-    }
-  }
-  .tabs {
-    width: 100%;
-    height: 45px;
-    background-color: #fff;
-    padding-left: 10px;
-  }
-  .real-view-content {
-    width: 100%;
-    height: 100%;
-    padding: 18px;
-    padding-bottom: 168px;
-    overflow: hidden;
-    overflow-y: auto;
-  }
-
-
-  .footer {
-    width: 100%;
-    height: 60px;
-    background-color: #fff;
-    position: absolute;
-    right: 0;
-    bottom: 60px;
-    padding-left: 18px;
-    z-index: 100;
-  }
+
+.real-view {
+  width: 100%;
+  height: 100%;
+  position: absolute;
+  top: -24px;
+  left: 0;
+  z-index: 99;
+  background-color: #f7f7f9;
+  padding-bottom: 100px;
+  .header {
+    height: 48px;
+    display: flex;
+    align-items: center;
+    padding-left: 18px;
+    background-color: #fff;
+    .back-button {
+      display: flex;
+      align-items: center;
+      cursor: pointer;
+    }
+  }
+  .tabs {
+    width: 100%;
+    height: 45px;
+    background-color: #fff;
+    padding-left: 10px;
+  }
+  .real-view-content {
+    width: 100%;
+    height: 100%;
+    padding: 18px;
+    padding-bottom: 168px;
+    overflow: hidden;
+    overflow-y: auto;
+  }
+
+
+  .footer {
+    width: 100%;
+    height: 60px;
+    background-color: #fff;
+    position: absolute;
+    right: 0;
+    bottom: 60px;
+    padding-left: 18px;
+    z-index: 100;
+  }
 }

+ 12 - 18
src/components/RealView/index.tsx

@@ -1,4 +1,4 @@
-import { defineComponent, onMounted, PropType, ref, Teleport, toRef, toRefs } from 'vue'
+import { defineComponent, onMounted, PropType, ref, Suspense, Teleport, toRef, toRefs } from 'vue'
 import { Row, Col, Tabs, Space, Button } from 'ant-design-vue'
 import { LeftOutlined } from '@ant-design/icons-vue'
 import './index.less'
@@ -15,7 +15,7 @@ const RealView = defineComponent({
     },
     tabsList: {
       type: Array as PropType<{key: string, tab: string}[]>,
-      default: () => []
+      default: null
     },
     footer: {
       type: Boolean,
@@ -29,6 +29,7 @@ const RealView = defineComponent({
   emits: ['cancel', 'tabChang', 'ok'],
   setup (props, ctx) {
     const { open, tabKey, tabsList, footer, title } = toRefs(props)
+    console.log('tabsList2313131:', tabsList.value)
 
     const cancel = () => ctx.emit('cancel')
 
@@ -36,13 +37,6 @@ const RealView = defineComponent({
 
     const onTabChange = (key) => ctx.emit('tabChang', key)
 
-    const TabsRender =
-      <div class="tabs" key={tabKey.value}>
-        <Tabs activeKey={tabKey.value} tabBarStyle={{ backgroundColor: 'fff', height: '45px' }} onChange={(key) => onTabChange(key)} >
-          { tabsList.value.map(item => <Tabs.TabPane key={item.key} tab={item.tab}> </Tabs.TabPane>) }
-        </Tabs>
-      </div>
-
     return () => (
       <>
       {
@@ -58,15 +52,15 @@ const RealView = defineComponent({
                   </a-space>
                 </div>
               </Row>
-              {
-                tabsList.value.length
-                  ? <div class="tabs" >
-                <Tabs activeKey={tabKey.value} tabBarStyle={{ backgroundColor: 'fff', height: '45px' }} onChange={(key) => onTabChange(key)} >
-                  { tabsList.value.map(item => <Tabs.TabPane key={item.key} tab={item.tab}> </Tabs.TabPane>) }
-                </Tabs>
-             </div>
-                  : <></>
-              }
+                {
+                     tabsList.value
+                       ? <div class="tabs" >
+                       <Tabs activeKey={tabKey.value} tabBarStyle={{ backgroundColor: 'fff', height: '45px' }} onChange={(key) => onTabChange(key)} >
+                         { tabsList.value.map(item => <Tabs.TabPane key={item.key} tab={item.tab}> </Tabs.TabPane>) }
+                       </Tabs>
+                       </div>
+                       : null
+                  }
 
               <div class='real-view-content' >
                 {ctx.slots.default?.()}

+ 1 - 2
src/controller/iot/tps.ts

@@ -3,8 +3,7 @@ import { message } from 'ant-design-vue'
 
 export class TpsController {
   static async list () {
-    const { data } = await getTpsList()
-    return data
+    return await getTpsList()
   }
 
   static async devicePage (params: {page: number, pageSize: number, label?: string, deviceId?: string}) {

+ 6 - 7
src/pages/Iot/device/analysis.vue

@@ -11,7 +11,6 @@
     @tabChange="key => onTabChange(key)"
   >
     <a-row :gutter="[8, 8]" style="margin: 0 20px;" >
-
         <a-col :span="24" >
           <a-space>
             <a-spin
@@ -48,7 +47,7 @@
                   :key="item.key"
                   :value="item.key"
                 >{{item.keyLabel}}</a-select-option>
-              </a-select>
+            </a-select>
             <!-- 聚合函数参数 -->
             <a-select v-if="activeTabKey ===  'poly'" placeholder="聚合函数只对数字类型有效"  style="width: 220px" v-model:value="state.aggregationFunc" >
               <a-select-option v-for="item in aggregationFunc" :key="item.key">
@@ -64,7 +63,8 @@
                 </a-select>
               </template>
             </a-input>
-            <a-range-picker :show-time="{ format: 'HH:mm' }" v-model:value="times" @change="changeRangePicker"  />
+            <a-range-picker :show-time="{ format: 'HH:mm' }" v-model:value="times"   />
+            <a-button @change="search" >搜索</a-button>
           </a-space>
         </a-col>
         <a-col :span="24">
@@ -91,7 +91,6 @@
           </span>
         </a-spin>
         </a-col>
-
       </a-row>
   </a-card>
 </template>
@@ -175,7 +174,7 @@ const state = reactive<{
   offlineNum: 0,
   attributeKey: null,
   aggregationFunc: null,
-  period: '',
+  period: '1',
   periodUnit: 'd'
 })
 
@@ -272,8 +271,8 @@ const selectAttr = (value: string) => {
   getDeviceAttr()
 }
 
-const changeRangePicker = (time) => {
-  activeTabKey.value === 'session' ? getDeviceSession() : getDeviceAttr()
+const search = (time) => {
+  // activeTabKey.value === 'session' ? getDeviceSession() : getDeviceAttr()
 }
 
 const selectDevice = async (value: string) => {

+ 6 - 5
src/pages/Iot/tps/device.vue

@@ -5,7 +5,7 @@
       :serviceParams="queryParams"
       :columns="columns"
       ref="tableProDom"
-      @add="openModal"
+      @add="openModal('add')"
     >
     <template #search >
       <!-- <a-space><InputTsx placeholder="请输入设备名称进行搜索" v-model:value="deviceName" /> <a-button type="primary" @click="search">搜索</a-button> </a-space> -->
@@ -25,6 +25,7 @@
   <RealView
     :open="visible"
     @cancel="closeModal"
+    footer
   >
     <a-card title="基本信息" >
       <template #extra >
@@ -68,7 +69,7 @@
         </a-form-item>
       </a-form>
     </a-card>
-    <a-card title="第三方服务参数" >
+    <a-card title="第三方服务参数" style="margin-top: 20px;" >
       <a-form-item label="ak" >
         <InputTsx allowClear placeholder="ak" v-model:value="deviceState.thirdParam.ak" />
       </a-form-item>
@@ -173,7 +174,7 @@ const onChangeMethod = (method: string) => {
 
 const onChangeDevice = (deviceId: string) => deviceState.deviceId = deviceId
 
-const { state: deviceState, reset: resetDeviceState } = useReactive<TPS.Device>({
+const deviceState = reactive<TPS.Device>({
   deviceId: '',
   thirdCode: '',
   label: '',
@@ -207,10 +208,10 @@ const search = () => {
   tableProDom.value.reload()
 }
 
-const openModal = (type: 'add' | 'update', record: TPS.Device) => {
+const openModal = (type: 'add' | 'update', record?: TPS.Device) => {
   opraState.value = type
   visible.value = true
-  resetDeviceState(record)
+  // resetDeviceState(record)
 }
 
 const closeModal = () => {

+ 6 - 6
src/pages/Iot/tps/list.vue

@@ -5,19 +5,19 @@
     :columns="columns"
     :hiddenMeunKeys="['add']"
   >
-
+    <template #render="{column, record}" >
+      <template v-if="column.key === 'registerTime'">
+        {{dayjs(record.registerTime).format('YYYY/MM/DD HH:mm:ss')}}
+      </template>
+    </template>
   </table-pro>
 </a-card>
 </template>
 <script lang='ts' setup >
 import { TpsController } from '@/controller'
+import dayjs from 'dayjs'
 
 const columns = [
-  {
-    title: '服务ID',
-    dataIndex: 'id',
-    key: 'id'
-  },
   {
     title: '名称',
     dataIndex: 'label',

+ 1 - 1
src/router/index.ts

@@ -323,7 +323,7 @@ const login = {
   meta: {
     title: '登录'
   },
-  component: () => import('@/pages/login/index.vue')
+  component: () => import('@commons/pages/login/index.vue')
 }
 
 const cvs = {

+ 3 - 0
vue.config.js

@@ -28,6 +28,7 @@ module.exports = defineConfig({
     config.resolve.alias
       .set('ThingsUi', resolve(__dirname, '/'))
       .set('AppConfig', resolve(__dirname, './config/defaultSetting'))
+      .set('@commons', resolve(__dirname, '../main/src/common'))
     config.stats('none')
     config.mode('development')
   },
@@ -35,11 +36,13 @@ module.exports = defineConfig({
     plugins: [
       // new BundleAnalyzerPlugin()
     ],
+    // qiankun 打包配置
     output: {
       library: `${packageName}`,
       libraryTarget: 'umd',
       chunkLoadingGlobal: `webpackJsonp_${packageName}`
     }
+    // qiankun 打包配置
   },
   css: {
     loaderOptions: {