feat (接口定义): 完善操作历史代码
This commit is contained in:
parent
bb2e85c418
commit
960acf52b3
|
@ -6,8 +6,7 @@
|
|||
<el-col class="kv-checkbox" v-if="isShowEnable">
|
||||
<el-checkbox v-if="!isDisable(index)" v-model="item.enable" :disabled="isReadOnly"/>
|
||||
</el-col>
|
||||
<span style="margin-left: 10px" v-else></span>
|
||||
|
||||
<span style="margin-left: 10px" v-else/>
|
||||
<el-col class="item">
|
||||
<input class="el-input el-input__inner" v-if="!suggestions" :disabled="isReadOnly" v-model="item.name" size="small" maxlength="200" show-word-limit :style="item.style"/>
|
||||
<el-autocomplete :disabled="isReadOnly" :maxlength="400" v-if="suggestions" v-model="item.name" size="small" show-word-limit :style="item.style"/>
|
||||
|
@ -29,6 +28,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
const background_new = "background:#F3E6E7;";
|
||||
const background_old = "background:#E2ECDC";
|
||||
export default {
|
||||
name: "MsApiKeyValueDetail",
|
||||
components: {},
|
||||
|
@ -111,13 +112,13 @@ export default {
|
|||
if (itemStr.indexOf("--name") !== -1) {
|
||||
itemStr = itemStr.replaceAll("--", "");
|
||||
let obj = JSON.parse(itemStr);
|
||||
obj.style = "background:#F3E6E7;text-decoration:line-through;text-decoration-color:red";
|
||||
obj.style = background_new;
|
||||
obj.box = true;
|
||||
this.data.push(obj);
|
||||
} else if (itemStr.indexOf("++name") !== -1) {
|
||||
itemStr = itemStr.replaceAll("++", "");
|
||||
let obj = JSON.parse(itemStr);
|
||||
obj.style = "background:#E2ECDC";
|
||||
obj.style = background_old;
|
||||
this.data.push(obj);
|
||||
} else if (itemStr.indexOf("**") !== -1) {
|
||||
itemMap.forEach(function (value, key) {
|
||||
|
@ -129,10 +130,10 @@ export default {
|
|||
newObj[key] = value;
|
||||
}
|
||||
});
|
||||
item.style = "background:#E2ECDC";
|
||||
item.style = background_old;
|
||||
this.data.push(item);
|
||||
newObj["box"] = true;
|
||||
newObj["style"] = "background:#F3E6E7;text-decoration:line-through;text-decoration-color:red";
|
||||
newObj["style"] = background_new;
|
||||
newObj["required"] = newObj.required ? this.$t('commons.selector.required') : this.$t('commons.selector.not_required');
|
||||
this.data.push(newObj);
|
||||
} else {
|
||||
|
|
|
@ -6,27 +6,22 @@
|
|||
|
||||
<el-tag
|
||||
:class="getClass(tag)"
|
||||
v-for="(tag, idx) in innerTags"
|
||||
v-for="(tag) in innerTags"
|
||||
v-bind="$attrs"
|
||||
type="info"
|
||||
:key="tag"
|
||||
:size="size"
|
||||
:closable="!readOnly"
|
||||
:disable-transitions="false"
|
||||
@close="remove(idx)">
|
||||
:disable-transitions="false">
|
||||
{{ getTag(tag) }}
|
||||
</el-tag>
|
||||
<input
|
||||
:disabled="readOnly"
|
||||
class="tag-input el-input"
|
||||
v-model="newTag"
|
||||
:placeholder="$t('commons.tag_tip')"
|
||||
@keydown.delete.stop="removeLastTag"
|
||||
@keydown="addNew"
|
||||
@blur="addNew"/>
|
||||
:placeholder="$t('commons.tag_tip')"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'MsInputTag',
|
||||
|
@ -63,53 +58,6 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
addNew(e) {
|
||||
if (e && (!this.addTagOnKeys.includes(e.keyCode)) && (e.type !== 'blur')) {
|
||||
return
|
||||
}
|
||||
if (e) {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
}
|
||||
let addSuccess = false
|
||||
if (this.newTag.includes(',')) {
|
||||
this.newTag.split(',').forEach(item => {
|
||||
if (this.addTag(item.trim())) {
|
||||
addSuccess = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (this.addTag(this.newTag.trim())) {
|
||||
addSuccess = true
|
||||
}
|
||||
}
|
||||
if (addSuccess) {
|
||||
this.tagChange()
|
||||
this.newTag = ''
|
||||
}
|
||||
},
|
||||
addTag(tag) {
|
||||
tag = tag.trim()
|
||||
if (tag && !this.innerTags.includes(tag)) {
|
||||
this.innerTags.push(tag)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
remove(index) {
|
||||
this.innerTags.splice(index, 1)
|
||||
this.tagChange()
|
||||
},
|
||||
removeLastTag() {
|
||||
if (this.newTag) {
|
||||
return
|
||||
}
|
||||
this.innerTags.pop()
|
||||
this.tagChange()
|
||||
},
|
||||
tagChange() {
|
||||
this.$emit('input', this.innerTags)
|
||||
},
|
||||
getTag(tag) {
|
||||
if (tag && (tag.indexOf("++") !== -1 || tag.indexOf("--") !== -1)) {
|
||||
tag = tag.substring(2);
|
||||
|
@ -182,7 +130,7 @@ export default {
|
|||
}
|
||||
|
||||
.ms-tag-del {
|
||||
text-decoration:line-through;
|
||||
text-decoration: line-through;
|
||||
text-decoration-color: red;
|
||||
-moz-text-decoration-line: line-through;
|
||||
background: #F3E6E7;
|
||||
|
|
Loading…
Reference in New Issue