Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
9755d174fe
|
@ -7,7 +7,7 @@
|
|||
<div class="left-content">
|
||||
<TitleComponent data="基本信息" />
|
||||
<j-alert
|
||||
v-if="!!_error && modelRef?.id && productPermission()"
|
||||
v-if="!!_error && modelRef?.id"
|
||||
style="margin: 10px 0"
|
||||
type="warning"
|
||||
>
|
||||
|
@ -485,7 +485,6 @@ import _ from 'lodash';
|
|||
import { onlyMessage } from '@/utils/comm';
|
||||
import MSelect from '../../components/MSelect/index.vue';
|
||||
import { _deploy } from '@/api/device/product';
|
||||
import { usePermissionStore } from '@/store/permission';
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
@ -493,9 +492,6 @@ const route = useRoute();
|
|||
const formRef = ref();
|
||||
const _errorSet = ref<Set<string>>(new Set());
|
||||
|
||||
const hasPermission = usePermissionStore().hasPermission;
|
||||
const productPermission = () => hasPermission(`device/Product:action`);
|
||||
|
||||
const modelRef = reactive({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div class="left-content">
|
||||
<TitleComponent data="基本信息" />
|
||||
<j-alert
|
||||
v-if="_error && modelRef?.id && productPermission()"
|
||||
v-if="_error && modelRef?.id"
|
||||
style="margin: 10px 0"
|
||||
type="warning"
|
||||
>
|
||||
|
@ -551,16 +551,12 @@ import { useMenuStore } from '@/store/menu';
|
|||
import { onlyMessage } from '@/utils/comm';
|
||||
import MSelect from '../../components/MSelect/index.vue';
|
||||
import { _deploy } from '@/api/device/product';
|
||||
import { usePermissionStore } from '@/store/permission';
|
||||
|
||||
const menuStory = useMenuStore();
|
||||
const route = useRoute();
|
||||
|
||||
const formRef = ref();
|
||||
|
||||
const hasPermission = usePermissionStore().hasPermission;
|
||||
const productPermission = () => hasPermission(`device/Product:action`);
|
||||
|
||||
const modelRef = reactive({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
|
|
|
@ -203,7 +203,6 @@ const columns = [
|
|||
dataIndex: 'deviceName',
|
||||
key: 'deviceName',
|
||||
fixed: 'left',
|
||||
width: 200,
|
||||
ellipsis: true,
|
||||
search: {
|
||||
type: 'string',
|
||||
|
@ -214,7 +213,6 @@ const columns = [
|
|||
dataIndex: 'productId',
|
||||
key: 'productId',
|
||||
ellipsis: true,
|
||||
width: 200,
|
||||
scopedSlots: true,
|
||||
// search: {
|
||||
// type: 'select',
|
||||
|
@ -233,6 +231,7 @@ const columns = [
|
|||
key: 'completeTime',
|
||||
ellipsis: true,
|
||||
dataIndex: 'completeTime',
|
||||
width: 200,
|
||||
search: {
|
||||
type: 'date',
|
||||
},
|
||||
|
@ -244,7 +243,6 @@ const columns = [
|
|||
key: 'progress',
|
||||
ellipsis: true,
|
||||
scopedSlots: true,
|
||||
width: 200,
|
||||
search: {
|
||||
type: 'number',
|
||||
},
|
||||
|
@ -262,14 +260,14 @@ const columns = [
|
|||
})),
|
||||
},
|
||||
scopedSlots: true,
|
||||
width: 200,
|
||||
width: 120,
|
||||
},
|
||||
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right',
|
||||
width: 200,
|
||||
width: 120,
|
||||
scopedSlots: true,
|
||||
},
|
||||
];
|
||||
|
@ -344,7 +342,9 @@ const confirm = async (e: MouseEvent) => {
|
|||
const res = await startTask(taskId, ['failed']);
|
||||
if (res.success) {
|
||||
onlyMessage('操作成功', 'success');
|
||||
handleRefresh('failed');
|
||||
stateList.forEach((item) => {
|
||||
handleRefresh(item.key);
|
||||
});
|
||||
tableRef.value.reload();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<ValueItem
|
||||
v-model:modelValue="record.value"
|
||||
:itemType="record.type"
|
||||
style="width: 100%"
|
||||
|
||||
:options="
|
||||
record.type === 'enum'
|
||||
? (
|
||||
|
@ -53,7 +53,6 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { emit } from 'process';
|
||||
import { PropType } from 'vue';
|
||||
|
||||
type Emits = {
|
||||
|
@ -100,8 +99,8 @@ watchEffect(() => {
|
|||
const onSave = () =>
|
||||
new Promise((resolve, reject) => {
|
||||
formRef.value?.validate().then((_data: any) => {
|
||||
_emit('update:modelValue', _data)
|
||||
resolve(_data);
|
||||
_emit('update:modelValue', modelRef.dataSource)
|
||||
resolve(true);
|
||||
}).catch(() => {
|
||||
reject(false)
|
||||
})
|
||||
|
@ -111,4 +110,8 @@ defineExpose({ onSave });
|
|||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-form-item) {
|
||||
margin: 0 !important;
|
||||
height: 30px;
|
||||
}
|
||||
</style>
|
|
@ -178,6 +178,7 @@ const funcChange = (val: string) => {
|
|||
|
||||
const saveBtn = async () => {
|
||||
const _inputs = await inputsRef.value.onSave();
|
||||
console.log(_inputs)
|
||||
if(!_inputs){
|
||||
return
|
||||
}
|
||||
|
@ -192,7 +193,7 @@ const saveBtn = async () => {
|
|||
}
|
||||
|
||||
if (values.type === 'INVOKE_FUNCTION') {
|
||||
const list = (modelRef.inputs || []).filter((it: any) => !!it.value);
|
||||
const list = (modelRef?.inputs || [])?.filter((it: any) => !!it.value);
|
||||
const obj = {};
|
||||
list.map((it: any) => {
|
||||
obj[it.id] = it.value;
|
||||
|
|
|
@ -1,89 +1,82 @@
|
|||
<template>
|
||||
<div class="advance-wrapper">
|
||||
<j-tabs v-model="activeKey" tab-position="left">
|
||||
<j-tab-pane
|
||||
v-for="func in newFunctions"
|
||||
:key="func.id"
|
||||
:tab="func.name"
|
||||
<div style="width: 150px">
|
||||
<j-tabs
|
||||
v-model="activeKey"
|
||||
tab-position="left"
|
||||
:tabBarStyle="{ width: '100%' }"
|
||||
@change="onTabChange"
|
||||
>
|
||||
<j-row :gutter="30">
|
||||
<j-col :span="15">
|
||||
<JMonacoEditor
|
||||
:ref="`monacoEditor${func.id}`"
|
||||
v-model="func.json"
|
||||
theme="vs-dark"
|
||||
style="height: 400px"
|
||||
/>
|
||||
<div class="editor-btn">
|
||||
<j-space>
|
||||
<j-button
|
||||
type="primary"
|
||||
@click="handleExecute(func)"
|
||||
>
|
||||
执行
|
||||
</j-button>
|
||||
<j-button
|
||||
type="default"
|
||||
@click="handleClear(func)"
|
||||
>
|
||||
清空
|
||||
</j-button>
|
||||
</j-space>
|
||||
<j-tab-pane v-for="func in newFunctions" :key="func.id">
|
||||
<template #tab>
|
||||
<div style="width: 100px; text-align: left">
|
||||
<j-ellipsis>{{ func.name }}</j-ellipsis>
|
||||
</div>
|
||||
</j-col>
|
||||
<j-col :span="9">
|
||||
<h6>执行结果:</h6>
|
||||
<span class="execute-result">
|
||||
{{ func.executeResult }}
|
||||
</span>
|
||||
</j-col>
|
||||
</j-row>
|
||||
</j-tab-pane>
|
||||
</j-tabs>
|
||||
</template>
|
||||
</j-tab-pane>
|
||||
</j-tabs>
|
||||
</div>
|
||||
<div style="flex: 1">
|
||||
<j-row :gutter="30">
|
||||
<j-col :span="15">
|
||||
<JMonacoEditor
|
||||
:ref="`monacoEditor${current.id}`"
|
||||
v-model="current.json"
|
||||
theme="vs-dark"
|
||||
style="height: 400px"
|
||||
/>
|
||||
<div class="editor-btn">
|
||||
<j-space>
|
||||
<j-button
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
@click="handleExecute(current)"
|
||||
>
|
||||
执行
|
||||
</j-button>
|
||||
<j-button
|
||||
type="default"
|
||||
@click="handleClear()"
|
||||
>
|
||||
清空
|
||||
</j-button>
|
||||
</j-space>
|
||||
</div>
|
||||
</j-col>
|
||||
<j-col :span="9">
|
||||
<h6>执行结果:</h6>
|
||||
<span class="execute-result">
|
||||
{{ executeResult }}
|
||||
</span>
|
||||
</j-col>
|
||||
</j-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ComponentInternalInstance } from 'vue';
|
||||
import { useInstanceStore } from '@/store/instance';
|
||||
import { execute } from '@/api/device/instance';
|
||||
import { onlyMessage } from '@/utils/comm';
|
||||
|
||||
const instanceStore = useInstanceStore();
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const activeKey = ref('');
|
||||
const loading = ref<boolean>(false);
|
||||
// 物模型数据
|
||||
const metadata = computed(() => JSON.parse(instanceStore.detail.metadata));
|
||||
const current = ref<any>({});
|
||||
const executeResult = ref<string>('');
|
||||
|
||||
// 设备功能数据处理
|
||||
const newFunctions = computed(() => {
|
||||
const result: any = [];
|
||||
metadata.value.functions?.forEach((func: any) => {
|
||||
const obj = {};
|
||||
const jsonData = func.inputs || func.properties;
|
||||
for (const jsonItem of jsonData) {
|
||||
const type = jsonItem.valueType ? jsonItem.valueType.type : '-';
|
||||
obj[jsonItem.id] = setInitValue(type, jsonItem['json']);
|
||||
}
|
||||
|
||||
result.push({
|
||||
...func,
|
||||
json: JSON.stringify(obj),
|
||||
executeResult: '',
|
||||
});
|
||||
});
|
||||
// console.log('newFunctions: ', result);
|
||||
return result;
|
||||
});
|
||||
const newFunctions = ref<any[]>([]);
|
||||
|
||||
/**
|
||||
* 根据数据类型, 赋初始值
|
||||
* @param type
|
||||
* @param json
|
||||
*/
|
||||
const setInitValue = (type: string, json?: any) => {
|
||||
const setInitValue = (type: string, json?: any) => {
|
||||
let initVal: any = '';
|
||||
if (['int', 'long', 'float', 'double'].includes(type)) {
|
||||
initVal = 0;
|
||||
|
@ -105,31 +98,73 @@ const setInitValue = (type: string, json?: any) => {
|
|||
return initVal;
|
||||
};
|
||||
|
||||
// 设备功能数据处理
|
||||
watch(
|
||||
() => metadata.value.functions,
|
||||
(newVal) => {
|
||||
const result: any = [];
|
||||
newVal?.forEach((func: any) => {
|
||||
const obj = {};
|
||||
const jsonData = func.inputs || func.properties;
|
||||
for (const jsonItem of jsonData) {
|
||||
const type = jsonItem.valueType ? jsonItem.valueType.type : '-';
|
||||
obj[jsonItem.id] = setInitValue(type, jsonItem['json']);
|
||||
}
|
||||
|
||||
result.push({
|
||||
...func,
|
||||
json: JSON.stringify(obj),
|
||||
});
|
||||
});
|
||||
newFunctions.value = result;
|
||||
current.value = result?.[0];
|
||||
activeKey.value = result?.[0]?.id;
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
);
|
||||
|
||||
const onTabChange = (_key: string) => {
|
||||
const _item = newFunctions.value.find((item: any) => item.id === _key);
|
||||
current.value = { ..._item };
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行
|
||||
*/
|
||||
const handleExecute = async (func: any) => {
|
||||
const { success, result } = await execute(
|
||||
loading.value = true;
|
||||
const resp: any = await execute(
|
||||
route.params.id as string,
|
||||
func.id,
|
||||
JSON.parse(func.json),
|
||||
);
|
||||
if (!success) return;
|
||||
onlyMessage('操作成功');
|
||||
func.executeResult = result instanceof Array ? result[0] : result;
|
||||
proxy?.$forceUpdate();
|
||||
)
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
if (resp.success) {
|
||||
executeResult.value = resp?.result instanceof Array ? resp?.result?.[0] : resp.result;
|
||||
onlyMessage('操作成功');
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 清空
|
||||
*/
|
||||
const handleClear = (func: any) => {
|
||||
func.json = '';
|
||||
proxy?.$forceUpdate();
|
||||
const handleClear = () => {
|
||||
current.json = '';
|
||||
executeResult.value = '';
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.advance-wrapper {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
.editor-btn {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
<j-space>
|
||||
<j-button
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
@click="handleExecute(func)"
|
||||
>
|
||||
执行
|
||||
|
@ -115,6 +116,7 @@ const route = useRoute();
|
|||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const activeKey = ref('');
|
||||
const loading = ref<boolean>(false);
|
||||
// 物模型数据
|
||||
const metadata = computed(() => JSON.parse(instanceStore.detail.metadata));
|
||||
const columns = ref([
|
||||
|
@ -201,11 +203,17 @@ const handleExecute = async (func: any) => {
|
|||
obj[item.id] = item.value;
|
||||
}
|
||||
});
|
||||
loading.value = true
|
||||
const { success, result } = await execute(
|
||||
route.params.id as string,
|
||||
func.id,
|
||||
obj,
|
||||
);
|
||||
).catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
if (!success) return;
|
||||
onlyMessage('操作成功');
|
||||
executeResult.value = result instanceof Array ? result[0] : result;
|
||||
|
|
|
@ -156,7 +156,7 @@ const queryPropertyData = async (params: any) => {
|
|||
watch(
|
||||
() => [_props.data.id, _props.time],
|
||||
([newVal]) => {
|
||||
if (newVal) {
|
||||
if (newVal && _props.time?.length) {
|
||||
queryPropertyData({
|
||||
pageSize: 12,
|
||||
pageIndex: 0,
|
||||
|
|
|
@ -53,9 +53,9 @@
|
|||
</template>
|
||||
<template #content>
|
||||
<Ellipsis style="width: calc(100% - 100px);">
|
||||
<h3 style="font-size: 16px;font-weight: 700;color: #315efb;">
|
||||
<span style="font-size: 16px;font-weight: 700">
|
||||
{{ slotProps.name }}
|
||||
</h3>
|
||||
</span>
|
||||
</Ellipsis>
|
||||
<p>通道数量:{{ slotProps.count || 0 }}</p>
|
||||
<j-badge
|
||||
|
|
|
@ -47,9 +47,9 @@
|
|||
</template>
|
||||
<template #content>
|
||||
<Ellipsis style="width: calc(100% - 100px);">
|
||||
<h3 style="font-size: 16px;font-weight: 700;color: #315efb;">
|
||||
<span style="font-size: 16px;font-weight: 700">
|
||||
{{ slotProps.name }}
|
||||
</h3>
|
||||
</span>
|
||||
</Ellipsis>
|
||||
<j-row>
|
||||
<j-col :span="12">
|
||||
|
|
|
@ -129,13 +129,12 @@ const handleSearch = (_params: any) => {
|
|||
params.value = _params;
|
||||
};
|
||||
|
||||
// const
|
||||
|
||||
const handleClick = (dt: any) => {
|
||||
if (_selectedRowKeys.value.includes(dt.id)) {
|
||||
_selectedRowKeys.value = [];
|
||||
emit('update:value', undefined);
|
||||
emit('change', { templateName: undefined, orgName: undefined, sendTo: undefined });
|
||||
// emit('change', { templateName: undefined, orgName: undefined, sendTo: undefined });
|
||||
emit('change', { templateName: undefined });
|
||||
emit('update:detail', undefined);
|
||||
} else {
|
||||
// console.log(dt)
|
||||
|
|
|
@ -184,7 +184,12 @@ const relationData = computed(() => {
|
|||
if(notifyType.value === 'email'){
|
||||
if(item && Array.isArray(item) && item.length){
|
||||
if(item[0].source === 'relation'){
|
||||
return item.map(i => i?.relation?.objectId)
|
||||
return item.map(i => {
|
||||
if(i.relation?.objectType === 'user') {
|
||||
return i?.relation?.objectId
|
||||
}
|
||||
return i?.relation?.related?.relation
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if (item?.source === 'relation') {
|
||||
|
@ -212,7 +217,6 @@ const treeData = ref<any[]>([
|
|||
},
|
||||
]);
|
||||
const mySource = ref<string>('relation');
|
||||
const labelMap = new Map();
|
||||
const treeDataMap = new Map()
|
||||
|
||||
const getRelationUsers = async (notifyType: string, notifierId: string) => {
|
||||
|
@ -247,7 +251,6 @@ const getUser = async (_source: string, _triggerType: string) => {
|
|||
paging: false,
|
||||
sorts: [{ name: 'name', order: 'asc' }],
|
||||
});
|
||||
console.log(_triggerType, _source)
|
||||
if (_triggerType && _triggerType === 'device' && _source === 'relation') {
|
||||
relationResp = await NoticeApi.getRelationUsers({
|
||||
paging: false,
|
||||
|
@ -279,7 +282,7 @@ const getUser = async (_source: string, _triggerType: string) => {
|
|||
title: item.name,
|
||||
isRelation: true,
|
||||
}
|
||||
treeDataMap.set(item.id, obj)
|
||||
treeDataMap.set(item.relation, obj)
|
||||
return obj
|
||||
}),
|
||||
});
|
||||
|
@ -338,11 +341,17 @@ const onChange = (
|
|||
if (Array.isArray(_value)) {
|
||||
if (props?.notify?.notifyType === 'email') {
|
||||
_values = _value.map((item) => {
|
||||
return {
|
||||
source: "relation",
|
||||
relation:{
|
||||
objectType: "user",
|
||||
objectId: item
|
||||
const _item = treeDataMap.get(item)
|
||||
const _isRelation = _item?.isRelation
|
||||
if(_isRelation) {
|
||||
return getObj(_source, item, _isRelation);
|
||||
} else {
|
||||
return {
|
||||
source: "relation",
|
||||
relation:{
|
||||
objectType: "user",
|
||||
objectId: item
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue