2
3
فهرست منبع

导入中石油准入编码

lining 6 سال پیش
والد
کامیت
b8ff2e50ec

+ 106 - 49
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -6,6 +6,9 @@ import (
 	"dashoo.cn/backend/api/business/register"
 	"encoding/json"
 	"fmt"
+	"github.com/tealeg/xlsx"
+	"log"
+	"os"
 	"strconv"
 	"strings"
 	"time"
@@ -498,7 +501,6 @@ func (this *OilSupplierController) GetJoinCertEntityList() {
 		where = where + " and a.BusinessScope like '%" + BusinessScope + "%'"
 	}
 
-
 	//企业用户只看自己的数据记录
 	/*parameterSvc := baseparameter.GetBaseparameterService(utils.DBE) //取出外部门ID
 	extOrganizeId := parameterSvc.GetBaseparameterMessage("GFGL", "paramset", "ExtOrganizeId")
@@ -508,10 +510,10 @@ func (this *OilSupplierController) GetJoinCertEntityList() {
 	svc := supplier.GetOilSupplierService(utils.DBE)
 	var registerUser register.OilCorporateInfo
 	sql := " UserName='" + this.User.Username + "'"
-	svc.GetEntity(&registerUser,sql)
+	svc.GetEntity(&registerUser, sql)
 	//企业用户必须加创建人条件
 	if this.User.IsCompanyUser == 1 {
-		where = where + " and (a.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='"+registerUser.CommercialNo+"')"
+		where = where + " and (a.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')"
 	} else {
 		//超级管理员和有查看所有数据权限的用户不加条件
 		svcPerm := permission.GetPermissionService(utils.DBE)
@@ -522,7 +524,6 @@ func (this *OilSupplierController) GetJoinCertEntityList() {
 
 	}
 
-
 	var list []supplier.OilSupplierView
 
 	total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
@@ -536,7 +537,6 @@ func (this *OilSupplierController) GetJoinCertEntityList() {
 	this.ServeJSON()
 }
 
-
 // @Title 获取集中评审列表
 // @Description get user by token
 // @Success 200 {object} []supplier.OilSupplier
@@ -688,16 +688,16 @@ func (this *OilSupplierController) GetJZPSJoinCertEntityList() {
 			var certIdList string
 			ids := actisvc.GetAllMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id)
 			if len(strings.Trim(ids, ",")) > 0 {
-				certIdList += strings.Trim(ids, ",")+ ","
+				certIdList += strings.Trim(ids, ",") + ","
 			}
 			ids = actisvc.GetAllMyTasks(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, this.User.Id)
 			if len(strings.Trim(ids, ",")) > 0 {
-				certIdList += strings.Trim(ids, ",")+ ","
+				certIdList += strings.Trim(ids, ",") + ","
 			}
 
 			ids = actisvc.GetAllMyTasks(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, this.User.Id)
 			if len(strings.Trim(ids, ",")) > 0 {
-				certIdList += strings.Trim(ids, ",")+ ","
+				certIdList += strings.Trim(ids, ",") + ","
 			}
 
 			//ids = actisvc.GetAllMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id)
@@ -1418,7 +1418,6 @@ func (this *OilSupplierController) GetDictListByStatus() {
 		dictList["MgrUnit"] = false
 	}
 
-
 	var datainfo DataInfo
 	datainfo.Items = dictList
 	this.Data["json"] = &datainfo
@@ -1479,13 +1478,13 @@ func (this *OilSupplierController) GetEntityByName() {
 	sqlsus += ` left join ` + OilSupplierCertName + ` b on b.SupplierId = a.Id`
 	sqlsus += ` where a.SupplierName ='` + name + `' and b.InFlag='2' and b.SupplierTypeCode='` + typecode + `'`
 	var tempMap []map[string]string
-	tempMap,_=svc.DBE.QueryString(sqlsus)
+	tempMap, _ = svc.DBE.QueryString(sqlsus)
 
-	if tempMap!=nil && tempMap[0]["1"] !=""{
+	if tempMap != nil && tempMap[0]["1"] != "" {
 		datainfo.Code = -1
 		this.Data["json"] = &datainfo
 		this.ServeJSON()
-	}else {
+	} else {
 		var sql string
 		sql = `select a.*,b.InStyle,b.Status from ` + OilSupplierName + ` a `
 		sql += ` left join ` + OilSupplierCertName + ` b on b.SupplierId = a.Id and b.SupplierTypeCode='` + typecode + `'`
@@ -1509,7 +1508,7 @@ func (this *OilSupplierController) GetEntityByName() {
 				this.Data["json"] = &datainfo
 				this.ServeJSON()
 			}
-		}else{
+		} else {
 			datainfo.Code = 0
 			datainfo.Item = model
 			this.Data["json"] = &datainfo
@@ -1533,7 +1532,7 @@ func (this *OilSupplierController) AddEntity() {
 	serviceCert := suppliercert.GetOilSupplierCertService(utils.DBE)
 	var registerUser register.OilCorporateInfo
 	sql := " UserName='" + this.User.Username + "'"
-	serviceCert.GetEntity(&registerUser,sql)
+	serviceCert.GetEntity(&registerUser, sql)
 	canApply := serviceCert.IsCanApplyByExtOrganizeUser(modelCertVM.SupplierTypeCode, registerUser.CommercialNo, this.User.Id, this.User.IsCompanyUser)
 	var errinfo ErrorDataInfo
 	if !canApply {
@@ -1671,7 +1670,7 @@ func (this *OilSupplierController) UpdateEntity() {
 	updateCols := svc.GetUpdateCols(OilSupplierCertName, typeCode, model.Id)
 	err := svc.UpdateEntityBytbl(OilSupplierName, id, &model, updateCols)
 	if err == nil {
-		svc.DBE.Exec("update OilSupplierCert set Instyle="+instyle+" where SupplierId="+id+" and SupplierTypeCode="+typeCode+"")
+		svc.DBE.Exec("update OilSupplierCert set Instyle=" + instyle + " where SupplierId=" + id + " and SupplierTypeCode=" + typeCode + "")
 		errinfo.Message = "修改成功!"
 		errinfo.Code = 0
 		this.Data["json"] = &errinfo
@@ -1797,19 +1796,19 @@ func (this *OilSupplierController) DeleteAllEntity() {
 		return
 	}
 	svc := supplier.GetOilSupplierService(utils.DBE)
-	err:=svc.DeleteEntityBytbl(OilSupplierCertName,"SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
-	err =svc.DeleteEntityBytbl(OilSupplierCert2FileName,"SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
-	err =svc.DeleteEntityBytbl(OilSupplierFileName,"SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
+	err := svc.DeleteEntityBytbl(OilSupplierCertName, "SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
+	err = svc.DeleteEntityBytbl(OilSupplierCert2FileName, "SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
+	err = svc.DeleteEntityBytbl(OilSupplierFileName, "SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
 
 	var model1 suppliercertsub.OilSupplierCert2File
 	count1, _ := svc.GetCount(&model1, "SupplierId="+Id)
-	if count1==0{
-		err=svc.DeleteEntityBytbl(OilSupplierFileName,"SupplierId="+Id)
+	if count1 == 0 {
+		err = svc.DeleteEntityBytbl(OilSupplierFileName, "SupplierId="+Id)
 	}
 	var model2 suppliercert.OilSupplierCert
 	count2, _ := svc.GetCount(&model2, "SupplierId="+Id)
-	if count2==0{
-		err=svc.DeleteEntityBytbl(OilSupplierName,"Id="+Id)
+	if count2 == 0 {
+		err = svc.DeleteEntityBytbl(OilSupplierName, "Id="+Id)
 	}
 	if err == nil {
 		errinfo.Message = "删除成功"
@@ -1823,6 +1822,7 @@ func (this *OilSupplierController) DeleteAllEntity() {
 		this.ServeJSON()
 	}
 }
+
 // @Title 判断是否可以申请准入
 // @Description
 // @Success 200 {string} Count
@@ -1842,27 +1842,27 @@ func (this *OilSupplierController) IsCanApply() {
 	svc := suppliercert.GetOilSupplierCertService(utils.DBE)
 	var registerUser register.OilCorporateInfo
 	sql := " UserName='" + this.User.Username + "'"
-	svc.GetEntity(&registerUser,sql)
+	svc.GetEntity(&registerUser, sql)
 	canApply := svc.IsCanApplyByExtOrganizeUser(Type, registerUser.CommercialNo, this.User.Id, this.User.IsCompanyUser)
 
 	if canApply {
 		//判断是否是暂停
-		if this.User.IsCompanyUser==1{
+		if this.User.IsCompanyUser == 1 {
 			var tempMap []map[string]string
-			sql:= "select 1 from OilSupplier a left join OilSupplierCert b on a.Id=b.SupplierId where (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='"+ registerUser.CommercialNo+"') and b.InFlag='2' and b.SupplierTypeCode='"+Type+"'"
-			tempMap,_=svc.DBE.QueryString(sql)
-			if tempMap!=nil && tempMap[0]["1"] !="" {
+			sql := "select 1 from OilSupplier a left join OilSupplierCert b on a.Id=b.SupplierId where (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "') and b.InFlag='2' and b.SupplierTypeCode='" + Type + "'"
+			tempMap, _ = svc.DBE.QueryString(sql)
+			if tempMap != nil && tempMap[0]["1"] != "" {
 				errinfo.Message = "已暂停,不可申请"
 				errinfo.Code = -2
 				this.Data["json"] = &errinfo
 				this.ServeJSON()
-			}else{
+			} else {
 				errinfo.Message = "无申请记录,可以申请"
 				errinfo.Code = 0
 				this.Data["json"] = &errinfo
 				this.ServeJSON()
 			}
-		}else{
+		} else {
 			errinfo.Message = "无申请记录,可以申请"
 			errinfo.Code = 0
 			this.Data["json"] = &errinfo
@@ -1965,7 +1965,7 @@ func (this *OilSupplierController) GetFirAuditerByDept() {
 	userIds := strings.Replace(tempstr, "uid_", "", -1)
 	userIds = strings.Trim(userIds, ",")
 	if userIds != "" {
-		where := "Id in (" + userIds + ")" + "and (UnitId=" + Id + " or Departmentid in (" + alldep +")) "
+		where := "Id in (" + userIds + ")" + "and (UnitId=" + Id + " or Departmentid in (" + alldep + ")) "
 		svc.GetEntities(&userlist, where)
 	}
 
@@ -2042,7 +2042,6 @@ func (this *OilSupplierController) GetAuditerByDeptAndNoLogin() {
 		svc.GetEntities(&userlist, where)
 	}
 
-
 	//certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
 	//var users []userRole.Base_RoleList
 	//certSrv.GetAuditUser(Id, auditstepcode, &users)
@@ -2053,8 +2052,6 @@ func (this *OilSupplierController) GetAuditerByDeptAndNoLogin() {
 	this.ServeJSON()
 }
 
-
-
 // @Title
 // @Description
 // @router /getjurisdiction [get]
@@ -2072,7 +2069,7 @@ func (this *OilSupplierController) GetJurisdiction() {
 // @Description get user by token
 // @Success 200 {object} []supplier.OilSupplier
 // @router /certlistinterface  [get]
-func (this *OilSupplierController) GetEntityListInterface () {
+func (this *OilSupplierController) GetEntityListInterface() {
 
 	//获取分页信息
 	//page := this.GetPageInfoForm()
@@ -2091,9 +2088,9 @@ func (this *OilSupplierController) GetEntityListInterface () {
 
 	if status == "1" {
 		where += "b.InStyle='1'"
-	}  else if status == "2" {
+	} else if status == "2" {
 		where += "b.InStyle='4'"
-	}  else if status == "3" {
+	} else if status == "3" {
 		where += "b.InStyle='5'"
 	} else if status == "4" {
 		where += "b.InStyle=''"
@@ -2102,7 +2099,7 @@ func (this *OilSupplierController) GetEntityListInterface () {
 	}
 
 	svc := supplier.GetOilSupplierService(utils.DBE)
-	var interfaceData  []supplier.InterfaceData
+	var interfaceData []supplier.InterfaceData
 	err := svc.GetInterfaceData(OilSupplierName, OilSupplierFileName, &interfaceData, where)
 
 	var errinfo ErrorDataInfo
@@ -2136,7 +2133,6 @@ func (this *OilSupplierController) GetEntityByCommercialNo() {
 	this.ServeJSON()
 }
 
-
 // @Title 更新文件上传
 // @Description 更新文件上传
 // @Param	id	path	string	true
@@ -2163,7 +2159,7 @@ func (this *OilSupplierController) EditSubfile() {
 	model.CreateBy = this.User.Realname
 	model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 
-	_,err := svc.InsertEntity(&model)
+	_, err := svc.InsertEntity(&model)
 
 	if err == nil {
 		errinfo.Message = "操作成功!"
@@ -2178,21 +2174,82 @@ func (this *OilSupplierController) EditSubfile() {
 	}
 }
 
+// @Title get 导入excel
+// @Description get SampleType by token
+// @Success 200 {object} sampletype.SampleType
+// @router /importexcel [get]
+func (this *OilSupplierController) ImportExcel() {
+
+	url := this.GetString("ExcelUrl")
+	var errorinfo ErrorInfo
+	if url == "" {
+		errorinfo.Code = -2
+		errorinfo.Message = "导入失败!"
+		this.Data["json"] = &errorinfo
+		this.ServeJSON()
+	}
 
+	svc := supplier.GetOilSupplierService(utils.DBE)
 
+	_dir := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx"
+	filename := strconv.Itoa(int(time.Now().Unix())) + ".xlsx"
+	utils.DownloadFile(url, filename, _dir)
+	t := time.Now()
+	filePath := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx/" + filename
+	xlFile, err := xlsx.OpenFile(filePath)
 
+	//excelFileName := "F:/物资类项目与资质对照表-2017.xlsx"
+	if err != nil {
+		fmt.Printf("open failed: %s\n", err)
+	}
+	var sheet = xlFile.Sheets[0]
 
+	var errLineNum string
 
+	for i := 1; i < len(sheet.Rows); i++ {
+		lineNo := strconv.Itoa(i + 1)
+		if len(sheet.Rows[i].Cells) != 0 {
+			this.OperationCell(svc, lineNo, sheet.Rows[i].Cells, &errLineNum)
+		}
+	}
+	os.Remove(filePath)
 
+	if errLineNum != "" {
+		errorinfo.Code = -1
+		errorinfo.Message = "导入失败!错误行号:" + errLineNum
+		this.Data["json"] = &errorinfo
+		this.ServeJSON()
+	} else {
+		elapsed := time.Since(t)
+		log.Println(elapsed)
+		errorinfo.Code = 0
+		errorinfo.Message = "导入成功!"
+		this.Data["json"] = &errorinfo
+		this.ServeJSON()
+	}
+}
 
+func (this *OilSupplierController) OperationCell(svc *supplier.OilSupplierService, lineNo string, cellsArr []*xlsx.Cell, errLineNum *string) {
 
-
-
-
-
-
-
-
-
-
-
+	defer func() {
+		if err := recover(); err != nil {
+			log.Println("err"+lineNo, err)
+			*errLineNum += lineNo + ","
+		}
+	}()
+
+	cells := cellsArr
+	supplierName := strings.TrimSpace(cells[0].Value)
+	oilCertificateNo := ""
+	if len(cells) >= 2 {
+		oilCertificateNo = strings.TrimSpace(cells[1].Value)
+	}
+	cols := []string{"PACNumber"}
+	var entity supplier.OilSupplier
+	entity.PACNumber = oilCertificateNo
+	where := "SupplierName='" + supplierName + "'"
+	err := svc.UpdateEntityBywheretbl(OilSupplierName, &entity, cols, where)
+	if err != nil {
+		panic(err)
+	}
+}

+ 1 - 1
src/dashoo.cn/frontend_web/nuxt.config.ignore.js

@@ -177,7 +177,7 @@ module.exports = {
     'pages/oilsupplier/suppliernopass/*.*',
     'pages/oilsupplier/supplierps/*.*',
     'pages/oilsupplier/supplierstorage/*.*',
-    'pages/oilsupplier/supplierstore/*.*',
+    // 'pages/oilsupplier/supplierstore/*.*',
     'pages/oilsupplier/tablefieldsetting/*.*',
     // 'pages/oilsupplier/technologyservice/*.*',
     'pages/system/*/*.*',

+ 7 - 7
src/dashoo.cn/frontend_web/nuxt.config.js

@@ -182,13 +182,13 @@ module.exports = {
     baseURL: '//localhost:10091/api/'                       //工作流图片
 
     /* --------Nuxt Start发版用 START-------------- */
-/*
-    appclient:  'gfgl',                            //供方信息管理平台
-    upfilehost: '/uploadfile',                     //附件上传
-    baseURL:    '/api/',                           //本地工作流图片
-    LOCAL_IP:   '10.76.248.23'                     //定义服务器内网IP,word转PDF时用到
-    // API_URL:    'http://10.76.248.23:10091/api/'   //服务器渲染时调用
-*/
+    /*
+        appclient:  'gfgl',                            //供方信息管理平台
+        upfilehost: '/uploadfile',                     //附件上传
+        baseURL:    '/api/',                           //本地工作流图片
+        LOCAL_IP:   '10.76.248.23'                     //定义服务器内网IP,word转PDF时用到
+        // API_URL:    'http://10.76.248.23:10091/api/'   //服务器渲染时调用
+     */
     /* --------Nuxt Start发版用 END-------------- */
   },
 }

+ 8 - 1
src/dashoo.cn/frontend_web/src/api/oilsupplier/supplier.js

@@ -160,5 +160,12 @@ export default {
       url: '/supplier/getentitybycommercialno/' + commercialNo,
       method: 'GET'
     })
-  }
+  },
+  importExcel (params, myAxios) {
+    return myAxios({
+      url: '/supplier/importexcel',
+      method: 'get',
+      params: params
+    })
+  },
 }

+ 0 - 7
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/_opera/basisedit.vue

@@ -555,10 +555,8 @@
         })
       },
       saveApplyTime () {
-        console.log(this.formDataApplyTime, 'formDataApplyTime')
         this.$refs['formDataApplyTime'].validate((valid) => {
           if (valid) {
-            console.log(this.formDataApplyTime, 'formDataApplyTime')
             apiCert.updataApplyTime(this.formData.CertId, this.formDataApplyTime, this.$axios).then(res => {
               if (res.data.code === 0) {
                 this.initDatas()
@@ -583,10 +581,8 @@
         let params = {
           SupplierCertId: this.formData.CertId
         }
-        console.log(params, 'params')
         apiCert.getApplyTimeList(params, this.$axios).then(res => {
           this.historyDatas = res.data
-          console.log(res.data, '==========')
         })
         this.innerVisible = true
       },
@@ -854,7 +850,6 @@
       },
       auditOrgChang (val) {
         let deptid = val[val.length - 1]
-        console.log(deptid)
         this.auditerOption = []
         this.auditer = ''
         let auditstepcode = 'FIRST_TRIAL'
@@ -989,7 +984,6 @@
         this.chooseAuditorVisible = true
       },
       setAuditer (val, name) {
-        console.log('------', val, name)
         this.auditer = val
         this.auditerName = name
         this.chooseAuditorVisible = false
@@ -1005,7 +999,6 @@
         this.applyLoading = true
         this.auditform.FirstAuditName = this.auditer
         this.auditform.CertId = this.certId
-        console.log('--this.auditform---', this.auditform)
         apiCert.auditEntity(this.certId, this.auditform, this.$axios).then(res => {
           if (res.data.code === 0) {
             // 保存成功后,初始化数据,变成修改

+ 0 - 8
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/_opera/goodsedit.vue

@@ -533,10 +533,8 @@
         })
       },
       saveApplyTime () {
-        console.log(this.formDataApplyTime, 'formDataApplyTime')
         this.$refs['formDataApplyTime'].validate((valid) => {
           if (valid) {
-            console.log(this.formDataApplyTime, 'formDataApplyTime')
             apiCert.updataApplyTime(this.formData.CertId, this.formDataApplyTime, this.$axios).then(res => {
               if (res.data.code === 0) {
                 this.initDatas()
@@ -561,10 +559,8 @@
         let params = {
           SupplierCertId: this.formData.CertId
         }
-        console.log(params, 'params')
         apiCert.getApplyTimeList(params, this.$axios).then(res => {
           this.historyDatas = res.data
-          console.log(res.data, '==========')
         })
         this.innerVisible = true
       },
@@ -612,12 +608,10 @@
       printinfo (oper) {
         if (oper < 10) {
           let bdhtml = window.document.body.innerHTML // 获取当前页的html代码
-          console.log(bdhtml)
           let sprnstr = '<!--startprint' + oper + '-->' // 设置打印开始区域
           let eprnstr = '<!--endprint' + oper + '-->' // 设置打印结束区域
           let prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) + 18) // 从开始代码向后取html
           prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr)) // 从结束代码向前取html
-          console.log(prnhtml, 'prnhtml')
           window.document.body.innerHTML = prnhtml
           window.print()
           window.document.body.innerHTML = bdhtml
@@ -753,7 +747,6 @@
         this.isCanUpdateSupplier(this.formData.Id)
         if (this.formData.Id) {
           api.getEntityAndCert(this.certId, this.$axios).then(res => {
-            console.log(res, '================')
             this.formData = res.data
             this.formDataCert.WorkerTotal = this.formData.WorkerTotal
             this.formDataCert.ContractNum = this.formData.ContractNum
@@ -855,7 +848,6 @@
 
       auditOrgChang (val) {
         let deptid = val[val.length - 1]
-        console.log(deptid)
         this.auditerOption = []
         this.auditer = ''
         let auditstepcode = 'FIRST_TRIAL'

+ 0 - 4
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/_opera/techedit.vue

@@ -563,10 +563,8 @@
         })
       },
       saveApplyTime () {
-        console.log(this.formDataApplyTime, 'formDataApplyTime')
         this.$refs['formDataApplyTime'].validate((valid) => {
           if (valid) {
-            console.log(this.formDataApplyTime, 'formDataApplyTime')
             apiCert.updataApplyTime(this.formData.CertId, this.formDataApplyTime, this.$axios).then(res => {
               if (res.data.code === 0) {
                 this.initDatas()
@@ -591,10 +589,8 @@
         let params = {
           SupplierCertId: this.formData.CertId
         }
-        console.log(params, 'params')
         apiCert.getApplyTimeList(params, this.$axios).then(res => {
           this.historyDatas = res.data
-          console.log(res.data, '==========')
         })
         this.innerVisible = true
       },

+ 0 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/basislist.vue

@@ -781,7 +781,6 @@ import certApi from '@/api/oilsupplier/suppliercert'
       getDictOptions () {
         api.getDictList(this.$axios).then(res => {
           this.dictData = res.data.items
-          console.log(this.dictData)
           this.OperTypeOptions = this.dictData['OperType']
           this.UnitRelationOptions = this.dictData['UnitRelation']
           this.InOptions = this.dictData['InOptions']

+ 92 - 3
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/goodslist.vue

@@ -26,10 +26,12 @@
                 <el-dropdown-item command="clear">查询重置</el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
+            <el-button type="primary" size="mini" style="margin-left:20px; margin-top: -4px;" @click="importExcel">导入中石油准入证编号</el-button>
           </el-form-item>
         </el-form>
       </div>
-      <el-table :data="entityList" size="mini" border height="calc(100vh - 243px)" style="width: 100%" @sort-change="orderby">
+      <el-table :data="entityList" size="mini" border height="calc(100vh - 243px)" style="width: 100%" @sort-change="orderby"
+                  v-loading="importloading">
         <el-table-column label="操作" min-width="200" align="center" fixed="right">
           <template slot-scope="scope">
             <router-link :to="'/oilsupplier/supplierstore/' + scope.row.Id + '/goodsedit?certid=' + scope.row.CertId">
@@ -285,12 +287,31 @@
         <el-button size="mini" type="primary" @click="handleSearch">查 询</el-button>
       </span>
     </el-dialog>
-
+    <el-dialog title="上传文件"  width="600px" :visible.sync="uploadshow">
+      <el-form label-width="100px">
+        <el-row>
+          <el-col :span="24">
+            <el-upload multiple style="margin-top: 10px;" action="" ref="refuploadattach"
+                       :http-request="uploadrequest" :before-upload="beforeAvatarUpload">
+              <el-button size="small" type="primary">点击上传</el-button>
+            </el-upload>
+          </el-col>
+          <el-col :span="24">
+            <el-button style="float: right;" size="mini" type="primary" @click="uploadExcel()">确定</el-button>
+          </el-col>
+        </el-row>
+      </el-form>
+    </el-dialog>
+    <el-dialog title="导入失败" :visible.sync="errorDialogVisible" :close-on-click-modal = "false" width="720px">
+      <el-input type="textarea" autosize placeholder="请输入内容" v-model="textarea"></el-input>
+    </el-dialog>
   </div>
 </template>
 <script>
   import { mapGetters } from 'vuex'
   import api from '@/api/oilsupplier/supplier'
+  import axios from 'axios'
+  import uploadajax from '@/assets/js/uploadajax.js'
 
   export default {
     computed: {
@@ -302,6 +323,11 @@
 
     data () {
       return {
+        textarea: '',
+        Excelurl: '',
+        uploadshow: false,
+        importloading: false,
+        errorDialogVisible: false,
         dialogVisible: false,
         // 列表数据
         countryoptions: [],
@@ -535,6 +561,70 @@
       this.getDictOptions()
     },
     methods: {
+      importExcel () {
+        this.uploadshow = true
+      },
+      uploadrequest (option) {
+        let _this = this
+        if (process.client) {
+          const myDomain = window.location.host
+          axios.post(process.env.upfilehost, {})
+            .then(function (res) {
+              if (res.data && res.data.fid && res.data.fid !== '') {
+                if (res.data.publicUrl.indexOf('/upfile') === 0) {
+                  option.action = `http://${myDomain}/${res.data.publicUrl}/${res.data.fid}`
+                } else {
+                  option.action = `http://${res.data.publicUrl}/${res.data.fid}`
+                }
+                uploadajax(option)
+                _this.Excelurl = option.action
+              } else {
+                _this.$message({
+                  type: 'warning',
+                  message: '未上传成功!请刷新界面重新上传!'
+                })
+              }
+            })
+            .catch(res => {
+              _this.$message({
+                type: 'warning',
+                message: '未上传成功!请重新上传!'
+              })
+            })
+        }
+      },
+      beforeAvatarUpload (file) {
+        if (file.name.indexOf('.xlsx') < 0) {
+          this.$message.error('文件格式必须为.xlsx')
+          return false
+        }
+        return true
+      },
+      uploadExcel () {
+        this.importloading = true
+        this.uploadshow = false
+        let params = {
+          ExcelUrl: this.Excelurl
+        }
+        api.importExcel(params, this.$axios).then(res => {
+          this.importloading = false
+          console.log(res)
+          if (res.data.code === 0) {
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else if (res.data.code === -1) {
+            this.errorDialogVisible = true
+            this.textarea = res.data.message
+          } else if (res.data.code === -2) {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        })
+      },
       initDatas () {
         // 分页及列表条件
         let params = {
@@ -595,7 +685,6 @@
       getDictOptions () {
         api.getDictList(this.$axios).then(res => {
           this.dictData = res.data.items
-          console.log(this.dictData)
           this.OperTypeOptions = this.dictData['OperType']
           this.UnitRelationOptions = this.dictData['UnitRelation']
           this.InOptions = this.dictData['InOptions']

+ 0 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/techlist.vue

@@ -783,7 +783,6 @@
      getDictOptions() {
         api.getDictList(this.$axios).then(res => {
            this.dictData = res.data.items
-           console.log(this.dictData)
            this.OperTypeOptions = this.dictData['OperType']
            this.UnitRelationOptions = this.dictData['UnitRelation']
            this.InOptions = this.dictData['InOptions']

+ 10 - 10
src/dashoo.cn/frontend_web/src/pages/system/tmpzcgf.vue

@@ -261,15 +261,6 @@
         //       })
         //   })
       },
-      insertfilename () {
-        this.dialogtitle = '导入资质名称'
-        this.start()
-        this.$axios.get('tmpzcgf/insertFileName')
-          .then(res => {
-            this.reset()
-            this.insertCertSub()
-          })
-      },
       updateSupplerId () {
         this.dialogtitle = '更新Cert表的SupplierID'
         this.start()
@@ -277,7 +268,7 @@
           .then(res => {
             // this.fullscreenLoading = false
             this.reset()
-            this.insertFileName()
+            this.insertfilename()
           })
         // this.$confirm('是否继续?', '提示', {
         //   confirmButtonText: '确定',
@@ -295,6 +286,15 @@
         //       })
         //   })
       },
+      insertfilename () {
+        this.dialogtitle = '导入资质名称'
+        this.start()
+        this.$axios.get('tmpzcgf/insertFileName')
+          .then(res => {
+            this.reset()
+            this.insertCertSub()
+          })
+      },
       insertSupplerCertSub () {
         this.$confirm('是否继续?', '提示', {
           confirmButtonText: '确定',