position.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <div class="position-com __box-shadow">
  3. <CusTab :tabs="[
  4. {name: '度', value: 'd'},
  5. {name: '度分', value: 'df'},
  6. {name: '度分秒', value: 'dfm'},
  7. ]" v-model:param="cusTransfer.tab" style="padding-left: 12px;"/>
  8. <div class="content">
  9. <div class="item">
  10. <div class="input">
  11. <div class="label">经度:</div>
  12. <template v-if="cusTransfer.tab === 'd'">
  13. <CusFormColumn
  14. link="number"
  15. :decimal="8"
  16. v-model:param="cusTransfer.format.d.lon1"/>
  17. <div class="unit">°</div>
  18. </template>
  19. <template v-else-if="cusTransfer.tab === 'df'">
  20. <CusFormColumn
  21. link="number"
  22. v-model:param="cusTransfer.format.df.lon1"/>
  23. <div class="unit">°</div>
  24. <CusFormColumn
  25. link="number"
  26. v-model:param="cusTransfer.format.df.lon2"/>
  27. <div class="unit">‘</div>
  28. </template>
  29. <template v-else-if="cusTransfer.tab === 'dfm'">
  30. <CusFormColumn
  31. link="number"
  32. v-model:param="cusTransfer.format.dfm.lon1"/>
  33. <div class="unit">°</div>
  34. <CusFormColumn
  35. link="number"
  36. v-model:param="cusTransfer.format.dfm.lon2"/>
  37. <div class="unit">‘</div>
  38. <CusFormColumn
  39. link="number"
  40. v-model:param="cusTransfer.format.dfm.lon3"/>
  41. <div class="unit">"</div>
  42. </template>
  43. </div>
  44. <div class="switch __hover" @click="cusTransfer.format.isEast = !cusTransfer.format.isEast">
  45. <div class="switch-item" :class="{active: cusTransfer.format.isEast}">E</div>
  46. <div class="switch-item" :class="{active: !cusTransfer.format.isEast}">W</div>
  47. </div>
  48. </div>
  49. <div class="item">
  50. <div class="input">
  51. <div class="label">纬度:</div>
  52. <template v-if="cusTransfer.tab === 'd'">
  53. <CusFormColumn
  54. link="number"
  55. :decimal="8"
  56. v-model:param="cusTransfer.format.d.lat1"/>
  57. <div class="unit">°</div>
  58. </template>
  59. <template v-else-if="cusTransfer.tab === 'df'">
  60. <CusFormColumn
  61. link="number"
  62. v-model:param="cusTransfer.format.df.lat1"/>
  63. <div class="unit">°</div>
  64. <CusFormColumn
  65. link="number"
  66. v-model:param="cusTransfer.format.df.lat2"/>
  67. <div class="unit">‘</div>
  68. </template>
  69. <template v-else-if="cusTransfer.tab === 'dfm'">
  70. <CusFormColumn
  71. link="number"
  72. v-model:param="cusTransfer.format.dfm.lat1"/>
  73. <div class="unit">°</div>
  74. <CusFormColumn
  75. link="number"
  76. v-model:param="cusTransfer.format.dfm.lat2"/>
  77. <div class="unit">‘</div>
  78. <CusFormColumn
  79. link="number"
  80. v-model:param="cusTransfer.format.dfm.lat3"/>
  81. <div class="unit">"</div>
  82. </template>
  83. </div>
  84. <div class="switch __hover" @click="cusTransfer.format.isSouth = !cusTransfer.format.isSouth">
  85. <div class="switch-item" :class="{active: cusTransfer.format.isSouth}">S</div>
  86. <div class="switch-item" :class="{active: !cusTransfer.format.isSouth}">N</div>
  87. </div>
  88. </div>
  89. </div>
  90. <div class="buttons">
  91. <div class="__hover">确定</div>
  92. <div class="__hover cancel">取消</div>
  93. </div>
  94. </div>
  95. </template>
  96. <script lang="ts">
  97. import {
  98. defineComponent,
  99. computed,
  100. onMounted,
  101. ref,
  102. reactive,
  103. watch,
  104. getCurrentInstance,
  105. ComponentInternalInstance,
  106. toRefs,
  107. nextTick
  108. } from 'vue'
  109. import {useStore} from 'vuex'
  110. import {useRouter, useRoute} from 'vue-router'
  111. import {ElMessage, ElMessageBox} from "element-plus";
  112. export default defineComponent({
  113. name: '',
  114. components: {},
  115. props: {
  116. map: {
  117. required: true
  118. },
  119. mapFunc: {
  120. required: true
  121. },
  122. transfer: {}
  123. },
  124. setup(props, {emit}) {
  125. const store = useStore();
  126. const router = useRouter();
  127. const route = useRoute();
  128. const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
  129. const state = reactive({
  130. transfer: <any>props.transfer,
  131. cusTransfer: <any>{
  132. tab: 'd',
  133. format: {
  134. d: {
  135. lon1: null,
  136. lat1: null,
  137. },
  138. df: {
  139. lon1: null,
  140. lon2: null,
  141. lat1: null,
  142. lat2: null,
  143. },
  144. dfm: {
  145. lon1: null,
  146. lon2: null,
  147. lon3: null,
  148. lat1: null,
  149. lat2: null,
  150. lat3: null,
  151. },
  152. isEast: true,
  153. isSouth: false,
  154. },
  155. }
  156. })
  157. onMounted(() => {
  158. if (props.transfer) {
  159. state.cusTransfer = props.transfer
  160. } else {
  161. emit('update:transfer', state.cusTransfer)
  162. }
  163. })
  164. return {
  165. ...toRefs(state),
  166. }
  167. },
  168. })
  169. </script>
  170. <style scoped lang="scss">
  171. .position-com {
  172. width: 100%;
  173. background-color: #FFFFFF;
  174. padding-bottom: 12px;
  175. .content {
  176. display: flex;
  177. flex-direction: column;
  178. padding: 0 12px;
  179. margin-top: 12px;
  180. .item {
  181. width: 100%;
  182. display: flex;
  183. align-items: center;
  184. &:not(:last-child) {
  185. margin-bottom: 8px;
  186. }
  187. .input {
  188. display: flex;
  189. align-items: center;
  190. flex: 1;
  191. .label {
  192. width: 44px;
  193. font-size: 14px;
  194. font-family: Microsoft YaHei;
  195. font-weight: 400;
  196. color: #434343;
  197. }
  198. :deep(.cus-form-column) {
  199. flex: 1;
  200. height: 36px;
  201. max-width: unset;
  202. }
  203. .unit {
  204. margin-left: 7px;
  205. margin-right: 12px;
  206. align-self: flex-start;
  207. margin-top: 3px;
  208. }
  209. }
  210. .switch {
  211. width: 50px;
  212. height: 28px;
  213. display: flex;
  214. align-items: center;
  215. justify-content: center;
  216. border: 2px solid #108DF3;
  217. border-radius: 4px;
  218. .switch-item {
  219. width: 16px;
  220. height: 16px;
  221. font-size: 14px;
  222. font-family: Microsoft YaHei;
  223. font-weight: 400;
  224. color: #108DF3;
  225. border-radius: 2px;
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. margin: 0 3px;
  230. &.active {
  231. font-size: 12px;
  232. color: #FFFFFF;
  233. background-color: #108DF3;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. .buttons {
  240. margin-top: 12px;
  241. display: flex;
  242. align-items: center;
  243. justify-content: center;
  244. >div {
  245. width: 80px;
  246. height: 36px;
  247. background-color: #1280F1;
  248. border: 1px solid #1270DA;
  249. border-radius: 2px;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. font-size: 14px;
  254. font-family: Microsoft YaHei;
  255. font-weight: 400;
  256. color: #FFFFFF;
  257. &:not(:last-child) {
  258. margin-right: 10px;
  259. }
  260. }
  261. .cancel {
  262. background-color: #FFFFFF;
  263. border-color: #1270DA;
  264. color: #108DF3;
  265. }
  266. }
  267. }
  268. </style>