|
|
@@ -7,76 +7,14 @@
|
|
|
:pageConfig="pageConfig"
|
|
|
:columns="columns"
|
|
|
:tools="false"
|
|
|
+ @sort-change="handleSortChange"
|
|
|
>
|
|
|
<template #toolbar>
|
|
|
- <el-radio-group @change="handleStatusChange" v-model="useStatus">
|
|
|
+ <el-radio-group @change="handleStatusChange" v-model="bookTag">
|
|
|
<el-radio-button label="全部" value="0" />
|
|
|
- <el-radio-button
|
|
|
- :label="item.dictLabel"
|
|
|
- :value="item.dictValue"
|
|
|
- v-for="item in bookTagDicts"
|
|
|
- />
|
|
|
+ <el-radio-button label="教材库" value="1" />
|
|
|
+ <el-radio-button label="社科库" value="2" />
|
|
|
</el-radio-group>
|
|
|
-
|
|
|
- <span class="ml-8"></span>
|
|
|
- <el-button
|
|
|
- type="success"
|
|
|
- plain
|
|
|
- v-permission="'recycle:bookTypes:batchAddBooklist'"
|
|
|
- @click="handleOptBooklist()"
|
|
|
- >
|
|
|
- 加入回收书单
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- type="warning"
|
|
|
- plain
|
|
|
- v-permission="'recycle:bookTypes:batchRemoveBlacklist'"
|
|
|
- @click="handleOptBlacklist()"
|
|
|
- >
|
|
|
- 移除黑名单
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- plain
|
|
|
- v-permission="'recycle:bookTypes:batchAddBlacklist'"
|
|
|
- @click="handleOptBlacklist()"
|
|
|
- >
|
|
|
- 加黑名单
|
|
|
- </el-button>
|
|
|
-
|
|
|
- <el-button
|
|
|
- type="warning"
|
|
|
- plain
|
|
|
- v-permission="'recycle:bookTypes:batchPauseRecycle'"
|
|
|
- @click="handleOptRecycle()"
|
|
|
- >
|
|
|
- 暂停回收
|
|
|
- </el-button>
|
|
|
-
|
|
|
- <el-button
|
|
|
- type="success"
|
|
|
- plain
|
|
|
- v-permission="'recycle:bookTypes:batchAddSocial'"
|
|
|
- @click="handleOptType(1)"
|
|
|
- >
|
|
|
- 加社科库
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- color="#192bbe"
|
|
|
- plain
|
|
|
- v-permission="'recycle:bookTypes:batchAddTeach'"
|
|
|
- @click="handleOptType(2)"
|
|
|
- >
|
|
|
- 加教材库
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- type="success"
|
|
|
- plain
|
|
|
- v-permission="'recycle:bookTypes:exprot'"
|
|
|
- @click="handleExportExcel()"
|
|
|
- >
|
|
|
- 导出Excel
|
|
|
- </el-button>
|
|
|
</template>
|
|
|
|
|
|
<template #cover="{ row }">
|
|
|
@@ -87,28 +25,20 @@
|
|
|
/>
|
|
|
</template>
|
|
|
<template #baseInfo="{ row }">
|
|
|
- <div class="flex justify-start items-center">
|
|
|
- <div style="flex: 2">
|
|
|
- <book-info :row="row"></book-info>
|
|
|
- </div>
|
|
|
- <div style="flex: 1.5; margin-left: 15px">
|
|
|
- <book-other-info :row="row"></book-other-info>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <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-permission="'recycle:bookTypes:delete'"
|
|
|
- @click="handleDelete(row)"
|
|
|
- >
|
|
|
- [删除]
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- color="#192bbe"
|
|
|
- plain
|
|
|
+ type="primary"
|
|
|
link
|
|
|
v-permission="'recycle:bookTypes:modifyType'"
|
|
|
@click="handleModifyType(row)"
|
|
|
@@ -117,26 +47,24 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</common-table>
|
|
|
+
|
|
|
+ <books-edit ref="editRef"></books-edit>
|
|
|
</ele-page>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
- import { ref, reactive } from 'vue';
|
|
|
+ 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 bookOtherInfo from '@/views/recycle/components/book-other-info.vue';
|
|
|
- import { useDictData } from '@/utils/use-dict-data';
|
|
|
-
|
|
|
- defineOptions({ name: 'bookTypes' });
|
|
|
- const [useStatusDicts, bookTagDicts] = useDictData([
|
|
|
- 'use_status',
|
|
|
- 'book_tag_ku'
|
|
|
- ]);
|
|
|
+ import bookStock from '@/views/recycle/components/book-stock.vue';
|
|
|
+ const { proxy } = getCurrentInstance();
|
|
|
+ defineOptions({ name: 'recycleBooklist' });
|
|
|
|
|
|
- const useStatus = ref('0');
|
|
|
+ const bookTag = ref('0');
|
|
|
function handleStatusChange(value) {
|
|
|
- pageRef.value.reload({ useStatus: value });
|
|
|
+ pageRef.value.reload({ bookTag: value });
|
|
|
}
|
|
|
|
|
|
/** 表格列配置 */
|
|
|
@@ -157,20 +85,65 @@
|
|
|
{
|
|
|
label: '信息',
|
|
|
prop: 'baseInfo',
|
|
|
- width: 540,
|
|
|
+ width: 500,
|
|
|
slot: 'baseInfo'
|
|
|
},
|
|
|
- { label: '回收折扣', prop: 'discount' },
|
|
|
- { label: '回收价格', prop: 'price' },
|
|
|
- { label: '最大回收量', prop: 'maxRecycledAmount' },
|
|
|
- { label: '当前剩余回收量', prop: 'remainingRecycledAmount' },
|
|
|
- { label: '所属类型', prop: 'bookTag' },
|
|
|
- { label: '售价', prop: 'salesPrice' },
|
|
|
- { label: '销量', prop: 'salesVolume' },
|
|
|
+ {
|
|
|
+ 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
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '售价',
|
|
|
+ prop: 'salePrice',
|
|
|
+ width: 120,
|
|
|
+ formatter: (row) => row.salePrice || 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '销量',
|
|
|
+ prop: 'salesNum',
|
|
|
+ sortable: true,
|
|
|
+ columnKey: '8'
|
|
|
+ },
|
|
|
{
|
|
|
columnKey: 'action',
|
|
|
label: '操作',
|
|
|
- width: 120,
|
|
|
+ width: 150,
|
|
|
slot: 'action',
|
|
|
fixed: 'right'
|
|
|
}
|
|
|
@@ -180,62 +153,53 @@
|
|
|
const pageRef = ref(null);
|
|
|
|
|
|
const pageConfig = reactive({
|
|
|
- pageUrl: '/book/bookInfo/list',
|
|
|
- exportUrl: '/book/bookInfo/export',
|
|
|
- fileName: '图书类型管理',
|
|
|
- cacheKey: 'bookTypesTable'
|
|
|
+ pageUrl: '/book/bookRecycleInfo/pageList',
|
|
|
+ exportUrl: '',
|
|
|
+ fileName: '回收书单管理',
|
|
|
+ cacheKey: 'recycleBooklistTable',
|
|
|
+ rowKey: 'isbn',
|
|
|
+ params: {
|
|
|
+ bookTag: bookTag.value
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
+ function handleSortChange({ column, order }) {
|
|
|
+ // 1 扫描次数 2总回收量 3最后一次扫描时间
|
|
|
+ reload({
|
|
|
+ orderType: column.columnKey,
|
|
|
+ orderWay: order === 'ascending' ? 'asc' : 'desc'
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
//刷新表格
|
|
|
function reload(where) {
|
|
|
pageRef.value?.reload(where);
|
|
|
}
|
|
|
|
|
|
- //导出excel
|
|
|
- function handleExportExcel() {
|
|
|
- pageRef.value?.exportData('图书类型管理');
|
|
|
+ //编辑
|
|
|
+ const editRef = ref(null);
|
|
|
+ function handleUpdateBook(row) {
|
|
|
+ let params = {
|
|
|
+ id: row.bookId
|
|
|
+ };
|
|
|
+ editRef.value?.handleOpen(params);
|
|
|
}
|
|
|
|
|
|
- //回收书单操作
|
|
|
- function handleOptBooklist(row) {
|
|
|
- let selections = row ? [row] : pageRef.value?.getSelections();
|
|
|
- let ids = selections.map((item) => item.id).join(',');
|
|
|
- let url = `/book/bookInfo/removeById/${ids}`;
|
|
|
- let title = row ? '确认移除回收书单?' : '确认加入回收书单?';
|
|
|
- pageRef.value?.operatBatch({ title, method: 'post', url, row });
|
|
|
- }
|
|
|
- //黑名单操作
|
|
|
- function handleOptBlacklist(row) {
|
|
|
- let selections = row ? [row] : pageRef.value?.getSelections();
|
|
|
- let ids = selections.map((item) => item.id).join(',');
|
|
|
- let url = `/book/bookInfo/removeBlacklist/${ids}`;
|
|
|
- let title = row ? '确认移除黑名单?' : '确认加入黑名单?';
|
|
|
- pageRef.value?.operatBatch({ title, method: 'post', url, row });
|
|
|
- }
|
|
|
- //回收操作
|
|
|
- function handleOptRecycle(row) {
|
|
|
- let selections = row ? [row] : pageRef.value?.getSelections();
|
|
|
- let ids = selections.map((item) => item.id).join(',');
|
|
|
- let url = `/book/bookInfo/recycle/${ids}`;
|
|
|
- let title = '确认回收?';
|
|
|
- pageRef.value?.operatBatch({ title, method: 'post', url, row });
|
|
|
- }
|
|
|
- //类型操作
|
|
|
- function handleOptType(type) {
|
|
|
- let selections = pageRef.value?.getSelections();
|
|
|
- let ids = selections.map((item) => item.id).join(',');
|
|
|
- let url = `/book/bookInfo/changeType/${ids}`;
|
|
|
- let title = type == 1 ? '确认加社科库?' : '确认加教材库?';
|
|
|
- pageRef.value?.operatBatch({ title, method: 'post', url, row });
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 类型操作(社科库/教材库)
|
|
|
+ * @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 ? '确认加社科库?' : '确认加教材库?';
|
|
|
|
|
|
- //删除
|
|
|
- function handleDelete(row) {
|
|
|
pageRef.value?.messageBoxConfirm({
|
|
|
- message: '确定删除吗?',
|
|
|
- fetch: () => request.get('/common/exportrecord/deleteRecord?id=' + row.id)
|
|
|
+ message: title,
|
|
|
+ fetch: () => proxy.$http.post(url, { isbnList })
|
|
|
});
|
|
|
}
|
|
|
- //修改类型
|
|
|
- function handleModifyType(row) {}
|
|
|
</script>
|