Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
1cfb9edc35
|
@ -1 +1,2 @@
|
|||
ENV=develop
|
||||
VITE_APP_BASE_API=/api
|
|
@ -1 +1,2 @@
|
|||
ENV=production
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 285 KiB |
|
@ -1,8 +1,13 @@
|
|||
<template>
|
||||
<router-view />
|
||||
<ConfigProvider :locale='zhCN'>
|
||||
<router-view />
|
||||
</ConfigProvider>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ConfigProvider } from 'jetlinks-ui-components'
|
||||
import zhCN from 'jetlinks-ui-components/es/locale/zh_CN';
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -23,4 +23,13 @@ export const addOperations_api = (data:object) => server.patch(`/application/ope
|
|||
/**
|
||||
* 删除可授权的接口ID
|
||||
*/
|
||||
export const delOperations_api = (data:object) => server.remove(`/application/operations/_batch`,{},{data});
|
||||
export const delOperations_api = (data:object) => server.remove(`/application/operations/_batch`,{},{data});
|
||||
|
||||
/**
|
||||
* 赋权-选中/取消选中api
|
||||
* @param id
|
||||
* @param type
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
export const updateOperations_api = (code:string,type:'_add'| '_delete', data: object) => server.post(`/application/${code}/grant/${type}`, data);
|
||||
|
|
|
@ -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>
|
||||
<j-badge
|
||||
:status="statusNames ? statusNames[status] : 'default'"
|
||||
:color="_color"
|
||||
:text="text"
|
||||
></j-badge>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// import { StatusColorEnum } from '@/utils/consts.ts';
|
||||
import { getHexColor } from './color'
|
||||
const props = defineProps({
|
||||
text: {
|
||||
type: String,
|
||||
|
@ -26,6 +27,18 @@ const props = defineProps({
|
|||
* 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>
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
<div
|
||||
v-if="showStatus"
|
||||
class="card-state"
|
||||
:class="statusNames ? statusNames[status] : ''"
|
||||
:style='{
|
||||
backgroundColor: getHexColor(statusNames[status])
|
||||
}'
|
||||
>
|
||||
<div class="card-state-content">
|
||||
<BadgeStatus
|
||||
|
@ -68,9 +70,10 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts" name='CardBox'>
|
||||
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';
|
||||
|
||||
type EmitProps = {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
:request='saveSearchHistory'
|
||||
:historyRequest='getSearchHistory'
|
||||
:columns='columns'
|
||||
:class='props.class'
|
||||
@search='searchSubmit'
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
<script lang="ts" setup name='JProUpload'>
|
||||
import { message, UploadChangeParam, UploadProps } from 'ant-design-vue';
|
||||
import { FILE_UPLOAD } from '@/api/comm';
|
||||
import { TOKEN_KEY } from '@/utils/variable';
|
|
@ -1,6 +1,6 @@
|
|||
<!-- 参数类型输入组件 -->
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<div class="value-item-warp">
|
||||
<j-select
|
||||
v-if="typeMap.get(itemType) === 'select'"
|
||||
v-model:value="myValue"
|
||||
|
@ -92,7 +92,7 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts" name='ValueItem'>
|
||||
import { PropType } from 'vue';
|
||||
import { UploadChangeParam, UploadFile } from 'ant-design-vue';
|
||||
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 { ItemData, ITypes } from './types';
|
||||
import { FILE_UPLOAD } from '@/api/comm';
|
||||
import { Upload } from 'jetlinks-ui-components'
|
||||
|
||||
type Emits = {
|
||||
(e: 'update:modelValue', data: string | number | boolean): void;
|
||||
|
|
|
@ -8,7 +8,7 @@ import CardBox from './CardBox/index.vue';
|
|||
import Search from './Search'
|
||||
import NormalUpload from './NormalUpload/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 { PageContainer, AIcon } from 'jetlinks-ui-components'
|
||||
import Ellipsis from './Ellipsis/index.vue'
|
||||
|
|
|
@ -4,13 +4,14 @@ import store from './store'
|
|||
import components from './components'
|
||||
import router from './router'
|
||||
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)
|
||||
|
||||
app.use(store)
|
||||
.use(router)
|
||||
.use(components)
|
||||
// .use(jComponents)
|
||||
.mount('#app')
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<!-- 已登录-绑定三方账号 -->
|
||||
<template v-if="!token">
|
||||
<div class="info">
|
||||
<a-card style="width: 280px">
|
||||
<j-card style="width: 280px">
|
||||
<template #title>
|
||||
<div class="info-head">
|
||||
<img :src="getImage('/bind/Rectangle.png')" />
|
||||
|
@ -18,9 +18,9 @@
|
|||
<p>账号:admin</p>
|
||||
<p>用户名:超级管理员</p>
|
||||
</div>
|
||||
</a-card>
|
||||
</j-card>
|
||||
<img :src="getImage('/bind/Vector.png')" />
|
||||
<a-card style="width: 280px">
|
||||
<j-card style="width: 280px">
|
||||
<template #title>
|
||||
<div class="info-head">
|
||||
<img :src="getImage('/bind/Rectangle.png')" />
|
||||
|
@ -37,11 +37,11 @@
|
|||
<p>用户名:-</p>
|
||||
<p>名称:{{ accountInfo?.name || '-' }}</p>
|
||||
</div>
|
||||
</a-card>
|
||||
</j-card>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<a-button type="primary" @click="handleBind"
|
||||
>立即绑定</a-button
|
||||
<j-button type="primary" @click="handleBind"
|
||||
>立即绑定</j-button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -60,30 +60,30 @@
|
|||
你已通过微信授权,完善以下登录信息即可以完成绑定
|
||||
</div>
|
||||
<div class="login-form">
|
||||
<a-form layout="vertical">
|
||||
<a-form-item
|
||||
<j-form layout="vertical">
|
||||
<j-form-item
|
||||
label="账户"
|
||||
v-bind="validateInfos.username"
|
||||
>
|
||||
<a-input
|
||||
<j-input
|
||||
v-model:value="formData.username"
|
||||
placeholder="请输入账户"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
</j-form-item>
|
||||
<j-form-item
|
||||
label="密码"
|
||||
v-bind="validateInfos.password"
|
||||
>
|
||||
<a-input-password
|
||||
<j-input-password
|
||||
v-model:value="formData.password"
|
||||
placeholder="请输入密码"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
</j-form-item>
|
||||
<j-form-item
|
||||
label="验证码"
|
||||
v-bind="validateInfos.verifyCode"
|
||||
>
|
||||
<a-input
|
||||
<j-input
|
||||
v-model:value="formData.verifyCode"
|
||||
placeholder="请输入验证码"
|
||||
>
|
||||
|
@ -94,18 +94,18 @@
|
|||
style="cursor: pointer"
|
||||
/>
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-button
|
||||
</j-input>
|
||||
</j-form-item>
|
||||
<j-form-item>
|
||||
<j-button
|
||||
type="primary"
|
||||
@click="handleLoginBind"
|
||||
style="width: 100%"
|
||||
>
|
||||
登录并绑定账户
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</j-button>
|
||||
</j-form-item>
|
||||
</j-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<div class="notification-record-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<div class="notification-subscription-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
<j-pro-table
|
||||
|
|
|
@ -178,6 +178,8 @@ const handleClick = async () => {
|
|||
_emits('save');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
message.error('暂无对应属性的映射');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<a-spin :spinning="loading" v-if="_metadata">
|
||||
<a-spin :spinning="loading" v-if="_metadata.length">
|
||||
<a-card :bordered="false">
|
||||
<template #title>
|
||||
<TitleComponent data="点位映射"></TitleComponent>
|
||||
|
@ -7,7 +7,7 @@
|
|||
<template #extra>
|
||||
<a-space>
|
||||
<a-button @click="showModal">批量映射</a-button>
|
||||
<a-button type="primary" @click="onSave">保存</a-button>
|
||||
<a-button type="primary" @click="onSave">保存并应用</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<a-form ref="formRef" :model="modelRef">
|
||||
|
@ -114,7 +114,7 @@
|
|||
/>
|
||||
</a-spin>
|
||||
<a-card v-else>
|
||||
<JEmpty description="暂无数据,请配置物模型" style="margin: 10% 0" />
|
||||
<JEmpty description="暂无数据,请配置物模型" style="margin: 10% 0" />
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
|
@ -174,7 +174,7 @@ const form = ref();
|
|||
const filterOption = (input: string, option: any) => {
|
||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
};
|
||||
const props = defineProps(['productList']);
|
||||
const props = defineProps(['productList']);
|
||||
const _emit = defineEmits(['close']);
|
||||
const instanceStore = useInstanceStore();
|
||||
let _metadata = ref();
|
||||
|
@ -203,31 +203,33 @@ const getChannel = async () => {
|
|||
|
||||
const handleSearch = async () => {
|
||||
loading.value = true;
|
||||
modelRef.dataSource = _metadata;
|
||||
getChannel();
|
||||
if (_metadata && _metadata.length) {
|
||||
const resp: any = await getEdgeMap(instanceStore.current?.orgId || '', {
|
||||
deviceId: instanceStore.current.id,
|
||||
query: {},
|
||||
}).catch(() => {
|
||||
modelRef.dataSource = _metadata;
|
||||
loading.value = false;
|
||||
});
|
||||
if (resp.status === 200) {
|
||||
const array = resp.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);
|
||||
modelRef.dataSource = array;
|
||||
}
|
||||
}
|
||||
modelRef.dataSource = _metadata.value;
|
||||
console.log(modelRef.dataSource);
|
||||
// if (_metadata.value && _metadata.value.length) {
|
||||
// console.log(1234);
|
||||
// const resp: any = await getEdgeMap(instanceStore.current?.orgId || '', {
|
||||
// deviceId: instanceStore.current.id,
|
||||
// query: {},
|
||||
// }).catch(() => {
|
||||
// modelRef.dataSource = _metadata;
|
||||
// loading.value = false;
|
||||
// });
|
||||
// if (resp.status === 200) {
|
||||
// const array = resp.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);
|
||||
// modelRef.dataSource = array;
|
||||
// }
|
||||
// }
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
|
@ -251,17 +253,13 @@ const onPatchBind = () => {
|
|||
visible.value = false;
|
||||
_emit('close');
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
handleSearch();
|
||||
});
|
||||
|
||||
watchEffect(() => {
|
||||
if (instanceStore.current?.metadata) {
|
||||
_metadata.value = instanceStore.current?.metadata;
|
||||
} else {
|
||||
_metadata.value = {};
|
||||
}
|
||||
handleSearch();
|
||||
});
|
||||
const onSave = async () => {
|
||||
form.value = await validate();
|
||||
|
|
|
@ -70,9 +70,61 @@ const getProductList = async () => {
|
|||
});
|
||||
if (res.status === 200) {
|
||||
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) => {
|
||||
if (e) {
|
||||
visible.value = true;
|
||||
|
@ -88,64 +140,8 @@ const selectChange = (e: any) => {
|
|||
);
|
||||
current.value.metadata = array;
|
||||
};
|
||||
watchEffect(() => {
|
||||
if (props.childData?.id) {
|
||||
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;
|
||||
}
|
||||
onMounted(() => {
|
||||
getProductList();
|
||||
});
|
||||
|
||||
const validate = async () => {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<SaveChild
|
||||
v-if="childVisible"
|
||||
@close-child-save="closeChildSave"
|
||||
:childData="current"
|
||||
:childData="_current"
|
||||
/>
|
||||
<div v-else>
|
||||
<Search
|
||||
|
@ -43,7 +43,7 @@
|
|||
"
|
||||
hasPermission="device/Instance:update"
|
||||
@click="
|
||||
current = {};
|
||||
_current = {};
|
||||
childVisible = true;
|
||||
"
|
||||
>新增并绑定</PermissionButton
|
||||
|
@ -123,7 +123,7 @@ import { usePermissionStore } from '@/store/permission';
|
|||
import SaveChild from './SaveChild/index.vue';
|
||||
|
||||
const instanceStore = useInstanceStore();
|
||||
const { detail } = storeToRefs(instanceStore);
|
||||
const { detail } = storeToRefs(instanceStore);
|
||||
const router = useRouter();
|
||||
const childVisible = ref(false);
|
||||
const permissionStore = usePermissionStore();
|
||||
|
@ -139,7 +139,7 @@ const childDeviceRef = ref<Record<string, any>>({});
|
|||
const params = ref<Record<string, any>>({});
|
||||
const _selectedRowKeys = ref<string[]>([]);
|
||||
const visible = ref<boolean>(false);
|
||||
const current = ref({});
|
||||
const _current = ref({});
|
||||
|
||||
const columns = [
|
||||
{
|
||||
|
@ -252,7 +252,7 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
|||
},
|
||||
icon: 'EditOutlined',
|
||||
onClick: () => {
|
||||
current.value = data;
|
||||
_current.value = data;
|
||||
childVisible.value = true;
|
||||
},
|
||||
},
|
||||
|
|
|
@ -202,6 +202,7 @@ const handleSearch = async () => {
|
|||
metadataType: 'property',
|
||||
name: item.name,
|
||||
}));
|
||||
console.log(metadata);
|
||||
if (_metadata && _metadata.length) {
|
||||
const resp: any = await getEdgeMap(instanceStore.current?.parentId || '', {
|
||||
deviceId: instanceStore.current.id,
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<template>
|
||||
<a-card class="boot-card-container" :bordered="false">
|
||||
<template #title>
|
||||
<h5 class="title">{{ cardTitle }}</h5>
|
||||
</template>
|
||||
<div class="boot-card-container">
|
||||
<h5 class="title">{{ cardTitle }}</h5>
|
||||
<div class="box">
|
||||
<div
|
||||
class="box-item"
|
||||
|
@ -23,7 +21,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
@ -46,9 +44,8 @@ const jumpPage = (item: bootConfig) => {
|
|||
|
||||
<style lang="less" scoped>
|
||||
.boot-card-container {
|
||||
:deep(.ant-card-body) {
|
||||
padding-top: 0;
|
||||
}
|
||||
background-color: #fff;
|
||||
padding: 24px 12px;
|
||||
.title {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<j-row :gutter="24">
|
||||
<j-col :span="12"><DeviceCountCard /></j-col>
|
||||
<j-col :span="12"><BasicCountCard /></j-col>
|
||||
<j-col :span="24" style="margin-top: 24px">
|
||||
<PlatformPicCard image="/images/home/content1.png" />
|
||||
<j-col :span="24" style="margin-top: 24px;">
|
||||
<PlatformPicCard image="/images/home/content1.svg" />
|
||||
</j-col>
|
||||
</j-row>
|
||||
</j-col>
|
||||
|
@ -41,7 +41,7 @@
|
|||
<DeviceChooseDialog
|
||||
v-if="deviceDialogVisible"
|
||||
v-model:visible="deviceDialogVisible"
|
||||
@confirm="(id:string)=>jumpPage('device/Instance/Detail', { id })"
|
||||
@confirm="(id:string)=>jumpPage('device/Instance/Detail', { id, tab: 'Diagnose' })"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -157,7 +157,7 @@ const deviceStepDetails: recommendList[] = [
|
|||
linkUrl: 'device/Instance',
|
||||
auth: devicePermission('import'),
|
||||
params: {
|
||||
import: true,
|
||||
type: 'import'
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@ -175,7 +175,7 @@ const opsBootConfig: bootConfig[] = [
|
|||
label: '日志排查',
|
||||
link: 'Log',
|
||||
params: {
|
||||
key: 'system',
|
||||
tab: 'system',
|
||||
},
|
||||
image: '/images/home/guide-home5.png',
|
||||
},
|
||||
|
@ -220,7 +220,7 @@ const opsStepDetails: recommendList[] = [
|
|||
iconUrl: '/images/home/bottom-5.png',
|
||||
linkUrl: 'Log',
|
||||
params: {
|
||||
key: 'system',
|
||||
tab: 'system',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
@ -39,7 +39,7 @@ const opsBootConfig: bootConfig[] = [
|
|||
label: '日志排查',
|
||||
link: 'Log',
|
||||
params: {
|
||||
key: 'system',
|
||||
tab: 'system',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ const opsStepDetails: recommendList[] = [
|
|||
iconUrl: '/images/home/bottom-5.png',
|
||||
linkUrl: 'Log',
|
||||
params: {
|
||||
key: 'system',
|
||||
tab: 'system',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<DeviceChooseDialog
|
||||
v-if="deviceDialogVisible"
|
||||
v-model:visible="deviceDialogVisible"
|
||||
@confirm="(id:string)=>jumpPage('device/Instance/Detail', { id })"
|
||||
@confirm="(id:string)=>jumpPage('device/Instance/Detail', { id, tab: 'Diagnose' })"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -25,10 +25,11 @@ const props = defineProps({
|
|||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #2f54eb;
|
||||
|
||||
height: 458px;
|
||||
.bj {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
|
|
|
@ -80,10 +80,6 @@
|
|||
</template>
|
||||
<template #actions="item">
|
||||
<PermissionButton
|
||||
v-if="
|
||||
item.key != 'tigger' ||
|
||||
slotProps.sceneTriggerType == 'manual'
|
||||
"
|
||||
:disabled="item.disabled"
|
||||
:popConfirm="item.popConfirm"
|
||||
:tooltip="{ ...item.tootip }"
|
||||
|
@ -146,10 +142,6 @@
|
|||
:key="i.key"
|
||||
>
|
||||
<PermissionButton
|
||||
v-if="
|
||||
i.key != 'tigger' ||
|
||||
slotProps.sceneTriggerType == 'manual'
|
||||
"
|
||||
:disabled="i.disabled"
|
||||
:popConfirm="i.popConfirm"
|
||||
:tooltip="{
|
||||
|
@ -439,7 +431,9 @@ const getActions = (
|
|||
icon: 'DeleteOutlined',
|
||||
},
|
||||
];
|
||||
return actions;
|
||||
return actions.filter((item)=>
|
||||
item.key != 'tigger' || data.sceneTriggerType == 'manual'
|
||||
);
|
||||
};
|
||||
const add = () => {
|
||||
menuStory.jumpPage('rule-engine/Alarm/Configuration/Save');
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<template>
|
||||
<div class='dropdown-time-picker'>
|
||||
<j-time-picker
|
||||
v-if='type === "time"'
|
||||
v-if='!_type'
|
||||
open
|
||||
class='manual-time-picker'
|
||||
v-model:value='myValue'
|
||||
class='manual-time-picker'
|
||||
:format='myFormat'
|
||||
:valueFormat='myFormat'
|
||||
:getPopupContainer='getPopupContainer'
|
||||
popupClassName='manual-time-picker-popup'
|
||||
@change='change'
|
||||
|
@ -17,7 +16,6 @@
|
|||
class='manual-time-picker'
|
||||
v-model:value='myValue'
|
||||
:format='myFormat'
|
||||
:valueFormat='myFormat'
|
||||
:getPopupContainer='getPopupContainer'
|
||||
popupClassName='manual-time-picker-popup'
|
||||
@change='change'
|
||||
|
@ -26,7 +24,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang='ts' name='DropdownTime'>
|
||||
import dayjs from 'dayjs'
|
||||
import dayjs, { Dayjs } from 'dayjs'
|
||||
|
||||
type Emit = {
|
||||
(e: 'update:value', value: string) : void
|
||||
|
@ -44,23 +42,26 @@ const props = defineProps({
|
|||
},
|
||||
format: {
|
||||
type: String,
|
||||
default: ''
|
||||
default: undefined
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emit>()
|
||||
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) => {
|
||||
return trigger?.parentNode || document.body
|
||||
}
|
||||
|
||||
const change = (e: string) => {
|
||||
myValue.value = e
|
||||
emit('update:value', e)
|
||||
emit('change', e)
|
||||
const change = (e: Dayjs) => {
|
||||
emit('update:value', e.format(myFormat))
|
||||
emit('change', e.format(myFormat))
|
||||
}
|
||||
|
||||
const _type = computed(() => {
|
||||
return props.value?.includes('-')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang='less'>
|
||||
|
|
|
@ -11,7 +11,7 @@ export const getComponent = (type: string): string => {
|
|||
case 'long':
|
||||
case 'float':
|
||||
case 'double':
|
||||
return 'number'
|
||||
return type
|
||||
case 'metric':
|
||||
case 'enum':
|
||||
case 'boolean':
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
@change='timeChange'
|
||||
/>
|
||||
<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'
|
||||
@click='onSelect'
|
||||
/>
|
||||
|
@ -54,7 +54,7 @@
|
|||
<ValueItem
|
||||
v-else
|
||||
v-model:modelValue='myValue'
|
||||
:itemType='getComponent(item.component)'
|
||||
:itemType='item.component'
|
||||
:options='item.key === "upper" ? metricOption : options'
|
||||
@change='valueItemChange'
|
||||
/>
|
||||
|
|
|
@ -1738,7 +1738,6 @@ function changeBackUpload(info: UploadChangeParam<UploadFile<any>>) {
|
|||
if (info.file.status === 'uploading') {
|
||||
form.uploadLoading = true;
|
||||
} else if (info.file.status === 'done') {
|
||||
console.log(info);
|
||||
|
||||
info.file.url = info.file.response?.result;
|
||||
form.uploadLoading = false;
|
||||
|
@ -1749,9 +1748,6 @@ function changeBackUpload(info: UploadChangeParam<UploadFile<any>>) {
|
|||
message.error('logo上传失败,请稍后再试');
|
||||
}
|
||||
}
|
||||
function test(...args: any[]) {
|
||||
console.log('test:', args);
|
||||
}
|
||||
function clearNullProp(obj: object) {
|
||||
if (typeof obj !== 'object') return;
|
||||
for (const prop in obj) {
|
||||
|
@ -1799,6 +1795,17 @@ function clearNullProp(obj: object) {
|
|||
padding: 0 15px;
|
||||
box-sizing: content-box;
|
||||
margin-right: 20px;
|
||||
color: #000;
|
||||
|
||||
&.ant-radio-button-wrapper-disabled {
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
&.ant-radio-button-wrapper-checked {
|
||||
background-color: #fff;
|
||||
border: 1px solid #1d39c4;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
> :last-child {
|
||||
width: 100%;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<div class="apply-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
|
||||
|
@ -270,6 +271,8 @@ const columns = [
|
|||
dataIndex: 'action',
|
||||
key: 'action',
|
||||
scopedSlots: true,
|
||||
width:'200px',
|
||||
fixed:'right'
|
||||
},
|
||||
];
|
||||
const queryParams = ref({});
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<div class="data-source-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<a-modal
|
||||
<j-modal
|
||||
class="add-device-or-product-dialog-container"
|
||||
title="绑定"
|
||||
width="1440px"
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div class="row">
|
||||
<span style="margin-right: 8px">批量配置</span>
|
||||
<a-switch
|
||||
<j-switch
|
||||
v-model:checked="bulkBool"
|
||||
checked-children="开"
|
||||
un-checked-children="关"
|
||||
|
@ -23,16 +23,19 @@
|
|||
/>
|
||||
</div>
|
||||
<div v-show="bulkBool">
|
||||
<a-checkbox-group v-model:value="bulkList" :options="options" />
|
||||
<j-checkbox-group v-model:value="bulkList" :options="options" />
|
||||
</div>
|
||||
|
||||
<Search :columns="props.queryColumns" @search="query.search" />
|
||||
|
||||
<pro-search
|
||||
:columns="props.queryColumns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
<j-pro-table
|
||||
ref="tableRef"
|
||||
:request="table.requestFun"
|
||||
:gridColumn="2"
|
||||
:params="query.params.value"
|
||||
:params="queryParams"
|
||||
:rowSelection="{
|
||||
selectedRowKeys: table._selectedRowKeys.value,
|
||||
onChange: selectRow,
|
||||
|
@ -69,8 +72,8 @@
|
|||
<h3 class="card-item-content-title">
|
||||
{{ slotProps.name }}
|
||||
</h3>
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<j-row>
|
||||
<j-col :span="12">
|
||||
<div class="card-item-content-text">ID</div>
|
||||
<div
|
||||
style="cursor: pointer"
|
||||
|
@ -78,8 +81,8 @@
|
|||
>
|
||||
{{ slotProps.id }}
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
</j-col>
|
||||
<j-col :span="12">
|
||||
<div class="card-item-content-text">
|
||||
资产权限
|
||||
</div>
|
||||
|
@ -88,15 +91,15 @@
|
|||
class="card-item-content-value"
|
||||
@click="(e) => e.stopPropagation()"
|
||||
>
|
||||
<a-checkbox-group
|
||||
<j-checkbox-group
|
||||
v-model:value="
|
||||
slotProps.selectPermissions
|
||||
"
|
||||
:options="slotProps.permissionList"
|
||||
/>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</j-col>
|
||||
</j-row>
|
||||
</template>
|
||||
</CardBox>
|
||||
</template>
|
||||
|
@ -107,7 +110,7 @@
|
|||
class="card-item-content-value"
|
||||
@click="(e) => e.stopPropagation()"
|
||||
>
|
||||
<a-checkbox-group
|
||||
<j-checkbox-group
|
||||
v-model:value="slotProps.selectPermissions"
|
||||
:options="slotProps.permissionList"
|
||||
/>
|
||||
|
@ -125,7 +128,7 @@
|
|||
></BadgeStatus>
|
||||
</template>
|
||||
</j-pro-table>
|
||||
</a-modal>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
@ -189,58 +192,8 @@ const options = computed(() =>
|
|||
const columns = props.queryColumns.filter(
|
||||
(item) => item.dataIndex !== 'action',
|
||||
);
|
||||
const query = {
|
||||
columns: [
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
ellipsis: true,
|
||||
fixed: 'left',
|
||||
search: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
ellipsis: true,
|
||||
fixed: 'left',
|
||||
search: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'state',
|
||||
key: 'state',
|
||||
ellipsis: true,
|
||||
fixed: 'left',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: [
|
||||
{
|
||||
label: '在线',
|
||||
value: 'online',
|
||||
},
|
||||
{
|
||||
label: '离线',
|
||||
value: 'offline',
|
||||
},
|
||||
{
|
||||
label: '禁用',
|
||||
value: 'notActive',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
params: ref({}),
|
||||
search: (params: any) => {
|
||||
query.params.value = params;
|
||||
},
|
||||
};
|
||||
|
||||
const queryParams = ref({});
|
||||
const table: any = {
|
||||
_selectedRowKeys: ref<string[]>([]), // 选中项的id
|
||||
backRowKeys: [] as string[], // 旧选中项的id
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
>
|
||||
<j-form ref="formRef" :model="form.data" layout="vertical">
|
||||
<j-form-item name="parentId" label="上级组织">
|
||||
<a-tree-select
|
||||
<j-tree-select
|
||||
v-model:value="form.data.parentId"
|
||||
style="width: 100%"
|
||||
placeholder="请选择上级组织"
|
||||
|
@ -20,7 +20,7 @@
|
|||
:field-names="{ value: 'id' }"
|
||||
>
|
||||
<template #title="{ name }"> {{ name }} </template>
|
||||
</a-tree-select>
|
||||
</j-tree-select>
|
||||
</j-form-item>
|
||||
<j-form-item
|
||||
name="name"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
</PermissionButton>
|
||||
</div>
|
||||
|
||||
<a-tree
|
||||
<jTree
|
||||
:tree-data="treeData"
|
||||
v-model:selected-keys="selectedKeys"
|
||||
:fieldNames="{ key: 'id' }"
|
||||
|
@ -69,7 +69,7 @@
|
|||
</PermissionButton>
|
||||
</span>
|
||||
</template>
|
||||
</a-tree>
|
||||
</jTree>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<EditDepartmentDialog
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<template>
|
||||
<div class="product-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
@search="(params:any) => (queryParams = params)"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
<j-pro-table
|
||||
ref="tableRef"
|
||||
|
@ -153,7 +154,7 @@
|
|||
></BadgeStatus>
|
||||
</template>
|
||||
<template #action="slotProps">
|
||||
<a-space :size="16">
|
||||
<j-space :size="16">
|
||||
<PermissionButton
|
||||
v-for="i in table.getActions(slotProps, 'table')"
|
||||
:uhasPermission="i.permission"
|
||||
|
@ -165,7 +166,7 @@
|
|||
>
|
||||
<AIcon :type="i.icon" />
|
||||
</PermissionButton>
|
||||
</a-space>
|
||||
</j-space>
|
||||
</template>
|
||||
</j-pro-table>
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<template>
|
||||
<div class="product-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
<j-pro-table
|
||||
|
@ -113,35 +114,35 @@
|
|||
</j-row>
|
||||
</template>
|
||||
<template #actions="item">
|
||||
<a-tooltip
|
||||
<j-tooltip
|
||||
v-bind="item.tooltip"
|
||||
:title="item.disabled && item.tooltip.title"
|
||||
>
|
||||
<a-dropdown
|
||||
<j-dropdown
|
||||
placement="bottomRight"
|
||||
v-if="item.key === 'others'"
|
||||
>
|
||||
<a-button>
|
||||
<j-button>
|
||||
<AIcon :type="item.icon" />
|
||||
<span>{{ item.text }}</span>
|
||||
</a-button>
|
||||
</j-button>
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item
|
||||
<j-menu>
|
||||
<j-menu-item
|
||||
v-for="(o, i) in item.children"
|
||||
:key="i"
|
||||
>
|
||||
<a-button
|
||||
<j-button
|
||||
type="link"
|
||||
@click="o.onClick"
|
||||
>
|
||||
<AIcon :type="o.icon" />
|
||||
<span>{{ o.text }}</span>
|
||||
</a-button>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</j-button>
|
||||
</j-menu-item>
|
||||
</j-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</j-dropdown>
|
||||
<PermissionButton
|
||||
v-else
|
||||
:hasPermission="item.permission"
|
||||
|
@ -155,7 +156,7 @@
|
|||
item.text
|
||||
}}</span>
|
||||
</PermissionButton>
|
||||
</a-tooltip>
|
||||
</j-tooltip>
|
||||
</template>
|
||||
</CardBox>
|
||||
</template>
|
||||
|
@ -178,7 +179,7 @@
|
|||
></BadgeStatus>
|
||||
</template>
|
||||
<template #action="slotProps">
|
||||
<a-space :size="16">
|
||||
<j-space :size="16">
|
||||
<PermissionButton
|
||||
v-for="i in table.getActions(slotProps, 'table')"
|
||||
:hasPermission="i.permission"
|
||||
|
@ -190,7 +191,7 @@
|
|||
>
|
||||
<AIcon :type="i.icon" />
|
||||
</PermissionButton>
|
||||
</a-space>
|
||||
</j-space>
|
||||
</template>
|
||||
</j-pro-table>
|
||||
|
||||
|
|
|
@ -9,13 +9,17 @@
|
|||
@ok="confirm"
|
||||
@cancel="emits('update:visible', false)"
|
||||
>
|
||||
<Search :columns="query.columns" @search="query.search" />
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
<div class="table">
|
||||
<j-pro-table
|
||||
ref="tableRef"
|
||||
:columns="table.columns"
|
||||
:columns="columns"
|
||||
:request="table.requestFun"
|
||||
:params="query.params"
|
||||
:params="queryParams"
|
||||
:rowSelection="{
|
||||
selectedRowKeys: table._selectedRowKeys,
|
||||
onChange: table.onSelectChange,
|
||||
|
@ -57,47 +61,28 @@ const confirm = () => {
|
|||
}
|
||||
};
|
||||
|
||||
const query = {
|
||||
columns: [
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
ellipsis: true,
|
||||
fixed: 'left',
|
||||
search: {
|
||||
type: 'string',
|
||||
},
|
||||
const columns = [
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
ellipsis: true,
|
||||
search: {
|
||||
type: 'string',
|
||||
},
|
||||
{
|
||||
title: '用户名',
|
||||
dataIndex: 'username',
|
||||
key: 'username',
|
||||
ellipsis: true,
|
||||
fixed: 'left',
|
||||
search: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
],
|
||||
params: ref({}),
|
||||
search: (params: any) => {
|
||||
query.params.value = params;
|
||||
},
|
||||
};
|
||||
{
|
||||
title: '用户名',
|
||||
dataIndex: 'username',
|
||||
key: 'username',
|
||||
ellipsis: true,
|
||||
search: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
];
|
||||
const queryParams = ref({});
|
||||
const table = reactive({
|
||||
columns: [
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
},
|
||||
{
|
||||
title: '用户名',
|
||||
dataIndex: 'username',
|
||||
key: 'username',
|
||||
},
|
||||
],
|
||||
_selectedRowKeys: [] as string[],
|
||||
|
||||
requestFun: async (oParams: any) => {
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
<template>
|
||||
<div>
|
||||
<j-advanced-search :columns="columns" @search="(p:any)=>params = p" />
|
||||
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
<j-pro-table
|
||||
ref="tableRef"
|
||||
:columns="columns"
|
||||
:request="table.requestFun"
|
||||
:params="params"
|
||||
:params="queryParams"
|
||||
:rowSelection="{
|
||||
selectedRowKeys: table._selectedRowKeys,
|
||||
onChange: table.onSelectChange,
|
||||
|
@ -137,7 +140,7 @@ const columns = [
|
|||
},
|
||||
];
|
||||
// 搜索参数
|
||||
const params = ref({});
|
||||
const queryParams = ref({});
|
||||
|
||||
// 表格
|
||||
const tableRef = ref<Record<string, any>>({}); // 表格实例
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<div class="menu-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
|
||||
|
@ -202,7 +203,7 @@ const table = reactive({
|
|||
},
|
||||
addChildren: (row: any) => {
|
||||
const sortIndex = row?.children?.length || 0;
|
||||
|
||||
|
||||
router.push(
|
||||
`/system/Menu/detail/:id?pid=${row.id}&basePath=${
|
||||
row.url || ''
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<div class="permission-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
@search="(params:any) => (queryParams = params)"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
|
||||
<j-pro-table
|
||||
|
|
|
@ -148,7 +148,9 @@ const requestCard = reactive<tableCardType>({
|
|||
return (requestCard.tableData = props.selectApi.parameters);
|
||||
const schema =
|
||||
props.selectApi.requestBody.content['application/json'].schema;
|
||||
const schemaName = (schema.$ref || schema.items.$ref)?.split('/').pop();
|
||||
const _ref = schema.$ref || schema?.items?.$ref;
|
||||
if(!_ref) return; // schema不是Java中的类的话则不进行解析,直接结束
|
||||
const schemaName = _ref?.split('/').pop();
|
||||
const type = schema.type || '';
|
||||
const tableData = findData(schemaName);
|
||||
if (type === 'array') {
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
</j-button>
|
||||
</div>
|
||||
<MonacoEditor
|
||||
v-if="refStr"
|
||||
v-model:modelValue="requestBody.code"
|
||||
style="height: 300px; width: 100%"
|
||||
theme="vs"
|
||||
|
@ -125,6 +126,8 @@ const props = defineProps<{
|
|||
selectApi: apiDetailsType;
|
||||
schemas: any;
|
||||
}>();
|
||||
const responsesContent = ref({});
|
||||
const editorRef = ref();
|
||||
const formRef = ref<FormInstance>();
|
||||
const requestBody = reactive({
|
||||
tableColumns: [
|
||||
|
@ -178,8 +181,16 @@ const paramsTable = computed(() => {
|
|||
return requestBody.params.paramsTable.slice(startIndex, endIndex);
|
||||
});
|
||||
|
||||
const responsesContent = ref({});
|
||||
const editorRef = ref()
|
||||
let schema: any = {};
|
||||
const refStr = ref('');
|
||||
|
||||
const init = () => {
|
||||
if (!props.selectApi.requestBody) return;
|
||||
schema = props.selectApi.requestBody.content['application/json'].schema;
|
||||
refStr.value = schema.$ref || schema?.items?.$ref;
|
||||
};
|
||||
init();
|
||||
|
||||
const send = () => {
|
||||
if (paramsTable.value.length)
|
||||
formRef.value &&
|
||||
|
@ -210,10 +221,10 @@ const _send = () => {
|
|||
...urlParams,
|
||||
};
|
||||
server[methodObj[methodName]](url, params).then((resp: any) => {
|
||||
if (Object.keys(params).length === 0){
|
||||
|
||||
// 如果用户没填写参数且有body的情况下,给用户展示请求示例
|
||||
if (Object.keys(params).length === 0 && refStr.value) {
|
||||
requestBody.code = JSON.stringify(getDefaultParams());
|
||||
editorRef.value?.editorFormat()
|
||||
editorRef.value?.editorFormat();
|
||||
}
|
||||
responsesContent.value = resp;
|
||||
});
|
||||
|
@ -224,9 +235,8 @@ const _send = () => {
|
|||
*/
|
||||
function getDefaultParams() {
|
||||
if (!props.selectApi.requestBody) return {};
|
||||
const schema =
|
||||
props.selectApi.requestBody.content['application/json'].schema;
|
||||
const schemaName = (schema.$ref || schema.items.$ref)?.split('/').pop();
|
||||
if (!refStr.value) return ''; // schema不是Java中的类的话则不进行解析,直接结束
|
||||
const schemaName = refStr.value?.split('/').pop() as string;
|
||||
const type = schema.type || '';
|
||||
const tableData = findData(schemaName);
|
||||
if (type === 'array') {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<template #url="slotProps">
|
||||
<span
|
||||
style="color: #1d39c4; cursor: pointer"
|
||||
@click="jump(slotProps)"
|
||||
@click="emits('update:clickApi', slotProps)"
|
||||
>{{ slotProps.url }}</span
|
||||
>
|
||||
</template>
|
||||
|
@ -25,18 +25,28 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { addOperations_api, delOperations_api } from '@/api/system/apiPage';
|
||||
import {
|
||||
addOperations_api,
|
||||
delOperations_api,
|
||||
updateOperations_api,
|
||||
} from '@/api/system/apiPage';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { modeType } from '../typing';
|
||||
const emits = defineEmits(['update:clickApi', 'update:selectedRowKeys']);
|
||||
const emits = defineEmits([
|
||||
'refresh',
|
||||
'update:clickApi',
|
||||
'update:selectedRowKeys',
|
||||
'update:changedApis',
|
||||
]);
|
||||
const props = defineProps<{
|
||||
tableData: any[];
|
||||
clickApi: any;
|
||||
selectedRowKeys: string[];
|
||||
sourceKeys: string[];
|
||||
mode: modeType;
|
||||
changedApis: any; // 产生变化的api项
|
||||
}>();
|
||||
|
||||
const code = useRoute().query.code as string;
|
||||
const columns = [
|
||||
{
|
||||
title: 'API',
|
||||
|
@ -52,13 +62,20 @@ const columns = [
|
|||
];
|
||||
const rowSelection = {
|
||||
onSelect: (record: any) => {
|
||||
const targetId = record.id;
|
||||
let newKeys = [...props.selectedRowKeys];
|
||||
|
||||
if (props.selectedRowKeys.includes(record.id)) {
|
||||
newKeys = newKeys.filter((id) => id !== record.id);
|
||||
} else newKeys.push(record.id);
|
||||
if (props.selectedRowKeys.includes(targetId)) {
|
||||
newKeys = newKeys.filter((id) => id !== targetId);
|
||||
} else newKeys.push(targetId);
|
||||
|
||||
emits('update:selectedRowKeys', newKeys);
|
||||
if (props.mode === 'appManger') {
|
||||
emits('update:changedApis', {
|
||||
...props.changedApis,
|
||||
[record.id]: record,
|
||||
});
|
||||
}
|
||||
},
|
||||
selectedRowKeys: ref<string[]>([]),
|
||||
};
|
||||
|
@ -73,13 +90,30 @@ const save = () => {
|
|||
removeKeys.length &&
|
||||
delOperations_api(removeKeys)
|
||||
.finally(() => addOperations_api(addKeys))
|
||||
.then(() => message.success('操作成功'));
|
||||
.then(() => {
|
||||
message.success('操作成功');
|
||||
emits('refresh')
|
||||
});
|
||||
} else if (props.mode === 'appManger') {
|
||||
const removeItems = removeKeys.map((key) => ({
|
||||
id: key,
|
||||
permissions: props.changedApis[key]?.security,
|
||||
}));
|
||||
const addItems = addKeys.map((key) => ({
|
||||
id: key,
|
||||
permissions: props.changedApis[key]?.security,
|
||||
}));
|
||||
Promise.all([
|
||||
updateOperations_api(code, '_delete', { operations: removeItems }),
|
||||
updateOperations_api(code, '_add', { operations: addItems }),
|
||||
]).then((resps) => {
|
||||
if (resps[0].status === 200 && resps[1].status === 200) {
|
||||
message.success('操作成功');
|
||||
emits('refresh');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const jump = (row: any) => {
|
||||
emits('update:clickApi', row);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selectedRowKeys,
|
||||
(n) => {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
@select="treeSelect"
|
||||
:mode="props.mode"
|
||||
:has-home="props.hasHome"
|
||||
:filter-array="treeFilter"
|
||||
:code="props.code"
|
||||
/>
|
||||
</j-col>
|
||||
|
@ -26,10 +25,12 @@
|
|||
<ChooseApi
|
||||
v-show="!selectedApi.url"
|
||||
v-model:click-api="selectedApi"
|
||||
:table-data="tableData"
|
||||
v-model:selectedRowKeys="selectedKeys"
|
||||
v-model:changedApis="changedApis"
|
||||
:table-data="tableData"
|
||||
:source-keys="selectSourceKeys"
|
||||
:mode="props.mode"
|
||||
@refresh="getSelectKeys"
|
||||
/>
|
||||
|
||||
<div
|
||||
|
@ -82,9 +83,8 @@ const props = defineProps<{
|
|||
hasHome?: boolean;
|
||||
code?: string;
|
||||
}>();
|
||||
const showHome = ref<boolean>(Boolean(props.hasHome));
|
||||
const showHome = ref<boolean>(Boolean(props.hasHome)); // 是否展示home页面
|
||||
const tableData = ref([]);
|
||||
const treeFilter = ref([]);
|
||||
const treeSelect = (node: treeNodeTpye, nodeSchemas: object = {}) => {
|
||||
if (node.key === 'home') return (showHome.value = true);
|
||||
schemas.value = nodeSchemas;
|
||||
|
@ -109,8 +109,8 @@ const treeSelect = (node: treeNodeTpye, nodeSchemas: object = {}) => {
|
|||
tableData.value = table;
|
||||
};
|
||||
|
||||
const activeKey = ref<'does' | 'test'>('does');
|
||||
const schemas = ref({});
|
||||
const activeKey = ref<'does' | 'test'>('does');
|
||||
const schemas = ref({}); // 对应一级api相关的类
|
||||
const initSelectedApi: apiDetailsType = {
|
||||
url: '',
|
||||
method: '',
|
||||
|
@ -121,23 +121,14 @@ const initSelectedApi: apiDetailsType = {
|
|||
};
|
||||
const selectedApi = ref<apiDetailsType>(initSelectedApi);
|
||||
|
||||
const selectedKeys = ref<string[]>([]); // 右侧默认勾选的项
|
||||
let selectSourceKeys = ref<string[]>([]);
|
||||
const selectedKeys = ref<string[]>([]); // 右侧勾选的项
|
||||
const selectSourceKeys = ref<string[]>([]); // 右侧原本勾选的项
|
||||
const changedApis = ref({}); // 勾选发生变化的项,以对应的id作为key
|
||||
|
||||
init();
|
||||
|
||||
function init() {
|
||||
// 右侧默认选中初始化
|
||||
if (props.mode === 'appManger') {
|
||||
getApiGranted_api(props.code as string).then((resp) => {
|
||||
selectedKeys.value = resp.result as string[];
|
||||
selectSourceKeys.value = [...(resp.result as string[])];
|
||||
});
|
||||
} else if (props.mode === 'api') {
|
||||
apiOperations_api().then((resp) => {
|
||||
selectedKeys.value = resp.result as string[];
|
||||
selectSourceKeys.value = [...(resp.result as string[])];
|
||||
});
|
||||
}
|
||||
getSelectKeys();
|
||||
watch(tableData, () => {
|
||||
activeKey.value = 'does';
|
||||
selectedApi.value = initSelectedApi;
|
||||
|
@ -147,6 +138,24 @@ function init() {
|
|||
() => (activeKey.value = 'does'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 右侧api选中项
|
||||
*/
|
||||
function getSelectKeys() {
|
||||
if (props.mode === 'appManger') {
|
||||
getApiGranted_api(props.code as string).then((resp) => {
|
||||
selectedKeys.value = resp.result as string[];
|
||||
selectSourceKeys.value = [...(resp.result as string[])];
|
||||
changedApis.value = {};
|
||||
});
|
||||
} else if (props.mode === 'api') {
|
||||
apiOperations_api().then((resp) => {
|
||||
selectedKeys.value = resp.result as string[];
|
||||
selectSourceKeys.value = [...(resp.result as string[])];
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
|
|
@ -24,5 +24,9 @@ export type apiDetailsType = {
|
|||
responses:object;
|
||||
description?:string;
|
||||
}
|
||||
|
||||
/**
|
||||
* api: api配置
|
||||
* appManger: 应用管理-赋权
|
||||
* home:应用管理-查看菜单,第三方首页
|
||||
*/
|
||||
export type modeType = 'api'| 'appManger' | 'home'
|
|
@ -1,8 +1,9 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<div class="relationship-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<template>
|
||||
<div class="role-user-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
|
||||
|
|
|
@ -6,10 +6,15 @@
|
|||
@ok="confirm"
|
||||
@cancel="emits('update:visible', false)"
|
||||
>
|
||||
<j-advanced-search
|
||||
<!-- <j-advanced-search
|
||||
:columns="columns"
|
||||
type="simple"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/> -->
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="simple"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
|
||||
<j-pro-table
|
||||
|
@ -35,7 +40,7 @@ import { message } from 'ant-design-vue';
|
|||
const emits = defineEmits(['refresh', 'update:visible']);
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
roleId: string
|
||||
roleId: string;
|
||||
}>();
|
||||
|
||||
const columns = [
|
||||
|
@ -85,15 +90,13 @@ const confirm = () => {
|
|||
if (selectedRowKeys.value.length < 1) {
|
||||
message.error('请至少选择一项');
|
||||
} else {
|
||||
bindUser_api(props.roleId, selectedRowKeys.value).then(
|
||||
(resp) => {
|
||||
if (resp.status === 200) {
|
||||
message.success('操作成功');
|
||||
emits('refresh');
|
||||
emits('update:visible', false);
|
||||
}
|
||||
},
|
||||
);
|
||||
bindUser_api(props.roleId, selectedRowKeys.value).then((resp) => {
|
||||
if (resp.status === 200) {
|
||||
message.success('操作成功');
|
||||
emits('refresh');
|
||||
emits('update:visible', false);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<div class="role-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
@search="(params:any)=>queryParams = params"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
|
||||
<j-pro-table
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<div class="user-container">
|
||||
<j-advanced-search
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
/>
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
interface ImportMetaEnv {
|
||||
readonly VITE_APP_BASE_API: string;
|
||||
readonly VITE_APP_WS_URL: string;
|
||||
readonly MODE: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
"layouts/*": ["./src/layouts/*"],
|
||||
"store/*": ["./src/store/*"],
|
||||
"style/*": ["./src/style/*"],
|
||||
"jetlinks-ui-components/es": ["./node_modules/jetlinks-ui-components/es/*"]
|
||||
},
|
||||
"types": ["ant-design-vue/typings/global", "vite/client"],
|
||||
"suppressImplicitAnyIndexErrors": true
|
||||
|
|
|
@ -12,12 +12,13 @@ import * as path from 'path'
|
|||
import monacoEditorPlugin from 'vite-plugin-monaco-editor';
|
||||
// import { JetlinksVueResolver } from 'jetlinks-ui-components/lib/plugin/resolve'
|
||||
import { JetlinksVueResolver } from './plugin/jetlinks'
|
||||
import { optimizeDeps } from './plugin/optimize'
|
||||
import copy from 'rollup-plugin-copy';
|
||||
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({ mode}) => {
|
||||
const env: Partial<ImportMetaEnv> = loadEnv(mode, process.cwd());
|
||||
|
||||
return {
|
||||
base: './',
|
||||
resolve: {
|
||||
|
@ -53,6 +54,7 @@ export default defineConfig(({ mode}) => {
|
|||
vue(),
|
||||
monacoEditorPlugin({}),
|
||||
vueJsx(),
|
||||
optimizeDeps(),
|
||||
Components({
|
||||
resolvers: [JetlinksVueResolver({ importStyle: 'less' }), VueAmapResolver()],
|
||||
directoryAsNamespace: true
|
||||
|
@ -110,6 +112,9 @@ export default defineConfig(({ mode}) => {
|
|||
javascriptEnabled: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: ['pinia', 'vue-router', 'axios', 'lodash-es', '@vueuse/core', 'echarts', 'dayjs'],
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue