lining 6 vuotta sitten
vanhempi
commit
11a8e2231f

+ 3 - 1
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplierService.go

@@ -48,7 +48,9 @@ func (s *OilSupplierService) GetMyPagingEntitiesWithOrderBytbl(supplierTableName
 	} else {
 		sql += ` order by ` + orderby + ` DESC `
 	}
-	sql += ` limit ` + utils.ToStr((pageIndex-1)*itemsPerPage) + "," + utils.ToStr(itemsPerPage)
+	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)

+ 31 - 0
src/dashoo.cn/backend/api/business/oilsupplier/suppliercertappend/oilsuppliercertappend.go

@@ -36,6 +36,37 @@ type OilSupplierCertAppend struct {
 	ModifiedBy     string    `xorm:"VARCHAR(50)"`
 }
 
+type OilSupplierCertAppendTodo struct {
+	Id             int       `xorm:"not null pk autoincr INT(10)"`
+	SupplierName    string    `xorm:"VARCHAR(100)"`
+	SupplierId     int       `xorm:"not null comment('供方基本信息表主键') INT(10)"`
+	SupplierCertId int       `xorm:"not null comment('供方准入证书信息表主键') INT(10)"`
+	ApplyDate      time.Time `xorm:"comment('申请日期') DATETIME"`
+	RecUnitFlag    string    `xorm:"comment('推荐单位的级联Id标记') VARCHAR(200)"`
+	RecUnitId      string    `xorm:"comment('推荐单位编码') VARCHAR(50)"`
+	RecUnitName    string    `xorm:"comment('推荐单位名称') VARCHAR(50)"`
+	AppendType     string    `xorm:"comment('增项类别(1 物资类,2 基建类,3 技术服务类)') VARCHAR(10)"`
+	DenyReason     string    `xorm:"comment('退回原因') VARCHAR(50)"`
+	AuditDate      time.Time `xorm:"comment('审核日期') DATETIME"`
+	Status         string    `xorm:"comment('状态标识') VARCHAR(50)"`
+	WorkFlowId     string    `xorm:"default '0' comment('工作流的ID') VARCHAR(255)"`
+	AuditIndex     int       `xorm:"default 0 comment('审批次数') INT(11)"`
+	BusinessKey    string    `xorm:"VARCHAR(255)"`
+	Remark         string    `xorm:"comment('备注') VARCHAR(500)"`
+	IsDelete       int       `xorm:"default 0 comment('删除状态,0正常,1已删除') INT(10)"`
+	Step           int       `xorm:"comment('页面上第几步') INT(10)"`
+	FirstAudit     int       `xorm:"default 0 comment('初审') INT(10)"`
+	SecondAudit    int       `xorm:"default 0 comment('复审') INT(10)"`
+	ThirdAudit     int       `xorm:"default 0 comment('专业科室审批') INT(10)"`
+	FourthAudit    int       `xorm:"default 0 comment('集中审批') INT(10)"`
+	CreateOn       time.Time `xorm:"DATETIME"`
+	CreateUserId   int       `xorm:"INT(10)"`
+	CreateBy       string    `xorm:"VARCHAR(50)"`
+	ModifiedOn     time.Time `xorm:"DATETIME"`
+	ModifiedUserId int       `xorm:"INT(10)"`
+	ModifiedBy     string    `xorm:"VARCHAR(50)"`
+}
+
 type Supplier struct {
 	SupplierId     int
 	SupplierCertId int

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

@@ -13,6 +13,7 @@ import (
 	. "dashoo.cn/backend/api/mydb"
 	"dashoo.cn/business2/userRole"
 	"github.com/go-xorm/xorm"
+	"dashoo.cn/utils"
 )
 
 type OilSupplierCertAppendService struct {
@@ -111,3 +112,39 @@ func (s *OilSupplierCertAppendService) SubmitOrgAudit(certId, wfName, wfNodeCode
 	svcActiviti.MultiTaskComplete(ActiComplete)
 	return processInstanceId
 }
+
+func (s *OilSupplierCertAppendService) GetMyPagingEntitiesWithOrderBytbl(supplierTableName, supplierCertAppendName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where string) (total int64) {
+	var resultsSlice []map[string][]byte
+
+	//获取总记录数
+	sqlCount := `select count(*) from ` + supplierTableName + ` a `
+	sqlCount += ` left join ` + supplierCertAppendName + " b on b.SupplierId = a.Id"
+	sqlCount += ` where ` + where
+
+	var sql string
+	sql = `select a.SupplierName, b.* `
+	sql += ` from ` + supplierTableName + ` a `
+	sql += ` left join ` + supplierCertAppendName + " 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
+}

+ 10 - 0
src/dashoo.cn/backend/api/business/todolist/todolist.go

@@ -0,0 +1,10 @@
+package todolist
+
+type TodoList struct {
+	Id               int    `xorm:"int(11)"`
+	CertId           string `xorm:"VARCHAR(30)"`
+	SupplierTypeCode string `xorm:"VARCHAR(30)"`
+	Type             string `xorm:"VARCHAR(10)"`
+	SupplierName     string `xorm:"VARCHAR(50)"`
+	UserName         string `xorm:"VARCHAR(50)"`
+}

+ 16 - 0
src/dashoo.cn/backend/api/business/todolist/todolistService.go

@@ -0,0 +1,16 @@
+package todolist
+
+import (
+	. "dashoo.cn/utils/db"
+	"github.com/go-xorm/xorm"
+)
+
+type TodoListService struct {
+	ServiceBase
+}
+
+func GetTodoListService(xormEngine *xorm.Engine) *TodoListService {
+	s := new(TodoListService)
+	s.DBE = xormEngine
+	return s
+}

+ 113 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/todolist.go

@@ -0,0 +1,113 @@
+package oilsupplier
+
+import (
+	"dashoo.cn/backend/api/business/oilsupplier/supplier"
+	"dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
+	"dashoo.cn/backend/api/business/todolist"
+	"dashoo.cn/backend/api/business/workflow"
+	. "dashoo.cn/backend/api/controllers"
+	"dashoo.cn/utils"
+	"fmt"
+	"strings"
+)
+
+type TodoListController struct {
+	BaseController
+}
+
+
+// @Title 获取列表
+// @Description get user by token
+// @Success 200 {object} []supplier.OilSupplierView
+// @router /gettodolist [get]
+func (this *TodoListController) GetMyTaskEntityList() {
+	var todolists []todolist.TodoList
+	var todo todolist.TodoList
+
+	page := this.GetPageInfoForm()
+	where := " 1=1 "
+	orderby := "Id"
+	asc := false
+	Order := this.GetString("Order")
+	where = where + " and b.Status>0"
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop
+		if Order == "asc" {
+			asc = true
+		}
+	}
+
+	//找出待办任务
+	actisvc := workflow.GetActivitiService(utils.DBE)
+	var certIdList string
+	if actisvc.GetMyTasks(workflow.OIL_SUPPLIER_APPLY, this.User.Id) != ""{
+		certIdList = actisvc.GetMyTasks(workflow.OIL_SUPPLIER_APPLY, this.User.Id)
+		certIdList = certIdList + ","
+	}
+	if actisvc.GetMyTasks(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id) != ""{
+		certIdList = fmt.Sprintf("%s %s",certIdList,actisvc.GetMyTasks(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id))
+		certIdList = certIdList + ","
+	}
+	if actisvc.GetMyTasks(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id) != ""{
+		certIdList = fmt.Sprintf("%s %s",certIdList,actisvc.GetMyTasks(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id))
+	}
+	certIdList = strings.Trim(certIdList, ",")
+	certIdarr := strings.Split(certIdList, ",")
+	for i, item := range certIdarr {
+		idx := strings.Index(item, "-")
+		if idx >= 0 {
+			certIdarr[i] = strings.Split(item, "-")[0]
+		}
+	}
+	certIdList = strings.Join(certIdarr, ",")
+	where += " and b.Id in (" + certIdList + ")"
+	//根据部门查询待办任务
+
+	svc := supplier.GetOilSupplierService(utils.DBE)
+	var list []supplier.OilSupplierView
+	//svc.GetEntities(&list, where)
+	svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
+
+	for _, item :=range list {
+		todo.Id = item.Id
+		todo.CertId = item.CertId
+		todo.SupplierTypeCode = item.SupplierTypeCode
+		todo.Type = "1"
+		todo.SupplierName = item.SupplierName
+		todo.UserName = this.User.Realname
+		todolists = append(todolists, todo)
+	}
+
+	//找出待办任务 -- 增项
+	whereapp := "1=1"
+	whereapp = whereapp + " and Status>0"
+	appendIdList := actisvc.GetMyTasks(workflow.OIL_APPEND_APPLY, this.User.Id)
+	appendIdarr := strings.Split(appendIdList, ",")
+	for i, item := range appendIdarr {
+		idx := strings.Index(item,"-")
+		if (idx >= 0 ) {
+			appendIdarr[i] = strings.Split(item, "-")[0]
+		}
+	}
+	appendIdList = strings.Join(appendIdarr, ",")
+	whereapp += " and b.Id in (" + appendIdList + ")"
+
+	var listapp []suppliercertappend.OilSupplierCertAppendTodo
+	svcapp := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
+	svcapp.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertAppendName, page.CurrentPage, page.Size, orderby, asc, &listapp, whereapp)
+
+	for _, item :=range listapp {
+		todo.Id = item.Id
+		todo.Type = "2"
+		todo.SupplierName = item.SupplierName
+		todo.UserName = this.User.Realname
+		todo.SupplierTypeCode = item.AppendType
+		todolists = append(todolists, todo)
+	}
+
+	var datainfo DataInfo
+	datainfo.Items = todolists
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}

+ 6 - 0
src/dashoo.cn/backend/api/routers/router.go

@@ -366,6 +366,12 @@ func init() {
 				&oilsupplier.SelectController{},
 			),
 		),
+		//待办任务
+		beego.NSNamespace("/todolist",
+			beego.NSInclude(
+				&oilsupplier.TodoListController{},
+			),
+		),
 		//RTX
 		beego.NSNamespace("/rtx",
 			beego.NSInclude(

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

@@ -102,5 +102,12 @@ export default {
       url: '/supplier/getauditerbydept/' + deptId + '?auditstepcode=' + auditstepcode,
       method: 'GET'
     })
+  },
+  getTodoList (params, myAxios) {
+    return myAxios({
+      url: '/todolist/gettodolist/',
+      method: 'GET',
+      params: params
+    })
   }
 }

+ 88 - 50
src/dashoo.cn/frontend_web/src/pages/index.vue

@@ -7,42 +7,37 @@
         </span>
       </div>
       <el-table
-        :data="tableData"
+        :data="entityList"
         size="mini"
         border
         :stripe="true"
         style="width: 100%">
 
-        <el-table-column
-          type="index"
-          label="序号">
-        </el-table-column>
+        <!--<el-table-column type="index" label="序号"></el-table-column>-->
 
-        <el-table-column
-          prop="name"
-          label="待办类型">
+        <el-table-column label="待办类型" prop="Type">
+          <template slot-scope="scope">
+            <span v-if="scope.row.Type=='1'" style="color:#E6A23C">准入</span>
+            <span v-if="scope.row.Type=='2'" style="color:#E6A23C">增项</span>
+            <span v-if="scope.row.Type=='3'" style="color:#E6A23C">年审</span>
+          </template>
         </el-table-column>
-
-        <el-table-column
-          prop="address"
-          label="公司名称">
+        <el-table-column label="类别" prop="SupplierTypeCode">
+          <template slot-scope="scope">
+            <span v-if="scope.row.SupplierTypeCode=='01'">物质类</span>
+            <span v-if="scope.row.SupplierTypeCode=='02'">基建类</span>
+            <span v-if="scope.row.SupplierTypeCode=='03'">技术服务类</span>
+          </template>
         </el-table-column>
 
-        <el-table-column
-          prop="date"
-          label="创建日期"
-          width="180">
-        </el-table-column>
+        <el-table-column label="公司名称" prop="SupplierName"></el-table-column>
 
-        <el-table-column
-          prop="user"
-          label="执行人">
-        </el-table-column>
+        <el-table-column label="执行人" prop="UserName"></el-table-column>
 
         <el-table-column label="操作" width="130" align="center" fixed="right">
           <template slot-scope="scope">
-            <el-button type="text" title="办理"  icon="el-icon-edit" size="mini">办理</el-button>
-            <el-button type="text" title="编辑"  icon="el-icon-s-promotion" size="mini">跟踪</el-button>
+            <el-button type="text" title="办理"  icon="el-icon-edit" size="mini" @click="rowClick(scope.row)">办理</el-button>
+            <!--<el-button type="text" title="编辑"  icon="el-icon-s-promotion" size="mini">跟踪</el-button>-->
           </template>
         </el-table-column>
 
@@ -52,7 +47,8 @@
 </template>
 
 <script>
-  import echarts from 'echarts'
+  import api from '@/api/oilsupplier/supplier'
+
   import {
     mapGetters
   } from 'vuex'
@@ -63,38 +59,80 @@
       authUser: 'authUser'
     }),
 
-    created () {
-    },
-
     data () {
       return {
         currentDate: new Date(),
-        tableData: [{
-          date: '2019-05-02',
-          name: '准入',
-          address: 'XXX有限公司',
-          user: '田家园'
-        }, {
-          date: '2019-05-04',
-          name: '增项',
-          address: 'XXX有限公司',
-          user: '田家园'
-        }, {
-          date: '2019-05-01',
-          name: '准入',
-          address: 'XXX有限公司',
-          user: '田家园'
-        }, {
-          date: '2019-05-03',
-          name: '准入',
-          address: 'XXX有限公司',
-          user: '田家园'
-        }],
+        // 查询时间
+        CreateOn: [],
+        // 分页参数
+        size: 10,
+        currentPage: 1,
+        currentItemCount: 0,
+        // 列表排序
+        Column: {
+          Order: '',
+          Prop: ''
+        },
+        // 查询项
+        searchFormReset: {},
+        entityList: []
       }
     },
-
+    created () {
+      this.initDatas()
+    },
     methods: {
-
+      rowClick (val) {
+        let SupplierType = ''
+        if (val.Type === '1') {
+          if (val.SupplierTypeCode === '01') {
+            SupplierType = 'goodsedit'
+          } else if (val.SupplierTypeCode === '02') {
+            SupplierType = 'basisedit'
+          } else {
+            SupplierType = 'techedit'
+          }
+          this.$router.push('oilsupplier/supplieraudit/' + val.Id + '/' + SupplierType + '?certid=' + val.CertId)
+        } else if (val.Type === '2') {
+          if (val.SupplierTypeCode === '01') {
+            SupplierType = 'goodsdataopera'
+          } else if (val.SupplierTypeCode === '02') {
+            SupplierType = 'basisdataopera'
+          } else {
+            SupplierType = 'techdataopera'
+          }
+          this.$router.push('oilsupplier/addtionaudit/' + val.Id + '/' + SupplierType)
+        }
+      },
+      initDatas () {
+        // 分页及列表条件
+        let params = {
+          _currentPage: this.currentPage,
+          _size: this.size,
+          Order: this.Column.Order,
+          Prop: this.Column.Prop,
+          Statustype: 2
+        }
+        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.getTodoList(params, this.$axios).then(res => {
+          this.entityList = res.data.items
+          console.log(this.entityList, 'this.entityList')
+          this.currentItemCount = res.data.currentItemCount
+        }).catch(err => {
+          console.error(err)
+        })
+      }
     }
   }
 </script>