Преглед на файлове

基础数据项数据插入

FinalYu преди 2 години
родител
ревизия
db479a419b
променени са 3 файла, в които са добавени 71 реда и са изтрити 13 реда
  1. 0 0
      chuanyi_client2/src/assets/icons/svg/report_basedata.svg
  2. 68 13
      chuanyi_client2/src/views/report_template/index.vue
  3. 3 0
      chuanyi_client2/vue.config.js

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
chuanyi_client2/src/assets/icons/svg/report_basedata.svg


+ 68 - 13
chuanyi_client2/src/views/report_template/index.vue

@@ -38,14 +38,14 @@
           <svg-icon icon-class="report_template" style="width: 35px;"/>
           <span>模板库</span>
         </div>
+        <div class="cy-chart-div" @click="dataEvent(1)">
+          <svg-icon icon-class="report_basedata" style="width: 35px;"/>
+          <span>基础数据项</span>
+        </div>
         <div class="cy-chart-div" @click="dataEvent()">
           <svg-icon icon-class="report_data" style="width: 35px;"/>
           <span>数据项</span>
         </div>
-<!--        <div class="cy-chart-div" @click="dataEvent1()">-->
-<!--          <svg-icon icon-class="report_data" style="width: 35px;"/>-->
-<!--          <span>数据表</span>-->
-<!--        </div>-->
         <div class="cy-chart-div" @click="barEvent('bar')">
           <svg-icon icon-class="bar_chart"/>
           <span>柱状图</span>
@@ -205,6 +205,29 @@
       </div>
     </el-dialog>
 
+    <!-- 选择基础数据项 -->
+    <el-dialog
+        title="选择基础数据项"
+        width="500px"
+        center
+        :before-close="dialogBaseDataClose"
+        :visible.sync="dialogBaseDataVisible"
+        :close-on-click-modal="false"
+        :append-to-body="true">
+      <el-select v-model="chooseBaseData" filterable placeholder="请选择数据项" style="width: 100%;">
+        <el-option
+            v-for="item in this.baseDataList"
+            :key="item.id"
+            :label="item.dictKey"
+            :value="item.dictValue">
+        </el-option>
+      </el-select>
+      <div style="width: 100%; text-align: center; margin-top: 20px;">
+        <el-button type="primary" @click="baseItemEvent">确定</el-button>
+        <el-button @click="dialogBaseDataClose">取消</el-button>
+      </div>
+    </el-dialog>
+
     <el-dialog
         title="选择四则运算表达式"
         width="500px"
@@ -328,6 +351,7 @@ import {
   updateReportTemplate
 } from "@/api/datasource";
 import {showLoading} from "@/utils/cqcy";
+import {getDictByKey} from "@/api/basic";
 
 export default {
   name: 'index',
@@ -343,6 +367,7 @@ export default {
       dialogDataModelVisible: false,
       dialogCommReportVisible: false,
       dialogGroupItemVisible: false,
+      dialogBaseDataVisible: false,
       menuLeft: 0,
       menuTop: 0,
       visibleChartMenu: false,
@@ -360,6 +385,8 @@ export default {
       },
       barChartOption: {
       },
+      baseDataList: [],
+      chooseBaseData: null,
       dataGroupList: [],
       itemDataListByTree: [],
       itemDataListByCalc: [],
@@ -836,7 +863,7 @@ export default {
       this.dialogClose()
     },
     /** 数据项 */
-    dataEvent() {
+    dataEvent(type) {
       let rangeWithFlatten = luckysheet.getRangeWithFlatten()
       if (!rangeWithFlatten || rangeWithFlatten.length != 1) {
         this.$message({
@@ -845,24 +872,43 @@ export default {
         })
         return
       }
+      // 基础数据项
+      if (type == 1) {
+        this.getBaseDataItem()
+        return
+      }
       this.chooseDataGroup = null
       this.getDataGroupList()
       this.dialogGroupItemVisible = true
     },
-    /** 数据表 */
-    dataEvent1() {
-      let rangeWithFlatten = luckysheet.getRangeWithFlatten()
-      if (!rangeWithFlatten || rangeWithFlatten.length != 1) {
+    /** 查询字典表:基础数据项 */
+    getBaseDataItem() {
+      getDictByKey({
+        'keyType': 'base_data_item'
+      }).then(res => {
+        this.dialogBaseDataVisible = true
+        this.baseDataList = res.data
+      }).catch((e) => {
+        console.error(e)
+      })
+    },
+    /** 基础数据项插入 */
+    baseItemEvent() {
+      console.log(this.chooseBaseData)
+      if (!this.chooseBaseData) {
         this.$message({
-          message: '请在 Excel 中选择图表需要存放的位置!',
+          message: '请选择基础数据项!',
           type: 'warning'
         })
         return
       }
-      this.chooseDataGroup = null
-      this.getDataGroupList()
-      this.dialogDataVisible = true
+      let rangeWithFlatten = luckysheet.getRangeWithFlatten()
+      let c = rangeWithFlatten[0].c
+      let r = rangeWithFlatten[0].r
+      luckysheet.setCellValue(r, c, this.chooseBaseData)
+      this.dialogBaseDataClose()
     },
+    /** 动态数据项插入 */
     itemEvent() {
       if (this.chooseGroupItemList.length == 0) {
         this.$message({
@@ -1201,6 +1247,15 @@ export default {
         this.dialogDataModelVisible = false
       }
     },
+    /** 弹出层关闭事件 */
+    dialogBaseDataClose() {
+      this.chooseBaseData = null
+      if (typeof(done) === 'function') {
+        done()
+      } else {
+        this.dialogBaseDataVisible = false
+      }
+    },
     /** 关闭右键弹出层 */
     closeMenu() {
       this.visibleChartMenu = false

+ 3 - 0
chuanyi_client2/vue.config.js

@@ -1,10 +1,13 @@
 'use strict'
 const path = require('path')
+const os = require('os')
 
 function resolve(dir) {
     return path.join(__dirname, dir)
 }
 
+process.env.VUE_APP_WINNAME = os.hostname()
+
 const name = process.env.VUE_APP_TITLE || '川仪READOPC报表软件' // 网页标题
 
 const port = process.env.port || process.env.npm_config_port || 81 // 端口

Някои файлове не бяха показани, защото твърде много файлове са промени