Pārlūkot izejas kodu

ShowList管理优化

zhangqiang 8 mēneši atpakaļ
vecāks
revīzija
d78ac6e28d

+ 1 - 1
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/showlist/controller/OkkiShowlistController.java

@@ -382,7 +382,7 @@ public class OkkiShowlistController {
 	 }
 
 	 @GetMapping(value = "productList")
-	 public Result<ProductListVO> productList(@RequestParam String siteId) throws Exception {
+	 public Result<ProductListVO> productList(@RequestParam(name="siteId",required=true) String siteId) throws Exception {
 		 final ProductListVO productList = okkiShowlistService.getProductList(siteId);
 		 return Result.OK(productList);
 	 }

+ 1 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/showlist/service/impl/OkkiShowlistServiceImpl.java

@@ -22,6 +22,7 @@ import org.jeecg.modules.okki.showlist.mapper.OkkiShowlistBlogMapper;
 import org.jeecg.modules.okki.showlist.mapper.OkkiShowlistMapper;
 import org.jeecg.modules.okki.showlist.service.IOkkiShowlistService;
 import org.jeecg.modules.okki.showlist.param.*;
+import org.jeecg.modules.okki.showlist.vo.ProductListDataVO;
 import org.jeecg.modules.okki.showlist.vo.ProductListVO;
 import org.jeecg.modules.okki.utils.HttpClientUtils;
 import org.springframework.beans.factory.annotation.Value;

+ 23 - 6
jeecgboot-vue3/src/views/okki/showlist/OkkiShowlist.data.ts

@@ -1,8 +1,8 @@
 import {BasicColumn} from '/@/components/Table';
 import {FormSchema} from '/@/components/Table';
-import { rules} from '/@/utils/helper/validator';
-import { render } from '/@/utils/common/renderUtils';
 import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
+import {ref} from "vue";
+import {defHttp} from "@/utils/http/axios";
 //列表数据
 export const columns: BasicColumn[] = [
    {
@@ -50,13 +50,17 @@ export const columns: BasicColumn[] = [
 export const searchFormSchema: FormSchema[] = [
 ];
 //表单数据
+export const siteId = ref();
 export const formSchema: FormSchema[] = [
   {
     label: '站点id',
     field: 'siteId',
     component: 'JSearchSelect',
-    componentProps:{
-       dict:"okki_site,company_name,site_id"
+    componentProps: {
+      dict:"okki_site,company_name,site_id",
+      onChange: (e) => {
+        siteId.value = e;
+      }
     },
     dynamicRules: ({model,schema}) => {
           return [
@@ -155,9 +159,22 @@ export const okkiProductListFormSchema: FormSchema[] = [
   {
     label: '商品pid',
     field: 'pidList',
-    component: 'Input',
+    component: 'ApiSelect',
     componentProps:{
-
+      //multiple: 多选;不填写为单选
+      mode: 'multiple',
+      //请求api,返回结果{ result: { records: [{'id':'1',name:'scott'},{'id':'2',name:'小张'}] }}
+      api: ()=> defHttp.get({ url: '/showlist/okkiShowlist/productList?siteId=' + siteId.value}),
+      //数值转成String
+      numberToString: false,
+      //标题字段
+      labelField: 'c_title',
+      //值字段
+      valueField: 'cid',
+      //请求参数
+      params: {},
+      //返回结果字段
+      resultField:'list'
      },
     dynamicRules: ({model,schema}) => {
           return [

+ 0 - 73
jeecgboot-vue3/src/views/okki/showlist/components/OkkiRecommendedProductsForm.vue

@@ -1,73 +0,0 @@
-<template>
-    <BasicForm @register="registerForm"/>
-</template>
-<script lang="ts">
-    import {defineComponent} from 'vue';
-    import {BasicForm, useForm} from '/@/components/Form/index';
-    import {okkiRecommendedProductsFormSchema} from '../OkkiShowlist.data';
-    import {defHttp} from '/@/utils/http/axios';
-    import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
-
-    export default defineComponent({
-        name:"OkkiRecommendedProductsForm",
-        components: {BasicForm},
-        emits:['register'],
-        props:{
-            disabled: {
-                type: Boolean,
-                default: false
-            }
-        },
-        setup(props,{emit}) {
-            const [registerForm, {setProps, resetFields, setFieldsValue,getFieldsValue,validate}] = useForm({
-                //labelWidth: 150,
-                schemas: okkiRecommendedProductsFormSchema,
-                showActionButtonGroup: false,
-                baseColProps: {span: 24}
-            });
-            /**
-            *初始化加载数据
-            */
-            function initFormData(url,id){
-                if(id){
-                     defHttp.get({url,params:{id}},{isTransformResponse:false}).then(res=>{
-                       res.success && setFieldsValue({...res.result[0]});
-                    })
-                }
-                setProps({disabled: props.disabled})
-            }
-           /**
-            *获取表单数据
-            */
-            function getFormData(){
-               let formData = getFieldsValue();
-               Object.keys(formData).map(k=>{
-                   if(formData[k] instanceof Array){
-                       formData[k] = formData[k].join(',')
-                   }
-               });
-               return [formData];
-            }
-            /**
-            *表单校验
-            */
-            function validateForm(index){
-                return new Promise((resolve, reject) => {
-                    // 验证子表表单
-                    validate().then(()=>{
-                        return resolve()
-                    }).catch(()=> {
-                        return reject({ error: VALIDATE_FAILED ,index})
-                    })
-                })
-            }
-            return {
-                registerForm,
-                resetFields,
-                initFormData,
-                getFormData,
-                validateForm
-            }
-        }
-    })
-</script>

+ 0 - 73
jeecgboot-vue3/src/views/okki/showlist/components/OkkiShowlistBlogForm.vue

@@ -1,73 +0,0 @@
-<template>
-    <BasicForm @register="registerForm"/>
-</template>
-<script lang="ts">
-    import {defineComponent} from 'vue';
-    import {BasicForm, useForm} from '/@/components/Form/index';
-    import {okkiShowlistBlogFormSchema} from '../OkkiShowlist.data';
-    import {defHttp} from '/@/utils/http/axios';
-    import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
-
-    export default defineComponent({
-        name:"OkkiShowlistBlogForm",
-        components: {BasicForm},
-        emits:['register'],
-        props:{
-            disabled: {
-                type: Boolean,
-                default: false
-            }
-        },
-        setup(props,{emit}) {
-            const [registerForm, {setProps, resetFields, setFieldsValue,getFieldsValue,validate}] = useForm({
-                //labelWidth: 150,
-                schemas: okkiShowlistBlogFormSchema,
-                showActionButtonGroup: false,
-                baseColProps: {span: 24}
-            });
-            /**
-            *初始化加载数据
-            */
-            function initFormData(url,id){
-                if(id){
-                     defHttp.get({url,params:{id}},{isTransformResponse:false}).then(res=>{
-                       res.success && setFieldsValue({...res.result[0]});
-                    })
-                }
-                setProps({disabled: props.disabled})
-            }
-           /**
-            *获取表单数据
-            */
-            function getFormData(){
-               let formData = getFieldsValue();
-               Object.keys(formData).map(k=>{
-                   if(formData[k] instanceof Array){
-                       formData[k] = formData[k].join(',')
-                   }
-               });
-               return [formData];
-            }
-            /**
-            *表单校验
-            */
-            function validateForm(index){
-                return new Promise((resolve, reject) => {
-                    // 验证子表表单
-                    validate().then(()=>{
-                        return resolve()
-                    }).catch(()=> {
-                        return reject({ error: VALIDATE_FAILED ,index})
-                    })
-                })
-            }
-            return {
-                registerForm,
-                resetFields,
-                initFormData,
-                getFormData,
-                validateForm
-            }
-        }
-    })
-</script>

+ 2 - 1
jeecgboot-vue3/src/views/okki/showlist/components/OkkiShowlistModal.vue

@@ -72,7 +72,7 @@
     import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods.ts'
     import OkkiOverviewForm from './OkkiOverviewForm.vue'
     import OkkiProductListForm from './OkkiProductListForm.vue'
-    import {formSchema,okkiAdvantageColumns,okkiKeywordsColumns,okkiFaqColumns} from '../OkkiShowlist.data';
+    import {siteId,formSchema,okkiAdvantageColumns,okkiKeywordsColumns,okkiFaqColumns} from '../OkkiShowlist.data';
     import {saveOrUpdate,okkiOverviewList,okkiProductListList,okkiAdvantageList,okkiKeywordsList,okkiFaqList} from '../OkkiShowlist.api';
     import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
     // Emits声明
@@ -122,6 +122,7 @@
             await setFieldsValue({
                 ...data.record,
             });
+            siteId.value = data.record.siteId;
              okkiOverviewForm.value.initFormData(okkiOverviewList,data?.record?.id)
              okkiProductListForm.value.initFormData(okkiProductListList,data?.record?.id)
              requestSubTableData(okkiAdvantageList, {id:data?.record?.id}, okkiAdvantageTable)