Parcourir la source

1、修复Bug

41235 il y a 1 an
Parent
commit
a4e0c2743b
2 fichiers modifiés avec 49 ajouts et 7 suppressions
  1. 46 3
      src/views/XMHJC/carousel/index.vue
  2. 3 4
      src/views/XMHJC/home/index.vue

+ 46 - 3
src/views/XMHJC/carousel/index.vue

@@ -52,6 +52,27 @@
             </el-col>
           </el-row>
         </template>
+
+        <template #menuId>
+          <el-form-item prop="menuId">
+            <el-select
+                v-model="formData.data.columnId"
+                :rule="rules.columnId"
+                placeholder="请选择菜单"
+                no-data-text="无数据,请到栏目菜单添加"
+                @change="(val) => getArticleListSelect(val)"
+            >
+              <el-option
+                  v-for="item in columnListData"
+                  :label="item.name"
+                  :value="item.id"
+              >
+              </el-option>
+            </el-select>
+
+          </el-form-item>
+
+        </template>
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
@@ -68,12 +89,13 @@ import byTable from "@/components/byTable/index.vue";
 import byForm from "@/components/byForm/index.vue";
 import { computed, ref } from "vue";
 import {getDictOneByXmhjc, getFileList, getFileStr} from "@/api/XMHJC/common";
-import {findColumnArticleList} from "@/api/XMHJC/column";
+import {findColumnArticleList, findMenuListByOpen} from "@/api/XMHJC/column";
 const loading = ref(false);
 const submitLoading = ref(false);
 const enableStatus = ref([]);
 const carouselModules = ref([]);
 const articleList = ref([]);
+const columnListData = ref([]);
 const targetType = ref([]);
 const sourceList = ref({
   data: [],
@@ -233,6 +255,13 @@ const formConfig = computed(() => {
       isShow: formData.data.targetType == 2,
     },
     {
+      type: "slot",
+      slotName: "menuId",
+      prop: "menuId",
+      label: "菜单",
+      required: true,
+    },
+    {
       label: "跳转文章",
       prop: "articleId",
       type: "select",
@@ -364,12 +393,21 @@ const getDictlist = async () => {
   }));
 };
 
+
 //获取文章列表
-const getArticleList = async () => {
+const getArticleListSelect = async (value) => {
+  formData.data.articleId = ""
+  await getArticleList(value)
+
+};
+
+//获取文章列表
+const getArticleList = async (value) => {
   const res = await findColumnArticleList({
     pageNum: 1,
     pageSize: 99999,
     status: 1,
+    columnId: value,
   });
   articleList.value = res.data.rows.map((x) => ({
     label: x.title,
@@ -400,9 +438,14 @@ const carouselUrlSuccess = (response, uploadFile) => {
   formData.data.carouselUrl = uploadFile.raw.fileUrl;
 };
 
+const getMenuList = async () => {
+  const res = await findMenuListByOpen({})
+  columnListData.value = res.data
+};
+
+getMenuList()
 getList();
 getDictlist();
-getArticleList();
 </script>
 
 <style lang="scss" scoped>

+ 3 - 4
src/views/XMHJC/home/index.vue

@@ -199,6 +199,7 @@ const formConfig = computed(() => {
       label: "文章1",
       placeholder: "请选择文章",
       data: articleList.value,
+      clearable: true,
       filterable: true,
     },
     {
@@ -207,6 +208,7 @@ const formConfig = computed(() => {
       label: "文章2",
       placeholder: "请选择文章",
       data: articleList.value,
+      clearable: true,
       filterable: true,
     },
     {
@@ -214,6 +216,7 @@ const formConfig = computed(() => {
       prop: "article3",
       label: "文章3",
       placeholder: "请选择文章",
+      clearable: true,
       data: articleList.value,
       filterable: true,
     },
@@ -272,8 +275,6 @@ const getDtl = async (row) => {
 const getMenuList = async () => {
   const res = await findMenuListByOpen({})
   columnListData.value = res.data
-
-
 };
 
 //获取文章列表
@@ -302,8 +303,6 @@ const getArticleList = async (value) => {
     label: x.title,
     value: x.id,
   }));
-
-
 };