|
@@ -449,7 +449,7 @@ func EditEdbClassify(classifyId int, classifyName, lang string, sysUser *system.
|
|
|
}
|
|
|
|
|
|
// DeleteCheck 删除检测
|
|
|
-func DeleteCheck(classifyId, edbInfoId int, sysUser *system.Admin) (deleteStatus int, tipsMsg string, err error, errMsg string) {
|
|
|
+func DeleteCheck(classifyId, edbInfoId int, sysUser *system.Admin) (deleteStatus int, tipsMsg string, tableList []*excel.ExcelBaseInfo, err error, errMsg string) {
|
|
|
//删除分类
|
|
|
if classifyId > 0 && edbInfoId == 0 {
|
|
|
// 查找分类
|
|
@@ -579,15 +579,26 @@ func DeleteCheck(classifyId, edbInfoId int, sysUser *system.Admin) (deleteStatus
|
|
|
|
|
|
// 判断指标是否用作表格引用
|
|
|
{
|
|
|
- calculateCount, tmpErr := excel.GetNoCustomAnalysisExcelEdbMappingCount(edbInfoId)
|
|
|
+ excelIds, tmpErr := excel.GetNoCustomAnalysisExcelEdbMapping(edbInfoId)
|
|
|
if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
|
|
|
errMsg = "删除失败"
|
|
|
err = errors.New("判断指标是否用作表格引用,GetNoCustomAnalysisExcelEdbMappingCount Err:" + tmpErr.Error())
|
|
|
return
|
|
|
}
|
|
|
- if calculateCount > 0 {
|
|
|
+ //英文翻译:
|
|
|
+ //1、当前指标已用作画图,不可删除:The current metric is in use for charting and cannot be deleted
|
|
|
+ //2、当前指标已被表格引用,不可删除:The current metric is referenced by a table and cannot be deleted
|
|
|
+ //3、删除失败:Deletion failed
|
|
|
+ //4、知道了:Understood
|
|
|
+ if len(excelIds) > 0 {
|
|
|
deleteStatus = 3
|
|
|
- tipsMsg = "当前指标已添加到表格,不可删除"
|
|
|
+ tipsMsg = "当前指标已被表格引用,不可删除"
|
|
|
+ tableList, tmpErr = excel.GetExcelBaseInfoByExcelInfoIdList(excelIds)
|
|
|
+ if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
|
|
|
+ errMsg = "删除失败"
|
|
|
+ err = errors.New("判断指标是否用作表格引用,GetExcelBaseInfoByExcelInfoIdList Err:" + tmpErr.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
}
|
|
@@ -611,7 +622,7 @@ func DeleteCheck(classifyId, edbInfoId int, sysUser *system.Admin) (deleteStatus
|
|
|
}
|
|
|
|
|
|
// Delete 删除分类/指标
|
|
|
-func Delete(classifyId, edbInfoId int, sysUser *system.Admin, requestBody, requestUrl string) (nextItem *data_manage.EdbInfo, err error, errMsg string) {
|
|
|
+func Delete(classifyId, edbInfoId int, sysUser *system.Admin, requestBody, requestUrl string) (nextItem *data_manage.EdbInfo, tableList []*excel.ExcelBaseInfo, err error, errMsg string) {
|
|
|
//删除分类
|
|
|
if classifyId > 0 && edbInfoId == 0 {
|
|
|
// 查找分类
|
|
@@ -733,14 +744,25 @@ func Delete(classifyId, edbInfoId int, sysUser *system.Admin, requestBody, reque
|
|
|
|
|
|
// 判断指标是否用作表格引用
|
|
|
{
|
|
|
- calculateCount, tmpErr := excel.GetNoCustomAnalysisExcelEdbMappingCount(edbInfoId)
|
|
|
+ excelIds, tmpErr := excel.GetNoCustomAnalysisExcelEdbMapping(edbInfoId)
|
|
|
if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
|
|
|
errMsg = "删除失败"
|
|
|
err = errors.New("判断指标是否用作表格引用,GetNoCustomAnalysisExcelEdbMappingCount Err:" + tmpErr.Error())
|
|
|
return
|
|
|
}
|
|
|
- if calculateCount > 0 {
|
|
|
- errMsg = "当前指标已添加到表格,不可删除"
|
|
|
+ //英文翻译:
|
|
|
+ //1、当前指标已用作画图,不可删除:The current metric is in use for charting and cannot be deleted
|
|
|
+ //2、当前指标已被表格引用,不可删除:The current metric is referenced by a table and cannot be deleted
|
|
|
+ //3、删除失败:Deletion failed
|
|
|
+ //4、知道了:Understood
|
|
|
+ if len(excelIds) > 0 {
|
|
|
+ errMsg = "当前指标已被表格引用,不可删除"
|
|
|
+ tableList, tmpErr = excel.GetExcelBaseInfoByExcelInfoIdList(excelIds)
|
|
|
+ if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
|
|
|
+ errMsg = "删除失败"
|
|
|
+ err = errors.New("判断指标是否用作表格引用,GetExcelBaseInfoByExcelInfoIdList Err:" + tmpErr.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
}
|