diff --git a/src/api/service/taskProgress.js b/src/api/service/taskProgress.js new file mode 100644 index 0000000..11c2cfe --- /dev/null +++ b/src/api/service/taskProgress.js @@ -0,0 +1,57 @@ +import request from "@/utils/request"; +const api = "/mosty-api/mosty-yjzl"; + +// 获取方格数据 +export function fetchTbZdxlFgdwSelectList() { + return request({ + url: `${api}/tbZdxlFgdw/selectList` + }) +} + +// 查询任务列表 +export function fetchTbZdxlFgxlrwSelectList(params) { + return request({ + url: `${api}/tbZdxlFgxlrw/selectList`, + params + }) +} + +export function fetchSelectListByBddxlrwId(params) { + return request({ + url: `${api}/tbZdxlFgdwBddxlrwJl/selectListByBddxlrwId`, + params + }) +} + +// 必到点采集列表 +export function fetchTbZdxlFgdwBddSelectPage(params) { + return request({ + url: `${api}/tbZdxlFgdwBdd/selectPage`, + params + }) +} + +// 新增必到点采集数据 +export function fetchTbZdxlFgdwBddSave(data) { + return request({ + url: `${api}/tbZdxlFgdwBdd/save`, + method: 'POST', + data + }) +} + +// 修改新增必到点采集数据 +export function fetchTbZdxlFgdwBddUpdate(data) { + return request({ + url: `${api}/tbZdxlFgdwBdd/update`, + method: "POST", + data + }) +} + +// 获取方格详情 +export function fetchTbZdxlFgdwId(id) { + return request({ + url: `${api}/tbZdxlFgdw/${id}` + }) +} diff --git a/src/assets/lz/dw.png b/src/assets/lz/dw.png new file mode 100644 index 0000000..5e151e3 Binary files /dev/null and b/src/assets/lz/dw.png differ diff --git a/src/components/Map/GdMap/index.vue b/src/components/Map/GdMap/index.vue index 834f62f..40f0553 100644 --- a/src/components/Map/GdMap/index.vue +++ b/src/components/Map/GdMap/index.vue @@ -249,6 +249,11 @@ onMounted(() => { let coords = [centerPoint.lng, centerPoint.lat]; emitter.emit("getcentercoord", coords); }); + + // 获取点击经纬度 + emitter.on("getMapClickCoordinates", (res) => { + mapUtil.value.enableClickEvents() + }) }); //切换地图底图 const onMapImageChange = (val) => { @@ -329,6 +334,7 @@ onUnmounted(() => { emitter.off("diffusionCircle"); emitter.off("SsCircle"); emitter.off("ClearssCircle"); + emitter.off("getMapClickCoordinates") }); diff --git a/src/components/Map/GdMap/mapUtil.js b/src/components/Map/GdMap/mapUtil.js index f3ff05a..b9b3c81 100644 --- a/src/components/Map/GdMap/mapUtil.js +++ b/src/components/Map/GdMap/mapUtil.js @@ -697,6 +697,31 @@ export function MapUtil(map) { break; } } + + /** 获取经纬度*/ + MapUtil.prototype.enableClickEvents = function() { + const _that = this; + + if (_that.clickEventHandler) { + console.log('点击事件已经启用'); + return; + } + + // 添加点击事件处理函数 + _that.clickEventHandler = (e) => { + const lng = e.lngLat.lng; + const lat = e.lngLat.lat; + + emitter.emit("mapClickCoordinates", { + lng, + lat, + coordinates: [lng, lat], + timestamp: new Date().getTime() + }); + }; + + _that.mMap.mapboxGLMap.on('click', _that.clickEventHandler); + }; } // 获取uuid 作为边界图层ID function getUUid() { diff --git a/src/components/aboutTable/MyTable.vue b/src/components/aboutTable/MyTable.vue index 8b60032..6ba3067 100644 --- a/src/components/aboutTable/MyTable.vue +++ b/src/components/aboutTable/MyTable.vue @@ -120,7 +120,7 @@ const props = defineProps({ }, selectable: { type: Function, - default: () => {} + default: () => [] } }); // 可选的时候选择的数据 diff --git a/src/router/index.js b/src/router/index.js index 9e19e45..755947d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -559,23 +559,41 @@ export const privateRoutes = [{ } }, { - path: "/service/taskPage", - component: () => import("@/views/backOfficeSystem/service/taskPage/dailyTaskPackage/index"), + path: "/taskPage", name: "taskPage", + redirect: "/taskPageIndex", meta: { title: '任务清单', icon: "article-ranking" }, children: [ { - path: "/taskPageIndex", + path: "/taskPage/taskPageIndex", component: () => import("@/views/backOfficeSystem/service/taskPage/dailyTaskPackage/index"), name: "taskPageIndex", meta: { title: '日常任务包', icon: "article-ranking" }, - } + }, + { + path: "/taskPage/taskProgress", + component: () => import("@/views/backOfficeSystem/service/taskPage/taskProgress/index"), + name: "taskProgress", + meta: { + title: '任务进度', + icon: "article-ranking" + }, + }, + { + path: "/taskPage/collectPage", + component: () => import("@/views/backOfficeSystem/service/taskPage/collectPage/index"), + name: "collectPage", + meta: { + title: '必到点采集', + icon: "article-ranking" + }, + }, ] }, { diff --git a/src/views/backOfficeSystem/service/taskPage/collectPage/AddFgFormDialog.vue b/src/views/backOfficeSystem/service/taskPage/collectPage/AddFgFormDialog.vue new file mode 100644 index 0000000..794564c --- /dev/null +++ b/src/views/backOfficeSystem/service/taskPage/collectPage/AddFgFormDialog.vue @@ -0,0 +1,306 @@ + + + + + {{ title }} + + 保存 + 关闭 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/backOfficeSystem/service/taskPage/collectPage/index.vue b/src/views/backOfficeSystem/service/taskPage/collectPage/index.vue new file mode 100644 index 0000000..1105862 --- /dev/null +++ b/src/views/backOfficeSystem/service/taskPage/collectPage/index.vue @@ -0,0 +1,223 @@ + + + + + + + + 新增 + + + + + + + + + + + + + + + + 编辑 + 查看详情 + + + + + + + + + + + + diff --git a/src/views/backOfficeSystem/service/taskPage/dailyTaskPackage/components/DistributePatrolTeamDialog.vue b/src/views/backOfficeSystem/service/taskPage/dailyTaskPackage/components/DistributePatrolTeamDialog.vue index 59ade05..978c2c7 100644 --- a/src/views/backOfficeSystem/service/taskPage/dailyTaskPackage/components/DistributePatrolTeamDialog.vue +++ b/src/views/backOfficeSystem/service/taskPage/dailyTaskPackage/components/DistributePatrolTeamDialog.vue @@ -49,21 +49,31 @@ - + + - {{ item.jlxm - }} + + + {{ item.jlxm }} + + + + @@ -72,7 +82,7 @@ }} - + @@ -331,10 +341,13 @@ const dialogFormVisible = ref(false); //弹窗 const isShowMap = ref(false) //展示地图 +const formData = ref({}) + //搜索数据 const listQuery = ref({ pageCurrent: 1, - pageSize: 20 + pageSize: 20, + // bbzt: 0 }); //表单数据 const form = ref({}); @@ -1007,7 +1020,7 @@ function delDictItem(row) { //批量数据 const multipleUserRef = ref(null); const multipleSelectionUser = ref([]) -const handleSelectionChange = (val) => { +const handleSelectionChange = async (val) => { // ids.value = []; // if (val) { // val.forEach((item) => { @@ -1015,17 +1028,40 @@ const handleSelectionChange = (val) => { // }); // } + await nextTick() + if (val?.length > 1) { let del_row = val?.shift(); multipleUserRef.value.toggleRowSelection(del_row, false); } multipleSelectionUser.value = val; + + if (multipleSelectionUser.value?.[0]?.id !== formData.value?.id) { + + formData.value.xfbbQwJlId = [] + formData.value.id = '' + } }; const handleClickClose = () => { // emits("selectionChange", []) visible.value = false } + +const handleChange = async (val, obj) => { + if (val?.length > 1) { + let del_row = val?.shift(); + } + console.log(val); + + formData.xfbbQwJlId = val + formData.value.id = obj?.id + await nextTick() + multipleUserRef.value.toggleRowSelection(obj, true) + + multipleSelectionUser.value = [obj] +} + // 确定 const onSubmit = () => { if (multipleSelectionUser.value.length === 0) { @@ -1035,7 +1071,14 @@ const onSubmit = () => { }); return } - emits("selectionChange", multipleSelectionUser.value) + + const obj = multipleSelectionUser.value?.[0]?.jlList?.find(i => i?.id == formData.value?.xfbbQwJlId[0]) + + emits("selectionChange", { + list: multipleSelectionUser.value, + xfbbName: `${multipleSelectionUser.value?.[0]?.fzrXm}-${obj?.jlxm}`, + ...formData?.value + }) visible.value = false } diff --git a/src/views/backOfficeSystem/service/taskPage/dailyTaskPackage/editAddFormDialog.vue b/src/views/backOfficeSystem/service/taskPage/dailyTaskPackage/editAddFormDialog.vue index 8a5a866..c624a0a 100644 --- a/src/views/backOfficeSystem/service/taskPage/dailyTaskPackage/editAddFormDialog.vue +++ b/src/views/backOfficeSystem/service/taskPage/dailyTaskPackage/editAddFormDialog.vue @@ -99,16 +99,49 @@ > - - - - - + + + + + + + + + + {{ getError($index) }} + + + + + + + + + + + + + @@ -121,6 +154,7 @@ import { ref, reactive, getCurrentInstance, computed } from "vue"; import { updateData } from "@/api/service/dailyTaskPackage"; import DictTag from "@/components/DictTag/index.vue"; +import MyTable from "@/components/aboutTable/MyTable.vue"; import DistributePatrolTeamDialog from "@/views/backOfficeSystem/service/taskPage/dailyTaskPackage/components/DistributePatrolTeamDialog.vue"; const { proxy } = getCurrentInstance(); @@ -131,6 +165,27 @@ const formRef = ref(null); const infoActive = ref(true); const visible = ref(false); +const pageData = reactive({ + tableConfiger: { + rowHieght: 61, + haveControls: false, + showSelectType: 'checkBox', + loading: false + }, + total: 0, + tableColumn: [ + { + label: "必到点", + prop: "bddMc" + }, + { + label: "打卡次数", + prop: "xlghDkcs", + showSolt:true + }, + ] +}) + //级联选择器配置 const props = defineProps({ modelValue: { @@ -152,7 +207,7 @@ const dialogFormVisible = computed({ //表单数据 const form = ref({ - bddList: [] + bddList: [{ xlghDkcs: 1 }, { xlghDkcs: "" }] }); // 打卡点验证规则 @@ -213,6 +268,10 @@ const rules = reactive({ function open(row = {}, type) { infoActive.value = type === 'view'; form.value = { ...row, xfbbName: row?.xfxz }; + form.value?.bddList?.forEach((item, index) => { + item.index = index // 直接添加index属性 + }) + title.value = "编辑信息"; dialogFormVisible.value = true; } @@ -224,12 +283,50 @@ function close() { } const handleChange = (val) => { - form.value.xfbbId = val?.[0]?.id; - form.value.xfbbName = `${val?.[0]?.fzrXm}警组`; + form.value.xfbbId = val?.id; + form.value.xfbbQwJlId = val?.xfbbQwJlId?.[0] + form.value.xfbbName = val?.xfbbName; +} + +const fieldErrors = ref({}) + +// 检查指定索引是否有错误 +const hasError = (index) => { + const propPath = `bddList[${index}].xlghDkcs` + return !!fieldErrors.value[propPath] +} + +// 获取指定索引的错误信息 +const getError = (index) => { + const propPath = `bddList[${index}].xlghDkcs` + return fieldErrors.value[propPath] || '' +} + +// 验证单个字段 +const validateField = async (propPath) => { + return new Promise((resolve) => { + formRef.value.validateField(propPath, (errorMessage) => { + fieldErrors.value[propPath] = errorMessage + resolve(!errorMessage) + }) + }) +} + +const validateAllCheckpoints = async () => { + // if (!form.value.bddList) return true + + const validations = form.value.bddList.map((_, index) => + validateField(`bddList[${index}].xlghDkcs`) + ) + + const results = await Promise.all(validations) + return results.every(result => result) } //提交 const submit = async () => { + console.log(await validateAllCheckpoints()) + console.log(fieldErrors.value) try { await formRef.value.validate() @@ -267,4 +364,32 @@ defineExpose({ open }) .label { margin-bottom: 1rem; } + +.validation-container { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 4px; + min-height: 60px; /* 预留错误信息空间 */ +} + +.error-message { + color: #f56c6c; + font-size: 12px; + line-height: 1; + padding: 2px 0; + display: block; +} + +.is-error .el-input-number__inner { + border-color: #f56c6c; +} + +/* 确保表格行高度适应错误信息 */ +.el-table .cell { + min-height: 40px; + display: flex; + flex-direction: column; + justify-content: center; +} diff --git a/src/views/backOfficeSystem/service/taskPage/taskProgress/index.vue b/src/views/backOfficeSystem/service/taskPage/taskProgress/index.vue new file mode 100644 index 0000000..1c98402 --- /dev/null +++ b/src/views/backOfficeSystem/service/taskPage/taskProgress/index.vue @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + 查询 + + + + + + 方格名称:{{ item?.fgMc }} + + + 打卡进度: + + + + 巡逻里程进度: + + + + + + + + + + + + + diff --git a/src/views/backOfficeSystem/service/taskPage/taskProgress/taskDetailsDialog.vue b/src/views/backOfficeSystem/service/taskPage/taskProgress/taskDetailsDialog.vue new file mode 100644 index 0000000..5658376 --- /dev/null +++ b/src/views/backOfficeSystem/service/taskPage/taskProgress/taskDetailsDialog.vue @@ -0,0 +1,186 @@ + + + + + {{ title }} + + 保存 + 关闭 + + + + + + + {{ item?.bddMc }} + + + + + + + + + + + + + + + +