fix(设备详情):修复认证弹窗没有数据问题

This commit is contained in:
yang
2026-10-27 15:07:29 +08:00
parent e4ed6edbd6
commit 07edfcc5ce
2 changed files with 26 additions and 15 deletions

View File

@@ -155,9 +155,9 @@ export function getMqttConnect(params) {
} }
//获取国标配置信息 //获取国标配置信息
export function getSipConfig(deviceSipId) { export function getSipConfig(deviceId) {
return request({ return request({
url: '/sip/sipconfig/auth/' + deviceSipId, url: '/sip/sipconfig/auth/' + deviceId,
method: 'get', method: 'get',
}); });
} }

View File

@@ -285,8 +285,8 @@
<el-input clearable v-model="httpForm.port" readonly style="width: 400px"></el-input> <el-input clearable v-model="httpForm.port" readonly style="width: 400px"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-form ref="GBform" :model="GBform" :rules="rules" label-width="120px" <el-form ref="GBform" :model="GBform" :rules="rules" label-width="120px"
v-if="this.form.transport == 'GB28181'"> v-if="isSipTransport || showSipConfig">
<!-- 服务器域 --> <!-- 服务器域 -->
<el-form-item :label="$t('device.device-edit.148398-87')"> <el-form-item :label="$t('device.device-edit.148398-87')">
<el-input clearable v-model="GBform.domainAlias" readonly style="width: 400px"></el-input> <el-input clearable v-model="GBform.domainAlias" readonly style="width: 400px"></el-input>
@@ -361,6 +361,9 @@ export default {
}, },
}, },
computed: { computed: {
isSipTransport() {
return String(this.form.transport || '').toUpperCase() === 'GB28181' || Number(this.form.deviceType) === 3;
},
deviceStatus: { deviceStatus: {
set(val) { set(val) {
if (val == 1) { if (val == 1) {
@@ -389,6 +392,7 @@ export default {
//二维码 //二维码
openCode: false, openCode: false,
openViewMqtt: false, openViewMqtt: false,
showSipConfig: false,
// 生成设备编码是否禁用 // 生成设备编码是否禁用
genDisabled: false, genDisabled: false,
// 选中选项卡 // 选中选项卡
@@ -1038,7 +1042,7 @@ export default {
this.httpForm.port + this.httpForm.port +
'"}'; '"}';
} }
if (this.form.transport == 'GB28181') { if (this.isSipTransport || this.showSipConfig) {
input.value = input.value =
'{domainAlias:' + '{domainAlias:' +
this.GBform.domainAlias + this.GBform.domainAlias +
@@ -1101,6 +1105,7 @@ export default {
handleViewMqtt() { handleViewMqtt() {
this.openViewMqtt = true; this.openViewMqtt = true;
this.loading = true; this.loading = true;
this.showSipConfig = false;
if (this.form.transport === 'MQTT' || this.form.transport === 'TCP' || this.form.transport === 'COAP') { if (this.form.transport === 'MQTT' || this.form.transport === 'TCP' || this.form.transport === 'COAP') {
const params = { const params = {
deviceId: this.form.deviceId, deviceId: this.form.deviceId,
@@ -1108,16 +1113,9 @@ export default {
getMqttConnect(params).then((response) => { getMqttConnect(params).then((response) => {
if (response.code == 200) { if (response.code == 200) {
this.listQuery = response.data; this.listQuery = response.data;
this.loading = false;
}
});
} else if (this.form.transport === 'GB28181') {
const deviceSipId = this.form.deviceId;
getSipConfig(deviceSipId).then((response) => {
if (response.code == 200) {
this.GBform = response.data;
this.loading = false;
} }
}).finally(() => {
this.loading = false;
}); });
} else if (this.form.transport === 'HTTP') { } else if (this.form.transport === 'HTTP') {
const params = { const params = {
@@ -1126,8 +1124,21 @@ export default {
getHttpConfig(params).then((response) => { getHttpConfig(params).then((response) => {
if (response.code == 200) { if (response.code == 200) {
this.httpForm = response.data; this.httpForm = response.data;
this.loading = false;
} }
}).finally(() => {
this.loading = false;
});
} else {
// Unknown or missing transport values fall back to SIP auth for this connection-info dialog.
this.showSipConfig = true;
getSipConfig(this.form.deviceId).then((response) => {
if (response.code == 200) {
this.GBform = response.data || {};
}
}).catch(() => {
this.$modal.msgError(this.$t('device.device-edit.148398-35'));
}).finally(() => {
this.loading = false;
}); });
} }
}, },