From 428889aeca255f355827d4cb3aca9fea9c413503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=B6=E4=B8=9C?= <1654135867@qq.com> Date: Mon, 29 Jul 2024 18:39:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E6=B7=BB=E5=8A=A0=E9=A2=98?= =?UTF-8?q?=E7=9B=AE=E8=87=AA=E5=8A=A8=E5=A1=AB=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../topic/controller/TopicController.java | 12 +++++++ .../src/views/topic/Topic.api.ts | 8 +++++ .../src/views/topic/components/TopicForm.vue | 31 +++++++++++++++++-- 3 files changed, 49 insertions(+), 2 deletions(-) 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]; });