10.9修改代码基坑监测后台

dev_xd
lj7788@126.com 2025-10-09 14:39:47 +08:00
parent a56cb53ff4
commit cd158636f1
4 changed files with 72 additions and 337 deletions

View File

@ -66,6 +66,9 @@
.el-dialog:not(.is-fullscreen) {
margin-top: 6vh !important;
}
.el-dialog.top-30vh{
margin-top: 30vh !important;
}
.el-dialog.scrollbar .el-dialog__body {
overflow: auto;
@ -74,6 +77,10 @@
padding: 10px 20px 0;
}
.el-dialog.hide-scrollbar .el-dialog__body {
overflow: hidden !important;
}
.el-table {
.el-table__header-wrapper, .el-table__fixed-header-wrapper {
th {

View File

@ -1,5 +1,5 @@
<template>
<el-dialog title="设备详情" custom-class="device-detail-dlg" top="30vh !important " v-model="open" width="960px" append-to-body
<el-dialog title="设备详情" class="device-detail-dlg top-30vh hide-scrollbar" v-model="open" width="960px" append-to-body
:close-on-click-modal="false" :close-on-press-escape="false">
<div class="nav-header">
<span class="nav-text">基本信息</span>

View File

@ -12,127 +12,47 @@
<el-button icon="el-icon-refresh" size="small" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="small" @click="handleAdd"
v-hasPermi="['device:pitDevice:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="small" :disabled="single" @click="handleUpdate"
v-hasPermi="['device:pitDevice:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="small" :disabled="multiple" @click="handleDelete"
v-hasPermi="['device:pitDevice:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="small" @click="handleExport"
v-hasPermi="['device:pitDevice:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch="showSearch" @update:showSearch="showSearch = $event" @queryTable="getList"></right-toolbar>
</el-row>
{{ pitDeviceList }}
<el-table v-loading="loading" :data="pitDeviceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="设备编号" align="center" prop="code" />
<el-table v-loading="loading" :data="pitDeviceList">
<el-table-column label="编号" align="center" prop="id" width="100"/>
<el-table-column label="设备编号" align="center" prop="devCode" />
<el-table-column label="设备名称" align="center" prop="name" />
<el-table-column label="设备类型" align="center" prop="type" />
<el-table-column label="安装位置" align="center" prop="location" />
<el-table-column label="状态" align="center" prop="status">
<el-table-column label="设备类型" align="center" prop="devTypeName" />
<el-table-column label="分类" align="center" width="250px">
<template v-slot="scope">
<dict-tag :options="dict.type.pit_device_status" :value="scope.row.status" />
{{ scope.row.typeCategory }} {{ scope.row.typeName }}
</template>
</el-table-column>
<el-table-column label="关联测点数目" align="center" prop="ptCount" />
<el-table-column label="当前电量" align="center" prop="batDl" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="small" type="primary" text v-if="1==2" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['device:pitDevice:edit']">修改</el-button>
<el-button size="small" type="primary" text icon="el-icon-tickets" @click="handleDetail(scope.row)"></el-button>
<el-button size="small" type="danger" text icon="el-icon-delete" @click="handleDelete(scope.row)"
<el-button type="primary" text icon="el-icon-info" @click="handleDetail(scope.row)"></el-button>
<el-button type="danger" text icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['device:pitDevice:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
@pagination="getList" />
<!-- 添加或修改基坑设备对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="设备编号" prop="code">
<el-input v-model="form.code" placeholder="请输入设备编号" />
</el-form-item>
<el-form-item label="设备名称" prop="name">
<el-input v-model="form.name" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="设备类型" prop="type">
<el-select v-model="form.type" placeholder="请选择设备类型">
<el-option v-for="dict in dict.type.pit_device_type" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="安装位置" prop="location">
<el-input v-model="form.location" placeholder="请输入安装位置" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in dict.type.pit_device_status" :key="dict.value" :value="dict.value">
{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
<!-- 基坑设备详情对话框 -->
<el-dialog :title="detailTitle" v-model="detailOpen" width="800px" append-to-body>
<el-row :gutter="20">
<el-col :span="12">
<el-descriptions title="设备基本信息" :column="1" border>
<el-descriptions-item label="设备编号">{{ detailData.code }}</el-descriptions-item>
<el-descriptions-item label="设备名称">{{ detailData.name }}</el-descriptions-item>
<el-descriptions-item label="设备类型">
<dict-tag :options="dict.type.pit_device_type" :value="detailData.type" />
</el-descriptions-item>
<el-descriptions-item label="安装位置">{{ detailData.location }}</el-descriptions-item>
<el-descriptions-item label="状态">
<dict-tag :options="dict.type.pit_device_status" :value="detailData.status" />
</el-descriptions-item>
</el-descriptions>
</el-col>
<el-col :span="12">
<el-descriptions title="关联测点信息" :column="1" border>
<el-descriptions-item label="测点数量">{{ surveyPoints.length }}</el-descriptions-item>
<el-descriptions-item label="测点列表">
<el-tag v-for="item in surveyPoints" :key="item.id" style="margin-right: 5px;">{{ item.name }}</el-tag>
</el-descriptions-item>
</el-descriptions>
</el-col>
</el-row>
<template #footer>
<div class="dialog-footer">
<el-button @click="detailOpen = false"> </el-button>
</div>
</template>
</el-dialog>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" @pagination="getList" />
<deviceDetailDlg ref="detailDlg"/>
</div>
</template>
<script>
import { listPitDevice, getPitDevice, delPitDevice, addPitDevice, updatePitDevice } from "@/api/device/pitDevice";
import {
listPitDevice,
getPitDevice,
delPitDevice,
addPitDevice,
updatePitDevice,
} from "@/api/device/pitDevice";
import { queryUnitList, findMyProjectList } from "@/api/publics";
import deviceDetailDlg from './deviceDetailDlg.vue'
import deviceDetailDlg from "./deviceDetailDlg.vue";
export default {
components:{
deviceDetailDlg
components: {
deviceDetailDlg,
},
name: "PitDevice",
data() {
@ -163,31 +83,43 @@ export default {
subDeptId: null,
name: null,
devCode: null,
devTypeName: null,
devTypeName: null,
},
//
form: {},
//
rules: {
},
rules: {},
projectOptions: [],
depts: [],
dict: {
type: {
pit_device_status: [],
pit_device_type: [],
},
},
};
},
created() {
const { pit_device_status, pit_device_type } = this.useDict(
"pit_device_status",
"pit_device_type"
);
this.dict.type.pit_device_status = pit_device_status;
this.dict.type.pit_device_type = pit_device_type;
this.getList();
this.init();
},
methods: {
doQuerySub() {
let prjId=this.queryParams.projectId;
let tmps = this.prjDept2 && this.prjDept2[prjId] ? this.prjDept2[prjId] || [] : [];
let prjId = this.queryParams.projectId;
let tmps =
this.prjDept2 && this.prjDept2[prjId] ? this.prjDept2[prjId] || [] : [];
if (tmps.length > 0 || !prjId) {
this.depts = tmps;
if (tmps.length == 1) {
this.queryParams.subDeptId = tmps[0].deptId;
} else {
this.queryParams.subDeptId = '';
this.queryParams.subDeptId = "";
}
this.getList();
return;
@ -205,7 +137,7 @@ export default {
if (objs.length == 1) {
this.queryParams.subDeptId = objs[0].deptId;
} else {
this.queryParams.subDeptId = '';
this.queryParams.subDeptId = "";
}
this.getList();
});
@ -221,60 +153,18 @@ export default {
/** 查询设备管理列表 */
getList() {
this.loading = true;
listPitDevice(this.queryParams).then(response => {
this.pitDeviceList = (response.rows||[]).map(it=>{
it.ptCount=it.surveypoints?it.surveypoints.length:0;
let obj=this.$tryToJson(it.devShadow,{});
let batDl=obj.state?.reported?.BAT_DL||'';
it.batDl=batDl?batDl+"%":"-";
listPitDevice(this.queryParams).then((response) => {
this.pitDeviceList = (response.rows || []).map((it) => {
it.ptCount = it.surveypoints ? it.surveypoints.length : 0;
let obj = this.$tryToJson(it.devShadow, {});
let batDl = obj.state?.reported?.BAT_DL || "";
it.batDl = batDl ? batDl + "%" : "-";
return it;
});
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
cfgId: null,
devId: null,
autoType: null,
certUrl: null,
checkDate: null,
devCode: null,
devShadow: null,
devType: null,
devTypeName: null,
key: null,
manufacturer: null,
name: null,
orgId: null,
parent: null,
parentIds: null,
productType: null,
position: null,
status: null,
structureId: null,
structureName: null,
typeCategory: null,
typeName: null,
verifyDate: null,
state: null,
remark: null,
isDel: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -285,52 +175,10 @@ export default {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加设备管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getPitDevice(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改设备管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updatePitDevice(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPitDevice(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
handleDetail(row){
handleDetail(row) {
this.$refs.detailDlg.showDialog(row);
},
/** 删除按钮操作 */
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除设备管理编号为"' + ids + '"的数据项?').then(function () {
@ -340,12 +188,6 @@ export default {
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
this.download('device/pitDevice/export', {
...this.queryParams
}, `pitDevice_${new Date().getTime()}.xlsx`)
}
}
},
};
</script>

View File

@ -10,64 +10,26 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="small" @click="handleAdd"
v-hasPermi="['device:pitElement:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="small" :disabled="single" @click="handleUpdate"
v-hasPermi="['device:pitElement:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="small" :disabled="multiple" @click="handleDelete"
v-hasPermi="['device:pitElement:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="small" @click="handleExport"
v-hasPermi="['device:pitElement:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch="showSearch" @update:showSearch="showSearch = $event" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="pitElementList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" />
<el-table v-loading="loading" :data="pitElementList" >
<el-table-column label="编号" align="center" prop="id" width="100"/>
<el-table-column label="构件名称" align="center" prop="name" />
<el-table-column label="构件类型" align="center" prop="type" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="监测项名称(EN)" align="center" prop="nameEn" >
<template v-slot="scope">
<el-button size="small" type="primary" text icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['device:pitElement:edit']">修改</el-button>
<el-button size="small" type="danger" text icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['device:pitElement:remove']">删除</el-button>
<span class="ignore">{{ scope.row.nameEn}}</span>
</template>
</el-table-column>
<el-table-column label="构件类型" align="center" prop="type" >
<template v-slot="scope">
<span class="ignore">{{ scope.row.type}}</span>
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
@pagination="getList" />
<!-- 添加或修改基坑构件对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="构件名称" prop="name">
<el-input v-model="form.name" placeholder="请输入构件名称" />
</el-form-item>
<el-form-item label="构件类型" prop="type">
<el-select v-model="form.type" placeholder="请选择构件类型">
<el-option v-for="dict in dict.type.pit_element_type" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
@ -162,36 +124,12 @@ export default {
this.loading = true;
listPitElement(this.queryParams).then(response => {
this.pitElementList = response.rows;
console.log("pitElementList==",response)
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
cfgId: null,
srvId: null,
maxSp: null,
monitorStatus: null,
name: null,
nameEn: null,
type: null,
state: null,
remark: null,
isDel: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -208,58 +146,6 @@ export default {
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加监测项管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getPitElement(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改监测项管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updatePitElement(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPitElement(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除监测项管理编号为"' + ids + '"的数据项?').then(function () {
return delPitElement(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
this.download('device/pitElement/export', {
...this.queryParams
}, `pitElement_${new Date().getTime()}.xlsx`)
}
}
};
</script>