Explorar o código

流程配置- 准入范围

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

+ 16 - 0
src/dashoo.cn/backend/api/business/organize/organizeService.go

@@ -1,7 +1,10 @@
 package organize
 
 import (
+	"dashoo.cn/business2/userRole"
+	"fmt"
 	"strconv"
+	"strings"
 
 	"dashoo.cn/utils"
 	. "dashoo.cn/utils/db"
@@ -123,4 +126,17 @@ func (s *OrganizeService) GetAllGoodsChildById(topid string) string {
 	mod := new(Id_Str)
 	s.DBE.Sql(`select fun_getOilGoodsAptitudeClasschildlist ('` + topid +  `') as Id`).Get(mod)
 	return mod.Id
+}
+
+//判断用户是否具有某角色
+func (s *OrganizeService) UserInRoleById(userId, RoleId string) bool {
+	var roleList []userRole.UserRoleModel
+	sqlcommand := fmt.Sprintf(`select * from Base_Role b where b.Id=%v `, RoleId)
+	s.DBE.SQL(sqlcommand).Find(&roleList)
+	if len(roleList) <1{
+		return false
+	}else{
+		roleidlist:=utils.RBAC.GetRolesForUserInDomain("uid_" + userId, utils.DOMAIN)
+		return strings.Contains(strings.Join(roleidlist, ","), "rid_" + strconv.Itoa(roleList[0].Id))
+	}
 }

+ 6 - 1
src/dashoo.cn/backend/api/controllers/casbin/organize.go

@@ -381,7 +381,12 @@ func (this *OrganizesController) ListByDeptId() {
 	if ParentId != "" {
 		ids = svc.GetAllChildById("100000180")
 	} else {
-		ids = svc.GetAllChildById(companyids[len(companyids)-1])
+		has := svc.UserInRoleById(this.User.Id, "10000203")
+		if has {
+			ids = svc.GetAllChildById("100000054")
+		} else {
+			ids = svc.GetAllChildById(companyids[len(companyids)-1])
+		}
 	}
 	where := " Id in ( " + ids + " ) and AccCode='" + this.User.AccCode + "'"
 

+ 3 - 3
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertsub.go

@@ -380,7 +380,7 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 				entity.EffectDate = time.Now()
 				entity.CreateBy = this.User.Realname
 				entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
-
+				entity.SupType = 1
 				if strings.Contains(hasField, needList[i].FileName+",") {
 					//已存在,不能重复添加
 					continue
@@ -462,7 +462,7 @@ func (this *OilSupplierCertSubController) AddTechBus() {
 				entity.EffectDate = time.Now()
 				entity.CreateBy = this.User.Realname
 				entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
-
+				entity.SupType = 1
 				if strings.Contains(hasField, needList[i].FileName+",") {
 					//已存在,不能重复添加
 					continue
@@ -537,7 +537,7 @@ func (this *OilSupplierCertSubController) AddBusiness() {
 			entity.EffectDate = time.Now()
 			entity.CreateBy = this.User.Realname
 			entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
-
+			entity.SupType = 1
 			if strings.Contains(hasField, needList[i].FileName+",") {
 				//已存在,不能重复添加
 				continue

+ 7 - 3
src/dashoo.cn/backend/api/controllers/system/auditsetting.go

@@ -55,6 +55,10 @@ func (this *OilAuditSettingController) GetEntityList() {
 	Code := this.GetString("Code")
 	svcPerm := permission.GetPermissionService(utils.DBE)
 	isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.AuditSetting.AllRecord")
+	svcuser := organize.GetOrganizeService(utils.DBE)
+	isauth = svcuser.UserInRoleById(this.User.Id, "10000203")
+
+
 	if !svcPerm.IsAdmin(this.User.Id) && !isauth {
 		//OrganizeId = this.User.DepartmentId //无权限看所有时,只看当前部门的数据
 		var org  organize.Base_Organize
@@ -218,13 +222,13 @@ func (this *OilAuditSettingController) AddEntity() {
 	if (err == nil) {
 		for _, Id := range auditIds {
 			var user userRole.Base_User
-
+			var org1  organize.Base_Organize
 			svc.GetEntityById(Id, &user)
-			svc.GetEntityById(user.Departmentid, &org)
+			svc.GetEntityById(user.Departmentid, &org1)
 			audituser.Id = 0
 			audituser.SettingId = model.Id
 			audituser.DepartmentId,_ = strconv.Atoi(user.Departmentid)
-			audituser.CompanyId = org.Parentid
+			audituser.CompanyId = org1.Parentid
 			audituser.UserId,_ = strconv.Atoi(Id)
 			audituser.UserName = user.Realname
 			audituser.CreateOn = time.Now()

+ 1 - 1
src/dashoo.cn/frontend_web/src/components/oilsupplier/basisinfo.vue

@@ -30,7 +30,7 @@
 
         <el-col :span="8">
           <el-form-item label="准入编码">
-            <el-input v-model="formData.JSAccessCardNo"  :readonly="!canUpdateSupplier" placeholder="请输入" style="width: 100%">
+            <el-input v-model="formData.JSAccessCardNo"  :readonly="this.formData.Status != '7'" placeholder="请输入" style="width: 100%">
             </el-input>
           </el-form-item>
         </el-col>

+ 2 - 1
src/dashoo.cn/frontend_web/src/components/oilsupplier/businesslist.vue

@@ -185,7 +185,8 @@
           Code: '',
           Name: '',
           Remark: '',
-          IsDelete: 0
+          IsDelete: 0,
+          Type: '1'
         },
         visible: false,
         selfVisible: this.visible, // 避免vue双向绑定警告

+ 1 - 1
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodsinfo.vue

@@ -30,7 +30,7 @@
 
         <el-col :span="8">
           <el-form-item label="准入编码">
-            <el-input v-model="formData.WZAccessCardNo"  :readonly="!canUpdateSupplier && this.formData.Status != '7'" placeholder="请输入" style="width: 100%">
+            <el-input v-model="formData.WZAccessCardNo"  :readonly="this.formData.Status != '7'" placeholder="请输入" style="width: 100%">
             </el-input>
           </el-form-item>
         </el-col>

+ 1 - 0
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodslist.vue

@@ -156,6 +156,7 @@
           SupplierId: parseInt(_this.SupplierId),
           SupplierCertId: parseInt(_this.SupplierCertId),
           SupplierTypeCode: '01',
+          Type: '1',
           Remark: _this.Remark
         }
         if (_this.checkList.length > 0) {

+ 1 - 1
src/dashoo.cn/frontend_web/src/components/oilsupplier/techinfo.vue

@@ -28,7 +28,7 @@
 
         <el-col :span="8">
           <el-form-item label="准入编码">
-            <el-input v-model="formData.JFAccessCardNo"  :readonly="!canUpdateSupplier" placeholder="请输入" style="width: 100%">
+            <el-input v-model="formData.JFAccessCardNo"  :readonly="this.formData.Status != '7'" placeholder="请输入" style="width: 100%">
             </el-input>
           </el-form-item>
         </el-col>

+ 1 - 0
src/dashoo.cn/frontend_web/src/components/oilsupplier/techlist.vue

@@ -150,6 +150,7 @@
           SupplierId: parseInt(_this.SupplierId),
           SupplierCertId: parseInt(_this.SupplierCertId),
           SupplierTypeCode: '03',
+          Type: '1',
           Remark: _this.Remark
         }
         if (_this.checkList.length > 0) {

+ 19 - 15
src/dashoo.cn/frontend_web/src/pages/index.vue

@@ -20,12 +20,12 @@
 
         <el-table-column
           prop="name"
-          label="流程名称">
+          label="待办类型">
         </el-table-column>
 
         <el-table-column
           prop="address"
-          label="任务名称">
+          label="公司名称">
         </el-table-column>
 
         <el-table-column
@@ -35,7 +35,7 @@
         </el-table-column>
 
         <el-table-column
-          prop="address"
+          prop="user"
           label="执行人">
         </el-table-column>
 
@@ -70,21 +70,25 @@
       return {
         currentDate: new Date(),
         tableData: [{
-          date: '2016-05-02',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
+          date: '2019-05-02',
+          name: '准入',
+          address: 'XXX有限公司',
+          user: '田家园'
         }, {
-          date: '2016-05-04',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1517 弄'
+          date: '2019-05-04',
+          name: '增项',
+          address: 'XXX有限公司',
+          user: '田家园'
         }, {
-          date: '2016-05-01',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1519 弄'
+          date: '2019-05-01',
+          name: '准入',
+          address: 'XXX有限公司',
+          user: '田家园'
         }, {
-          date: '2016-05-03',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1516 弄'
+          date: '2019-05-03',
+          name: '准入',
+          address: 'XXX有限公司',
+          user: '田家园'
         }],
       }
     },

+ 17 - 0
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstorage/_opera/basisedit.vue

@@ -25,6 +25,7 @@
             <el-button slot="reference" plain size="mini" style="margin-right: 5px">查看进度</el-button>
           </el-popover>
           <el-button type="primary" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="createWZAccessCardNo">生成准入编码</el-button>
+          <el-button type="primary" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="saveAccessCardNo">保存准入编码</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" v-if="this.formData.Status == '7'" @click="confirm">确认入库</el-button>
           <router-link :to="'/oilsupplier/supplierstorage/basislist'">
             <el-button type="primary" size="mini" style="margin-left: 8px" v-if="showReturn">返回
@@ -477,6 +478,22 @@
       }
     },
     methods: {
+      saveAccessCardNo () {
+        apiCert.saveAccessCardNo(this.formData.Id, this.formData.CertId, this.formData.JSAccessCardNo, '02', this.$axios).then(res => {
+          console.log(res.data, 'res.data')
+          if (res.data.code === 0) {
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        })
+      },
       createWZAccessCardNo () {
         apiCert.createAccessCardNo(this.formData.Id, this.formData.CertId, '02', this.$axios).then(res => {
           this.formData.JSAccessCardNo = res.data

+ 17 - 0
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstorage/_opera/techedit.vue

@@ -25,6 +25,7 @@
             <el-button slot="reference" plain size="mini" style="margin-right: 5px">查看进度</el-button>
           </el-popover>
           <el-button type="primary" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="createJFAccessCardNo">生成准入编码</el-button>
+          <el-button type="primary" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="saveAccessCardNo">保存准入编码</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="confirm">确认入库</el-button>
           <router-link :to="'/oilsupplier/supplierstorage/techlist'">
             <el-button type="primary" size="mini" style="margin-left: 8px" v-if="showReturn">返回
@@ -485,6 +486,22 @@
       }
     },
     methods: {
+      saveAccessCardNo () {
+        apiCert.saveAccessCardNo(this.formData.Id, this.formData.CertId, this.formData.JFAccessCardNo, '03', this.$axios).then(res => {
+          console.log(res.data, 'res.data')
+          if (res.data.code === 0) {
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        })
+      },
       createJFAccessCardNo () {
         apiCert.createAccessCardNo(this.formData.Id, this.formData.CertId, '03', this.$axios).then(res => {
           this.formData.JFAccessCardNo = res.data

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/basislist.vue

@@ -538,7 +538,7 @@
            sort: true
            },*/
           {
-            prop: "JSAccessCardNo",
+            prop: "AccessCardNo",
             label: '准入证编号',
             width: 260,
             sort: true

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/goodslist.vue

@@ -538,7 +538,7 @@
            }, */
 
           {
-            prop: 'WZAccessCardNo',
+            prop: 'AccessCardNo',
             label: '准入证编号',
             width: 260,
             sort: true

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/techlist.vue

@@ -544,7 +544,7 @@
           },*/
 
           {
-            prop: "JFAccessCardNo",
+            prop: "AccessCardNo",
             label: '准入证编号',
             width: 260,
             sort: true