2021-03-19 18:52:19 +08:00
|
|
|
<template>
|
2020-01-20 21:25:55 +08:00
|
|
|
<transition name="right-box-580">
|
2021-01-18 18:58:57 +08:00
|
|
|
<div class="right-box right-box-panel z-top" v-if="rightBox.show" v-clickoutside="{obj:panel,func:clickos}">
|
2020-01-03 17:17:09 +08:00
|
|
|
<!-- begin--顶部按钮-->
|
2020-10-15 14:27:46 +08:00
|
|
|
<div class="right-box-top-btns right-box-form-delete">
|
2020-12-08 21:53:37 +08:00
|
|
|
<button @click="del(panel)" class="nz-btn nz-btn-size-normal nz-btn-size-alien nz-btn-min-width-82" type="button" v-has="'panel_delete'" v-if="panel.id != ''">
|
2020-09-10 17:00:32 +08:00
|
|
|
<span class="right-box-top-btn-icon"><i class="nz-icon nz-icon-delete"></i></span>
|
2020-01-20 17:32:03 +08:00
|
|
|
<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-12-14 20:25:24 +08:00
|
|
|
<div class="right-box-form-box">
|
2021-02-09 15:14:19 +08:00
|
|
|
<el-form class="right-box-form right-box-form-left" label-width="120px" :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'}">
|
2021-02-04 11:21:00 +08:00
|
|
|
<el-input placeholder="" maxlength="64" show-word-limit v-model="panel.name" size="small" id="panel-box-input-name"></el-input>
|
2020-01-20 17:32:03 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
2020-12-14 20:25:24 +08:00
|
|
|
</div>
|
2020-01-03 17:17:09 +08:00
|
|
|
<!-- end--表单-->
|
|
|
|
|
|
|
|
|
|
<!-- begin--底部按钮-->
|
|
|
|
|
<div class="right-box-bottom-btns">
|
2021-02-04 11:21:00 +08:00
|
|
|
<button v-cancel="{obj:panel,func:esc}" id="panel-box-esc" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new">
|
2020-01-20 17:32:03 +08:00
|
|
|
<span>{{$t('overall.cancel')}}</span>
|
|
|
|
|
</button>
|
2021-02-04 11:21:00 +08:00
|
|
|
<button :class="{'nz-btn-disabled':prevent_opt.save}" :disabled="prevent_opt.save" @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="panel-box-save">
|
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>
|
2021-03-19 18:52:19 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'panelBox',
|
|
|
|
|
props: {
|
|
|
|
|
panel: Object
|
|
|
|
|
},
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
rightBox: { // 面板弹出框相关
|
|
|
|
|
show: false,
|
|
|
|
|
title: this.$t('dashboard.panel.createPanelTitle')
|
2020-01-03 17:17:09 +08:00
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
show (show) {
|
|
|
|
|
this.rightBox.show = show
|
|
|
|
|
},
|
|
|
|
|
setTitle (title) {
|
|
|
|
|
this.rightBox.title = title
|
2020-01-03 17:17:09 +08:00
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
clickos () {
|
|
|
|
|
this.esc()
|
|
|
|
|
},
|
|
|
|
|
// 面板相关方法
|
|
|
|
|
del: function (u) {
|
|
|
|
|
this.$confirm(this.$t('tip.confirmDelete'), {
|
|
|
|
|
confirmButtonText: this.$t('tip.yes'),
|
|
|
|
|
cancelButtonText: this.$t('tip.no'),
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
2021-04-07 11:21:12 +08:00
|
|
|
this.$delete('visual/panel?ids=' + u.id).then(response => {
|
2021-03-19 18:52:19 +08:00
|
|
|
if (response.code === 200) {
|
|
|
|
|
this.esc()
|
|
|
|
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.deleteSuccess') })
|
|
|
|
|
this.$emit('reloadForDel')
|
2020-01-20 17:32:03 +08:00
|
|
|
} else {
|
2021-03-19 18:52:19 +08:00
|
|
|
this.$message.error(response.msg)
|
2020-01-20 17:32:03 +08:00
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
})
|
|
|
|
|
})
|
2020-01-03 17:17:09 +08:00
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
save: function () {
|
|
|
|
|
this.$refs.panelForm.validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
this.prevent_opt.save = true
|
|
|
|
|
if (this.panel.id) {
|
2021-04-07 11:21:12 +08:00
|
|
|
this.$put('visual/panel', this.panel).then(response => {
|
2021-03-19 18:52:19 +08:00
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
this.prevent_opt.save = false
|
|
|
|
|
})
|
|
|
|
|
} else {
|
2021-04-07 11:21:12 +08:00
|
|
|
this.$post('visual/panel', this.panel).then(response => {
|
2021-03-19 18:52:19 +08:00
|
|
|
if (response.code === 200) {
|
|
|
|
|
this.esc()
|
|
|
|
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
|
|
|
|
this.$emit('reload', this.panel.name)
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(response.msg)
|
|
|
|
|
}
|
|
|
|
|
this.prevent_opt.save = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
})
|
2020-01-03 17:17:09 +08:00
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
esc: function () {
|
|
|
|
|
this.rightBox.show = false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created () {
|
2020-01-03 17:17:09 +08:00
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
},
|
|
|
|
|
mounted: function () {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
2020-01-03 17:17:09 +08:00
|
|
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
}
|
2020-01-03 17:17:09 +08:00
|
|
|
</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>
|