Explorar o código

add 数据管理/高校列表&图书基础数据

haveyou hai 1 ano
pai
achega
5eac7173ee

+ 25 - 32
src/components/CommonPage/CommonTable.vue

@@ -1,29 +1,24 @@
 <template>
-  <ele-page flex-table>
-    <!-- 搜索表单 -->
-    <slot name="search"></slot>
-    <ele-card :body-style="{ paddingTop: '8px' }" flex-table>
-      <!-- 表格 -->
-      <ele-pro-table
-        ref="tableRef"
-        row-key="postId"
-        :columns="columns"
-        :datasource="datasource"
-        :show-overflow-tooltip="true"
-        v-model:selections="selections"
-        highlight-current-row
-        :export-config="{ fileName: pageConfig.fileName }"
-        :cache-key="pageConfig.cacheKey"
-        v-bind="$attrs"
-      >
-        <template v-for="(val, key) in slotArray" v-slot:[key]="{ row }">
-          <slot :name="key" :row="row"></slot>
-        </template>
-      </ele-pro-table>
-    </ele-card>
-
-    <slot></slot>
-  </ele-page>
+  <ele-card :body-style="{ paddingTop: '8px' }" flex-table>
+    <!-- 表格 -->
+    <ele-pro-table
+      ref="tableRef"
+      row-key="postId"
+      :columns="columns"
+      :datasource="datasource"
+      :show-overflow-tooltip="true"
+      v-model:selections="selections"
+      highlight-current-row
+      :export-config="{ fileName: pageConfig.fileName }"
+      :cache-key="pageConfig.cacheKey"
+      border
+      v-bind="$attrs"
+    >
+      <template v-for="(val, key) in slotArray" v-slot:[key]="{ row }">
+        <slot :name="key" :row="row"></slot>
+      </template>
+    </ele-pro-table>
+  </ele-card>
 </template>
 
 <script setup>
@@ -32,6 +27,7 @@
   import { EleMessage } from 'ele-admin-plus/es';
   import { useDictData } from '@/utils/use-dict-data';
   import { download, toFormData, checkDownloadRes } from '@/utils/common';
+
   const slotArray = useSlots();
 
   let props = defineProps({
@@ -55,7 +51,10 @@
   const selections = ref([]);
 
   async function queryPage(params) {
-    const res = await proxy.$http.get(props.pageUrl, { params });
+    let url = props.pageConfig.pageUrl || props.pageUrl;
+    // const res = await proxy.$http.post(url, params);
+
+    const res = await proxy.$http.get(url, { params });
     if (res.data.code === 200) {
       return res.data;
     }
@@ -138,11 +137,5 @@
     });
   };
 
-  //修改备注
-  const remarksRef = ref(null);
-  function handleRemarks(row) {
-    remarksRef.value?.handleOpen(row);
-  }
-
   defineExpose({ reload, exportData, operatBatch });
 </script>

+ 124 - 0
src/views/data/books/components/books-edit.vue

@@ -0,0 +1,124 @@
+<!-- 搜索表单 -->
+<template>
+  <ele-card :body-style="{ paddingBottom: '8px' }">
+    <ProSearch :columns="columns" v-model:form="form" ref="searchRef">
+      <el-col :span="6" style="min-width: 160px">
+        <el-button style="width: 80px" type="primary" plain @click="search"
+          >查询</el-button
+        >
+        <el-button style="width: 80px" type="info" @click="reset"
+          >重置</el-button
+        >
+      </el-col>
+    </ProSearch>
+  </ele-card>
+</template>
+
+<script setup>
+  import { reactive, ref, defineEmits } from 'vue';
+  import { useFormData } from '@/utils/use-form-data';
+  import ProSearch from '@/components/CommonPage/ProSearch.vue';
+
+  const emit = defineEmits(['search']);
+  const columns = reactive([
+    { tag: 'el-input', label: '发件人名称', prop: 'senderName', span: 4 },
+    { tag: 'el-input', label: '发件人电话', prop: 'senderPhone', span: 4 },
+    {
+      tag: 'el-input',
+      label: '发件人地址(仅查询7天内数据)',
+      prop: 'senderAddress',
+      span: 5
+    },
+    { tag: 'el-input', label: '用户名', prop: 'userName', span: 4 },
+    {
+      tag: 'el-input',
+      label: '搜索备注关键字',
+      prop: 'searchRemarks',
+      span: 4
+    },
+    {
+      tag: 'el-select',
+      label: '收货仓库',
+      prop: 'receivingWarehouse',
+      span: 3
+    },
+    { tag: 'el-select', label: '全部订单', prop: 'allOrders', span: 3 },
+    {
+      tag: 'el-select',
+      label: '物流公司',
+      prop: 'logisticsCompany',
+      span: 3
+    },
+    { tag: 'el-select', label: '全部方式', prop: 'allMethods', span: 3 },
+    {
+      tag: 'el-date-picker',
+      label: '建单时间(开始时间)',
+      prop: 'orderStartTime',
+      span: 3,
+      tagAttrs: {
+        valueFormat: 'YYYY-MM-DD'
+      }
+    },
+    {
+      tag: 'el-date-picker',
+      label: '建单时间(结束时间)',
+      prop: 'orderEndTime',
+      span: 4,
+      tagAttrs: {
+        valueFormat: 'YYYY-MM-DD'
+      }
+    },
+    {
+      tag: 'el-date-picker',
+      label: '建单时间(开始时间)',
+      prop: 'orderStartTime',
+      span: 4,
+      tagAttrs: {
+        valueFormat: 'YYYY-MM-DD'
+      }
+    },
+    {
+      tag: 'el-date-picker',
+      label: '建单时间(结束时间)',
+      prop: 'orderEndTime',
+      span: 4,
+      tagAttrs: {
+        valueFormat: 'YYYY-MM-DD'
+      }
+    },
+    {
+      tag: 'el-input',
+      label: '订单编号(多个以中文逗号、空格或换行分割)',
+      prop: 'orderNumber',
+      span: 6
+    },
+    {
+      tag: 'el-input',
+      label: '物流单号(多个以中文逗号、空格或换行分割)',
+      prop: 'logisticsNumber',
+      span: 6
+    }
+  ]);
+
+  const initKeys = {};
+  for (let i = 0; i < columns.length; i++) {
+    initKeys[columns[i].prop] = '';
+  }
+
+  /** 表单数据 */
+  const [form, resetFields] = useFormData({
+    ...initKeys
+  });
+
+  const searchRef = ref(null);
+  /** 搜索 */
+  const search = () => {
+    emit('search', { ...form });
+  };
+
+  /** 重置 */
+  const reset = () => {
+    resetFields();
+    search();
+  };
+</script>

+ 69 - 0
src/views/data/books/components/books-search.vue

@@ -0,0 +1,69 @@
+<!-- 搜索表单 -->
+<template>
+  <ele-card :body-style="{ paddingBottom: '8px' }">
+    <ProSearch :columns="columns" v-model:form="form" ref="searchRef">
+      <el-col :span="6" style="min-width: 160px">
+        <el-button style="width: 80px" type="primary" plain @click="search"
+          >查询</el-button
+        >
+        <el-button style="width: 80px" type="info" @click="reset"
+          >重置</el-button
+        >
+      </el-col>
+    </ProSearch>
+  </ele-card>
+</template>
+
+<script setup>
+  import { reactive, ref, defineEmits } from 'vue';
+  import { useFormData } from '@/utils/use-form-data';
+  import ProSearch from '@/components/CommonPage/ProSearch.vue';
+
+  const emit = defineEmits(['search']);
+  const columns = reactive([
+    { tag: 'el-input', label: '书名', prop: 'bookName', span: 4 },
+    { tag: 'el-input', label: '条码', prop: 'code', span: 4 },
+    {
+      tag: 'el-input',
+      label: '作者',
+      prop: 'senderAddress',
+      span: 4
+    },
+    { tag: 'el-input', label: '出版社', prop: 'userName', span: 4 },
+    {
+      tag: 'el-select',
+      label: '人工核实',
+      prop: 'receivingWarehouse',
+      span: 3
+    },
+    { tag: 'el-select', label: '是否套装', prop: 'allOrders', span: 3 },
+    {
+      tag: 'el-select',
+      label: '商品标记',
+      prop: 'logisticsCompany',
+      span: 3
+    }
+  ]);
+
+  const initKeys = {};
+  for (let i = 0; i < columns.length; i++) {
+    initKeys[columns[i].prop] = '';
+  }
+
+  /** 表单数据 */
+  const [form, resetFields] = useFormData({
+    ...initKeys
+  });
+
+  const searchRef = ref(null);
+  /** 搜索 */
+  const search = () => {
+    emit('search', { ...form });
+  };
+
+  /** 重置 */
+  const reset = () => {
+    resetFields();
+    search();
+  };
+</script>

+ 223 - 0
src/views/data/books/index.vue

@@ -0,0 +1,223 @@
+<template>
+  <ele-page flex-table>
+    <books-search @search="reload"></books-search>
+    
+    <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
+      <template #toolbar>
+        <el-button
+          type="primary"
+          plain
+          :icon="PlusOutlined"
+          v-permission="'data:books:add'"
+          @click="handleBatchDelete"
+        >
+          新增图书
+        </el-button>
+        <el-button
+          type="danger"
+          plain
+          :icon="DeleteOutlined"
+          v-permission="'data:books:batchDelete'"
+          @click="handleBatchDelete"
+        >
+          批量删除
+        </el-button>
+        <el-button
+          type="primary"
+          plain
+          v-permission="'data:books:import'"
+          @click="handleBatchDelete"
+        >
+          导入EXCEL
+        </el-button>
+        <el-button
+          type="success"
+          plain
+          v-permission="'data:books:export'"
+          @click="handleBatchDelete"
+          :icon="DownloadOutlined"
+        >
+          导出图书明细
+        </el-button>
+      </template>
+      <template #picture="{ row }">
+        <el-image
+          style="width: 80px; height: 100px"
+          fit="cover"
+          src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
+        />
+      </template>
+
+      <template #baseInfo="{ row }">
+        <div class="base-info flex flex-col items-start">
+          <div class="common-text">
+            <el-text>书     名:</el-text>
+            <el-text type="success">行政法与行政诉讼法(第六版)</el-text>
+          </div>
+          <div class="common-text">
+            <el-text>条    码:</el-text>
+            <el-text>9787301257975</el-text>
+          </div>
+          <div class="common-text">
+            <el-text>作    者:</el-text>
+            <el-text>姜明安</el-text>
+          </div>
+          <div class="common-text">
+            <el-text>出版社:</el-text>
+            <el-text>北京大学出版社</el-text>
+          </div>
+        </div>
+      </template>
+
+      <template #action="{ row }">
+        <div>
+          <el-button
+            type="primary"
+            link
+            v-permission="'data:books:changeLogs'"
+            @click="handleApplyForOrderRestore(row)"
+          >
+            变动记录
+          </el-button>
+          <el-button
+            type="primary"
+            link
+            v-permission="'data:books:update'"
+            @click="toOrderDetail(row)"
+          >
+            编辑
+          </el-button>
+        </div>
+      </template>
+    </common-table>
+  </ele-page>
+</template>
+
+<script setup>
+  import { ref, reactive } from 'vue';
+  import { ElMessageBox } from 'element-plus/es';
+  import { EleMessage } from 'ele-admin-plus/es';
+  import {
+    PlusOutlined,
+    DeleteOutlined,
+    DownloadOutlined
+  } from '@/components/icons';
+  import CommonTable from '@/components/CommonPage/CommonTable.vue';
+  import booksEdit from '@/views/data/books/components/books-edit.vue';
+  import booksSearch from '@/views/data/books/components/books-search.vue';
+  import { useDictData } from '@/utils/use-dict-data';
+  import { useRouter } from 'vue-router';
+
+  defineOptions({ name: 'recycleOrderCancelled' });
+
+  /** 表格列配置 */
+  const columns = ref([
+    {
+      type: 'selection',
+      columnKey: 'selection',
+      width: 50,
+      align: 'center',
+      fixed: 'left'
+    },
+    {
+      label: '图片',
+      prop: 'picture',
+      slot: 'picture',
+      align: 'center',
+      minWidth: 100
+    },
+    {
+      label: '基础信息',
+      prop: 'baseInfo',
+      slot: 'baseInfo',
+      align: 'center',
+      minWidth: 300
+    },
+    {
+      label: '定价',
+      prop: 'price',
+      formatter: (row) => '¥30',
+      align: 'center'
+    },
+    { label: '出版时间', prop: 'createTime', align: 'center', minWidth: 120 },
+    {
+      label: '分类标签',
+      prop: 'tag',
+      formatter: (row) => '教材',
+      align: 'center'
+    },
+    {
+      label: '人工核实',
+      prop: 'peo',
+      formatter: (row) => '是',
+      align: 'center'
+    },
+    {
+      columnKey: 'action',
+      label: '操作',
+      width: 180,
+      align: 'center',
+      slot: 'action'
+    }
+  ]);
+
+  let router = useRouter();
+  /** 页面组件实例 */
+  const pageRef = ref(null);
+
+  const pageConfig = reactive({
+    pageUrl: '',
+    exportUrl: '',
+    fileName: '图书基础数据',
+    cacheKey: 'books-base-data'
+  });
+  
+  //刷新表格
+  function reload() {
+    pageRef.value?.reload();
+  }
+
+  //批量删除
+  function handleBatchDelete() {
+    pageRef.value?.operatBatch({
+      title: '确认删除?',
+      url: '/recycleOrder/batchAudit'
+    });
+  }
+
+  //订单详情
+  function toOrderDetail(row) {
+    router.push({ path: '/recycleOrder/detail', query: { id: row.postId } });
+  }
+
+  //订单日志
+  const orderLogRef = ref(null);
+  function openOrderLog(row) {
+    orderLogRef.value?.handleOpen(row);
+  }
+
+  //用户绑定标签
+  const userTagRef = ref(null);
+  function openEditUserTag(row) {
+    userTagRef.value?.handleOpen(row);
+  }
+
+  function messageBoxConfirm({ message, url, row }) {
+    ElMessageBox.confirm(message, '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '关闭',
+      type: 'warning'
+    }).then(() => {
+      console.log(row, 'row');
+    });
+  }
+
+  //申请恢复订单
+  function handleApplyForOrderRestore(row) {
+    messageBoxConfirm({
+      message: '确认申请恢复订单?',
+      url: `/recycleOrder/applyForOrderRestore/${row.postId}`,
+      row
+    });
+  }
+</script>

+ 69 - 0
src/views/data/universities/components/universities-edit.vue

@@ -0,0 +1,69 @@
+<!-- 搜索表单 -->
+<template>
+  <ele-card :body-style="{ paddingBottom: '8px' }">
+    <ProSearch :columns="columns" v-model:form="form" ref="searchRef">
+      <el-col :span="6" style="min-width: 160px">
+        <el-button style="width: 80px" type="primary" plain @click="search"
+          >查询</el-button
+        >
+        <el-button style="width: 80px" type="info" @click="reset"
+          >重置</el-button
+        >
+      </el-col>
+    </ProSearch>
+  </ele-card>
+</template>
+
+<script setup>
+  import { reactive, ref, defineEmits } from 'vue';
+  import { useFormData } from '@/utils/use-form-data';
+  import ProSearch from '@/components/CommonPage/ProSearch.vue';
+
+  const emit = defineEmits(['search']);
+  const columns = reactive([
+    { tag: 'el-input', label: '书名', prop: 'bookName', span: 4 },
+    { tag: 'el-input', label: '条码', prop: 'code', span: 4 },
+    {
+      tag: 'el-input',
+      label: '作者',
+      prop: 'senderAddress',
+      span: 4
+    },
+    { tag: 'el-input', label: '出版社', prop: 'userName', span: 4 },
+    {
+      tag: 'el-select',
+      label: '人工核实',
+      prop: 'receivingWarehouse',
+      span: 3
+    },
+    { tag: 'el-select', label: '是否套装', prop: 'allOrders', span: 3 },
+    {
+      tag: 'el-select',
+      label: '商品标记',
+      prop: 'logisticsCompany',
+      span: 3
+    }
+  ]);
+
+  const initKeys = {};
+  for (let i = 0; i < columns.length; i++) {
+    initKeys[columns[i].prop] = '';
+  }
+
+  /** 表单数据 */
+  const [form, resetFields] = useFormData({
+    ...initKeys
+  });
+
+  const searchRef = ref(null);
+  /** 搜索 */
+  const search = () => {
+    emit('search', { ...form });
+  };
+
+  /** 重置 */
+  const reset = () => {
+    resetFields();
+    search();
+  };
+</script>

+ 63 - 0
src/views/data/universities/components/universities-search.vue

@@ -0,0 +1,63 @@
+<!-- 搜索表单 -->
+<template>
+  <ele-card :body-style="{ paddingBottom: '8px' }">
+    <ProSearch :columns="columns" v-model:form="form" ref="searchRef">
+      <el-col :span="6" style="min-width: 160px">
+        <el-button style="width: 80px" type="primary" plain @click="search"
+          >查询</el-button
+        >
+        <el-button style="width: 80px" type="info" @click="reset"
+          >重置</el-button
+        >
+      </el-col>
+    </ProSearch>
+  </ele-card>
+</template>
+
+<script setup>
+  import { reactive, ref, defineEmits } from 'vue';
+  import { useFormData } from '@/utils/use-form-data';
+  import ProSearch from '@/components/CommonPage/ProSearch.vue';
+
+  const emit = defineEmits(['search']);
+  const columns = reactive([
+    { tag: 'el-input', label: '学校名称', prop: 'bookName', span: 4 },
+    { tag: 'el-input', label: '省份', prop: 'code', span: 4 },
+    {
+      tag: 'el-input',
+      label: '所在市',
+      prop: 'senderAddress',
+      span: 4
+    },
+    { tag: 'el-input', label: '办学层次', prop: 'userName', span: 4 },
+    { tag: 'el-input', label: '主管部门', prop: 'userName', span: 4 },
+    {
+      tag: 'el-select',
+      label: '标记',
+      prop: 'receivingWarehouse',
+      span: 4
+    },
+  ]);
+
+  const initKeys = {};
+  for (let i = 0; i < columns.length; i++) {
+    initKeys[columns[i].prop] = '';
+  }
+
+  /** 表单数据 */
+  const [form, resetFields] = useFormData({
+    ...initKeys
+  });
+
+  const searchRef = ref(null);
+  /** 搜索 */
+  const search = () => {
+    emit('search', { ...form });
+  };
+
+  /** 重置 */
+  const reset = () => {
+    resetFields();
+    search();
+  };
+</script>

+ 220 - 0
src/views/data/universities/index.vue

@@ -0,0 +1,220 @@
+<template>
+  <ele-page flex-table>
+    <universities-search @search="reload"></universities-search>
+
+    <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
+      <template #toolbar>
+        <el-button
+          type="primary"
+          plain
+          :icon="PlusOutlined"
+          v-permission="'data:universities:add'"
+          @click="handleBatchDelete"
+        >
+          新增高校
+        </el-button>
+        <el-button
+          type="danger"
+          plain
+          :icon="DeleteOutlined"
+          v-permission="'data:universities:batchDelete'"
+          @click="handleBatchDelete()"
+        >
+          批量删除
+        </el-button>
+        <el-button
+          type="success"
+          plain
+          v-permission="'data:universities:export'"
+          @click="handleBatchDelete"
+          :icon="DownloadOutlined"
+        >
+          导出EXCEL
+        </el-button>
+      </template>
+      <template #picture="{ row }">
+        <el-image
+          style="width: 80px; height: 100px"
+          fit="cover"
+          src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
+        />
+      </template>
+
+      <template #baseInfo="{ row }">
+        <div class="base-info flex flex-col items-start">
+          <div class="common-text">
+            <el-text>书 名:</el-text>
+            <el-text type="success">行政法与行政诉讼法(第六版)</el-text>
+          </div>
+          <div class="common-text">
+            <el-text>条 码:</el-text>
+            <el-text>9787301257975</el-text>
+          </div>
+          <div class="common-text">
+            <el-text>作 者:</el-text>
+            <el-text>姜明安</el-text>
+          </div>
+          <div class="common-text">
+            <el-text>出版社:</el-text>
+            <el-text>北京大学出版社</el-text>
+          </div>
+        </div>
+      </template>
+
+      <template #action="{ row }">
+        <div>
+          <el-button
+            type="primary"
+            link
+            v-permission="'data:universities:update'"
+            @click="toOrderDetail(row)"
+          >
+            编辑
+          </el-button>
+          <el-button
+            type="danger"
+            link
+            v-permission="'data:universities:delete'"
+            @click="handleBatchDelete(row)"
+          >
+            删除
+          </el-button>
+          <el-button
+            type="warning"
+            link
+            v-permission="'data:universities:delete'"
+            @click="handleApplyForOrderRestore(row)"
+          >
+            标为正常/标为盗版
+          </el-button>
+        </div>
+      </template>
+    </common-table>
+  </ele-page>
+</template>
+
+<script setup>
+  import { ref, reactive } from 'vue';
+  import { ElMessageBox } from 'element-plus/es';
+  import { EleMessage } from 'ele-admin-plus/es';
+  import {
+    PlusOutlined,
+    DeleteOutlined,
+    DownloadOutlined
+  } from '@/components/icons';
+  import CommonTable from '@/components/CommonPage/CommonTable.vue';
+  import universitiesEdit from '@/views/data/universities/components/universities-edit.vue';
+  import universitiesSearch from '@/views/data/universities/components/universities-search.vue';
+  import { useDictData } from '@/utils/use-dict-data';
+  import { useRouter } from 'vue-router';
+
+  defineOptions({ name: 'recycleOrderCancelled' });
+
+  /** 表格列配置 */
+  const columns = ref([
+    {
+      type: 'selection',
+      columnKey: 'selection',
+      width: 50,
+      align: 'center',
+      fixed: 'left'
+    },
+    {
+      label: '学校名称',
+      prop: 'schoolName',
+      align: 'center',
+      minWidth: 100
+    },
+    {
+      label: '省份',
+      prop: 'province',
+      align: 'center'
+    },
+    {
+      label: '所在市',
+      prop: 'city',
+      align: 'center'
+    },
+    { label: '主管部门', prop: 'createTime', align: 'center' },
+    {
+      label: '办学层次',
+      prop: 'tag',
+      align: 'center'
+    },
+    {
+      label: '标记',
+      prop: 'peo',
+      formatter: (row) => '是',
+      align: 'center',
+      width:150
+    },
+    {
+      columnKey: 'action',
+      label: '操作',
+      width: 240,
+      align: 'center',
+      slot: 'action'
+    }
+  ]);
+
+  let router = useRouter();
+  /** 页面组件实例 */
+  const pageRef = ref(null);
+
+  const pageConfig = reactive({
+    // pageUrl: '/baseinfo/schoolInfo/list',
+    exportUrl: '',
+    fileName: '高校列表',
+    cacheKey: 'universitiesTable'
+  });
+
+  //刷新表格
+  function reload() {
+    pageRef.value?.reload();
+  }
+
+  //批量删除
+  function handleBatchDelete(row) {
+    pageRef.value?.operatBatch({
+      title: '确认删除?',
+      row,
+      url: '/recycleOrder/batchAudit'
+    });
+  }
+
+  //订单详情
+  function toOrderDetail(row) {
+    router.push({ path: '/recycleOrder/detail', query: { id: row.postId } });
+  }
+
+  //订单日志
+  const orderLogRef = ref(null);
+  function openOrderLog(row) {
+    orderLogRef.value?.handleOpen(row);
+  }
+
+  //用户绑定标签
+  const userTagRef = ref(null);
+  function openEditUserTag(row) {
+    userTagRef.value?.handleOpen(row);
+  }
+
+  function messageBoxConfirm({ message, url, row }) {
+    ElMessageBox.confirm(message, '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '关闭',
+      type: 'warning'
+    }).then(() => {
+      console.log(row, 'row');
+    });
+  }
+
+  //申请恢复订单
+  function handleApplyForOrderRestore(row) {
+    messageBoxConfirm({
+      message: '确认申请恢复订单?',
+      url: `/recycleOrder/applyForOrderRestore/${row.postId}`,
+      row
+    });
+  }
+</script>