2020-01-03 17:17:09 +08:00
|
|
|
<template key="panelBox">
|
2020-01-20 21:25:55 +08:00
|
|
|
<transition name="right-box-580">
|
2020-01-06 17:10:57 +08:00
|
|
|
<div class="right-box right-box-panel z-top" v-if="rightBox.show">
|
2020-01-03 17:17:09 +08:00
|
|
|
<!-- begin--顶部按钮-->
|
|
|
|
|
<div class="right-box-top-btns">
|
2020-01-20 17:32:03 +08:00
|
|
|
<button type="button" v-if="panel.id != ''" @click="del(panel)" class="nz-btn nz-btn-size-normal nz-btn-size-alien nz-btn-style-light nz-btn-min-width-82">
|
|
|
|
|
<span class="right-box-top-btn-icon"><i class="el-icon-delete"></i></span>
|
|
|
|
|
<span class="right-box-top-btn-txt">{{$t('overall.delete')}}</span>
|
2020-01-03 17:17:09 +08:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- end--顶部按钮-->
|
|
|
|
|
|
|
|
|
|
<!-- begin--标题-->
|
|
|
|
|
<div class="right-box-title">{{rightBox.title}}</div>
|
|
|
|
|
<!-- end--标题-->
|
|
|
|
|
|
|
|
|
|
<!-- begin--表单-->
|
2020-01-20 17:32:03 +08:00
|
|
|
<el-scrollbar class="right-box-form-box">
|
|
|
|
|
<el-form class="right-box-form" :model="panel" label-position="top" ref="panelForm">
|
2020-02-07 19:57:39 +08:00
|
|
|
<el-form-item :label='$t("overall.name")' prop="name" :rules="{required: true, message: $t('validate.required'), trigger: 'blur'}">
|
2020-01-20 17:32:03 +08:00
|
|
|
<el-input placeholder="" maxlength="64" show-word-limit v-model="panel.name" size="small" ></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-scrollbar>
|
2020-01-03 17:17:09 +08:00
|
|
|
<!-- end--表单-->
|
|
|
|
|
|
|
|
|
|
<!-- begin--底部按钮-->
|
|
|
|
|
<div class="right-box-bottom-btns">
|
2020-02-17 17:29:15 +08:00
|
|
|
<button @click="esc" id="module-box-esc" class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-min-width-100">
|
2020-01-20 17:32:03 +08:00
|
|
|
<span>{{$t('overall.cancel')}}</span>
|
|
|
|
|
</button>
|
2020-02-17 17:29:15 +08:00
|
|
|
<button @click="save" id="module-box-save" class="nz-btn nz-btn-size-normal nz-btn-style-normal nz-btn-min-width-100">
|
2020-01-20 17:32:03 +08:00
|
|
|
<span>{{$t('overall.save')}}</span>
|
|
|
|
|
</button>
|
2020-01-03 17:17:09 +08:00
|
|
|
</div>
|
|
|
|
|
<!-- end--底部按钮-->
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</transition>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
name: "panelBox",
|
|
|
|
|
props: {
|
|
|
|
|
panel: Object
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
rightBox: { //面板弹出框相关
|
|
|
|
|
show: false,
|
|
|
|
|
title: this.$t('dashboard.panel.createPanelTitle')
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
show(show) {
|
|
|
|
|
this.rightBox.show = show;
|
|
|
|
|
},
|
|
|
|
|
setTitle(title) {
|
|
|
|
|
this.rightBox.title = title;
|
|
|
|
|
},
|
|
|
|
|
//面板相关方法
|
|
|
|
|
del: function(u) {
|
|
|
|
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
|
|
|
|
confirmButtonText: this.$t("tip.yes"),
|
|
|
|
|
cancelButtonText: this.$t("tip.no"),
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.$delete("panel?ids=" + u.id).then(response => {
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
this.esc();
|
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
|
|
|
|
this.$emit("reloadForDel");
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
save: function() {
|
2020-01-20 17:32:03 +08:00
|
|
|
this.$refs.panelForm.validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.panel.id) {
|
|
|
|
|
this.$put('panel', this.panel).then(response => {
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
this.esc();
|
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
|
|
|
|
|
this.$emit("reload");
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
}
|
|
|
|
|
});
|
2020-01-03 17:17:09 +08:00
|
|
|
} else {
|
2020-01-20 17:32:03 +08:00
|
|
|
this.$post('panel', this.panel).then(response => {
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
this.esc();
|
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
|
2020-02-06 18:50:40 +08:00
|
|
|
this.$emit("reload", this.panel.name);
|
2020-01-20 17:32:03 +08:00
|
|
|
} else {
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
}
|
|
|
|
|
});
|
2020-01-03 17:17:09 +08:00
|
|
|
}
|
2020-01-20 17:32:03 +08:00
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
2020-01-03 17:17:09 +08:00
|
|
|
},
|
|
|
|
|
esc: function() {
|
|
|
|
|
this.rightBox.show = false;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
mounted: function() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2020-01-06 17:10:57 +08:00
|
|
|
.z-top{
|
2020-02-07 19:57:39 +08:00
|
|
|
z-index: 3000 !important;
|
2020-01-06 17:10:57 +08:00
|
|
|
}
|
2020-01-03 17:17:09 +08:00
|
|
|
</style>
|