diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/topic/controller/TopicController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/topic/controller/TopicController.java index b2c57051..d412ee2b 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/topic/controller/TopicController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/topic/controller/TopicController.java @@ -273,6 +273,18 @@ public class TopicController extends JeecgController { } return Result.OK(); } + + //用于查询根据id获取的年度比赛项目 + @GetMapping(value = "/getdate") + public Result getdate(@RequestParam(name="annualCompid",required=true) String annualCompid) { + QueryWrapper queryWrapper= new QueryWrapper<>(); + queryWrapper.eq("id",annualCompid); + AnnualCompPoint annualCompPoint =annualCompPointService.getOne(queryWrapper); + return Result.OK(annualCompPoint.getObjName()); + } + + + /** * 添加 * diff --git a/jeecgboot-vue3-master/src/views/topic/Topic.api.ts b/jeecgboot-vue3-master/src/views/topic/Topic.api.ts index 688d928c..700efa12 100644 --- a/jeecgboot-vue3-master/src/views/topic/Topic.api.ts +++ b/jeecgboot-vue3-master/src/views/topic/Topic.api.ts @@ -17,6 +17,7 @@ enum Api { importExcel = '/topic/topic/importExcel', exportXls = '/topic/topic/exportXls', addScoreSta = '/scoresta/scoreSta/addScoreSta', + getdate = '/topic/topic/getdate', } export const addScoreSta = (params, isUpdate) => { @@ -46,6 +47,13 @@ export const list3 = (params) => defHttp.get({url: Api.list3, params}); export const list5 = (params) => defHttp.get({url: Api.list5, params}); export const Update = (params) => defHttp.post({url: Api.edit, params}); export const select = (params) => defHttp.post({url: Api.select, params}); +/*export const getdate = (params) => defHttp.get({url: Api.getdate, params});*/ + +export const getdate = (params) => + defHttp.get({ + url: Api.getdate, + params + }); /** * 删除单个 diff --git a/jeecgboot-vue3-master/src/views/topic/components/TopicForm.vue b/jeecgboot-vue3-master/src/views/topic/components/TopicForm.vue index 9164321c..e3cb5e09 100644 --- a/jeecgboot-vue3-master/src/views/topic/components/TopicForm.vue +++ b/jeecgboot-vue3-master/src/views/topic/components/TopicForm.vue @@ -56,8 +56,14 @@ import JSwitch from '/@/components/Form/src/jeecg/components/JSwitch.vue'; import JPopup from '/@/components/Form/src/jeecg/components/JPopup.vue'; import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue'; import { getValueType } from '/@/utils'; -import { saveOrUpdate,select } from '../Topic.api'; +import { saveOrUpdate,select,getdate } from '../Topic.api'; import { Form } from 'ant-design-vue'; +import {useRoute} from "vue-router"; +import {demoArticleListApi} from "/@/api/demo/mainHome"; +const $Route = useRoute() +//把路由中的数据转化到组件中 + + const props = defineProps({ formDisabled: { type: Boolean, default: false }, @@ -101,12 +107,32 @@ const disabled = computed(()=>{ } return props.formDisabled; }); +function routrtodate() { + const annualCompid = $Route.query.annualCompid; + formData.annualCompid = annualCompid; + console.log( formData.annualCompid,annualCompid,'111') +}; +routrtodate(); +let compName = '' +function getData() { + return new Promise((resovle,rej) => { + const annualCompid = $Route.query.annualCompid; + getdate({ annualCompid:annualCompid }).then(res => { + console.log(res,'2222') + compName = res + resovle(res) + }) + }) +}; +// getData(); /** * 新增 */ -function add() { +async function add() { +const res = await getData() + setFieldsValue({annualCompid:formData.annualCompid,annualCompid_dictText:res}) edit({}); } function change(record){ @@ -166,6 +192,7 @@ async function submitForm() { * popup组件值改变事件 */ function setFieldsValue(map) { + console.log(map) Object.keys(map).map((key) => { formData[key] = map[key]; });