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-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="设备编码" prop="centerDeviceCode"> <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-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="设备uuid" prop="uuid"> <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-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -461,7 +461,7 @@ const title = ref("");
const collapseVisible = ref(false); const collapseVisible = ref(false);
const editName = ref("更多筛选项"); const editName = ref("更多筛选项");
const deptOptions = ref([]); const deptOptions = ref([]);
const disabledDeviceCode = ref(false); const disabledDeviceCode = ref(true);
const fixedColumns = ref(false); const fixedColumns = ref(false);
const fixedOrderColumn = ref(false); const fixedOrderColumn = ref(false);
const tableHeight = ref("0px"); const tableHeight = ref("0px");
@ -547,9 +547,6 @@ const data = reactive({
orgName: [ orgName: [
{ required: true, message: "所属组织名称", trigger: "change" } { required: true, message: "所属组织名称", trigger: "change" }
], ],
orgCode: [
{ required: true, message: "所属组织编码", trigger: "change" }
],
thingsboardServer: [ thingsboardServer: [
{ required: thingsboardShow, message: "thingsboard服务", trigger: "change" } { required: thingsboardShow, message: "thingsboard服务", trigger: "change" }
], ],
@ -563,7 +560,7 @@ const { queryParams, form, rules, params } = toRefs(data);
/** 查询设备信息列表 */ /** 查询设备信息列表 */
function getList() { function getList() {
loading.value = true; // loading.value = true;
let param = { let param = {
"obj": queryParams.value, "obj": queryParams.value,
"params": queryParamFilter.value, "params": queryParamFilter.value,
@ -652,16 +649,16 @@ function handleSelectionChange(selection) {
function handleAdd() { function handleAdd() {
reset(); reset();
loading.value = true; loading.value = true;
getUuid().then(response => { // getUuid().then(response => {
form.value.centerDeviceCode = response.msg; // form.value.centerDeviceCode = response.msg;
form.value.uuid = response.msg; // form.value.uuid = response.msg;
form.value.enabledFlag = true; // form.value.enabledFlag = true;
}); // });
selectDcBaseDeviceinfoMaxSort().then(response => { selectDcBaseDeviceinfoMaxSort().then(response => {
form.value.sort = response.data?.sort + 1; form.value.sort = response.data?.sort + 1;
loading.value = false; loading.value = false;
}) })
disabledDeviceCode.value = false; disabledDeviceCode.value = true;
open.value = true; open.value = true;
title.value = "添加设备信息"; title.value = "添加设备信息";
} }
@ -710,56 +707,67 @@ function submitForm() {
dialogLoading.close(); dialogLoading.close();
}); });
} else { } else {
let param = { addDevice(form.value).then(response => {
"obj": { "centerDeviceCode": form.value.centerDeviceCode }, if (response.code == 200) {
"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("新增成功"); proxy.$modal.msgSuccess("新增成功");
open.value = false; open.value = false;
reset();
getList(); getList();
} else { } else {
proxy.$modal.msgError(response.data?.msg); proxy.$modal.msgError(response.msg);
} }
dialogLoading.close(); 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) { if (item.value == val) {
form.value.deviceSource = item.label; form.value.deviceSource = item.label;
} }
if (val == '002') { // if (val == '002') {
ioserverShow.value = true; // ioserverShow.value = true;
thingsboardShow.value = false; // thingsboardShow.value = false;
} else if (val == '001') { // } else if (val == '001') {
getThServerList(); // getThServerList();
ioserverShow.value = false; // ioserverShow.value = false;
thingsboardShow.value = true; // thingsboardShow.value = true;
} // }
}) })
} }

Loading…
Cancel
Save