|
@@ -7,48 +7,40 @@
|
|
|
<div class="flex items-center mb-4">
|
|
<div class="flex items-center mb-4">
|
|
|
<el-statistic :value="statistics.totalStockNum || 0" title="累计激活码数量" value-style="font-size:30px"
|
|
<el-statistic :value="statistics.totalStockNum || 0" title="累计激活码数量" value-style="font-size:30px"
|
|
|
class="mr-20" />
|
|
class="mr-20" />
|
|
|
- <el-statistic :value="statistics.totalOutNum || 0" title="已出库数量" value-style="font-size:30px"
|
|
|
|
|
|
|
+ <el-statistic :value="statistics.totalOutNum || 0" title="已出库数量" value-style="font-size:30px"
|
|
|
class="mr-20" />
|
|
class="mr-20" />
|
|
|
<el-statistic :value="statistics.totalOutPrice || 0" title="已出库金额" :precision="2"
|
|
<el-statistic :value="statistics.totalOutPrice || 0" title="已出库金额" :precision="2"
|
|
|
value-style="font-size:30px" class="mr-20" />
|
|
value-style="font-size:30px" class="mr-20" />
|
|
|
- <el-statistic :value="statistics.stockNum || 0" title="待出库数量" value-style="font-size:30px"
|
|
|
|
|
|
|
+ <el-statistic :value="statistics.stockNum || 0" title="待出库数量" value-style="font-size:30px"
|
|
|
class="mr-20" />
|
|
class="mr-20" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
- <template #bookInfo="{ row }">
|
|
|
|
|
- <div class="book-info">
|
|
|
|
|
- <div class="book-title">{{ row.bookName }}</div>
|
|
|
|
|
- <div class="book-details">
|
|
|
|
|
- <div class="book-detail-item">作者:{{ row.author || '-' }}</div>
|
|
|
|
|
- <div class="book-detail-item">ISBN:{{ row.isbn || '-' }}</div>
|
|
|
|
|
- <div class="book-detail-item">出版社:{{ row.publisher || '-' }}</div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </template>
|
|
|
|
|
-
|
|
|
|
|
<template #type="{ row }">
|
|
<template #type="{ row }">
|
|
|
- <el-tag :type="row.type == 0 ? 'success' : 'warning'">
|
|
|
|
|
- {{ row.type == 0 ? '入库' : '出库' }}
|
|
|
|
|
|
|
+ <el-tag :type="row.type == 1 ? 'success' : 'warning'">
|
|
|
|
|
+ {{ row.type == 1 ? "入库" : "出库" }}
|
|
|
</el-tag>
|
|
</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template #status="{ row }">
|
|
<template #status="{ row }">
|
|
|
- <el-tag :type="row.status == 1 ? 'success' : row.status == 2 ? 'warning' : 'info'">
|
|
|
|
|
|
|
+ <el-tag :type="row.status == 1 ? 'success' : row.status == 2 ? 'warning' : 'info'
|
|
|
|
|
+ ">
|
|
|
{{ getStatusText(row.status) }}
|
|
{{ getStatusText(row.status) }}
|
|
|
</el-tag>
|
|
</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template #operatorName="{ row }">
|
|
<template #operatorName="{ row }">
|
|
|
- {{ row.operatorName || '-' }}
|
|
|
|
|
|
|
+ {{ row.operatorName || "-" }}
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template #action="{ row }">
|
|
<template #action="{ row }">
|
|
|
<div>
|
|
<div>
|
|
|
- <el-button type="primary" v-permission="'code:activation:detail'" link @click="handleViewDetails(row)">
|
|
|
|
|
|
|
+ <el-button type="primary" v-permission="'code:activation:detail'" link
|
|
|
|
|
+ @click="handleViewDetails(row)">
|
|
|
[查看详情]
|
|
[查看详情]
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- <el-button type="danger" v-permission="'code:activation:invalid'" link @click="handleInvalid(row)" v-if="row.type == 1">
|
|
|
|
|
|
|
+ <el-button type="danger" v-permission="'code:activation:invalid'" link @click="handleInvalid(row)"
|
|
|
|
|
+ v-if="row.canCancel == 1">
|
|
|
[作废]
|
|
[作废]
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</div>
|
|
</div>
|
|
@@ -57,43 +49,50 @@
|
|
|
|
|
|
|
|
<!-- 出库详情弹窗 -->
|
|
<!-- 出库详情弹窗 -->
|
|
|
<out-detail-modal ref="outDetailModalRef" />
|
|
<out-detail-modal ref="outDetailModalRef" />
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 入库详情弹窗 -->
|
|
|
|
|
+ <in-detail-modal ref="inDetailModalRef" />
|
|
|
|
|
+
|
|
|
<!-- 作废弹窗 -->
|
|
<!-- 作废弹窗 -->
|
|
|
<invalid-modal ref="invalidModalRef" @success="handleInvalidSuccess" />
|
|
<invalid-modal ref="invalidModalRef" @success="handleInvalidSuccess" />
|
|
|
</ele-page>
|
|
</ele-page>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { ref, reactive, onMounted } from 'vue';
|
|
|
|
|
-import CommonTable from '@/components/CommonPage/CommonTable.vue';
|
|
|
|
|
-import pageSearch from './page-search.vue';
|
|
|
|
|
-import OutDetailModal from './components/out-detail-modal.vue';
|
|
|
|
|
-import InvalidModal from './components/invalid-modal.vue';
|
|
|
|
|
-import request from '@/utils/request';
|
|
|
|
|
|
|
+import { ref, reactive, onMounted } from "vue";
|
|
|
|
|
+import CommonTable from "@/components/CommonPage/CommonTable.vue";
|
|
|
|
|
+import pageSearch from "./page-search.vue";
|
|
|
|
|
+import OutDetailModal from "./components/out-detail-modal.vue";
|
|
|
|
|
+import InDetailModal from "./components/in-detail-modal.vue";
|
|
|
|
|
+import InvalidModal from "./components/invalid-modal.vue";
|
|
|
|
|
+import request from "@/utils/request";
|
|
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
|
|
|
|
|
-defineOptions({ name: 'CodeRecord' });
|
|
|
|
|
|
|
+defineOptions({ name: "CodeRecord" });
|
|
|
|
|
|
|
|
// 统计数据的响应式对象
|
|
// 统计数据的响应式对象
|
|
|
const statistics = reactive({
|
|
const statistics = reactive({
|
|
|
totalStockNum: 0,
|
|
totalStockNum: 0,
|
|
|
totalOutNum: 0,
|
|
totalOutNum: 0,
|
|
|
totalOutPrice: 0,
|
|
totalOutPrice: 0,
|
|
|
- stockNum: 0
|
|
|
|
|
|
|
+ stockNum: 0,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 获取统计数据
|
|
// 获取统计数据
|
|
|
-async function fetchStatistics() {
|
|
|
|
|
- request.get('/activation/bookActivationInfo/inOutSum', {
|
|
|
|
|
- params: {
|
|
|
|
|
- startTime: '',
|
|
|
|
|
- endTime: ''
|
|
|
|
|
- }
|
|
|
|
|
- }).then(res => {
|
|
|
|
|
- console.log('获取统计数据:', res);
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
- Object.assign(statistics, res.data.data || {});
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+async function fetchStatistics(where = {}) {
|
|
|
|
|
+ request
|
|
|
|
|
+ .get("/activation/bookActivationInfo/inOutSum", {
|
|
|
|
|
+ params: {
|
|
|
|
|
+ startTime: where.startTime || "",
|
|
|
|
|
+ endTime: where.endTime || "",
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ console.log("获取统计数据:", res);
|
|
|
|
|
+ if (res.data.code === 200) {
|
|
|
|
|
+ Object.assign(statistics, res.data.data || {});
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
@@ -103,37 +102,60 @@ onMounted(() => {
|
|
|
// 获取状态文本
|
|
// 获取状态文本
|
|
|
function getStatusText(status) {
|
|
function getStatusText(status) {
|
|
|
const statusMap = {
|
|
const statusMap = {
|
|
|
- 1: '已完成',
|
|
|
|
|
- 2: '进行中',
|
|
|
|
|
- 3: '待处理'
|
|
|
|
|
|
|
+ 1: "已完成",
|
|
|
|
|
+ 2: "进行中",
|
|
|
|
|
+ 3: "待处理",
|
|
|
};
|
|
};
|
|
|
- return statusMap[status] || '未知';
|
|
|
|
|
|
|
+ return statusMap[status] || "未知";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 表格列配置 */
|
|
/** 表格列配置 */
|
|
|
const columns = ref([
|
|
const columns = ref([
|
|
|
- { label: 'ISBN', prop: 'isbn', align: 'center', width: 150 },
|
|
|
|
|
|
|
+ { label: "ISBN", prop: "isbn", align: "center", width: 150 },
|
|
|
{
|
|
{
|
|
|
- label: '商品名称',
|
|
|
|
|
- prop: 'bookName',
|
|
|
|
|
- align: 'left',
|
|
|
|
|
|
|
+ label: "商品名称",
|
|
|
|
|
+ prop: "bookName",
|
|
|
|
|
+ align: "left",
|
|
|
minWidth: 300,
|
|
minWidth: 300,
|
|
|
- slot: 'bookInfo'
|
|
|
|
|
},
|
|
},
|
|
|
- { label: '操作类型', prop: 'type', align: 'center', width: 100, slot: 'type' },
|
|
|
|
|
- { label: '操作时间', prop: 'operatorTime', align: 'center', width: 180 },
|
|
|
|
|
- { label: '数量', prop: 'num', align: 'center', width: 100 },
|
|
|
|
|
- { label: '金额', prop: 'totalPrice', align: 'center', width: 120 },
|
|
|
|
|
- { label: '单价', prop: 'price', align: 'center', width: 100 },
|
|
|
|
|
- { label: '操作', prop: 'operatorName', align: 'center', width: 120, slot: 'operatorName' },
|
|
|
|
|
{
|
|
{
|
|
|
- columnKey: 'action',
|
|
|
|
|
- label: '操作',
|
|
|
|
|
|
|
+ label: "操作类型",
|
|
|
|
|
+ prop: "type",
|
|
|
|
|
+ align: "center",
|
|
|
|
|
+ width: 100,
|
|
|
|
|
+ slot: "type",
|
|
|
|
|
+ },
|
|
|
|
|
+ { label: "操作时间", prop: "operatorTime", align: "center", width: 180 },
|
|
|
|
|
+ { label: "数量", prop: "num", align: "center", width: 100 },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "金额",
|
|
|
|
|
+ prop: "totalPrice",
|
|
|
|
|
+ align: "center",
|
|
|
width: 120,
|
|
width: 120,
|
|
|
- align: 'center',
|
|
|
|
|
- slot: 'action',
|
|
|
|
|
- fixed: 'right'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ formatter: (row) => (row.totalPrice == null ? "-" : row.totalPrice),
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "单价",
|
|
|
|
|
+ prop: "price",
|
|
|
|
|
+ align: "center",
|
|
|
|
|
+ width: 100,
|
|
|
|
|
+ formatter: (row) => (row.price == null ? "-" : row.price),
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "操作",
|
|
|
|
|
+ prop: "operatorName",
|
|
|
|
|
+ align: "center",
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ slot: "operatorName",
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ columnKey: "action",
|
|
|
|
|
+ label: "操作",
|
|
|
|
|
+ width: 150,
|
|
|
|
|
+ align: "center",
|
|
|
|
|
+ slot: "action",
|
|
|
|
|
+ fixed: "right",
|
|
|
|
|
+ },
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
/** 页面组件实例 */
|
|
/** 页面组件实例 */
|
|
@@ -142,38 +164,50 @@ const pageRef = ref(null);
|
|
|
/** 出库详情弹窗引用 */
|
|
/** 出库详情弹窗引用 */
|
|
|
const outDetailModalRef = ref(null);
|
|
const outDetailModalRef = ref(null);
|
|
|
|
|
|
|
|
|
|
+/** 入库详情弹窗引用 */
|
|
|
|
|
+const inDetailModalRef = ref(null);
|
|
|
|
|
+
|
|
|
/** 作废弹窗引用 */
|
|
/** 作废弹窗引用 */
|
|
|
const invalidModalRef = ref(null);
|
|
const invalidModalRef = ref(null);
|
|
|
|
|
|
|
|
const pageConfig = reactive({
|
|
const pageConfig = reactive({
|
|
|
- pageUrl: '/activation/bookActivationInfo/inOutList',
|
|
|
|
|
- fileName: '出入库记录',
|
|
|
|
|
- cacheKey: 'codeRecord',
|
|
|
|
|
- rowKey: 'id',
|
|
|
|
|
|
|
+ pageUrl: "/activation/bookActivationInfo/inOutList",
|
|
|
|
|
+ fileName: "出入库记录",
|
|
|
|
|
+ cacheKey: "codeRecord",
|
|
|
|
|
+ rowKey: "id",
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
//刷新表格
|
|
//刷新表格
|
|
|
|
|
+const whereCache = ref({});
|
|
|
function reload(where) {
|
|
function reload(where) {
|
|
|
pageRef.value?.reload(where);
|
|
pageRef.value?.reload(where);
|
|
|
|
|
+ whereCache.value = where;
|
|
|
|
|
+ fetchStatistics(whereCache.value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 查看详情
|
|
// 查看详情
|
|
|
const handleViewDetails = (row) => {
|
|
const handleViewDetails = (row) => {
|
|
|
- console.log('查看详情:', row);
|
|
|
|
|
if (row && row.id) {
|
|
if (row && row.id) {
|
|
|
- outDetailModalRef.value?.handleOpen(row.id);
|
|
|
|
|
|
|
+ // 根据 type 类型打开不同的详情弹窗
|
|
|
|
|
+ // type: 1-入库, 2-出库
|
|
|
|
|
+ if (row.type == 1) {
|
|
|
|
|
+ inDetailModalRef.value?.handleOpen(row.id);
|
|
|
|
|
+ } else if (row.type == 2) {
|
|
|
|
|
+ outDetailModalRef.value?.handleOpen(row.id);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error("未知的记录类型");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- console.error('缺少记录ID');
|
|
|
|
|
|
|
+ ElMessage.error("缺少记录ID");
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 作废操作
|
|
// 作废操作
|
|
|
const handleInvalid = (row) => {
|
|
const handleInvalid = (row) => {
|
|
|
- console.log('作废操作:', row);
|
|
|
|
|
if (row && row.id) {
|
|
if (row && row.id) {
|
|
|
invalidModalRef.value?.handleOpen(row);
|
|
invalidModalRef.value?.handleOpen(row);
|
|
|
} else {
|
|
} else {
|
|
|
- console.error('缺少记录信息');
|
|
|
|
|
|
|
+ ElMessage.error("缺少记录ID");
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -182,9 +216,8 @@ const handleInvalidSuccess = () => {
|
|
|
// 刷新表格数据
|
|
// 刷新表格数据
|
|
|
reload();
|
|
reload();
|
|
|
// 刷新统计数据
|
|
// 刷新统计数据
|
|
|
- fetchStatistics();
|
|
|
|
|
|
|
+ fetchStatistics(whereCache.value);
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|