whj 7 месяцев назад
Родитель
Сommit
cf1204d7a5

+ 1 - 1
src/layouts/BasicLayout.vue

@@ -58,7 +58,7 @@
       </a-layout>
     </template>
     <template v-else>
-      <a-layout :class="[layoutMode, `content-width-${contentWidth}`]" :style="{ paddingLeft: contentPaddingLeft, minHeight: '100vh' }">
+      <a-layout :class="[layoutMode, `content-width-${contentWidth}`]" :style="{minHeight: '100vh' }">
         <!-- layout header -->
         <MixGlobalHeader
           :mode="layoutMode"

+ 2 - 2
src/views/sb/info/modules/BaseForm.vue

@@ -339,13 +339,13 @@
         </a-col>
         <a-col :lg="12" :md="24" :sm="24">
           <a-form-item label="水平位置" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-            <a-input-number :step="1" :min="85" style="width:70%" v-decorator="['zjm']" placeholder="请输入离屏幕左上角的右方距离,最低85" />
+            <a-input-number :step="1" :min="0" style="width:70%" v-decorator="['zjm']" placeholder="请选择" />
             <a-button style="width: 30%" type="primary" @click="handlePoint">设置预览</a-button>
           </a-form-item>
         </a-col>
         <a-col :lg="12" :md="24" :sm="24">
           <a-form-item label="垂直位置" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-            <a-input-number :step="1" :min="340" style="width:70%" v-decorator="['jbdh']" placeholder="请输入离屏幕左上角的下方位置,最低340" />
+            <a-input-number :step="1" :min="0" style="width:70%" v-decorator="['jbdh']" placeholder="请选择" />
             <a-button style="width: 30%" type="primary" @click="handlePoint">设置预览</a-button>
           </a-form-item>
         </a-col>

+ 16 - 16
src/views/sb/info/modules/PointModal.vue

@@ -29,7 +29,7 @@
 import { fetchSbPosition } from '@/api/sb/position'
 export default {
   name: 'PointModal',
-  data() {
+  data () {
     return {
       confirmLoading: false,
       modalTitle: null,
@@ -37,15 +37,15 @@ export default {
       y: null,
       visible: false,
       record: {},
-      url: null,
+      url: null
     }
   },
   props: {},
-  created() {
+  created () {
     // 下拉框map
   },
   methods: {
-    base(record) {
+    base (record) {
       this.visible = true
       // 如果是空标识添加
       this.modalTitle = '选择点位'
@@ -53,35 +53,35 @@ export default {
       this.y = record.jbdh
       this.record = record
       this.$nextTick(() => {
-        this.$refs.point.style.left = this.x + 'px'
-        this.$refs.point.style.top = this.y + 'px'
+        this.$refs.point.style.left = `calc(${this.x}% - 5px)`
+        this.$refs.point.style.top = `calc(${this.y}% - 5px)`
         fetchSbPosition({ id: record.positionId }).then((res) => {
           this.url = res.data.opcImg
         })
       })
     },
-    save() {
+    save () {
       this.$emit('ok', {
         zjm: this.x,
-        jbdh: this.y,
+        jbdh: this.y
       })
       this.visible = false
     },
-    handleSelectPoint(e) {
-      this.x = e.layerX
-      this.y = e.layerY
-      this.$refs.point.style.left = this.x + 'px'
-      this.$refs.point.style.top = this.y + 'px'
+    handleSelectPoint (e) {
+      this.x = +(e.offsetX * 100 / e.target.width).toFixed(2)
+      this.y = +(e.offsetY * 100 / e.target.height).toFixed(2)
+      this.$refs.point.style.left = e.offsetX - 5 + 'px'
+      this.$refs.point.style.top = e.offsetY - 5 + 'px'
     },
-    handleCancel(values) {
+    handleCancel (values) {
       this.visible = false
       this.$emit('ok')
       this.x = null
       this.y = null
       this.record = null
       this.confirmLoading = false
-    },
-  },
+    }
+  }
 }
 </script>
 <style lang="less" scoped>