From e6c8860ead63be692c7de5ff8f408ebddece6b29 Mon Sep 17 00:00:00 2001 From: SunTao <328867980@qq.com> Date: Mon, 4 Nov 2024 10:38:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=97=85=E5=AE=B3=E7=A1=AE=E8=AE=A4=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/xj/confirmation.js | 43 ++ .../components/image-dialog.vue | 519 +++++++++++++++ .../confirmation-management/index.vue | 626 ++++++++++++++++++ .../inspection/disease-management/index.vue | 203 ++++-- .../xj/inspection/road-management/index.vue | 147 +++- .../inspection/traffic-management/index.vue | 140 +++- 6 files changed, 1618 insertions(+), 60 deletions(-) create mode 100644 src/api/xj/confirmation.js create mode 100644 src/views/xj/inspection/confirmation-management/components/image-dialog.vue create mode 100644 src/views/xj/inspection/confirmation-management/index.vue diff --git a/src/api/xj/confirmation.js b/src/api/xj/confirmation.js new file mode 100644 index 0000000..a4cc4c3 --- /dev/null +++ b/src/api/xj/confirmation.js @@ -0,0 +1,43 @@ +/* + * @Author: SunTao 328867980@qq.com + * @Date: 2024-11-01 16:31:49 + * @LastEditors: SunTao 328867980@qq.com + * @LastEditTime: 2024-11-01 16:33:52 + * @FilePath: \znxjxt-ui\src\api\xj\confirmation.js + * @Description: 巡检信息-病害确认 + */ +import request from "@/utils/request"; + +// 查询列表病害类型 +export function getDefectList(params) { + return request({ + url: "/metadata/defectType", + method: "get", + params, + }); +} + +// 路段下拉数据 +export function getSegment() { + return request({ + url: "/api/v2/segment/selectList", + method: "post", + }); +} + +// 病害状态下拉类型 +export function getDefectStatus() { + return request({ + url: "/metadata/defectState", + method: "get", + }); +} + +// 查询病害日志列表 +export function listDefect(query) { + return request({ + url: "/xj/defect/list", + method: "get", + params: query, + }); +} diff --git a/src/views/xj/inspection/confirmation-management/components/image-dialog.vue b/src/views/xj/inspection/confirmation-management/components/image-dialog.vue new file mode 100644 index 0000000..24dde1c --- /dev/null +++ b/src/views/xj/inspection/confirmation-management/components/image-dialog.vue @@ -0,0 +1,519 @@ + + + + + + + \ No newline at end of file diff --git a/src/views/xj/inspection/confirmation-management/index.vue b/src/views/xj/inspection/confirmation-management/index.vue new file mode 100644 index 0000000..a45b055 --- /dev/null +++ b/src/views/xj/inspection/confirmation-management/index.vue @@ -0,0 +1,626 @@ + + + + + + + \ No newline at end of file diff --git a/src/views/xj/inspection/disease-management/index.vue b/src/views/xj/inspection/disease-management/index.vue index ad8a3e6..804be99 100644 --- a/src/views/xj/inspection/disease-management/index.vue +++ b/src/views/xj/inspection/disease-management/index.vue @@ -2,7 +2,7 @@ * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git * @Date: 2024-10-08 10:58:25 * @LastEditors: SunTao 328867980@qq.com - * @LastEditTime: 2024-10-29 10:32:48 + * @LastEditTime: 2024-11-01 16:00:00 * @FilePath: \znxjxt-ui\src\views\xj\inspection\disease-management .vue * @Description: 巡检信息管理-病害管理 --> @@ -128,6 +128,13 @@ :min="0" > + + + + + + + @@ -523,6 +538,31 @@ 关闭 + + + +
+ Main Image +
+
+
@@ -582,8 +622,8 @@ export default { maxLen: undefined, minArea: undefined, maxArea: undefined, - minDistance: null, - maxDistance: null, + id: "", + snapshotId: "", }, dateTime: [], // 新增/编辑表单参数 @@ -678,6 +718,12 @@ export default { viewForm: {}, // 地图中心点 centerPoint: [123.30297096718999, 41.87942945541742], + // 查看图片大图弹窗显隐控制 + showImageDialog: false, + // 查看大图片路径 + currentImageItem: "", + // 图片病害位置信息 + rects: [], }; }, created() { @@ -689,43 +735,6 @@ export default { this.getDefectStatusList(); }, methods: { - // 转换为按分类、子分类的label和value格式 - transformToDeepCategorizedLabelValue(data) { - const result = {}; - - data.items.forEach((item) => { - Object.entries(item).forEach(([categoryKey, categoryValue]) => { - if (!result[categoryKey]) { - result[categoryKey] = {}; - } - categoryValue.forEach((subCategory) => { - Object.entries(subCategory).forEach( - ([subCategoryKey, subCategoryValue]) => { - if (!result[categoryKey][subCategoryKey]) { - result[categoryKey][subCategoryKey] = []; - } - // 处理嵌套的对象,将其转换为 label 和 value - if (typeof subCategoryValue === "object") { - Object.entries(subCategoryValue).forEach(([key, value]) => { - result[categoryKey][subCategoryKey].push({ - label: value, - value: key, - }); - }); - } else { - result[categoryKey][subCategoryKey].push({ - label: subCategoryValue, - value: subCategoryKey, - }); - } - } - ); - }); - }); - }); - - return result; - }, /* 获取路段下拉数据 */ getSegmentList() { getSegment().then(({ code, data }) => { @@ -734,6 +743,7 @@ export default { } }); }, + /* 获取列表病害类型对应数据 */ getTableDefect() { getDefectList().then(({ code, data }) => { @@ -742,6 +752,7 @@ export default { } }); }, + /* 过滤列表病害类型 */ filterDefect(value) { let a = null; @@ -752,6 +763,7 @@ export default { return a.label; } }, + /* 过滤列表病害状态 */ filterState(value) { let a = null; @@ -762,6 +774,7 @@ export default { return a.label; } }, + /* 获取病害类型下拉数据 */ getdefectTypes() { getDefectTypes().then((response) => { @@ -774,6 +787,7 @@ export default { }); }); }, + /* 查询校验状态下拉数据 */ getStates() { getStatesList().then(({ code, data }) => { @@ -782,6 +796,7 @@ export default { } }); }, + /* 查询病害状态下拉数据 */ getDefectStatusList() { getDefectStatus().then(({ data, code }) => { @@ -790,6 +805,7 @@ export default { } }); }, + /** 查询缺陷列表 */ getList() { // 处理日期范围 @@ -808,6 +824,7 @@ export default { this.loading = false; }); }, + /* 新增/编辑弹窗取消按钮 */ cancel() { this.dialogVisible = false; @@ -832,10 +849,12 @@ export default { } // this.resetFormData(); }, + /* 重置表单方法 */ resetForm(formName) { this.$refs[formName].resetFields(); }, + /* 表单重置事件 */ resetQuery() { this.resetForm("queryForm"); @@ -854,9 +873,12 @@ export default { maxLen: undefined, minArea: undefined, maxArea: undefined, + id: "", + snapshotId: "", }; (this.dateTime = []), this.getList(); }, + /** 点击搜索按钮操作 */ handleQuery() { const phonereg = /^K\d{4}\+\d{3}$/; @@ -879,12 +901,14 @@ export default { this.getList(); } }, + /* 多选框选中数据 */ handleSelectionChange(selection) { this.ids = selection.map((item) => item.id); this.single = selection.length !== 1; this.multiple = !selection.length; }, + /** 新增按钮操作 */ handleAdd() { this.dialogVisible = true; @@ -893,6 +917,7 @@ export default { this.initMap("addMap"); }); }, + /** 修改按钮操作 */ handleUpdate(row) { this.dialogVisible = true; @@ -919,6 +944,7 @@ export default { }; }); }, + /* 批量确认操作 */ handleUpdateBatch() { if (this.ids.length > 0) { @@ -933,14 +959,17 @@ export default { this.$modal.msgWarning("请选择一条记录进行修改"); } }, + /* 文件提交处理 */ submitUpload() { this.$refs.upload.submit(); }, + /* 文件上传中处理 */ handleFileUploadProgress(event, file, fileList) { this.upload.isUploading = true; }, + /* 文件上传成功处理 */ handleFileSuccess(response, file, fileList) { this.upload.fileList = fileList.map((item) => { @@ -951,6 +980,7 @@ export default { }); this.upload.isUploading = false; }, + /** 提交按钮 */ submitForm() { this.$refs["defectForm"].validate((valid) => { @@ -1008,6 +1038,7 @@ export default { } }); }, + /** 删除按钮操作 */ handleDelete(row) { const ids = row ? [row.id] : this.ids; @@ -1026,6 +1057,7 @@ export default { }) .catch(() => {}); }, + /** 导出按钮操作 */ handleExport() { this.download( @@ -1036,6 +1068,7 @@ export default { `defect_${new Date().getTime()}.xlsx` ); }, + /** 重置表单数据 */ resetFormData() { this.form = { @@ -1053,6 +1086,7 @@ export default { }; this.resetForm("defectForm"); }, + /* 点击行列表查看事件 */ viewDefect(defect) { // this.loadDefect(defect.id); @@ -1075,6 +1109,7 @@ export default { this.map.removeEventListener("click", this.onMapClick); }); }, + /* 初始化天地图 */ initMap(ele) { // if (this.map) { @@ -1090,6 +1125,7 @@ export default { // 添加单击事件 this.map.on("click", this.onMapClick); }, + /* 新增/编辑地图单击事件 */ onMapClick(e) { const marker = new T.Marker(e.lnglat); @@ -1103,11 +1139,67 @@ export default { this.markers.push(e.lnglat); } }, + /* 关闭查看对话框 */ closeDialog() { this.centerPoint = [123.30297096718999, 41.87942945541742]; this.openViewDialog = false; }, + + /* 打开查看图片弹窗 */ + showScreenImg(item) { + this.currentImageItem = item; + this.showImageDialog = true; + }, + + /* 图片位置信息获取 */ + updateRects() { + this.rects = []; + this.rectsItem = {}; + const image = this.$refs.mainImage; + const rects = this.currentImageItem?.rect?.split(",").map(Number) || []; + this.rects = [ + { + left: rects[0], + top: rects[1], + width: rects[2], + height: rects[3], + }, + ]; + // this.rectsItem = this.defectData[this.currentIndex]; + }, + + /* 图片红框位置 */ + getRectStyle({ left, top, width, height }) { + const image = this.$refs.mainImage; + const container = this.$refs.imageContainer; + if (!image || !container) return {}; + + const scaleX = container.clientWidth / image.naturalWidth; + const scaleY = container.clientHeight / image.naturalHeight; + const scale = Math.min(scaleX, scaleY); + + const renderedWidth = image.naturalWidth * scale; + const renderedHeight = image.naturalHeight * scale; + + const offsetX = (container.clientWidth - renderedWidth) / 2; + const offsetY = (container.clientHeight - renderedHeight) / 2; + + return { + position: "absolute", + left: `${left * scale + offsetX}px`, + top: `${top * scale + offsetY}px`, + width: `${width * scale}px`, + height: `${height * scale}px`, + border: "2px solid #FF0000", + boxSizing: "border-box", + }; + }, + + /* 关闭查看图片弹窗 */ + imgCancel() { + this.showImageDialog = false; + }, }, }; @@ -1160,4 +1252,27 @@ export default { max-width: 25rem; } } + +/* 查看大图弹窗 */ +.image-container { + position: relative; + width: 100%; + height: 80%; + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; +} + +.image-container img { + max-width: 100%; + max-height: 100%; + object-fit: contain; +} + +.rect-overlay { + position: absolute; + pointer-events: none; + border: 2px solid red; +} diff --git a/src/views/xj/inspection/road-management/index.vue b/src/views/xj/inspection/road-management/index.vue index f432e13..4d149e7 100644 --- a/src/views/xj/inspection/road-management/index.vue +++ b/src/views/xj/inspection/road-management/index.vue @@ -2,7 +2,7 @@ * @Author: SunTao 328867980@qq.com * @Date: 2024-10-11 15:14:16 * @LastEditors: SunTao 328867980@qq.com - * @LastEditTime: 2024-10-25 09:28:22 + * @LastEditTime: 2024-11-01 15:59:48 * @FilePath: \znxjxt-ui\src\views\xj\inspection\road-management\index.vue * @Description: 巡检信息-路产管理 --> @@ -42,9 +42,9 @@ clearable />
- + @@ -240,10 +240,10 @@ @@ -343,6 +343,31 @@ :roadType="roadType" > + + + +
+ Main Image +
+
+
@@ -367,7 +392,7 @@ export default { // 道路名称 segmentName: "", // 路产类型 - defectType: "", + equipmentType: "", // 校验状态 dataStatus: "", // 巡检任务 @@ -423,6 +448,12 @@ export default { addVisible: false, // 查看弹窗显隐控制 viewVisible: false, + // 查看图片大图弹窗显隐控制 + showImageDialog: false, + // 查看大图片路径 + currentImageItem: "", + // 图片病害位置信息 + rects: [], }; }, created() { @@ -440,6 +471,7 @@ export default { } }); }, + /* 获取路产类型下拉数据 */ getRoadTypeList() { getRoadType().then(({ code, data }) => { @@ -448,6 +480,7 @@ export default { } }); }, + /* 路产状态下拉数据 */ getDefectStatusList() { getDefectStatus().then(({ data, code }) => { @@ -456,6 +489,7 @@ export default { } }); }, + /* 点击搜索事件 */ handleQuery() { const phonereg = /^K\d{4}\+\d{3}$/; @@ -481,12 +515,13 @@ export default { this.getRoadList(); } }, + /* 点击重置事件 */ resetQuery() { this.searchForm = {}; - this.queryForm = { + this.queryParams = { segmentName: "", - defectType: "", + equipmentType: "", dataStatus: "", inspectDirection: "", defectType3: "", @@ -498,6 +533,7 @@ export default { this.dateTime = []; this.getRoadList(); }, + /* 获取列表数据 */ getRoadList() { const params = { @@ -513,6 +549,7 @@ export default { } }); }, + /* 过滤列表路产类型 */ filterDefect(value) { let a = null; @@ -523,6 +560,7 @@ export default { return a.label; } }, + /* 过滤路产状态 */ filterState(value) { let a = null; @@ -533,6 +571,7 @@ export default { return a.label; } }, + /* 点击新增事件 */ handleAdd() { this.addVisible = true; @@ -541,6 +580,7 @@ export default { title: "添加路产", }; }, + /* 点击删除事件 */ handleDelete(row) { const checkIds = row ? [row.id] : this.checkIds; @@ -560,8 +600,10 @@ export default { }) .catch(() => {}); }, + /* 点击导出事件 */ handleExport() {}, + /* 批量确认事件 */ handleUpdateBatch() { if (this.checkIds.length > 0) { @@ -576,12 +618,14 @@ export default { this.$modal.msgWarning("请选择一条记录进行修改"); } }, + /* 列表选择改变事件 */ handleSelectionChange(selection) { this.checkIds = selection.map((item) => item.id); this.single = selection.length !== 1; this.multiple = !selection.length; }, + /* 列表-点击修改事件 */ handleUpdate(item) { this.addVisible = true; @@ -591,6 +635,7 @@ export default { ...item, }; }, + /* 列表-点击查看事件 */ viewDefect(item) { this.viewVisible = true; @@ -599,16 +644,19 @@ export default { ...item, }; }, + /* 切换分页 */ handleCurrentChange(arg) { this.pagination.page = arg; this.getRoadList(); }, + /* 切换每条/页 */ handleSizeChange(arg) { this.pagination.size = arg; this.getRoadList(); }, + /* 关闭新增/编辑弹窗 */ addCancel() { this.addVisible = false; @@ -616,11 +664,67 @@ export default { this.addTitle = ""; this.getRoadList(); }, + /* 关闭查看弹窗 */ viewCancel() { this.viewVisible = false; this.dialogItem = { title: "添加路产" }; }, + + /* 打开查看图片弹窗 */ + showScreenImg(item) { + this.currentImageItem = item; + this.showImageDialog = true; + }, + + /* 图片位置信息获取 */ + updateRects() { + this.rects = []; + this.rectsItem = {}; + const image = this.$refs.mainImage; + const rects = this.currentImageItem?.rect?.split(",").map(Number) || []; + this.rects = [ + { + left: rects[0], + top: rects[1], + width: rects[2], + height: rects[3], + }, + ]; + // this.rectsItem = this.defectData[this.currentIndex]; + }, + + /* 图片红框位置 */ + getRectStyle({ left, top, width, height }) { + const image = this.$refs.mainImage; + const container = this.$refs.imageContainer; + if (!image || !container) return {}; + + const scaleX = container.clientWidth / image.naturalWidth; + const scaleY = container.clientHeight / image.naturalHeight; + const scale = Math.min(scaleX, scaleY); + + const renderedWidth = image.naturalWidth * scale; + const renderedHeight = image.naturalHeight * scale; + + const offsetX = (container.clientWidth - renderedWidth) / 2; + const offsetY = (container.clientHeight - renderedHeight) / 2; + + return { + position: "absolute", + left: `${left * scale + offsetX}px`, + top: `${top * scale + offsetY}px`, + width: `${width * scale}px`, + height: `${height * scale}px`, + border: "2px solid #FF0000", + boxSizing: "border-box", + }; + }, + + /* 关闭查看图片弹窗 */ + imgCancel() { + this.showImageDialog = false; + }, }, }; @@ -682,4 +786,27 @@ export default { max-width: 25rem; } } + +/* 查看大图弹窗 */ +.image-container { + position: relative; + width: 100%; + height: 80%; + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; +} + +.image-container img { + max-width: 100%; + max-height: 100%; + object-fit: contain; +} + +.rect-overlay { + position: absolute; + pointer-events: none; + border: 2px solid red; +} diff --git a/src/views/xj/inspection/traffic-management/index.vue b/src/views/xj/inspection/traffic-management/index.vue index 5d53845..755cf2d 100644 --- a/src/views/xj/inspection/traffic-management/index.vue +++ b/src/views/xj/inspection/traffic-management/index.vue @@ -2,7 +2,7 @@ * @Author: SunTao 328867980@qq.com * @Date: 2024-10-12 14:52:23 * @LastEditors: SunTao 328867980@qq.com - * @LastEditTime: 2024-10-25 13:02:28 + * @LastEditTime: 2024-11-01 16:11:11 * @FilePath: \znxjxt-ui\src\views\xj\inspection\traffic-management\index.vue * @Description: 巡检管理-交安事件 --> @@ -229,10 +229,10 @@ @@ -328,6 +328,31 @@ :eventType="eventType" > + + + +
+ Main Image +
+
+
@@ -411,6 +436,12 @@ export default { addVisible: false, // 查看弹窗显隐控制 viewVisible: false, + // 查看图片大图弹窗显隐控制 + showImageDialog: false, + // 查看大图片路径 + currentImageItem: "", + // 图片病害位置信息 + rects: [], }; }, created() { @@ -429,6 +460,7 @@ export default { } }); }, + /* 获取事件类型下拉数据 */ getEventTypeList() { getEventType().then(({ code, data }) => { @@ -437,6 +469,7 @@ export default { } }); }, + /* 事件状态下拉数据 */ getDefectStatusList() { getDefectStatus().then(({ data, code }) => { @@ -445,6 +478,7 @@ export default { } }); }, + /* 获取路产类型下拉数据 */ getRoadTypeList() { getRoadType().then(({ code, data }) => { @@ -453,6 +487,7 @@ export default { } }); }, + /* 点击搜索事件 */ handleQuery() { const phonereg = /^K\d{4}\+\d{3}$/; @@ -478,6 +513,7 @@ export default { this.getRoadList(); } }, + /* 点击重置事件 */ resetQuery() { this.searchForm = {}; @@ -495,6 +531,7 @@ export default { this.dateTime = []; this.getRoadList(); }, + /* 获取列表数据 */ getRoadList() { const params = { @@ -510,6 +547,7 @@ export default { } }); }, + /* 过滤列表事件类型 */ filterDefect(value) { let a = null; @@ -520,6 +558,7 @@ export default { return a.label; } }, + /* 过滤事件状态 */ filterState(value) { let a = null; @@ -530,6 +569,7 @@ export default { return a.label; } }, + /* 点击新增事件 */ handleAdd() { this.addVisible = true; @@ -538,6 +578,7 @@ export default { title: "添加事件", }; }, + /* 点击删除事件 */ handleDelete(row) { const checkIds = row ? [row.id] : this.checkIds; @@ -557,8 +598,10 @@ export default { }) .catch(() => {}); }, + /* 点击导出事件 */ handleExport() {}, + /* 批量确认事件 */ handleUpdateBatch() { if (this.checkIds.length > 0) { @@ -573,12 +616,14 @@ export default { this.$modal.msgWarning("请选择一条记录进行修改"); } }, + /* 列表选择改变事件 */ handleSelectionChange(selection) { this.checkIds = selection.map((item) => item.id); this.single = selection.length !== 1; this.multiple = !selection.length; }, + /* 列表-点击修改事件 */ handleUpdate(item) { this.addVisible = true; @@ -588,6 +633,7 @@ export default { ...item, }; }, + /* 列表-点击查看事件 */ viewDefect(item) { this.viewVisible = true; @@ -596,16 +642,19 @@ export default { ...item, }; }, + /* 切换分页 */ handleCurrentChange(arg) { this.pagination.page = arg; this.getRoadList(); }, + /* 切换每条/页 */ handleSizeChange(arg) { this.pagination.size = arg; this.getRoadList(); }, + /* 关闭新增/编辑弹窗 */ addCancel() { this.addVisible = false; @@ -613,16 +662,72 @@ export default { this.addTitle = ""; this.getRoadList(); }, + /* 关闭查看弹窗 */ viewCancel() { this.viewVisible = false; this.dialogItem = { title: "添加事件" }; }, + + /* 打开查看图片弹窗 */ + showScreenImg(item) { + this.currentImageItem = item; + this.showImageDialog = true; + }, + + /* 图片位置信息获取 */ + updateRects() { + this.rects = []; + this.rectsItem = {}; + const image = this.$refs.mainImage; + const rects = this.currentImageItem?.rect?.split(",").map(Number) || []; + this.rects = [ + { + left: rects[0], + top: rects[1], + width: rects[2], + height: rects[3], + }, + ]; + // this.rectsItem = this.defectData[this.currentIndex]; + }, + + /* 图片红框位置 */ + getRectStyle({ left, top, width, height }) { + const image = this.$refs.mainImage; + const container = this.$refs.imageContainer; + if (!image || !container) return {}; + + const scaleX = container.clientWidth / image.naturalWidth; + const scaleY = container.clientHeight / image.naturalHeight; + const scale = Math.min(scaleX, scaleY); + + const renderedWidth = image.naturalWidth * scale; + const renderedHeight = image.naturalHeight * scale; + + const offsetX = (container.clientWidth - renderedWidth) / 2; + const offsetY = (container.clientHeight - renderedHeight) / 2; + + return { + position: "absolute", + left: `${left * scale + offsetX}px`, + top: `${top * scale + offsetY}px`, + width: `${width * scale}px`, + height: `${height * scale}px`, + border: "2px solid #FF0000", + boxSizing: "border-box", + }; + }, + + /* 关闭查看图片弹窗 */ + imgCancel() { + this.showImageDialog = false; + }, }, }; - \ No newline at end of file