Explorar o código

设备统计查询

lining %!s(int64=6) %!d(string=hai) anos
pai
achega
edd42f1cbb

+ 37 - 10
src/dashoo.cn/backend/api/controllers/lims/devicestatistics.go

@@ -4,6 +4,7 @@ import (
 	"dashoo.cn/backend/api/business/devicestatistics"
 	"dashoo.cn/backend/api/business/organize"
 	. "dashoo.cn/backend/api/controllers"
+	"dashoo.cn/business2/permission"
 	"dashoo.cn/utils"
 	"fmt"
 	"strconv"
@@ -56,18 +57,18 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		}
 
 	} else {
-		//if thrId == this.User.DepartmentId {
-			unitId = organizeSvc.GetMyUnitDepartmentId(this.User.DepartmentId)
-			//var throrg []organize.Base_Organize
+		if unitId != "" {
 			throrg := organizeSvc.GetAllThirdChildByTopId(unitId, "")
-			for _, item := range throrg {
-				thrIds += strconv.Itoa(item.Id) + ","
+			if throrg == nil {
+				thrIds = "-1"
+			} else {
+				for _, item := range throrg {
+					thrIds += strconv.Itoa(item.Id) + ","
+				}
+				thrIds = strings.Trim(thrIds, ",")
+				ethrIds = organizeSvc.GetAllChildById(unitId)
 			}
-			ethrIds = organizeSvc.GetAllChildById(unitId)
-			thrIds = strings.Trim(thrIds, ",")
-		//} else {
-		//	ethrIds = thrId
-		//}
+		}
 	}
 	if thrIds != "" {
 		wheret = " and b.TestDepartId in (" + thrIds + ")"
@@ -316,6 +317,32 @@ func (this *DeviceStatisticsController) GetDictList() {
 	this.ServeJSON()
 }
 
+
+// @Title 判断是否有权限
+// @Description get user by token
+// @Success 200 {object}
+// @router /getauthority [get]
+func (this *DeviceStatisticsController) GetAuthority() {
+
+	dictList := make(map[string]interface{})
+
+	code := this.GetString("Code")
+	organizeSvc := organize.GetOrganizeService(utils.DBE)
+	dictList["unitId"] = organizeSvc.GetMyUnitDepartmentId(this.User.DepartmentId)
+	svcPerm := permission.GetPermissionService(utils.DBE)
+	dictList["isauth"] = svcPerm.IsAuthorized(this.User.Id, code)
+
+
+
+	var datainfo DataInfo
+	datainfo.Items = &dictList
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+
+
+}
+
+
 //获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。
 
 func GetFirstDateOfMonth(d time.Time) time.Time {

+ 67 - 0
src/dashoo.cn/backend/api/controllers/lims/limsdataentry.go

@@ -150,6 +150,73 @@ func (this *LimsDataEntryController) GetTaskBalanceList() {
 	this.ServeJSON()
 }
 
+// @Title 获取数据录入列表
+// @Description get user by token
+// @Success 200 {object} business.device.DeviceChannels
+// @router /finishlist [get]
+func (this *LimsDataEntryController) GetTaskBalanceFinishList() {
+	var list []limsdataentry.LimsDateEntryModel
+	//获取分页信息
+	page := this.GetPageInfoForm()
+	svc := limsdataentry.GetLimsDataEntryService(utils.DBE)
+
+
+
+	EntrustNo := this.GetString("EntrustNo")
+	testDetailId := this.GetString("TestDetailId")
+	department := this.GetString("department")
+	conUserBy := this.GetString("conUserBy")
+	CheckStatus := this.GetString("CheckStatus")
+	BalanceTime := this.GetString("BalanceTime")
+	orderby := "a.Id desc"
+	Order := this.GetString("Order")
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop + " " + Order
+	}
+	where := " b.BalanceStatus <> 0 "
+	if EntrustNo != "" {
+		where = where + " and b.EntrustNo like '%" + EntrustNo + "%'"
+	}
+	if testDetailId != "" {
+		where = where + " and b.TestDetailId = '" + testDetailId + "'"
+	}
+	if department != "" {
+		where = where + " and b.Department like '%" + department + "%'"
+	}
+	if conUserBy != "" {
+		where = where + " and b.ConUserBy = '" + conUserBy + "'"
+	}
+	if CheckStatus != "" {
+		where = where + " and a.CheckStatus = '" + CheckStatus + "'"
+	}
+	if BalanceTime != "" {
+		dates := strings.Split(BalanceTime, ",")
+		if len(dates) == 2 {
+			minDate := dates[0]
+			maxDate := dates[1]
+			where = where + " and b.BalanceTime>='" + minDate + "' and b.BalanceTime<='" + maxDate + "'"
+		}
+	}
+
+	svcActiviti := workflow.GetActivitiService(utils.DBE)
+	var processInstanceId string
+	var RoleSet auditsetting.Base_OilAuditSetting
+	rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
+	rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.DATAAUDIT, &RoleSet)
+	processInstanceId = svcActiviti.GetHistoryMyTasks(RoleSet.WorkFlowCord, this.User.Id)
+	if len(processInstanceId) <= 0 {
+		processInstanceId = "0"
+	}
+	where += " and a.Id in (" + processInstanceId + ")"
+	total, list := svc.GetBalanceEntrySerch(this.User.AccCode+LimsTaskBalanceName, this.User.AccCode+LimsDateEntryName, this.User.AccCode+LimsEntrustMainName, page.CurrentPage, page.Size, orderby, where)
+	var datainfo DataInfo
+	datainfo.Items = list
+	datainfo.CurrentItemCount = total
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
 // @Title 获取数据录入列表
 // @Description get user by token
 // @Success 200 {object} business.device.DeviceChannels

+ 7 - 0
src/dashoo.cn/frontend_web/src/api/lims/secondcenter.js

@@ -11,5 +11,12 @@ export default {
       url: '/devicestatistics/dictlist/',
       method: 'GET'
     })
+  },
+  getAuthority (params, myAxios) {
+    return myAxios({
+      url: '/devicestatistics/getauthority',
+      method: 'GET',
+      params: params
+    })
   }
 }

+ 10 - 11
src/dashoo.cn/frontend_web/src/pages/index.vue

@@ -169,7 +169,6 @@
         tjz: false,
         currentPage: 1,
         currentItemCount: 0,
-        size: 10,
         pageSize: 10,
         // finished
         // 分页参数
@@ -403,7 +402,7 @@
           _this.Getime = []
         }
         // 解析时间
-        if (_this.Getime.length == 2) {
+        if (_this.Getime.length === 2) {
           _this.Getime[1].setHours(23)
           _this.Getime[1].setMinutes(59)
           _this.Getime[1].setSeconds(59)
@@ -411,10 +410,10 @@
           getime.push(_this.formatDateTime(_this.Getime[1]))
         }
         let params = {
-          department: this.Department,
+          department: this.Department
         }
         _this.$axios.get('/limsindex/getentrust?getime=' + getime.join(','), {
-           params
+          params
         })
           .then(res => {
             for (var i = 0; i < res.data.length; i++) {
@@ -471,7 +470,7 @@
           _this.Getime = []
         }
         // 解析时间
-        if (_this.Getime.length == 2) {
+        if (_this.Getime.length === 2) {
           _this.Getime[1].setHours(23)
           _this.Getime[1].setMinutes(59)
           _this.Getime[1].setSeconds(59)
@@ -479,7 +478,7 @@
           getime.push(_this.formatDateTime(_this.Getime[1]))
         }
         let params = {
-          department: this.Department,
+          department: this.Department
         }
         _this.$axios.get('/limsindex/getdata?getime=' + getime.join(','), {
           params
@@ -539,7 +538,7 @@
           _this.Getime = []
         }
         // 解析时间
-        if (_this.Getime.length == 2) {
+        if (_this.Getime.length === 2) {
           _this.Getime[1].setHours(23)
           _this.Getime[1].setMinutes(59)
           _this.Getime[1].setSeconds(59)
@@ -572,7 +571,7 @@
           _this.Getime = []
         }
         // 解析时间
-        if (_this.Getime.length == 2) {
+        if (_this.Getime.length === 2) {
           _this.Getime[1].setHours(23)
           _this.Getime[1].setMinutes(59)
           _this.Getime[1].setSeconds(59)
@@ -580,7 +579,7 @@
           getime.push(_this.formatDateTime(_this.Getime[1]))
         }
         let params = {
-          department: this.Department,
+          department: this.Department
         }
         _this.$axios.get('/limsindex/getinstrument?getime=' + getime.join(','), {
           params
@@ -660,7 +659,7 @@
           _this.Getime = []
         }
         // 解析时间
-        if (_this.Getime.length == 2) {
+        if (_this.Getime.length === 2) {
           _this.Getime[1].setHours(23)
           _this.Getime[1].setMinutes(59)
           _this.Getime[1].setSeconds(59)
@@ -1020,7 +1019,7 @@
         this.initData()
       },
       handleSizeChange (value) {
-        this.size = value
+        this.pageSize = value
         this.currentPage = 1
         this.initData()
       }

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/lims/dataentry/index.vue

@@ -487,7 +487,7 @@ import reportApi from '@/api/lims/createReport'
         }
         Object.assign(params, this.searchform)
         // request
-        _this.$axios.get('/limsdataentry/list?BalanceTime=' + BalanceTime.join(','), {
+        _this.$axios.get('/limsdataentry/finishlist?BalanceTime=' + BalanceTime.join(','), {
           params
         })
           .then(res => {

+ 19 - 7
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/towLevelCenter.vue

@@ -5,23 +5,23 @@
         <span>
           <i class="icon icon-table2"></i> 统计
         </span>
-        <el-form ref="form" :inline="true" style="float: right; margin-top: -10px" v-if="beijiance">
+        <el-form ref="form" :inline="true" style="float: right; margin-top: -10px" v-if="beijiance || Isauthority">
           <!--<el-form-item label="检测时间">
             <el-date-picker size="mini" style="width: 220px" v-model="CreateOn" type="daterange" range-separator="至"
                             start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
           </el-form-item>-->
 
-          <el-form-item label="被检单位">
+          <el-form-item label="被检单位" v-if="beijiance">
             <el-select ref="refQueryProjectType" style="margin-right:10px; margin-top: -4px;" size="mini" v-model="UnitCheckId" clearable filterable placeholder="按被检单位查询">
               <el-option v-for="item in UnitCheckOptions" :key="item.Id" :label="item.Fullname" :value="item.Id"></el-option>
             </el-select>
           </el-form-item>
 
-          <!--<el-form-item label="检测单位">
-            <el-select ref="refQueryProjectType" style="margin-right:10px; margin-top: -4px;" size="mini" v-model="QueryProjectTypeId" clearable filterable placeholder="按检测单位查询" @change="ProjectTypeChangeHandler" @clear="ProjectTypeClearHandler">
-              <el-option v-for="item in projectTypeList" :key="item.id" :label="item.FullName" :value="item.Id"></el-option>
+          <el-form-item label="检测单位" v-if="Isauthority">
+            <el-select ref="refQueryProjectType" style="margin-right:10px; margin-top: -4px;" size="mini" v-model="UnitCheckId" clearable filterable placeholder="按检测单位查询">
+              <el-option v-for="item in UnitCheckOptions" :key="item.Id" :label="item.Fullname" :value="item.Id"></el-option>
             </el-select>
-          </el-form-item>-->
+          </el-form-item>
 
           <!--<el-form-item label="设备类型">
             <el-select ref="refQueryProjectType" style="margin-right:10px; margin-top: -4px;" size="mini" v-model="QueryProjectTypeId" clearable filterable placeholder="按设备类型查询" @change="ProjectTypeChangeHandler" @clear="ProjectTypeClearHandler">
@@ -81,6 +81,7 @@
     }),
     data () {
       return {
+        Isauthority: false,
         beijiance: false,
         jiancedidian: false,
         formSearch: {
@@ -148,12 +149,23 @@
 
       }
       this.getDictOptions()
-      this.initData()
     },
     methods: {
+      getAuthority () {
+        let params = {
+          Code: 'lims.secondcenter.all'
+        }
+        api.getAuthority(params, this.$axios).then(res => {
+          console.log(res, 'res.data.items')
+          this.Isauthority = res.data.items['isauth']
+          this.UnitCheckId = parseInt(res.data.items['unitId'])
+          this.initData()
+        })
+      },
       getDictOptions () {
         api.getDictList(this.$axios).then(res => {
           this.UnitCheckOptions = res.data.items['unitorg']
+          this.getAuthority()
         })
       },
       initData () {