Browse Source

jiahan.wu fix: 设备编码生成逻辑调整

develop
eric777 8 months ago
parent
commit
cd186a9fa1
  1. 136
      src/views/model/device/index.vue

136
src/views/model/device/index.vue

@ -232,12 +232,12 @@
<el-row>
<el-col :span="12">
<el-form-item label="设备编码" prop="centerDeviceCode">
<el-input :disabled="disabledDeviceCode" v-model="form.centerDeviceCode" placeholder="请输入设备编码" />
<el-input :disabled="disabledDeviceCode" v-model="form.centerDeviceCode" placeholder="" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备uuid" prop="uuid">
<el-input v-model="form.uuid" placeholder="请输入设备uuid" />
<el-input disabled=true v-model="form.uuid" placeholder="" />
</el-form-item>
</el-col>
<el-col :span="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;
} 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) {
addDevice(form.value).then(response => {
if (response.code == 200) {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
reset();
getList();
} else {
proxy.$modal.msgError(response.data?.msg);
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;
// }
})
}

Loading…
Cancel
Save