소스 검색

对比显示差异

Liuqi 6 년 전
부모
커밋
7260f5166e

+ 37 - 11
src/dashoo.cn/backend/api/business/oilsupplier/suppliercertsub/oilsuppliercertsub.go

@@ -10,7 +10,7 @@ type OilSupplierCertSub struct {
 	SupplierCertId       int       `xorm:"not null comment('供方准入证书信息表主键') INT(10)"`
 	SupplierCertAppendId int       `xorm:"not null comment('增项信息表ID') INT(10)"`
 	GoodsLevel           string    `xorm:"not null default '' comment('级别')"`
-	IsManufacturer		 int	   `xorm:"not null comment('是否为供应商') INT(11)"`
+	IsManufacturer       int       `xorm:"not null comment('是否为供应商') INT(11)"`
 	SupplierTypeCode     string    `xorm:"not null default '' comment('准入类别代码') VARCHAR(5)"`
 	SubClassId           int       `xorm:"not null comment('分类表主键(物资类或基建类或技术服务类)') INT(10)"`
 	Code                 string    `xorm:"not null default '' comment('分类编码') VARCHAR(8)"`
@@ -57,7 +57,7 @@ type Tmp_OilSupplierCertSub struct {
 	SupplierCertId       int       `xorm:"not null comment('供方准入证书信息表主键') INT(10)"`
 	SupplierCertAppendId int       `xorm:"not null comment('增项信息表ID') INT(10)"`
 	GoodsLevel           string    `xorm:"not null default '' comment('级别')"`
-	IsManufacturer		 int	   `xorm:"not null comment('是否为供应商') INT(11)"`
+	IsManufacturer       int       `xorm:"not null comment('是否为供应商') INT(11)"`
 	SupplierTypeCode     string    `xorm:"not null default '' comment('准入类别代码') VARCHAR(5)"`
 	SubClassId           int       `xorm:"not null comment('分类表主键(物资类或基建类或技术服务类)') INT(10)"`
 	Code                 string    `xorm:"not null default '' comment('分类编码') VARCHAR(8)"`
@@ -76,15 +76,15 @@ type Tmp_OilSupplierCertSub struct {
 }
 
 type goodsChecked struct {
-	Id       string `json:"id"`
-	Code     string
-	Name     string
-	CodeName string
+	Id         string `json:"id"`
+	Code       string
+	Name       string
+	CodeName   string
 	GoodsLevel string
 }
 type SupplierCertSubModel struct {
 	CheckList        []goodsChecked //批量添加准入范围
-	Id               int            `xorm:"<- not null pk autoincr INT(10)"`
+	Id               int `xorm:"<- not null pk autoincr INT(10)"`
 	SupplierId       int
 	SupplierCertId   int
 	SupplierTypeCode string
@@ -103,7 +103,7 @@ type techChecked struct {
 }
 type TechnologySubModel struct {
 	CheckList        []techChecked //批量添加准入范围
-	Id               int           `xorm:"<- not null pk autoincr INT(10)"`
+	Id               int `xorm:"<- not null pk autoincr INT(10)"`
 	SupplierId       int
 	SupplierCertId   int
 	SupplierTypeCode string
@@ -152,9 +152,6 @@ type OilSupplierOpinion struct {
 	ModifiedBy        string    `xorm:"VARCHAR(50)"`
 }
 
-
-
-
 type OilSupplierCert2File struct {
 	Id               int       `xorm:"not null pk autoincr INT(10)"`
 	SupplierId       int       `xorm:"not null default 0 comment('供方基本信息表主键') INT(10)"`
@@ -174,3 +171,32 @@ type OilSupplierCert2File struct {
 	ModifiedUserId   int       `xorm:"INT(10)"`
 	ModifiedBy       string    `xorm:"VARCHAR(50)"`
 }
+
+//对比分析差异表
+type OilCompare struct {
+	SortCoding         string //分类编码
+	SortName           string //分类名称
+	Level              string //级别
+	SupplierCode       string //供应商编码
+	SupplierName       string //供应商名称
+	SurplusCount       string //管理单位类型
+	ManagementUnitType string //产品变更类型
+	EliminationCause   string //剔除原因
+	AccessList         string //准入单位
+	SupplierSubTime    string //供应商提交时间
+	ProductType        string //产品类型
+	Editor             string //编辑人
+	EditingTime        string //编辑时间
+	FlowState          string //流程状态
+	ProcessNotes       string //流程备注
+	Reviewime          string //复核时间
+	Brand              string //品牌
+	WorkCode           string //工作单编码
+	WorkType           string //工作单类型
+	ProductScope       string //产品服务范围
+	IsBid              string //是否公开中标
+	MoreInfo           string //备注
+	ManufacturerCode   string //代理的制造商编码
+	ManufacturerName   string //代理的制造商名称
+	Diff			   string //是否为比对出的不同项
+}

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

@@ -1992,3 +1992,84 @@ func (this *OilGoodsAptitudeController) FindInconformity() {
 		this.ServeJSON()
 	}
 }
+
+// @Title get 导入excel对比差异
+// @Description get SampleType by token
+// @Success 200 {object} sampletype.SampleType
+// @router /oilcompare [get]
+func (this *OilGoodsAptitudeController) OilCompare() {
+
+	url := this.GetString("ExcelUrl")
+	session := utils.DBE.NewSession()
+	err := session.Begin()
+	svc := goodsaptitude.GetOilGoodsAptitudeSession(session)
+
+	timeUnixNano := strconv.FormatInt(int64(time.Now().UnixNano()), 10)
+	_dir := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx"
+	utils.DownloadFile(url, timeUnixNano+".xlsx", _dir)
+	filePath := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx/" + timeUnixNano + ".xlsx"
+	xlFile, err := xlsx.OpenFile(filePath)
+
+	//excelFileName := "F:/物资类项目与资质对照表-2017.xlsx"
+	if err != nil {
+		fmt.Printf("open failed: %s\n", err)
+	}
+	var sheet = xlFile.Sheets[0]
+	defer func() {
+		session.Close()
+	}()
+
+	var List []supplier.OilSupplier
+	var Comparelist []suppliercertsub.OilCompare
+	var Compare suppliercertsub.OilCompare
+	var CompanyName = sheet.Rows[2].Cells[4].Value
+	where := "SupplierName = '" + CompanyName + "'"
+	svc.GetEntitysByWhere(OilSupplierName, where, &List)
+
+	for i := 2; i < len(sheet.Rows); i++ {
+		Compare.SortCoding = sheet.Rows[i].Cells[0].Value
+		Compare.SortName = sheet.Rows[i].Cells[1].Value
+		Compare.Level = sheet.Rows[i].Cells[2].Value
+		//Compare.SupplierCode = sheet.Rows[i].Cells[3].Value
+		Compare.SupplierName = sheet.Rows[i].Cells[4].Value
+		//Compare.SurplusCount = sheet.Rows[i].Cells[5].Value
+		Compare.ManagementUnitType = sheet.Rows[i].Cells[6].Value
+		//Compare.EliminationCause = sheet.Rows[i].Cells[7].Value
+		//Compare.AccessList = sheet.Rows[i].Cells[8].Value
+		//Compare.SupplierSubTime = sheet.Rows[i].Cells[9].Value
+		//Compare.ProductType = sheet.Rows[i].Cells[10].Value
+		//Compare.Editor = sheet.Rows[i].Cells[11].Value
+		//Compare.EditingTime = sheet.Rows[i].Cells[12].Value
+		//Compare.FlowState = sheet.Rows[i].Cells[13].Value
+		//Compare.ProcessNotes = sheet.Rows[i].Cells[14].Value
+		//Compare.Reviewime = sheet.Rows[i].Cells[15].Value
+		//Compare.Brand = sheet.Rows[i].Cells[16].Value
+		//Compare.WorkCode = sheet.Rows[i].Cells[17].Value
+		//Compare.WorkType = sheet.Rows[i].Cells[18].Value
+		//Compare.ProductScope = sheet.Rows[i].Cells[19].Value
+		//Compare.IsBid = sheet.Rows[i].Cells[20].Value
+		//Compare.MoreInfo = sheet.Rows[i].Cells[21].Value
+		//Compare.ManufacturerCode = sheet.Rows[i].Cells[22].Value
+		//Compare.ManufacturerName = sheet.Rows[i].Cells[23].Value
+		Compare.Diff = "0"
+		if len(List)<1 {
+			Compare.Diff = "1"
+		}
+		if len(List)>0 {
+			var certsublist2 []suppliercertsub.OilSupplierCertSub
+			namewhere := "SupplierId = '" + strconv.Itoa(List[0].Id) + "' and Code ='" + Compare.SortCoding + "'"
+			svc.GetEntitysByWhere(OilSupplierCertSubName, namewhere, &certsublist2)
+			if len(certsublist2) < 1 {
+				Compare.Diff = "1"
+			}
+		}
+		Comparelist = append(Comparelist, Compare)
+	}
+
+	os.Remove(filePath)
+
+	var datainfo DataInfo
+	datainfo.Items = Comparelist
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}

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

@@ -138,5 +138,12 @@ export default {
       method: 'post',
       data: formdata
     })
+  },
+  oilcompare (params, myAxios) {
+    return myAxios({
+      url: '/goodsaptitude/oilcompare',
+      method: 'get',
+      params: params
+    })
   }
 }

+ 140 - 0
src/dashoo.cn/frontend_web/src/pages/oilsupplier/oilcompare/index.vue

@@ -0,0 +1,140 @@
+<template>
+  <div>
+    <el-breadcrumb class="heading">
+      <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
+      <el-breadcrumb-item :to="{ path: '/oilsupplier/goodsaptitude' }">审验对比</el-breadcrumb-item>
+    </el-breadcrumb>
+    <el-card class="box-card" style="height: calc(100vh - 115px);" v-loading="loading">
+      <div slot="header">
+        <span>
+          <i class="el-icon-document-copy"></i> 审验对比
+        </span>
+        <span style="float: right;">
+            <el-row>
+                <el-col :span="12">
+                    <el-upload multiple action="" ref="refuploadattach"
+                                :http-request="uploadrequest" :before-upload="beforeAvatarUpload">
+                        <el-button style="margin-left:10px; margin-top: -4px;" size="small" type="primary">点击上传</el-button>
+                    </el-upload>
+                </el-col>
+                <el-col :span="12">
+                    <el-button size="small" style="margin-left:10px; margin-top: -4px;" type="primary" @click="uploadExcel()">审验对比</el-button>
+                </el-col>
+            </el-row>
+        </span>
+      </div>
+      <el-table id="rebateSetTable" :data="entityList" size="mini" v-loading="loading" border height="calc(100vh - 243px)"
+        style="width: 100%"  :v-loading="importloading" :row-class-name="compareline">
+        <el-table-column label="分类编码"  prop="SortCoding" align="center"></el-table-column>
+        <el-table-column label="分类名称"  prop="SortName" align="center"></el-table-column>
+        <el-table-column label="级别"  prop="Level" align="center"></el-table-column>
+        <el-table-column label="供应商名称"  prop="SupplierName" align="center"></el-table-column>
+        <el-table-column label="产品变更类型"  prop="ManagementUnitType" align="center"></el-table-column>
+      </el-table>
+    </el-card>
+  </div>
+</template>
+<script>
+  import {
+    mapGetters
+  } from 'vuex'
+  import api from '@/api/oilsupplier/goodsaptitude'
+  import axios from 'axios'
+  import uploadajax from '@/assets/js/uploadajax.js'
+
+  export default {
+    computed: {
+      ...mapGetters({
+        authUser: 'authUser'
+      })
+    },
+    name: 'oilgoodsaptitude',
+
+    data () {
+      return {
+          importloading:false,
+          currentPage:1,
+          currentItemCount: 0,
+          size: 10,
+          loading: false,
+          entityList:[],
+          Excelurl: '',
+      }
+    },
+    created () {
+
+    },
+    methods: {
+      uploadExcel () {
+        this.importloading = true
+        let params = {
+          ExcelUrl: this.Excelurl
+        }
+        if(this.Excelurl != ''){
+          api.oilcompare(params, this.$axios).then(res => {
+              if (res.data.items) {
+                  this.entityList = res.data.items
+                  this.importloading = false
+                }
+          })
+        }else if (this.Excelurl == '') {
+                this.$message({
+                type: 'warning',
+                message: '获取文件地址错误!'
+                })
+            }
+      },
+      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
+      },
+      compareline({row, rowIndex}){
+        if (row.Diff == "1") {
+          return 'warning-row'
+        }
+      }
+    }
+  }
+</script>
+
+<style>
+  .el-pagination {
+    margin: 1rem 0 2rem;
+    text-align: right;
+  }
+  .el-table .warning-row {
+  background: #FFCCCC;
+  }
+</style>