diff --git a/src/components/DictTag/Select.vue b/src/components/DictTag/Select.vue
index b47aa9a..7f2c247 100644
--- a/src/components/DictTag/Select.vue
+++ b/src/components/DictTag/Select.vue
@@ -1,13 +1,6 @@
-
+
@@ -52,11 +45,11 @@ const dictList = ref([]);
async function loadDictData() {
if (props.dictType) {
- const res = await getDicts(props.dictType);
- dictList.value = res.data.map((p: any) => ({
- label: p.label,
- value: p.value
- }));
+ const res = await getDicts(props.dictType);
+ dictList.value = res.data.map((p: any) => ({
+ label: p.label,
+ value: p.value
+ }));
}
}
diff --git a/src/views/device/deviceGroup/form.vue b/src/views/device/deviceGroup/form.vue
index 4321ef4..3f78785 100644
--- a/src/views/device/deviceGroup/form.vue
+++ b/src/views/device/deviceGroup/form.vue
@@ -1,10 +1,16 @@
-
+
-
+
+
+
+
+
+
+
@@ -47,12 +53,13 @@ const dataFormRef = ref();
const visible = ref(false)
const loading = ref(false)
// 定义字典
-
+const { panel_type } = useDict("panel_type")
// 提交表单数据
const form = reactive({
id: '',
name: '',
bizType: '',
+ panelViewCodes: [],
sort: '',
});
@@ -87,7 +94,11 @@ const onSubmit = async () => {
try {
loading.value = true;
- form.id ? await deviceGroupApi.putObj(form) : await deviceGroupApi.addObj(form);
+ const _form: any = { ...form }
+ if (_form.panelViewCodes && _form.panelViewCodes.length) {
+ _form.panelViewCodes = _form.panelViewCodes.join(',')
+ }
+ form.id ? await deviceGroupApi.putObj(_form) : await deviceGroupApi.addObj(_form);
useMessage().success(form.id ? '修改成功' : '添加成功');
visible.value = false;
emit('refresh');
@@ -100,14 +111,19 @@ const onSubmit = async () => {
// 初始化表单数据
-const getdeviceGroupData = (id: string) => {
- // 获取数据
- loading.value = true
- deviceGroupApi.getObj(id).then((res: any) => {
- Object.assign(form, res.data)
- }).finally(() => {
+const getdeviceGroupData = async (id: string) => {
+ try {
+ loading.value = true
+ const { code, data } = await deviceGroupApi.getObj(id)
+ if (data.panelViewCodes) {
+ data.panelViewCodes = data.panelViewCodes.split(',')
+ }
+ Object.assign(form, data)
+ } catch (error) {
+ console.error("|初始化表单数据|意外的错误:", error);
+ } finally {
loading.value = false
- })
+ }
};
// 暴露变量
diff --git a/src/views/device/deviceGroup/index.vue b/src/views/device/deviceGroup/index.vue
index 8e27c37..31f13ba 100644
--- a/src/views/device/deviceGroup/index.vue
+++ b/src/views/device/deviceGroup/index.vue
@@ -9,6 +9,9 @@
+
+
+
{{ $t('common.queryBtn') }}
@@ -53,7 +56,7 @@
摄像头
-
编辑
@@ -86,7 +89,7 @@ const FormDialog = defineAsyncComponent(() => import('./form.vue'));
const CameraTableDialog = defineAsyncComponent(() => import('./camera-table-dialog.vue'));
// 定义查询字典
-const { device_group_type } = useDict("device_group_type")
+const { device_group_type, panel_type } = useDict("device_group_type", "panel_type")
// 定义变量内容
const formDialogRef = ref()
const cameraTableDialogRef = ref()