From 4a17e701c961a6cee27c8489eff72fbe4997692b Mon Sep 17 00:00:00 2001 From: ihzero Date: Fri, 4 Aug 2023 11:32:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- src/api/sys/other.ts | 14 ++++++ src/views/device/management/DeviceDrawer.vue | 2 + .../device/management/management.data.ts | 45 ++++++++++++++++++- src/views/visualization/components/SZJCSJ.vue | 4 +- src/views/visualization/components/TRJCSJ.vue | 4 +- 6 files changed, 66 insertions(+), 7 deletions(-) diff --git a/.env.development b/.env.development index c4218e07..790b66bd 100644 --- a/.env.development +++ b/.env.development @@ -6,13 +6,13 @@ VITE_PUBLIC_PATH = / # Cross-domain proxy, you can configure multiple # Please note that no line breaks -VITE_PROXY = [["/api","http://36.133.205.221:81"],["/upload","http://36.133.205.221:81/api/web/upload"]] +VITE_PROXY = [["/basic-api","http://lcny.sk797.cn"],["/upload","http://lcny.sk797.cn/api/web/upload"]] # Delete console VITE_DROP_CONSOLE = false # Basic interface address SPA -VITE_GLOB_API_URL=/api +VITE_GLOB_API_URL=/basic-api # File upload address, optional VITE_GLOB_UPLOAD_URL=/upload diff --git a/src/api/sys/other.ts b/src/api/sys/other.ts index 9456844f..d1b1dcc9 100644 --- a/src/api/sys/other.ts +++ b/src/api/sys/other.ts @@ -29,6 +29,20 @@ export function getDeviceTypes(mode: ErrorMessageMode = 'none') { }, ) } +/** + * @description:设备类型 + */ +export function getKeywords(params, mode: ErrorMessageMode = 'none') { + return defHttp.get( + { + url: '/api/keywords', + params, + }, + { + errorMessageMode: mode, + }, + ) +} /** * @description:添加设备 */ diff --git a/src/views/device/management/DeviceDrawer.vue b/src/views/device/management/DeviceDrawer.vue index b12e744d..9e927f89 100644 --- a/src/views/device/management/DeviceDrawer.vue +++ b/src/views/device/management/DeviceDrawer.vue @@ -37,6 +37,8 @@ ...obj, agricultural_base_id: obj.base_id, type: formatDataByObject(deviceTypes).find((e) => e.label == obj.type)?.value, + supplier_key: obj?.supplier?.id, + project_key: obj?.project?.id, }) } }) diff --git a/src/views/device/management/management.data.ts b/src/views/device/management/management.data.ts index 0a094da9..ba885302 100644 --- a/src/views/device/management/management.data.ts +++ b/src/views/device/management/management.data.ts @@ -1,7 +1,7 @@ import { BasicColumn } from '/@/components/Table' import { FormSchema } from '/@/components/Table' import { getAgriculturalBasic } from '/@/api/sys/user' -import { getDeviceTypes } from '/@/api/sys/other' +import { getDeviceTypes, getKeywords } from '/@/api/sys/other' import { h } from 'vue' import { Tag } from 'ant-design-vue' function formatDataByObject(obj): any[] { @@ -27,6 +27,20 @@ export const columns: BasicColumn[] = [ title: '设备编号', dataIndex: 'sn', }, + { + title: '设备厂商', + dataIndex: 'supplier', + customRender: ({ text }) => { + return text?.name ?? '' + }, + }, + { + title: '项目', + dataIndex: 'project', + customRender: ({ text }) => { + return text?.name ?? '' + }, + }, { title: '基地', dataIndex: 'base_name', @@ -181,12 +195,41 @@ export const accountFormSchema: FormSchema[] = [ required: true, component: 'Input', }, + { + field: 'supplier_key', + label: '设备厂商', + required: true, + component: 'ApiSelect', + componentProps: { + api: async () => { + const res = await getKeywords({ key: 'device-supplier' }) + return res + }, + labelField: 'name', + valueField: 'key', + }, + }, + { + field: 'project_key', + label: '项目', + required: true, + component: 'ApiSelect', + componentProps: { + api: async () => { + const res = await getKeywords({ key: 'device-project' }) + return res + }, + labelField: 'name', + valueField: 'key', + }, + }, { field: 'monitoring_point', label: '监控点', required: true, component: 'Input', }, + { field: 'extends.ip', label: '设备IP', diff --git a/src/views/visualization/components/SZJCSJ.vue b/src/views/visualization/components/SZJCSJ.vue index 7c1a7495..20961afc 100644 --- a/src/views/visualization/components/SZJCSJ.vue +++ b/src/views/visualization/components/SZJCSJ.vue @@ -1,11 +1,11 @@