|
@@ -55,8 +55,27 @@ func GetExcelDetailInfoByUnicode(unicode string, sysUserId int) (excelDetail res
|
|
|
}
|
|
|
|
|
|
func formatExcelInfo2Detail(excelInfo *excel.ExcelInfo, sysUserId int) (excelDetail response.ExcelInfoDetail, errMsg string, err error) {
|
|
|
+ checkExcelInfo := excelInfo
|
|
|
+ if excelInfo.Source == utils.BALANCE_TABLE {
|
|
|
+ checkExcelInfoId := excelInfo.ExcelInfoId
|
|
|
+ if excelInfo.BalanceType == 1 {
|
|
|
+ checkExcelInfoId = excelInfo.RelExcelInfoId
|
|
|
+ } else {
|
|
|
+ if excelInfo.ParentId > 0 {
|
|
|
+ checkExcelInfoId = excelInfo.ParentId
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if checkExcelInfoId != excelInfo.ExcelInfoId {
|
|
|
+ checkExcelInfo, err = excel.GetExcelInfoById(excelInfo.ExcelInfoId)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "获取平衡表格信息失败"
|
|
|
+ err = errors.New("获取平衡表格信息失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
// 数据权限
|
|
|
- haveOperaAuth, err := data_manage_permission.CheckExcelPermissionByExcelInfoId(excelInfo.ExcelInfoId, excelInfo.ExcelClassifyId, excelInfo.IsJoinPermission, sysUserId)
|
|
|
+ haveOperaAuth, err := data_manage_permission.CheckExcelPermissionByExcelInfoId(checkExcelInfo.ExcelInfoId, checkExcelInfo.ExcelClassifyId, checkExcelInfo.IsJoinPermission, sysUserId)
|
|
|
if err != nil {
|
|
|
err = errors.New("获取表格权限信息失败,Err" + err.Error())
|
|
|
return
|
|
@@ -84,6 +103,7 @@ func formatExcelInfo2Detail(excelInfo *excel.ExcelInfo, sysUserId int) (excelDet
|
|
|
BalanceType: excelInfo.BalanceType,
|
|
|
UpdateUserId: excelInfo.UpdateUserId,
|
|
|
UpdateUserRealName: excelInfo.UpdateUserRealName,
|
|
|
+ RelExcelInfoId: excelInfo.RelExcelInfoId,
|
|
|
}
|
|
|
|
|
|
// 无权限,不需要返回数据
|
|
@@ -157,11 +177,14 @@ func formatExcelInfo2Detail(excelInfo *excel.ExcelInfo, sysUserId int) (excelDet
|
|
|
result.Data = newData
|
|
|
excelDetail.TableData = result
|
|
|
}
|
|
|
+ if excelDetail.Source == utils.BALANCE_TABLE {
|
|
|
+ excelDetail.Button = GetBalanceExcelInfoOpButton(sysUserId, excelDetail.SysUserId, excelDetail.HaveOperaAuth, checkExcelInfo.ExcelInfoId, checkExcelInfo.SysUserId)
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// GetExcelInfoOpButton 获取ETA表格的操作权限
|
|
|
-func GetExcelInfoOpButton(sysUser *system.Admin, belongUserId, source int, haveOperaAuth bool) (button response.ExcelInfoDetailButton) {
|
|
|
+func GetExcelInfoOpButton(sysUser *system.Admin, belongUserId, source int, haveOperaAuth bool) (button excel.ExcelInfoDetailButton) {
|
|
|
// 如果没有数据权限,那么直接返回
|
|
|
if !haveOperaAuth {
|
|
|
return
|
|
@@ -187,8 +210,38 @@ func GetExcelInfoOpButton(sysUser *system.Admin, belongUserId, source int, haveO
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //todo 如果是平衡表,判断是否是协作人
|
|
|
+ return
|
|
|
+}
|
|
|
|
|
|
+// GetBalanceExcelInfoOpButton 获取ETA平衡表格的操作权限
|
|
|
+func GetBalanceExcelInfoOpButton(sysUserId, belongUserId int, haveOperaAuth bool, parentExcelInfoId, parentSysUserId int) (button excel.ExcelInfoDetailButton) {
|
|
|
+ // 如果没有数据权限,那么直接返回
|
|
|
+ if !haveOperaAuth {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //非管理员角色查看其他用户创建的表格,可刷新、另存为、下载表格;
|
|
|
+ button.RefreshButton = true
|
|
|
+ button.CopyButton = true
|
|
|
+ button.DownloadButton = true
|
|
|
+
|
|
|
+ belongUserId = parentSysUserId
|
|
|
+ if sysUserId == belongUserId {
|
|
|
+ button.OpEdbButton = true
|
|
|
+ button.RefreshEdbButton = true
|
|
|
+ button.OpWorkerButton = true
|
|
|
+ } else {
|
|
|
+ obj := new(excel.ExcelWorker)
|
|
|
+ workerList, err := obj.GetByExcelInfoId(parentExcelInfoId)
|
|
|
+ if err == nil {
|
|
|
+ for _, v := range workerList {
|
|
|
+ if v.SysUserId == sysUserId {
|
|
|
+ button.OpEdbButton = true
|
|
|
+ button.RefreshEdbButton = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|