|
@@ -2,7 +2,7 @@
|
|
|
<ele-page flex-table>
|
|
<ele-page flex-table>
|
|
|
<code-search @search="reload" />
|
|
<code-search @search="reload" />
|
|
|
|
|
|
|
|
- <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
|
|
|
|
|
|
|
+ <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns" :sortFunction="sortFunction">
|
|
|
<template #bookInfo="{ row }">
|
|
<template #bookInfo="{ row }">
|
|
|
<div class="book-info">
|
|
<div class="book-info">
|
|
|
<div class="book-title" @click="handleClick(row)">{{ row.bookName }}</div>
|
|
<div class="book-title" @click="handleClick(row)">{{ row.bookName }}</div>
|
|
@@ -47,12 +47,19 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
+ <template #stockNum="{ row }">
|
|
|
|
|
+ <el-button type="primary" link @click="handleViewStockImages(row)">
|
|
|
|
|
+ {{ row.stockNum || 0 }}
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
<template #action="{ row }">
|
|
<template #action="{ row }">
|
|
|
<div>
|
|
<div>
|
|
|
<el-button type="warning" v-permission="'code:activation:out'" link @click="handleViewDetails(row)">
|
|
<el-button type="warning" v-permission="'code:activation:out'" link @click="handleViewDetails(row)">
|
|
|
出库
|
|
出库
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- <el-button type="danger" v-permission="'code:activation:inDetails'" link @click="handleInDetails(row)">
|
|
|
|
|
|
|
+ <el-button type="danger" v-permission="'code:activation:inDetails'" link
|
|
|
|
|
+ @click="handleInDetails(row)">
|
|
|
入库明细
|
|
入库明细
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<el-button type="success" v-permission="'code:activation:outDetails'" link
|
|
<el-button type="success" v-permission="'code:activation:outDetails'" link
|
|
@@ -79,6 +86,9 @@
|
|
|
<!-- 价格编辑弹窗 -->
|
|
<!-- 价格编辑弹窗 -->
|
|
|
<price-edit-modal ref="priceEditModalRef" v-model="priceEditVisible" @success="handlePriceEditSuccess" />
|
|
<price-edit-modal ref="priceEditModalRef" v-model="priceEditVisible" @success="handlePriceEditSuccess" />
|
|
|
|
|
|
|
|
|
|
+ <!-- 库存图片查看弹窗 -->
|
|
|
|
|
+ <stock-image-modal ref="stockImageModalRef" v-model="stockImageVisible" />
|
|
|
|
|
+
|
|
|
<!-- 商品编辑弹窗 -->
|
|
<!-- 商品编辑弹窗 -->
|
|
|
<booksEdit ref="bookEditRef" />
|
|
<booksEdit ref="bookEditRef" />
|
|
|
</ele-page>
|
|
</ele-page>
|
|
@@ -96,6 +106,7 @@ import InDetailModal from './components/in-detail-modal.vue';
|
|
|
import OutStockModal from './components/out-stock-modal.vue';
|
|
import OutStockModal from './components/out-stock-modal.vue';
|
|
|
import ActivationOutStockModal from './components/activation-out-stock-modal.vue';
|
|
import ActivationOutStockModal from './components/activation-out-stock-modal.vue';
|
|
|
import PriceEditModal from './components/price-edit-modal.vue';
|
|
import PriceEditModal from './components/price-edit-modal.vue';
|
|
|
|
|
+import StockImageModal from './components/stock-image-modal.vue';
|
|
|
import booksEdit from '@/views/data/books/components/books-edit.vue';
|
|
import booksEdit from '@/views/data/books/components/books-edit.vue';
|
|
|
|
|
|
|
|
defineOptions({ name: 'CodeList' });
|
|
defineOptions({ name: 'CodeList' });
|
|
@@ -106,6 +117,7 @@ const inDetailVisible = ref(false);
|
|
|
const outStockVisible = ref(false);
|
|
const outStockVisible = ref(false);
|
|
|
const activationOutStockVisible = ref(false);
|
|
const activationOutStockVisible = ref(false);
|
|
|
const priceEditVisible = ref(false);
|
|
const priceEditVisible = ref(false);
|
|
|
|
|
+const stockImageVisible = ref(false);
|
|
|
|
|
|
|
|
/** 弹窗组件引用 */
|
|
/** 弹窗组件引用 */
|
|
|
const outDetailModalRef = ref(null);
|
|
const outDetailModalRef = ref(null);
|
|
@@ -113,6 +125,7 @@ const inDetailModalRef = ref(null);
|
|
|
const outStockModalRef = ref(null);
|
|
const outStockModalRef = ref(null);
|
|
|
const activationOutStockModalRef = ref(null);
|
|
const activationOutStockModalRef = ref(null);
|
|
|
const priceEditModalRef = ref(null);
|
|
const priceEditModalRef = ref(null);
|
|
|
|
|
+const stockImageModalRef = ref(null);
|
|
|
|
|
|
|
|
//编辑图书
|
|
//编辑图书
|
|
|
const bookEditRef = ref(null);
|
|
const bookEditRef = ref(null);
|
|
@@ -121,6 +134,21 @@ function handleClick(row) {
|
|
|
bookEditRef.value?.handleOpen(row);
|
|
bookEditRef.value?.handleOpen(row);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/** 排序函数 */
|
|
|
|
|
+const sortFunction = (orders) => {
|
|
|
|
|
+ if (orders && orders.orderByColumn) {
|
|
|
|
|
+ // 1-按照库存降序 2-按照库存升序3-按照销量降序4-按照销量升序
|
|
|
|
|
+ if (orders.orderByColumn === 'stockNum') {
|
|
|
|
|
+ orders.orderField = orders.isAsc === "ascending" ? 2 : 1;
|
|
|
|
|
+ } else if (orders.orderByColumn === 'salesNum') {
|
|
|
|
|
+ orders.orderField = orders.isAsc === "ascending" ? 4 : 3;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return orders;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/** 表格列配置 */
|
|
/** 表格列配置 */
|
|
|
const columns = reactive([
|
|
const columns = reactive([
|
|
|
{
|
|
{
|
|
@@ -171,13 +199,16 @@ const columns = reactive([
|
|
|
label: '库存',
|
|
label: '库存',
|
|
|
prop: 'stockNum',
|
|
prop: 'stockNum',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- width: 120
|
|
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ slot: 'stockNum',
|
|
|
|
|
+ sortable: true,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '销量',
|
|
label: '销量',
|
|
|
prop: 'salesNum',
|
|
prop: 'salesNum',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- width: 120
|
|
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ sortable: true,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
columnKey: 'action',
|
|
columnKey: 'action',
|
|
@@ -239,6 +270,14 @@ function handleOpenActivationModal(data) {
|
|
|
activationOutStockModalRef.value?.handleOpen(data);
|
|
activationOutStockModalRef.value?.handleOpen(data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/** 查看库存图片 */
|
|
|
|
|
+const handleViewStockImages = (row) => {
|
|
|
|
|
+ stockImageVisible.value = true;
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ stockImageModalRef.value?.handleOpen(row.isbn);
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
/** 编辑价格 */
|
|
/** 编辑价格 */
|
|
|
function handleEditPrice(row, type) {
|
|
function handleEditPrice(row, type) {
|
|
|
if (row && row.isbn) {
|
|
if (row && row.isbn) {
|