|
@@ -298,6 +298,34 @@ export default {
|
|
|
const { type, source } = this.$props;
|
|
|
this.$emit("copyChange", this.innerValue.split(/,|,|\s+/));
|
|
|
},
|
|
|
+ useBlur() {
|
|
|
+ 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] === "") {
|
|
|
+ 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() {},
|
|
@@ -326,10 +354,12 @@ export default {
|
|
|
v-bind="$attrs"
|
|
|
v-model="innerValue"
|
|
|
:size="size"
|
|
|
+ :disabled="disabled"
|
|
|
:value-key="valueKey"
|
|
|
:fetch-suggestions="useAutocomplete"
|
|
|
+ @blur="useBlur"
|
|
|
@select="useConfirm([$event])"
|
|
|
- :disabled="disabled"
|
|
|
+ @keyup.delete.native="handleKeyupDel"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
<i :size="size" class="el-icon-search" slot="suffix" @click="open"> </i>
|