|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<el-dialog
|
|
|
- title="添加事项"
|
|
|
+ :title="$t('ToolBox.ForexCalendar.add_item')"
|
|
|
width="600px"
|
|
|
center
|
|
|
custom-class="add-event-dialog-wrap"
|
|
@@ -11,21 +11,24 @@
|
|
|
>
|
|
|
<div class="dialog-content">
|
|
|
<div class="event-header">
|
|
|
+ <!-- 选择日期 -->
|
|
|
<el-date-picker type="date" v-model="eventDay"
|
|
|
- placeholder="选择日期"
|
|
|
+ :placeholder="$t('ToolBox.ForexCalendar.select_date')"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
@change="getDayEvents"
|
|
|
>
|
|
|
</el-date-picker>
|
|
|
<div class="event-select">
|
|
|
<el-select v-model="selectType" style="width:130px">
|
|
|
- <el-option label="关联指标" :value="1"/>
|
|
|
- <el-option label="自定义事项" :value="2"/>
|
|
|
+ <!-- 关联指标 -->
|
|
|
+ <el-option :label="$t('ToolBox.ForexCalendar.link_edb')" :value="1"/>
|
|
|
+ <!-- 自定义事项 -->
|
|
|
+ <el-option :label="$t('ToolBox.ForexCalendar.link_item')" :value="2"/>
|
|
|
</el-select>
|
|
|
<!-- 关联指标 -->
|
|
|
<el-select v-if="selectType===1" style="flex:1;"
|
|
|
filterable remote clearable
|
|
|
- placeholder="请输入指标ID/指标名称"
|
|
|
+ :placeholder="$t('ToolBox.ForexCalendar.edb_input')"
|
|
|
v-model="searchText"
|
|
|
:remote-method="searchHandle">
|
|
|
<i slot="prefix" class="el-input__icon el-icon-search"></i>
|
|
@@ -36,28 +39,61 @@
|
|
|
:value="item.PptId"/>
|
|
|
</el-select>
|
|
|
<!-- 自定义事项 -->
|
|
|
- <el-button v-if="selectType===2" style="flex:1;">+</el-button>
|
|
|
+ <el-button v-if="selectType===2" style="flex:1;" @click="addEventItem">+</el-button>
|
|
|
|
|
|
- <el-tooltip effect="dark" content="Top Left 提示文字" placement="top">
|
|
|
+ <el-tooltip effect="dark" :content="$t('ToolBox.ForexCalendar.link_hint')" placement="top">
|
|
|
<i class="el-icon-question" style="font-size: 16px;"></i>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="event-form">
|
|
|
-
|
|
|
+ <el-form :model="eventForm" ref="eventForm">
|
|
|
+ <draggable
|
|
|
+ v-model="eventForm.events"
|
|
|
+ animation="300"
|
|
|
+ tag="div"
|
|
|
+ class="events-wrap"
|
|
|
+ handle=".el-icon-rank">
|
|
|
+ <div class="event" :class="{'show-bgColor':item.isExpand}" v-for="(item,index) in eventForm.events" :key="index">
|
|
|
+ <el-form-item :prop="`events[${index}].title`" class="event-item"
|
|
|
+ :rules="[
|
|
|
+ {required:true,message:$t('ToolBox.ForexCalendar.item_input'),trigger: 'blur'},
|
|
|
+ {max: 15, message: '超出15个字,请重新编辑', trigger: 'change'}]">
|
|
|
+ <!-- move icon -->
|
|
|
+ <i class="el-icon-rank icon"></i>
|
|
|
+ <el-input v-model="item.title" :placeholder="$t('ToolBox.ForexCalendar.item_input')" />
|
|
|
+ <!-- expand icon -->
|
|
|
+ <i class="icon" :class="{'el-icon-arrow-right':item.isExpand===false,'el-icon-arrow-down':item.isExpand===true}"
|
|
|
+ @click="item.isExpand = !item.isExpand"></i>
|
|
|
+ <!-- close icon position-->
|
|
|
+ <i class="el-icon-remove icon" @click="removeEvent(index)"></i>
|
|
|
+ <!-- edb icon position-->
|
|
|
+ <i class="el-icon-printer icon"></i>
|
|
|
+ </el-form-item>
|
|
|
+ <div class="event-expand-setting" v-show="item.isExpand">
|
|
|
+ <span>{{ $t('ToolBox.ForexCalendar.font_color') }} <el-color-picker v-model="item.textColor" color-format="hex" size="mini"></el-color-picker></span>
|
|
|
+ <span>{{ $t('ToolBox.ForexCalendar.fill_color') }} <el-color-picker v-model="item.backgroundColor" color-format="hex" size="mini"></el-color-picker></span>
|
|
|
+ <span>{{ $t('ToolBox.ForexCalendar.font_bold') }} <el-switch v-model="item.isTextBold"></el-switch></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </draggable>
|
|
|
+
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
<div class="dialog-footer" slot="footer">
|
|
|
- <el-button>取消</el-button>
|
|
|
- <el-button type="primary">保存</el-button>
|
|
|
+ <el-button @click="$emit('close')">{{ $t('Dialog.cancel_btn') }}</el-button>
|
|
|
+ <el-button type="primary" @click="handleSaveEvents">{{ $t('Dialog.confirm_save_btn') }}</el-button>
|
|
|
</div>
|
|
|
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import draggable from 'vuedraggable';
|
|
|
export default {
|
|
|
+ components:{draggable},
|
|
|
props:{
|
|
|
isEventDialogShow:{
|
|
|
type:Boolean,
|
|
@@ -66,6 +102,10 @@ export default {
|
|
|
choosedDay:{
|
|
|
type:String,
|
|
|
default:''
|
|
|
+ },
|
|
|
+ dayEvents:{
|
|
|
+ type:Array,
|
|
|
+ default:[]
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
@@ -75,7 +115,13 @@ export default {
|
|
|
searchText:'',
|
|
|
searchOptions:[],
|
|
|
eventForm:{
|
|
|
- events:[]
|
|
|
+ events:[/* {
|
|
|
+ title:'',
|
|
|
+ textColor:'#000',
|
|
|
+ backgroundColor:'#ccc',
|
|
|
+ isTextBold:false,
|
|
|
+ isExpand:false,//是否展开
|
|
|
+ } */]
|
|
|
}
|
|
|
};
|
|
|
},
|
|
@@ -91,7 +137,32 @@ export default {
|
|
|
searchHandle(){},
|
|
|
//获取当天的事项
|
|
|
getDayEvents(){
|
|
|
+ //接口获取
|
|
|
|
|
|
+ console.log('dayEvents',this.dayEvents)
|
|
|
+ this.eventForm.events = this.dayEvents
|
|
|
+ },
|
|
|
+ //添加一个事项
|
|
|
+ addEventItem(){
|
|
|
+ this.eventForm.events.push({
|
|
|
+ title:'',
|
|
|
+ textColor:'#000',
|
|
|
+ backgroundColor:'#ccc',
|
|
|
+ isTextBold:false,
|
|
|
+ isExpand:false,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ removeEvent(index){
|
|
|
+ this.eventForm.events.splice(index,1)
|
|
|
+ },
|
|
|
+ async handleSaveEvents(){
|
|
|
+ if(!this.eventDay) return this.$message.warning('请选择日期')
|
|
|
+ try{
|
|
|
+ await this.$refs.eventForm.validate()
|
|
|
+ }catch(e){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$emit('save',{events:this.eventForm.events,eventDay:this.eventDay})
|
|
|
}
|
|
|
},
|
|
|
};
|
|
@@ -102,6 +173,30 @@ export default {
|
|
|
.el-input{
|
|
|
width: 100%;
|
|
|
}
|
|
|
+ .el-form-item{
|
|
|
+ margin-bottom: 10px;
|
|
|
+ &.event-item{
|
|
|
+ .el-form-item__content{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ gap:10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .event-expand-setting{
|
|
|
+ .el-color-picker {
|
|
|
+ display: inline-block;
|
|
|
+ &.el-color-picker--mini {
|
|
|
+ height: 20px;
|
|
|
+ }
|
|
|
+ .el-color-picker__trigger {
|
|
|
+ width: 40px;
|
|
|
+ height: 20px;
|
|
|
+ padding: 0;
|
|
|
+ border: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|
|
|
<style scoped lang="scss">
|
|
@@ -115,6 +210,22 @@ export default {
|
|
|
}
|
|
|
.event-form{
|
|
|
min-height: 200px;
|
|
|
+ .event{
|
|
|
+ position:relative;
|
|
|
+ &.show-bgColor{
|
|
|
+ background-color:#EBEBEB;
|
|
|
+ }
|
|
|
+ .event-item{
|
|
|
+ .icon{
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .event-expand-setting{
|
|
|
+ padding:0 30px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|