刷新食谱计划
This commit is contained in:
parent
a9b69cd1a5
commit
6be196d27f
@ -9,6 +9,7 @@ import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.poi.ExcelUtil;
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.service.ISysRecipesPlanService;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -101,4 +102,16 @@ public class SysRecipesPlanController extends BaseController {
|
||||
ExcelUtil<SysRecipesPlan> util = new ExcelUtil<SysRecipesPlan>(SysRecipesPlan.class);
|
||||
return util.exportExcel(list, "recipesPlan");
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新食谱计划
|
||||
* @param cusId
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:plan:refresh')")
|
||||
@GetMapping("/refreshRecipesPlan")
|
||||
public AjaxResult refreshRecipesPlan(@RequestParam("cusId")Long cusId) {
|
||||
sysRecipesPlanService.regenerateRecipesPlan(cusId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -49,3 +49,11 @@ export function listRecipesPlanByCusId(id) {
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
export function refreshRecipesPlan(cusId){
|
||||
return request({
|
||||
url: "/recipes/recipesPlan/refreshRecipesPlan",
|
||||
method: "get",
|
||||
params: {"cusId": cusId}
|
||||
});
|
||||
}
|
||||
|
@ -46,6 +46,14 @@
|
||||
>
|
||||
生成7天体验计划
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
v-hasPermi="['recipes:plan:refresh']"
|
||||
@click="refreshRecipesPlan()"
|
||||
>
|
||||
刷新食谱计划
|
||||
</el-button>
|
||||
</section>
|
||||
<section>
|
||||
<el-button
|
||||
@ -154,6 +162,7 @@ import {
|
||||
listRecipesPlanByCusId,
|
||||
addRecipesPlan,
|
||||
updateRecipesPlan,
|
||||
refreshRecipesPlan
|
||||
} from "@/api/custom/recipesPlan";
|
||||
import PlanPauseDrawer from "./PlanPauseDrawer";
|
||||
import VueQr from "vue-qr";
|
||||
@ -188,6 +197,7 @@ export default {
|
||||
return time.getTime() < Date.now() - 24 * 60 * 60 * 1000;
|
||||
},
|
||||
},
|
||||
refreshFlag: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@ -223,6 +233,25 @@ export default {
|
||||
this.planLoading = false;
|
||||
});
|
||||
},
|
||||
refreshRecipesPlan(){
|
||||
if(this.refreshFlag){
|
||||
//请勿重复刷新
|
||||
this.$message.error("请勿重复刷新,十秒后重试");
|
||||
return;
|
||||
}else{
|
||||
this.refreshFlag = true;
|
||||
}
|
||||
refreshRecipesPlan(this.data.id).then((response) => {
|
||||
//十秒之后刷新页面
|
||||
this.$message.success("正在刷新,大概需要十秒");
|
||||
});
|
||||
var self = this;
|
||||
let t = setTimeout(function(){
|
||||
self.getList();
|
||||
self.$message.success("食谱计划刷新成功");
|
||||
self.refreshFlag = false;
|
||||
}, 10000);
|
||||
},
|
||||
reset() {
|
||||
this.form = {
|
||||
startDate: null,
|
||||
|
Loading…
x
Reference in New Issue
Block a user