Browse Source

容器权限

shihang 6 years ago
parent
commit
50a2bb8dc0

+ 1 - 0
src/dashoo.cn/backend/api/business/samplesfileinfo/samplesfileinfo.go

@@ -406,6 +406,7 @@ type AnimalSamplesFileShow struct {
 	ProjectName       string    `xorm:"VARCHAR(50)"`
 	BeeKeepers        string    `xorm:"VARCHAR(256)"`
 	TakeAway          string    `xorm:"VARCHAR(256)"`
+	ShortbarCode      string    `xorm:"VARCHAR(50)"`
 	AllbarCode        string    `xorm:"VARCHAR(256)"`
 	CreateUserId      int       `xorm:"INT(10)"`
 	CreateBy          string    `xorm:"VARCHAR(255)"`

+ 1 - 0
src/dashoo.cn/backend/api/business/samplesfileinfo/samplesfileinfoService.go

@@ -146,6 +146,7 @@ func (s *SamplesFileInfoService) QueryAnimalSampleList(acccode string, where str
 
 	for i := 0; i < len(List); i++ {
 		//List[i].AllbarCode = "蜂种:" + List[i].Genus + "&&蜂种备注:" + List[i].GenusName + "&&项目属性:" + List[i].ProjectName + "&&采样地址:" + List[i].AddressName + "&&采样时间:" + List[i].SurveyDate.Format("2006-01-02") + "&&群数:" + strconv.Itoa(List[i].Amount) + "&&经度:" + List[i].Longitude + "&&纬度:" + List[i].Latitude + "&&海拔:" + List[i].Altitude + "&&采集人:" + List[i].TakeAway + "&&供蜂人:" + List[i].BeeKeepers + "&&样本编码:" + List[i].BarCode
+		List[i].ShortbarCode = List[i].BarCode[0:14]
 		List[i].AllbarCode = List[i].BarCode + "·" + List[i].Genus + "-" + List[i].GenusName + "·" + List[i].AddressName + "·" + List[i].SurveyDate.Format("2006-01-02") + "·" + List[i].Altitude + "米·" + List[i].ProjectName
 	}
 	return List

+ 1 - 0
src/dashoo.cn/backend/api/business/samplesinfo/samplesinfo.go

@@ -403,6 +403,7 @@ type AnimalSamplesInfoShow struct {
 	Remark            string    `xorm:"TEXT"`
 	BeeKeepers        string    `xorm:"VARCHAR(256)"`
 	TakeAway          string    `xorm:"VARCHAR(256)"`
+	ShortbarCode      string    `xorm:"VARCHAR(50)"`
 	AllbarCode        string    `xorm:"VARCHAR(256)"`
 	CreateUserId      int       `xorm:"INT(10)"`
 	CreateBy          string    `xorm:"VARCHAR(255)"`

+ 1 - 0
src/dashoo.cn/backend/api/business/samplesinfo/samplesinfoService.go

@@ -881,6 +881,7 @@ func (s *SamplesInfoService) QueryAnimalSampleList(acccode string, where string)
 
 	for i := 0; i < len(List); i++ {
 		//List[i].AllbarCode = "蜂种:" + List[i].Genus + "&&蜂种备注:" + List[i].GenusName + "&&项目属性:" + List[i].ProjectName + "&&采样地址:" + List[i].AddressName + "&&采样时间:" + List[i].SurveyDate.Format("2006-01-02") + "&&群数:" + strconv.Itoa(List[i].Amount) + "&&经度:" + List[i].Longitude + "&&纬度:" + List[i].Latitude + "&&海拔:" + List[i].Altitude + "&&采集人:" + List[i].TakeAway + "&&供蜂人:" + List[i].BeeKeepers + "&&样本编码:" + List[i].BarCode
+		List[i].ShortbarCode = List[i].BarCode[0:14]
 		List[i].AllbarCode = List[i].BarCode + "·" + List[i].Genus + "-" + List[i].GenusName + "·" + List[i].AddressName + "·" + List[i].SurveyDate.Format("2006-01-02") + "·" + List[i].Altitude + "米·" + List[i].ProjectName
 	}
 	return List

+ 20 - 2
src/dashoo.cn/backend/api/controllers/equipment/equipment.go

@@ -11,6 +11,8 @@ import (
 	"dashoo.cn/backend/api/business/currboxcapacity"
 	"dashoo.cn/backend/api/business/equipment"
 	"dashoo.cn/backend/api/business/lastordernum"
+	"dashoo.cn/business2/organize"
+	"dashoo.cn/business2/userRole"
 	"github.com/tealeg/xlsx"
 
 	"dashoo.cn/backend/api/business/samplesinfo"
@@ -81,11 +83,27 @@ func (this *EquipmentController) List() {
 	svc := equipment.GetEquipmentService(utils.DBE)
 	svcPermission := permission.GetPermissionService(utils.DBE)
 	eids := svcPermission.GetEquipmentIdById(utils.ToStr(this.User.Id))
+
+	userSvc := userRole.GetUserService(utils.DBE)
+	organizeSvc := organize.GetOrganizeService(utils.DBE)
+	departList := organizeSvc.GetChildByTopId(this.User.DepartmentId)
+	//取出当前部门及下级部门的所有用户列表
+	var subUserList []userRole.Base_User
+	whereUser := " 1=1 "
+	whereUser += " and DepartmentId in (" + departList + ")"
+	userSvc.GetEntities(&subUserList, whereUser)
+	var userIds string
+
+	for _, tmpUser := range subUserList {
+		userIds += strconv.Itoa(tmpUser.Id) + ","
+	}
+	userIds = strings.Trim(userIds, ",")
+
 	where := " a.AccCode = '" + this.User.AccCode + "'"
 	if eids != "" {
-		where = where + " and (a.CreateUserId= " + utils.ToStr(this.User.Id) + " or a.Id in (" + eids + "))"
+		where = where + " and (a.CreateUserId in (" + userIds + ")" + " or a.Id in (" + eids + "))"
 	} else {
-		where = where + "and a.CreateUserId= " + utils.ToStr(this.User.Id)
+		where = where + "and a.CreateUserId in (" + userIds + ")"
 	}
 
 	searchkey := this.GetString("searchkey")

+ 2 - 2
src/dashoo.cn/frontend_animal/nuxt.config.js

@@ -176,9 +176,9 @@ module.exports = {
   env: {
     appclient: 'biobank', //因顿LIMS:lims,样本库:biobank,细胞制备:cellbank,样本搜索判断,登录跳转判断
 
-    //imgserverhost: 'http://47.92.238.200:9081', // BioBank服务地址,图片上传文件
-    // upfilehost: 'http://weed1.labsop.cn:9333/dir/assign', // 附件上传
+    //imgserverhost: 'http://47.92.238.200:9081', // BioBank服务地址,图片上传文件    
     // imgserverhost: 'http://localhost:9081', // BioBank服务地址,图片上传文件
+    // upfilehost: 'http://weed1.labsop.cn:9333/dir/assign', // 附件上传
     imgserverhost: 'http://192.168.0.192:9081', // 蜜蜂所服务地址,图片上传文件
     upfilehost: 'http://192.168.0.192:9333/dir/assign', // 蜜蜂所附件上传
 

+ 9 - 12
src/dashoo.cn/frontend_animal/src/pages/system/userrole.vue

@@ -142,8 +142,8 @@
       </el-checkbox>
       <div style="margin-top:10px;" class="rowequippower">
         <el-checkbox-group v-model="selectedequip">
-          <el-checkbox v-for="item in equipalllist" :key="item.Id" @change="handlecheckedequpichange"
-            :label="item.label" :value="item.value"> {{item.label}}</el-checkbox>
+          <el-checkbox v-for="item in equipalllist" :key="item.Id" @change="handlecheckedequpichange" :label="item.Id"
+            :value="item.Id"> {{item.Name}}</el-checkbox>
         </el-checkbox-group>
       </div>
       <div slot="footer" class="dialog-footer">
@@ -470,6 +470,7 @@
           .catch(() => {})
       },
 
+      //容器权限
       //容器权限
       getallequipmentlist() {
         let _this = this
@@ -477,8 +478,8 @@
           .then(res => {
             for (var i = 0; i < res.data.items.length / 2; i++) {
               _this.equipalllist.push({
-                label: res.data.items[2 * i],
-                value: res.data.items[2 * i + 1]
+                Name: res.data.items[2 * i],
+                Id: res.data.items[2 * i + 1]
               })
             }
           })
@@ -492,14 +493,11 @@
         _this.selectedequip = []
         _this.$axios.get('/role/getroleequidpower?id=' + val.Id, {})
           .then(res => {
-            var arr = res.data.split(",");
-            for (let i = 0; i < arr.length; i++) {
-              if (arr[i] != '') {
+            if (res.data && res.data != '') {
+              var arr = res.data.split(",");
+              for (let i = 0; i < arr.length; i++) {
                 _this.selectedequip.push(arr[i])
               }
-              // if (parseInt(arr[i]) > 0) {
-              //   _this.selectedequip.push(parseInt(arr[i]))
-              // }
             }
             _this.handlecheckedequpichange()
           })
@@ -699,13 +697,12 @@
         this.selectedequip = []
         if (val) {
           for (let i = 0; i < this.equipalllist.length; i++) {
-            this.selectedequip.push(this.equipalllist[i].label)
+            this.selectedequip.push(this.equipalllist[i].Id)
           }
         }
         this.isequpicheckall = false
       },
       handlecheckedequpichange() {
-        console.log("wwwwwwwwwwwww", this.selectedequip)
         let checkedCount = this.selectedequip.length
         this.equipCheckAll = checkedCount === this.equipalllist.length
         this.isequpicheckall = checkedCount > 0 && checkedCount < this.equipalllist.length

+ 2 - 2
src/dashoo.cn/frontend_web/nuxt.config.js

@@ -159,8 +159,8 @@ module.exports = {
   },
 
   axios: {
-    baseURL: '//localhost:9081/api/' // 本机开发使用
-    // baseURL: '//47.92.238.200:9081/api/' // BioBank on ALi发布使用
+    // baseURL: '//localhost:9081/api/' // 本机开发使用
+    baseURL: '//47.92.238.200:9081/api/' // BioBank on ALi发布使用
     // baseURL: '//188.188.30.89:9081/api/' //临沂使用
     // baseURL: '//api09.labsop.cn/api/'
     // baseURL: '//192.168.0.211:10091/api/' // 花生所系统

+ 10 - 20
src/dashoo.cn/frontend_web/src/pages/system/userrole.vue

@@ -142,8 +142,8 @@
       </el-checkbox>
       <div style="margin-top:10px;" class="rowequippower">
         <el-checkbox-group v-model="selectedequip">
-          <el-checkbox v-for="item in equipalllist" :key="item.Id" @change="handlecheckedequpichange"
-            :label="item.label" :value="item.value"> {{item.label}}</el-checkbox>
+          <el-checkbox v-for="item in equipalllist" :key="item.Id" @change="handlecheckedequpichange" :label="item.Id"
+            :value="item.Id"> {{item.Name}}</el-checkbox>
         </el-checkbox-group>
       </div>
       <div slot="footer" class="dialog-footer">
@@ -483,8 +483,8 @@
           .then(res => {
             for (var i = 0; i < res.data.items.length / 2; i++) {
               _this.equipalllist.push({
-                label: res.data.items[2 * i],
-                value: res.data.items[2 * i + 1]
+                Name: res.data.items[2 * i],
+                Id: res.data.items[2 * i + 1]
               })
             }
           })
@@ -498,9 +498,11 @@
         _this.selectedequip = []
         _this.$axios.get('/role/getroleequidpower?id=' + val.Id, {})
           .then(res => {
-            var arr = res.data.split(",");
-            for (let i = 0; i < arr.length; i++) {
-              _this.selectedequip.push(arr[i])
+            if (res.data && res.data != '') {
+              var arr = res.data.split(",");
+              for (let i = 0; i < arr.length; i++) {
+                _this.selectedequip.push(arr[i])
+              }
             }
             _this.handlecheckedequpichange()
           })
@@ -511,10 +513,8 @@
       },
       saveequiptmentpower() {
         let _this = this
-        // request
         this.$axios.put('/role/saveequpipower?id=' + this.operationid + '&selectedids=' + this.selectedequip, {})
           .then(res => {
-            // response
             if (res.data.code === 0) {
               _this.$message({
                 type: 'success',
@@ -531,7 +531,6 @@
             }
           })
           .catch(err => {
-            // handle error
             console.error(err)
           })
       },
@@ -549,17 +548,14 @@
           _currentPage: this.currentUserPage,
           _size: this.userSize
         }
-        // request
         this.$axios.get('role/getusersforrole/' + rid, {
             params
           })
           .then(res => {
-            // response
             _this.userList = res.data.items
             _this.currentUserItemCount = res.data.currentItemCount
           })
           .catch(err => {
-            // handle error
             console.error(err)
           })
       },
@@ -572,13 +568,11 @@
         let _this = this
         this.$axios.get('users/list', {})
           .then(res => {
-            // response
             _this.partuserlist = res.data.items
             console.log(this.partuserlist, '====')
             this.userlistfilter()
           })
           .catch(err => {
-            // handle error
             console.error(err)
           })
       },
@@ -598,10 +592,8 @@
         }
         let useridlist = tempOfficers.join(',');
         let useridliststring = useridlist.toString()
-        // request
         this.$axios.put('role/setuserrole/' + useridliststring + '_' + this.selectRoleId, {})
           .then(res => {
-            // response
             if (res.data.code === 0) {
               _this.$message({
                 type: 'success',
@@ -618,7 +610,6 @@
             }
           })
           .catch(err => {
-            // handle error
             console.error(err)
           })
 
@@ -655,7 +646,6 @@
         }).then(() => {
           _this.$axios.delete('role/deleteuser/' + val.Id + '_' + this.selectRoleId, null)
             .then(res => {
-              // response
               if (res.data.code === 0) {
                 _this.$message({
                   type: 'success',
@@ -714,7 +704,7 @@
         this.selectedequip = []
         if (val) {
           for (let i = 0; i < this.equipalllist.length; i++) {
-            this.selectedequip.push(this.equipalllist[i].label)
+            this.selectedequip.push(this.equipalllist[i].Id)
           }
         }
         this.isequpicheckall = false