fix: bug#物模型新增改造

* fix: bug#物模型新增改造
This commit is contained in:
qiaochuLei 2023-11-28 15:45:58 +08:00 committed by GitHub
parent 809a66956c
commit 95f6f45e88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 28 deletions

View File

@ -1,6 +1,6 @@
<template>
<div ref="tableContainer">
<j-data-table
<j-data-table
v-if="!heavyLoad"
ref="tableRef"
:data-source="dataSource"
:columns="columns"
@ -37,7 +37,6 @@
:hasPermission="`${permission}:update`"
key="update"
:loading="loading"
:disabled="hasOperate('add', type) || !editStatus"
:tooltip="{
title: hasOperate('add', type)
@ -202,10 +201,11 @@
</PermissionButton>
</j-space>
</template>
</j-data-table>
<PermissionButton
type="dashed"
</j-data-table>
<PermissionButton
type="primary"
block
ghost
:hasPermission="`${permission}:update`"
key="add"
:disabled="hasOperate('add', type)"
@ -219,9 +219,9 @@
@click="handleAddClick()"
placement="topRight"
>
新增
</PermissionButton>
</div>
<template #icon><AIcon type="PlusOutlined"/></template>
新增行
</PermissionButton>
<PropertiesModal
v-if="type === 'properties' && detailData.visible"
:data="detailData.data"
@ -279,6 +279,7 @@ import {useSystem} from "store/system";
import {storeToRefs} from "pinia";
import { FULL_CODE } from 'jetlinks-ui-components/es/DataTable'
import { usePermissionStore } from '@/store/permission';
import App from '@/App.vue';
const props = defineProps({
target: {
@ -323,7 +324,7 @@ const detailData = reactive({
visible:false
})
const heavyLoad = ref<Boolean>(false)
const showSave = ref(metadata.value.length !== 0)
@ -449,7 +450,6 @@ const removeItem = (index: number) => {
// }
if (_data.length === 0) {
showSave.value = false
handleSaveClick()
}
}
@ -559,11 +559,6 @@ onUnmounted(() => {
watch(() => metadata.value, () => {
dataSource.value = metadata.value
if(!dataSource.value.length){
nextTick(()=>{
tableContainer.value.classList.add('tableContainer')
})
}
}, { immediate: true })
onBeforeRouteUpdate((to, from, next) => { //
@ -582,9 +577,4 @@ onBeforeRouteLeave((to, from, next) => { // 设备管理外路由跳转
justify-content: space-between;
padding-bottom: 16px;
}
.tableContainer{
:deep(.ant-table-body){
display: none;
}
}
</style>

View File

@ -49,6 +49,7 @@ const handleOk = async () => {
...form.checkedMenu,
// ...form.half,
]);
dealMenu(items)
console.log(items);
if (form.checkedSystem) {
if (items && items.length !== 0) {
@ -169,6 +170,17 @@ function getSystemList(id: string) {
});
}
const dealMenu = (data:any)=>{
data?.forEach((i:any)=>{
i.options = {
show:true
}
if(i.children){
dealMenu(i.children)
}
})
}
watch(() => props.data, (newVal: any) => {
form.checkedSystem = newVal?.page.configuration?.checkedSystem
if (form.checkedSystem) {

View File

@ -4,6 +4,7 @@
title="集成菜单"
visible
width="800px"
:maskClosable="false"
@cancel="cancel"
@ok="cancel"
>
@ -106,12 +107,10 @@
{
required: true,
message: '请输入名称',
trigger: 'change',
},
{
max: 64,
message: '最多可输入64个字符',
trigger: 'change',
},
]">
<j-input v-model:value="formData.name" placeholder="请输入名称" />
@ -122,12 +121,10 @@
{
required: true,
message: '请输入编码',
trigger: 'change',
},
{
max: 64,
message: '最多可输入64个字符',
trigger: 'change',
},
{
validator: checkCode,
@ -152,12 +149,12 @@
</j-col> -->
</j-row>
</div>
<j-form-item label="页面地址" name="url" :rules="[
<j-form-item label="页面地址" name="url" :validateFirst="true" :rules="[
{
required: true,
message: '请输入页面地址',
},
{ max: 128, message: '最多可输入128字符' },
{ max: 128, message: '最多可输入128字符'},
{ pattern: /^\//, message: '请正确填写地址,以/开头' },
]">
<j-input v-model:value="formData.url" placeholder="请输入页面地址" />
@ -268,6 +265,7 @@ const addChildrenMenu = (data:any) =>{
const addMenu = () =>{
initFormData()
formData.value.sortIndex = rootMenuTotal.value
sourceCode.value = ''
showControls.value = true
editType.value = 'add'
}

View File

@ -312,7 +312,8 @@ const tableRef = ref();
const current = ref<any>({})
const table = {
refresh: () => {
tableRef.value.reload(queryParams.value);
// tableRef.value.reload(queryParams.value);
window.location.reload()
},
toAdd: () => {
visible.value = true

View File

@ -3,6 +3,7 @@
visible
title="菜单图标"
width="800px"
:maskClosable="false"
@cancel="emits('update:visible', false)"
@ok="confirm"
>