浏览代码

前后:特别业务导出;已入库导出

dubch 4 年之前
父节点
当前提交
7d16f00890

+ 7 - 3
src/dashoo.cn/backend/api/controllers/oilsupplier/oilcatalog.go

@@ -225,7 +225,7 @@ func (this *OilCatalogController) ExportExcelAll() {
 	svc.GetEntities(&list, where)
 
 	fileTitle := "大港油田" + CardTitle + "目录"
-	showColumnArr := "序号,企业名称,业务范围,有效期起,有效期止,备注"
+	showColumnArr := "序号,企业名称,业务范围,有效期起,有效期止,责任部室,备注"
 
 	f := xlsx.NewFile()
 	sheet, _ := f.AddSheet(fileTitle)
@@ -234,8 +234,12 @@ func (this *OilCatalogController) ExportExcelAll() {
 	row.WriteSlice(&cellName, -1)
 
 	for idx, item := range list {
-		dataString := strconv.Itoa(idx+1) + "," + item.CompanyName + "," + svc.TrimSpaceForString(item.Business) + "," + utils.ToStr(item.ValidityFrom.Format("2006-01-02")) + "," +
-			utils.ToStr(item.ValidityTo.Format("2006-01-02")) + "," + item.Remark
+		validityFrom := utils.ToStr(item.ValidityFrom.Format("2006-01-02"))
+		if validityFrom == "0001-01-01" {
+			validityFrom = ""
+		}
+		dataString := strconv.Itoa(idx+1) + "," + item.CompanyName + "," + svc.TrimSpaceForString(item.Business) + "," + validityFrom + "," +
+			utils.ToStr(item.ValidityTo.Format("2006-01-02")) + "," + item.DutyDept + "," + item.Remark
 		cellName := strings.Split(dataString, ",")
 		row := sheet.AddRow()
 		row.WriteSlice(&cellName, -1)

+ 215 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -1198,6 +1198,221 @@ func (this *OilSupplierController) GetJoinStoreEntityList() {
 	this.ServeJSON()
 }
 
+// @Title 企业入库列表-导出
+// @Description get user by token
+// @Success 200 {object} []supplier.OilSupplier
+// @router /exportStoreList [get]
+func (this *OilSupplierController) ExportStoreList() {
+
+	//获取分页信息
+	where := " 1=1 "
+	orderby := "Id"
+	asc := false
+	Order := this.GetString("Order")
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop
+		if Order == "asc" {
+			asc = true
+		}
+	}
+	SupplierName := this.GetString("SupplierName")
+	Grade := this.GetString("Grade")
+	SupplierTypeName := this.GetString("SupplierTypeName")
+	CreateOn := this.GetString("CreateOn")
+	SupplierTypeCode := this.GetString("SupplierTypeCode")
+	OperType := this.GetString("OperType")
+	SpecTypeCode := this.GetString("SpecTypeCode")
+	Country := this.GetString("Country")
+	InStyle := this.GetString("InStyle")
+	MgrUnit := this.GetString("MgrUnit")
+	PACNumber := this.GetString("PACNumber")
+	CommercialNo := this.GetString("CommercialNo")
+	Province := this.GetString("Province")
+	City := this.GetString("City")
+	Street := this.GetString("Street")
+	Address := this.GetString("Address")
+	LinkProvince := this.GetString("LinkProvince")
+	LinkCity := this.GetString("LinkCity")
+	LinkStreet := this.GetString("LinkStreet")
+	LinkAddress := this.GetString("LinkAddress")
+	LegalPerson := this.GetString("LegalPerson")
+	ContactName := this.GetString("ContactName")
+	CompanyType := this.GetString("CompanyType")
+	SetupTime := this.GetString("SetupTime")
+	RegCapital1 := this.GetString("RegCapital1")
+	RegCapital2 := this.GetString("RegCapital2")
+	BusinessScope := this.GetString("BusinessScope")
+	Code := this.GetString("Code")
+	InFlag := this.GetString("InFlag")
+
+	if SupplierName != "" {
+		where = where + " and a.SupplierName like '%" + SupplierName + "%'"
+	}
+	if Grade != "" {
+		where = where + " and a.Grade = '" + Grade + "'"
+	}
+	if SupplierTypeName != "" {
+		where = where + " and b.SupplierTypeName like '%" + SupplierTypeName + "%'"
+	}
+	if CreateOn != "" {
+		dates := strings.Split(CreateOn, ",")
+		if len(dates) == 2 {
+			minDate := dates[0]
+			maxDate := dates[1]
+			where = where + " and b.CreateOn>='" + minDate + "' and b.CreateOn<='" + maxDate + "'"
+		}
+	}
+	if SupplierTypeCode != "" {
+		where = where + " and b.SupplierTypeCode ='" + SupplierTypeCode + "'"
+	}
+	if OperType != "" {
+		where = where + " and a.OperType like '%" + OperType + "%'"
+	}
+	if SpecTypeCode != "" {
+		where = where + " and a.SpecTypeCode = '" + SpecTypeCode + "'"
+	}
+	if Country != "" {
+		where = where + " and a.Country like '%" + Country + "%'"
+	}
+	if InStyle != "" {
+		where = where + " and b.InStyle ='" + InStyle + "'"
+	}
+	if MgrUnit != "" {
+		where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
+	}
+	if PACNumber != "" {
+		where = where + " and a.PACNumber ='" + PACNumber + "'"
+	}
+	if CommercialNo != "" {
+		where = where + " and a.CommercialNo ='" + CommercialNo + "'"
+	}
+	if Province != "" {
+		where = where + " and a.Province ='" + Province + "'"
+	}
+	if City != "" {
+		where = where + " and a.City ='" + City + "'"
+	}
+	if Street != "" {
+		where = where + " and a.Street ='" + Street + "'"
+	}
+	if Address != "" {
+		where = where + " and a.Address ='" + Address + "'"
+	}
+	if LinkProvince != "" {
+		where = where + " and a.LinkProvince ='" + LinkProvince + "'"
+	}
+	if LinkCity != "" {
+		where = where + " and a.LinkCity ='" + LinkCity + "'"
+	}
+	if LinkStreet != "" {
+		where = where + " and a.LinkStreet ='" + LinkStreet + "'"
+	}
+	if LinkAddress != "" {
+		where = where + " and a.LinkAddress ='" + LinkAddress + "'"
+	}
+	if LegalPerson != "" {
+		where = where + " and a.LegalPerson ='" + LegalPerson + "'"
+	}
+	if ContactName != "" {
+		where = where + " and a.ContactName ='" + ContactName + "'"
+	}
+	if CompanyType != "" {
+		where = where + " and a.CompanyType like '%" + CompanyType + "%'"
+	}
+	if SetupTime != "" {
+		where = where + " and a.SetupTime ='" + SetupTime + "'"
+	}
+	//注册资金范围
+	if RegCapital1 != "" {
+		where = where + " and a.RegCapital >= '" + RegCapital1 + "'"
+	}
+	if RegCapital2 != "" {
+		where = where + " and a.RegCapital <= '" + RegCapital2 + "'"
+	}
+	if BusinessScope != "" {
+		where = where + " and a.BusinessScope like '%" + BusinessScope + "%'"
+	}
+	status := this.GetString("Status")
+
+	if status != "" {
+		where = where + " and b.Status='" + status + "'"
+	}
+
+	if InFlag != "" {
+		where = where + " and b.InFlag='" + InFlag + "'"
+	}
+
+	//企业用户只看自己的数据记录
+	/*parameterSvc := baseparameter.GetBaseparameterService(utils.DBE) //取出外部门ID
+	extOrganizeId := parameterSvc.GetBaseparameterMessage("GFGL", "paramset", "ExtOrganizeId")
+	if extOrganizeId == this.User.DepartmentId {
+		where = where + " and a.CreateUserId = '" + this.User.Id + "'"
+	}*/
+
+	//企业用户必须加创建人条件
+	if this.User.IsCompanyUser == 1 {
+		where = where + " and a.CreateUserId = '" + this.User.Id + "'"
+	}
+
+	svc := supplier.GetOilSupplierService(utils.DBE)
+	var list []supplier.OilSupplierView
+	var Ids supplier.OilCertIds
+
+	if Code != "" {
+		where1 := " SupplierTypeCode = '" + SupplierTypeCode + "' and Code like '" + Code + "%'"
+		svc.GetCertIds(&Ids, where1)
+	}
+
+	svc.GetMyPagingEntitiesWithOrderBytbl2(OilSupplierName, OilSupplierCertName, 1, 5000, orderby, asc, &list, where, Code, Ids.Ids)
+
+	fileTitle := "已入库"
+	showColumnArr := "序号,准入标识,准入证编号,准入类别,企业名称,有效期,工商注册号,省市县,单位地址,注册资本,币种,联系人姓名,公司类型,成立时间,开户银行,银行账号,电子邮箱,银行信用等级,移动电话,固定电话,传真,公司电话,备注"
+
+	f := xlsx.NewFile()
+	sheet, _ := f.AddSheet(fileTitle)
+	cellName := strings.Split(showColumnArr, ",")
+	row := sheet.AddRow()
+	row.WriteSlice(&cellName, -1)
+
+	for idx, item := range list {
+		regCapital := strconv.FormatFloat(item.RegCapital, 'f', 2, 64)
+		inStyle := ""
+		if item.InFlag == "1" {
+			inStyle = "准入"
+		} else if item.InFlag == "2" {
+			inStyle = "暂停"
+		} else if item.InFlag == "3" {
+			inStyle = "取消"
+		}
+		dataString := strconv.Itoa(idx+1) + "," + inStyle + "," + item.AccessCardNo + "," + item.SupplierTypeName + "," + item.SupplierName + "," +
+			utils.ToStr(item.ApplyTime.Format("2006-01-02")) + "," + item.CommercialNo + "," + item.AllAddress + "," + item.Address + ","  + regCapital + "," + item.Currency + "," + item.ContactName + "," + item.CompanyType + "," + utils.ToStr(item.SetupTime.Format("2006-01-02")) + "," + item.DepositBank + "," + item.BankAccount + "," + item.EMail + "," + item.BankCreditRating + "," + item.Mobile + ","  + item.Telphone + ","  + item.Fax + "," + item.CompanyTel + "," + item.Remark
+		cellName := strings.Split(dataString, ",")
+		row := sheet.AddRow()
+		row.WriteSlice(&cellName, -1)
+	}
+	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(), "20060102") + fileTitle + ".xlsx"
+	f.Save(path)
+	var sw *Seaweed
+	var filer []string
+	if _filer := os.Getenv("GOSWFS_FILER_URL"); _filer != "" {
+		filer = []string{_filer}
+	}
+	sw = NewSeaweed("http", utils.Cfg.MustValue("file", "upFileHost"), filer, 2*1024*1024, 5*time.Minute)
+	_, _, fID, _ := sw.UploadFile(path, "", "")
+
+	retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
+	os.Remove(path)
+	fmt.Println("==retDocWatermarkUrl==", retDocUrl)
+	this.Data["json"] = retDocUrl
+	this.ServeJSON()
+}
+
 // @Title 获取列表
 // @Description get user by token
 // @Success 200 {object} []supplier.OilSupplierView

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

@@ -34,6 +34,13 @@ export default {
       params: params
     })
   },
+  exportStoreList (CreateOn, params, myAxios) {
+    return myAxios({
+      url: '/supplier/exportStoreList?CreateOn=' + CreateOn,
+      method: 'GET',
+      params: params
+    })
+  },
   getMyTasks (CreateOn, params, myAxios) {
     return myAxios({
       url: '/supplier/mytasks?CreateOn=' + CreateOn,

+ 43 - 2
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/index.vue

@@ -40,7 +40,7 @@
             </el-dropdown>
           </el-form-item>
           <el-form-item>
-            <el-button type="primary" size="mini" @click="exportExcel">导出</el-button>
+            <el-button type="primary" size="mini" @click="exportExcel" :loading="exportLoading">导出</el-button>
           </el-form-item>
         </el-form>
       </div>
@@ -321,6 +321,7 @@
     data () {
       return {
         tableLoading: false,
+        exportLoading: false,
         dialogVisible: false,
         // 列表数据
         entityList: [],
@@ -820,7 +821,7 @@
         })
       },
       //  列表打印导出功能
-      exportExcel () {
+      exportExcelOld () {
         /* generate workbook object from table */
         let table = document.querySelector('#rebateSetTable').cloneNode(true) // 克隆备份(原table不动)
         // 因为element-ui的表格的fixed属性导致多出一个table,会下载重复内容,这里删除掉
@@ -846,6 +847,46 @@
         }
         return wbout
       },
+      exportExcel () {
+        this.exportLoading = true
+        // 分页及列表条件
+        let params = {
+          _currentPage: this.currentPage,
+          _size: this.size,
+          Order: this.Column.Order,
+          Prop: this.Column.Prop,
+          SupplierTypeName: '',
+          Status: '8'
+        }
+        let myCreateOn = []
+        // 解析时间
+        if (this.CreateOn && this.CreateOn.length == 2) {
+          this.CreateOn[1].setHours(23)
+          this.CreateOn[1].setMinutes(59)
+          this.CreateOn[1].setSeconds(59)
+          myCreateOn.push(this.formatDateTime(this.CreateOn[0]))
+          myCreateOn.push(this.formatDateTime(this.CreateOn[1]))
+        }
+        // 查询条件
+        Object.assign(params, this.searchForm)
+        // 访问接口
+        api.exportStoreList(myCreateOn.join(','), params, this.$axios).then(res => {
+          this.$message({
+            duration: 10000,
+            type: 'success',
+            message: "导出成功"
+          })
+          this.exportLoading = false
+          let docurl = res.data
+          // 内网服务器专用
+          if (process.client && docurl.indexOf('upfile') === 0) {
+            const myDomain = window.location.host
+            location.href = 'http://' + myDomain + '/' + docurl
+          } else {
+            location.href = 'http://' + docurl
+          }
+        })
+      },
       getDictOptions () {
         api.getDictList(this.$axios).then(res => {
           this.dictData = res.data.items