From 473c4693da47d95681d738e09bab077cf16a2ef5 Mon Sep 17 00:00:00 2001 From: wally <18603454788@163.com> Date: Fri, 29 Oct 2021 14:59:12 +0800 Subject: [PATCH 1/2] feat: devices management;network config add device select --- src/App.vue | 29 ++++++------- src/components/device-select-and-status.vue | 42 ++++++++++++++++++ src/components/refresh.vue | 19 +++++++++ src/components/search-bar.vue | 5 +-- src/store/user.js | 4 +- src/views/device-list.vue | 47 ++++++++++++++++----- src/views/network-config.vue | 39 +++++++++++++---- 7 files changed, 145 insertions(+), 40 deletions(-) create mode 100644 src/components/device-select-and-status.vue create mode 100644 src/components/refresh.vue diff --git a/src/App.vue b/src/App.vue index c0ea327..332f8d1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,7 @@ + + + + 选择站点: + + + + + 获取状态: + {{ get }} + + 设置状态: + {{ set }} + + diff --git a/src/components/refresh.vue b/src/components/refresh.vue new file mode 100644 index 0000000..be91fc9 --- /dev/null +++ b/src/components/refresh.vue @@ -0,0 +1,19 @@ + + + + + + + + + diff --git a/src/components/search-bar.vue b/src/components/search-bar.vue index 816731f..eb5c246 100644 --- a/src/components/search-bar.vue +++ b/src/components/search-bar.vue @@ -2,7 +2,7 @@ - + @@ -26,8 +26,7 @@ const store = useStore(); const devices = computed(() => store.state.device.devices); const onSubmit = () => { - searchDeviceForm.value.validate(valid => { - console.log(valid, { ...searchDevice }); + searchDeviceForm.value.validate(() => { const { device } = searchDevice; emit('search', { deviceId: device }); }); diff --git a/src/store/user.js b/src/store/user.js index 47689fe..72e8d3e 100644 --- a/src/store/user.js +++ b/src/store/user.js @@ -12,7 +12,7 @@ export default { }, userId({ user }) { if (!user) return null; - return user.userId; + return user.id; }, }, @@ -26,7 +26,7 @@ export default { state.user = user; if (user) { localStorage.setItem('token', user.token); - localStorage.setItem('user', user); + localStorage.setItem('user', JSON.stringify(user)); } else { localStorage.removeItem('token'); localStorage.removeItem('user'); diff --git a/src/views/device-list.vue b/src/views/device-list.vue index 35341ce..4d6c85b 100644 --- a/src/views/device-list.vue +++ b/src/views/device-list.vue @@ -17,23 +17,41 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - 删除 + + - 编辑 + + + @@ -59,11 +77,13 @@ diff --git a/src/views/network-config.vue b/src/views/network-config.vue index ac225a1..651f41e 100644 --- a/src/views/network-config.vue +++ b/src/views/network-config.vue @@ -1,4 +1,7 @@ + + + @@ -79,12 +82,18 @@ + + + From 3f6e1bc8ee0e8c8b0d1e9c72cac358d7e12d2241 Mon Sep 17 00:00:00 2001 From: wally <18603454788@163.com> Date: Fri, 29 Oct 2021 15:36:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E5=8E=BB=E6=8E=89=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=8A=B6=E6=80=81=EF=BC=9B=E9=87=91=E5=B1=9E=E9=80=9A?= =?UTF-8?q?=E9=81=93=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA4=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/index.js | 4 +- src/components/device-select-and-status.vue | 7 +- src/views/function-config.vue | 81 ++++++++++++++++----- 3 files changed, 68 insertions(+), 24 deletions(-) diff --git a/src/apis/index.js b/src/apis/index.js index 98608ba..efc13cd 100644 --- a/src/apis/index.js +++ b/src/apis/index.js @@ -23,10 +23,10 @@ export const getMonthsDate = params => http.get(`${corrosion}/statistics/months` export const getRealtimeData = params => http.get(`${corrosion}/statistics/realtime`, { params }); // 获取网络配置参数 -export const getConfigNetwork = () => http.get(`${corrosion}/config/network`); +export const getConfigNetwork = params => http.get(`${corrosion}/config/network`, { params }); // 获取功能配置参数 -export const getConfigFunction = () => http.get(`${corrosion}/config/function`); +export const getConfigFunction = params => http.get(`${corrosion}/config/function`, { params }); // 提交网络配置参数 export const createConfigNetwork = data => http.post(`${corrosion}/config/network`, data); diff --git a/src/components/device-select-and-status.vue b/src/components/device-select-and-status.vue index c643b82..82d32d5 100644 --- a/src/components/device-select-and-status.vue +++ b/src/components/device-select-and-status.vue @@ -10,14 +10,13 @@ const store = useStore(); const devices = computed(() => store.state.device.devices); // 设备/站点列表 const deviceId = ref(''); // 选中的设备id const currentDeviceId = computed(() => store.state.device.currentDeviceId); // 正在操作的设备的id -const get = computed(() => (props.status.get ? '设置生效' : '等待下发')); +// const get = computed(() => (props.status.get ? '设置生效' : '等待下发')); const set = computed(() => (props.status.set ? '设置生效' : '等待下发')); // 监听currentDeviceId watch( () => currentDeviceId.value, newValue => { - console.log('newValue: ', newValue); if (newValue && deviceId.value !== newValue) { deviceId.value = newValue; } @@ -33,8 +32,8 @@ watch( - 获取状态: - {{ get }} + 设置状态: {{ set }} diff --git a/src/views/function-config.vue b/src/views/function-config.vue index 4f8bf1f..cbba5e9 100644 --- a/src/views/function-config.vue +++ b/src/views/function-config.vue @@ -1,4 +1,7 @@ + + + @@ -81,22 +84,45 @@ - - - 不加密 - 加密 + + + + + + + + + + + + + + + + + + - - - + + + + + + + 不加密 + 加密 + + + + @@ -131,13 +157,19 @@ + + +