build / build (push) Successful in 10m17s
- 同步仓库 CI 配置 .gitea/workflows/build.yml - 纳入 src/public/config/scripts 等工程文件 - .gitignore 增加 .scratch/.backup/.trash,排除本地临时产物
169 lines
4.2 KiB
Vue
169 lines
4.2 KiB
Vue
<template>
|
|
<div class="type_set-box">
|
|
<div class="type_name">
|
|
<i class="iconfont icon-stop fl mr-10" v-if="!isEdit && !active" style="color: #ff5959"></i>
|
|
<Input v-if="isEdit" v-model="type.name" ref="type_input" @on-blur="update" @on-enter="update" />
|
|
<span v-else class="fl">{{ type.name }}</span>
|
|
</div>
|
|
<div class="type_action flex">
|
|
<div class="action_item" @click="open">
|
|
<span v-if="active">停用</span>
|
|
<span v-else>启用</span>
|
|
</div>
|
|
<div class="action_edit" @click="edit">
|
|
<span>编辑</span>
|
|
</div>
|
|
<div class="action_delete" @click="remove">
|
|
<span>删除</span>
|
|
</div>
|
|
</div>
|
|
<div class="divider"></div>
|
|
<div class="divider2"></div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: "TypeSetBox",
|
|
props: {
|
|
type: {
|
|
name: { type: String, default: "" },
|
|
id: { type: String, default: "" },
|
|
},
|
|
active: { type: Boolean, default: true },
|
|
},
|
|
data() {
|
|
return {
|
|
isEdit: false,
|
|
eventType: "",
|
|
};
|
|
},
|
|
watch: {
|
|
type: {
|
|
deep: true,
|
|
handler(newVal) {
|
|
if (this.isEdit) {
|
|
this.isEdit = false;
|
|
}
|
|
},
|
|
},
|
|
"type.name"(newVal) {
|
|
if (this.isEdit) {
|
|
this.isEdit = false;
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
open() {
|
|
this.$emit("active", this.type.id);
|
|
},
|
|
edit() {
|
|
this.isEdit = !this.isEdit;
|
|
if (this.isEdit) this.$nextTick(() => this.$refs["type_input"].focus());
|
|
},
|
|
update(e) {
|
|
if (!this.type.name) {
|
|
this.$Message.error("值不得为空!");
|
|
return;
|
|
}
|
|
|
|
if (this.eventType == "") {
|
|
this.eventType = e.type;
|
|
this.isEdit = false;
|
|
this.$emit("edit", this.type.id, this.type.name);
|
|
setTimeout(() => {
|
|
this.eventType = "";
|
|
}, 500);
|
|
}
|
|
},
|
|
remove() {
|
|
this.$emit("remove", this.type.id);
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.flex {
|
|
display: flex;
|
|
}
|
|
.type_set-box {
|
|
width: 222px;
|
|
background: #ffffff;
|
|
margin-right: 15px;
|
|
margin-bottom: 15px;
|
|
.type_name {
|
|
height: 66px;
|
|
border: 1px solid #e9e9e9;
|
|
border-bottom: none;
|
|
padding-left: 15px;
|
|
padding-right: 15px;
|
|
line-height: 66px;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
span {
|
|
height: 24px;
|
|
font-size: 15px;
|
|
font-family: PingFangSC-Semibold, PingFang SC;
|
|
font-weight: 500;
|
|
color: #272829;
|
|
line-height: 24px;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
width: 222px;
|
|
display: inline-block;
|
|
}
|
|
.iconfont {
|
|
font-size: 26px;
|
|
}
|
|
}
|
|
.type_action {
|
|
flex-wrap: wrap;
|
|
justify-content: center;
|
|
align-items: center;
|
|
width: 222px;
|
|
height: 30px;
|
|
line-height: 30px;
|
|
background: #f7f7f7;
|
|
border-radius: 0px 0px 2px 2px;
|
|
border-top: none;
|
|
border: 1px solid #e9e9e9;
|
|
span {
|
|
font-size: 12px;
|
|
}
|
|
|
|
div {
|
|
cursor: pointer;
|
|
flex: 1;
|
|
text-align: center;
|
|
}
|
|
div:hover {
|
|
color: #6c91f0;
|
|
}
|
|
}
|
|
.divider {
|
|
// position: relative;
|
|
height: 14px;
|
|
width: 1px;
|
|
background: #e8e8e8;
|
|
// left: 73px;
|
|
// top: -23px;
|
|
float: left;
|
|
margin-left: 71px;
|
|
margin-top: -22px;
|
|
}
|
|
.divider2 {
|
|
// position: relative;
|
|
// left: 146px;
|
|
// top: -37px;
|
|
height: 14px;
|
|
width: 1px;
|
|
background: #e8e8e8;
|
|
float: left;
|
|
margin-left: 147px;
|
|
margin-top: -22px;
|
|
}
|
|
}
|
|
</style> |