Commit a4d2c6db authored by 周远喜's avatar 周远喜

ok

parent 3488f24a
......@@ -21,7 +21,7 @@ export default {
},
value: {
type: String,
default: '2001-01-01 00:00:00'
default: ''
},
},
created() {
......
<template>
<Tooltip trigger="hover" v-if="title" :content="title" placement="top-end">
<Tooltip trigger="hover" v-if="title" :content="title" placement="top-end">
<a class="op" :class="css" @click="handler">
<slot>
<Icon v-if="type=='icon'" :type="icon" :color="color" />
<span v-else="type=='text'" v-text="text"></span>
</slot>
<slot>
<Icon v-if="type == 'icon'" :type="icon" :color="color" />
<span v-else="type == 'text'" v-text="text"></span>
</slot>
</a>
</Tooltip>
<a class="op" v-else :class="css" @click="handler">
</Tooltip>
<a class="op" v-else :class="css" @click="handler">
<slot>
<Icon v-if="type=='icon'" :type="icon" :color="color" />
<span v-else="type=='text'" v-text="text"></span>
<Icon v-if="type == 'icon'" :type="icon" :color="color" />
<span v-else="type == 'text'" v-text="text"></span>
</slot>
</a>
</a>
</template>
<script>
export default {
name: "op",
props: {
icon: {
type: String
},
oprate: {
type: String
},
type: {
type: String,
default: "text"
},
title: {
type: String,
},
msg: {
type: String,
default: "确认要删除吗?"
},
color: {
type: String
}
name: "op",
props: {
icon: {
type: String,
},
oprate: {
type: String,
},
type: {
type: String,
default: "text",
},
title: {
type: String,
},
msg: {
type: String,
default: "确认要删除吗?",
},
data() {
return {
text: "",
css: "detail"
};
color: {
type: String,
},
created() {
var oprates = {
detail: "查看",
edit: "编辑",
add: "添加",
delete: "删除",
remove: "删除"
};
disalbed: {
// 0 启用 1 禁用 2权限不足
type: Number,
default: 0,
},
},
data() {
return {
text: "",
css: "detail",
};
},
created() {
var oprates = {
detail: "查看",
edit: "编辑",
add: "添加",
delete: "删除",
remove: "删除",
};
if (oprates[this.oprate]) {
this.text = oprates[this.oprate];
this.css = this.oprate;
} else if (this.oprate) {
this.css = this.oprate;
} else if (this.type == "icon") {
this.css = "icon";
if (oprates[this.oprate]) {
this.text = oprates[this.oprate];
this.css = this.oprate;
} else if (this.oprate) {
this.css = this.oprate;
} else if (this.type == "icon") {
this.css = "icon";
}
},
methods: {
handler() {
if (this.disalbed == 0) {
if (this.oprate == "delete" || this.oprate == "remove") {
this.$Modal.confirm({
title: this.title,
content: "<p>" + this.msg + "</p>",
onOk: () => {
this.$emit("click", event);
},
});
} else {
this.$emit("click", event);
}
}else if(this.disabled==1){
this.$Message.info("不能操作")
}else{
this.$Message.info("没有权限")
}
},
methods: {
handler() {
if (this.oprate == "delete" || this.oprate == "remove") {
this.$Modal.confirm({
title: this.title,
content: "<p>" + this.msg + "</p>",
onOk: () => {
this.$emit("click", event);
}
});
} else {
this.$emit("click", event);
}
}
}
},
};
</script>
<style lang="less">
a.op {
display: inline;
margin: 0 3px;
display: inline;
margin: 0 3px;
}
</style>
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment