fix: 物模型开发
This commit is contained in:
parent
09eb1c3a2a
commit
1f70697392
|
@ -33,7 +33,7 @@ const BaseColumns: JColumnProps[] = [
|
||||||
const EventColumns: JColumnProps[] = BaseColumns.concat([
|
const EventColumns: JColumnProps[] = BaseColumns.concat([
|
||||||
{
|
{
|
||||||
title: '事件级别',
|
title: '事件级别',
|
||||||
dataIndex: 'expands',
|
dataIndex: 'level',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
@ -59,12 +59,12 @@ const PropertyColumns: JColumnProps[] = BaseColumns.concat([
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '属性来源',
|
title: '属性来源',
|
||||||
dataIndex: 'expands',
|
dataIndex: 'source',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '读写类型',
|
title: '读写类型',
|
||||||
dataIndex: 'expands',
|
dataIndex: 'type',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
@ -77,7 +77,7 @@ const TagColumns: JColumnProps[] = BaseColumns.concat([
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '读写类型',
|
title: '读写类型',
|
||||||
dataIndex: 'expands',
|
dataIndex: 'type',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<JTable :loading="loading" :data-source="data" size="small" :columns="columns" row-key="id">
|
<JTable :loading="loading" :data-source="data" size="small" :columns="columns" row-key="id" model="TABLE">
|
||||||
<template #headerTitle>
|
<template #headerTitle>
|
||||||
<a-input-search v-model:value="searchValue" placeholder="请输入名称" @search="handleSearch"></a-input-search>
|
<a-input-search v-model:value="searchValue" placeholder="请输入名称" @search="handleSearch"></a-input-search>
|
||||||
<PermissionButton :has-permission="permission" key="add" @click="handleAddClick"
|
<PermissionButton :has-permission="permission" key="add" @click="handleAddClick"
|
||||||
|
@ -11,11 +11,24 @@
|
||||||
</template>
|
</template>
|
||||||
新增
|
新增
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
<Edit
|
<Edit v-if="metadataStore.model.edit" :type="target" :tabs="type"></Edit>
|
||||||
v-if="metadataStore.model.edit"
|
</template>
|
||||||
:type="target"
|
<template #level="slotProps">
|
||||||
:tabs="type"
|
{{ levelMap[slotProps.expands?.level] || '-' }}
|
||||||
></Edit>
|
</template>
|
||||||
|
<template #async="slotProps">
|
||||||
|
{{ slotProps.async ? '是' : '否' }}
|
||||||
|
</template>
|
||||||
|
<template #valueType="slotProps">
|
||||||
|
{{ slotProps.valueType?.type }}
|
||||||
|
</template>
|
||||||
|
<template #source="slotProps">
|
||||||
|
{{ sourceMap[slotProps.expands?.source] }}
|
||||||
|
</template>
|
||||||
|
<template #type="slotProps">
|
||||||
|
<a-tag v-for="item in (slotProps.expands?.type || [])" :key="item">
|
||||||
|
{{ expandsType[item] }}
|
||||||
|
</a-tag>
|
||||||
</template>
|
</template>
|
||||||
</JTable>
|
</JTable>
|
||||||
</template>
|
</template>
|
||||||
|
@ -42,6 +55,21 @@ const productStore = useProductStore()
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const data = ref<MetadataItem[]>([])
|
const data = ref<MetadataItem[]>([])
|
||||||
const { type, target = 'product' } = props
|
const { type, target = 'product' } = props
|
||||||
|
const levelMap = ref({
|
||||||
|
ordinary: '普通',
|
||||||
|
warn: '警告',
|
||||||
|
urgent: '紧急',
|
||||||
|
})
|
||||||
|
const sourceMap = ref({
|
||||||
|
device: '设备',
|
||||||
|
manual: '手动',
|
||||||
|
rule: '规则',
|
||||||
|
});
|
||||||
|
const expandsType = ref({
|
||||||
|
read: '读',
|
||||||
|
write: '写',
|
||||||
|
report: '上报',
|
||||||
|
});
|
||||||
const actions: JColumnProps[] = [
|
const actions: JColumnProps[] = [
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
@ -97,4 +125,5 @@ const operateLimits = (action: 'add' | 'updata', types: MetadataType) => {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|
||||||
</style>
|
</style>
|
|
@ -19,7 +19,7 @@
|
||||||
<a-tab-pane v-for="item in codecs" :key="item.id" :tab="item.name">
|
<a-tab-pane v-for="item in codecs" :key="item.id" :tab="item.name">
|
||||||
<div class="cat-panel">
|
<div class="cat-panel">
|
||||||
<!-- TODO 代码编辑器 -->
|
<!-- TODO 代码编辑器 -->
|
||||||
{{ value }}
|
<MonacoEditor v-model="value" theme="vs" style="height: 100%"></MonacoEditor>
|
||||||
</div>
|
</div>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<template #addonAfter>
|
<template #addonAfter>
|
||||||
<a-upload v-model:file-list="fileList" :before-upload="beforeUpload" accept=".json"
|
<a-upload v-model:file-list="fileList" :before-upload="beforeUpload" accept=".json"
|
||||||
:show-upload-list="false" :action="FILE_UPLOAD" @change="fileChange"
|
:show-upload-list="false" :action="FILE_UPLOAD" @change="fileChange"
|
||||||
:headers="{ 'X-Access-Token': token }">
|
:headers="{ 'X-Access-Token': getToken()}">
|
||||||
<upload-outlined class="upload-button"/>
|
<upload-outlined class="upload-button"/>
|
||||||
<!-- <button id="uploadFile" style="display: none;"></button> -->
|
<!-- <button id="uploadFile" style="display: none;"></button> -->
|
||||||
</a-upload>
|
</a-upload>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="物模型" v-bind="validateInfos.import" v-if="formModel.metadataType === 'script'">
|
<a-form-item label="物模型" v-bind="validateInfos.import" v-if="formModel.metadataType === 'script'">
|
||||||
<!-- TODO代码编辑器 -->
|
<!-- TODO代码编辑器 -->
|
||||||
<a-textarea v-model:value="formModel.import"></a-textarea>
|
<MonacoEditor v-model="formModel.import" theme="vs" style="height: 300px"></MonacoEditor>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
@ -64,8 +64,8 @@ import { useInstanceStore } from '@/store/instance'
|
||||||
import { useProductStore } from '@/store/product';
|
import { useProductStore } from '@/store/product';
|
||||||
import { UploadOutlined, ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
import { UploadOutlined, ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import { FILE_UPLOAD } from '@/api/comm';
|
import { FILE_UPLOAD } from '@/api/comm';
|
||||||
import { LocalStore } from '@/utils/comm';
|
import { LocalStore, getToken } from '@/utils/comm';
|
||||||
import { TOKEN_KEY } from '@/utils/variable';
|
import MonacoEditor from '@/components/MonacoEditor/index.vue'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const instanceStore = useInstanceStore()
|
const instanceStore = useInstanceStore()
|
||||||
|
@ -147,7 +147,6 @@ const onSubmit = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const fileList = ref<UploadFile[]>([])
|
const fileList = ref<UploadFile[]>([])
|
||||||
const token = ref(LocalStore.get(TOKEN_KEY));
|
|
||||||
|
|
||||||
const productList = ref<DefaultOptionType[]>([])
|
const productList = ref<DefaultOptionType[]>([])
|
||||||
|
|
||||||
|
|
|
@ -32,16 +32,16 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<a-tab-pane tab="属性定义" key="properties">
|
<a-tab-pane tab="属性定义" key="properties">
|
||||||
<BaseMetadata target={props.type} type="properties" :permission="permission" />
|
<BaseMetadata :target="type" type="properties" :permission="permission" />
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane tab="功能定义" key="functions">
|
<a-tab-pane tab="功能定义" key="functions">
|
||||||
<BaseMetadata target={props.type} type="functions" :permission="permission" />
|
<BaseMetadata :target="type" type="functions" :permission="permission" />
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane tab="事件定义" key="events">
|
<a-tab-pane tab="事件定义" key="events">
|
||||||
<BaseMetadata target={props.type} type="events" :permission="permission" />
|
<BaseMetadata :target="type" type="events" :permission="permission" />
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane tab="标签定义" key="tags">
|
<a-tab-pane tab="标签定义" key="tags">
|
||||||
<BaseMetadata target={props.type} type="tags" :permission="permission" />
|
<BaseMetadata :target="type" type="tags" :permission="permission" />
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
<Import v-model:visible="visible" :type="type" @close="visible = false" />
|
<Import v-model:visible="visible" :type="type" @close="visible = false" />
|
||||||
|
@ -58,6 +58,7 @@ import { SystemConst } from '@/utils/consts'
|
||||||
import { useInstanceStore } from '@/store/instance'
|
import { useInstanceStore } from '@/store/instance'
|
||||||
import Import from './Import/index.vue'
|
import Import from './Import/index.vue'
|
||||||
import Cat from './Cat/index.vue'
|
import Cat from './Cat/index.vue'
|
||||||
|
import BaseMetadata from './Base/index.vue'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const instanceStore = useInstanceStore()
|
const instanceStore = useInstanceStore()
|
||||||
|
|
Loading…
Reference in New Issue