whj 7 달 전
부모
커밋
314af8dc43
2개의 변경된 파일10개의 추가작업 그리고 7개의 파일을 삭제
  1. 5 2
      src/views/store/store/modules/BaseForm.vue
  2. 5 5
      src/views/store/store/modules/PositionMap.vue

+ 5 - 2
src/views/store/store/modules/BaseForm.vue

@@ -163,7 +163,7 @@
                   />
                 </a-col>
                 <a-col :span="4">
-                  <a-button :disabled="!opcImg" @click="openPositionMap" type="primary">选择</a-button>
+                  <a-button @click="openPositionMap" type="primary">选择</a-button>
                 </a-col>
               </a-row>
             </a-input-group>
@@ -395,13 +395,16 @@ export default {
       }
     },
     openPositionMap () {
+      if (!this.opcImg) {
+        this.$message.info('请先选择所属厂区或所属仓库!')
+        return
+      }
       const { form: { getFieldsValue } } = this
       this.$refs.position.base(getFieldsValue(['positionY',
         'positionX']))
     },
     handleSelectPosition (val) {
       const { form: { setFieldsValue } } = this
-
       this.$nextTick(() => {
         setFieldsValue(Object.assign(pick(val, [
           'positionY',

+ 5 - 5
src/views/store/store/modules/PositionMap.vue

@@ -9,7 +9,8 @@
   >
     <div style="position: relative;">
       <div class="point" ref="point" />
-      <img @click="handleSelect" :src="opcImg" width="100%" alt="">
+      <img v-if="opcImg" @click="handleSelect" :src="opcImg" width="100%" alt="">
+      <a-empty v-else description="暂无底图,请上传" />
     </div>
   </a-modal>
 </template>
@@ -36,12 +37,11 @@ export default {
         positionX: 0,
         positionY: 0
       }
-      // calc(~"50% - 5px")
+      // calc(50% - 5px)
       if (record.positionX && record.positionY) this.position = { ...record }
       this.$nextTick(() => {
-        console.log(this.$refs.point.style, this.position)
-        this.$refs.point.style.left = `calc(~"${this.position.positionX}% - 5px")`
-        this.$refs.point.style.top = `calc(~"${this.position.positionY}% - 5px")`
+        this.$refs.point.style.left = `calc(${this.position.positionX}% - 5px)`
+        this.$refs.point.style.top = `calc(${this.position.positionY}% - 5px)`
       })
     },
     handleSelect (e) {