Browse Source

修改数据

xiangyiyong 7 months ago
parent
commit
bfe7f1c132

File diff suppressed because it is too large
+ 17978 - 18423
package-lock.json


+ 0 - 2
package.json

@@ -30,7 +30,6 @@
     "esri-loader": "^2.16.0",
     "file-saver": "^2.0.5",
     "flv.js": "^1.6.2",
-    "gifsicle": "^3.0.4",
     "html2canvas": "^1.3.3",
     "html2pdf": "0.0.11",
     "image-conversion": "^2.1.1",
@@ -100,7 +99,6 @@
     "eslint-plugin-vue": "5.2.2",
     "html-webpack-plugin": "3.2.0",
     "image-webpack-loader": "^6.0.0",
-    "imagemin-gifsicle": "^7.0.0",
     "increase-memory-limit": "^1.0.7",
     "mockjs": "1.0.1-beta3",
     "node-sass": "^4.14.1",

+ 11 - 5
src/views/dcSystem/assayWaterQuality/assayManage/assayMtuResult/index.vue

@@ -219,7 +219,7 @@
         <div style="width: 100%; height: calc(100vh - 280px)">
           <!-- 正文表格上面部分(不含下面翻页) -->
           <el-table
-            id="siteMonitor"
+            id="siteMonitorDialog"
             ref="tableData"
             v-loading="loading"
             highlight-current-row
@@ -267,10 +267,15 @@
       <!-- 弹出的详情框右下角的确认取消 -->
       <div slot="footer" class="dialog-footer">
         <!-- <el-button v-if="btnState3" v-loading="dialogLoading" type="primary" size="mini" @click="exportResult">导出</el-button> -->
+        <ExportBtn
+          style="float: left;"
+          :button-size="'mini'"
+          table-id="siteMonitorDialog"
+          :name="ruleForm.assayResultName"
+        />
         <el-button v-loading="dialogLoading" size="mini" @click="dialogVisible = false">取 消</el-button>
         <el-button v-if="btnState1" v-loading="dialogLoading" type="primary" size="mini" @click="commit">确定</el-button>
         <el-button v-if="btnState2" v-loading="dialogLoading" type="primary" size="mini" @click="upData">修改</el-button>
-        <!-- <el-button v-if="btnState4" v-loading="dialogLoading" type="primary" size="mini" @click="submitForm">打印</el-button> -->
       </div>
 
     </el-dialog>
@@ -298,10 +303,11 @@ import ReturnPdf from '../../../common/ReturnPdf'
 import { validyyyyMMdd } from '@/utils/validate'
 import XLSX from 'xlsx'
 import moment from 'moment'
+import ExportBtn from '@/views/zhpt/wxreportforms/components/ExportBtn'
 
 export default {
   name: 'AssayResult',
-  components: { ReturnPdf },
+  components: { ReturnPdf, ExportBtn },
 
   data() {
     return {
@@ -352,7 +358,8 @@ export default {
       printDialog: false,
       pdfData: [],
       column: [],
-      samplingLocationData: []
+      samplingLocationData: [],
+      excelFileName: ''
     }
   },
 
@@ -728,7 +735,6 @@ export default {
 
       this.exportList(this.assayResultData)
     },
-
     exportList(list) {
       const tableData = [
         ['序号', '化验结果编号', '化验结果名称', '化验项配置', '水样编号', '创建人', '创建时间', '描述', '化验项', '化验值', '化验结果',

+ 29 - 6
src/views/zhpt/wxreportforms/components/ExportBtn.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-button size="small" type="primary" @click="setExport2Excel">
+  <el-button :size="buttonSize" type="primary" @click="setExport2Excel">
     导出
   </el-button>
 </template>
@@ -9,7 +9,28 @@
 import XLSX2 from 'xlsx'
 import XLSX from 'xlsx-style'
 export default {
-  props: ['tableId', 'file', 'clickfun'],
+  props: {
+    'tableId': {
+      type: String,
+      default: ''
+    },
+    'file': {
+      type: String,
+      default: ''
+    },
+    'clickfun': {
+      type: Function,
+      default: () => {}
+    },
+    buttonSize: {
+      type: String,
+      default: 'small'
+    },
+    name: {
+      type: String,
+      default: ''
+    }
+  },
   data() {
     return {
       todayTimeString: new Date().getTime()
@@ -57,9 +78,11 @@ export default {
         '电量': row => row.s.numFmt = '0%' // (row.v *= 100, )
       }
       var cacheCells = {}
+      // 循环处理数据
       for (const key in wb) {
         if (key.indexOf('!') > -1) continue
-        if (['', '操作', '详情', '编辑详情'].indexOf(wb[key].v) > -1) {
+        const tempKey = key.replace(/\d+/g, '')
+        if (['操作', '详情', '编辑详情'].indexOf(wb[key].v) > -1 || !wb[tempKey + '1'].v) {
           delete wb[key]
           continue
         } else {
@@ -88,7 +111,6 @@ export default {
               right: { style: 'thin' }
             }
           }
-
           if (rowW == 1 && cells.hasOwnProperty(wb[key].v)) {
             cacheCells[cellW] = cells[wb[key].v]
           } else if (cacheCells.hasOwnProperty(cellW)) {
@@ -96,16 +118,17 @@ export default {
           }
           if (wb[key].z == 'm/d/yy') {
             delete wb[key].z
-            // wb[key].s.numFmt = 'yyyy-m-dd h:mm:ss'
             wb[key].s.numFmt = 'yyyy-m-dd'
             wb[key].v -= 0.0004976851
           }
         }
       }
 
+      // 导出数据
       var data = wb['!merges'] ? this.addRangeBorder(wb['!merges'], wb) : wb // 合并项添加边框
       var filedata = this.sheet2blob(data)
-      this.openDownloadDialog(filedata, this.todayTimeString + '-' + (this.file || '') + '报表.xlsx')
+      const name = this.name ? (this.todayTimeString + '-' + (this.name || '') + '.xlsx') : (this.todayTimeString + '-' + (this.file || '') + '报表.xlsx')
+      this.openDownloadDialog(filedata, name)
     },
     // 为合并项添加边框
     addRangeBorder(range, ws) {