diff --git a/.env b/.env index 09344c1..c88b550 100644 --- a/.env +++ b/.env @@ -3,3 +3,5 @@ VITE_PORT = 8848 # 是否隐藏首页 隐藏 true 不隐藏 false (勿删除,VITE_HIDE_HOME只需在.env文件配置) VITE_HIDE_HOME = false +# 开发环境后端地址 +VITE_APP_BASE_URL = 'http://192.168.10.21:8000' diff --git a/.env.development b/.env.development index b5306f2..22c009d 100644 --- a/.env.development +++ b/.env.development @@ -6,3 +6,5 @@ VITE_PUBLIC_PATH = ./ # 开发环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数") VITE_ROUTER_HISTORY = "hash" +# 开发环境后端地址 +VITE_APP_BASE_URL = 'http://192.168.10.21:8000' diff --git a/src/api/device.ts b/src/api/device.ts new file mode 100644 index 0000000..fc476fd --- /dev/null +++ b/src/api/device.ts @@ -0,0 +1,29 @@ +import { http } from "@/utils/http"; +import { baseUrlApi } from "./utils"; + +type Result = { + success: boolean; + data?: Array; +}; + +type ResultList = { + success: boolean; + data?: { + /** 列表数据 */ + results: Array; + }; +}; + +/** 节点模型设备获取 */ +export const getDeviceList = (params?: object) => { + return http.request("get", baseUrlApi("enterprise_node/"), { + params + }); +}; + +/** 获取设备分类 */ +export const getDeviceClassfication = (params?: object) => { + return http.request("get", baseUrlApi("device_classfication/"), { + params + }); +}; diff --git a/src/api/list.ts b/src/api/list.ts index d206dd2..35592db 100644 --- a/src/api/list.ts +++ b/src/api/list.ts @@ -22,7 +22,7 @@ export const getCardList = (data?: object) => { }; export const getServerList = (data?: object) => { - return http.request("post", "/getServerList", { data }); + return http.request("post", "/api/server/", { data }); }; export const getServerBoxList = (data?: object) => { diff --git a/src/api/user.ts b/src/api/user.ts index 9f8125b..192e2ad 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -1,5 +1,5 @@ import { http } from "@/utils/http"; - +import { baseUrlApi } from "./utils"; export type UserResult = { success: boolean; data: { @@ -30,7 +30,7 @@ export type RefreshTokenResult = { /** 登录 */ export const getLogin = (data?: object) => { - return http.request("post", "/login", { data }); + return http.request("post", baseUrlApi("login/"), { data }); }; /** 刷新token */ diff --git a/src/api/utils.ts b/src/api/utils.ts new file mode 100644 index 0000000..2f0d1a1 --- /dev/null +++ b/src/api/utils.ts @@ -0,0 +1,2 @@ +const { VITE_APP_BASE_URL } = import.meta.env; +export const baseUrlApi = (url: string) => `${VITE_APP_BASE_URL}/api/${url}`; diff --git a/src/assets/computePower/computePowerBg.png b/src/assets/computePower/computePowerBg.png new file mode 100644 index 0000000..d81132e Binary files /dev/null and b/src/assets/computePower/computePowerBg.png differ diff --git a/src/assets/history_alarm.png b/src/assets/history_alarm.png new file mode 100644 index 0000000..4479c36 Binary files /dev/null and b/src/assets/history_alarm.png differ diff --git a/src/components/CustomTree/src/collapseTree.tsx b/src/components/CustomTree/src/collapseTree.tsx index 15175b2..7c3409a 100644 --- a/src/components/CustomTree/src/collapseTree.tsx +++ b/src/components/CustomTree/src/collapseTree.tsx @@ -1,41 +1,8 @@ -import { defineComponent, reactive } from "vue"; +import { defineComponent, Transition } from "vue"; import CollapseTreeItem from "./collapseTreeItem"; import "./collapseTreeStyle.scss"; import styles from "./collapseTreeStyle.scss"; -const testDeviceTreeData = [ - { - name: "临沂总部", - id: "11", - level: 0, - expended: true, - childList: [ - { - name: "精密仪器车间", - id: "精密仪器设备", - level: 1 - }, - { - name: "装配间", - id: "装配设备", - level: 1 - } - ] - }, - { - name: "临沂分部", - id: "12", - level: 0, - childList: [ - { - name: "机械加工车间", - id: "机械加工设备", - level: 1 - } - ] - } -]; - export default defineComponent({ name: "CollapseTree", props: { @@ -45,11 +12,10 @@ export default defineComponent({ } }, - setup() { + setup(props) { // const count = ref(1); - const treeData = reactive({ - list: testDeviceTreeData - }); + // const treeData = ref(props.value); + // console.log(treeData.value); return () => { return ( @@ -58,7 +24,7 @@ export default defineComponent({ class="root_cat_box" style={{ padding: "16px", overflowY: "scroll", minHeight: "100%" }} > - {treeData.list.map((vFirst, kFirst) => { + {props.value.map((vFirst, kFirst) => { return (
  • - {Array.isArray(vFirst.childList) && - vFirst.childList.length && ( + {Array.isArray(vFirst.children) && + vFirst.children.length && (
      - {vFirst.childList.map((item, index) => { + {vFirst.children.map((item, index) => { return (
    • diff --git a/src/main.ts b/src/main.ts index ed83190..bbe5873 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,8 +17,8 @@ import { MotionPlugin } from "@vueuse/motion"; import { useEcharts } from "@/plugins/echarts"; import { injectResponsiveStorage } from "@/utils/responsive"; -// import Table from "@pureadmin/table"; -// import PureDescriptions from "@pureadmin/descriptions"; +import Table from "@pureadmin/table"; +import PureDescriptions from "@pureadmin/descriptions"; // 引入重置样式 import "./style/reset.scss"; @@ -58,9 +58,12 @@ getServerConfig(app).then(async config => { await router.isReady(); injectResponsiveStorage(app, config); setupStore(app); - app.use(MotionPlugin).use(useI18n).use(ElementPlus).use(useEcharts); - // .use(useEcharts); - // .use(Table); - // .use(PureDescriptions); + app + .use(MotionPlugin) + .use(useI18n) + .use(ElementPlus) + .use(useEcharts) + .use(Table) + .use(PureDescriptions); app.mount("#app"); }); diff --git a/src/views/alarm/index.vue b/src/views/alarm/index.vue index 95d20cd..e776c53 100644 --- a/src/views/alarm/index.vue +++ b/src/views/alarm/index.vue @@ -139,7 +139,7 @@ const columns = [ }, // TODO 需要封装操作按钮 { - type: "action", + slot: "operation", label: "操作" } ]; @@ -210,6 +210,7 @@ onMounted(() => {