|
@@ -740,9 +740,25 @@
|
|
|
label="选择其他营期"
|
|
label="选择其他营期"
|
|
|
prop="periodId"
|
|
prop="periodId"
|
|
|
>
|
|
>
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="createCampPeriodForm.trainingCampId"
|
|
|
|
|
+ placeholder="请选择训练营"
|
|
|
|
|
+ :loading="loadingNew"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ filterable
|
|
|
|
|
+ @change="handleTrainingCampChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in trainingCampList"
|
|
|
|
|
+ :key="item.trainingCampId"
|
|
|
|
|
+ :label="item.trainingCampName"
|
|
|
|
|
+ :value="item.trainingCampId"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+
|
|
|
<el-select
|
|
<el-select
|
|
|
v-model="createCampPeriodForm.periodId"
|
|
v-model="createCampPeriodForm.periodId"
|
|
|
- placeholder="请选择其他营期"
|
|
|
|
|
|
|
+ placeholder="请选择营期"
|
|
|
:loading="loadingNew"
|
|
:loading="loadingNew"
|
|
|
clearable
|
|
clearable
|
|
|
filterable
|
|
filterable
|
|
@@ -754,6 +770,7 @@
|
|
|
:value="item.periodId"
|
|
:value="item.periodId"
|
|
|
/>
|
|
/>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
|
|
+
|
|
|
<div v-if="loadingNew" class="loading-text">
|
|
<div v-if="loadingNew" class="loading-text">
|
|
|
<i class="el-icon-loading"></i> 加载中...
|
|
<i class="el-icon-loading"></i> 加载中...
|
|
|
</div>
|
|
</div>
|
|
@@ -1033,6 +1050,7 @@ export default {
|
|
|
otherCampPeriods: [], // 其他训练营的期数列表
|
|
otherCampPeriods: [], // 其他训练营的期数列表
|
|
|
// 缓存数据避免重复请求
|
|
// 缓存数据避免重复请求
|
|
|
periodDataCache: new Map(),
|
|
periodDataCache: new Map(),
|
|
|
|
|
+ trainingCampList:[],
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
@@ -2065,39 +2083,39 @@ export default {
|
|
|
},
|
|
},
|
|
|
/** 加载其他训练营期数列表 */
|
|
/** 加载其他训练营期数列表 */
|
|
|
async loadOtherCampPeriods() {
|
|
async loadOtherCampPeriods() {
|
|
|
- if (this.trainingCampIdValue == null) {
|
|
|
|
|
- this.$message.error('缺少训练营ID,无法查询数据');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- // 检查缓存
|
|
|
|
|
- const cacheKey = `otherCampPeriods_${this.trainingCampIdValue}`;
|
|
|
|
|
- if (this.periodDataCache.has(cacheKey)) {
|
|
|
|
|
- this.otherCampPeriods = this.periodDataCache.get(cacheKey);
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- this.loading = true;
|
|
|
|
|
|
|
+ // 清空营期数据和选中项,避免显示旧数据
|
|
|
|
|
+ this.otherCampPeriods = [];
|
|
|
|
|
+ this.createCampPeriodForm.periodId = ''; // 清空已选营期
|
|
|
|
|
+ this.createCampPeriodForm.trainingCampId = ''; // 清空已选训练营
|
|
|
|
|
+
|
|
|
|
|
+ // 检查缓存 - 使用固定键名,因为训练营列表不依赖当前训练营ID
|
|
|
|
|
+ // const cacheKey = 'trainingCampList';
|
|
|
|
|
+ // if (this.periodDataCache.has(cacheKey)) {
|
|
|
|
|
+ // this.trainingCampList = this.periodDataCache.get(cacheKey);
|
|
|
|
|
+ // return;
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ this.loadingNew = true;
|
|
|
try {
|
|
try {
|
|
|
const requestParams = {
|
|
const requestParams = {
|
|
|
periodId: this.trainingCampIdValue,
|
|
periodId: this.trainingCampIdValue,
|
|
|
campPeriodType: this.createCampPeriodForm.campPeriodType
|
|
campPeriodType: this.createCampPeriodForm.campPeriodType
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
const response = await getScreeningCampPeriod(requestParams);
|
|
const response = await getScreeningCampPeriod(requestParams);
|
|
|
-
|
|
|
|
|
if (response && Array.isArray(response.resultList)) {
|
|
if (response && Array.isArray(response.resultList)) {
|
|
|
- this.otherCampPeriods = response.resultList;
|
|
|
|
|
- // 缓存数据
|
|
|
|
|
- this.periodDataCache.set(cacheKey, response.resultList);
|
|
|
|
|
|
|
+ this.trainingCampList = response.resultList;
|
|
|
|
|
+ // 缓存数据 - 使用固定键名
|
|
|
|
|
+ //this.periodDataCache.set(cacheKey, response.resultList);
|
|
|
} else {
|
|
} else {
|
|
|
console.warn('接口返回格式异常:', response);
|
|
console.warn('接口返回格式异常:', response);
|
|
|
- this.otherCampPeriods = [];
|
|
|
|
|
|
|
+ this.trainingCampList = [];
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('接口请求失败:', error);
|
|
console.error('接口请求失败:', error);
|
|
|
this.$message.error('查询失败,请重试');
|
|
this.$message.error('查询失败,请重试');
|
|
|
- this.otherCampPeriods = [];
|
|
|
|
|
|
|
+ this.trainingCampList = [];
|
|
|
} finally {
|
|
} finally {
|
|
|
- this.loading = false;
|
|
|
|
|
|
|
+ this.loadingNew = false;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -2189,6 +2207,7 @@ export default {
|
|
|
|
|
|
|
|
this.currentCampPeriods = [];
|
|
this.currentCampPeriods = [];
|
|
|
this.otherCampPeriods = [];
|
|
this.otherCampPeriods = [];
|
|
|
|
|
+ this.trainingCampList=[]
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
this.submitLoading = false;
|
|
this.submitLoading = false;
|
|
|
|
|
|
|
@@ -2197,6 +2216,23 @@ export default {
|
|
|
this.$refs.createCampPeriodForm.clearValidate();
|
|
this.$refs.createCampPeriodForm.clearValidate();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ handleTrainingCampChange(trainingCampId){
|
|
|
|
|
+ this.otherCampPeriods = [];
|
|
|
|
|
+ this.createCampPeriodForm.periodId = '';
|
|
|
|
|
+ const params = {
|
|
|
|
|
+ ...this.queryParams,
|
|
|
|
|
+ trainingCampId: trainingCampId // 更新训练营ID
|
|
|
|
|
+ };
|
|
|
|
|
+ pagePeriod(params).then(response => {
|
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
|
+ this.otherCampPeriods = response.rows;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.error(response.msg || '查询营期失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ this.$message.error('查询营期失败: ' + (error.message || '查询营期失败'));
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|