fix: 修复datSource问题

This commit is contained in:
100011797 2023-02-01 10:58:26 +08:00
parent e09eda6b41
commit 2ba0164295
7 changed files with 69 additions and 6 deletions

View File

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 544 B

View File

@ -207,6 +207,7 @@ const JTable = defineComponent<JTableProps>({
_dataSource.value = [] _dataSource.value = []
} }
} else { } else {
console.log(props?.dataSource)
_dataSource.value = props?.dataSource || [] _dataSource.value = props?.dataSource || []
} }
loading.value = false loading.value = false
@ -220,6 +221,16 @@ const JTable = defineComponent<JTableProps>({
{deep: true, immediate: true} {deep: true, immediate: true}
) )
watch(
() => props.dataSource,
(newValue) => {
if(props.dataSource){
handleSearch(props.params)
}
},
{deep: true, immediate: true}
)
onMounted(() => { onMounted(() => {
window.onresize = () => { window.onresize = () => {
windowChange() windowChange()

View File

@ -0,0 +1,46 @@
<template>
<a-card>
<a-row type="flex">
<a-col flex="200px">
<div>
<a-input-search
v-model:value="value"
placeholder="请输入事件名称"
style="width: 200px; margin-bottom: 10px"
@search="onSearch"
/>
<a-tabs
tab-position="left"
:style="{ height: '600px' }"
v-model:activeKey="activeKey"
tabBarStyle="width: 200px"
>
<a-tab-pane v-for="i in tabList" :key="i.key" :tab="i.tab" />
</a-tabs>
</div>
</a-col>
<a-col flex="auto">
<!-- <component :is="tabs[activeKey]" /> -->
123
</a-col>
</a-row>
</a-card>
</template>
<script lang="ts" setup>
const activeKey = ref<string>('property')
const tabList = ref<{key: string, tab: string}[]>([
{
key: 'property',
tab: '属性'
},
{
key: 'event1',
tab: '事件1'
}
])
const onSearch = () => {
}
</script>

View File

@ -32,7 +32,7 @@
</div> </div>
</template> </template>
<template #extra> <template #extra>
<img @click="handleRefresh" :src="getImage('/device/instance/button.png')" style="margin-right: 20px; cursor: pointer;" /> <img @click="handleRefresh" :src="getImage('/device/button.png')" style="margin-right: 20px; cursor: pointer;" />
</template> </template>
<component :is="tabs[instanceStore.tabActiveKey]" /> <component :is="tabs[instanceStore.tabActiveKey]" />
</page-container> </page-container>
@ -41,6 +41,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useInstanceStore } from '@/store/instance'; import { useInstanceStore } from '@/store/instance';
import Info from './Info/index.vue'; import Info from './Info/index.vue';
import Running from './Running/index.vue'
import Metadata from '../../components/Metadata/index.vue'; import Metadata from '../../components/Metadata/index.vue';
import { _deploy, _disconnect } from '@/api/device/instance' import { _deploy, _disconnect } from '@/api/device/instance'
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
@ -59,6 +60,10 @@ const list = [
key: 'Info', key: 'Info',
tab: '实例信息' tab: '实例信息'
}, },
{
key: 'Running',
tab: '运行状态'
},
{ {
key: 'Metadata', key: 'Metadata',
tab: '物模型' tab: '物模型'
@ -67,7 +72,8 @@ const list = [
const tabs = { const tabs = {
Info, Info,
Metadata Metadata,
Running
} }
watch( watch(

View File

@ -385,7 +385,7 @@ const handleAdd = () => {
* 查看 * 查看
*/ */
const handleView = (id: string) => { const handleView = (id: string) => {
router.push('/device/instance/detail/' + id); router.push('/iot/device/instance/detail/' + id);
}; };
const getActions = ( const getActions = (

View File

@ -1,5 +1,5 @@
<template> <template>
<div>123</div> <page-container>阿里云</page-container>
</template> </template>
<script setup> <script setup>

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <page-container>
<JTable <JTable
:columns="columns" :columns="columns"
:request="request" :request="request"
@ -69,7 +69,7 @@
</a-space> </a-space>
</template> </template>
</JTable> </JTable>
</div> </page-container>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">