This commit is contained in:
@@ -72,10 +72,9 @@
|
|||||||
"node": true
|
"node": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:vue/essential",
|
"plugin:vue/strongly-recommended",
|
||||||
"@vue/prettier"
|
"@vue/prettier"
|
||||||
],
|
],
|
||||||
"rules": {},
|
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"parser": "babel-eslint"
|
"parser": "babel-eslint"
|
||||||
}
|
}
|
||||||
@@ -88,4 +87,4 @@
|
|||||||
"browserslist": [
|
"browserslist": [
|
||||||
"defaults"
|
"defaults"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
|
||||||
tagSearchEntry:
|
|
||||||
{{ tagSearchEntry }}<br />
|
|
||||||
value:{{ value }}
|
|
||||||
</div>
|
|
||||||
<span class="v-label v-label--active theme--light">
|
<span class="v-label v-label--active theme--light">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</span>
|
</span>
|
||||||
<v-autocomplete
|
<v-autocomplete
|
||||||
v-bind:value="value"
|
:value="value"
|
||||||
v-on:input="input($event)"
|
@input="input($event)"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:items="sourcetags"
|
:items="sourcetags"
|
||||||
:loading="tagSearchUnderway"
|
:loading="tagSearchUnderway"
|
||||||
@@ -41,11 +36,8 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
beforeUpdate() {
|
beforeUpdate() {
|
||||||
// if(this.value==null){
|
|
||||||
// this.value=[];
|
|
||||||
// }
|
|
||||||
//Set the initial list items based on the record items, this only needs to be called once at init
|
//Set the initial list items based on the record items, this only needs to be called once at init
|
||||||
if (!this.initialized && this.value!=null && this.value.length > 0) {
|
if (!this.initialized && this.value != null && this.value.length > 0) {
|
||||||
this.sourcetags = this.value;
|
this.sourcetags = this.value;
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
}
|
}
|
||||||
@@ -60,11 +52,11 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
default: [],
|
default: [],
|
||||||
type: Array
|
type: Array
|
||||||
},
|
},
|
||||||
// value: Array,
|
// value: Array,
|
||||||
label: String,
|
label: String,
|
||||||
readonly: { type: Boolean, default: false }
|
readonly: { type: Boolean, default: false }
|
||||||
},
|
},
|
||||||
@@ -80,7 +72,7 @@ export default {
|
|||||||
|
|
||||||
//We never expect there to be no data here
|
//We never expect there to be no data here
|
||||||
if (!res.hasOwnProperty("data")) {
|
if (!res.hasOwnProperty("data")) {
|
||||||
throw new Error(res);
|
throw new Error(res);
|
||||||
}
|
}
|
||||||
//adding this to the property will automatically have it cached by the autocomplete component
|
//adding this to the property will automatically have it cached by the autocomplete component
|
||||||
//as cache-items has been set so this just needs to be set here once and all is well in future
|
//as cache-items has been set so this just needs to be set here once and all is well in future
|
||||||
@@ -101,38 +93,29 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
offerAdd(){
|
offerAdd() {
|
||||||
if(this.tagSearchEntry==null || this.tagSearchEntry==""){
|
if (this.tagSearchEntry == null || this.tagSearchEntry == "") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let searchTag=this.normalizeTag(this.tagSearchEntry);
|
let searchTag = this.normalizeTag(this.tagSearchEntry);
|
||||||
|
if (this.value.some((z) => z == searchTag)) return false;
|
||||||
if (
|
|
||||||
!editItem.filter.items.some(
|
|
||||||
z => z.op == filterItem.op && z.value == filterItem.value
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
console.log("offerAdd",{searchtag:searchTag,val:this.value});
|
|
||||||
if(this.value.some)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
},
|
},
|
||||||
input(e){
|
input(e) {
|
||||||
console.log("input",e);
|
console.log("input", e);
|
||||||
this.tagSearchEntry = "";
|
this.tagSearchEntry = "";
|
||||||
this.$emit('input', e)
|
this.$emit("input", e);
|
||||||
},
|
},
|
||||||
addTag() {
|
addTag() {
|
||||||
let theTag = this.tagSearchEntry;
|
let theTag = this.tagSearchEntry;
|
||||||
theTag = this.normalizeTag(theTag);
|
theTag = this.normalizeTag(theTag);
|
||||||
this.sourcetags.push(theTag);
|
this.sourcetags.push(theTag);
|
||||||
this.value.push(theTag);
|
this.value.push(theTag);
|
||||||
this.tagSearchEntry = "";
|
this.tagSearchEntry = "";
|
||||||
this.$emit("input", this.value);
|
this.$emit("input", this.value);
|
||||||
},
|
},
|
||||||
normalizeTag(tagName) {
|
normalizeTag(tagName) {
|
||||||
return window.$gz.util.normalizeTag(tagName);
|
return window.$gz.util.normalizeTag(tagName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user