diff --git a/src/views/permission/role/auth.vue b/src/views/permission/role/auth.vue index 616edb7..c49b2ef 100644 --- a/src/views/permission/role/auth.vue +++ b/src/views/permission/role/auth.vue @@ -1,21 +1,8 @@ <template> <div class="edit-popup"> - <popup - ref="popupRef" - title="分配权限" - :async="true" - width="550px" - @confirm="handleSubmit" - @close="handleClose" - > - <el-form - class="ls-form" - ref="formRef" - :rules="rules" - :model="formData" - label-width="60px" - v-loading="loading" - > + <popup ref="popupRef" title="分配权限" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose"> + <div>多门店后台</div> + <el-form class="ls-form" ref="formRef" :rules="rules" :model="formData" label-width="60px" v-loading="loading"> <el-scrollbar class="h-[400px] sm:h-[600px]"> <el-form-item label="权限" prop="menu_id"> <div> @@ -23,23 +10,35 @@ <el-checkbox label="全选/不全选" @change="handleSelectAll" /> <el-checkbox v-model="checkStrictly" label="父子联动" /> <div> - <el-tree - ref="treeRef" - :data="menuTree" - :props="{ - label: 'name', - children: 'children' - }" - :check-strictly="!checkStrictly" - node-key="id" - :default-expand-all="isExpand" - show-checkbox - /> + <el-tree ref="treeRef" :data="menuTree" :props="{ + label: 'name', + children: 'children' + }" :check-strictly="!checkStrictly" node-key="id" :default-expand-all="isExpand" + show-checkbox /> </div> </div> </el-form-item> </el-scrollbar> </el-form> + <!-- <div>收银系统</div> + <el-form class="ls-form" ref="formRef" :rules="rules" :model="formData" label-width="60px" v-loading="loading"> + <el-scrollbar class="h-[400px] sm:h-[600px]"> + <el-form-item label="权限" prop="menu_id"> + <div> + <el-checkbox label="展开/折叠" @change="handleExpand" /> + <el-checkbox label="全选/不全选" @change="handleSelectAll" /> + <el-checkbox v-model="checkStrictly" label="父子联动" /> + <div> + <el-tree ref="treeRef" :data="menuTree" :props="{ + label: 'name', + children: 'children' + }" :check-strictly="!checkStrictly" node-key="id" :default-expand-all="isExpand" + show-checkbox /> + </div> + </div> + </el-form-item> + </el-scrollbar> + </el-form> --> </popup> </div> </template> diff --git a/src/views/storesSet/index.vue b/src/views/storesSet/index.vue index 716fa0b..dfd1bd8 100644 --- a/src/views/storesSet/index.vue +++ b/src/views/storesSet/index.vue @@ -15,8 +15,8 @@ <el-switch v-model="formData.status" :active-value="1" :inactive-value="0"></el-switch> </el-form-item> <el-form-item label="营业时间" prop="title"> - <el-time-picker v-model="formData.times" is-range range-separator="-" - start-placeholder="开始时间" end-placeholder="结束时间" value-format="HH:mm:ss" /> + <el-time-picker v-model="formData.times" is-range range-separator="-" start-placeholder="开始时间" + end-placeholder="结束时间" value-format="HH:mm:ss" /> </el-form-item> <el-form-item label="门店地址" prop="title"> <el-row> @@ -100,6 +100,8 @@ const formData = reactive({ city_id: '', area_id: '', street_id: '', + address: "", + title: "", lat: "", lng: "", range: '1', diff --git a/src/views/storesSet/myMap/index.vue b/src/views/storesSet/myMap/index.vue index 989db74..f2c044a 100644 --- a/src/views/storesSet/myMap/index.vue +++ b/src/views/storesSet/myMap/index.vue @@ -1,32 +1,34 @@ <template> - <el-autocomplete class="w-[500px]" v-model="locationInfo.title" @select="handleSelect" - :fetch-suggestions="querySearch" placeholder="请输入详细地址" :trigger-on-focus="false" /> + <el-autocomplete class="w-[500px]" v-model="formData.title" @select="handleSelect" :fetch-suggestions="querySearch" + placeholder="请输入详细地址" :trigger-on-focus="false" /> <el-button type="primary" @click="getLocationByAddress">搜索</el-button> <el-button type="primary" @click="getLocation">当前位置</el-button> <div id="myMap" class="w-[100%] h-[100%]"></div> </template> <script lang="ts" setup> -import { ref, onMounted } from "vue" +import { ref, onMounted, defineProps } from "vue" import { jsonp } from "vue-jsonp" import feedback from '@/utils/feedback' let myMap: any = null //地图对象 var markerLayer: any = null //点标记图层 var geocoder: any = null; //地址解析器 - - -let locationInfo = ref({ - address: "", - title: "", - lat: "", - lng: "" +const props = defineProps({ + formData: { + type: Object, + }, }) +// let locationInfo = ref({ +// address: "", +// title: "", +// lat: "", +// lng: "" - +// }) const initMap = () => { - var center = new window.TMap.LatLng(30.629673, 103.775231) + var center = new window.TMap.LatLng(props.formData.lat, props.formData.lng) myMap = new window.TMap.Map(document.getElementById('myMap'), { center: center, zoom: 15, @@ -37,6 +39,7 @@ const initMap = () => { map: myMap }); geocoder = new window.TMap.service.Geocoder() + if (!props.formData.lat) getLocation() } @@ -69,8 +72,9 @@ const setMarker = async (lat: number, lng: number, isSelect: Boolean = false) => if (isSelect) return var location = new window.TMap.LatLng(lat, lng); let res = await geocoder.getAddress({ location: location }) - locationInfo.value.address = res.result.address - locationInfo.value.title = res.result.formatted_addresses.recommend + console.log(res, 'res') + props.formData.address = res.result.address + props.formData.title = res.result.formatted_addresses.recommend } @@ -87,17 +91,17 @@ const querySearch = async (queryString: string, cb: any) => { } }; const handleSelect = (e) => { - locationInfo.value.title = e.title - locationInfo.value.address = e.address - locationInfo.value.address = e.address - locationInfo.value.lat = e.location.lat - locationInfo.value.lng = e.location.lng + props.formData.title = e.title + props.formData.address = e.address + props.formData.address = e.address + props.formData.lat = e.location.lat + props.formData.lng = e.location.lng setMarker(e.location.lat, e.location.lng, true) } // 地址解析坐标 const getLocationByAddress = async () => { - let res = await jsonp(`https://apis.map.qq.com/ws/geocoder/v1/?key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&address=${locationInfo.value.address}&output=jsonp`); + let res = await jsonp(`https://apis.map.qq.com/ws/geocoder/v1/?key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&address=${props.formData.address}&output=jsonp`); if (!res.result) return feedback.msgError("位置搜索失败,请重新输入或手动选择") setMarker(res.result.location.lat, res.result.location.lng) }