|
@@ -557,7 +557,7 @@ func DeleteCheck(classifyId, edbInfoId int, sysUser *system.Admin) (deleteStatus
|
|
|
}
|
|
|
if calculateCount > 0 {
|
|
|
deleteStatus = 4
|
|
|
- tipsMsg = "当前指标已用作,指标运算,不可删除"
|
|
|
+ tipsMsg = "当前指标已用作指标运算,不可删除"
|
|
|
return
|
|
|
}
|
|
|
}
|
|
@@ -579,7 +579,7 @@ func DeleteCheck(classifyId, edbInfoId int, sysUser *system.Admin) (deleteStatus
|
|
|
|
|
|
// 判断指标是否用作表格引用
|
|
|
{
|
|
|
- excelIds, tmpErr := excel.GetNoCustomAnalysisExcelEdbMapping(edbInfoId)
|
|
|
+ tableItems, tmpErr := excel.GetNoCustomAnalysisExcelEdbMapping(edbInfoId)
|
|
|
if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
|
|
|
errMsg = "删除失败"
|
|
|
err = errors.New("判断指标是否用作表格引用,GetNoCustomAnalysisExcelEdbMappingCount Err:" + tmpErr.Error())
|
|
@@ -590,9 +590,17 @@ func DeleteCheck(classifyId, edbInfoId int, sysUser *system.Admin) (deleteStatus
|
|
|
//2、当前指标已被表格引用,不可删除:The current metric is referenced by a table and cannot be deleted
|
|
|
//3、删除失败:Deletion failed
|
|
|
//4、知道了:Understood
|
|
|
- if len(excelIds) > 0 {
|
|
|
+ if len(tableItems) > 0 {
|
|
|
deleteStatus = 6
|
|
|
tipsMsg = "当前指标已被表格引用,不可删除"
|
|
|
+ var excelIds []int
|
|
|
+ for _, tableItem := range tableItems {
|
|
|
+ if tableItem.ParentId > 0 {
|
|
|
+ excelIds = append(excelIds, tableItem.ParentId)
|
|
|
+ } else {
|
|
|
+ excelIds = append(excelIds, tableItem.ExcelInfoId)
|
|
|
+ }
|
|
|
+ }
|
|
|
tableList, tmpErr = excel.GetExcelBaseInfoByExcelInfoIdList(excelIds)
|
|
|
if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
|
|
|
errMsg = "删除失败"
|
|
@@ -769,7 +777,7 @@ func Delete(classifyId, edbInfoId int, sysUser *system.Admin, requestBody, reque
|
|
|
|
|
|
// 判断指标是否用作表格引用
|
|
|
{
|
|
|
- excelIds, tmpErr := excel.GetNoCustomAnalysisExcelEdbMapping(edbInfoId)
|
|
|
+ tableItems, tmpErr := excel.GetNoCustomAnalysisExcelEdbMapping(edbInfoId)
|
|
|
if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
|
|
|
errMsg = "删除失败"
|
|
|
err = errors.New("判断指标是否用作表格引用,GetNoCustomAnalysisExcelEdbMappingCount Err:" + tmpErr.Error())
|
|
@@ -780,14 +788,8 @@ func Delete(classifyId, edbInfoId int, sysUser *system.Admin, requestBody, reque
|
|
|
//2、当前指标已被表格引用,不可删除:The current metric is referenced by a table and cannot be deleted
|
|
|
//3、删除失败:Deletion failed
|
|
|
//4、知道了:Understood
|
|
|
- if len(excelIds) > 0 {
|
|
|
+ if len(tableItems) > 0 {
|
|
|
errMsg = "当前指标已被表格引用,不可删除"
|
|
|
- /*tableList, tmpErr = excel.GetExcelBaseInfoByExcelInfoIdList(excelIds)
|
|
|
- if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
|
|
|
- errMsg = "删除失败"
|
|
|
- err = errors.New("判断指标是否用作表格引用,GetExcelBaseInfoByExcelInfoIdList Err:" + tmpErr.Error())
|
|
|
- return
|
|
|
- }*/
|
|
|
return
|
|
|
}
|
|
|
}
|