Procházet zdrojové kódy

修改图书类型管理也看

ylong před 7 měsíci
rodič
revize
bf0ffbcf38

+ 2 - 1
src/components/CommonPage/CommonTable.vue

@@ -144,7 +144,8 @@
       plain: true
     });
     tableRef.value?.fetch?.(({ where, orders }) => {
-      exportRecord({ ...where, ...orders }, method)
+      let initKeys = props.pageConfig.params || {};
+      exportRecord({ ...where, ...orders,...initKeys }, method)
         .then((res) => {
           if (res.data.code === 200) {
             EleMessage.success('操作成功,请前往导出记录下载');

+ 1 - 0
src/views/marketing/dialog/index.vue

@@ -51,6 +51,7 @@
         <div>
           <el-text v-if="row.frequency == 1">首次访问时出现,之后不出现</el-text>
           <el-text v-if="row.frequency == 2">间隔{{row.frequencyTime}}小时后再次出现</el-text>
+          <el-text v-if="row.frequency == 3">常驻</el-text>
         </div>
       </template>
 

+ 65 - 0
src/views/recycle/bookTypes/components/modify-type.vue

@@ -0,0 +1,65 @@
+<template>
+    <el-dialog
+        v-model="visible"
+        title="修改图书类型"
+        width="400px"
+        @close="reset"
+    >
+        <el-form :model="form" label-width="80px">
+            <el-form-item label="图书类型">
+                <el-select v-model="form.operateType" placeholder="请选择类型">
+                    <el-option label="教材库" :value="1" />
+                    <el-option label="社科库" :value="2" />
+                    <el-option label="中小学" :value="3" />
+                </el-select>
+            </el-form-item>
+        </el-form>
+        <template #footer>
+            <el-button @click="visible = false">取消</el-button>
+            <el-button type="primary" @click="handleSave" :loading="loading"
+                >保存</el-button
+            >
+        </template>
+    </el-dialog>
+</template>
+
+<script setup>
+    import { ref,getCurrentInstance } from 'vue';
+    import { ElMessage } from 'element-plus';
+    const { proxy } = getCurrentInstance();
+    const visible = ref(false);
+    const loading = ref(false);
+    const form = ref({
+        isbn: '',
+        operateType: 1
+    });
+    const emit = defineEmits(['success']);
+
+    function open({ isbn, bookTag }) {
+        form.value.isbn = isbn;
+        form.value.operateType = Number(bookTag);
+        visible.value = true;
+    }
+    function reset() {
+        loading.value = false;
+    }
+    async function handleSave() {
+        loading.value = true;
+        try {
+            let { data } = await proxy.$http.post('/book/bookInfo/setBookTag', form.value);
+            if (data.code === 200) {
+                ElMessage.success('修改成功');
+                visible.value = false;
+                emit('success');
+            } else {
+                ElMessage.error(data.msg);
+            }
+        } catch (e) {
+            ElMessage.error('修改失败');
+        } finally {
+            loading.value = false;
+        }
+    }
+
+    defineExpose({ open });
+</script>

+ 56 - 0
src/views/recycle/bookTypes/components/opeate-log.vue

@@ -0,0 +1,56 @@
+<!-- 操作日志弹窗 -->
+<template>
+  <ele-modal :width="800" v-model="visible" title="操作日志">
+    <ele-data-table
+      ref="tableRef"
+      class="flex-1"
+      row-key="id"
+      :columns="columns"
+      :data="dataList"
+    ></ele-data-table>
+
+    <template #footer>
+      <el-button @click="handleCancel">关闭</el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script setup>
+import { ref, reactive, nextTick } from 'vue';
+import request from '@/utils/request';
+
+const visible = defineModel({ type: Boolean });
+const dataList = ref([]);
+const tableRef = ref();
+
+const handleCancel = () => {
+  visible.value = false;
+};
+
+const handleOpen = (row) => {
+  visible.value = true;
+  nextTick(() => {
+    fetchLog(row.isbn);
+  });
+};
+
+function fetchLog(isbn) {
+  request.get('/book/bookInfo/getBookTagChangeLog', { params: { isbn } }).then((res) => {
+    if (res.data && res.data.code === 0) {
+      dataList.value = res.data.data || [];
+    } else {
+      dataList.value = [];
+    }
+  });
+}
+
+const columns = reactive([
+  { label: '操作员', prop: 'sysUserName', width: 120 },
+  { label: '操作内容', prop: 'content' },
+  { label: '操作时间', prop: 'createTime', width: 180 }
+]);
+
+defineExpose({
+  handleOpen
+});
+</script>

+ 280 - 199
src/views/recycle/bookTypes/index.vue

@@ -1,209 +1,290 @@
 <template>
-  <ele-page flex-table>
-    <book-search @search="reload"></book-search>
-
-    <common-table
-      ref="pageRef"
-      :pageConfig="pageConfig"
-      :columns="columns"
-      :tools="false"
-      @sort-change="handleSortChange"
-    >
-      <template #toolbar>
-        <el-radio-group @change="handleStatusChange" v-model="bookTag">
-          <el-radio-button label="全部" value="-1" />
-          <el-radio-button label="教材库" value="1" />
-          <el-radio-button label="社科库" value="2" />
-        </el-radio-group>
-      </template>
-
-      <template #cover="{ row }">
-        <el-image
-          style="width: 90px; height: 120px; border-radius: 4px"
-          fit="cover"
-          :src="row.cover"
-        />
-      </template>
-      <template #baseInfo="{ row }">
-        <book-info
-          :row="row"
-          @edit="handleUpdateBook"
-          :showFormat="false"
-          :showTag="false"
-        ></book-info>
-      </template>
-      <template #stock="{ row }">
-        <book-stock :row="row"></book-stock>
-      </template>
-
-      <template #action="{ row }">
-        <el-button
-          type="primary"
-          link
-          v-permission="'recycle:bookTypes:modifyType'"
-          @click="handleModifyType(row)"
+    <ele-page flex-table>
+        <book-search @search="reload"></book-search>
+
+        <common-table
+            ref="pageRef"
+            :pageConfig="pageConfig"
+            :columns="columns"
+            :tools="false"
+            @sort-change="handleSortChange"
         >
-          [修改类型]
-        </el-button>
-      </template>
-    </common-table>
+            <template #toolbar>
+                <el-radio-group @change="handleStatusChange" v-model="bookTag">
+                    <!-- 1教材 2社科 3中小学 4未分类 5全部 6关键字库 -->
+                    <el-radio-button label="全部" value="5" />
+                    <el-radio-button label="教材库" value="1" />
+                    <el-radio-button label="社科库" value="2" />
+                    <el-radio-button label="中小学" value="3" />
+                    <el-radio-button label="未分类" value="4" />
+                    <el-radio-button label="关键字库" value="6" />
+                </el-radio-group>
+
+                <el-button
+                    type="primary"
+                    class="ml-4"
+                    v-permission="'recycle:bookTypes:exportExcel'"
+                    @click="handleExportExcel"
+                    >导出Excel</el-button
+                >
+            </template>
+
+            <template #cover="{ row }">
+                <el-image
+                    style="width: 90px; height: 120px; border-radius: 4px"
+                    fit="cover"
+                    :src="row.cover"
+                />
+            </template>
+            <template #baseInfo="{ row }">
+                <book-info
+                    :row="row"
+                    @edit="handleUpdateBook"
+                    :showFormat="false"
+                    :showTag="false"
+                ></book-info>
+            </template>
+            <template #stock="{ row }">
+                <book-stock :row="row"></book-stock>
+            </template>
+
+            <template #action="{ row }">
+                <el-button
+                    type="danger"
+                    link
+                    v-if="bookTag != 4 && bookTag != 6"
+                    v-permission="'recycle:bookTypes:delete'"
+                    @click="handleDelete(row)"
+                >
+                    [移除]
+                </el-button>
+                <el-button
+                    type="warning"
+                    link
+                    v-if="bookTag != 4 && bookTag != 6"
+                    v-permission="'recycle:bookTypes:modifyType'"
+                    @click="handleModifyType(row)"
+                >
+                    [修改类型]
+                </el-button>
+                <el-button
+                    type="primary"
+                    link
+                    v-if="bookTag != 4 && bookTag != 6"
+                    v-permission="'recycle:bookTypes:opeateLog'"
+                    @click="handleOpenLog(row)"
+                >
+                    [操作日志]
+                </el-button>
 
-    <books-edit ref="editRef"></books-edit>
-  </ele-page>
+                <el-button
+                    type="success"
+                    link
+                    v-if="bookTag == 4 || bookTag == 6"
+                    v-permission="'recycle:bookTypes:add'"
+                    @click="setBookTag(row, '确认加入教材库?', 1)"
+                >
+                    [加教材库]
+                </el-button>
+                <el-button
+                    type="warning"
+                    link
+                    v-if="bookTag == 4 || bookTag == 6"
+                    v-permission="'recycle:bookTypes:add'"
+                    @click="setBookTag(row, '确认加入社科库?', 2)"
+                >
+                    [加社科库]
+                </el-button>
+                <el-button
+                    type="danger"
+                    link
+                    v-if="bookTag == 4 || bookTag == 6"
+                    v-permission="'recycle:bookTypes:add'"
+                    @click="setBookTag(row, '确认加入中小学库?', 3)"
+                >
+                    [加中小学库]
+                </el-button>
+            </template>
+        </common-table>
+
+        <books-edit ref="editRef"></books-edit>
+        <modify-type ref="modifyTypeRef" @success="reload" />
+        <opeate-log ref="logRef" />
+    </ele-page>
 </template>
 
 <script setup>
-  import { ref, reactive, getCurrentInstance } from 'vue';
-  import CommonTable from '@/components/CommonPage/CommonTable.vue';
-  import booksEdit from '@/views/data/books/components/books-edit.vue';
-  import bookSearch from '@/views/recycle/components/book-search.vue';
-  import bookInfo from '@/views/recycle/components/book-info.vue';
-  import bookStock from '@/views/recycle/components/book-stock.vue';
-  const { proxy } = getCurrentInstance();
-  defineOptions({ name: 'recycleBooklist' });
-
-  const bookTag = ref('-1');
-  function handleStatusChange(value) {
-    bookTag.value = value;
-    pageConfig.params.bookTag = value;
-    pageRef.value.reload();
-  }
-
-  /** 表格列配置 */
-  const columns = ref([
-    {
-      type: 'selection',
-      columnKey: 'selection',
-      width: 50,
-      align: 'center',
-      fixed: 'left'
-    },
-    {
-      label: '图片',
-      prop: 'cover',
-      width: 120,
-      slot: 'cover'
-    },
-    {
-      label: '信息',
-      prop: 'baseInfo',
-      width: 500,
-      slot: 'baseInfo'
-    },
-    {
-      label: '回收折扣',
-      minWidth: 100,
-      prop: 'recycleDiscount',
-      sortable: true,
-      columnKey: '4'
-    },
-    {
-      label: '回收价格',
-      prop: 'recyclePrice',
-      sortable: true,
-      columnKey: '5',
-      minWidth: 100
-    },
-    {
-      label: '最大回收量',
-      minWidth: 120,
-      prop: 'recycleMax',
-      sortable: true,
-      columnKey: '6'
-    },
-    {
-      label: '总回收数量',
-      minWidth: 120,
-      prop: 'recycleTotalNum',
-      sortable: true,
-      columnKey: '2'
-    },
-    {
-      label: '当前剩余回收量',
-      minWidth: 140,
-      prop: 'restRecycleNum',
-      sortable: true,
-      columnKey: '7'
-    },
-    {
-      label: '所属类型',
-      prop: 'bookTagName',
-      width: 120,
-      formatter: (row) =>
-        row.bookTag == 2 ? '社科库' : row.bookTag == 1 ? '教材库' : '--'
-    },
-    {
-      label: '售价',
-      prop: 'salePrice',
-      width: 120,
-      formatter: (row) => row.salePrice || 0
-    },
-    {
-      label: '销量',
-      prop: 'salesNum',
-      sortable: true,
-      columnKey: '8'
-    },
-    {
-      columnKey: 'action',
-      label: '操作',
-      width: 150,
-      slot: 'action',
-      fixed: 'right'
-    }
-  ]);
-
-  /** 页面组件实例 */
-  const pageRef = ref(null);
-
-  const pageConfig = reactive({
-    pageUrl: '/book/bookRecycleInfo/pageList',
-    exportUrl: '',
-    fileName: '回收书单管理',
-    cacheKey: 'recycleBooklistTable',
-    rowKey: 'isbn',
-    params: {
-      bookTag: bookTag.value
+    import { ref, reactive, getCurrentInstance } from 'vue';
+    import CommonTable from '@/components/CommonPage/CommonTable.vue';
+    import booksEdit from '@/views/data/books/components/books-edit.vue';
+    import bookSearch from '@/views/recycle/components/book-search.vue';
+    import bookInfo from '@/views/recycle/components/book-info.vue';
+    import bookStock from '@/views/recycle/components/book-stock.vue';
+    import ModifyType from './components/modify-type.vue';
+    import OpeateLog from './components/opeate-log.vue';
+    const { proxy } = getCurrentInstance();
+    defineOptions({ name: 'recycleBooklist' });
+
+    const bookTag = ref('5');
+    function handleStatusChange(value) {
+        bookTag.value = value;
+        pageConfig.params.bookTag = value;
+        pageRef.value.reload();
     }
-  });
 
-  function handleSortChange({ column, order }) {
-    // 1 扫描次数 2总回收量 3最后一次扫描时间
-    reload({
-      orderType: column.columnKey,
-      orderWay: order === 'ascending' ? 'asc' : 'desc'
-    });
-  }
-
-  //刷新表格
-  function reload(where) {
-    pageRef.value?.reload(where);
-  }
-
-  //编辑
-  const editRef = ref(null);
-  function handleUpdateBook(row) {
-    let params = {
-      id: row.bookId
-    };
-    editRef.value?.handleOpen(params);
-  }
-
-  /**
-   * 类型操作(社科库/教材库)
-   * @param {Number} type - 类型:1社科库,2教材库
-   */
-  function handleModifyType(row) {
-    const isbnList = [row.isbn];
-    const url =
-      row.bookTag == 1
-        ? '/book/bookRecycleInfo/changeBookTag2'
-        : '/book/bookRecycleInfo/changeBookTag1';
-    const title = row.bookTag == 1 ? '确认加社科库?' : '确认加教材库?';
-
-    pageRef.value?.messageBoxConfirm({
-      message: title,
-      fetch: () => proxy.$http.post(url, { isbnList })
+    /** 表格列配置 */
+    const columns = ref([
+        {
+            type: 'selection',
+            columnKey: 'selection',
+            width: 50,
+            align: 'center',
+            fixed: 'left'
+        },
+        {
+            label: '图片',
+            prop: 'cover',
+            width: 120,
+            slot: 'cover'
+        },
+        {
+            label: '信息',
+            prop: 'baseInfo',
+            width: 500,
+            slot: 'baseInfo'
+        },
+        {
+            label: '回收折扣',
+            minWidth: 100,
+            prop: 'recycleDiscount',
+            align: 'center'
+        },
+        {
+            label: '回收价格',
+            prop: 'recyclePrice',
+            minWidth: 100,
+            align: 'center'
+        },
+        {
+            label: '最大回收量',
+            minWidth: 120,
+            prop: 'recycleMax',
+            align: 'center'
+        },
+        {
+            label: '总回收数量',
+            minWidth: 120,
+            prop: 'recycleTotalNum',
+            align: 'center'
+        },
+        {
+            label: '当前剩余回收量',
+            minWidth: 140,
+            prop: 'restRecycleNum',
+            align: 'center'
+        },
+        {
+            label: '所属类型',
+            prop: 'bookTagName',
+            width: 120,
+            align: 'center'
+        },
+        {
+            label: '售价',
+            prop: 'salePrice',
+            width: 120,
+            align: 'center',
+            formatter: (row) => '¥ ' + (row.salePrice || 0)
+        },
+        {
+            label: '销量',
+            prop: 'salesNum',
+            align: 'center'
+        },
+        {
+            columnKey: 'action',
+            label: '操作',
+            width: 120,
+            slot: 'action',
+            fixed: 'right'
+        }
+    ]);
+
+    /** 页面组件实例 */
+    const pageRef = ref(null);
+
+    const pageConfig = reactive({
+        pageUrl: '/book/bookInfo/bookTagList',
+        exportUrl: '/book/bookInfo/exportBookTagList',
+        fileName: '图书类型管理',
+        cacheKey: 'bookTypesTable',
+        rowKey: 'isbn',
+        params: {
+            bookTag: bookTag.value
+        }
     });
-  }
+
+    function handleSortChange({ column, order }) {
+        // 1 扫描次数 2总回收量 3最后一次扫描时间
+        reload({
+            orderType: column.columnKey,
+            orderWay: order === 'ascending' ? 'asc' : 'desc'
+        });
+    }
+
+    //导出excel
+    function handleExportExcel() {
+        pageRef.value?.exportData('图书类型管理');
+    }
+
+    //刷新表格
+    function reload(where) {
+        pageRef.value?.reload(where);
+    }
+
+    //编辑
+    const editRef = ref(null);
+    function handleUpdateBook(row) {
+        let params = {
+            id: row.bookId
+        };
+        editRef.value?.handleOpen(params);
+    }
+
+    /**
+     * 类型操作(社科库/教材库)
+     * @param {Number} type - 类型:1社科库,2教材库 3 中小学
+     */
+    const modifyTypeRef = ref(null);
+    function handleModifyType(row) {
+        modifyTypeRef.value.open({ isbn: row.isbn, bookTag: row.bookTag });
+    }
+
+    /**
+     * 操作日志
+     */
+    const logRef = ref(null);
+    function handleOpenLog(row) {
+        logRef.value?.handleOpen(row);
+    }
+
+    //封装一个方法,删除
+    function setBookTag(row, message, operateType) {
+        pageRef.value?.messageBoxConfirm({
+            message: message,
+            fetch: () =>
+                proxy.$http.post('/book/bookInfo/setBookTag', {
+                    isbn: row.isbn,
+                    // 1加入教材库 2加入社科库 3加入中小学库 4移除
+                    operateType: operateType
+                })
+        });
+    }
+
+    /**
+     * 移除
+     */
+    function handleDelete(row) {
+        setBookTag(row, '确认移除?', 4);
+    }
 </script>

+ 98 - 97
src/views/recycle/components/book-info.vue

@@ -1,114 +1,115 @@
 <template>
-  <div class="recycle-order-number flex flex-col items-start">
-    <div class="common-text">
-      <el-text>书名:</el-text>
-      <el-text type="primary" class="cursor-pointer" @click="handleEdit">{{
-        row.bookName
-      }}</el-text>
-    </div>
-
-    <div class="flex w-full">
-      <div class="flex flex-col" style="flex: 2">
-        <div class="common-text">
-          <el-text>作 者:</el-text>
-          <el-text>{{ row.author || '-' }} </el-text>
-        </div>
-        <div class="common-text">
-          <el-text>ISBN:</el-text>
-          <el-text>{{ row.isbn }}</el-text>
-        </div>
-        <div class="common-text" v-if="showFormat">
-          <el-text>分类:</el-text>
-          <el-text>{{ row.cateName || '-' }}</el-text>
-        </div>
-        <div class="common-text">
-          <el-text>出版社:</el-text>
-          <el-text>{{ row.publish || '-' }}</el-text>
-        </div>
-        <div class="common-text">
-          <el-text>出版时间:</el-text>
-          <el-text>{{ publishDate }} </el-text>
-        </div>
-      </div>
-      <div class="flex flex-col" style="flex: 1.5">
+    <div class="recycle-order-number flex flex-col items-start">
         <div class="common-text">
-          <el-text>定价:</el-text>
-          <el-text>¥ {{ row.price }}</el-text>
-        </div>
-        <div class="common-text" v-if="!showFormat">
-          <el-text>开本尺寸:</el-text>
-          <el-text>{{ row.bookFormat }}</el-text>
-        </div>
-        <div class="common-text" v-else>
-          <el-text>回收折扣:</el-text>
-          <el-text>{{ row.recycleDiscount }}折</el-text>
+            <el-text>书名:</el-text>
+            <el-text
+                type="primary"
+                class="cursor-pointer"
+                @click="handleEdit"
+                >{{ row.bookName }}</el-text
+            >
         </div>
-        <div class="common-text">
-          <el-text>回收状态:</el-text>
 
-          <!-- 1 正在回收 2 收满暂停回收 3 手动暂停回收 -->
-          <el-text>{{
-            row.recycleStatus == 1
-              ? '正在回收'
-              : row.recycleStatus == 2
-                ? '收满暂停回收'
-                : row.recycleStatus == 3
-                  ? '手动暂停回收'
-                  : '-'
-          }}</el-text>
-        </div>
-        <div class="common-text" v-if="showTag">
-          <el-text>所属类型:</el-text>
-          <el-text>{{
-            row.bookTag == 1 ? '教材库' : row.bookTag == 2 ? '社科库' : '-'
-          }}</el-text>
-        </div>
-        <div class="common-text">
-          <el-text
-            >(已回收数量:{{ row.recycleNum || 0 }} 当前库存:{{
-              row.stockNum || 0
-            }})</el-text
-          >
+        <div class="flex w-full">
+            <div class="flex flex-col" style="flex: 2">
+                <div class="common-text">
+                    <el-text>作 者:</el-text>
+                    <el-text>{{ row.author || '-' }} </el-text>
+                </div>
+                <div class="common-text">
+                    <el-text>ISBN:</el-text>
+                    <el-text>{{ row.isbn }}</el-text>
+                </div>
+                <div class="common-text" v-if="showFormat">
+                    <el-text>分类:</el-text>
+                    <el-text>{{ row.cateName || '-' }}</el-text>
+                </div>
+                <div class="common-text">
+                    <el-text>出版社:</el-text>
+                    <el-text>{{ row.publish || '-' }}</el-text>
+                </div>
+                <div class="common-text">
+                    <el-text>出版时间:</el-text>
+                    <el-text>{{ publishDate }} </el-text>
+                </div>
+            </div>
+            <div class="flex flex-col" style="flex: 1.8">
+                <div class="common-text">
+                    <el-text>定价:</el-text>
+                    <el-text>¥ {{ row.price }}</el-text>
+                </div>
+                <div class="common-text" v-if="!showFormat">
+                    <el-text>开本尺寸:</el-text>
+                    <el-text>{{ row.bookFormat }}</el-text>
+                </div>
+                <div class="common-text" v-else>
+                    <el-text>回收折扣:</el-text>
+                    <el-text>{{ row.recycleDiscount }}折</el-text>
+                </div>
+                <div class="common-text">
+                    <el-text>回收状态:</el-text>
+
+                    <!-- 1 正在回收 2 收满暂停回收 3 手动暂停回收 -->
+                    <el-text>{{
+                        row.recycleStatus == 1
+                            ? '正在回收'
+                            : row.recycleStatus == 2
+                              ? '收满暂停回收'
+                              : row.recycleStatus == 3
+                                ? '手动暂停回收'
+                                : '-'
+                    }}</el-text>
+                </div>
+                <div class="common-text" v-if="showTag">
+                    <el-text>所属类型:</el-text>
+                    <el-text>{{ row.bookTagName }}</el-text>
+                </div>
+                <div class="common-text">
+                    <el-text
+                        >(已回收数量:{{ row.recycleNum || 0 }} 当前库存:{{
+                            row.stockNum || 0
+                        }})</el-text
+                    >
+                </div>
+            </div>
         </div>
-      </div>
     </div>
-  </div>
 </template>
 
 <script setup>
-  import { dayjs } from 'element-plus';
-  import { computed } from 'vue';
+    import { dayjs } from 'element-plus';
+    import { computed } from 'vue';
 
-  const props = defineProps({
-    row: {
-      type: Object,
-      default: () => {}
-    },
-    showFormat: {
-      type: Boolean,
-      default: true
-    },
-    showTag: {
-      type: Boolean,
-      default: true
-    }
-  });
+    const props = defineProps({
+        row: {
+            type: Object,
+            default: () => {}
+        },
+        showFormat: {
+            type: Boolean,
+            default: true
+        },
+        showTag: {
+            type: Boolean,
+            default: true
+        }
+    });
 
-  const emit = defineEmits(['edit']);
+    const emit = defineEmits(['edit']);
 
-  const publishDate = computed(() => {
-    return props.row.pubDate
-      ? dayjs(props.row.pubDate).format('YYYY-MM-DD')
-      : '-';
-  });
+    const publishDate = computed(() => {
+        return props.row.pubDate
+            ? dayjs(props.row.pubDate).format('YYYY-MM-DD')
+            : '-';
+    });
 
-  const handleEdit = () => {
-    emit('edit', props.row);
-  };
+    const handleEdit = () => {
+        emit('edit', props.row);
+    };
 </script>
 
 <style scoped>
-  .cursor-pointer {
-    cursor: pointer;
-  }
+    .cursor-pointer {
+        cursor: pointer;
+    }
 </style>

+ 19 - 13
src/views/recycle/components/book-other-info.vue

@@ -14,27 +14,33 @@
         </div>
         <div class="common-text">
             <el-text>回收状态:</el-text>
-            <el-text>{{ row.recyleStatus == 1 ? '正在回收' : '暂停回收' }}</el-text>
+            <el-text>{{
+                row.recyleStatus == 1 ? '正在回收' : '暂停回收'
+            }}</el-text>
         </div>
         <div class="common-text">
             <el-text>所属类型:</el-text>
-            <el-text>{{ row.bookTag == 1 ? '教材库' : row.bookTag == 2 ? '社科库' : '-' }}</el-text>
+            <el-text>{{ row.bookTagName }}</el-text>
         </div>
         <div class="common-text">
-            <el-text>(已回收数量:{{ row.recyleNum || 0 }} 当前库存:{{ row.stockNum || 0 }})</el-text>
+            <el-text
+                >(已回收数量:{{ row.recyleNum || 0 }} 当前库存:{{
+                    row.stockNum || 0
+                }})</el-text
+            >
         </div>
     </div>
 </template>
 
 <script setup>
-const props = defineProps({
-    row: {
-        type: Object,
-        default: () => { }
-    },
-    showFormat: {
-        type: Boolean,
-        default: false
-    }
-});
+    const props = defineProps({
+        row: {
+            type: Object,
+            default: () => {}
+        },
+        showFormat: {
+            type: Boolean,
+            default: false
+        }
+    });
 </script>

+ 102 - 101
src/views/recycle/components/book-stat-info.vue

@@ -1,118 +1,119 @@
 <template>
-  <div class="recycle-order-number flex flex-col items-start">
-    <div class="common-text">
-      <el-text>书名:</el-text>
-      <el-text type="primary" class="cursor-pointer" @click="handleEdit">{{
-        row.bookName
-      }}</el-text>
-    </div>
-
-    <div class="flex w-full">
-      <div class="flex flex-col" style="flex: 2">
-        <div class="common-text">
-          <el-text>作 者:</el-text>
-          <el-text>{{ row.author || '-' }} </el-text>
-        </div>
+    <div class="recycle-order-number flex flex-col items-start">
         <div class="common-text">
-          <el-text>ISBN:</el-text>
-          <el-text>{{ row.isbn }}</el-text>
+            <el-text>书名:</el-text>
+            <el-text
+                type="primary"
+                class="cursor-pointer"
+                @click="handleEdit"
+                >{{ row.bookName }}</el-text
+            >
         </div>
 
-        <div class="common-text">
-          <el-text>出版社:</el-text>
-          <el-text>{{ row.publish || '-' }}</el-text>
-        </div>
-        <div class="common-text">
-          <el-text>出版时间:</el-text>
-          <el-text>{{ publishDate }} </el-text>
-        </div>
-        <div class="common-text" v-if="showFormat">
-          <el-text>所属类型:</el-text>
-          <el-text>{{
-            row.bookTagName ? row.bookTagName + '库' : '-'
-          }}</el-text>
-        </div>
-        <div class="common-text" v-if="showFormat">
-          <el-text>回收状态:</el-text>
-          <dict-data
-            code="recycle_status"
-            :model-value="row.recycleStatus"
-            type="text"
-          ></dict-data>
-        </div>
-      </div>
-      <div class="flex flex-col" style="flex: 1.5">
-        <div class="common-text">
-          <el-text>定价:</el-text>
-          <el-text>¥ {{ row.price }}</el-text>
-        </div>
-        <div class="common-text" v-if="!showFormat">
-          <el-text>开本尺寸:</el-text>
-          <el-text>{{ row.bookFormat }}</el-text>
-        </div>
-        <div class="common-text" v-else>
-          <el-text>回收折扣:</el-text>
-          <el-text>{{ row.recycleDiscount }}折</el-text>
-          <el-text
-            v-if="row.sugDiscountStr"
-            style="color: #f56c6c; margin-left: 10px"
-            >{{ row.sugDiscountStr }}</el-text
-          >
-        </div>
-        <div class="common-text">
-          <el-text>回收价格:</el-text>
-          <el-text>¥ {{ row.recyclePrice }}</el-text>
-        </div>
-        <div class="common-text">
-          <el-text>销售价格:</el-text>
-          <el-text>¥ {{ row.productPrice || 0 }}</el-text>
-        </div>
-        <div class="common-text">
-          <el-text
-            >(已回收数量:{{ row.recycleNum || 0 }} 当前库存:{{
-              row.stockNum || 0
-            }})</el-text
-          >
+        <div class="flex w-full">
+            <div class="flex flex-col" style="flex: 2">
+                <div class="common-text">
+                    <el-text>作 者:</el-text>
+                    <el-text>{{ row.author || '-' }} </el-text>
+                </div>
+                <div class="common-text">
+                    <el-text>ISBN:</el-text>
+                    <el-text>{{ row.isbn }}</el-text>
+                </div>
+
+                <div class="common-text">
+                    <el-text>出版社:</el-text>
+                    <el-text>{{ row.publish || '-' }}</el-text>
+                </div>
+                <div class="common-text">
+                    <el-text>出版时间:</el-text>
+                    <el-text>{{ publishDate }} </el-text>
+                </div>
+                <div class="common-text" v-if="showFormat">
+                    <el-text>所属类型:</el-text>
+                    <el-text>{{ row.bookTagName || '-' }}</el-text>
+                </div>
+                <div class="common-text" v-if="showFormat">
+                    <el-text>回收状态:</el-text>
+                    <dict-data
+                        code="recycle_status"
+                        :model-value="row.recycleStatus"
+                        type="text"
+                    ></dict-data>
+                </div>
+            </div>
+            <div class="flex flex-col" style="flex: 1.5">
+                <div class="common-text">
+                    <el-text>定价:</el-text>
+                    <el-text>¥ {{ row.price }}</el-text>
+                </div>
+                <div class="common-text" v-if="!showFormat">
+                    <el-text>开本尺寸:</el-text>
+                    <el-text>{{ row.bookFormat }}</el-text>
+                </div>
+                <div class="common-text" v-else>
+                    <el-text>回收折扣:</el-text>
+                    <el-text>{{ row.recycleDiscount }}折</el-text>
+                    <el-text
+                        v-if="row.sugDiscountStr"
+                        style="color: #f56c6c; margin-left: 10px"
+                        >{{ row.sugDiscountStr }}</el-text
+                    >
+                </div>
+                <div class="common-text">
+                    <el-text>回收价格:</el-text>
+                    <el-text>¥ {{ row.recyclePrice }}</el-text>
+                </div>
+                <div class="common-text">
+                    <el-text>销售价格:</el-text>
+                    <el-text>¥ {{ row.productPrice || 0 }}</el-text>
+                </div>
+                <div class="common-text">
+                    <el-text
+                        >(已回收数量:{{ row.recycleNum || 0 }} 当前库存:{{
+                            row.stockNum || 0
+                        }})</el-text
+                    >
+                </div>
+            </div>
         </div>
-      </div>
     </div>
-  </div>
 </template>
 
 <script setup>
-  import { dayjs } from 'element-plus';
-  import { computed } from 'vue';
+    import { dayjs } from 'element-plus';
+    import { computed } from 'vue';
 
-  const props = defineProps({
-    row: {
-      type: Object,
-      default: () => {}
-    },
-    showFormat: {
-      type: Boolean,
-      default: true
-    },
-    showTag: {
-      type: Boolean,
-      default: true
-    }
-  });
+    const props = defineProps({
+        row: {
+            type: Object,
+            default: () => {}
+        },
+        showFormat: {
+            type: Boolean,
+            default: true
+        },
+        showTag: {
+            type: Boolean,
+            default: true
+        }
+    });
 
-  const emit = defineEmits(['edit']);
+    const emit = defineEmits(['edit']);
 
-  const publishDate = computed(() => {
-    return props.row.pubDate
-      ? dayjs(props.row.pubDate).format('YYYY-MM-DD')
-      : '-';
-  });
+    const publishDate = computed(() => {
+        return props.row.pubDate
+            ? dayjs(props.row.pubDate).format('YYYY-MM-DD')
+            : '-';
+    });
 
-  const handleEdit = () => {
-    emit('edit', props.row);
-  };
+    const handleEdit = () => {
+        emit('edit', props.row);
+    };
 </script>
 
 <style scoped>
-  .cursor-pointer {
-    cursor: pointer;
-  }
+    .cursor-pointer {
+        cursor: pointer;
+    }
 </style>