From cd186a9fa1a525b9e38bf8ead1f37b829d54f88e Mon Sep 17 00:00:00 2001 From: eric777 Date: Thu, 14 Mar 2024 10:25:16 +0800 Subject: [PATCH] =?UTF-8?q?jiahan.wu=20fix:=20=E8=AE=BE=E5=A4=87=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/model/device/index.vue | 144 ++++++++++++++++--------------- 1 file changed, 76 insertions(+), 68 deletions(-) diff --git a/src/views/model/device/index.vue b/src/views/model/device/index.vue index ae707b2..bc62803 100644 --- a/src/views/model/device/index.vue +++ b/src/views/model/device/index.vue @@ -232,12 +232,12 @@ - + - + @@ -461,7 +461,7 @@ const title = ref(""); const collapseVisible = ref(false); const editName = ref("更多筛选项"); const deptOptions = ref([]); -const disabledDeviceCode = ref(false); +const disabledDeviceCode = ref(true); const fixedColumns = ref(false); const fixedOrderColumn = ref(false); const tableHeight = ref("0px"); @@ -547,9 +547,6 @@ const data = reactive({ orgName: [ { required: true, message: "所属组织名称", trigger: "change" } ], - orgCode: [ - { required: true, message: "所属组织编码", trigger: "change" } - ], thingsboardServer: [ { required: thingsboardShow, message: "thingsboard服务", trigger: "change" } ], @@ -563,7 +560,7 @@ const { queryParams, form, rules, params } = toRefs(data); /** 查询设备信息列表 */ function getList() { - loading.value = true; + // loading.value = true; let param = { "obj": queryParams.value, "params": queryParamFilter.value, @@ -652,16 +649,16 @@ function handleSelectionChange(selection) { function handleAdd() { reset(); loading.value = true; - getUuid().then(response => { - form.value.centerDeviceCode = response.msg; - form.value.uuid = response.msg; - form.value.enabledFlag = true; - }); + // getUuid().then(response => { + // form.value.centerDeviceCode = response.msg; + // form.value.uuid = response.msg; + // form.value.enabledFlag = true; + // }); selectDcBaseDeviceinfoMaxSort().then(response => { form.value.sort = response.data?.sort + 1; loading.value = false; }) - disabledDeviceCode.value = false; + disabledDeviceCode.value = true; open.value = true; title.value = "添加设备信息"; } @@ -710,56 +707,67 @@ function submitForm() { dialogLoading.close(); }); } else { - let param = { - "obj": { "centerDeviceCode": form.value.centerDeviceCode }, - "params": new Object(), - "sort": [], - "pageNum": 1, - "pageSize": 10, - } - listWithFilterColumn(param).then(response => { - let total = response.data.tableData.total; - if (total > 0) { - ElMessageBox.alert('设备中台编号不能重复', '提示', { - confirmButtonText: '确定', - center: true, - }) - dialogLoading.close(); - return; + addDevice(form.value).then(response => { + if (response.code == 200) { + proxy.$modal.msgSuccess("新增成功"); + open.value = false; + reset(); + getList(); } else { - let param = { - "obj": { "uuid": form.value.uuid }, - "params": new Object(), - "sort": [], - "pageNum": 1, - "pageSize": 10, - } - listWithFilterColumn(param).then(response => { - let total = response.data.tableData.total; - if (total > 0) { - ElMessageBox.alert('设备uuid不能重复', '提示', { - confirmButtonText: '确定', - center: true, - }) - dialogLoading.close(); - return; - } else { - addAndSyncParamMap(form.value).then(response => { - console.log("deviceresponse"); - console.log(response); - if (response.data?.status == true) { - proxy.$modal.msgSuccess("新增成功"); - open.value = false; - getList(); - } else { - proxy.$modal.msgError(response.data?.msg); - } - dialogLoading.close(); - }); - } - }); + proxy.$modal.msgError(response.msg); } + dialogLoading.close(); }); + // let param = { + // "obj": { "centerDeviceCode": form.value.centerDeviceCode }, + // "params": new Object(), + // "sort": [], + // "pageNum": 1, + // "pageSize": 10, + // } + // listWithFilterColumn(param).then(response => { + // let total = response.data.tableData.total; + // if (total > 0) { + // ElMessageBox.alert('设备中台编号不能重复', '提示', { + // confirmButtonText: '确定', + // center: true, + // }) + // dialogLoading.close(); + // return; + // } else { + // let param = { + // "obj": { "uuid": form.value.uuid }, + // "params": new Object(), + // "sort": [], + // "pageNum": 1, + // "pageSize": 10, + // } + // listWithFilterColumn(param).then(response => { + // let total = response.data.tableData.total; + // if (total > 0) { + // ElMessageBox.alert('设备uuid不能重复', '提示', { + // confirmButtonText: '确定', + // center: true, + // }) + // dialogLoading.close(); + // return; + // } else { + // addAndSyncParamMap(form.value).then(response => { + // console.log("deviceresponse"); + // console.log(response); + // if (response.data?.status == true) { + // proxy.$modal.msgSuccess("新增成功"); + // open.value = false; + // getList(); + // } else { + // proxy.$modal.msgError(response.data?.msg); + // } + // dialogLoading.close(); + // }); + // } + // }); + // } + // }); } } }); @@ -831,14 +839,14 @@ function deviceSourceChange(val) { if (item.value == val) { form.value.deviceSource = item.label; } - if (val == '002') { - ioserverShow.value = true; - thingsboardShow.value = false; - } else if (val == '001') { - getThServerList(); - ioserverShow.value = false; - thingsboardShow.value = true; - } + // if (val == '002') { + // ioserverShow.value = true; + // thingsboardShow.value = false; + // } else if (val == '001') { + // getThServerList(); + // ioserverShow.value = false; + // thingsboardShow.value = true; + // } }) }