Browse Source

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!637
李园 1 năm trước cách đây
mục cha
commit
e2150a0d49

+ 26 - 10
src/components/popover-select-v2/index.vue

@@ -84,17 +84,17 @@ export default {
         return this.value;
       },
       set(value) {
-        const {
-          $props: { source, dataMapping },
-        } = this;
+        // const {
+        //   $props: { source, dataMapping },
+        // } = this;
 
-        for (let key in dataMapping) {
-          if (dataMapping[key] === "id" || dataMapping[key] === "code") {
-            if (source[key] && source[key] !== "") {
-              source[key] = undefined;
-            }
-          }
-        }
+        // for (let key in dataMapping) {
+        //   if (dataMapping[key] === "id" || dataMapping[key] === "code") {
+        //     if (source[key] && source[key] !== "") {
+        //       source[key] = undefined;
+        //     }
+        //   }
+        // }
         this.$emit("input", value);
       },
     },
@@ -251,6 +251,21 @@ export default {
     handleClear() {
       this.innerValue = "";
     },
+    handleKeyupDel() {
+      console.log("focus");
+      const {
+        $props: { source, dataMapping },
+      } = this;
+
+      for (let key in dataMapping) {
+        if (dataMapping[key] === "id" || dataMapping[key] === "code") {
+          if (source[key] && source[key] !== "") {
+            source[key] = undefined;
+          }
+        }
+      }
+    },
+
   },
   created() {},
   mounted() {},
@@ -269,6 +284,7 @@ export default {
       @clear="handleClear"
       @change="handleChange"
       @keyup.enter.native="handleChange"
+      @keyup.delete.native="handleKeyupDel"
     >
       <i :size="size" class="el-icon-search" slot="suffix" @click="open"> </i>
     </el-input>

+ 27 - 12
src/components/popover-select/index.vue

@@ -109,18 +109,18 @@ export default {
         return multiple ? "" : value;
       },
       set(val) {
-        const {
-          $props: { source, dataMapping, multiple },
-        } = this;
-        if (!multiple) {
-          for (let key in dataMapping) {
-            if (dataMapping[key] === "id" || dataMapping[key] === "code") {
-              if (source[key] && source[key] !== "") {
-                source[key] = undefined;
-              }
-            }
-          }
-        }
+        // const {
+        //   $props: { source, dataMapping, multiple },
+        // } = this;
+        // if (!multiple) {
+        //   for (let key in dataMapping) {
+        //     if (dataMapping[key] === "id" || dataMapping[key] === "code") {
+        //       if (source[key] && source[key] !== "") {
+        //         source[key] = undefined;
+        //       }
+        //     }
+        //   }
+        // }
 
         this.$emit("input", val);
       },
@@ -325,6 +325,20 @@ export default {
         }
       }
     },
+    handleKeyupDel() {
+      console.log("focus");
+      const {
+        $props: { source, dataMapping },
+      } = this;
+
+      for (let key in dataMapping) {
+        if (dataMapping[key] === "id" || dataMapping[key] === "code") {
+          if (source[key] && source[key] !== "") {
+            source[key] = undefined;
+          }
+        }
+      }
+    },
   },
   created() {},
   mounted() {},
@@ -344,6 +358,7 @@ export default {
       @clear="handleClear"
       @change="handleChange"
       @keyup.enter.native="handleChange"
+      @keyup.delete.native="handleKeyupDel"
     >
       <i :size="size" class="el-icon-search" slot="suffix" @click="open"> </i>
     </el-input>