|
@@ -42,7 +42,12 @@
|
|
|
<el-table-column prop="beforeStock" label="变动前" width="70" />
|
|
<el-table-column prop="beforeStock" label="变动前" width="70" />
|
|
|
<el-table-column prop="afterStock" label="变动后" width="70" />
|
|
<el-table-column prop="afterStock" label="变动后" width="70" />
|
|
|
<el-table-column prop="remark" label="备注" min-width="150" show-overflow-tooltip />
|
|
<el-table-column prop="remark" label="备注" min-width="150" show-overflow-tooltip />
|
|
|
- <el-table-column prop="createdAt" label="时间" width="160" />
|
|
|
|
|
|
|
+ <el-table-column prop="createdAt" label="时间" width="160">
|
|
|
|
|
+ <template slot-scope="{ row }">{{ formatTime ? formatTime(row.createdAt) : row.createdAt }}</template>
|
|
|
|
|
+ <template slot="header">
|
|
|
|
|
+ <span class="sort-header" @click.stop="onSortClick('createdAt', $event)">时间<span v-if="sortIndex('createdAt') !== null" class="sort-index" :class="sortClass('createdAt') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('createdAt') }}</span>{{ sortIcon('createdAt') }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
<el-pagination @size-change="txPageSize=$event;loadTransactions()" @current-change="txPage=$event;loadTransactions()" :current-page="txPage" :page-sizes="[10,20,50]" :page-size="txPageSize" :total="txTotal" layout="total, sizes, prev, pager, next, jumper" class="pagination-wrap" />
|
|
<el-pagination @size-change="txPageSize=$event;loadTransactions()" @current-change="txPage=$event;loadTransactions()" :current-page="txPage" :page-sizes="[10,20,50]" :page-size="txPageSize" :total="txTotal" layout="total, sizes, prev, pager, next, jumper" class="pagination-wrap" />
|
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
@@ -218,10 +223,13 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import SortMixin from '@/mixins/SortMixin'
|
|
|
import { getInventoryTransactions, getInboundOrderList, getInboundOrderDetail, confirmInbound, cancelInbound, getStockAlerts, getCountingList, createCountingRecord, confirmCounting, createManualOutbound, getManualOutboundList, getProductList, getProductSkuList } from '@/api/admin'
|
|
import { getInventoryTransactions, getInboundOrderList, getInboundOrderDetail, confirmInbound, cancelInbound, getStockAlerts, getCountingList, createCountingRecord, confirmCounting, createManualOutbound, getManualOutboundList, getProductList, getProductSkuList } from '@/api/admin'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
|
|
+ mixins: [SortMixin],
|
|
|
name: 'InventoryManage',
|
|
name: 'InventoryManage',
|
|
|
|
|
+ mixins: [SortMixin],
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
activeTab: 'transactions',
|
|
activeTab: 'transactions',
|
|
@@ -234,7 +242,8 @@ export default {
|
|
|
showCreateCounting: false, countingForm: { productId: '', skuId: '', actualStock: '', remark: '' },
|
|
showCreateCounting: false, countingForm: { productId: '', skuId: '', actualStock: '', remark: '' },
|
|
|
outboundList: [], outboundLoading: false, outboundPage: 1, outboundPageSize: 20, outboundTotal: 0,
|
|
outboundList: [], outboundLoading: false, outboundPage: 1, outboundPageSize: 20, outboundTotal: 0,
|
|
|
showCreateOutbound: false, outboundProductOptions: [], outboundSkuOptions: [],
|
|
showCreateOutbound: false, outboundProductOptions: [], outboundSkuOptions: [],
|
|
|
- outboundForm: { productId: '', skuId: '', quantity: 1, reason: '', remark: '' }
|
|
|
|
|
|
|
+ outboundForm: { productId: '', skuId: '', quantity: 1, reason: '', remark: '' },
|
|
|
|
|
+ sortableColumns: { id: 'ID', createdAt: '时间' }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
@@ -245,16 +254,18 @@ export default {
|
|
|
this.loadOutboundList()
|
|
this.loadOutboundList()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ loadList() { this.loadTransactions() },
|
|
|
async loadTransactions() {
|
|
async loadTransactions() {
|
|
|
this.txLoading = true
|
|
this.txLoading = true
|
|
|
try {
|
|
try {
|
|
|
- const params = {
|
|
|
|
|
- page: this.txPage, size: this.txPageSize,
|
|
|
|
|
- type: this.txFilters.type || null,
|
|
|
|
|
- startDate: this.txFilters.dateRange ? this.txFilters.dateRange[0] : null,
|
|
|
|
|
- endDate: this.txFilters.dateRange ? this.txFilters.dateRange[1] : null
|
|
|
|
|
- }
|
|
|
|
|
- const res = await getInventoryTransactions(params)
|
|
|
|
|
|
|
+ const params = {
|
|
|
|
|
+ page: this.txPage, size: this.txPageSize,
|
|
|
|
|
+ type: this.txFilters.type || null,
|
|
|
|
|
+ startDate: this.txFilters.dateRange ? this.txFilters.dateRange[0] : null,
|
|
|
|
|
+ endDate: this.txFilters.dateRange ? this.txFilters.dateRange[1] : null
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.sortState.length > 0) params.sort = this.sortState
|
|
|
|
|
+ const res = await getInventoryTransactions(params)
|
|
|
this.txList = res.data.records || []
|
|
this.txList = res.data.records || []
|
|
|
this.txTotal = res.data.total || 0
|
|
this.txTotal = res.data.total || 0
|
|
|
} catch (e) { this.$message.error('加载失败') }
|
|
} catch (e) { this.$message.error('加载失败') }
|
|
@@ -377,4 +388,18 @@ export default {
|
|
|
.inventory-manage { padding: 20px; }
|
|
.inventory-manage { padding: 20px; }
|
|
|
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
|
|
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
|
|
|
.pagination-wrap { margin-top: 12px; text-align: right; }
|
|
.pagination-wrap { margin-top: 12px; text-align: right; }
|
|
|
|
|
+.sort-header {
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ user-select: none;
|
|
|
|
|
+ font-weight: 500;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+}
|
|
|
|
|
+.sort-header:hover {
|
|
|
|
|
+ color: #409eff;
|
|
|
|
|
+}
|
|
|
|
|
+.sort-tag {
|
|
|
|
|
+ margin-left: 8px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|