-
\ No newline at end of file
diff --git a/src/views/rule-engine/Scene/Save/Timer/AddModal.vue b/src/views/rule-engine/Scene/Save/Timer/AddModal.vue
index db8b21a9..82631c0f 100644
--- a/src/views/rule-engine/Scene/Save/Timer/AddModal.vue
+++ b/src/views/rule-engine/Scene/Save/Timer/AddModal.vue
@@ -3,7 +3,7 @@
title='触发规则'
visible
:width='820'
- @click='save'
+ @ok='save'
@cancel='cancel'
>
import Timer from '../components/Timer'
import type { OperationTimer } from '@/views/rule-engine/Scene/typings'
-import {nextTick, PropType} from "vue";
-import {TriggerDevice} from "@/views/rule-engine/Scene/typings";
+import { PropType} from "vue";
import {handleTimerOptions} from "@/views/rule-engine/Scene/Save/components/Timer/util";
type Emit = {
(e: 'cancel'): void
- (e: 'save', data: TriggerDevice, options: Record): void
+ (e: 'save', data: OperationTimer, options: Record): void
}
const props = defineProps({
- timer: {
+ value: {
type: Object as PropType,
default: () => ({})
}
@@ -39,14 +38,14 @@ interface AddModelType {
}
const addModel = reactive({
- timer: props.timer
+ timer: props.value
})
const save = async () => {
const timerData = await timerRef.value?.validateFields()
if (timerData) {
- const options = handleTimerOptions(timerData)
- emit("save", timerData, options)
+ const options = handleTimerOptions(addModel.timer)
+ emit("save", addModel.timer, options)
}
}
@@ -54,9 +53,9 @@ const cancel = () => {
emit("cancel")
}
-nextTick(() => {
- Object.assign(addModel, props.timer)
-})
+// watchEffect(() => {
+// addModel.timer = props.value
+// })
diff --git a/src/views/rule-engine/Scene/Save/Timer/Title.vue b/src/views/rule-engine/Scene/Save/Timer/Title.vue
new file mode 100644
index 00000000..b37d035c
--- /dev/null
+++ b/src/views/rule-engine/Scene/Save/Timer/Title.vue
@@ -0,0 +1,58 @@
+
+
+
点击配置定时触发
+
+
+
+
+
+ {{ options.name }}
+
+
+
{{ options.extraName }}
+
+
+ {{ options.when }}
+
+
+ {{ options.time }}
+
+
+ {{ options.extraTime }}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/rule-engine/Scene/Save/Timer/index.vue b/src/views/rule-engine/Scene/Save/Timer/index.vue
index 6d750bb6..81d29554 100644
--- a/src/views/rule-engine/Scene/Save/Timer/index.vue
+++ b/src/views/rule-engine/Scene/Save/Timer/index.vue
@@ -2,7 +2,7 @@
@@ -29,8 +29,7 @@
v-if="visible"
@cancel='visible = false'
@save="save"
- :value="data.trigger.device"
- :options="data.options.trigger"
+ :value="data.trigger.timer"
/>
@@ -41,6 +40,7 @@ import { storeToRefs } from 'pinia';
import Action from '../action/index.vue';
import AddModel from './AddModal.vue'
import AddButton from '../components/AddButton.vue'
+import Title from './Title.vue'
import type { OperationTimer, BranchesThen } from '@/views/rule-engine/Scene/typings'
const sceneStore = useSceneStore();
@@ -49,6 +49,7 @@ const visible = ref(false)
const rules = [{
validator(_: any, v: any) {
+ console.log(v)
if (!v) {
return Promise.reject(new Error('请配置定时触发规则'));
}
@@ -85,5 +86,21 @@ const save = (_data: OperationTimer, options: Record) => {
}
-
\ No newline at end of file
diff --git a/src/views/rule-engine/Scene/Save/action/Device/Product.vue b/src/views/rule-engine/Scene/Save/action/Device/Product.vue
index a487395f..a59386ad 100644
--- a/src/views/rule-engine/Scene/Save/action/Device/Product.vue
+++ b/src/views/rule-engine/Scene/Save/action/Device/Product.vue
@@ -3,7 +3,7 @@
:columns="columns"
type="simple"
@search="handleSearch"
- class="search"
+ class="scene-search"
target="scene-trigger-device-product"
/>
diff --git a/src/views/rule-engine/Scene/Save/action/Device/actions/index.vue b/src/views/rule-engine/Scene/Save/action/Device/actions/index.vue
index ff7cdbb5..f935083e 100644
--- a/src/views/rule-engine/Scene/Save/action/Device/actions/index.vue
+++ b/src/views/rule-engine/Scene/Save/action/Device/actions/index.vue
@@ -22,6 +22,7 @@
showSearch
placeholder="请选择功能"
v-model:value="modelRef.message.functionId"
+ @select='functionSelect'
>
{
+ modelRef.message.inputs = []
+}
+
+const functionRules = [{
+ validator(_: string, value: any) {
+ if (!value?.length && functions.value.length) {
+ return Promise.reject('请输入功能值')
+ } else {
+ const hasValue = value.find((item: { name: string, value: any}) => !item.value)
+ if (hasValue) {
+ const functionItem = functions.value.find((item: any) => item.id === hasValue.name)
+ return Promise.reject(functionItem?.name ? `请输入${functionItem.name}值` : '请输入功能值')
+ }
+ }
+ return Promise.resolve();
+ }
+}]
+
const metadata = ref<{
functions: any[];
properties: any[];
diff --git a/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue b/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue
index b5d35ad2..d3a07b0e 100644
--- a/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue
+++ b/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue
@@ -3,7 +3,7 @@
:columns="columns"
type="simple"
@search="handleSearch"
- class="search"
+ class="scene-search"
target="scene-trigger-device-device"
/>
diff --git a/src/views/rule-engine/Scene/Save/components/FunctionCall/FunctionCall.vue b/src/views/rule-engine/Scene/Save/components/FunctionCall/FunctionCall.vue
index 25a9270a..1dda6f53 100644
--- a/src/views/rule-engine/Scene/Save/components/FunctionCall/FunctionCall.vue
+++ b/src/views/rule-engine/Scene/Save/components/FunctionCall/FunctionCall.vue
@@ -101,6 +101,7 @@ const valueChange = debounce(() => {
const _value = dataSource.value.map(item => ({
name: item.id, value: item.value
}))
+ console.log(_value)
emit('change', _value)
emit('update:value', _value)
}, 500)
diff --git a/src/views/rule-engine/Scene/Save/components/Timer/WhenOption.vue b/src/views/rule-engine/Scene/Save/components/Timer/WhenOption.vue
index 345f3fb1..f1adc12b 100644
--- a/src/views/rule-engine/Scene/Save/components/Timer/WhenOption.vue
+++ b/src/views/rule-engine/Scene/Save/components/Timer/WhenOption.vue
@@ -17,6 +17,7 @@ import { numberToString } from './util'
type Emit = {
(e: 'update:value', data: Array):void
+ (e: 'change', data: Array):void
}
const props = defineProps({
@@ -48,6 +49,7 @@ const change = (number: number) => {
}
rowKeys.value = [..._keys.values()]
emit('update:value', rowKeys.value)
+ emit('change', rowKeys.value)
}
const allActive = computed(() => {
@@ -57,7 +59,9 @@ const allActive = computed(() => {
watch(() => props.type, () => {
const isMonth = props.type === 'month'
const day = isMonth ? 31 : 7
- change(0)
+ if (!props.value.length) {
+ change(0)
+ }
timeOptions.value = new Array(day)
.fill(1)
.map((_, index) => {
diff --git a/src/views/rule-engine/Scene/Save/components/Timer/index.vue b/src/views/rule-engine/Scene/Save/components/Timer/index.vue
index 84eb7e26..7b902b18 100644
--- a/src/views/rule-engine/Scene/Save/components/Timer/index.vue
+++ b/src/views/rule-engine/Scene/Save/components/Timer/index.vue
@@ -15,6 +15,7 @@
]'
option-type='button'
button-style='solid'
+ @change='updateValue'
/>
-
+
-
+
-
+
执行一次
@@ -68,6 +75,7 @@
@change='(v) => {
formModel.period.from = v[0]
formModel.period.to = v[1]
+ updateValue()
}'
/>
@@ -83,6 +91,7 @@
:min='1'
:max='59'
v-model:value='formModel.period.every'
+ @change='updateValue'
>
@@ -103,7 +113,7 @@
diff --git a/src/views/rule-engine/Scene/Save/components/TriggerWay.vue b/src/views/rule-engine/Scene/Save/components/TriggerWay.vue
index 9f5401cc..a079509b 100644
--- a/src/views/rule-engine/Scene/Save/components/TriggerWay.vue
+++ b/src/views/rule-engine/Scene/Save/components/TriggerWay.vue
@@ -57,15 +57,17 @@ const classNames = computed(() => {
})
const handleClick = (type: string) => {
- emit('update:modelValue', type)
+ if (!props.disabled) {
+ emit('update:modelValue', type)
+ }
}
\ No newline at end of file
diff --git a/src/views/rule-engine/Scene/Save/index.vue b/src/views/rule-engine/Scene/Save/index.vue
index d66d8a7c..12d93a3c 100644
--- a/src/views/rule-engine/Scene/Save/index.vue
+++ b/src/views/rule-engine/Scene/Save/index.vue
@@ -114,4 +114,7 @@ onUnmounted(() => {
}
}
}
+
+
\ No newline at end of file
diff --git a/src/views/rule-engine/Scene/Save/style.less b/src/views/rule-engine/Scene/Save/style.less
new file mode 100644
index 00000000..27da287d
--- /dev/null
+++ b/src/views/rule-engine/Scene/Save/style.less
@@ -0,0 +1,3 @@
+.scene-search {
+ padding: 24px 0 0 0;
+}
\ No newline at end of file
diff --git a/src/views/rule-engine/Scene/index.vue b/src/views/rule-engine/Scene/index.vue
index 535e7bf4..92f38c15 100644
--- a/src/views/rule-engine/Scene/index.vue
+++ b/src/views/rule-engine/Scene/index.vue
@@ -300,7 +300,7 @@ const getActions = (
];
if (data.triggerType === 'manual') {
const _item: ActionsType = {
- key: 'trigger',
+ key: 'tigger',
text: '手动触发',
disabled: data.state?.value === 'disable',
tooltip: {
diff --git a/src/views/system/Department/components/AddDeviceOrProductDialog.vue b/src/views/system/Department/components/AddDeviceOrProductDialog.vue
index 6481f03e..c82bc814 100644
--- a/src/views/system/Department/components/AddDeviceOrProductDialog.vue
+++ b/src/views/system/Department/components/AddDeviceOrProductDialog.vue
@@ -143,6 +143,9 @@ import {
} from '@/api/system/department';
import { message } from 'jetlinks-ui-components';
import { dictType } from '../typing';
+import { useDepartmentStore } from '@/store/department';
+
+const departmentStore = useDepartmentStore();
const emits = defineEmits(['confirm', 'update:visible']);
const props = defineProps<{
@@ -154,6 +157,9 @@ const props = defineProps<{
}>();
// 弹窗相关
const loading = ref(false);
+// 资产咨询次数, 产品分配后自动进入的设备资产, 第一次需要带上产品id查询
+const queryCount = ref(0);
+
const confirm = () => {
if (table.selectedRows.length < 1) {
return message.warning('请先勾选数据');
@@ -167,6 +173,11 @@ const confirm = () => {
permission: item.selectPermissions,
}));
+ if (params.length === 1) {
+ // 只选择一个产品资产分配时, 分配之后, 进入设备资产分配需查出对应产品下的设备
+ departmentStore.setProductId(params[0].assetIdList[0]);
+ }
+
loading.value = true;
bindDeviceOrProductList_api(props.assetType, params)
.then(() => {
@@ -259,8 +270,10 @@ const table: any = {
// 选中
onSelectChange: (row: any) => {
// 若该项的可选权限中没有分享权限,则不支持任何操作
- if (!row.permissionList.find((item: any) => item.value === 'share'))
+ if (!row.permissionList.find((item: any) => item.value === 'share')) {
+ message.warning('该资产不支持共享');
return;
+ }
const selectedRowKeys = table._selectedRowKeys.value;
const index = selectedRowKeys.indexOf(row.id);
@@ -330,7 +343,9 @@ const table: any = {
resolve({
code: 200,
result: {
- data: data.sort((a, b) => a.createTime - b.createTime),
+ data: data.sort(
+ (a, b) => a.createTime - b.createTime,
+ ),
pageIndex,
pageSize,
total,
@@ -394,6 +409,7 @@ const table: any = {
}),
// 整理参数并获取数据
requestFun: async (oParams: any) => {
+ queryCount.value += 1;
if (props.parentId) {
const terms = [
{
@@ -411,9 +427,24 @@ const table: any = {
],
},
},
+ {
+ column: 'productId$product-info',
+ type: 'and',
+ value: `id is ${departmentStore.productId}`,
+ },
],
},
];
+
+ if (
+ props.assetType !== 'device' ||
+ !departmentStore.productId ||
+ queryCount.value > 1 ||
+ departmentStore.optType === 'handle'
+ ) {
+ // 非设备|产品id不存在|有其他查询操作(queryCount+1)|设备页面手动点击资产分配, 均删除产品带入的id
+ terms[0].terms.pop();
+ }
if (oParams.terms && oParams.terms.length > 0)
terms.unshift({ terms: oParams.terms });
const params = {
diff --git a/src/views/system/Department/components/EditDepartmentDialog.vue b/src/views/system/Department/components/EditDepartmentDialog.vue
index ea145c5c..d6b6f0a4 100644
--- a/src/views/system/Department/components/EditDepartmentDialog.vue
+++ b/src/views/system/Department/components/EditDepartmentDialog.vue
@@ -18,6 +18,7 @@
placeholder="请选择上级组织"
:tree-data="treeData"
:field-names="{ value: 'id' }"
+ @change="handleTreeSelectChange"
>
{{ name }}
@@ -60,6 +61,21 @@ import {
updateDepartment_api,
} from '@/api/system/department';
+type treeType = {
+ id: string;
+ parentId?: string;
+ name: string;
+ sortIndex: string | number;
+ children?: treeType[];
+ disabled?: boolean;
+};
+type formType = {
+ id?: string;
+ parentId?: string;
+ name: string;
+ sortIndex: string | number;
+};
+
const emits = defineEmits(['refresh', 'update:visible']);
const props = defineProps<{
treeData: any[];
@@ -91,8 +107,8 @@ const treeData = computed(() => {
});
/**
* 在给定的树中通过id匹配
- * @param node
- * @param id
+ * @param node
+ * @param id
*/
const findItemById = (node: treeType[], id: string): treeType | null => {
let result = null;
@@ -107,7 +123,7 @@ const findItemById = (node: treeType[], id: string): treeType | null => {
};
/**
* 将此树下的所有节点禁用
- * @param treeNode
+ * @param treeNode
*/
const filterTree = (treeNode: treeType[]) => {
if (treeNode.length < 1) return;
@@ -160,18 +176,15 @@ const form = reactive({
});
form.init();
-type treeType = {
- id: string;
- parentId?: string;
- name: string;
- sortIndex: string | number;
- children?: treeType[];
- disabled?: boolean;
-};
-type formType = {
- id?: string;
- parentId?: string;
- name: string;
- sortIndex: string | number;
+/**
+ * 上级组织选择改变
+ */
+const handleTreeSelectChange = () => {
+ // 上级组织
+ const parent = treeData.value.find((f: any) => f.id === form.data.parentId);
+ // 当前编辑的组织排序, 为选择上级组织的最大排序+1, 如上级组织没有自组织, 则默认为1
+ form.data.sortIndex = parent?.children
+ ? parent.children[parent.children.length - 1].sortIndex + 1
+ : 1;
};
diff --git a/src/views/system/Department/device/index.vue b/src/views/system/Department/device/index.vue
index 1d1f076e..d4e70dc4 100644
--- a/src/views/system/Department/device/index.vue
+++ b/src/views/system/Department/device/index.vue
@@ -22,7 +22,7 @@
资产分配
@@ -70,7 +70,7 @@
:status="slotProps.state?.value"
:statusText="slotProps.state?.text"
:statusNames="{
- online: 'success',
+ online: 'processing',
offline: 'error',
notActive: 'warning',
}"
@@ -147,7 +147,7 @@
:status="slotProps.state.value"
:text="slotProps.state.text"
:statusNames="{
- online: 'success',
+ online: 'processing',
offline: 'error',
notActive: 'warning',
}"
@@ -211,6 +211,9 @@ import { intersection } from 'lodash-es';
import type { dictType, optionsType } from '../typing';
import { message } from 'jetlinks-ui-components';
+import { useDepartmentStore } from '@/store/department';
+
+const departmentStore = useDepartmentStore();
const permission = 'system/Department';
@@ -247,6 +250,9 @@ const columns = [
search: {
rename: 'productId$product-info',
type: 'select',
+ handleValue(value: string) {
+ return `id is ${value}`;
+ },
options: () =>
new Promise((resolve) => {
const params = {
@@ -288,14 +294,9 @@ const columns = [
search: {
type: 'select',
options: [
- {
- label: '正常',
- value: 1,
- },
- {
- label: '禁用',
- value: 0,
- },
+ { label: '禁用', value: 'notActive' },
+ { label: '离线', value: 'offline' },
+ { label: '在线', value: 'online' },
],
},
scopedSlots: true,
@@ -467,7 +468,9 @@ const table = {
};
}
},
- clickAdd: () => {
+ clickAdd: (type?: string) => {
+ // 设备资产分配弹窗操作类型: type = 'handle': 手动点击资产分配按钮, !type产品资产分配后, 自动弹出设备资产分配
+ departmentStore.setType(type)
dialogs.addShow = true;
},
clickEdit: (row?: any) => {
@@ -520,7 +523,7 @@ const dialogs = reactive({
});
table.init();
-nextTick(() => {
+watchEffect(() => {
props.bindBool && table.clickAdd();
emits('update:bindBool', false);
});
diff --git a/src/views/system/Department/product/index.vue b/src/views/system/Department/product/index.vue
index 9537f7ff..0a113a4c 100644
--- a/src/views/system/Department/product/index.vue
+++ b/src/views/system/Department/product/index.vue
@@ -68,9 +68,8 @@
:status="slotProps.state?.value"
:statusText="slotProps.state?.text"
:statusNames="{
- online: 'success',
- offline: 'error',
- notActive: 'warning',
+ 1: 'processing',
+ 0: 'error',
}"
>
@@ -172,9 +171,8 @@
:status="slotProps.state.value"
:text="slotProps.state.text"
:statusNames="{
- online: 'success',
- offline: 'error',
- notActive: 'warning',
+ 1: 'processing',
+ 0: 'error',
}"
>
diff --git a/src/views/system/Platforms/Api/components/ApiTest.vue b/src/views/system/Platforms/Api/components/ApiTest.vue
index df1d8124..14afd101 100644
--- a/src/views/system/Platforms/Api/components/ApiTest.vue
+++ b/src/views/system/Platforms/Api/components/ApiTest.vue
@@ -19,6 +19,7 @@
:dataSource="paramsTable"
:pagination="false"
size="small"
+ bordered
>
@@ -65,8 +66,7 @@
新增
@@ -305,11 +306,15 @@ type requestObj = {
}
}
.table {
+ margin-bottom: 22px;
:deep(.ant-table-cell) {
padding: 0 8px;
height: 56px;
}
}
+ :deep(.ant-form-item) {
+ margin-bottom: 0;
+ }
}
}
}
diff --git a/src/views/system/Platforms/Api/components/ChooseApi.vue b/src/views/system/Platforms/Api/components/ChooseApi.vue
index be147aa1..e6783527 100644
--- a/src/views/system/Platforms/Api/components/ChooseApi.vue
+++ b/src/views/system/Platforms/Api/components/ChooseApi.vue
@@ -79,7 +79,7 @@ const rowSelection = {
},
selectedRowKeys: ref([]),
};
-const save = () => {
+const save = async () => {
const keys = props.selectedRowKeys;
const removeKeys = props.sourceKeys.filter((key) => !keys.includes(key));
@@ -87,13 +87,20 @@ const save = () => {
if (props.mode === 'api') {
// 此时是api配置
- removeKeys.length &&
- delOperations_api(removeKeys)
- .finally(() => addOperations_api(addKeys))
- .then(() => {
- message.success('操作成功');
- emits('refresh')
- });
+ // removeKeys.length &&
+ // delOperations_api(removeKeys)
+ // .finally(() => addOperations_api(addKeys))
+ // .then(() => {
+ // message.success('操作成功');
+ // emits('refresh');
+ // });
+ // fix: bug#10829
+ removeKeys.length && (await delOperations_api(removeKeys));
+ const res = await addOperations_api(addKeys);
+ if (res.success) {
+ message.success('操作成功');
+ emits('refresh');
+ }
} else if (props.mode === 'appManger') {
const removeItems = removeKeys.map((key) => ({
id: key,
diff --git a/src/views/system/Role/Detail/Permiss/index.vue b/src/views/system/Role/Detail/Permiss/index.vue
index 8c1fe792..21898ba0 100644
--- a/src/views/system/Role/Detail/Permiss/index.vue
+++ b/src/views/system/Role/Detail/Permiss/index.vue
@@ -78,12 +78,16 @@ const form = reactive({
});
},
clickSave: () => {
- const updateRole = updateRole_api(form.data);
- const updateTree = updatePrimissTree_api(roleId, { menus: form.menus });
+ formRef.value?.validate().then(() => {
+ const updateRole = updateRole_api(form.data);
+ const updateTree = updatePrimissTree_api(roleId, {
+ menus: form.menus,
+ });
- Promise.all([updateRole, updateTree]).then((resp) => {
- message.success('操作成功');
- router.push('/system/Role');
+ Promise.all([updateRole, updateTree]).then((resp) => {
+ message.success('操作成功');
+ router.push('/system/Role');
+ });
});
},
});
@@ -123,7 +127,7 @@ form.getForm();
:deep(.ant-form-item-required) {
padding-right: 12px;
- &::before{
+ &::before {
right: 0;
}
}
diff --git a/src/views/system/User/index.vue b/src/views/system/User/index.vue
index 8fe8b0a6..2283af2d 100644
--- a/src/views/system/User/index.vue
+++ b/src/views/system/User/index.vue
@@ -4,7 +4,7 @@
queryParams = {...params}"
+ @search="handleParams"
/>
{
+
+ const newParams = (params?.terms as any[])?.map(item1 => {
+ item1.terms = item1.terms.map((item2: any) => {
+ if (['telephone', 'email'].includes(item2.column)) {
+ return {
+ column: 'id$user-detail',
+ value: [item2]
+ }
+ }
+ return item2
+ })
+ return item1
+ })
+ queryParams.value = { terms: newParams || [] }
+}