2
3
lining преди 6 години
родител
ревизия
25e34c73d5

+ 78 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/basisbuild.go

@@ -2,6 +2,9 @@ package oilsupplier
 
 import (
 	"encoding/json"
+	"fmt"
+	"github.com/tealeg/xlsx"
+	"reflect"
 	"strings"
 	"time"
 
@@ -344,3 +347,78 @@ func (this *OilBasisBuildController) BasicList() {
 	this.Data["json"] = &datainfo
 	this.ServeJSON()
 }
+
+// @Title get 导出ex
+// @Description get SampleType by token
+// @Success 200 {object} sampletype.SampleType
+// @router /exportexcelall [get]
+func (this *OilBasisBuildController) ExportExcelAll() {
+
+	//获取分页信息
+	where := " 1=1 "
+	orderby := "Code"
+	asc := true
+	Order := this.GetString("Order")
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop
+		if Order == "asc" {
+			asc = true
+		} else {
+			asc = false
+		}
+	}
+
+	t := time.Now()
+	svc := basisbuild.GetOilBasisBuildService(utils.DBE)
+	var list []basisbuild.OilBasisBuild
+	svc.GetPagingEntitiesWithOrderBytbl("", 0, 0, orderby, asc, &list, where)
+
+	var title []string
+	filetitle := "基建类"
+	//自定义显示列
+	showcolumnarr := this.GetString("showcolumnarr")
+	showcolumnnamearr := this.GetString("showcolumnnamearr")
+	titlestring := showcolumnnamearr
+	title = strings.Split(titlestring, ",")
+	f := xlsx.NewFile()
+	sheet, _ := f.AddSheet(filetitle)
+	cellname := strings.Split(showcolumnarr, ",")
+	row := sheet.AddRow()
+	row.WriteSlice(&cellname, -1)
+
+	for _, item := range list {
+		var enumModel basisbuild.OilBasisBuild
+		tmpModel := &item
+		enumModel = *tmpModel
+		immumodel := reflect.ValueOf(&enumModel)
+		elem := immumodel.Elem()
+		row := sheet.AddRow()
+		for _, name := range title {
+			cell := row.AddCell()
+			if strings.HasPrefix(name, "F") {
+				var val = elem.FieldByName(name).String()
+				if val == "1" {
+					cell.Value = "是"
+				} else {
+					cell.Value = ""
+				}
+			} else {
+				cell.Value = elem.FieldByName(name).String()
+			}
+		}
+	}
+
+	for c, cl := 0, len(sheet.Cols); c < cl; c++ {
+		sheet.Cols[c].Width = 20
+	}
+
+	dir := "static/file/excel/report/" + this.GetAccode()
+	SaveDirectory(dir)
+	path := dir + "/" + utils.TimeFormat(time.Now(), "200612") + filetitle + ".xlsx"
+	f.Save(path)
+	this.Data["json"] = this.Ctx.Request.Host + "/" + path
+	this.ServeJSON()
+	elapsed := time.Since(t)
+	fmt.Println(elapsed)
+}

+ 80 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/goodsaptitude.go

@@ -957,6 +957,86 @@ func (this *OilGoodsAptitudeController) ExportExcelAll() {
 	}
 	//this.SaveSampleXlsx(filetitle, title, showcolumnarr, list, f)
 
+	dir := "static/file/excel/report/" + this.GetAccode()
+	SaveDirectory(dir)
+	path := dir + "/" + utils.TimeFormat(time.Now(), "200612") + filetitle + ".xlsx"
+	f.Save(path)
+	this.Data["json"] = this.Ctx.Request.Host + "/" + path
+	this.ServeJSON()
+	elapsed := time.Since(t)
+	fmt.Println(elapsed)
+}
+
+// @Title get 导出ex
+// @Description get SampleType by token
+// @Success 200 {object} sampletype.SampleType
+// @router /exportexcelall2019 [get]
+func (this *OilGoodsAptitudeController) ExportExcelAll2019() {
+	//获取分页信息
+	//page := this.GetPageInfoForm()
+	where := " 1=1 "
+	orderby := "Code"
+	asc := true
+	Order := this.GetString("Order")
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop
+		if Order == "asc" {
+			asc = true
+		} else {
+			asc = false
+		}
+	}
+	Edition := this.GetString("Edition")
+
+	if Edition != "" {
+		where = where + " and a.Edition = '" + Edition + "'"
+	}
+
+	t := time.Now()
+	svc := goodsaptitude.GetOilGoodsAptitudeService(utils.DBE)
+	var list []goodsaptitude.OilGoodsAptitude_2
+	svc.GetList_2019(OilGoodsAptitudeName, OilGoodsAptitudeClassName, 0, 0, orderby, asc, &list, where)
+
+	var title []string
+	filetitle := "物资类(顶级)"
+	//自定义显示列
+	showcolumnarr := this.GetString("showcolumnarr")
+	showcolumnnamearr := this.GetString("showcolumnnamearr")
+	titlestring := showcolumnnamearr
+	title = strings.Split(titlestring, ",")
+	f := xlsx.NewFile()
+	sheet, _ := f.AddSheet(filetitle)
+	cellname := strings.Split(showcolumnarr, ",")
+	row := sheet.AddRow()
+	row.WriteSlice(&cellname, -1)
+
+	for _, item := range list {
+		var enumModel goodsaptitude.OilGoodsAptitude_2
+		tmpModel := &item
+		enumModel = *tmpModel
+		immumodel := reflect.ValueOf(&enumModel)
+		elem := immumodel.Elem()
+		row := sheet.AddRow()
+		for _, name := range title {
+			cell := row.AddCell()
+			if strings.HasPrefix(name, "F") {
+				var val = elem.FieldByName(name).String()
+				if val == "1" {
+					cell.Value = "是"
+				} else {
+					cell.Value = ""
+				}
+			} else {
+				cell.Value = elem.FieldByName(name).String()
+			}
+		}
+	}
+
+	for c, cl := 0, len(sheet.Cols); c < cl; c++ {
+		sheet.Cols[c].Width = 20
+	}
+
 	dir := "static/file/excel/report/" + this.GetAccode()
 	SaveDirectory(dir)
 	path := dir + "/" + utils.TimeFormat(time.Now(), "200612") + filetitle + ".xlsx"

+ 78 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/technologyservice.go

@@ -3,6 +3,9 @@ package oilsupplier
 import (
 	"dashoo.cn/backend/api/business/oilsupplier/technologyserviceclass"
 	"encoding/json"
+	"fmt"
+	"github.com/tealeg/xlsx"
+	"reflect"
 	"strconv"
 	"strings"
 	"time"
@@ -623,3 +626,78 @@ func (this *OilTechnologyServiceController) GetCodeById() {
 	this.Data["json"] = &datainfo
 	this.ServeJSON()
 }
+
+// @Title get 导出ex
+// @Description get SampleType by token
+// @Success 200 {object} sampletype.SampleType
+// @router /exportexcelall [get]
+func (this *OilTechnologyServiceController) ExportExcelAll() {
+
+	//获取分页信息
+	where := " 1=1 "
+	orderby := "Code"
+	asc := true
+	Order := this.GetString("Order")
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop
+		if Order == "asc" {
+			asc = true
+		} else {
+			asc = false
+		}
+	}
+
+	t := time.Now()
+	svc := technologyservice.GetOilTechnologyServiceService(utils.DBE)
+	var list []technologyservice.OilTechnologyServiceView
+	svc.GetMyPagingEntitiesWithOrderBytbl(OilTechsrvDetailViewName, 0, 0, orderby, asc, &list, where)
+
+	var title []string
+	filetitle := "技术服务类"
+	//自定义显示列
+	showcolumnarr := this.GetString("showcolumnarr")
+	showcolumnnamearr := this.GetString("showcolumnnamearr")
+	titlestring := showcolumnnamearr
+	title = strings.Split(titlestring, ",")
+	f := xlsx.NewFile()
+	sheet, _ := f.AddSheet(filetitle)
+	cellname := strings.Split(showcolumnarr, ",")
+	row := sheet.AddRow()
+	row.WriteSlice(&cellname, -1)
+
+	for _, item := range list {
+		var enumModel technologyservice.OilTechnologyServiceView
+		tmpModel := &item
+		enumModel = *tmpModel
+		immumodel := reflect.ValueOf(&enumModel)
+		elem := immumodel.Elem()
+		row := sheet.AddRow()
+		for _, name := range title {
+			cell := row.AddCell()
+			if strings.HasPrefix(name, "F") {
+				var val = elem.FieldByName(name).String()
+				if val == "1" {
+					cell.Value = "是"
+				} else {
+					cell.Value = ""
+				}
+			} else {
+				cell.Value = elem.FieldByName(name).String()
+			}
+		}
+	}
+
+	for c, cl := 0, len(sheet.Cols); c < cl; c++ {
+		sheet.Cols[c].Width = 20
+	}
+
+	dir := "static/file/excel/report/" + this.GetAccode()
+	SaveDirectory(dir)
+	path := dir + "/" + utils.TimeFormat(time.Now(), "200612") + filetitle + ".xlsx"
+	f.Save(path)
+	this.Data["json"] = this.Ctx.Request.Host + "/" + path
+	this.ServeJSON()
+	elapsed := time.Since(t)
+	fmt.Println(elapsed)
+}

+ 7 - 0
src/dashoo.cn/frontend_web/src/api/oilsupplier/basisbuild.js

@@ -44,5 +44,12 @@ export default {
       url: '/oilclassorgsetting/addorganize?classId=' + classId + '&organizeids=' + organizeids,
       method: 'post'
     })
+  },
+  exportExcelAll (params, myAxios) {
+    return myAxios({
+      url: '/basisbuild/exportexcelall',
+      method: 'get',
+      params: params
+    })
   }
 }

+ 7 - 0
src/dashoo.cn/frontend_web/src/api/oilsupplier/goodsaptitude.js

@@ -78,5 +78,12 @@ export default {
       method: 'get',
       params: params
     })
+  },
+  exportExcelAll2019 (params, myAxios) {
+    return myAxios({
+      url: '/goodsaptitude/exportexcelall2019',
+      method: 'get',
+      params: params
+    })
   }
 }

+ 7 - 0
src/dashoo.cn/frontend_web/src/api/oilsupplier/technologyservice.js

@@ -44,5 +44,12 @@ export default {
       url: '/technologyservice/delete/' + entityId,
       method: 'delete'
     })
+  },
+  exportExcelAll (params, myAxios) {
+    return myAxios({
+      url: '/technologyservice/exportexcelall',
+      method: 'get',
+      params: params
+    })
   }
 }

+ 51 - 26
src/dashoo.cn/frontend_web/src/pages/oilsupplier/basisbuild/index.vue

@@ -4,7 +4,7 @@
       <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
       <el-breadcrumb-item :to="{ path: '/oilsupplier/basisbuild' }">基建类资质对照表</el-breadcrumb-item>
     </el-breadcrumb>
-    <el-card class="box-card" style="height: calc(100vh - 115px);">
+    <el-card class="box-card" style="height: calc(100vh - 115px);" v-loading="loading">
       <div slot="header">
         <span>
           <i class="icon icon-table2"></i> 基建类资质对照表
@@ -149,6 +149,7 @@
 
     data() {
       return {
+        loading: false,
         deptsetVisible: false,
         dialogVisible: false,
         // 列表数据
@@ -354,33 +355,57 @@
           console.error(err)
         })
       },
-      exportExcel() {
-        /* generate workbook object from table */
-        let table = document.querySelector("#rebateSetTable").cloneNode(true); //克隆备份(原table不动)
-        // 因为element-ui的表格的fixed属性导致多出一个table,会下载重复内容,这里删除掉
-        table.removeChild(table.querySelector(".el-table__fixed-right")) //删掉备份的子节点
-        let wb = XLSX.utils.table_to_book(table, {
-          raw: true
-        });
-        /* get binary string as output */
-        let wbout = XLSX.write(wb, {
-          bookType: "xlsx",
-          bookSST: true,
-          type: "array"
-        });
-        try {
-          FileSaver.saveAs(
-            new Blob([wbout], {
-              type: "application/octet-stream"
-            }),
-            "BasisBuild.xlsx"
-          );
-        } catch (e) {
-          if (typeof console !== "undefined") console.log(e, wbout);
+      // exportExcel() {
+      //   /* generate workbook object from table */
+      //   let table = document.querySelector("#rebateSetTable").cloneNode(true); //克隆备份(原table不动)
+      //   // 因为element-ui的表格的fixed属性导致多出一个table,会下载重复内容,这里删除掉
+      //   table.removeChild(table.querySelector(".el-table__fixed-right")) //删掉备份的子节点
+      //   let wb = XLSX.utils.table_to_book(table, {
+      //     raw: true
+      //   });
+      //   /* get binary string as output */
+      //   let wbout = XLSX.write(wb, {
+      //     bookType: "xlsx",
+      //     bookSST: true,
+      //     type: "array"
+      //   });
+      //   try {
+      //     FileSaver.saveAs(
+      //       new Blob([wbout], {
+      //         type: "application/octet-stream"
+      //       }),
+      //       "BasisBuild.xlsx"
+      //     );
+      //   } catch (e) {
+      //     if (typeof console !== "undefined") console.log(e, wbout);
+      //   }
+      //   return wbout;
+      // },
+      exportExcel () {
+        this.loading = true
+        // 显示列
+        let showcolumn = this.tableColumns.concat(this.dynamicTableColumns)
+        let showcolumnarr = []
+        let showcolumnnamearr = []
+
+        for (var i = 0; i < showcolumn.length; i++) {
+          showcolumnarr.push(showcolumn[i].label)
+          showcolumnnamearr.push(showcolumn[i].prop.replace(/,/g, ','))
+        }
+        let params = {
+          _currentPage: this.currentPage,
+          _size: this.size,
+          Order: this.Column.Order,
+          Prop: this.Column.Prop,
+          Edition: '2',
+          showcolumnarr: showcolumnarr + '',
+          showcolumnnamearr: showcolumnnamearr + ''
         }
-        return wbout;
+        api.exportExcelAll(params, this.$axios).then(res => {
+          this.loading = false
+          window.location = 'http://' + res.data
+        })
       },
-
       searchCommand(command) {
         if (command === 'search') {
           this.dialogVisible = true

+ 50 - 24
src/dashoo.cn/frontend_web/src/pages/oilsupplier/goodsaptitude2019/index.vue

@@ -5,7 +5,7 @@
       <el-breadcrumb-item :to="{ path: '/oilsupplier/goodsaptitude' }">物资类项目与资质对照表</el-breadcrumb-item>
     </el-breadcrumb>
     <el-card class="box-card"
-             style="height: calc(100vh - 115px);">
+             style="height: calc(100vh - 115px);" v-loading="loading">
       <div slot="header">
         <span>
           <i class="icon icon-table2"></i> 物资类项目与资质对照表
@@ -128,6 +128,7 @@ export default {
 
   data () {
     return {
+      loading: false,
       Code: '',
       Name: '',
       // 列表数据
@@ -210,31 +211,56 @@ export default {
       this.Code = ''
       this.initDatas()
     },
+    // exportExcel () {
+    //   /* generate workbook object from table */
+    //   let table = document.querySelector('#rebateSetTable').cloneNode(true) // 克隆备份(原table不动)
+    //   // 因为element-ui的表格的fixed属性导致多出一个table,会下载重复内容,这里删除掉
+    //   table.removeChild(table.querySelector('.el-table__fixed-right')) // 删掉备份的子节点
+    //   let wb = XLSX.utils.table_to_book(table, {
+    //     raw: true
+    //   })
+    //   /* get binary string as output */
+    //   let wbout = XLSX.write(wb, {
+    //     bookType: 'xlsx',
+    //     bookSST: true,
+    //     type: 'array'
+    //   })
+    //   try {
+    //     FileSaver.saveAs(
+    //       new Blob([wbout], {
+    //         type: 'application/octet-stream'
+    //       }),
+    //       'Goods.xlsx'
+    //     )
+    //   } catch (e) {
+    //     if (typeof console !== 'undefined') console.log(e, wbout)
+    //   }
+    //   return wbout
+    // },
     exportExcel () {
-      /* generate workbook object from table */
-      let table = document.querySelector('#rebateSetTable').cloneNode(true) // 克隆备份(原table不动)
-      // 因为element-ui的表格的fixed属性导致多出一个table,会下载重复内容,这里删除掉
-      table.removeChild(table.querySelector('.el-table__fixed-right')) // 删掉备份的子节点
-      let wb = XLSX.utils.table_to_book(table, {
-        raw: true
-      })
-      /* get binary string as output */
-      let wbout = XLSX.write(wb, {
-        bookType: 'xlsx',
-        bookSST: true,
-        type: 'array'
-      })
-      try {
-        FileSaver.saveAs(
-          new Blob([wbout], {
-            type: 'application/octet-stream'
-          }),
-          'Goods.xlsx'
-        )
-      } catch (e) {
-        if (typeof console !== 'undefined') console.log(e, wbout)
+      this.loading = true
+      // 显示列
+      let showcolumn = this.tableColumns.concat(this.dynamicTableColumns)
+      let showcolumnarr = []
+      let showcolumnnamearr = []
+
+      for (var i = 0; i < showcolumn.length; i++) {
+        showcolumnarr.push(showcolumn[i].label)
+        showcolumnnamearr.push(showcolumn[i].prop.replace(/,/g, ','))
       }
-      return wbout
+      let params = {
+        _currentPage: this.currentPage,
+        _size: this.size,
+        Order: this.Column.Order,
+        Prop: this.Column.Prop,
+        Edition: '2',
+        showcolumnarr: showcolumnarr + '',
+        showcolumnnamearr: showcolumnnamearr + ''
+      }
+      api.exportExcelAll2019(params, this.$axios).then(res => {
+        this.loading = false
+        window.location = 'http://' + res.data
+      })
     },
     initTableHeader () {
       setapi.initGoodTableHeader(this.$axios).then(res => {

+ 58 - 32
src/dashoo.cn/frontend_web/src/pages/oilsupplier/technologyservice/index.vue

@@ -4,7 +4,7 @@
       <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
       <el-breadcrumb-item :to="{ path: '/oilsupplier/technologyservice' }">技术服务类资质对照表</el-breadcrumb-item>
     </el-breadcrumb>
-    <el-card class="box-card" style="height: calc(100vh - 115px);">
+    <el-card class="box-card" style="height: calc(100vh - 115px);" v-loading="loading">
       <div slot="header">
         <span>
           <i class="icon icon-table2"></i> 技术服务类资质对照表
@@ -261,6 +261,7 @@
 
     data() {
       return {
+        loading: false,
         codeeditshow: false,
         classid: '',
         deptsetVisible: false,
@@ -468,38 +469,63 @@
           this.dynamicTableColumns = res.data.items
         })
       },
-      exportExcel() {
-        this.size = this.currentItemCount; //表格长度变长
-        this.initDatas()
-        this.$nextTick(function () {
-          /* generate workbook object from table */
-          let table = document.querySelector("#rebateSetTable").cloneNode(true); //克隆备份(原table不动)
-          // 因为element-ui的表格的fixed属性导致多出一个table,会下载重复内容,这里删除掉
-          table.removeChild(table.querySelector(".el-table__fixed-right")) //删掉备份的子节点
-          let wb = XLSX.utils.table_to_book(table, {
-            raw: true
-          });
-          /* get binary string as output */
-          let wbout = XLSX.write(wb, {
-            bookType: "xlsx",
-            bookSST: true,
-            type: "array"
-          });
-          try {
-            FileSaver.saveAs(
-              new Blob([wbout], {
-                type: "application/octet-stream"
-              }),
-              "Technology.xlsx"
-            );
-          } catch (e) {
-            if (typeof console !== "undefined") console.log(e, wbout);
-          }
-          this.size = '10'; //表格还原
-          this.initDatas()
-          return wbout
+      // exportExcel() {
+      //   this.size = this.currentItemCount; //表格长度变长
+      //   this.initDatas()
+      //   this.$nextTick(function () {
+      //     /* generate workbook object from table */
+      //     let table = document.querySelector("#rebateSetTable").cloneNode(true); //克隆备份(原table不动)
+      //     // 因为element-ui的表格的fixed属性导致多出一个table,会下载重复内容,这里删除掉
+      //     table.removeChild(table.querySelector(".el-table__fixed-right")) //删掉备份的子节点
+      //     let wb = XLSX.utils.table_to_book(table, {
+      //       raw: true
+      //     });
+      //     /* get binary string as output */
+      //     let wbout = XLSX.write(wb, {
+      //       bookType: "xlsx",
+      //       bookSST: true,
+      //       type: "array"
+      //     });
+      //     try {
+      //       FileSaver.saveAs(
+      //         new Blob([wbout], {
+      //           type: "application/octet-stream"
+      //         }),
+      //         "Technology.xlsx"
+      //       );
+      //     } catch (e) {
+      //       if (typeof console !== "undefined") console.log(e, wbout);
+      //     }
+      //     this.size = '10'; //表格还原
+      //     this.initDatas()
+      //     return wbout
+      //   })
+      //
+      // },
+      exportExcel () {
+        this.loading = true
+        // 显示列
+        let showcolumn = this.tableColumns.concat(this.dynamicTableColumns)
+        let showcolumnarr = []
+        let showcolumnnamearr = []
+
+        for (var i = 0; i < showcolumn.length; i++) {
+          showcolumnarr.push(showcolumn[i].label)
+          showcolumnnamearr.push(showcolumn[i].prop.replace(/,/g, ','))
+        }
+        let params = {
+          _currentPage: this.currentPage,
+          _size: this.size,
+          Order: this.Column.Order,
+          Prop: this.Column.Prop,
+          Edition: '2',
+          showcolumnarr: showcolumnarr + '',
+          showcolumnnamearr: showcolumnnamearr + ''
+        }
+        api.exportExcelAll(params, this.$axios).then(res => {
+          this.loading = false
+          window.location = 'http://' + res.data
         })
-
       },
       Name1Change(val) {
         this.formData.Code2 = this.formData.Code2.replace(/^(\w{0})\w{2}(.*)$/, '$1' + val + '$2')