Browse Source

Merge branch 'ETA1.1.3'

cxmo 1 year ago
parent
commit
1ef6793fef

+ 14 - 0
src/api/modules/toolBoxApi.js

@@ -0,0 +1,14 @@
+import http from "@/api/http.js"
+
+//工具箱
+export const ToolBoxInterface = {
+    /**
+     * 获取联储观察的数据
+     * @param {Object} params 
+     * @param {String} DateTime //时间 yyyy-MM-dd
+     * @returns 
+     */
+    getSheetDetail:(params)=>{
+        return http.get('/meeting_probabilities/detail',params)
+    }
+}

+ 39 - 1
src/routes/modules/chartRoutes.js

@@ -202,7 +202,7 @@ export default [
 	},
 
 	/* 持仓分析 */
-	{
+	/* {
 		path:'/',
 		component: home,
 		name: '持仓分析',
@@ -219,5 +219,43 @@ export default [
 				component:()=>import('@/views/positionAnalysis_manage/detail.vue'),
 			}
 		]
+	}, */
+	/* 工具箱 */
+	//ETA1.1.3:将持仓分析,商品价格曲线合并至工具箱
+	{
+		path:'/',
+		component:home,
+		name:'工具箱',
+		hidden:false,
+		children:[
+			{
+				path: 'positionAnalysisList',
+				name: '持仓列表',
+				component:()=>import('@/views/positionAnalysis_manage/list.vue')
+			},
+			{
+				path: 'positionAnalysisDetail',
+				name: '持仓详情',
+				component:()=>import('@/views/positionAnalysis_manage/detail.vue'),
+			},
+			{
+				path:'federalReserveWatch',
+				name:'联储观察',
+				component:()=>import('@/views/toolBox_manage/FederalReserveWatch.vue')
+			},{
+				path: "commordityChartBase",
+				name: "商品价格曲线",
+				component: () => import('@/views/futures_manage/commodityChartBase.vue')
+			},
+			{
+				path: "addCommodityChart",
+				name: "编辑图表",
+				component: () => import('@/views/futures_manage/chartEditor.vue'),
+				meta: { 
+					pathFrom: "commordityChartBase",
+					pathName: "商品价格曲线",
+				}
+			},
+		]
 	}
 ]

+ 143 - 0
src/views/toolBox_manage/FederalReserveWatch.vue

@@ -0,0 +1,143 @@
+<template>
+    <!-- 联储观察 -->
+    <div class="federal-reserve-wrap">
+        <div class="tool-box">
+            <el-date-picker
+                v-model="selectDate"
+                value-format="yyyy-MM-dd"
+                type="date"
+                placeholder="选择日期" @change="getSheetDetail">
+            </el-date-picker>
+            <el-button type="text" @click="downloadSheet" :loading="isDownload">下载</el-button>
+        </div>
+        <div class="table-box">
+            <div class="sheet-wrap">
+                <div id="sheet-container" v-if="this.sheetDetailInfo.MeetingInfoId">
+                </div>
+                <tableNoData text="该日期暂无数据" v-else/>
+                
+            </div>
+            
+        </div>
+    </div>
+</template>
+
+<script>
+import {ToolBoxInterface} from "@/api/modules/toolBoxApi.js";
+export default {
+    data() {
+        return {
+            sheetDetailInfo:{},
+            selectDate:'',
+            exportBase: process.env.VUE_APP_API_ROOT + "/meeting_probabilities/detail", //数据导出接口
+        };
+    },
+    methods: {
+        getSheetDetail(){
+            let type
+            if(!this.selectDate){
+                type='init'
+            }
+            ToolBoxInterface.getSheetDetail({
+                DateTime: this.selectDate||'',
+            }).then(res=>{
+                if(res.Ret!==200) return
+                this.sheetDetailInfo = res.Data||{};
+                type==='init'&&(this.selectDate = this.sheetDetailInfo.DateTime||'')
+                this.$nextTick(()=>{
+                    this.sheetDetailInfo.MeetingInfoId&&this.initSheet()
+                })
+            })
+        },
+        downloadSheet(){
+            if(!this.sheetDetailInfo.MeetingInfoId){
+                this.$message.warning("暂无下载文件")
+                return 
+            }
+            const exportApi = this.exportBase
+                +`?${localStorage.getItem("auth") || ""}`
+                +`&DateTime=${this.selectDate}`
+                +`&IsExport=1`
+
+            this.isDownload = true;
+            const link = document.createElement("a");
+            link.href = this.escapeStr(exportApi);
+            link.download = "";
+            link.click();
+            setTimeout(() => {
+                this.isDownload = false;
+            }, 5000);
+        },
+        // 对[#,;]转义
+        escapeStr(str) {
+            return str.replace(/#/g, escape("#")).replace(/;/g, escape(";"));
+        },
+        initSheet(){
+            const baseOption = this.sheetDetailInfo.Content ? JSON.parse(this.sheetDetailInfo.Content) : {}
+            //luckysheet配置,能隐藏的都隐藏了,并且禁止编辑
+            const options = {
+                container:'sheet-container',
+                lang: 'zh',
+                showinfobar: false,
+                showtoolbar:false,
+                showsheetbar:false,
+                showstatisticBar:false,
+                showstatisticBarConfig: {
+                    count: false, // 计数栏
+                    view: false, // 打印视图
+                    zoom: true, // 缩放
+                },
+                allowCopy:false,
+                allowEdit:false,//不允许编辑
+                allowUpdate:false,
+                enableAddRow:false,
+                sheetFormulaBar:false,
+                showConfigWindowResize:true,
+                data: [{
+                    ...baseOption,
+                    scrollTop: 0,
+                    scrollLeft: 0,
+                }],
+            }
+            luckysheet.create(options)
+            document.querySelector("#luckysheet-cols-h-c").style.pointerEvents = 'none'
+        }
+    },
+    mounted(){
+        this.getSheetDetail()
+    }
+};
+</script>
+
+<style scoped lang="scss">
+.federal-reserve-wrap{
+    height:calc(100vh - 120px);
+    background-color: #fff;
+    display: flex;
+    flex-direction: column;
+    box-sizing: border-box;
+    padding:30px;
+    .tool-box{
+        display: flex;
+        justify-content: space-between;
+    }
+    .table-box{
+        width:100%;
+        box-sizing: border-box;
+        flex: 1;
+        margin-top: 30px;
+        .sheet-wrap{
+            width:100%;
+            height: 100%;
+            position: relative;
+            /* cursor:not-allowed;
+            pointer-events: none; */
+            #sheet-container {
+                margin:0;padding:0;
+                position:absolute;
+                width:100%;left: 0px;top: 0;bottom:0px;
+            }
+        }
+    }
+}
+</style>

+ 44 - 0
src/views/toolBox_manage/components/Sheet.vue

@@ -0,0 +1,44 @@
+<template>
+    <div class="table-wrapper">
+        <table cellpadding="0" cellspacing="0">
+            <tbody>
+                <tr v-for="(item, index) in props.data" :key="index">
+                    <td :class="['data-cell', {
+                        'one-bg': (index + 1) % 2 && index > 0,
+                        'tow-bg': (index + 1) % 2 !== 0 && index > 0,
+                        'head-column': index === 0
+                    }]" v-for="(cell, cell_index) in item" :key="cell_index" :colspan="cell.mc.cs || 1"
+                        :rowspan="cell.mc.rs || 1" :style="`
+            color: ${cell.fc};
+                                    font-weight: ${cell.bl ? 'bold' : 'normal'};
+                                    font-style: ${cell.it ? 'italic' : 'normal'};
+                                    background: ${cell.bg};
+          `">
+                        <!-- 单元格拆分 -->
+                        <div class="split-word" v-if="cell.ct.s">
+                            <span v-for="(word, word_index) in cell.ct.s" :key="`${index}_${cell_index}_${word_index}`"
+                                :style="`color: ${word.fc};font-weight: ${word.bl ? 'bold' : 'normal'};font-style: ${word.it ? 'italic' : 'normal'};
+                            `">{{ word.v }}</span>
+                        </div>
+                        <div v-else>{{ cell.m }}</div>
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+    </div>
+</template>
+
+<script>
+    export default {
+        data() {
+            return {
+
+            };
+        },
+        methods: {
+
+        },
+    };
+</script>
+
+<style scoped lang="scss"></style>