Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
9dff4d7a95
|
@ -1 +1,2 @@
|
||||||
|
ENV=develop
|
||||||
VITE_APP_BASE_API=/api
|
VITE_APP_BASE_API=/api
|
|
@ -1 +1,2 @@
|
||||||
|
ENV=production
|
||||||
VITE_APP_BASE_API=/api
|
VITE_APP_BASE_API=/api
|
|
@ -0,0 +1,49 @@
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
|
const rootPath = path.resolve(__dirname, '../')
|
||||||
|
|
||||||
|
function optimizeAntdComponents(moduleName: string): string[] {
|
||||||
|
const moduleESPath = `${moduleName}/es`
|
||||||
|
const nodeModulePath = `./node_modules/${moduleESPath}`
|
||||||
|
const includes: string[] = [moduleESPath]
|
||||||
|
|
||||||
|
const folders = fs.readdirSync(
|
||||||
|
path.resolve(rootPath, nodeModulePath)
|
||||||
|
)
|
||||||
|
|
||||||
|
folders.map(name => {
|
||||||
|
const folderName = path.resolve(
|
||||||
|
rootPath,
|
||||||
|
nodeModulePath,
|
||||||
|
name
|
||||||
|
)
|
||||||
|
let stat = fs.lstatSync(folderName)
|
||||||
|
if (stat.isDirectory()) {
|
||||||
|
let styleFolder = path.resolve(folderName, 'style')
|
||||||
|
if (fs.existsSync((styleFolder))) {
|
||||||
|
let _stat = fs.lstatSync(styleFolder)
|
||||||
|
if (_stat.isDirectory()) {
|
||||||
|
includes.push(`${moduleESPath}/${name}/style`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return includes
|
||||||
|
}
|
||||||
|
|
||||||
|
export function optimizeDeps() {
|
||||||
|
return {
|
||||||
|
name: "optimizeDeps",
|
||||||
|
configResolved: async (config) => {
|
||||||
|
const components = [
|
||||||
|
...optimizeAntdComponents('ant-design-vue'),
|
||||||
|
...optimizeAntdComponents('jetlinks-ui-components')
|
||||||
|
]
|
||||||
|
let concat = config.optimizeDeps.include.concat(components)
|
||||||
|
config.optimizeDeps.include = Array.from(new Set(concat))
|
||||||
|
console.log(config.optimizeDeps.include)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<router-view />
|
<ConfigProvider :locale='zhCN'>
|
||||||
|
<router-view />
|
||||||
|
</ConfigProvider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ConfigProvider } from 'jetlinks-ui-components'
|
||||||
|
import zhCN from 'jetlinks-ui-components/es/locale/zh_CN';
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
const color = {
|
||||||
|
'processing': '64, 169, 255',
|
||||||
|
'error': '247, 79, 70',
|
||||||
|
'success': '74, 234, 220',
|
||||||
|
'warning': '250, 178, 71',
|
||||||
|
'default': '63, 73, 96'
|
||||||
|
}
|
||||||
|
export const getHexColor = (code: string, pe: number = 0.3) => {
|
||||||
|
const _color = color[code] || color.default
|
||||||
|
if (code === 'default') {
|
||||||
|
pe = 0.1
|
||||||
|
}
|
||||||
|
return `rgba(${_color}, ${pe})`
|
||||||
|
}
|
||||||
|
|
||||||
|
export default color
|
|
@ -1,12 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<j-badge
|
<j-badge
|
||||||
:status="statusNames ? statusNames[status] : 'default'"
|
:color="_color"
|
||||||
:text="text"
|
:text="text"
|
||||||
></j-badge>
|
></j-badge>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// import { StatusColorEnum } from '@/utils/consts.ts';
|
// import { StatusColorEnum } from '@/utils/consts.ts';
|
||||||
|
import { getHexColor } from './color'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
text: {
|
text: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -26,6 +27,18 @@ const props = defineProps({
|
||||||
* 0: 'error'
|
* 0: 'error'
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
statusNames: { type: Object },
|
statusNames: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({
|
||||||
|
'success': 'success',
|
||||||
|
'warning': 'warning',
|
||||||
|
'error': 'error',
|
||||||
|
'default': 'default',
|
||||||
|
})
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const _color = computed(() => {
|
||||||
|
return getHexColor(props.statusNames[props.status], 1)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
<div
|
<div
|
||||||
v-if="showStatus"
|
v-if="showStatus"
|
||||||
class="card-state"
|
class="card-state"
|
||||||
:class="statusNames ? statusNames[status] : ''"
|
:style='{
|
||||||
|
backgroundColor: getHexColor(statusNames[status])
|
||||||
|
}'
|
||||||
>
|
>
|
||||||
<div class="card-state-content">
|
<div class="card-state-content">
|
||||||
<BadgeStatus
|
<BadgeStatus
|
||||||
|
@ -68,9 +70,10 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts" name='CardBox'>
|
||||||
import BadgeStatus from '@/components/BadgeStatus/index.vue';
|
import BadgeStatus from '@/components/BadgeStatus/index.vue';
|
||||||
import type { ActionsType } from '@/components/Table/index.vue';
|
import { getHexColor } from '../BadgeStatus/color'
|
||||||
|
import type { ActionsType } from '@/components/Table';
|
||||||
import { PropType } from 'vue';
|
import { PropType } from 'vue';
|
||||||
|
|
||||||
type EmitProps = {
|
type EmitProps = {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
:request='saveSearchHistory'
|
:request='saveSearchHistory'
|
||||||
:historyRequest='getSearchHistory'
|
:historyRequest='getSearchHistory'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
|
:class='props.class'
|
||||||
@search='searchSubmit'
|
@search='searchSubmit'
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup name='JProUpload'>
|
||||||
import { message, UploadChangeParam, UploadProps } from 'ant-design-vue';
|
import { message, UploadChangeParam, UploadProps } from 'ant-design-vue';
|
||||||
import { FILE_UPLOAD } from '@/api/comm';
|
import { FILE_UPLOAD } from '@/api/comm';
|
||||||
import { TOKEN_KEY } from '@/utils/variable';
|
import { TOKEN_KEY } from '@/utils/variable';
|
|
@ -1,6 +1,6 @@
|
||||||
<!-- 参数类型输入组件 -->
|
<!-- 参数类型输入组件 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="wrapper">
|
<div class="value-item-warp">
|
||||||
<j-select
|
<j-select
|
||||||
v-if="typeMap.get(itemType) === 'select'"
|
v-if="typeMap.get(itemType) === 'select'"
|
||||||
v-model:value="myValue"
|
v-model:value="myValue"
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts" name='ValueItem'>
|
||||||
import { PropType } from 'vue';
|
import { PropType } from 'vue';
|
||||||
import { UploadChangeParam, UploadFile } from 'ant-design-vue';
|
import { UploadChangeParam, UploadFile } from 'ant-design-vue';
|
||||||
import { DefaultOptionType } from 'ant-design-vue/lib/select';
|
import { DefaultOptionType } from 'ant-design-vue/lib/select';
|
||||||
|
@ -102,6 +102,7 @@ import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable';
|
||||||
import { LocalStore } from '@/utils/comm';
|
import { LocalStore } from '@/utils/comm';
|
||||||
import { ItemData, ITypes } from './types';
|
import { ItemData, ITypes } from './types';
|
||||||
import { FILE_UPLOAD } from '@/api/comm';
|
import { FILE_UPLOAD } from '@/api/comm';
|
||||||
|
import { Upload } from 'jetlinks-ui-components'
|
||||||
|
|
||||||
type Emits = {
|
type Emits = {
|
||||||
(e: 'update:modelValue', data: string | number | boolean): void;
|
(e: 'update:modelValue', data: string | number | boolean): void;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import CardBox from './CardBox/index.vue';
|
||||||
import Search from './Search'
|
import Search from './Search'
|
||||||
import NormalUpload from './NormalUpload/index.vue'
|
import NormalUpload from './NormalUpload/index.vue'
|
||||||
import FileFormat from './FileFormat/index.vue'
|
import FileFormat from './FileFormat/index.vue'
|
||||||
import JProUpload from './JUpload/index.vue'
|
import JProUpload from './Upload/index.vue'
|
||||||
import { BasicLayoutPage, BlankLayoutPage } from './Layout'
|
import { BasicLayoutPage, BlankLayoutPage } from './Layout'
|
||||||
import { PageContainer, AIcon } from 'jetlinks-ui-components'
|
import { PageContainer, AIcon } from 'jetlinks-ui-components'
|
||||||
import Ellipsis from './Ellipsis/index.vue'
|
import Ellipsis from './Ellipsis/index.vue'
|
||||||
|
|
|
@ -4,13 +4,14 @@ import store from './store'
|
||||||
import components from './components'
|
import components from './components'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import './style.less'
|
import './style.less'
|
||||||
// import jComponents from 'jetlinks-ui-components'
|
|
||||||
// import 'jetlinks-ui-components/es/style.js'
|
import dayjs from 'dayjs';
|
||||||
|
import 'dayjs/locale/zh-cn';
|
||||||
|
dayjs.locale('zh-cn');
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
app.use(store)
|
app.use(store)
|
||||||
.use(router)
|
.use(router)
|
||||||
.use(components)
|
.use(components)
|
||||||
// .use(jComponents)
|
|
||||||
.mount('#app')
|
.mount('#app')
|
||||||
|
|
|
@ -178,6 +178,8 @@ const handleClick = async () => {
|
||||||
_emits('save');
|
_emits('save');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
message.error('暂无对应属性的映射');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<a-spin :spinning="loading" v-if="_metadata">
|
<a-spin :spinning="loading" v-if="_metadata.length">
|
||||||
<a-card :bordered="false">
|
<a-card :bordered="false">
|
||||||
<template #title>
|
<template #title>
|
||||||
<TitleComponent data="点位映射"></TitleComponent>
|
<TitleComponent data="点位映射"></TitleComponent>
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button @click="showModal">批量映射</a-button>
|
<a-button @click="showModal">批量映射</a-button>
|
||||||
<a-button type="primary" @click="onSave">保存</a-button>
|
<a-button type="primary" @click="onSave">保存并应用</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
<a-form ref="formRef" :model="modelRef">
|
<a-form ref="formRef" :model="modelRef">
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
/>
|
/>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
<a-card v-else>
|
<a-card v-else>
|
||||||
<JEmpty description="暂无数据,请配置物模型" style="margin: 10% 0" />
|
<JEmpty description="暂无数据,请配置物模型" style="margin: 10% 0" />
|
||||||
</a-card>
|
</a-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ const form = ref();
|
||||||
const filterOption = (input: string, option: any) => {
|
const filterOption = (input: string, option: any) => {
|
||||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||||
};
|
};
|
||||||
const props = defineProps(['productList']);
|
const props = defineProps(['productList']);
|
||||||
const _emit = defineEmits(['close']);
|
const _emit = defineEmits(['close']);
|
||||||
const instanceStore = useInstanceStore();
|
const instanceStore = useInstanceStore();
|
||||||
let _metadata = ref();
|
let _metadata = ref();
|
||||||
|
@ -203,31 +203,33 @@ const getChannel = async () => {
|
||||||
|
|
||||||
const handleSearch = async () => {
|
const handleSearch = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
modelRef.dataSource = _metadata;
|
|
||||||
getChannel();
|
getChannel();
|
||||||
if (_metadata && _metadata.length) {
|
modelRef.dataSource = _metadata.value;
|
||||||
const resp: any = await getEdgeMap(instanceStore.current?.orgId || '', {
|
console.log(modelRef.dataSource);
|
||||||
deviceId: instanceStore.current.id,
|
// if (_metadata.value && _metadata.value.length) {
|
||||||
query: {},
|
// console.log(1234);
|
||||||
}).catch(() => {
|
// const resp: any = await getEdgeMap(instanceStore.current?.orgId || '', {
|
||||||
modelRef.dataSource = _metadata;
|
// deviceId: instanceStore.current.id,
|
||||||
loading.value = false;
|
// query: {},
|
||||||
});
|
// }).catch(() => {
|
||||||
if (resp.status === 200) {
|
// modelRef.dataSource = _metadata;
|
||||||
const array = resp.result?.[0].reduce((x: any, y: any) => {
|
// loading.value = false;
|
||||||
const metadataId = _metadata.find(
|
// });
|
||||||
(item: any) => item.metadataId === y.metadataId,
|
// if (resp.status === 200) {
|
||||||
);
|
// const array = resp.result?.[0].reduce((x: any, y: any) => {
|
||||||
if (metadataId) {
|
// const metadataId = _metadata.find(
|
||||||
Object.assign(metadataId, y);
|
// (item: any) => item.metadataId === y.metadataId,
|
||||||
} else {
|
// );
|
||||||
x.push(y);
|
// if (metadataId) {
|
||||||
}
|
// Object.assign(metadataId, y);
|
||||||
return x;
|
// } else {
|
||||||
}, _metadata);
|
// x.push(y);
|
||||||
modelRef.dataSource = array;
|
// }
|
||||||
}
|
// return x;
|
||||||
}
|
// }, _metadata);
|
||||||
|
// modelRef.dataSource = array;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -251,17 +253,13 @@ const onPatchBind = () => {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
_emit('close');
|
_emit('close');
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
handleSearch();
|
|
||||||
});
|
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (instanceStore.current?.metadata) {
|
if (instanceStore.current?.metadata) {
|
||||||
_metadata.value = instanceStore.current?.metadata;
|
_metadata.value = instanceStore.current?.metadata;
|
||||||
} else {
|
} else {
|
||||||
_metadata.value = {};
|
_metadata.value = {};
|
||||||
}
|
}
|
||||||
|
handleSearch();
|
||||||
});
|
});
|
||||||
const onSave = async () => {
|
const onSave = async () => {
|
||||||
form.value = await validate();
|
form.value = await validate();
|
||||||
|
|
|
@ -70,9 +70,61 @@ const getProductList = async () => {
|
||||||
});
|
});
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
productList.value = res.result;
|
productList.value = res.result;
|
||||||
|
if (props.childData?.id) {
|
||||||
|
current.value.parentId = props.childData.id;
|
||||||
|
form.name = props.childData?.name;
|
||||||
|
form.productId = props.childData?.productId;
|
||||||
|
selectChange(form.productId);
|
||||||
|
if (current.value.metadata) {
|
||||||
|
const metadata = current.value.metadata;
|
||||||
|
if (metadata && metadata.length !== 0) {
|
||||||
|
getEdgeMap(current.value.id, {
|
||||||
|
deviceId: props.childData.id,
|
||||||
|
query: {},
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
// console.log(res.result)
|
||||||
|
//合并物模型
|
||||||
|
const array = res.result[0]?.reduce(
|
||||||
|
(x: any, y: any) => {
|
||||||
|
const metadataId = metadata.find(
|
||||||
|
(item: any) =>
|
||||||
|
item.metadataId === y.metadataId,
|
||||||
|
);
|
||||||
|
if (metadataId) {
|
||||||
|
Object.assign(metadataId, y);
|
||||||
|
} else {
|
||||||
|
x.push(y);
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
},
|
||||||
|
metadata,
|
||||||
|
);
|
||||||
|
//删除物模型
|
||||||
|
const items = array.filter(
|
||||||
|
(item: any) => item.metadataName,
|
||||||
|
);
|
||||||
|
current.value.metadata = items;
|
||||||
|
const delList = array
|
||||||
|
.filter((a: any) => !a.metadataName)
|
||||||
|
.map((b: any) => b.id);
|
||||||
|
//删除后解绑
|
||||||
|
if (delList && delList.length !== 0) {
|
||||||
|
removeEdgeMap(current.value.id, {
|
||||||
|
deviceId: props.childData.id,
|
||||||
|
idList: [...delList],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
visible.value = true;
|
||||||
|
} else {
|
||||||
|
current.value.parentId = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getProductList();
|
|
||||||
const selectChange = (e: any) => {
|
const selectChange = (e: any) => {
|
||||||
if (e) {
|
if (e) {
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
|
@ -88,64 +140,8 @@ const selectChange = (e: any) => {
|
||||||
);
|
);
|
||||||
current.value.metadata = array;
|
current.value.metadata = array;
|
||||||
};
|
};
|
||||||
watchEffect(() => {
|
onMounted(() => {
|
||||||
if (props.childData?.id) {
|
getProductList();
|
||||||
current.value.parentId = props.childData.id;
|
|
||||||
form.name = props.childData?.name;
|
|
||||||
form.productId = props.childData?.productId;
|
|
||||||
if (props.childData.deriveMetadata) {
|
|
||||||
const metadata = JSON.parse(
|
|
||||||
props.childData?.deriveMetadata || {},
|
|
||||||
)?.properties?.map((item: any) => ({
|
|
||||||
metadataId: item.id,
|
|
||||||
metadataName: `${item.name}(${item.id})`,
|
|
||||||
metadataType: 'property',
|
|
||||||
name: item.name,
|
|
||||||
}));
|
|
||||||
if (metadata && metadata.length !== 0) {
|
|
||||||
getEdgeMap(current.value.id, {
|
|
||||||
deviceId: props.childData.id,
|
|
||||||
query: {},
|
|
||||||
}).then((res) => {
|
|
||||||
if (res.status === 200) {
|
|
||||||
// console.log(res.result)
|
|
||||||
//合并物模型
|
|
||||||
const array = res.result[0]?.reduce(
|
|
||||||
(x: any, y: any) => {
|
|
||||||
const metadataId = metadata.find(
|
|
||||||
(item: any) =>
|
|
||||||
item.metadataId === y.metadataId,
|
|
||||||
);
|
|
||||||
if (metadataId) {
|
|
||||||
Object.assign(metadataId, y);
|
|
||||||
} else {
|
|
||||||
x.push(y);
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
},
|
|
||||||
metadata,
|
|
||||||
);
|
|
||||||
//删除物模型
|
|
||||||
const items = array.filter(
|
|
||||||
(item: any) => item.metadataName,
|
|
||||||
);
|
|
||||||
current.value.metadata = items;
|
|
||||||
const delList = array
|
|
||||||
.filter((a: any) => !a.metadataName)
|
|
||||||
.map((b: any) => b.id);
|
|
||||||
//删除后解绑
|
|
||||||
if (delList && delList.length !== 0) {
|
|
||||||
removeEdgeMap(current.value.id, {
|
|
||||||
deviceId: props.childData.id,
|
|
||||||
idList: [...delList],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
visible.value = true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const validate = async () => {
|
const validate = async () => {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<SaveChild
|
<SaveChild
|
||||||
v-if="childVisible"
|
v-if="childVisible"
|
||||||
@close-child-save="closeChildSave"
|
@close-child-save="closeChildSave"
|
||||||
:childData="current"
|
:childData="_current"
|
||||||
/>
|
/>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<Search
|
<Search
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
"
|
"
|
||||||
hasPermission="device/Instance:update"
|
hasPermission="device/Instance:update"
|
||||||
@click="
|
@click="
|
||||||
current = {};
|
_current = {};
|
||||||
childVisible = true;
|
childVisible = true;
|
||||||
"
|
"
|
||||||
>新增并绑定</PermissionButton
|
>新增并绑定</PermissionButton
|
||||||
|
@ -123,7 +123,7 @@ import { usePermissionStore } from '@/store/permission';
|
||||||
import SaveChild from './SaveChild/index.vue';
|
import SaveChild from './SaveChild/index.vue';
|
||||||
|
|
||||||
const instanceStore = useInstanceStore();
|
const instanceStore = useInstanceStore();
|
||||||
const { detail } = storeToRefs(instanceStore);
|
const { detail } = storeToRefs(instanceStore);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const childVisible = ref(false);
|
const childVisible = ref(false);
|
||||||
const permissionStore = usePermissionStore();
|
const permissionStore = usePermissionStore();
|
||||||
|
@ -139,7 +139,7 @@ const childDeviceRef = ref<Record<string, any>>({});
|
||||||
const params = ref<Record<string, any>>({});
|
const params = ref<Record<string, any>>({});
|
||||||
const _selectedRowKeys = ref<string[]>([]);
|
const _selectedRowKeys = ref<string[]>([]);
|
||||||
const visible = ref<boolean>(false);
|
const visible = ref<boolean>(false);
|
||||||
const current = ref({});
|
const _current = ref({});
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
@ -252,7 +252,7 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
},
|
},
|
||||||
icon: 'EditOutlined',
|
icon: 'EditOutlined',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
current.value = data;
|
_current.value = data;
|
||||||
childVisible.value = true;
|
childVisible.value = true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -202,6 +202,7 @@ const handleSearch = async () => {
|
||||||
metadataType: 'property',
|
metadataType: 'property',
|
||||||
name: item.name,
|
name: item.name,
|
||||||
}));
|
}));
|
||||||
|
console.log(metadata);
|
||||||
if (_metadata && _metadata.length) {
|
if (_metadata && _metadata.length) {
|
||||||
const resp: any = await getEdgeMap(instanceStore.current?.parentId || '', {
|
const resp: any = await getEdgeMap(instanceStore.current?.parentId || '', {
|
||||||
deviceId: instanceStore.current.id,
|
deviceId: instanceStore.current.id,
|
||||||
|
|
|
@ -34,65 +34,72 @@
|
||||||
<j-empty v-if="!deptTreeData.length" />
|
<j-empty v-if="!deptTreeData.length" />
|
||||||
</j-col>
|
</j-col>
|
||||||
<j-col :span="20">
|
<j-col :span="20">
|
||||||
<JProTable
|
<j-button type="primary" @click="handleAutoBind">
|
||||||
|
自动绑定
|
||||||
|
</j-button>
|
||||||
|
<JTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:dataSource="dataSource"
|
:dataSource="dataSource"
|
||||||
:loading="tableLoading"
|
:loading="tableLoading"
|
||||||
model="table"
|
:pagination="{
|
||||||
noPagination
|
total: dataSource.length,
|
||||||
|
current: current,
|
||||||
|
pageSize: pageSize,
|
||||||
|
pageSizeOptions: ['12', '24', '48', '96'],
|
||||||
|
showSizeChanger: true,
|
||||||
|
showTotal: (total: number, range: number) => `第 ${range[0]} - ${range[1]} 条/总共 ${total} 条`,
|
||||||
|
}"
|
||||||
|
@change="handleTableChange"
|
||||||
>
|
>
|
||||||
<template #headerTitle>
|
<template #bodyCell="{ column, record, index }">
|
||||||
<j-button type="primary" @click="handleAutoBind">
|
<template v-if="column.dataIndex === 'status'">
|
||||||
自动绑定
|
<j-space>
|
||||||
</j-button>
|
<j-badge
|
||||||
</template>
|
:status="record.status.value"
|
||||||
<template #status="slotProps">
|
:text="record.status.text"
|
||||||
<j-space>
|
></j-badge>
|
||||||
<j-badge
|
</j-space>
|
||||||
:status="slotProps.status.value"
|
</template>
|
||||||
:text="slotProps.status.text"
|
<template v-if="column.dataIndex === 'action'">
|
||||||
></j-badge>
|
<j-space :size="16">
|
||||||
</j-space>
|
<j-tooltip
|
||||||
</template>
|
v-for="i in getActions(record, 'table')"
|
||||||
<template #action="slotProps">
|
:key="i.key"
|
||||||
<j-space :size="16">
|
v-bind="i.tooltip"
|
||||||
<j-tooltip
|
|
||||||
v-for="i in getActions(slotProps, 'table')"
|
|
||||||
:key="i.key"
|
|
||||||
v-bind="i.tooltip"
|
|
||||||
>
|
|
||||||
<j-popconfirm
|
|
||||||
v-if="i.popConfirm"
|
|
||||||
v-bind="i.popConfirm"
|
|
||||||
:disabled="i.disabled"
|
|
||||||
>
|
>
|
||||||
<j-button
|
<j-popconfirm
|
||||||
|
v-if="i.popConfirm"
|
||||||
|
v-bind="i.popConfirm"
|
||||||
:disabled="i.disabled"
|
:disabled="i.disabled"
|
||||||
|
>
|
||||||
|
<j-button
|
||||||
|
:disabled="i.disabled"
|
||||||
|
style="padding: 0"
|
||||||
|
type="link"
|
||||||
|
><AIcon :type="i.icon"
|
||||||
|
/></j-button>
|
||||||
|
</j-popconfirm>
|
||||||
|
<j-button
|
||||||
style="padding: 0"
|
style="padding: 0"
|
||||||
type="link"
|
type="link"
|
||||||
><AIcon :type="i.icon"
|
v-else
|
||||||
/></j-button>
|
@click="
|
||||||
</j-popconfirm>
|
i.onClick && i.onClick(record)
|
||||||
<j-button
|
"
|
||||||
style="padding: 0"
|
>
|
||||||
type="link"
|
<j-button
|
||||||
v-else
|
:disabled="i.disabled"
|
||||||
@click="
|
style="padding: 0"
|
||||||
i.onClick && i.onClick(slotProps)
|
type="link"
|
||||||
"
|
><AIcon :type="i.icon"
|
||||||
>
|
/></j-button>
|
||||||
<j-button
|
</j-button>
|
||||||
:disabled="i.disabled"
|
</j-tooltip>
|
||||||
style="padding: 0"
|
</j-space>
|
||||||
type="link"
|
</template>
|
||||||
><AIcon :type="i.icon"
|
|
||||||
/></j-button>
|
|
||||||
</j-button>
|
|
||||||
</j-tooltip>
|
|
||||||
</j-space>
|
|
||||||
</template>
|
</template>
|
||||||
</JProTable>
|
</JTable>
|
||||||
</j-col>
|
</j-col>
|
||||||
</j-row>
|
</j-row>
|
||||||
</j-modal>
|
</j-modal>
|
||||||
|
@ -184,23 +191,10 @@ const getDepartment = async () => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// deptTreeData.value = arrayToTree(_result, _result[0]?.parentId);
|
|
||||||
deptTreeData.value = _result;
|
deptTreeData.value = _result;
|
||||||
deptId.value = _result[0]?.id;
|
deptId.value = _result[0]?.id;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* 扁平数据转树形结构
|
|
||||||
*/
|
|
||||||
// const arrayToTree = (arr: any, pid: string | number) => {
|
|
||||||
// return arr
|
|
||||||
// .filter((item: any) => item.parentId === pid)
|
|
||||||
// .map((item: any) => ({
|
|
||||||
// ...item,
|
|
||||||
// children: arrayToTree(arr, item.id),
|
|
||||||
// }));
|
|
||||||
// };
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门点击
|
* 部门点击
|
||||||
*/
|
*/
|
||||||
|
@ -230,6 +224,7 @@ const columns = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
},
|
},
|
||||||
|
@ -285,7 +280,7 @@ const handleAutoBind = () => {
|
||||||
thirdPartyUserId: i.thirdPartyUserId,
|
thirdPartyUserId: i.thirdPartyUserId,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// console.log('arr: ', arr);
|
|
||||||
configApi.dingTalkBindUser(arr, props.data.id).then(() => {
|
configApi.dingTalkBindUser(arr, props.data.id).then(() => {
|
||||||
message.success('操作成功');
|
message.success('操作成功');
|
||||||
getTableData();
|
getTableData();
|
||||||
|
@ -346,8 +341,8 @@ const dataSource = ref<any>([]);
|
||||||
const tableLoading = ref(false);
|
const tableLoading = ref(false);
|
||||||
const getTableData = () => {
|
const getTableData = () => {
|
||||||
tableLoading.value = true;
|
tableLoading.value = true;
|
||||||
Promise.all<any>([getDeptUsers(), getBindUsers(), getAllUsers()]).then(
|
Promise.all<any>([getDeptUsers(), getBindUsers(), getAllUsers()])
|
||||||
(res) => {
|
.then((res) => {
|
||||||
dataSource.value = [];
|
dataSource.value = [];
|
||||||
const [deptUsers, bindUsers, unBindUsers] = res;
|
const [deptUsers, bindUsers, unBindUsers] = res;
|
||||||
(deptUsers || []).forEach((deptUser: any) => {
|
(deptUsers || []).forEach((deptUser: any) => {
|
||||||
|
@ -379,9 +374,20 @@ const getTableData = () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// console.log('dataSource.value: ', dataSource.value);
|
// console.log('dataSource.value: ', dataSource.value);
|
||||||
},
|
})
|
||||||
);
|
.finally(() => {
|
||||||
tableLoading.value = false;
|
tableLoading.value = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端分页
|
||||||
|
*/
|
||||||
|
const current = ref(1);
|
||||||
|
const pageSize = ref(12);
|
||||||
|
const handleTableChange = (pagination: any) => {
|
||||||
|
current.value = pagination.current;
|
||||||
|
pageSize.value = pagination.pageSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -475,5 +481,8 @@ const handleCancel = () => {
|
||||||
.model-body {
|
.model-body {
|
||||||
height: 600px;
|
height: 600px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
&:deep(.ant-pagination-item) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -80,10 +80,6 @@
|
||||||
</template>
|
</template>
|
||||||
<template #actions="item">
|
<template #actions="item">
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
v-if="
|
|
||||||
item.key != 'tigger' ||
|
|
||||||
slotProps.sceneTriggerType == 'manual'
|
|
||||||
"
|
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
:popConfirm="item.popConfirm"
|
:popConfirm="item.popConfirm"
|
||||||
:tooltip="{ ...item.tootip }"
|
:tooltip="{ ...item.tootip }"
|
||||||
|
@ -146,10 +142,6 @@
|
||||||
:key="i.key"
|
:key="i.key"
|
||||||
>
|
>
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
v-if="
|
|
||||||
i.key != 'tigger' ||
|
|
||||||
slotProps.sceneTriggerType == 'manual'
|
|
||||||
"
|
|
||||||
:disabled="i.disabled"
|
:disabled="i.disabled"
|
||||||
:popConfirm="i.popConfirm"
|
:popConfirm="i.popConfirm"
|
||||||
:tooltip="{
|
:tooltip="{
|
||||||
|
@ -439,7 +431,9 @@ const getActions = (
|
||||||
icon: 'DeleteOutlined',
|
icon: 'DeleteOutlined',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
return actions;
|
return actions.filter((item)=>
|
||||||
|
item.key != 'tigger' || data.sceneTriggerType == 'manual'
|
||||||
|
);
|
||||||
};
|
};
|
||||||
const add = () => {
|
const add = () => {
|
||||||
menuStory.jumpPage('rule-engine/Alarm/Configuration/Save');
|
menuStory.jumpPage('rule-engine/Alarm/Configuration/Save');
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div class='dropdown-time-picker'>
|
<div class='dropdown-time-picker'>
|
||||||
<j-time-picker
|
<j-time-picker
|
||||||
v-if='type === "time"'
|
v-if='!_type'
|
||||||
open
|
open
|
||||||
class='manual-time-picker'
|
|
||||||
v-model:value='myValue'
|
v-model:value='myValue'
|
||||||
|
class='manual-time-picker'
|
||||||
:format='myFormat'
|
:format='myFormat'
|
||||||
:valueFormat='myFormat'
|
|
||||||
:getPopupContainer='getPopupContainer'
|
:getPopupContainer='getPopupContainer'
|
||||||
popupClassName='manual-time-picker-popup'
|
popupClassName='manual-time-picker-popup'
|
||||||
@change='change'
|
@change='change'
|
||||||
|
@ -17,7 +16,6 @@
|
||||||
class='manual-time-picker'
|
class='manual-time-picker'
|
||||||
v-model:value='myValue'
|
v-model:value='myValue'
|
||||||
:format='myFormat'
|
:format='myFormat'
|
||||||
:valueFormat='myFormat'
|
|
||||||
:getPopupContainer='getPopupContainer'
|
:getPopupContainer='getPopupContainer'
|
||||||
popupClassName='manual-time-picker-popup'
|
popupClassName='manual-time-picker-popup'
|
||||||
@change='change'
|
@change='change'
|
||||||
|
@ -26,7 +24,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='ts' name='DropdownTime'>
|
<script setup lang='ts' name='DropdownTime'>
|
||||||
import dayjs from 'dayjs'
|
import dayjs, { Dayjs } from 'dayjs'
|
||||||
|
|
||||||
type Emit = {
|
type Emit = {
|
||||||
(e: 'update:value', value: string) : void
|
(e: 'update:value', value: string) : void
|
||||||
|
@ -44,23 +42,26 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
format: {
|
format: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: undefined
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<Emit>()
|
const emit = defineEmits<Emit>()
|
||||||
const myFormat = props.format || ( props.type === 'time' ? 'HH:mm:ss' : 'YYYY-MM-DD HH:mm:ss')
|
const myFormat = props.format || ( props.type === 'time' ? 'HH:mm:ss' : 'YYYY-MM-DD HH:mm:ss')
|
||||||
const myValue = ref(props.value || dayjs(new Date()).format(myFormat))
|
const myValue = ref<Dayjs>(dayjs(props.value || new Date(), myFormat))
|
||||||
|
|
||||||
const getPopupContainer = (trigger: HTMLElement) => {
|
const getPopupContainer = (trigger: HTMLElement) => {
|
||||||
return trigger?.parentNode || document.body
|
return trigger?.parentNode || document.body
|
||||||
}
|
}
|
||||||
|
|
||||||
const change = (e: string) => {
|
const change = (e: Dayjs) => {
|
||||||
myValue.value = e
|
emit('update:value', e.format(myFormat))
|
||||||
emit('update:value', e)
|
emit('change', e.format(myFormat))
|
||||||
emit('change', e)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _type = computed(() => {
|
||||||
|
return props.value?.includes('-')
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='less'>
|
<style lang='less'>
|
||||||
|
|
|
@ -11,7 +11,7 @@ export const getComponent = (type: string): string => {
|
||||||
case 'long':
|
case 'long':
|
||||||
case 'float':
|
case 'float':
|
||||||
case 'double':
|
case 'double':
|
||||||
return 'number'
|
return type
|
||||||
case 'metric':
|
case 'metric':
|
||||||
case 'enum':
|
case 'enum':
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
@change='timeChange'
|
@change='timeChange'
|
||||||
/>
|
/>
|
||||||
<DropdownMenus
|
<DropdownMenus
|
||||||
v-if='["select","enum", "boolean"].includes(item.component)'
|
v-else-if='["select","enum", "boolean"].includes(item.component)'
|
||||||
:options='["metric", "upper"].includes(item.key) ? metricOption : options'
|
:options='["metric", "upper"].includes(item.key) ? metricOption : options'
|
||||||
@click='onSelect'
|
@click='onSelect'
|
||||||
/>
|
/>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
<ValueItem
|
<ValueItem
|
||||||
v-else
|
v-else
|
||||||
v-model:modelValue='myValue'
|
v-model:modelValue='myValue'
|
||||||
:itemType='getComponent(item.component)'
|
:itemType='item.component'
|
||||||
:options='item.key === "upper" ? metricOption : options'
|
:options='item.key === "upper" ? metricOption : options'
|
||||||
@change='valueItemChange'
|
@change='valueItemChange'
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
readonly VITE_APP_BASE_API: string;
|
readonly VITE_APP_BASE_API: string;
|
||||||
readonly VITE_APP_WS_URL: string;
|
readonly VITE_APP_WS_URL: string;
|
||||||
|
readonly MODE: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"layouts/*": ["./src/layouts/*"],
|
"layouts/*": ["./src/layouts/*"],
|
||||||
"store/*": ["./src/store/*"],
|
"store/*": ["./src/store/*"],
|
||||||
"style/*": ["./src/style/*"],
|
"style/*": ["./src/style/*"],
|
||||||
|
"jetlinks-ui-components/es": ["./node_modules/jetlinks-ui-components/es/*"]
|
||||||
},
|
},
|
||||||
"types": ["ant-design-vue/typings/global", "vite/client"],
|
"types": ["ant-design-vue/typings/global", "vite/client"],
|
||||||
"suppressImplicitAnyIndexErrors": true
|
"suppressImplicitAnyIndexErrors": true
|
||||||
|
|
|
@ -12,12 +12,13 @@ import * as path from 'path'
|
||||||
import monacoEditorPlugin from 'vite-plugin-monaco-editor';
|
import monacoEditorPlugin from 'vite-plugin-monaco-editor';
|
||||||
// import { JetlinksVueResolver } from 'jetlinks-ui-components/lib/plugin/resolve'
|
// import { JetlinksVueResolver } from 'jetlinks-ui-components/lib/plugin/resolve'
|
||||||
import { JetlinksVueResolver } from './plugin/jetlinks'
|
import { JetlinksVueResolver } from './plugin/jetlinks'
|
||||||
|
import { optimizeDeps } from './plugin/optimize'
|
||||||
import copy from 'rollup-plugin-copy';
|
import copy from 'rollup-plugin-copy';
|
||||||
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({ mode}) => {
|
export default defineConfig(({ mode}) => {
|
||||||
const env: Partial<ImportMetaEnv> = loadEnv(mode, process.cwd());
|
const env: Partial<ImportMetaEnv> = loadEnv(mode, process.cwd());
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: './',
|
base: './',
|
||||||
resolve: {
|
resolve: {
|
||||||
|
@ -53,6 +54,7 @@ export default defineConfig(({ mode}) => {
|
||||||
vue(),
|
vue(),
|
||||||
monacoEditorPlugin({}),
|
monacoEditorPlugin({}),
|
||||||
vueJsx(),
|
vueJsx(),
|
||||||
|
optimizeDeps(),
|
||||||
Components({
|
Components({
|
||||||
resolvers: [JetlinksVueResolver({ importStyle: 'less' }), VueAmapResolver()],
|
resolvers: [JetlinksVueResolver({ importStyle: 'less' }), VueAmapResolver()],
|
||||||
directoryAsNamespace: true
|
directoryAsNamespace: true
|
||||||
|
@ -110,6 +112,9 @@ export default defineConfig(({ mode}) => {
|
||||||
javascriptEnabled: true,
|
javascriptEnabled: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
optimizeDeps: {
|
||||||
|
include: ['pinia', 'vue-router', 'axios', 'lodash-es', '@vueuse/core', 'echarts', 'dayjs'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue