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

ok

parent 3488f24a
...@@ -21,7 +21,7 @@ export default { ...@@ -21,7 +21,7 @@ export default {
}, },
value: { value: {
type: String, type: String,
default: '2001-01-01 00:00:00' default: ''
}, },
}, },
created() { created() {
......
<template> <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"> <a class="op" :class="css" @click="handler">
<slot> <slot>
<Icon v-if="type=='icon'" :type="icon" :color="color" /> <Icon v-if="type == 'icon'" :type="icon" :color="color" />
<span v-else="type=='text'" v-text="text"></span> <span v-else="type == 'text'" v-text="text"></span>
</slot> </slot>
</a> </a>
</Tooltip> </Tooltip>
<a class="op" v-else :class="css" @click="handler"> <a class="op" v-else :class="css" @click="handler">
<slot> <slot>
<Icon v-if="type=='icon'" :type="icon" :color="color" /> <Icon v-if="type == 'icon'" :type="icon" :color="color" />
<span v-else="type=='text'" v-text="text"></span> <span v-else="type == 'text'" v-text="text"></span>
</slot> </slot>
</a> </a>
</template> </template>
<script> <script>
export default { export default {
name: "op", name: "op",
props: { props: {
icon: { icon: {
type: String type: String,
}, },
oprate: { oprate: {
type: String type: String,
}, },
type: { type: {
type: String, type: String,
default: "text" default: "text",
}, },
title: { title: {
type: String, type: String,
}, },
msg: { msg: {
type: String, type: String,
default: "确认要删除吗?" default: "确认要删除吗?",
},
color: {
type: String
}
}, },
data() { color: {
return { type: String,
text: "",
css: "detail"
};
}, },
created() { disalbed: {
var oprates = { // 0 启用 1 禁用 2权限不足
detail: "查看", type: Number,
edit: "编辑", default: 0,
add: "添加", },
delete: "删除", },
remove: "删除" data() {
}; return {
text: "",
css: "detail",
};
},
created() {
var oprates = {
detail: "查看",
edit: "编辑",
add: "添加",
delete: "删除",
remove: "删除",
};
if (oprates[this.oprate]) { if (oprates[this.oprate]) {
this.text = oprates[this.oprate]; this.text = oprates[this.oprate];
this.css = this.oprate; this.css = this.oprate;
} else if (this.oprate) { } else if (this.oprate) {
this.css = this.oprate; this.css = this.oprate;
} else if (this.type == "icon") { } else if (this.type == "icon") {
this.css = "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> </script>
<style lang="less"> <style lang="less">
a.op { a.op {
display: inline; display: inline;
margin: 0 3px; margin: 0 3px;
} }
</style> </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