Browse Source

曾用名查询

Signed-off-by: lijunqing <lijunqing@dashoo.cn>
lijunqing 6 năm trước cách đây
mục cha
commit
93bd62895a

+ 6 - 0
src/dashoo.cn/backend/api/business/oilsupplier/infochange/infochange.go

@@ -179,3 +179,9 @@ type SuppModelInfo struct {
 	LinkZipCode        string    `xorm:"comment('通信地址-邮编') VARCHAR(20)"`
 	HseTraining        string    `xorm:"default '0' comment('是否需要进行HSE审查培训') VARCHAR(2)"`
 }
+
+
+type OilUsedName struct {
+	SupplierName        string    `xorm:"comment('企业名称') VARCHAR(255)"`
+	OldSupplierName     string    `xorm:"comment('曾用名') VARCHAR(255)"`
+}

+ 34 - 0
src/dashoo.cn/backend/api/business/oilsupplier/infochange/infochangeService.go

@@ -204,3 +204,37 @@ func (s *InfoChangeService) GetSuppPagingEntitiesWithOrderBytbl(supplierTableNam
 	return total
 }
 
+
+func (s *InfoChangeService) GetUsedNameWithOrderBytbl(SupplierName, infoChangeName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where string) (total int64) {
+	var resultsSlice []map[string][]byte
+
+	//获取总记录数
+	sqlCount := `select count(*) from ` + SupplierName + ` a `
+	sqlCount += ` left join ` + infoChangeName + ` b  on b.SupplierId = a.Id `
+	sqlCount += ` where ` + where
+
+	var sql string
+	sql = `select a.SupplierName, b.OldSupplierName`
+	sql += ` from ` + SupplierName + ` a `
+	sql += ` left join ` + infoChangeName + ` b on b.SupplierId = a.Id `
+	sql += ` where ` + where
+	if asc {
+		sql += ` order by ` + orderby + ` ASC `
+	} else {
+		sql += ` order by ` + orderby + ` DESC `
+	}
+	sql += ` limit ` + utils.ToStr((pageIndex-1)*itemsPerPage) + "," + utils.ToStr(itemsPerPage)
+	s.DBE.SQL(sql).Find(entitiesPtr)
+
+	resultsSlice, _ = s.DBE.Query(sqlCount)
+
+	if len(resultsSlice) > 0 {
+		results := resultsSlice[0]
+		for _, value := range results {
+			total, _ = strconv.ParseInt(string(value), 10, 64)
+			break
+		}
+	}
+
+	return total
+}

+ 9 - 32
src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

@@ -382,55 +382,32 @@ func (this *InfoChangeController) GetSuppList() {
 func (this *InfoChangeController) GetAllEntityList() {
 	//获取分页信息
 	page := this.GetPageInfoForm()
-	where := " 1=1 "
-	orderby := "Id"
+	where := " 1=1 and b.OldSupplierName is not null"
+	orderby := "a.Id"
 	asc := false
 	Order := this.GetString("Order")
 	Prop := this.GetString("Prop")
 	if Order != "" && Prop != "" {
-		orderby = Prop
+		orderby = "a."+Prop
 		if Order == "asc" {
 			asc = true
 		}
 	}
-	SupplierTypeName := this.GetString("SupplierTypeName")
-	RecUnitId := this.GetString("RecUnitId")
-	AccessCardNo := this.GetString("AccessCardNo")
-	SupplierName := this.GetString("SupplierName")
-	CreateOn := this.GetString("CreateOn")
-
-	if SupplierTypeName != "" {
-		where = where + " and SupplierTypeName like '%" + SupplierTypeName + "%'"
-	}
 
-	if RecUnitId != "" {
-		where = where + " and RecUnitId like '%" + RecUnitId + "%'"
-	}
-
-	if AccessCardNo != "" {
-		where = where + " and AccessCardNo like '%" + AccessCardNo + "%'"
-	}
+	SupplierName := this.GetString("SupplierName")
 
 	if SupplierName != "" {
-		where = where + " and SupplierName like '%" + SupplierName + "%'"
+		where = where + " and a.SupplierName like '%" + SupplierName + "%'"
 	}
 
-	if CreateOn != "" {
-		dates := strings.Split(CreateOn, ",")
-		if len(dates) == 2 {
-			minDate := dates[0]
-			maxDate := dates[1]
-			where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
-		}
-	}
+
 	svc := infochange.GetInfoChangeService(utils.DBE)
-	var list []infochange.OilInfoChange
-	total := svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, where)
+	var list []infochange.OilUsedName
+	total := svc.GetUsedNameWithOrderBytbl(OilSupplierName,OilInfoChangeName, page.CurrentPage, page.Size, orderby, asc, &list, where)
 	var datainfo DataInfo
 	datainfo.Items = list
 	datainfo.CurrentItemCount = total
-	datainfo.PageIndex = page.CurrentPage
-	datainfo.ItemsPerPage = page.Size
+
 	this.Data["json"] = &datainfo
 	this.ServeJSON()
 }

+ 2 - 2
src/dashoo.cn/frontend_web/src/api/oilsupplier/usednameselect.js

@@ -1,7 +1,7 @@
 export default {
-  getNameList (CreateOn,params, myAxios) {
+  getNameList (params, myAxios) {
     return myAxios({
-      url:'/infochange/alllist?CreateOn=' + CreateOn,
+      url: '/infochange/alllist',
       method: 'GET',
       params: params
     })

+ 8 - 54
src/dashoo.cn/frontend_web/src/pages/select/usednameselect/index.vue

@@ -34,8 +34,7 @@
 
       <!--内框表格显示-->
       <el-table id="rebateSetTable" size="mini" :data="entityList" border height="calc(100vh - 243px)"
-        style="width: 100%" @sort-change="orderby" @cell-click="handle" @cell-mouse-enter="changeClor"
-        @cell-mouse-leave="backClor">
+        style="width: 100%" @sort-change="orderby">
         <!--内框表格剩余栏显示-->
         <el-table-column label="企业名称" prop="SupplierName" sortable align="center"></el-table-column>
         <el-table-column label="曾用名" prop="OldSupplierName" align="center"></el-table-column>
@@ -61,18 +60,14 @@
     },
     data() {
       return {
-        show: false,
         // 定义列表数据
         entityList: [],
         // 分页参数
         size: 10,
         currentPage: 1,
         currentItemCount: 0,
-        //查询时间
-        CreateOn: [new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000), new Date()],
         searchForm: {
           SupplierName: "",
-          SupplierTypeName: ""
         },
         //列表排序
         Column: {
@@ -85,28 +80,21 @@
     methods: {
       //初始化列表方法
       initDatas(event) {
-        console.log(event);
         if (event != null) {
           this.currentPage = 1;
         }
+        
         let params = {
           _size: this.size,
           _currentPage: this.currentPage,
           Order: this.Column.Order,
           Prop: this.Column.Prop
         };
-        let myCreateOn = []
-        // 解析时间
-        if (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.getNameList(myCreateOn,params, this.$axios)
+        
+        api.getNameList(params, this.$axios)
           .then(res => {
             console.log(res.data.items);
             this.entityList = res.data.items;
@@ -116,6 +104,7 @@
             console.error(err);
           });
       },
+
       exportExcel() {
         /* generate workbook object from table */
         let wb = XLSX.utils.table_to_book(
@@ -139,16 +128,6 @@
         }
         return wbout;
       },
-      backClor(row, column, event, cell) {
-        if (column.property === "SupplierName") {
-          event.style.background = "";
-        }
-      },
-      changeClor(row, column, event, cell) {
-        if (column.property === "SupplierName") {
-          event.style.background = "#d3dce6";
-        }
-      },
 
       //列表排序功能
       orderby(column) {
@@ -160,20 +139,6 @@
         this.Column.Prop = column.prop;
         this.initDatas();
       },
-      jstimehandle(val) {
-        if (val === "") {
-          return "----";
-        } else if (val === "0001-01-01T08:00:00+08:00") {
-          return "----";
-        } else if (val === "0001-01-01T00:00:00Z") {
-          return "----";
-        } else if (val === "5000-01-01T23:59:59+08:00") {
-          return "永久";
-        } else {
-          val = val.replace("T", " ");
-          return val.substring(0, 10);
-        }
-      },
 
       //分页方法
       handleCurrentChange(value) {
@@ -190,19 +155,8 @@
           this.clearSearch();
         }
       },
-      formatDateTime(date) {
-        var y = date.getFullYear();
-        var m = date.getMonth() + 1;
-        m = m < 10 ? ('0' + m) : m;
-        var d = date.getDate();
-        d = d < 10 ? ('0' + d) : d;
-        var h = date.getHours();
-        var minute = date.getMinutes();
-        minute = minute < 10 ? ('0' + minute) : minute;
-        return y + '-' + m + '-' + d + ' ' + h + ':' + minute;
-      },
+
       clearSearch() {
-        this.searchForm.SupplierTypeName = "";
         this.searchForm.SupplierName = "";
         this.currentPage = 1;
         this.initDatas();