From fadfda7644d8947a170ce82a13dbaef90dcc3157 Mon Sep 17 00:00:00 2001 From: wangqiujuan0808 <578331299@qq.com> Date: Wed, 8 May 2024 23:16:35 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/infoApi.js | 42 ++-- src/components/AddSet copy.vue | 262 +++++++++++++++++++++++ src/components/AddSet.vue | 370 ++++++++++++--------------------- src/components/ViewSet.vue | 120 +++++++++++ src/utils/axios.js | 5 +- src/views/Page.vue | 35 ++-- 6 files changed, 560 insertions(+), 274 deletions(-) create mode 100644 src/components/AddSet copy.vue create mode 100644 src/components/ViewSet.vue diff --git a/src/api/infoApi.js b/src/api/infoApi.js index 8e49d36..3826d00 100644 --- a/src/api/infoApi.js +++ b/src/api/infoApi.js @@ -80,14 +80,6 @@ const infoApi = { detP(params) { return postPBRequest('/template', params, 53310, params.template_name) }, - // // 获取设备列表 - // getSet(params) { - // return postJsonRequest('/tx/info', params) - // }, - // // 新增设备 - // addSet(params) { - // return putRequest('/tx/device', params) - // }, // 驱动列表查询 getTx(params) { return postPBRequest('/driver', params, 54000) @@ -109,19 +101,33 @@ const infoApi = { getTxSupport() { return postPBRequest('/driver', null, 54001) }, + // 查询查询驱动下设备的可用模板列表 // 查询驱动配置项 - getTxConfig(params) { - return postPBRequest("/driver", params, 53002); + getTxTemplate(params) { + return postPBRequest("/driver", params, 54011, params.driver_name); + }, + // 新增设备 + addSet(params) { + return postPBRequest('/driver', params, 54110, params.driver_name) }, - // 通讯服务启用,停用 - startStatus(params) { - return postPBRequest("/driver", params,53201); - }, - // 通讯服务停止 - stopStatus(params) { - return postPBRequest("/driver", params,53202); - } + // 获取设备列表 + getSet(params) { + return postPBRequest('/driver', params, 54010, params.driver_name) + }, + // 删除设备 + delSet(params) { + return postPBRequest('/driver', params, 54310, params.driver_name) + }, + + // 通讯服务启用,停用 + startStatus(params) { + return postPBRequest("/driver", params, 53201); + }, + // 通讯服务停止 + stopStatus(params) { + return postPBRequest("/driver", params, 53202); + } // // 获取上报列表 // getSc(params) { diff --git a/src/components/AddSet copy.vue b/src/components/AddSet copy.vue new file mode 100644 index 0000000..4f4f5af --- /dev/null +++ b/src/components/AddSet copy.vue @@ -0,0 +1,262 @@ + + + diff --git a/src/components/AddSet.vue b/src/components/AddSet.vue index 4f4f5af..4814fdb 100644 --- a/src/components/AddSet.vue +++ b/src/components/AddSet.vue @@ -1,262 +1,150 @@ diff --git a/src/components/ViewSet.vue b/src/components/ViewSet.vue new file mode 100644 index 0000000..c5616dd --- /dev/null +++ b/src/components/ViewSet.vue @@ -0,0 +1,120 @@ + + + + \ No newline at end of file diff --git a/src/utils/axios.js b/src/utils/axios.js index 5b5e86a..c671ae9 100644 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -56,14 +56,15 @@ axios.interceptors.response.use( } ); // post请求 -export function postPBRequest(url, params, actionNum,template_name) { +export function postPBRequest(url, params, actionNum,name) { + const title = url === '/driver' ? {'driver_name': name }: {'template_name': name} return axios({ method: "post", url: url, data: params, headers: { "action": actionNum, - "template_name": template_name + ...title }, }); } \ No newline at end of file diff --git a/src/views/Page.vue b/src/views/Page.vue index c9a8145..0875680 100644 --- a/src/views/Page.vue +++ b/src/views/Page.vue @@ -90,7 +90,10 @@ 删除 - 设备 + 新增设备 + + + 设备查询 @@ -109,10 +112,13 @@ :formData="formData" :dialogVisible="dialogVisible1" v-if="dialogVisible1" - @dialogClose="dialogClose1" - @dialogSuccess="dialogSuccess1" + @dialogClose="dialogClose" + @dialogSuccess="dialogSuccess" > + + @@ -122,11 +128,13 @@ import infoApi from "@/api/infoApi.js"; import { ElMessage, ElMessageBox } from "element-plus"; import AddData from "@/components/AddData.vue"; import AddSet from "@/components/AddSet.vue"; +import ViewSet from "@/components/ViewSet.vue"; export default { name: "page", components: { AddData, AddSet, + ViewSet }, setup() { const state = reactive({ @@ -135,6 +143,7 @@ export default { formData: {}, dialogVisible: false, dialogVisible1: false, + dialogVisible2: false, type: '0' // 0新增 1 编辑 }); @@ -163,21 +172,17 @@ export default { }; const dialogClose = () => { state.dialogVisible = false; + state.dialogVisible1 = false; + state.dialogVisible2 = false; }; const dialogSuccess = () => { state.dialogVisible = false; + state.dialogVisible1 = false; + state.dialogVisible2 = false; getTableData(); }; - const dialogClose1 = () => { - state.dialogVisible1 = false; - }; - - const dialogSuccess1 = () => { - state.dialogVisible1 = false; - getTableData(); - }; const addData = () => { state.formData = { name: '', @@ -223,6 +228,11 @@ export default { state.dialogVisible1 = true; }; + const viewData = (item) => { + state.dialogVisible2 = true; + state.formData = JSON.parse(JSON.stringify(item)); + } + const changeStatus = async (item) => { console.log(item.enable); const param = { @@ -246,8 +256,7 @@ export default { dialogClose, dialogSuccess, changeStatus, - dialogClose1, - dialogSuccess1 + viewData }; }, };