mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 00:10:25 +08:00 
			
		
		
		
	fix: 数据库编辑导致标签关联删除修复、cron组件调整
This commit is contained in:
		@@ -78,7 +78,7 @@
 | 
				
			|||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script lang="ts" setup>
 | 
					<script lang="ts" setup>
 | 
				
			||||||
import { computed, toRefs, onMounted, reactive, ref, nextTick } from 'vue';
 | 
					import { computed, toRefs, onMounted, reactive, ref, nextTick, watch } from 'vue';
 | 
				
			||||||
import CrontabSecond from './CrontabSecond.vue';
 | 
					import CrontabSecond from './CrontabSecond.vue';
 | 
				
			||||||
import CrontabMin from './CrontabMin.vue';
 | 
					import CrontabMin from './CrontabMin.vue';
 | 
				
			||||||
import CrontabHour from './CrontabHour.vue';
 | 
					import CrontabHour from './CrontabHour.vue';
 | 
				
			||||||
@@ -129,9 +129,15 @@ const { tabTitles, crontabValueObj } = toRefs(state);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
onMounted(() => {
 | 
					onMounted(() => {
 | 
				
			||||||
    resolveExp();
 | 
					    resolveExp();
 | 
				
			||||||
    changeTab(state.activeName);
 | 
					 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					watch(
 | 
				
			||||||
 | 
					    () => props.expression,
 | 
				
			||||||
 | 
					    () => {
 | 
				
			||||||
 | 
					        resolveExp();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function shouldHide(key: string) {
 | 
					function shouldHide(key: string) {
 | 
				
			||||||
    if (props.hideComponent && props.hideComponent.includes(key)) return false;
 | 
					    if (props.hideComponent && props.hideComponent.includes(key)) return false;
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
@@ -156,6 +162,7 @@ function resolveExp() {
 | 
				
			|||||||
                ...obj,
 | 
					                ...obj,
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        changeTab(state.activeName);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        //没有传入的表达式 则还原
 | 
					        //没有传入的表达式 则还原
 | 
				
			||||||
        clearCron();
 | 
					        clearCron();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,7 +37,7 @@
 | 
				
			|||||||
            <div class="flex-align-center w100">
 | 
					            <div class="flex-align-center w100">
 | 
				
			||||||
                <el-radio v-model="radioValue" :label="7" class="mr5"> 指定 </el-radio>
 | 
					                <el-radio v-model="radioValue" :label="7" class="mr5"> 指定 </el-radio>
 | 
				
			||||||
                <el-select @click="radioValue = 7" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
					                <el-select @click="radioValue = 7" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
				
			||||||
                    <el-option v-for="item in 31" :key="item" :value="item">{{ item }}</el-option>
 | 
					                    <el-option v-for="item in 31" :key="item" :value="`${item}`">{{ item }}</el-option>
 | 
				
			||||||
                </el-select>
 | 
					                </el-select>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@
 | 
				
			|||||||
            <div class="flex-align-center w100">
 | 
					            <div class="flex-align-center w100">
 | 
				
			||||||
                <el-radio v-model="radioValue" :label="4" class="mr5"> 指定 </el-radio>
 | 
					                <el-radio v-model="radioValue" :label="4" class="mr5"> 指定 </el-radio>
 | 
				
			||||||
                <el-select @click="radioValue = 4" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
					                <el-select @click="radioValue = 4" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
				
			||||||
                    <el-option v-for="item in 60" :key="item" :value="item - 1">{{ item - 1 }}</el-option>
 | 
					                    <el-option v-for="item in 60" :key="item" :value="`${item - 1}`">{{ item - 1 }}</el-option>
 | 
				
			||||||
                </el-select>
 | 
					                </el-select>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@
 | 
				
			|||||||
            <div class="flex-align-center w100">
 | 
					            <div class="flex-align-center w100">
 | 
				
			||||||
                <el-radio v-model="radioValue" :label="4" class="mr5"> 指定 </el-radio>
 | 
					                <el-radio v-model="radioValue" :label="4" class="mr5"> 指定 </el-radio>
 | 
				
			||||||
                <el-select @click="radioValue = 4" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
					                <el-select @click="radioValue = 4" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
				
			||||||
                    <el-option v-for="item in 60" :key="item" :value="item - 1">{{ item - 1 }}</el-option>
 | 
					                    <el-option v-for="item in 60" :key="item" :value="`${item - 1}`">{{ item - 1 }}</el-option>
 | 
				
			||||||
                </el-select>
 | 
					                </el-select>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,20 +18,11 @@
 | 
				
			|||||||
            </el-radio>
 | 
					            </el-radio>
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- <el-form-item>
 | 
					 | 
				
			||||||
            <el-radio v-model="radioValue" :label="4">
 | 
					 | 
				
			||||||
                指定
 | 
					 | 
				
			||||||
                <el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width: 100%">
 | 
					 | 
				
			||||||
                    <el-option v-for="item in 12" :key="item" :value="item">{{ item }}</el-option>
 | 
					 | 
				
			||||||
                </el-select>
 | 
					 | 
				
			||||||
            </el-radio>
 | 
					 | 
				
			||||||
        </el-form-item> -->
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        <el-form-item>
 | 
					        <el-form-item>
 | 
				
			||||||
            <div class="flex-align-center w100">
 | 
					            <div class="flex-align-center w100">
 | 
				
			||||||
                <el-radio v-model="radioValue" :label="4" class="mr5"> 指定 </el-radio>
 | 
					                <el-radio v-model="radioValue" :label="4" class="mr5"> 指定 </el-radio>
 | 
				
			||||||
                <el-select @click="radioValue = 4" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
					                <el-select @click="radioValue = 4" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
				
			||||||
                    <el-option v-for="item in 12" :key="item" :value="item">{{ item }}</el-option>
 | 
					                    <el-option v-for="item in 12" :key="item" :value="`${item}`">{{ item }}</el-option>
 | 
				
			||||||
                </el-select>
 | 
					                </el-select>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@
 | 
				
			|||||||
            <div class="flex-align-center w100">
 | 
					            <div class="flex-align-center w100">
 | 
				
			||||||
                <el-radio v-model="radioValue" :label="4" class="mr5"> 指定 </el-radio>
 | 
					                <el-radio v-model="radioValue" :label="4" class="mr5"> 指定 </el-radio>
 | 
				
			||||||
                <el-select @click="radioValue = 4" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
					                <el-select @click="radioValue = 4" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
				
			||||||
                    <el-option v-for="item in 60" :key="item" :value="item - 1">{{ item - 1 }}</el-option>
 | 
					                    <el-option v-for="item in 60" :key="item" :value="`${item - 1}`">{{ item - 1 }}</el-option>
 | 
				
			||||||
                </el-select>
 | 
					                </el-select>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,7 @@
 | 
				
			|||||||
            <div class="flex-align-center w100">
 | 
					            <div class="flex-align-center w100">
 | 
				
			||||||
                <el-radio v-model="radioValue" :label="6" class="mr5"> 指定 </el-radio>
 | 
					                <el-radio v-model="radioValue" :label="6" class="mr5"> 指定 </el-radio>
 | 
				
			||||||
                <el-select @click="radioValue = 6" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
					                <el-select @click="radioValue = 6" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
				
			||||||
                    <el-option v-for="(item, index) of weekList" :label="item" :key="index" :value="index + 1">{{ item }}</el-option>
 | 
					                    <el-option v-for="(item, index) of weekList" :label="item" :key="index" :value="`${index + 1}`">{{ item }}</el-option>
 | 
				
			||||||
                </el-select>
 | 
					                </el-select>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,20 +23,11 @@
 | 
				
			|||||||
            </el-radio>
 | 
					            </el-radio>
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- <el-form-item>
 | 
					 | 
				
			||||||
            <el-radio :label="5" v-model="radioValue">
 | 
					 | 
				
			||||||
                指定
 | 
					 | 
				
			||||||
                <el-select clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
					 | 
				
			||||||
                    <el-option v-for="item in 9" :key="item" :value="item - 1 + fullYear" :label="item - 1 + fullYear" />
 | 
					 | 
				
			||||||
                </el-select>
 | 
					 | 
				
			||||||
            </el-radio>
 | 
					 | 
				
			||||||
        </el-form-item> -->
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        <el-form-item>
 | 
					        <el-form-item>
 | 
				
			||||||
            <div class="flex-align-center w100">
 | 
					            <div class="flex-align-center w100">
 | 
				
			||||||
                <el-radio v-model="radioValue" :label="5" class="mr5"> 指定 </el-radio>
 | 
					                <el-radio v-model="radioValue" :label="5" class="mr5"> 指定 </el-radio>
 | 
				
			||||||
                <el-select @click="radioValue = 5" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
					                <el-select @click="radioValue = 5" class="w100" clearable v-model="checkboxList" placeholder="可多选" multiple>
 | 
				
			||||||
                    <el-option v-for="item in 9" :key="item" :value="item - 1 + fullYear" :label="item - 1 + fullYear" />
 | 
					                    <el-option v-for="item in 9" :key="item" :value="`${item - 1 + fullYear}`" :label="item - 1 + fullYear" />
 | 
				
			||||||
                </el-select>
 | 
					                </el-select>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -113,7 +113,7 @@ func (d *dbAppImpl) SaveDb(ctx context.Context, dbEntity *entity.Db, tagIds ...u
 | 
				
			|||||||
	return d.Tx(ctx, func(ctx context.Context) error {
 | 
						return d.Tx(ctx, func(ctx context.Context) error {
 | 
				
			||||||
		return d.UpdateById(ctx, dbEntity)
 | 
							return d.UpdateById(ctx, dbEntity)
 | 
				
			||||||
	}, func(ctx context.Context) error {
 | 
						}, func(ctx context.Context) error {
 | 
				
			||||||
		return d.tagApp.RelateResource(ctx, oldDb.Code, consts.TagResourceTypeDb, tagIds)
 | 
							return d.tagApp.RelateResource(ctx, old.Code, consts.TagResourceTypeDb, tagIds)
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -150,6 +150,9 @@ func (p *tagTreeAppImpl) GetAccountResourceCodes(accountId uint64, resourceType
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (p *tagTreeAppImpl) RelateResource(ctx context.Context, resourceCode string, resourceType int8, tagIds []uint64) error {
 | 
					func (p *tagTreeAppImpl) RelateResource(ctx context.Context, resourceCode string, resourceType int8, tagIds []uint64) error {
 | 
				
			||||||
 | 
						if resourceCode == "" {
 | 
				
			||||||
 | 
							return errorx.NewBiz("资源编号不能为空")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	// 如果tagIds为空数组,则为解绑该标签资源关联关系
 | 
						// 如果tagIds为空数组,则为解绑该标签资源关联关系
 | 
				
			||||||
	if len(tagIds) == 0 {
 | 
						if len(tagIds) == 0 {
 | 
				
			||||||
		return p.tagResourceApp.DeleteByCond(ctx, &entity.TagResource{
 | 
							return p.tagResourceApp.DeleteByCond(ctx, &entity.TagResource{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user