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