diff --git a/src/components.d.ts b/src/components.d.ts index 5c3eb2a..419ee11 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -61,6 +61,7 @@ SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] SelectEmployeesDialog: typeof import('./components/dialog/selectEmployeesDialog.vue')['default'] + SelectLocationMap: typeof import('./components/SelectLocationMap/index.vue')['default'] SelectRoleDialog: typeof import('./components/dialog/selectRoleDialog.vue')['default'] SelectStaffDialog: typeof import('./components/dialog/selectStaffDialog.vue')['default'] SvgIcon: typeof import('./components/SvgIcon/index.vue')['default'] diff --git a/src/components.d.ts b/src/components.d.ts index 5c3eb2a..419ee11 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -61,6 +61,7 @@ SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] SelectEmployeesDialog: typeof import('./components/dialog/selectEmployeesDialog.vue')['default'] + SelectLocationMap: typeof import('./components/SelectLocationMap/index.vue')['default'] SelectRoleDialog: typeof import('./components/dialog/selectRoleDialog.vue')['default'] SelectStaffDialog: typeof import('./components/dialog/selectStaffDialog.vue')['default'] SvgIcon: typeof import('./components/SvgIcon/index.vue')['default'] diff --git a/src/components/SelectLocationMap/index.vue b/src/components/SelectLocationMap/index.vue new file mode 100644 index 0000000..2c7064d --- /dev/null +++ b/src/components/SelectLocationMap/index.vue @@ -0,0 +1,55 @@ + + + + + + diff --git a/src/components.d.ts b/src/components.d.ts index 5c3eb2a..419ee11 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -61,6 +61,7 @@ SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] SelectEmployeesDialog: typeof import('./components/dialog/selectEmployeesDialog.vue')['default'] + SelectLocationMap: typeof import('./components/SelectLocationMap/index.vue')['default'] SelectRoleDialog: typeof import('./components/dialog/selectRoleDialog.vue')['default'] SelectStaffDialog: typeof import('./components/dialog/selectStaffDialog.vue')['default'] SvgIcon: typeof import('./components/SvgIcon/index.vue')['default'] diff --git a/src/components/SelectLocationMap/index.vue b/src/components/SelectLocationMap/index.vue new file mode 100644 index 0000000..2c7064d --- /dev/null +++ b/src/components/SelectLocationMap/index.vue @@ -0,0 +1,55 @@ + + + + + + diff --git a/src/components/SelectLocationMap/map/index.vue b/src/components/SelectLocationMap/map/index.vue new file mode 100644 index 0000000..35d0061 --- /dev/null +++ b/src/components/SelectLocationMap/map/index.vue @@ -0,0 +1,123 @@ + + + + + + + + diff --git a/src/components.d.ts b/src/components.d.ts index 5c3eb2a..419ee11 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -61,6 +61,7 @@ SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] SelectEmployeesDialog: typeof import('./components/dialog/selectEmployeesDialog.vue')['default'] + SelectLocationMap: typeof import('./components/SelectLocationMap/index.vue')['default'] SelectRoleDialog: typeof import('./components/dialog/selectRoleDialog.vue')['default'] SelectStaffDialog: typeof import('./components/dialog/selectStaffDialog.vue')['default'] SvgIcon: typeof import('./components/SvgIcon/index.vue')['default'] diff --git a/src/components/SelectLocationMap/index.vue b/src/components/SelectLocationMap/index.vue new file mode 100644 index 0000000..2c7064d --- /dev/null +++ b/src/components/SelectLocationMap/index.vue @@ -0,0 +1,55 @@ + + + + + + diff --git a/src/components/SelectLocationMap/map/index.vue b/src/components/SelectLocationMap/map/index.vue new file mode 100644 index 0000000..35d0061 --- /dev/null +++ b/src/components/SelectLocationMap/map/index.vue @@ -0,0 +1,123 @@ + + + + + + + + diff --git a/src/views/data/electricity/components/busbarAdd.vue b/src/views/data/electricity/components/busbarAdd.vue index 39b0f25..6a69406 100644 --- a/src/views/data/electricity/components/busbarAdd.vue +++ b/src/views/data/electricity/components/busbarAdd.vue @@ -20,6 +20,7 @@ const dialogStatus = ref('') // 对话框类型:create,update const isEditMode = ref(true) const rowData = ref() +// 表单 const areaForm = ref({ type: '', // 节点类型 gs: '', // 节点并联电导 @@ -37,7 +38,16 @@ nodeName: '', lng: '', lat: '', -}) // 表单 + busId: '', +}) +const locationData = ref([]) // 经纬度 - 展示用 +const locationDataStr = computed(() => locationData.value.join()) +watch(() => locationData.value, (newVal: number[]) => { + if (newVal.length) { + areaForm.value.lng = newVal[0].toString() + areaForm.value.lat = newVal[1].toString() + } +}, { deep: true }) const textMap: { [key: string]: string } = { update: '编辑', create: '新增', @@ -84,7 +94,7 @@ vmin: [{ required: true, message: '请输入节点最小电压', trigger: ['blur', 'change'] }], pd: [{ required: true, message: '请输入负荷有功功率', trigger: ['blur', 'change'] }], qd: [{ required: true, message: '请输入负荷无功功率', trigger: ['blur', 'change'] }], - lng: [{ required: true, message: '请输入节点经度', trigger: ['blur', 'change'] }], + lng: [{ required: true, message: '请选择节点经纬度坐标', trigger: ['blur', 'change'] }], lat: [{ required: true, message: '请输入节点纬度', trigger: ['blur', 'change'] }], nodeName: [{ required: true, message: '请输入节点名称', trigger: ['blur', 'change'] }], } // 前端校验规则 @@ -107,7 +117,9 @@ nodeName: '', lng: '', lat: '', + busId: '', } + locationData.value = [] } const nodeTypeList = ref([]) // 获取设备类型列表 @@ -117,7 +129,6 @@ }) } fetchNodeType() - // 初始化对话框 const initDialog = (dialogStatusValue: string, row: any, id: string) => { fetchDataList() @@ -134,6 +145,9 @@ } else if (dialogStatus.value === 'update') { // 如果是修改,将row中数据填写到输入框中 areaForm.value = row + if (row.lng && row.lat) { + locationData.value = [Number(row.lng), Number(row.lat)] + } rowData.value = JSON.parse(JSON.stringify(row)) areaForm.value.type = row.type.toString() isEditMode.value = true @@ -204,17 +218,24 @@ const cancel = () => { dialogFormVisible.value = false } +const selectRef = ref() +// 选择经纬度 +const selectLocation = () => { + selectRef.value.initDialog(locationData.value) +} +// 确定经纬度 +const confirm = (data: number[]) => { + locationData.value = data +}