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 ecd4b5f..e05ee03 100644 --- a/src/views/Page.vue +++ b/src/views/Page.vue @@ -93,7 +93,10 @@ 删除 - 设备 + 新增设备 + + + 设备查询 @@ -112,17 +115,20 @@ :formData="formData" :dialogVisible="dialogVisible1" v-if="dialogVisible1" - @dialogClose="dialogClose1" - @dialogSuccess="dialogSuccess1" + @dialogClose="dialogClose" + @dialogSuccess="dialogSuccess" > + + @@ -133,12 +139,14 @@ import { ElMessage, ElMessageBox } from "element-plus"; import AddData from "@/components/AddData.vue"; import AddSet from "@/components/AddSet.vue"; import PzSet from "@/components/PzSet.vue"; +import ViewSet from "@/components/ViewSet.vue"; export default { name: "page", components: { AddData, AddSet, - PzSet + PzSet, + ViewSet }, setup() { const state = reactive({ @@ -147,8 +155,9 @@ export default { formData: {}, dialogVisible: false, dialogVisible1: false, - dialogVisible2: false,// 配置弹框 - type: '0', // 0新增 1 编辑 + dialogVisible2: false, + dialogVisible3: false, + type: '0' // 0新增 1 编辑 }); onMounted(() => { @@ -176,6 +185,8 @@ export default { }; const dialogClose = () => { state.dialogVisible = false; + state.dialogVisible1 = false; + state.dialogVisible2 = false; }; const dialogSuccess = () => { @@ -186,18 +197,22 @@ export default { const dialogClose1 = () => { state.dialogVisible1 = false; }; - const dialogClose2 = () => { - state.dialogVisible2 = false; + + const dialogClose3 = () => { + state.dialogVisible3 = false; }; - + const dialogSuccess3 = () => { + state.dialogVisible3 = false; + getTableData(); + }; + const dialogSuccess1 = () => { state.dialogVisible1 = false; - getTableData(); - }; - const dialogSuccess2 = () => { state.dialogVisible2 = false; getTableData(); }; + + const addData = () => { state.formData = { name: '', @@ -243,6 +258,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 = { @@ -258,7 +278,7 @@ export default { }; const openPz = (item) => { - state.dialogVisible2 = true; + state.dialogVisible3 = true; } return { @@ -272,9 +292,10 @@ export default { changeStatus, dialogClose1, dialogSuccess1, - dialogClose2, - dialogSuccess2, - openPz + dialogClose3, + dialogSuccess3, + openPz, + viewData }; }, };