Browse Source

流程查询-综合

lining 6 years ago
parent
commit
372e01ae12

+ 36 - 0
src/dashoo.cn/backend/api/business/oilsupplier/annualaudit/annualauditService.go

@@ -153,5 +153,41 @@ func (s *OilAnnualAuditService) GetMyPagingEntitiesWithOrderBytbl(supplierTableN
 		}
 	}
 
+	return total
+}
+
+func (s *OilAnnualAuditService) GetProcessInfoWithOrderBytbl(oilAnnualAuditName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where string) (total int64) {
+	var resultsSlice []map[string][]byte
+
+	//获取总记录数
+	sqlCount := `select count(*) from ` + oilAnnualAuditName
+	sqlCount += ` where ` + where
+
+	var sql string
+	sql = `select SupplierName, Id, `
+	sql += ` Status, SupplierTypeName SupplierTypeCode, `
+	sql += ` WorkflowId, '3' as Type, CreateOn`
+	sql += ` from ` + oilAnnualAuditName + ` a `
+	sql += ` where ` + where
+	if asc {
+		sql += ` order by ` + orderby + ` ASC `
+	} else {
+		sql += ` order by ` + orderby + ` DESC `
+	}
+	if (pageIndex != 0 && itemsPerPage !=0) {
+		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
 }

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

@@ -236,5 +236,41 @@ func (s *InfoChangeService) GetUsedNameWithOrderBytbl(SupplierName, infoChangeNa
 		}
 	}
 
+	return total
+}
+
+func (s *InfoChangeService) GetProcessInfoWithOrderBytbl(tableName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where string) (total int64) {
+	var resultsSlice []map[string][]byte
+
+	//获取总记录数
+	sqlCount := `select count(*) from ` + tableName
+	sqlCount += ` where ` + where
+
+	var sql string
+	sql = `select SupplierName, Id, `
+	sql += ` Status, `
+	sql += ` WorkflowId, '4' as Type, CreateOn`
+	sql += ` from ` + tableName + ` a `
+	sql += ` where ` + where
+	if asc {
+		sql += ` order by ` + orderby + ` ASC `
+	} else {
+		sql += ` order by ` + orderby + ` DESC `
+	}
+	if (pageIndex != 0 && itemsPerPage !=0) {
+		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
 }

+ 37 - 0
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplierService.go

@@ -236,3 +236,40 @@ func (s *OilSupplierService) GetInterfaceData(supplierTableName, supplierFileTab
 	return err
 }
 
+func (s *OilSupplierService) GetProcessInfoWithOrderBytbl(supplierTableName, supplierCertTableName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where string) (total int64) {
+	var resultsSlice []map[string][]byte
+
+	//获取总记录数
+	sqlCount := `select count(*) from ` + supplierCertTableName + ` a `
+	sqlCount += ` left join ` + supplierCertTableName + " b on b.SupplierId = a.Id"
+	sqlCount += ` where ` + where
+
+	var sql string
+	sql = `select a.SupplierName, b.Id, `
+	sql += ` b.Status, b.SupplierTypeCode, `
+	sql += ` b.WorkflowId, b.ProcessKey, '1' as Type, b.CreateOn`
+	sql += ` from ` + supplierTableName + ` a `
+	sql += ` left join ` + supplierCertTableName + " b on b.SupplierId = a.Id"
+	sql += ` where ` + where
+	if asc {
+		sql += ` order by ` + orderby + ` ASC `
+	} else {
+		sql += ` order by ` + orderby + ` DESC `
+	}
+	if (pageIndex != 0 && itemsPerPage !=0) {
+		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
+}

+ 35 - 0
src/dashoo.cn/backend/api/business/oilsupplier/suppliercertappend/oilsuppliercertappendService.go

@@ -162,3 +162,38 @@ func (s *OilSupplierCertAppendService) GetTodoEntitie(supplierTableName, supplie
 
 }
 
+func (s *OilSupplierCertAppendService) GetProcessInfoWithOrderBytbl(supplierCertAppendName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where string) (total int64) {
+	var resultsSlice []map[string][]byte
+
+	//获取总记录数
+	sqlCount := `select count(*) from ` + supplierCertAppendName + ` a `
+	sqlCount += ` where ` + where
+
+	var sql string
+	sql = `select SupplierName, Id, `
+	sql += ` Status, AppendType SupplierTypeCode, `
+	sql += ` WorkflowId, ProcessKey, '2' as Type, CreateOn`
+	sql += ` from ` + supplierCertAppendName + ` a `
+	sql += ` where ` + where
+	if asc {
+		sql += ` order by ` + orderby + ` ASC `
+	} else {
+		sql += ` order by ` + orderby + ` DESC `
+	}
+	if (pageIndex != 0 && itemsPerPage !=0) {
+		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
+}

+ 42 - 18
src/dashoo.cn/backend/api/controllers/oilsupplier/select.go

@@ -9,7 +9,9 @@ import (
 	"dashoo.cn/backend/api/business/register"
 	"encoding/json"
 	"fmt"
+	"sort"
 	"strconv"
+	"time"
 
 	// "fmt"
 
@@ -36,6 +38,16 @@ type UpInfoSearch struct {
 	Reason              string
 }
 
+type Processinfo struct {
+	Id                  int
+	WorkflowId          string
+	ProcessKey          string
+	SupplierName        string
+	SupplierTypeCode    string
+	Status         		string
+	Type                string
+	CreateOn            time.Time
+}
 
 // @Title 获取所有
 // @Description
@@ -295,6 +307,7 @@ func (this *SelectController) GetProcessAuditList() {
 	var registerUser register.OilCorporateInfo
 	sql := " UserName='" + this.User.Username + "'"
 	svc.GetEntity(&registerUser,sql)
+	var processinfolist []Processinfo
 	if this.User.IsCompanyUser == 1 {
 		where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='"+registerUser.CommercialNo+"')"
 	}
@@ -307,12 +320,14 @@ func (this *SelectController) GetProcessAuditList() {
 
 	var total int64 = 0
 	var datainfo DataInfo
-	if tabinx == "0" {
-		var list []supplier.OilSupplierView
+	if tabinx == "1" || tabinx == "0" {
+		var list []Processinfo //[]supplier.OilSupplierView
 
-		total = svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, "b.Id", asc, &list, where)
-		datainfo.Items = list
-	} else if tabinx == "1" {
+		total = total + svc.GetProcessInfoWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, "b.Id", asc, &list, where)
+		processinfolist = append(processinfolist, list...)
+		//datainfo.Items = processinfolist
+	}
+	if tabinx == "2" || tabinx == "0" {
 		whereapp := "1=1"
 		//企业用户必须加创建人条件
 		if this.User.IsCompanyUser == 1 {
@@ -324,11 +339,13 @@ func (this *SelectController) GetProcessAuditList() {
 		if supplierName != "" {
 			whereapp = whereapp + " and SupplierName like '%" + supplierName + "%'"
 		}
-		var list []suppliercertappend.OilSupplierCertAppend
+		var list []Processinfo//[]suppliercertappend.OilSupplierCertAppend
 		svc := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
-		total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
-		datainfo.Items = list
-	} else if tabinx == "2" {
+		total = total + svc.GetProcessInfoWithOrderBytbl(OilSupplierCertAppendName, page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
+		processinfolist = append(processinfolist, list...)
+		//datainfo.Items = processinfolist
+	}
+	if tabinx == "3" || tabinx == "0" {
 		whereapp := "1=1"
 		//企业用户必须加创建人条件
 		if this.User.IsCompanyUser == 1 {
@@ -340,11 +357,13 @@ func (this *SelectController) GetProcessAuditList() {
 		if supplierName != "" {
 			whereapp = whereapp + " and SupplierName like '%" + supplierName + "%'"
 		}
-		var list []annualaudit.OilAnnualAudit
+		var list []Processinfo//[]annualaudit.OilAnnualAudit
 		svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
-		total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
-		datainfo.Items = list
-	} else if tabinx == "3" {
+		total = total + svc.GetProcessInfoWithOrderBytbl(OilAnnualAuditName, page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
+		processinfolist = append(processinfolist, list...)
+		//datainfo.Items = processinfolist
+	}
+	if tabinx == "4" || tabinx == "0" {
 		whereapp := "1=1"
 		//企业用户必须加创建人条件
 		if this.User.IsCompanyUser == 1 {
@@ -353,11 +372,13 @@ func (this *SelectController) GetProcessAuditList() {
 		if supplierName != "" {
 			whereapp = whereapp + " and SupplierName like '%" + supplierName + "%'"
 		}
-		var list []infochange.OilInfoChange
+		var list []Processinfo//[]infochange.OilInfoChange
 		svc := infochange.GetInfoChangeService(utils.DBE)
-		total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
-		datainfo.Items = list
-	} else if tabinx == "4" {
+		total = total + svc.GetProcessInfoWithOrderBytbl(OilInfoChangeName, page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
+		processinfolist = append(processinfolist, list...)
+		//datainfo.Items = processinfolist
+	}
+	if tabinx == "5" {
 		whereapp := "1=1"
 		//企业用户必须加创建人条件
 		if this.User.IsCompanyUser == 1 {
@@ -371,7 +392,10 @@ func (this *SelectController) GetProcessAuditList() {
 		total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
 		datainfo.Items = list
 	}
-
+	sort.Slice(processinfolist, func(i, j int) bool {
+		return processinfolist[i].CreateOn.Unix() > processinfolist[j].CreateOn.Unix()
+	})
+	datainfo.Items = processinfolist
 	datainfo.CurrentItemCount = total
 	datainfo.PageIndex = page.CurrentPage
 	datainfo.ItemsPerPage = page.Size

+ 71 - 21
src/dashoo.cn/frontend_web/src/pages/select/processselect/index.vue

@@ -39,8 +39,36 @@
         </el-form>
       </div>
       <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
+        <el-tab-pane label="综合" name="all">
+          <el-table :data="entityListAll" id="rebateSetTableAll" size="mini" border style="width: 100%" @sort-change="orderby" height="calc(100vh - 330px)">
+            <el-table-column align="center" label="公司名称" prop="SupplierName"></el-table-column>
+            <el-table-column align="center" label="类别" prop="Type">
+              <template slot-scope="scope">
+                {{typeStr(scope.row.Type)}}
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="类型" prop="SupplierTypeCode">
+              <template slot-scope="scope">
+                {{transferStr(scope.row.SupplierTypeCode)}}
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="当前状态" prop="Status">
+              <template slot-scope="scope">
+                {{statusStr(scope.row.Status)}}
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="操作">
+              <template slot-scope="scope">
+                <el-button type="text" title="查看流程"  icon="el-icon-edit" size="mini" @click="openwfhistory(scope.row)">查看流程</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <el-pagination @size-change="handleSizeChangeAll":current-page="currentPage"
+                         :page-sizes="[40, 80, 160]" :page-size="sizeAll" layout="total, sizes" :total="currentItemCount">
+          </el-pagination>
+        </el-tab-pane>
         <el-tab-pane label="准入" name="first">
-          <el-table :data="entityList" id="rebateSetTable0" size="mini" border style="width: 100%" @sort-change="orderby">
+          <el-table :data="entityList" id="rebateSetTable0" size="mini" border style="width: 100%" @sort-change="orderby" height="calc(100vh - 330px)">
             <el-table-column align="center" label="公司名称" prop="SupplierName"></el-table-column>
             <el-table-column align="center" label="类型" prop="SupplierTypeCode">
               <template slot-scope="scope">
@@ -63,11 +91,11 @@
           </el-pagination>
         </el-tab-pane>
         <el-tab-pane label="增项" name="second">
-          <el-table :data="entityList1" id="rebateSetTable1" size="mini"  border style="width: 100%" @sort-change="orderby">
+          <el-table :data="entityList1" id="rebateSetTable1" size="mini"  border style="width: 100%" @sort-change="orderby" height="calc(100vh - 330px)">
             <el-table-column align="center" label="公司名称" prop="SupplierName"></el-table-column>
             <el-table-column align="center" label="类型" prop="SupplierTypeCode">
               <template slot-scope="scope">
-                {{transferStr(scope.row.AppendType)}}
+                {{transferStr(scope.row.SupplierTypeCode)}}
               </template>
             </el-table-column>
             <el-table-column align="center" label="当前状态" prop="Status">
@@ -86,11 +114,11 @@
           </el-pagination>
         </el-tab-pane>
         <el-tab-pane label="年审" name="third">
-          <el-table :data="entityList2" id="rebateSetTable2" size="mini" border style="width: 100%" @sort-change="orderby">
+          <el-table :data="entityList2" id="rebateSetTable2" size="mini" border style="width: 100%" @sort-change="orderby" height="calc(100vh - 330px)">
             <el-table-column align="center" label="公司名称" prop="SupplierName"></el-table-column>
-            <el-table-column align="center" label="类型" prop="SupplierTypeName">
+            <el-table-column align="center" label="类型" prop="SupplierTypeCode">
               <template slot-scope="scope">
-                {{transferStr(scope.row.SupplierTypeName)}}
+                {{transferStr(scope.row.SupplierTypeCode)}}
               </template>
             </el-table-column>
             <el-table-column align="center" label="当前状态" prop="Status">
@@ -117,7 +145,7 @@
           </el-pagination>
         </el-tab-pane>
         <el-tab-pane label="变更申请" name="fourth">
-          <el-table :data="entityList3" id="rebateSetTable3" size="mini" border style="width: 100%" @sort-change="orderby">
+          <el-table :data="entityList3" id="rebateSetTable3" size="mini" border style="width: 100%" @sort-change="orderby" height="calc(100vh - 330px)">
             <el-table-column align="center" label="公司名称" prop="SupplierName"></el-table-column>
             <el-table-column align="center" label="当前状态" prop="Status">
               <template slot-scope="scope">
@@ -206,16 +234,18 @@
     },
     data () {
       return {
-        activeName: 'first',
+        activeName: 'all',
         dialogVisible: false,
         dialogVisible1: false,
         // 列表数据
+        entityListAll: [],
         entityList: [],
         entityList1: [],
         entityList2: [],
         entityList3: [],
         entitySumList: [],
         // 分页参数
+        sizeAll: 40,
         size: 10,
         currentPage: 1,
         currentItemCount: 0,
@@ -264,31 +294,31 @@
         this.initDatas(tab.index)
       },
       openwfhistory (val) {
-        if (this.tabinx == '0') { // 准入
-          this.entrydetail.Id = val.CertId
-          this.entrydetail.business = val.CertId
+        if (this.tabinx == '1' || val.Type == '1') { // 准入
+          this.entrydetail.Id = val.Id
+          this.entrydetail.business = val.Id
           this.entrydetail.instance = val.WorkflowId
           this.entrydetail.status = val.Status
           this.entrydetail.process = val.ProcessKey
           this.dialogVisible = true
-        } else if (this.tabinx == '1') { //  增项
+        } else if (this.tabinx == '2' || val.Type == '2') { //  增项
           this.entrydetail.Id = val.Id
           this.entrydetail.business = val.Id
           this.entrydetail.instance = val.WorkFlowId
           this.entrydetail.process = val.ProcessKey
           this.dialogVisible = true
-        } else if (this.tabinx == '2') { // 年审
+        } else if (this.tabinx == '3' || val.Type == '3') { // 年审
           this.entrydetail.Id = val.Id
           this.entrydetail.business = val.Id
           this.entrydetail.instance = val.WorkflowId
           this.entrydetail.process = 'oil_audit_apply'
           this.dialogVisible = true
-        } else if (this.tabinx == '3') { // 信息变更
+        } else if (this.tabinx == '4'  || val.Type == '4') { // 信息变更
           this.entrydetail.business = val.Id
           this.entrydetail.instance = val.WorkflowId
           this.entrydetail.process = 'oil_info_change'
           this.dialogVisible = true
-        } else if (this.tabinx == '4') { // 资质变更
+        } else if (this.tabinx == '5') { // 资质变更
           this.entrydetail.business = val.Id
           this.entrydetail.instance = val.WorkflowId
           this.dialogVisible = true
@@ -321,15 +351,18 @@
         Object.assign(params, this.searchForm)
         // 访问接口
         api.getProcessAuditList(myCreateOn.join(','), params, this.$axios).then(res => {
-          if (val == '0') {
+          if (val == '1') {
             this.entityList = res.data.items
-          } else if (val == '1') {
-            this.entityList1 = res.data.items
           } else if (val == '2') {
-            this.entityList2 = res.data.items
+            this.entityList1 = res.data.items
           } else if (val == '3') {
+            this.entityList2 = res.data.items
+          } else if (val == '4') {
             this.entityList3 = res.data.items
+          } else if (val == "0") {
+            this.entityListAll = res.data.items
           }
+          console.log(res.data.items)
           this.currentItemCount = res.data.currentItemCount
         }).catch(err => {
           console.error(err)
@@ -393,7 +426,19 @@
         this.CreateOn = ''
         this.initDatas(this.tabinx)
       },
-
+      typeStr (val) {
+        if (val === '1') {
+          return '准入'
+        } else if (val === '2') {
+          return '增项'
+        } else if (val === '3') {
+          return '年审'
+        } else if (val === '4') {
+          return '信息变更'
+        } else {
+          return ''
+        }
+      },
       transferStr (val) {
         if (val === '01') {
           return '物资类'
@@ -457,7 +502,12 @@
         this.currentPage = 1
         this.initDatas(this.tabinx)
       },
-
+      handleSizeChangeAll (value) {
+        this.sizeAll = value
+        this.size = parseInt(value / 4)
+        this.currentPage = 1
+        this.initDatas(this.tabinx)
+      },
       GetCommand (cmdType, row) {
         let cmd = {}
         cmd.Command = cmdType