|
|
@@ -4,7 +4,7 @@
|
|
|
|
|
|
<common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns" :tools="false">
|
|
|
<template #toolbar>
|
|
|
- <el-radio-group @change="handleStatusChange" v-model="useStatus">
|
|
|
+ <el-radio-group @change="handleStatusChange" v-model="searchType">
|
|
|
<el-radio-button label="全部" value="0" />
|
|
|
<el-radio-button label="已加入回收书单(正在回收)" value="1" />
|
|
|
<el-radio-button label="已加入回收书单(暂停回收)" value="2" />
|
|
|
@@ -13,40 +13,40 @@
|
|
|
</el-radio-group>
|
|
|
|
|
|
<span class="ml-8"></span>
|
|
|
- <el-button type="success" plain v-permission="'recycle:booklist:batchRemoveBooklist'"
|
|
|
- @click="handleOptBooklist()">
|
|
|
+ <el-button type="warning" plain v-permission="'recycle:booklist:batchRemoveBooklist'"
|
|
|
+ @click="handleOptBooklist()" v-if="['0', '1', '2'].includes(searchType)">
|
|
|
移除回收书单
|
|
|
</el-button>
|
|
|
- <el-button type="danger" plain v-permission="'recycle:booklist:batchAddBooklist'"
|
|
|
- @click="handleOptBooklist()">
|
|
|
+ <el-button type="success" plain v-permission="'recycle:booklist:batchAddBooklist'"
|
|
|
+ @click="handleOptBooklist()" v-if="['3', '4'].includes(searchType)">
|
|
|
加入回收书单
|
|
|
</el-button>
|
|
|
- <el-button type="success" plain v-permission="'recycle:booklist:batchRemoveBlacklist'"
|
|
|
- @click="handleOptBlacklist()">
|
|
|
- 批量移除黑名单
|
|
|
+ <el-button type="warning" plain v-permission="'recycle:booklist:batchRemoveBlacklist'"
|
|
|
+ @click="handleOptBlacklist()" v-if="searchType === '4'">
|
|
|
+ 移除黑名单
|
|
|
</el-button>
|
|
|
<el-button type="danger" plain v-permission="'recycle:booklist:batchAddBlacklist'"
|
|
|
- @click="handleOptBlacklist()">
|
|
|
- 批量加黑名单
|
|
|
+ @click="handleOptBlacklist()" v-if="searchType !== '4'">
|
|
|
+ 加黑名单
|
|
|
</el-button>
|
|
|
|
|
|
<el-button type="warning" plain v-permission="'recycle:booklist:batchPauseRecycle'"
|
|
|
- @click="handleOptRecycle()">
|
|
|
+ @click="handleOptRecycle()" v-if="searchType === '1'">
|
|
|
暂停回收
|
|
|
</el-button>
|
|
|
- <el-button type="success" plain v-permission="'recycle:booklist:batchStartRecycle'"
|
|
|
- @click="handleOptRecycle()">
|
|
|
+ <el-button type="warning" plain v-permission="'recycle:booklist:batchStartRecycle'"
|
|
|
+ @click="handleOptRecycle()" v-if="['0', '2'].includes(searchType)">
|
|
|
开启回收
|
|
|
</el-button>
|
|
|
<el-button type="primary" plain v-permission="'recycle:booklist:batchAddDiscount'"
|
|
|
- @click="handleAddDiscount()">
|
|
|
+ @click="handleAddDiscount()" v-if="searchType === '3'">
|
|
|
指定折扣加回收书单
|
|
|
</el-button>
|
|
|
<el-button type="success" plain v-permission="'recycle:booklist:batchAddSocial'"
|
|
|
@click="handleOptType(1)">
|
|
|
加社科库
|
|
|
</el-button>
|
|
|
- <el-button type="success" plain v-permission="'recycle:booklist:batchAddTeach'"
|
|
|
+ <el-button type="primary" plain v-permission="'recycle:booklist:batchAddTeach'"
|
|
|
@click="handleOptType(2)">
|
|
|
加教材库
|
|
|
</el-button>
|
|
|
@@ -58,7 +58,7 @@
|
|
|
<template #baseInfo="{ row }">
|
|
|
<div class="flex justify-start items-center">
|
|
|
<div style="flex: 2">
|
|
|
- <book-info :row="row"></book-info>
|
|
|
+ <book-info :row="row" @edit="handleUpdateBook"></book-info>
|
|
|
</div>
|
|
|
<div style="flex: 1.5; margin-left: 15px">
|
|
|
<book-other-info :row="row"></book-other-info>
|
|
|
@@ -78,35 +78,35 @@
|
|
|
@click="handleSetParams(row)">
|
|
|
[设置独立参数]
|
|
|
</el-button>
|
|
|
- <el-button type="warning" link v-permission="'recycle:booklist:addBlacklist'"
|
|
|
- @click="handleOptBlacklist(row)">
|
|
|
- [加入黑名单]
|
|
|
- </el-button>
|
|
|
<el-button type="success" link v-permission="'recycle:booklist:removeBlacklist'"
|
|
|
- @click="handleOptBlacklist(row)">
|
|
|
+ @click="handleOptBlacklist(row)" v-if="row.bookStatus == 3">
|
|
|
[移除黑名单]
|
|
|
</el-button>
|
|
|
+ <el-button type="warning" link v-permission="'recycle:booklist:addBlacklist'"
|
|
|
+ @click="handleOptBlacklist(row)" v-if="row.bookStatus == 1 || row.bookStatus == 2">
|
|
|
+ [加入黑名单]
|
|
|
+ </el-button>
|
|
|
<el-button type="danger" link v-permission="'recycle:booklist:pauseRecycle'"
|
|
|
- @click="handleOptRecycle(row)">
|
|
|
+ @click="handleOptRecycle(row)" v-if="row.recycleStatus == 1">
|
|
|
[暂停回收]
|
|
|
</el-button>
|
|
|
<el-button type="success" link v-permission="'recycle:booklist:startRecycle'"
|
|
|
- @click="handleOptRecycle(row)">
|
|
|
+ @click="handleOptRecycle(row)" v-else>
|
|
|
[开启回收]
|
|
|
</el-button>
|
|
|
<el-button type="success" link v-permission="'recycle:booklist:removeBooklist'"
|
|
|
- @click="handleOptBooklist(row)">
|
|
|
+ @click="handleOptBooklist(row)" v-if="row.bookStatus == 2">
|
|
|
[移除回收书单]
|
|
|
</el-button>
|
|
|
<el-button type="danger" link v-permission="'recycle:booklist:addBooklist'"
|
|
|
- @click="handleOptBooklist(row)">
|
|
|
+ @click="handleOptBooklist(row)" v-if="row.bookStatus == 1">
|
|
|
[加入回收书单]
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</common-table>
|
|
|
|
|
|
<books-edit ref="editRef"></books-edit>
|
|
|
- <set-params ref="paramsRef"></set-params>
|
|
|
+ <set-params ref="paramsRef" @refresh="reload"></set-params>
|
|
|
</ele-page>
|
|
|
</template>
|
|
|
|
|
|
@@ -122,11 +122,10 @@ import setParams from '@/views/recycle/components/set-params.vue';
|
|
|
import { useDictData } from '@/utils/use-dict-data';
|
|
|
|
|
|
defineOptions({ name: 'recycleBooklist' });
|
|
|
-const [useStatusDicts] = useDictData(['use_status']);
|
|
|
|
|
|
-const useStatus = ref('0');
|
|
|
+const searchType = ref('0');
|
|
|
function handleStatusChange(value) {
|
|
|
- pageRef.value.reload({ useStatus: value });
|
|
|
+ pageRef.value.reload({ searchType: value });
|
|
|
}
|
|
|
|
|
|
/** 表格列配置 */
|
|
|
@@ -147,46 +146,57 @@ const columns = ref([
|
|
|
{
|
|
|
label: '信息',
|
|
|
prop: 'baseInfo',
|
|
|
- width: 540,
|
|
|
+ width: 500,
|
|
|
slot: 'baseInfo'
|
|
|
},
|
|
|
{
|
|
|
label: '回收折扣',
|
|
|
- prop: 'discount',
|
|
|
+ minWidth: 100,
|
|
|
+ prop: 'recycleDiscount',
|
|
|
+ sortable: true,
|
|
|
+ columnKey: 'recycleDiscount'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '回收价格',
|
|
|
+ prop: 'recyclePrice',
|
|
|
sortable: true,
|
|
|
- columnKey: 'discount'
|
|
|
+ columnKey: 'recyclePrice',
|
|
|
+ minWidth: 100
|
|
|
},
|
|
|
- { label: '回收价格', prop: 'price', sortable: true, columnKey: 'price' },
|
|
|
{
|
|
|
label: '最大回收量',
|
|
|
- prop: 'maxRecycledAmount',
|
|
|
+ minWidth: 120,
|
|
|
+ prop: 'recycleMax',
|
|
|
sortable: true,
|
|
|
- columnKey: 'maxRecycledAmount'
|
|
|
+ columnKey: 'recycleMax'
|
|
|
},
|
|
|
{
|
|
|
label: '总回收数量',
|
|
|
- prop: 'totalRecycledAmount',
|
|
|
+ minWidth: 120,
|
|
|
+ prop: 'recycleNum',
|
|
|
sortable: true,
|
|
|
- columnKey: 'totalRecycledAmount'
|
|
|
+ columnKey: 'recycleNum'
|
|
|
},
|
|
|
{
|
|
|
label: '当前剩余回收量',
|
|
|
- prop: 'remainingRecycledAmount',
|
|
|
+ minWidth: 140,
|
|
|
+ prop: 'restRecycleNum',
|
|
|
sortable: true,
|
|
|
- columnKey: 'remainingRecycledAmount'
|
|
|
+ columnKey: 'restRecycleNum'
|
|
|
},
|
|
|
{
|
|
|
label: '销量',
|
|
|
- prop: 'salesVolume',
|
|
|
+ prop: 'salesNum',
|
|
|
sortable: true,
|
|
|
- columnKey: 'salesVolume'
|
|
|
+ columnKey: 'salesNum'
|
|
|
},
|
|
|
{
|
|
|
label: '库存',
|
|
|
- prop: 'stock',
|
|
|
+ prop: 'stockNum',
|
|
|
sortable: true,
|
|
|
- columnKey: 'stock',
|
|
|
- slot: 'stock'
|
|
|
+ columnKey: 'stockNum',
|
|
|
+ slot: 'stock',
|
|
|
+ minWidth: 100
|
|
|
},
|
|
|
{
|
|
|
columnKey: 'action',
|
|
|
@@ -201,7 +211,7 @@ const columns = ref([
|
|
|
const pageRef = ref(null);
|
|
|
|
|
|
const pageConfig = reactive({
|
|
|
- pageUrl: '/book/bookInfo/list',
|
|
|
+ pageUrl: '/book/bookRecycleInfo/pageList',
|
|
|
fileName: '回收书单管理',
|
|
|
cacheKey: 'recycleBooklistTable'
|
|
|
});
|
|
|
@@ -214,7 +224,10 @@ function reload(where) {
|
|
|
//编辑
|
|
|
const editRef = ref(null);
|
|
|
function handleUpdateBook(row) {
|
|
|
- editRef.value?.handleOpen(row);
|
|
|
+ let params = {
|
|
|
+ id: row.bookId
|
|
|
+ };
|
|
|
+ editRef.value?.handleOpen(params);
|
|
|
}
|
|
|
//设置参数
|
|
|
const paramsRef = ref(null);
|
|
|
@@ -225,34 +238,110 @@ function handleSetParams(row) {
|
|
|
//回收书单操作
|
|
|
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 });
|
|
|
+ if (!selections || selections.length === 0) {
|
|
|
+ ElMessage.warning('请选择要操作的图书');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const isbnList = selections.map((item) => item.isbn);
|
|
|
+ const isInRecycleList = row ? row.bookStatus === '2' : selections[0].bookStatus === '2';
|
|
|
+
|
|
|
+ const url = isInRecycleList
|
|
|
+ ? '/book/bookRecycleInfo/removeOut'
|
|
|
+ : '/book/bookRecycleInfo/addIn';
|
|
|
+
|
|
|
+ const title = isInRecycleList ? '确认移除回收书单?' : '确认加入回收书单?';
|
|
|
+
|
|
|
+ pageRef.value?.operatBatch({
|
|
|
+ title,
|
|
|
+ method: 'post',
|
|
|
+ url,
|
|
|
+ data: { isbnList },
|
|
|
+ row,
|
|
|
+ success: () => {
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
//黑名单操作
|
|
|
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 });
|
|
|
+ if (!selections || selections.length === 0) {
|
|
|
+ ElMessage.warning('请选择要操作的图书');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const isbnList = selections.map((item) => item.isbn);
|
|
|
+ const isBlacklist = row ? row.bookStatus === '3' : selections[0].bookStatus === '3';
|
|
|
+
|
|
|
+ const url = isBlacklist
|
|
|
+ ? '/book/bookRecycleInfo/removeBlackList'
|
|
|
+ : '/book/bookRecycleInfo/addBlackList';
|
|
|
+
|
|
|
+ const title = isBlacklist ? '确认移除黑名单?' : '确认加入黑名单?';
|
|
|
+
|
|
|
+ pageRef.value?.operatBatch({
|
|
|
+ title,
|
|
|
+ method: 'post',
|
|
|
+ url,
|
|
|
+ data: { isbnList },
|
|
|
+ row,
|
|
|
+ success: () => {
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
//回收操作
|
|
|
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 });
|
|
|
+ if (!selections || selections.length === 0) {
|
|
|
+ ElMessage.warning('请选择要操作的图书');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const isbnList = selections.map((item) => item.isbn);
|
|
|
+ const isStop = row ? row.recycleStatus === '1' : selections[0].recycleStatus === '1';
|
|
|
+
|
|
|
+ const url = isStop
|
|
|
+ ? '/book/bookRecycleInfo/stopRecycle'
|
|
|
+ : '/book/bookRecycleInfo/openRecycle';
|
|
|
+
|
|
|
+ const title = isStop ? '确认暂停回收?' : '确认开启回收?';
|
|
|
+
|
|
|
+ pageRef.value?.operatBatch({
|
|
|
+ title,
|
|
|
+ method: 'post',
|
|
|
+ url,
|
|
|
+ data: { isbnList },
|
|
|
+ row,
|
|
|
+ success: () => {
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
//类型操作
|
|
|
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 });
|
|
|
+ if (!selections || selections.length === 0) {
|
|
|
+ ElMessage.warning('请选择要操作的图书');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const isbnList = selections.map((item) => item.isbn);
|
|
|
+ const url = type == 2
|
|
|
+ ? '/book/bookRecycleInfo/changeBookTag2'
|
|
|
+ : '/book/bookRecycleInfo/changeBookTag1';
|
|
|
+ const title = type == 2 ? '确认加社科库?' : '确认加教材库?';
|
|
|
+
|
|
|
+ pageRef.value?.operatBatch({
|
|
|
+ title,
|
|
|
+ method: 'post',
|
|
|
+ url,
|
|
|
+ data: { isbnList },
|
|
|
+ success: () => {
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
//指定折扣
|
|
|
function handleAddDiscount() {
|