Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
jackhoo_98 2023-03-28 14:37:55 +08:00
commit 551863ba2f
21 changed files with 199 additions and 92 deletions

View File

@ -1,5 +1,11 @@
<template>
<pro-search class="device-search" type="simple" :columns="columns" target="device-instance-running-events" @search="handleSearch" />
<pro-search
class="device-search"
type="simple"
:columns="columns"
target="device-instance-running-events"
@search="handleSearch"
/>
<JProTable
ref="eventsRef"
:columns="columns"
@ -17,13 +23,18 @@
</j-button>
</template>
</JProTable>
<j-modal :width="600" v-model:visible="visible" title="详情" class="device-running-event-modal">
<JsonViewer :value="info" />
<template #footer>
<j-button type="primary" @click="visible = false">关闭</j-button>
</template>
</j-modal>
</template>
<script lang="ts" setup>
import dayjs from 'dayjs';
import { getEventList } from '@/api/device/instance';
import { useInstanceStore } from '@/store/instance';
import { Modal } from 'jetlinks-ui-components';
import JsonViewer from 'vue-json-viewer';
const events = defineProps({
@ -52,13 +63,11 @@ const columns = ref<Record<string, any>>([
},
]);
const params = ref<Record<string, any>>({});
const visible = ref<boolean>(false);
const info = ref<Record<string, any>>({});
const _getEventList = (_params: any) =>
getEventList(
instanceStore.current.id || '',
events.data.id || '',
_params
);
getEventList(instanceStore.current.id || '', events.data.id || '', _params);
watchEffect(() => {
if (events.data?.valueType?.type === 'object') {
@ -69,7 +78,7 @@ watchEffect(() => {
dataIndex: `${i.id}_format`,
search: {
type: i?.valueType?.type || 'string',
}
},
});
});
} else {
@ -85,20 +94,28 @@ const handleSearch = (_params: any) => {
};
const detail = (_info: any) => {
Modal.info({
title: () => '详情',
width: 850,
content: () => h('JsonViewer', {
'expand-depth': 5,
value: _info
}),
okText: '关闭',
});
info.value = _info
visible.value = true
// Modal.info({
// title: () => '',
// width: 850,
// content: () => h('JsonViewer', {
// 'expand-depth': 5,
// value: _info
// }),
// okText: '',
// });
};
</script>
<style lang="less">
.device-search {
margin: 0 0 24px 0 ;
margin: 0 0 24px 0;
}
.device-running-event-modal {
.ant-modal-body {
padding: 0 20px;
}
}
</style>

View File

@ -13,7 +13,7 @@
<j-row type="flex">
<j-col flex="180px">
<j-form-item name="photoUrl">
<JProUpload v-model="modelRef.photoUrl" />
<JProUpload accept="image/*" v-model="modelRef.photoUrl" />
</j-form-item>
</j-col>
<j-col flex="auto">

View File

@ -5,9 +5,16 @@
<template #title>
<div style="display: flex">
<h3>配置信息</h3>
<div style="margin: 0 0px 0 15px; color: #1d39c4">
<AIcon type="EditOutlined" @click="editConfig"/>
</div>
<!-- <div style="margin: 0 0px 0 15px; color: #1d39c4">
<AIcon type="EditOutlined" @click="editConfig" />
</div> -->
<PermissionButton
type="link"
@click="editConfig"
hasPermission="device/Product:update"
>
<template #icon><AIcon type="EditOutlined" /></template>
</PermissionButton>
</div>
</template>

View File

@ -13,7 +13,7 @@
<j-row type="flex">
<j-col flex="180px">
<j-form-item name="photoUrl">
<JProUpload v-model="modelRef.photoUrl" />
<JProUpload accept="image/*" v-model="modelRef.photoUrl" />
</j-form-item>
</j-col>
<j-col flex="auto">

View File

@ -245,12 +245,6 @@ export default {
url: '/iot/link/protocol',
buttons: [
{ id: 'view', name: '查看', enabled: true, granted: true },
{
id: 'action',
name: '启/禁用',
enabled: true,
granted: true,
},
{ id: 'delete', name: '删除', enabled: true, granted: true },
{
id: 'update',
@ -651,12 +645,6 @@ export default {
url: '/iot/link/protocol',
buttons: [
{ id: 'view', name: '查看', enabled: true, granted: true },
{
id: 'action',
name: '启/禁用',
enabled: true,
granted: true,
},
{ id: 'delete', name: '删除', enabled: true, granted: true },
{
id: 'update',

View File

@ -1364,6 +1364,16 @@ export default [
},
],
},
{
id: 'action',
name: '启/禁用',
permissions: [
{
permission: 'firmware-upgrade-task-manager',
actions: ['save'],
}
],
},
],
accessSupport: { text: "不支持", value: "unsupported" },
supportDataAccess: false

View File

@ -2,8 +2,21 @@
<template>
<page-container>
<pro-search :columns="columns" target="recharge-search" @search="handleSearch" />
<j-pro-table ref="rechargeRef" :columns="columns" :request="queryRechargeList" model="TABLE"
:defaultParams="{ sorts: [{ name: 'createTime', order: 'desc' }] }" :params="params">
<j-pro-table
ref="rechargeRef"
:columns="columns"
:request="queryRechargeList"
model="TABLE"
:defaultParams="{
pageSize: 10,
sorts: [{ name: 'createTime', order: 'desc' }],
}"
:pagination="{
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50', '100'],
}"
:params="params"
>
<template #headerTitle>
<j-space>
<PermissionButton @click="visible = true" :hasPermission="'iot-card/Recharge:pay'" type="primary">

View File

@ -44,15 +44,33 @@
</j-radio-group>
</j-form-item>
<j-form-item label="说明" name="description">
<j-textarea v-model:value="form.description" showCount :maxlength="200"></j-textarea>
<j-textarea
v-model:value="form.description"
showCount
:maxlength="200"
></j-textarea>
</j-form-item>
<PermissionButton type="primary" :loading="loading" @click="handleSave" :hasPermission="['rule-engine/Alarm/Configuration:add','rule-engine/Alarm/Configuration:update']">保存</PermissionButton>
<PermissionButton
type="primary"
:loading="loading"
@click="handleSave"
:hasPermission="[
'rule-engine/Alarm/Configuration:add',
'rule-engine/Alarm/Configuration:update',
]"
>保存</PermissionButton
>
</j-form>
</div>
</template>
<script lang="ts" setup>
import { getTargetTypes, save, detail , updata} from '@/api/rule-engine/configuration';
import {
getTargetTypes,
save,
detail,
updata,
} from '@/api/rule-engine/configuration';
import { queryLevel } from '@/api/rule-engine/config';
import { query } from '@/api/rule-engine/scene';
import { getImage } from '@/utils/comm';
@ -63,15 +81,14 @@ import { useAlarmConfigurationStore } from '@/store/alarm';
import { storeToRefs } from 'pinia';
import { usePermissionStore } from '@/store/permission';
const route = useRoute();
const id = route.query?.id;
let selectDisable = ref(false);
const alarmConfigurationStore = useAlarmConfigurationStore();
let { configurationData } = storeToRefs(alarmConfigurationStore);
const queryData = () => {
if (id) {
detail(id).then((res) => {
if (route.query?.id) {
detail(route.query?.id).then((res) => {
if (res.status === 200) {
form.value = res?.result
form.value = res?.result;
// form.level = res?.result?.level;
// form.name = res?.result?.name;
// form.targetType = res?.result?.targetType;
@ -84,7 +101,7 @@ const queryData = () => {
{
column: 'id',
termType: 'alarm-bind-rule',
value: id,
value: route.query?.id,
},
],
type: 'and',
@ -176,18 +193,22 @@ const handleSave = async () => {
formRef.value
.validate()
.then(async () => {
const res = id ? await updata(form.value) : await save(form.value);
const res = route.query?.id
? await updata(form.value)
: await save(form.value);
if (res.status === 200) {
message.success('操作成功,请配置关联的场景联动');
loading.value = false;
menuStory.jumpPage(
'rule-engine/Alarm/Configuration/Save',
{},
{ id: res.result?.id },
);
if (!id) {
if (res.result?.id) {
menuStory.jumpPage(
'rule-engine/Alarm/Configuration/Save',
{},
{ id: res.result?.id },
);
}
if (!route.query?.id) {
configurationData.value.current = res.result;
}
}
}
})
.catch((error) => {
@ -196,6 +217,12 @@ const handleSave = async () => {
});
};
queryData();
watch(
() => route.query?.id,
() => {
queryData();
},
);
</script>
<style lang="less" scoped>
.ant-radio-button-wrapper {
@ -203,7 +230,7 @@ queryData();
width: 20%;
height: 100%;
}
.levelSelect{
.levelSelect {
display: flex;
width: 100%;
}

View File

@ -40,12 +40,13 @@
</j-space>
</template>
</JProTable>
<Info v-if="visiable" :data="current" @close="close"/>
<Info v-if="visiable" :data="current" @close="close" :description="description"/>
</page-container>
</template>
<script lang="ts" setup>
import { detail, queryHistoryList } from '@/api/rule-engine/log';
import { detail as configurationDetail} from '@/api/rule-engine/configuration'
import { useRoute } from 'vue-router';
import dayjs from 'dayjs';
import type { ActionsType } from '@/components/Table/index.vue';
@ -58,6 +59,7 @@ const route = useRoute();
const id = route.params?.id;
const { params: routerParams } = useRouterParams()
let visiable = ref(false);
let description = ref<string>();
const columns = [
{
title: '告警时间',
@ -168,6 +170,11 @@ watchEffect(async () => {
key: 'targetName',
});
}
configurationDetail(res.result?.alarmConfigId).then((res:any)=>{
if(res.status === 200){
description.value = res.result?.description;
}
})
}
});
const handleSearch = (_params: any) => {

View File

@ -1,8 +1,26 @@
<template>
<j-modal visible title="详情" okText="确定" cancelText="取消" :width="1000" @ok="closeModal" @cancel="closeModal">
<j-modal
visible
title="详情"
okText="确定"
cancelText="取消"
:width="1000"
@ok="closeModal"
@cancel="closeModal"
>
<j-descriptions bordered :column="2">
<j-descriptions-item v-if="props.data.targetType==='device'" label="告警设备" :span="1">{{props.data?.targetName || ''}}</j-descriptions-item>
<j-descriptions-item v-if="props.data.targetType==='device'" label="设备ID" :span="1">{{props.data?.targetId || ''}}</j-descriptions-item>
<j-descriptions-item
v-if="props.data.targetType === 'device'"
label="告警设备"
:span="1"
>{{ props.data?.targetName || '' }}</j-descriptions-item
>
<j-descriptions-item
v-if="props.data.targetType === 'device'"
label="设备ID"
:span="1"
>{{ props.data?.targetId || '' }}</j-descriptions-item
>
<j-descriptions-item label="告警名称" :span="1">{{
props.data?.alarmConfigName
}}</j-descriptions-item>
@ -23,22 +41,20 @@
</Ellipsis>
</j-tooltip>
</j-descriptions-item>
<j-descriptions-item label="告警说明" :span="1"
><j-tooltip
placement="topLeft"
:title="data?.description || ''"
>
<Ellipsis>
<span>
{{ data?.description || '' }}
</span> </Ellipsis
>
</j-tooltip></j-descriptions-item
>
<j-descriptions-item
label="告警流水"
:span="2"
><div style="max-height: 500px; overflow-y: auto;"><JsonViewer :value="JSON.parse(data?.alarmInfo || '{}')" :expand-depth="5"></JsonViewer></div></j-descriptions-item>
<j-descriptions-item label="告警说明" :span="1">
<Ellipsis style="width: calc(100% - 20px)">
<span>
{{ description || '' }}
</span>
</Ellipsis>
</j-descriptions-item>
<j-descriptions-item label="告警流水" :span="2"
><div style="max-height: 500px; overflow-y: auto">
<JsonViewer
:value="JSON.parse(data?.alarmInfo || '{}')"
:expand-depth="5"
></JsonViewer></div
></j-descriptions-item>
</j-descriptions>
</j-modal>
</template>
@ -49,11 +65,12 @@ import { Store } from 'jetlinks-store';
import JsonViewer from 'vue-json-viewer';
const props = defineProps({
data: Object,
description: String,
});
const emit = defineEmits(['close'])
const emit = defineEmits(['close']);
const closeModal = () => {
emit('close');
}
};
</script>
<style lang="less" scoped>
</style>

View File

@ -13,7 +13,7 @@
v-model:value="_value"
:precision="3"
:min="0"
:max="6535"
:max="65535"
>
<template #addonAfter>
<j-select

View File

@ -7,6 +7,7 @@
v-model:value="_value"
v-model:source="_source"
@select="onChange"
valueName="id"
>
<template v-slot="{ label }">
<j-input :value="label" readonly />
@ -15,6 +16,7 @@
</template>
<script lang="ts" setup>
import { cloneDeep } from 'lodash-es';
import ParamsDropdown from '../../../components/ParamsDropdown';
import { handleParamsData } from './index';
@ -101,7 +103,7 @@ const filterParamsData = (type?: string, data?: any[]): any[] => {
};
const upperOptions = computed(() => {
return filterParamsData(props.data.valueType?.type, props?.builtInList);
return filterParamsData(props.data.valueType?.type, cloneDeep(props?.builtInList));
});
const onChange = () => {

View File

@ -39,6 +39,7 @@
v-model:value="propertyModelRef.propertiesValue"
v-model:source="propertyModelRef.source"
@select="onValueChange"
valueName="id"
>
<template v-slot="{ label }">
<j-input readonly :value="label" placeholder="请选择" />
@ -51,6 +52,7 @@
</template>
<script lang="ts" setup>
import { cloneDeep } from 'lodash-es';
import ParamsDropdown from '../../../components/ParamsDropdown';
import { handleParamsData } from './index';
const props = defineProps({
@ -122,7 +124,8 @@ const filterParamsData = (type?: string, data?: any[]): any[] => {
};
const upperOptions = computed(() => {
return filterParamsData(getType.value?.valueType?.type, props?.builtInList);
const _data = filterParamsData(getType.value?.valueType?.type, cloneDeep(props?.builtInList))
return _data
});
const handleOptions = computed(() => {
@ -162,7 +165,7 @@ const onChange = () => {
});
};
const onValueChange = () => {
const onValueChange = (val: any) => {
const obj = {
[`${propertyModelRef.properties}`]: {
value: propertyModelRef?.propertiesValue,
@ -170,7 +173,7 @@ const onValueChange = () => {
},
};
emit('update:value', obj);
emit('change', propertyModelRef?.propertiesValue)
emit('change', val?.name || val)
};
watch(

View File

@ -183,7 +183,7 @@ watch(
<style lang="less">
.action-search {
padding: 0 0 24px 0;
padding: 0;
}
.logo {

View File

@ -183,7 +183,7 @@ watch(
<style lang="less">
.action-search {
padding: 0 0 24px 0;
padding: 0;
}
.logo {

View File

@ -79,6 +79,7 @@ const formRef = ref();
const modelRef = reactive({});
watchEffect(() => {
console.log(props?.value)
Object.assign(modelRef, props?.value);
});

View File

@ -91,7 +91,7 @@ const source = computed(() => {
});
const builtInList = ref<any[]>([]);
const upperKey = ref();
const upperKey = ref(props.value?.upperKey);
const sourceChange = (val: any) => {
emit('update:value', {
@ -160,6 +160,14 @@ watch(
},
{ deep: true, immediate: true },
);
watch(
() => props.value.upperKey,
(newVal) => {
upperKey.value = newVal
},
{ immediate: true },
);
</script>
<style lang="less" scoped>

View File

@ -176,10 +176,10 @@
name="name"
:required="true"
:rules="[
// {
// required: true,
// message: '',
// },
{
required: true,
message: '请输入名称',
},
{
max: 64,
message: '最多可输入64个字符',
@ -467,7 +467,7 @@ const checkName = (_: any, value: any) =>
resolve('');
}
} else {
reject('请输入名称');
resolve('');
}
});
</script>

View File

@ -232,7 +232,7 @@ const table: any = {
// allPermissions,
// );
// item.selectPermissions = newPermission;
// fix: bug#10756
item.selectPermissions = n[1];
//
@ -264,6 +264,12 @@ const table: any = {
removedItem.selectPermissions = ['read'];
});
}
if (!nValue.length) {
//
table.tableData.forEach((item: any) => {
item.selectPermissions = ['read'];
});
}
},
{ deep: true },
);

View File

@ -548,6 +548,7 @@ watch(
() => props.parentId,
() => {
tableData._selectedRowKeys = [];
tableData.selectedRows = [];
},
);
</script>

View File

@ -3700,8 +3700,8 @@ jetlinks-store@^0.0.3:
jetlinks-ui-components@^1.0.5:
version "1.0.5"
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#c93a8863ed93b90f620d3c011ec79ada218625dd"
integrity sha512-ESpadoDCZHkedS0oFgQmuSUvoMLUk2OrCXwB6x4ED4crfKynLJtqjBYeY/f8Eb2TuRTLxElL/qv6dr+MTaJSeQ==
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#531a7cd5cc4069dc299f0efcc92411a4eee369e7"
integrity sha512-7VHsz5lVG9PlFkHoJvEown4QARuVuasR+jDa9NNQ+pJSHAtHAeiIO1bpVTQKfE5WCyhCKPnN8yIerJLLzmQ1fA==
dependencies:
"@vueuse/core" "^9.12.0"
ant-design-vue "^3.2.15"