openHj 10 сар өмнө
parent
commit
7b57e7b1dd

+ 262 - 0
src/views/XMHJC/browsing/index.vue

@@ -0,0 +1,262 @@
+<template>
+  <div class="carousel">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :action-list="[
+          // {
+          //   text: '添加轮播图',
+          //   action: () => openModal('add'),
+          // },
+        ]"
+        @moreSearch="moreSearch"
+        @get-list="getList">
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+    <el-dialog title="高级检索" v-if="openSearch" v-model="openSearch" width="600" :before-close="cancelSearch">
+      <byForm :formConfig="formSearchConfig" :formOption="formOption" v-model="sourceList.pagination">
+        <template #dateRangeCreateTime>
+          <el-row style="width: 100%">
+            <el-col :span="8">
+              <el-date-picker
+                v-model="dateRange"
+                value-format="YYYY-MM-DD"
+                type="daterange"
+                range-separator="-"
+                start-placeholder="开始日期"
+                end-placeholder="结束日期"
+                :default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]"
+              ></el-date-picker>
+            </el-col>
+          </el-row>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="cancelSearch()" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitSearch()" size="large">确 定</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+/* eslint-disable vue/no-unused-components */
+import { ElMessage, ElMessageBox } from "element-plus";
+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, 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 dateRange = ref([]);
+const openSearch = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let modalType = ref("add");
+let rules = ref({
+  modules: [{ required: true, message: "请选择所属模块" }],
+  title: [{ required: true, message: "请输入标题" }],
+  status: [{ required: true, message: "请选择启用状态", trigger: "change" }],
+  sort: [{ required: true, message: "请输入排序", trigger: "blur" }],
+
+  carouselUrl: [{ required: true, message: "请上传轮播图", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
+const config = computed(() => {
+  return [
+    {
+        attrs: {
+            label: "模块名称",
+            prop: "name",
+        },
+      // render(type) {
+      //   return proxy.dictValueLabel(type, carouselModules.value);
+      // },
+    },
+    {
+      attrs: {
+        label: "ip",
+        prop: "ip",
+      },
+    },
+    {
+      attrs: {
+        label: "访问时间",
+        prop: "createTime",
+      },
+    },
+    /*{
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: row.status == 1 ? "禁用" : "启用",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              changeStatus(row);
+            },
+          },
+          {
+            attrs: {
+              label: "编辑",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDetail(row);
+            },
+          },
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+            },
+            el: "button",
+            click() {
+              del(row);
+            },
+          },
+        ];
+      },
+    },*/
+  ];
+});
+
+let formData = reactive({
+  data: {},
+  treeData: [],
+  carouselUrlList:[],
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const formSearchConfig = computed(() => {
+  return [
+    {
+      type: "slot",
+      slotName: "dateRangeCreateTime",
+      label: "访问时间",
+    },
+  ];
+});
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+    proxy.post("/browsingHistory/page", sourceList.value.pagination).then((message) => {
+    console.log(message);
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {};
+};
+
+
+//编辑详情
+const getDetail = (row) => {
+  modalType.value = "edit";
+  proxy.post("/carouselManager/detail", { id: row.id }).then((res) => {
+    formData.data = res;
+    getFileList({businessIdList: [res.id], fileType: 1}).then((resFile) => {
+      formData.data.carouselUrlList = resFile.data[res.id];
+      formData.data.carouselUrl = resFile.data[res.id];
+      dialogVisible.value = true;
+    });
+  });
+};
+
+//删除
+const del = (row) => {
+  modalType.value = "edit";
+  ElMessageBox.confirm("你是否确认此操作?", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  }).then(() => {
+    proxy.post("/carouselManager/delete", { id: row.id }).then((res) => {
+        ElMessage({
+          message: "操作成功",
+          type: "success",
+        });
+        getList();
+      });
+  });
+};
+
+const moreSearch = () => {
+  openSearch.value = true;
+};
+
+const cancelSearch = () => {
+  openSearch.value = false;
+};
+
+
+const submitSearch = () => {
+  if (dateRange.value.length !== 0) {
+    sourceList.value.pagination.beginTime = dateRange.value[0];
+    sourceList.value.pagination.endTime = dateRange.value[1];
+  }
+  openSearch.value = false;
+  getList();
+};
+
+
+getList();
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+.el-icon.uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 110px;
+  height: 110px;
+  text-align: center;
+  border: 1px dashed var(--el-border-color);
+}
+</style>