Ver código fonte

Merge remote-tracking branch 'origin/master'

zhoupeng 1 ano atrás
pai
commit
07d4a3fac7

+ 1 - 1
chuanyi-admin/src/views/system/dept/dept-dist.vue

@@ -14,7 +14,7 @@
       :model="queryParams"
       size="small"
       :inline="true"
-      label-width="68px"
+      label-width="80px"
     >
       <el-form-item label="用户姓名" prop="userName">
         <el-input

+ 1 - 1
chuanyi-admin/src/views/system/log/index.vue

@@ -9,7 +9,7 @@
           :model="queryParams"
           size="small"
           :inline="true"
-          label-width="68px"
+          label-width="80px"
         >
           <el-form-item label="系统模块" prop="modelName">
             <el-input

+ 1 - 1
chuanyi-admin/src/views/system/role/index.vue

@@ -10,7 +10,7 @@
             :model="queryParams"
             size="small"
             :inline="true"
-            label-width="68px"
+            label-width="80px"
           >
             <el-form-item label="角色名称" prop="roleName">
               <el-input

+ 1 - 1
chuanyi-admin/src/views/system/user/index.vue

@@ -9,7 +9,7 @@
           :model="queryParams"
           size="small"
           :inline="true"
-          label-width="68px"
+          label-width="80px"
         >
           <el-form-item label="用户名称" prop="userName">
             <el-input

+ 12 - 0
chuanyi_client2/src/api/basic.js

@@ -1,5 +1,6 @@
 /* jshint esversion: 6 */
 import request from '@/utils/request';
+import cqcyCode from "@/utils/cqcyCode";
 
 /**
  * 根据字典 Key 查询字典值
@@ -44,4 +45,15 @@ export function getTextEditorNew() {
         },
         method: 'get'
     });
+}
+
+/**
+ * 请求自动打印配置
+ * @returns {*}
+ */
+export function getConfigPrintInfo() {
+    return request({
+        url: cqcyCode["showPrintServerConfig"],
+        method: 'get'
+    });
 }

BIN
chuanyi_client2/src/assets/images/logo.png


BIN
chuanyi_client2/src/assets/images/logocy.png


+ 37 - 6
chuanyi_client2/src/background.js

@@ -1,14 +1,17 @@
 'use strict'
 
-import { app, protocol, BrowserWindow, Menu, ipcMain, dialog } from 'electron'
+import { app, protocol, BrowserWindow, Menu, ipcMain, dialog, net } from 'electron'
 import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
 import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
 import { autoUpdater } from 'electron-updater'
 import Store from 'electron-store'
+import { exec } from 'child_process'
+import cqcyCode from "@/utils/cqcyCode";
 
 Store.initRenderer()
 const isDevelopment = process.env.NODE_ENV !== 'production'
 let win
+let cmdStr = 'start ./public/pkg/PrintServerApp-1.0.0.exe'
 
 /**
  * 方案必须在应用准备就绪之前注册
@@ -223,22 +226,50 @@ app.on('ready', async () => {
     }
   }
   await createWindow()
+  runExec()
 })
 
 app.on('ready', function()  {
   autoUpdater.checkForUpdatesAndNotify().then(r => {});
-})
+});
+
+function runExec () {
+  // 请求网络服务net
+  let request = net.request(cqcyCode['checkPrintServerInstated']);
+  request.on("response", response=> {
+    // 获取请求状态码
+    if (response.statusCode !== 200) {
+      // dialog.showMessageBox({
+      //   title: '系统提示',
+      //   message: '检测到您还未安装自动打印服务,建议您进行安装。'
+      // }).then(e => {
+      //   exec(cmdStr, {});
+      // });
+      exec(cmdStr, {});
+    }
+  });
+  request.on('error', (error) => {
+    // dialog.showMessageBox({
+    //   title: '系统提示',
+    //   message: JSON.stringify(error)
+    // }).then(e => {
+    //   exec(cmdStr, {});
+    // });
+    exec(cmdStr, {});
+  });
+  request.end();
+}
 
 if (isDevelopment) {
   if (process.platform === 'win32') {
     process.on('message', (data) => {
       if (data === 'graceful-exit') {
-        app.quit()
+        app.quit();
       }
-    })
+    });
   } else {
     process.on('SIGTERM', () => {
-      app.quit()
-    })
+      app.quit();
+    });
   }
 }

+ 28 - 8
chuanyi_client2/src/components/HeaderPersonal/index.vue

@@ -15,8 +15,9 @@
         <el-dropdown-item @click.native="reloadPage">首页</el-dropdown-item>
         <el-dropdown-item v-if="roleCodeList.indexOf(__self.clientRole) > -1" @click.native="getWarnInfo">报警信息</el-dropdown-item>
         <el-dropdown-item @click.native="updateUserPwd">修改密码</el-dropdown-item>
-        <el-dropdown-item @click.native="helpEvent">帮助</el-dropdown-item>
+        <el-dropdown-item @click.native="configPrintInfo">自动打印服务配置</el-dropdown-item>
         <el-dropdown-item @click.native="checkApplicationUpdate">关于我们</el-dropdown-item>
+        <el-dropdown-item @click.native="helpEvent">帮助</el-dropdown-item>
         <el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>
       </el-dropdown-menu>
     </el-dropdown>
@@ -63,7 +64,7 @@
     <!-- 关于我们 -->
     <el-dialog
         title=""
-        width="300px"
+        width="500px"
         center
         v-dialog-drag
         v-if="dialogAboutVisible"
@@ -72,11 +73,13 @@
         :close-on-click-modal="true"
         :append-to-body="true">
       <div style="text-align: center;">
-        <div>
-          <el-image :src="require('@/assets/images/logo.png')" fit="contain" class="c-logo"></el-image>
-        </div>
-        <div>
-          <span style="font-size: 18px; font-weight: bold; font-family: '微软雅黑';">重庆川仪控制系统有限公司</span>
+        <div class="cy-about-us">
+          <div style="width: 50px;">
+            <el-image :src="require('@/assets/images/logo.png')" fit="contain" class="c-logo"></el-image>
+          </div>
+          <div style="margin-left: 10px;">
+            <span style="font-size: 18px; font-weight: bold; font-family: '微软雅黑';">Easy Industrial Report</span>
+          </div>
         </div>
         <div style="margin-top: 50px;">当前版本:{{ appVersion }}</div>
       </div>
@@ -176,7 +179,7 @@ import {updatePwd} from '@/api/user'
 import {getPubKey} from '@/utils/auth'
 import {encrypt} from '@/utils/jsencrypt'
 import {customCompare, showAlertMsgWin, showAlertWin, showConfirmWin, showLoading} from '@/utils/cqcy'
-import {getAllMessageNotice, getTextEditorNew} from "@/api/basic";
+import {getAllMessageNotice, getConfigPrintInfo, getTextEditorNew} from "@/api/basic";
 import {clearMessage, deleteMessageNoticeById, delMesNotByIdList} from "@/api/datasource";
 
 let pkg = require('../../../package.json')
@@ -279,6 +282,14 @@ export default {
         showAlertWin(this, null, e)
       })
     },
+    configPrintInfo() {
+      getConfigPrintInfo().then(res => {
+        console.log(res)
+      }).catch((e) => {
+        loading.close()
+        showAlertWin(this, null, e)
+      })
+    },
     checkApplicationUpdate() {
       this.appVersion = 'V' + pkg.version
       this.dialogAboutVisible = true
@@ -477,4 +488,13 @@ export default {
     }
   }
 }
+
+.cy-about-us {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  align-content: center;
+  justify-content: center;
+  align-items: center;
+}
 </style>

+ 16 - 0
chuanyi_client2/src/utils/cqcy.js

@@ -655,4 +655,20 @@ export function checkReportChangeStatusAction(_this, callback, callbackError) {
     } else {
         if (callback) callback()
     }
+}
+
+/**
+ * 处理超出长度的时间
+ * @param listDate
+ * @returns {*[]}
+ */
+export function withDateFormatLength(listDate) {
+    if (!listDate || listDate.length == 0) {
+        return []
+    }
+    let arr = []
+    listDate.forEach((date) => {
+        arr.push(date.substring(0, 19))
+    })
+    return arr
 }

+ 3 - 0
chuanyi_client2/src/utils/cqcyCode.js

@@ -4,6 +4,9 @@ export default {
     'port': '8081',
     'host': '192.168.1.99',
 
+    'checkPrintServerInstated': 'http://localhost:8084/api/testInstalled',
+    'showPrintServerConfig': 'http://localhost:8084/api/settingShow',
+
     'clientRole': 'ClientRole',
     'invalidData': '',
 

+ 32 - 1
chuanyi_client2/src/views/home/index.vue

@@ -15,7 +15,10 @@
             label="图表名称"
             prop="chartName">
           <template slot-scope="scope">
-                <span style="color: #409EFF; cursor: pointer;"
+<!--                <span style="color: #409EFF; cursor: pointer;"-->
+<!--                      @click="handleChartNodeClick(scope.row)"-->
+<!--                      :title="scope.row.reportTableName">{{ scope.row.chartName }}</span>-->
+                <span style=""
                       @click="handleChartNodeClick(scope.row)"
                       :title="scope.row.reportTableName">{{ scope.row.chartName }}</span>
           </template>
@@ -244,6 +247,21 @@ export default {
     this.getIndexAllChart()
   },
   methods: {
+    clearChartForm() {
+      this.chartForm = {
+        chartName: '',
+        valueType: 0,
+        chartType: 'bar',
+        valueTakingMode: 0,
+        bucketType: 1,
+        bucketValue: 1,
+        dateRange: [],
+        startTime: null,
+        endTime: null,
+        chartItemList: [],
+        userGroupList: []
+      }
+    },
     hideMainView(flag) {
       this.hideMainViewFlag = flag
     },
@@ -290,6 +308,7 @@ export default {
     },
     /** 保存首页图表添加事件 */
     addIndexChartBtnEvent() {
+      this.clearChartForm()
       this.addIndexChart = true
       this.dialogIndexChartVisible = true
     },
@@ -320,6 +339,10 @@ export default {
         showAlertMsgWin(this, null, '用户组不能为空!')
         return
       }
+      if (this.chartForm.chartType == 'pie' && this.chartForm.chartItemList.length > 1) {
+        showAlertMsgWin(this, null, '饼图仅支持选择一项数据项!')
+        return
+      }
       // this.chartForm.startTime = this.chartForm.dateRange[0]
       // this.chartForm.endTime = this.chartForm.dateRange[1]
       saveIndexChart(this.chartForm).then(res => {
@@ -345,6 +368,10 @@ export default {
         showAlertMsgWin(this, null, '用户组不能为空!')
         return
       }
+      if (this.chartForm.chartType == 'pie' && this.chartForm.chartItemList.length > 1) {
+        showAlertMsgWin(this, null, '饼图仅支持选择一项数据项!')
+        return
+      }
       updateIndexChart(this.chartForm).then(res => {
         this.addIndexChart = true
         this.dialogIndexChartVisible = false
@@ -356,6 +383,10 @@ export default {
     },
     /** 更新已选择数据项 */
     updateDataItemEmit(items) {
+      if (this.chartForm.chartType == 'pie' && items.length > 1) {
+        showAlertMsgWin(this, null, '饼图仅支持选择一项数据项!')
+        return
+      }
       this.chartForm.chartItemList = []
       items.forEach((item) => {
         this.chartForm.chartItemList.push({

+ 19 - 5
chuanyi_client2/src/views/my_report/index.vue

@@ -524,7 +524,7 @@ import {
   getLuckysheetConfig,
   getNowFormatDate, showAlertMsgWin,
   showAlertWin, showConfirmWin,
-  showLoading, showPromptWin
+  showLoading, showPromptWin, withDateFormatLength
 } from '@/utils/cqcy'
 import {
   delReportTableById,
@@ -1278,6 +1278,7 @@ export default {
         tableItemList.forEach((tableItem, i) => {
           if (i == 0) {
             let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+            valueTimeList = withDateFormatLength(valueTimeList)
             let xAxis = tableItem.xaxis
             let yAxis = tableItem.yaxis - 1
             if (valueTimeList.length == 0) {
@@ -1315,10 +1316,12 @@ export default {
             let valueIndexList = tableItem.valueIndexList ? tableItem.valueIndexList.split(',') : []
             this.deviceReportUpdateData('${index}', valueIndexList, false)
             let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+            valueTimeList = withDateFormatLength(valueTimeList)
             this.deviceReportUpdateData('${startTime}', valueTimeList, false)
           }
           if (tableItem.timeItemType == 1) { // 结束时间
             let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+            valueTimeList = withDateFormatLength(valueTimeList)
             this.deviceReportUpdateData('${stopTime}', valueTimeList, tableInfo.isGenCountTime == 1)
           }
           if (valueList.length == 0) {
@@ -1436,10 +1439,20 @@ export default {
         for (let j in reportChartItemList) {
           let _name = reportChartItemList[j].describe ? reportChartItemList[j].describe : reportChartItemList[j].itemName
           if (chartType == 'pie') {
+            info.option.legend = null
+            info.option.tooltip = {
+              trigger: 'item',
+              formatter: '{b0}<br /> <b>{c0}</b>'
+            }
             temp.name = _name
-            temp.data.push({
-              'name': _name,
-              'value': reportChartItemList[j].valueList
+            let names = reportChartItemList[i].valueTimeList ? reportChartItemList[i].valueTimeList.split(',') : [];
+            names = withDateFormatLength(names)
+            let vals = reportChartItemList[i].valueList ? reportChartItemList[i].valueList.split(',') : [];
+            names.forEach((name, j) => {
+              temp.data.push({
+                'name': name,
+                'value': vals[j]
+              })
             })
           } else {
             let _t = []
@@ -1460,8 +1473,9 @@ export default {
         let axisLabel = {};
         axisLabel.rotate = 20;
         xAxis.axisLabel = axisLabel
+        let times = (reportChartItemList[0].valueTimeList) ? reportChartItemList[0].valueTimeList.split(",") : []
         xAxis.data = (reportChartItemList && reportChartItemList.length > 0) ?
-            ((reportChartItemList[0].valueTimeList) ? reportChartItemList[0].valueTimeList.split(",") : []) : []
+            withDateFormatLength(times) : []
         // xAxis.data = xAxis.data.slice(0, 7)
         for (let i in reportChartItemList) {
           let name = reportChartItemList[i].describe ? reportChartItemList[i].describe : reportChartItemList[i].itemName

+ 1 - 1
chuanyi_client2/src/views/report_template/index.vue

@@ -2334,7 +2334,7 @@ export default {
           this.barChartOption.series.push(series)
         }
       } else {
-        this.barChartOption.legend.data = null
+        this.barChartOption.legend = null
         let seriesName = this.barChartForm.legendData[0]
         let dataList = []
         for (let i in this.barChartForm.xAxisData) {

+ 19 - 5
chuanyi_client2/src/views/run_config/index.vue

@@ -634,7 +634,7 @@ import {
   getLuckysheetConfig,
   getNowFormatDate, showAlertMsgWin,
   showAlertWin, showConfirmWin,
-  showLoading, showPromptWin
+  showLoading, showPromptWin, withDateFormatLength
 } from '@/utils/cqcy'
 import {
   delReportTableById,
@@ -1412,6 +1412,7 @@ export default {
         tableItemList.forEach((tableItem, i) => {
           if (i == 0) {
             let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+            valueTimeList = withDateFormatLength(valueTimeList)
             let xAxis = tableItem.xaxis
             let yAxis = tableItem.yaxis - 1
             if (valueTimeList.length == 0) {
@@ -1449,10 +1450,12 @@ export default {
             let valueIndexList = tableItem.valueIndexList ? tableItem.valueIndexList.split(',') : []
             this.deviceReportUpdateData('${index}', valueIndexList, false)
             let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+            valueTimeList = withDateFormatLength(valueTimeList)
             this.deviceReportUpdateData('${startTime}', valueTimeList, false)
           }
           if (tableItem.timeItemType == 1) { // 结束时间
             let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+            valueTimeList = withDateFormatLength(valueTimeList)
             this.deviceReportUpdateData('${stopTime}', valueTimeList, tableInfo.isGenCountTime == 1)
           }
           if (valueList.length == 0) {
@@ -1570,10 +1573,20 @@ export default {
         for (let j in reportChartItemList) {
           let _name = reportChartItemList[j].describe ? reportChartItemList[j].describe : reportChartItemList[j].itemName
           if (chartType == 'pie') {
+            info.option.legend = null
+            info.option.tooltip = {
+              trigger: 'item',
+              formatter: '{b0}<br /> <b>{c0}</b>'
+            }
             temp.name = _name
-            temp.data.push({
-              'name': _name,
-              'value': reportChartItemList[j].valueList
+            let names = reportChartItemList[i].valueTimeList ? reportChartItemList[i].valueTimeList.split(',') : [];
+            names = withDateFormatLength(names)
+            let vals = reportChartItemList[i].valueList ? reportChartItemList[i].valueList.split(',') : [];
+            names.forEach((name, j) => {
+              temp.data.push({
+                'name': name,
+                'value': vals[j]
+              })
             })
           } else {
             let _t = []
@@ -1594,8 +1607,9 @@ export default {
         let axisLabel = {};
         axisLabel.rotate = 20;
         xAxis.axisLabel = axisLabel
+        let times = (reportChartItemList[0].valueTimeList) ? reportChartItemList[0].valueTimeList.split(",") : []
         xAxis.data = (reportChartItemList && reportChartItemList.length > 0) ?
-            ((reportChartItemList[0].valueTimeList) ? reportChartItemList[0].valueTimeList.split(",") : []) : []
+            withDateFormatLength(times) : []
         // xAxis.data = xAxis.data.slice(0, 7)
         for (let i in reportChartItemList) {
           let name = reportChartItemList[i].describe ? reportChartItemList[i].describe : reportChartItemList[i].itemName

+ 1 - 0
chuanyi_client2/vue.config.js

@@ -70,6 +70,7 @@ module.exports = {
                 'productName': name, // 生成 exe 的名字
                 'appId': 'com.jd.cqcy', // 包名
                 'copyright': 'cqcy', // 版权信息
+                'extraFiles': ['./public/pkg'],
                 'nsis': {
                     'oneClick': false, // 是否一键安装
                     'allowElevation': true, // 允许请求提升。若为 false,则用户必须使用提升的权限重新启动安装程序