From 47e6f6ac9428dda27201a22a80768ce71d8c6a00 Mon Sep 17 00:00:00 2001 From: wangqiujuan0808 <578331299@qq.com> Date: Tue, 22 Oct 2024 11:56:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AddData.vue | 8 +- src/components/AddMb.vue | 2 +- src/components/AddPoint.vue | 66 +++++--- src/components/AddSet.vue | 4 +- src/components/Header.vue | 61 +++---- src/components/ViewPoint.vue | 2 +- src/views/Data.vue | 297 ++++++++++++++++++----------------- src/views/Model.vue | 2 +- src/views/Page.vue | 4 +- 9 files changed, 244 insertions(+), 202 deletions(-) diff --git a/src/components/AddData.vue b/src/components/AddData.vue index b4edd30..9125dfa 100644 --- a/src/components/AddData.vue +++ b/src/components/AddData.vue @@ -34,12 +34,12 @@ - + @@ -48,7 +48,7 @@ @@ -94,7 +94,7 @@ export default { { required: true, message: "请选择通讯模板", trigger: "blur" }, ], driver_description: [{ required: false, message: "请输入驱动描述", trigger: "blur" }], - driver_type: [{ required: true, message: "请选择通讯驱动", trigger: "change" }] + driver_type: [{ required: true, message: "请选择驱动类型", trigger: "change" }] }, }); const visible = computed(() => { diff --git a/src/components/AddMb.vue b/src/components/AddMb.vue index 4dca75d..b0fa05d 100644 --- a/src/components/AddMb.vue +++ b/src/components/AddMb.vue @@ -1,6 +1,6 @@ - + diff --git a/src/components/AddPoint.vue b/src/components/AddPoint.vue index 2c399ea..09937f6 100644 --- a/src/components/AddPoint.vue +++ b/src/components/AddPoint.vue @@ -1,6 +1,6 @@ - + @@ -14,8 +14,8 @@ - + @@ -23,7 +23,8 @@ - + @@ -51,7 +52,10 @@ export default { setup(props, ctx) { const checkAddress = (rule, value, callback) => { let num = Number(value); - if (value && (num >= 0 && num <= 65535)) { + if (num === 0) { + callback(); + } + else if (value && (num > 0 && num <= 65535)) { callback(); } else { callback(new Error("点位地址:0-65535")); @@ -170,7 +174,7 @@ export default { onMounted(() => { state.addForm = props.pointData; getPointData(); - changeRegister(); + props.type === 'U'? changeSelectData() : changeRegister(); }); const getPointData = () => { @@ -186,47 +190,65 @@ export default { } const changeRegister = () => { - if(state.addForm.register === 1) { + changeSelectData(); + changeValue(); + } + + const changeSelectData = () => { + if (state.addForm.register === 1) { state.datatypeArr.forEach(ele => { // 只能选择bool - ele.disabled1 = ele.value!== 1 + ele.disabled1 = ele.value !== 1 }) state.perOptions.forEach(ele => {// 可读可写 ele.disabled = false; }) - state.addForm.point_type = 1; - state.addForm.point_permissions = 1; } - if(state.addForm.register === 2) { + if (state.addForm.register === 2) { state.datatypeArr.forEach(ele => {// 只能选择bool - ele.disabled1 = ele.value!== 1 + ele.disabled1 = ele.value !== 1 }) state.perOptions.forEach(ele => {// 只能可读 ele.disabled = ele.value === 2; }) - state.addForm.point_type = 1; - state.addForm.point_permissions = 1; } - if(state.addForm.register === 3) { + if (state.addForm.register === 3) { state.datatypeArr.forEach(ele => {// 不支持bool ele.disabled1 = ele.value === 1 }) state.perOptions.forEach(ele => {// 只能可读 ele.disabled = ele.value === 2; }) + } + if (state.addForm.register === 4) { + state.datatypeArr.forEach(ele => {// 不支持bool + ele.disabled1 = ele.value === 1 + }) + state.perOptions.forEach(ele => {// 可读可写 + ele.disabled = false; + }) + } + } + + const changeValue = () => { + if (state.addForm.register === 1) { + state.addForm.point_type = 1; + state.addForm.point_permissions = 1; + } + if (state.addForm.register === 2) { + state.addForm.point_type = 1; + state.addForm.point_permissions = 1; + } + if (state.addForm.register === 3) { state.addForm.point_type = 3; state.addForm.point_permissions = 1; } - if(state.addForm.register === 4) { - state.datatypeArr.forEach(ele => {// 不支持bool - ele.disabled1 = ele.value === 1 - }) - state.perOptions.forEach(ele => {// 可读可写 - ele.disabled = false; - }) + if (state.addForm.register === 4) { state.addForm.point_type = 3; state.addForm.point_permissions = 1; } } + + const closeDialog = () => { ctx.emit("dialogClose"); }; diff --git a/src/components/AddSet.vue b/src/components/AddSet.vue index fc6dfdb..30f4c8f 100644 --- a/src/components/AddSet.vue +++ b/src/components/AddSet.vue @@ -1,6 +1,6 @@ - + @@ -55,7 +55,7 @@ export default { { min: 3, max: 20, message: "长度在3到20个字符", trigger: "blur" }, { required: true, validator: validName, trigger: "blur" },], device_description: [ - { required: true, message: "请输入设备描述", trigger: "blur" } + { required: false, message: "请输入设备描述", trigger: "blur" } ], slave_id: [ { required: true, message: "请输入设备ID", trigger: "blur" }, diff --git a/src/components/Header.vue b/src/components/Header.vue index fb83b9d..b0089cb 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -6,47 +6,38 @@ {{ name }} - + - + + + {{ (userInfo && userInfo.nickName) || "" }} - + + + 登录名:{{ (userInfo && userInfo.nickName) || "" }} 昵称:{{ (userInfo && userInfo.nickName) || "" }} - 重启设备 - 修改密码 - 退出登录 + + 重启设备 + 修改密码 + 退出登录 + - +
登录名:{{ (userInfo && userInfo.nickName) || "" }}
昵称:{{ (userInfo && userInfo.nickName) || "" }}