Browse Source

新分拣看板

dev
常熟吴彦祖 3 days ago
parent
commit
be293befad
  1. 2
      .gitignore
  2. 19
      src/api/haianWarehouse/autoIssueTask.js
  3. 4
      src/api/haianWarehouse/sortingBoard.js
  4. 4
      src/api/warehouse/labelInventoryStock.js
  5. 7
      src/router/index.js
  6. 450
      src/views/modules/haianWarehouse/automatedWarehouse/autoIssueTask54.vue
  7. 255
      src/views/modules/haianWarehouse/dashboard/sortingBoard54.vue
  8. 926
      src/views/modules/warehouse/inventoryStock.vue
  9. 772
      src/views/modules/warehouse/inventoryStockold.vue

2
.gitignore

@ -15,3 +15,5 @@ node_modules/
*.ntvs*
*.njsproj
*.sln
# GitNexus本地图谱不提交,刷新后可重新生成 - rqrq
.gitnexus

19
src/api/haianWarehouse/autoIssueTask.js

@ -0,0 +1,19 @@
import { createAPI } from '@/utils/httpRequest.js'
/**
* 分页查询海安自动发料任务 - rqrq
* @param {Object} data 必须含 site/page/limit以及 search* 筛选 - rqrq
*/
export const getAutoIssueTaskPage = data => createAPI('/autoWareHourceHaian/haiAnAutoIssueTask/getAutoIssueTaskPage', 'post', data)
/**
* 查询海安自动发料任务标签明细 - rqrq
* @param {Object} data 必须含 site searchIssueTaskId - rqrq
*/
export const getAutoIssueTaskLabelList = data => createAPI('/autoWareHourceHaian/haiAnAutoIssueTask/getAutoIssueTaskLabelList', 'post', data)
/**
* 查询海安自动发料移库关联及队列结果 - rqrq
* @param {Object} data 必须含 site searchIssueTaskId - rqrq
*/
export const getAutoIssueMoveRefList = data => createAPI('/autoWareHourceHaian/haiAnAutoIssueTask/getAutoIssueMoveRefList', 'post', data)

4
src/api/haianWarehouse/sortingBoard.js

@ -0,0 +1,4 @@
import { createAPI } from '@/utils/httpRequest.js'
// 海安分拣看板按显式site和sortingStation读取共享ALL快照,只查询不操作任务;失败交由页面展示 - rqrq
export const getSortingBoard = data => createAPI('/api/dashboard/haian/sorting/getSortingBoard', 'post', data)

4
src/api/warehouse/labelInventoryStock.js

@ -0,0 +1,4 @@
import { createAPI } from '@/utils/httpRequest.js'
// 新库存页面及分批导出统一使用标签聚合接口,旧库存API保留给old页面 - rqrq
export const getLabelInventoryStockList = data => createAPI('warehouse/getLabelInventoryStockList', 'post', data)

7
src/router/index.js

@ -21,6 +21,13 @@ const _import = require('./import-' + process.env.NODE_ENV)
const globalRoutes = [
{ path: '/404', component: _import('common/404'), name: '404', meta: { title: '404未找到' } },
{ path: '/login', component: _import('common/login'), name: 'login', meta: { title: '登录' } },
// 海安六个看板独立入口共用海安展示页,固定分拣位防串屏;工厂由页面初始化并显式传给后端 - rqrq
{ path: '/dashboard-haian-sorting-j1h', component: _import('modules/haianWarehouse/dashboard/sortingBoard54'), name: 'haian-sorting-j1h', props: { sortingStation: 'J1H', boardTitle: '自动分拣 1' }, meta: { title: '海安自动分拣1' } },
{ path: '/dashboard-haian-sorting-j2h', component: _import('modules/haianWarehouse/dashboard/sortingBoard54'), name: 'haian-sorting-j2h', props: { sortingStation: 'J2H', boardTitle: '自动分拣 2' }, meta: { title: '海安自动分拣2' } },
{ path: '/dashboard-haian-sorting-r1h', component: _import('modules/haianWarehouse/dashboard/sortingBoard54'), name: 'haian-sorting-r1h', props: { sortingStation: 'R1H', boardTitle: '人工分拣 1' }, meta: { title: '海安人工分拣1' } },
{ path: '/dashboard-haian-sorting-r2h', component: _import('modules/haianWarehouse/dashboard/sortingBoard54'), name: 'haian-sorting-r2h', props: { sortingStation: 'R2H', boardTitle: '人工分拣 2' }, meta: { title: '海安人工分拣2' } },
{ path: '/dashboard-haian-sorting-r3h', component: _import('modules/haianWarehouse/dashboard/sortingBoard54'), name: 'haian-sorting-r3h', props: { sortingStation: 'R3H', boardTitle: '人工分拣 3' }, meta: { title: '海安人工分拣3' } },
{ path: '/dashboard-haian-sorting-r4h', component: _import('modules/haianWarehouse/dashboard/sortingBoard54'), name: 'haian-sorting-r4h', props: { sortingStation: 'R4H', boardTitle: '人工分拣 4' }, meta: { title: '海安人工分拣4' } },
{ path: '/dashboard-picking-board', component: _import('modules/dashboard/picking-board-1043'), name: 'dashboard-picking-board', meta: { title: '人工拣选看板' } },
{ path: '/dashboard-picking2-board', component: _import('modules/dashboard/picking-board-1028'), name: 'dashboard-picking-board', meta: { title: '人工拣选看板' } },
{ path: '/dashboard-robot-picking-board', component: _import('modules/dashboard/robot-picking-container'), name: 'dashboard-robot-picking-container', meta: { title: '机械臂拣选-周转箱' } },

450
src/views/modules/haianWarehouse/automatedWarehouse/autoIssueTask54.vue

@ -0,0 +1,450 @@
<template>
<div class="mod-config">
<!-- 查询区site 来自登录工厂禁止手改 - rqrq -->
<el-form :inline="true" label-position="top" style="margin-top: 1px; margin-left: 0px;">
<el-form-item label="工厂编码">
<el-input v-model="queryData.site" style="width: 100px" disabled></el-input>
</el-form-item>
<el-form-item label="托盘号">
<el-input v-model="queryData.searchPalletId" style="width: 140px" clearable placeholder="请输入托盘号" @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item label="运输任务号">
<el-input v-model="queryData.searchTransportTaskNo" style="width: 160px" clearable placeholder="请输入运输任务号" @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="queryData.searchStatus" placeholder="请选择" style="width: 120px" clearable>
<el-option label="全部" value=""></el-option>
<el-option label="移库中" value="移库中"></el-option>
<el-option label="待发料" value="待发料"></el-option>
<el-option label="处理中" value="处理中"></el-option>
<el-option label="已完成" value="已完成"></el-option>
</el-select>
</el-form-item>
<el-form-item label="失败码">
<el-select v-model="queryData.searchErrorCode" placeholder="请选择" style="width: 130px" clearable>
<el-option label="全部" value=""></el-option>
<el-option label="无失败码" value="NONE"></el-option>
<el-option label="移库失败" value="移库失败"></el-option>
<el-option label="发料失败" value="发料失败"></el-option>
<!-- 待核实独立筛选避免现场把结果不确定的标签直接补发 - rqrq -->
<el-option label="发料待核实" value="发料待核实"></el-option>
</el-select>
</el-form-item>
<el-form-item label="创建时间从">
<el-date-picker v-model="queryData.searchStartDate" type="date" value-format="yyyy-MM-dd" style="width: 140px" clearable></el-date-picker>
</el-form-item>
<el-form-item label="创建时间至">
<el-date-picker v-model="queryData.searchEndDate" type="date" value-format="yyyy-MM-dd" style="width: 140px" clearable></el-date-picker>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" :loading="dataListLoading" :disabled="dataListLoading" @click="getDataList()">查询</el-button>
<el-button :disabled="dataListLoading" @click="resetQuery()">重置</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
:height="height"
border
highlight-current-row
v-loading="dataListLoading"
:row-class-name="tableRowClassName"
style="width: 100%;"
@row-click="handleRowClick">
<el-table-column prop="id" label="任务ID" min-width="80" header-align="center" align="center"></el-table-column>
<el-table-column prop="palletId" label="托盘号" min-width="120" header-align="center" align="center"></el-table-column>
<el-table-column prop="transportTaskNo" label="运输任务号" min-width="140" header-align="center" align="center"></el-table-column>
<el-table-column prop="status" label="状态" min-width="90" header-align="center" align="center">
<template slot-scope="scope">
<el-tag :type="getStatusTagType(scope.row.status, scope.row.errorCode)" size="small">{{ scope.row.status || '-' }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="errorCode" label="失败码" min-width="100" header-align="center" align="center">
<template slot-scope="scope">
<span :style="scope.row.errorCode ? 'color:#F56C6C' : ''">{{ scope.row.errorCode || '-' }}</span>
</template>
</el-table-column>
<el-table-column prop="labelCount" label="标签数" min-width="80" header-align="center" align="center">
<template slot-scope="scope">{{ formatCount(scope.row.labelCount) }}</template>
</el-table-column>
<el-table-column label="成功/失败" min-width="100" header-align="center" align="center">
<template slot-scope="scope">{{ formatCount(scope.row.successCount) }} / {{ formatCount(scope.row.failCount) }}</template>
</el-table-column>
<el-table-column prop="unbindCount" label="已解绑" min-width="80" header-align="center" align="center">
<template slot-scope="scope">{{ formatCount(scope.row.unbindCount) }}</template>
</el-table-column>
<!-- 待核实数量来自后端 U 状态聚合单位张与普通失败分开展示 - rqrq -->
<el-table-column prop="unknownCount" label="待核实" min-width="80" header-align="center" align="center">
<template slot-scope="scope">{{ formatCount(scope.row.unknownCount) }}</template>
</el-table-column>
<el-table-column prop="errorMsg" label="错误说明" min-width="180" header-align="center" align="left" show-overflow-tooltip></el-table-column>
<el-table-column prop="createdTime" label="创建时间" min-width="160" header-align="center" align="center">
<template slot-scope="scope">{{ formatDateTime(scope.row.createdTime) }}</template>
</el-table-column>
<el-table-column prop="processedTime" label="完结时间" min-width="160" header-align="center" align="center">
<template slot-scope="scope">{{ formatDateTime(scope.row.processedTime) }}</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 1000]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<div class="detail-panel">
<div v-if="!currentTask.id" class="detail-empty">请选择一条任务</div>
<div v-else>
<div class="detail-header">
选中任务 #{{ currentTask.id }} 托盘 {{ currentTask.palletId || '-' }} 状态 {{ currentTask.status || '-' }} 失败码 {{ currentTask.errorCode || '-' }}
 RFID明细ID {{ currentTask.transportDetailId || '-' }} 完结 {{ formatDateTime(currentTask.processedTime) || '-' }}
</div>
<div v-if="currentTask.errorMsg" class="detail-error">错误说明{{ currentTask.errorMsg }}</div>
<el-tabs v-model="activeTab">
<el-tab-pane label="标签明细" name="label">
<el-table :data="labelList" border v-loading="labelListLoading" max-height="260" style="width: 100%;">
<el-table-column prop="serialNo" label="标签号" min-width="140" header-align="center" align="center"></el-table-column>
<el-table-column prop="partNo" label="物料号" min-width="120" header-align="center" align="center"></el-table-column>
<el-table-column prop="notifyNo" label="申请单号" min-width="140" header-align="center" align="center"></el-table-column>
<el-table-column prop="issueFlag" label="发料" min-width="120" header-align="center" align="center">
<template slot-scope="scope">
<el-tag :type="getIssueFlagTag(scope.row.issueFlag)" size="small">{{ getIssueFlagLabel(scope.row.issueFlag) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="unbindFlag" label="解绑" min-width="80" header-align="center" align="center">
<template slot-scope="scope">{{ scope.row.unbindFlag === 'Y' ? '已解绑' : '仍在托' }}</template>
</el-table-column>
<el-table-column label="留盘" min-width="70" header-align="center" align="center">
<template slot-scope="scope">{{ isRemainOnPallet(scope.row) ? '是' : '否' }}</template>
</el-table-column>
<el-table-column prop="errorMsg" label="失败原因" min-width="180" header-align="center" align="left" show-overflow-tooltip></el-table-column>
<el-table-column prop="updatedTime" label="更新时间" min-width="160" header-align="center" align="center">
<template slot-scope="scope">{{ formatDateTime(scope.row.updatedTime) }}</template>
</el-table-column>
</el-table>
<!-- 请求已开始和待核实不能当作未发必须先核对 IFS 后再人工处理 - rqrq -->
<div class="detail-tip">发料成功才会解绑请求已开始或待核实的标签禁止直接补发解绑请先核对 IFS 发料记录任务已完成仅表示自动处理结束</div>
</el-tab-pane>
<el-tab-pane label="移库队列" name="move">
<el-table :data="moveList" border v-loading="moveListLoading" max-height="260" style="width: 100%;">
<el-table-column prop="moveQueueId" label="队列ID" min-width="90" header-align="center" align="center"></el-table-column>
<el-table-column prop="queueStatus" label="队列状态" min-width="90" header-align="center" align="center">
<template slot-scope="scope">{{ scope.row.queueStatus || '-' }}</template>
</el-table-column>
<el-table-column prop="resultFlag" label="结果" min-width="80" header-align="center" align="center">
<template slot-scope="scope">{{ getMoveResultLabel(scope.row.resultFlag) }}</template>
</el-table-column>
<el-table-column prop="resultMsg" label="结果说明" min-width="220" header-align="center" align="left" show-overflow-tooltip></el-table-column>
<el-table-column prop="createdTime" label="入队时间" min-width="160" header-align="center" align="center">
<template slot-scope="scope">{{ formatDateTime(scope.row.createdTime) }}</template>
</el-table-column>
</el-table>
<div v-if="!moveListLoading && moveList.length === 0" class="detail-tip">无需搬库视为 IFS 已完成</div>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import {
getAutoIssueTaskPage,
getAutoIssueTaskLabelList,
getAutoIssueMoveRefList
} from '@/api/haianWarehouse/autoIssueTask.js'
export default {
name: 'autoIssueTask54',
data () {
return {
queryData: {
site: this.$store.state.user.site,
searchPalletId: '',
searchTransportTaskNo: '',
searchStatus: '',
searchErrorCode: '',
searchStartDate: '',
searchEndDate: '',
page: 1,
limit: 20
},
dataList: [],
pageIndex: 1,
pageSize: 20,
totalPage: 0,
dataListLoading: false,
height: 280,
currentTask: {},
activeTab: 'label',
labelList: [],
labelListLoading: false,
moveList: [],
moveListLoading: false
}
},
mounted () {
this.$nextTick(() => {
this.height = Math.max(220, window.innerHeight - 460)
})
},
activated () {
this.queryData.site = this.$store.state.user.site
this.getDataList()
},
methods: {
// site - rqrq
getDataList () {
if (this.dataListLoading) {
return
}
if (!this.queryData.site) {
this.$alert('缺少site,无法查询', '提示')
return
}
this.dataListLoading = true
this.queryData.page = this.pageIndex
this.queryData.limit = this.pageSize
this.queryData.site = this.$store.state.user.site
getAutoIssueTaskPage(this.queryData).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = (data.page && data.page.list) || []
this.totalPage = (data.page && data.page.totalCount) || 0
} else {
this.dataList = []
this.totalPage = 0
this.$alert((data && data.msg) || '查询失败', '提示')
}
this.clearDetail()
}).catch(() => {
this.dataList = []
this.totalPage = 0
this.clearDetail()
this.$message.error('查询异常')
}).finally(() => {
this.dataListLoading = false
})
},
// - rqrq
resetQuery () {
if (this.dataListLoading) {
return
}
this.queryData = {
site: this.$store.state.user.site,
searchPalletId: '',
searchTransportTaskNo: '',
searchStatus: '',
searchErrorCode: '',
searchStartDate: '',
searchEndDate: '',
page: 1,
limit: this.pageSize
}
this.pageIndex = 1
this.getDataList()
},
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// loading - rqrq
handleRowClick (row) {
if (!row || !row.id) {
return
}
this.currentTask = Object.assign({}, row)
this.activeTab = 'label'
this.loadLabelList()
this.loadMoveList()
},
loadLabelList () {
const taskId = this.currentTask.id
this.labelListLoading = true
getAutoIssueTaskLabelList({
site: this.$store.state.user.site,
searchIssueTaskId: taskId
}).then(({ data }) => {
if (this.currentTask.id !== taskId) {
return
}
if (data && data.code === 0) {
this.labelList = data.rows || []
} else {
this.labelList = []
this.$alert((data && data.msg) || '查询标签明细失败', '提示')
}
}).catch(() => {
if (this.currentTask.id !== taskId) {
return
}
this.labelList = []
this.$message.error('查询标签明细异常')
}).finally(() => {
if (this.currentTask.id === taskId) {
this.labelListLoading = false
}
})
},
loadMoveList () {
const taskId = this.currentTask.id
this.moveListLoading = true
getAutoIssueMoveRefList({
site: this.$store.state.user.site,
searchIssueTaskId: taskId
}).then(({ data }) => {
if (this.currentTask.id !== taskId) {
return
}
if (data && data.code === 0) {
this.moveList = data.rows || []
} else {
this.moveList = []
this.$alert((data && data.msg) || '查询移库关联失败', '提示')
}
}).catch(() => {
if (this.currentTask.id !== taskId) {
return
}
this.moveList = []
this.$message.error('查询移库关联异常')
}).finally(() => {
if (this.currentTask.id === taskId) {
this.moveListLoading = false
}
})
},
clearDetail () {
this.currentTask = {}
this.labelList = []
this.moveList = []
},
formatCount (value) {
if (value === null || value === undefined || value === '') {
return 0
}
return value
},
formatDateTime (value) {
if (!value) {
return ''
}
const date = new Date(value)
if (isNaN(date.getTime())) {
return value
}
const pad = num => (num < 10 ? '0' + num : '' + num)
return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate()) +
' ' + pad(date.getHours()) + ':' + pad(date.getMinutes()) + ':' + pad(date.getSeconds())
},
getStatusTagType (status, errorCode) {
if (errorCode) {
return 'danger'
}
if (status === '已完成') {
return 'success'
}
if (status === '待发料') {
return 'warning'
}
if (status === '处理中') {
return 'info'
}
return ''
},
tableRowClassName ({ row }) {
if (row && row.errorCode) {
return 'error-row'
}
return ''
},
// P U - rqrq
getIssueFlagLabel (flag) {
if (flag === 'P') {
return '请求已开始'
}
if (flag === 'U') {
return '待核实'
}
if (flag === 'S') {
return '成功'
}
if (flag === 'F') {
return '失败'
}
return '未发'
},
// 使 IFS - rqrq
getIssueFlagTag (flag) {
if (flag === 'P' || flag === 'U') {
return 'warning'
}
if (flag === 'S') {
return 'success'
}
if (flag === 'F') {
return 'danger'
}
return 'info'
},
// S+N - rqrq
isRemainOnPallet (row) {
if (!row) {
return false
}
return row.unbindFlag !== 'Y'
},
getMoveResultLabel (flag) {
if (flag === 'S') {
return '成功'
}
if (flag === 'F') {
return '失败'
}
return flag || '-'
}
}
}
</script>
<style scoped>
.mod-config {
padding: 10px;
}
.detail-panel {
margin-top: 12px;
padding: 10px;
border: 1px solid #ebeef5;
background: #fff;
}
.detail-empty {
color: #909399;
padding: 16px 0;
text-align: center;
}
.detail-header {
margin-bottom: 8px;
line-height: 22px;
}
.detail-error {
color: #F56C6C;
margin-bottom: 8px;
}
.detail-tip {
margin-top: 8px;
color: #909399;
font-size: 12px;
}
/deep/ .el-table .error-row {
background: #fef0f0;
}
</style>

255
src/views/modules/haianWarehouse/dashboard/sortingBoard54.vue

@ -0,0 +1,255 @@
<template>
<div class="haian-sorting-board">
<!-- 海安独立大屏固定分拣位工单来自标签预留完成状态来自WMS不展示原/目标托盘 - rqrq -->
<header class="board-header">
<img src="~@/assets/img/cclbai.png" alt="CCL" class="board-logo">
<div class="board-title">
<h1>海安 · {{ boardTitle }}</h1>
<span>分拣位 {{ sortingStation }} · 工厂 {{ site || '未设置' }}</span>
</div>
<time>{{ currentTime }}</time>
</header>
<section class="board-summary">
<div class="summary-counts">
<span>标签 <strong>{{ visibleRows.length }}</strong></span>
<span>未完成 <strong class="pending-text">{{ pendingCount }}</strong></span>
<span>已完成 <strong class="completed-text">{{ completedCount }}</strong></span>
</div>
<div class="summary-refresh">
<span :class="['connection-dot', { healthy: available && !stale }]" aria-hidden="true"></span>
<span role="status">{{ displayMessage }}</span>
<el-button size="small" :loading="queryLoading" :disabled="queryLoading || !siteReady" @click="fetchData(true)">刷新</el-button>
</div>
</section>
<!-- 固定高度容器配合粘性表头数据返回后按实际溢出滚动鼠标进入暂停便于核对 - rqrq -->
<div ref="tableViewport" class="table-viewport" @mouseenter="scrollPaused = true" @mouseleave="scrollPaused = false">
<table class="board-table">
<colgroup>
<col style="width: 4%">
<col style="width: 13%">
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 17%">
<col style="width: 19%">
<col style="width: 8%">
<col style="width: 15%">
</colgroup>
<thead>
<tr><th>序号</th><th>工单号</th><th>产品编码</th><th>物料编码</th><th>物料名称</th><th>RFID / 标签号</th><th>状态</th><th>说明</th></tr>
</thead>
<tbody>
<tr v-for="(item, index) in visibleRows" :key="item.rfidBarcode">
<td>{{ index + 1 }}</td>
<td :title="item.orderNo">{{ item.orderNo || '-' }}</td>
<td :title="item.orderPartNo">{{ item.orderPartNo || '-' }}</td>
<td :title="item.partNo">{{ item.partNo || '-' }}</td>
<td class="description" :title="item.partDesc">{{ item.partDesc || '-' }}</td>
<td class="barcode" :title="item.rfidBarcode">{{ item.rfidBarcode }}</td>
<td><span :class="['status-badge', item.status === '已完成' ? 'completed' : 'pending']">{{ item.status }}</span></td>
<td class="row-message" :title="item.message">{{ item.message || '-' }}</td>
</tr>
<tr v-if="visibleRows.length === 0">
<td colspan="8" class="empty-message" :class="{ 'is-error': !available || stale }">{{ displayMessage }}</td>
</tr>
</tbody>
</table>
</div>
<footer class="board-footer">
<span> 5 秒自动刷新</span>
<span>数据更新时间{{ updatedTime }}</span>
</footer>
</div>
</template>
<script>
import dayjs from 'dayjs'
import { getSortingBoard } from '@/api/haianWarehouse/sortingBoard'
// 使props - rqrq
export default {
name: 'HaianSortingBoard54',
props: {
sortingStation: { type: String, required: true },
boardTitle: { type: String, required: true }
},
data () {
return {
site: '',
siteReady: false,
rows: [],
available: false,
message: '正在获取分拣数据…',
updatedAt: 0,
lastReceivedAt: 0,
now: Date.now(),
queryLoading: false,
refreshTimer: null,
clockTimer: null,
scrollTimer: null,
scrollPaused: false,
scrollResumeAt: 0,
requestVersion: 0
}
},
computed: {
// 20 - rqrq
currentTime () { return dayjs(this.now).format('YYYY-MM-DD HH:mm:ss') },
updatedTime () { return this.updatedAt ? dayjs(this.updatedAt).format('YYYY-MM-DD HH:mm:ss') : '-' },
stale () { return this.lastReceivedAt > 0 && this.now - this.lastReceivedAt > 20000 },
visibleRows () { return this.available && !this.stale ? this.rows : [] },
pendingCount () { return this.visibleRows.filter(item => item.status === '未完成').length },
completedCount () { return this.visibleRows.filter(item => item.status === '已完成').length },
displayMessage () { return this.stale ? '数据更新超时,正在重试…' : this.message }
},
watch: {
// - rqrq
'$route.fullPath' () { this.initializeBoard() }
},
mounted () {
// site使 - rqrq
this.initializeBoard()
this.clockTimer = setInterval(() => { this.now = Date.now() }, 1000)
this.refreshTimer = setInterval(() => { this.fetchData(false) }, 5000)
this.scrollTimer = setInterval(this.scrollTable, 60)
},
beforeDestroy () {
// - rqrq
this.requestVersion++
clearInterval(this.refreshTimer)
clearInterval(this.clockTimer)
clearInterval(this.scrollTimer)
},
methods: {
// URLsite=54 - rqrq
initializeBoard () {
this.requestVersion++
this.queryLoading = false
this.rows = []
this.available = false
this.updatedAt = 0
this.lastReceivedAt = 0
this.siteReady = false
this.site = ''
const storeSite = String(this.$store.state.user.site || '').trim()
const querySite = this.$route.query.site
if (querySite !== undefined && (typeof querySite !== 'string' || querySite.trim() !== '54')) {
this.message = '海安看板的工厂参数必须为 site=54'
return
}
const site = querySite === undefined ? storeSite : querySite.trim()
if (site !== '54' || (storeSite && storeSite !== '54')) {
this.message = '请使用海安工厂打开看板;独立屏地址需带 ?site=54'
return
}
this.$store.commit('user/updateSite', site)
this.site = site
this.siteReady = true
this.message = '正在获取分拣数据…'
this.$nextTick(() => {
if (this.$refs.tableViewport) this.$refs.tableViewport.scrollTop = 0
this.fetchData(false)
})
},
// loadingsitefinally - rqrq
async fetchData (manual = false) {
if (!this.siteReady || this.queryLoading) return
const version = this.requestVersion
const station = this.sortingStation
const site = String(this.$store.state.user.site || '').trim()
if (site !== this.site) {
this.available = false
this.rows = []
this.message = '当前工厂已变化,请重新打开海安看板'
return
}
this.queryLoading = true
try {
const { data } = await getSortingBoard({ site: this.$store.state.user.site, sortingStation: station })
if (version !== this.requestVersion) return
this.lastReceivedAt = Date.now()
if (!data || data.code !== 0 || !data.row) {
this.rows = []
this.available = false
this.message = (data && data.msg) || '看板查询失败'
if (manual) this.$alert(this.message, '查询失败', { confirmButtonText: '确定' }).catch(() => {})
return
}
const board = data.row
if (board.site !== site || board.sortingStation !== station) {
throw new Error('返回工厂或分拣位与当前看板不一致')
}
this.available = board.available === true
this.rows = this.available && Array.isArray(board.rows) ? board.rows : []
this.updatedAt = Number(board.updatedAt) || 0
this.message = board.message || (this.rows.length ? '数据正常' : '当前分拣位暂无任务')
if (manual && !this.available) this.$alert(this.message, '数据不可用', { confirmButtonText: '确定' }).catch(() => {})
} catch (error) {
if (version !== this.requestVersion) return
this.rows = []
this.available = false
this.message = '分拣数据连接异常,正在重试…'
// 5 - rqrq
if (manual || !this.lastReceivedAt) this.$message.error('查询海安分拣看板失败,请检查网络或服务')
this.lastReceivedAt = Date.now()
} finally {
if (version === this.requestVersion) this.queryLoading = false
}
},
// 2 - rqrq
scrollTable () {
const viewport = this.$refs.tableViewport
if (!viewport || this.scrollPaused || !this.visibleRows.length || Date.now() < this.scrollResumeAt) return
if (viewport.scrollHeight <= viewport.clientHeight) return
if (viewport.scrollTop + viewport.clientHeight >= viewport.scrollHeight - 1) {
viewport.scrollTop = 0
this.scrollResumeAt = Date.now() + 2000
} else {
viewport.scrollTop += 1
}
}
}
}
</script>
<style scoped>
/* 海安大屏沿用项目蓝底白字视觉,固定视口和表头;长文本可换行,避免小屏横向滚动 - rqrq */
.haian-sorting-board { height: 100vh; width: 100%; box-sizing: border-box; padding: 18px 24px 12px; background: #344f70; color: #f4f7fb; font-family: 'Microsoft YaHei', sans-serif; display: flex; flex-direction: column; overflow: hidden; }
.board-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 82px; }
.board-logo { width: 108px; height: auto; }
.board-title { flex: 1; text-align: center; }
.board-title h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: 3px; }
.board-title span { color: #d2e1ee; font-size: 16px; }
.board-header time { font-size: 18px; font-variant-numeric: tabular-nums; }
.board-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 18px 0; }
.summary-counts, .summary-refresh { display: flex; align-items: center; gap: 20px; }
.summary-counts strong { font-size: 26px; margin-left: 8px; }
.pending-text { color: #ffd17d; }
.completed-text { color: #80e5bc; }
.connection-dot { width: 10px; height: 10px; flex-shrink: 0; border-radius: 50%; background: #ffad99; }
.connection-dot.healthy { background: #80e5bc; }
.summary-refresh { font-size: 14px; gap: 10px; }
.table-viewport { flex: 1; min-height: 0; overflow-y: auto; background: #2b405a; border: 1px solid #637e9e; border-radius: 6px; }
.board-table { width: 100%; table-layout: fixed; border-spacing: 0; }
.board-table th { position: sticky; top: 0; z-index: 1; background: #1b6676; color: #fff; font-size: 18px; padding: 16px 8px; }
.board-table td { padding: 18px 8px; font-size: 18px; text-align: center; border-bottom: 1px solid #526b87; overflow-wrap: break-word; word-wrap: break-word; }
.board-table tbody tr:nth-child(even) { background: #344b66; }
.board-table .description { text-align: left; }
.board-table .barcode { font-family: Consolas, 'Microsoft YaHei', monospace; }
.board-table .row-message { color: #ffd17d; font-size: 14px; }
.status-badge { display: inline-block; padding: 5px 10px; border-radius: 4px; white-space: nowrap; font-size: 16px; }
.status-badge.pending { background: #745827; color: #fff0cf; }
.status-badge.completed { background: #21684e; color: #d4ffeb; }
.board-table .empty-message { height: 220px; font-size: 24px; color: #d2e1ee; }
.board-table .empty-message.is-error { color: #ffd17d; }
.board-footer { display: flex; justify-content: space-between; padding-top: 12px; color: #d2e1ee; font-size: 14px; }
@media screen and (max-width: 1280px) {
.haian-sorting-board { padding: 12px; }
.board-title h1 { font-size: 26px; }
.board-header time { font-size: 14px; }
.board-table th, .board-table td { font-size: 14px; padding: 12px 5px; }
.status-badge { padding: 4px; font-size: 13px; }
}
</style>

926
src/views/modules/warehouse/inventoryStock.vue

@ -1,771 +1,259 @@
<template>
<div class="mod-config">
<div>
<span @click="favoriteFunction()">
<icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
</span>
</div>
<el-form :inline="true" label-position="top">
<el-form-item :label="inputLabel.headerInput.label1">
<el-input style="width: 120px;" v-model="queryHeaderData.site" clearable @keyup.enter.native="getDataList()"></el-input>
<div class="mod-config label-inventory-stock">
<el-button class="favorite-button" type="text" :loading="favoriteLoading"
:disabled="favoriteLoading" @click="toggleFavorite">
<icon-svg :name="favorite ? 'xiangqufill' : 'xiangqu'" class="favorite-icon"></icon-svg>
</el-button>
<el-form :inline="true" label-position="top" :disabled="queryLoading || exportLoading"
@submit.native.prevent="getDataList(true)">
<el-form-item label="工厂编码">
<el-input v-model="query.site" clearable @keyup.enter.native="getDataList(true)"></el-input>
</el-form-item>
<el-form-item :label="inputLabel.headerInput.label2">
<el-input style="width: 120px;" v-model="queryHeaderData.warehouseId" clearable @keyup.enter.native="getDataList()"></el-input>
<el-form-item label="仓库编码">
<el-input v-model="query.warehouseId" clearable @keyup.enter.native="getDataList(true)"></el-input>
</el-form-item>
<el-form-item :label="inputLabel.headerInput.label3">
<el-input style="width: 120px;" v-model="queryHeaderData.partNo" clearable @keyup.enter.native="getDataList()"></el-input>
<el-form-item label="物料编码">
<el-input v-model="query.partNo" clearable @keyup.enter.native="getDataList(true)"></el-input>
</el-form-item>
<el-form-item :label="inputLabel.headerInput.label4">
<el-input style="width: 120px;" v-model="queryHeaderData.batchNo" clearable @keyup.enter.native="getDataList()"></el-input>
<el-form-item label="批次号">
<el-input v-model="query.batchNo" clearable @keyup.enter.native="getDataList(true)"></el-input>
</el-form-item>
<el-form-item :label="inputLabel.headerInput.label5">
<el-input style="width: 120px;" v-model="queryHeaderData.locationId" clearable @keyup.enter.native="getDataList()"></el-input>
<el-form-item label="库位编码">
<el-input v-model="query.locationId" clearable @keyup.enter.native="getDataList(true)"></el-input>
</el-form-item>
<el-form-item :label="inputLabel.headerInput.label6">
<el-select v-model="queryHeaderData.freezeFlag" placeholder="请选择" style="width: 120px;">
<el-option label="全部" value=""></el-option>
<el-option
v-for="item in selectList.select1"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item style="margin-top: 20px;">
<el-button @click="getDataList('Y')" type="primary">{{ $t('warehouse.common.search') }}</el-button>
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:defaultValue="exportDefaultValue"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
:worksheet="$t('warehouse.common.exportWorksheet')"
class="el-button el-button--primary el-button--medium">
{{ $t('warehouse.common.download') }}
</download-excel>
<el-form-item class="query-actions">
<el-button type="primary" :loading="queryLoading" :disabled="queryLoading || exportLoading"
@click="getDataList(true)">{{ $t('warehouse.common.search') }}</el-button>
<el-button type="primary" :loading="exportLoading" :disabled="queryLoading || exportLoading"
@click="exportInventory">{{ $t('warehouse.common.download') }}</el-button>
</el-form-item>
</el-form>
<el-table
id="inventoryStock"
:height="height"
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%; margin-bottom: 15px;">
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
<!-- 暂不展示库存口径说明仅隐藏文字不改变查询规则 - rqrq
<div class="stock-note">现有库存为在库标签数量汇总包含预留冻结库存无锁查询结果可能随并发业务变化</div>
-->
<!-- 固定展示新口径的七列不读取旧列配置避免已移除字段被用户历史配置重新带回 - rqrq -->
<el-table v-loading="queryLoading" :data="dataList" :height="tableHeight" border style="width: 100%;">
<el-table-column prop="site" label="工厂编码" width="100" align="center"></el-table-column>
<el-table-column prop="warehouseId" label="仓库编码" width="120" align="center"></el-table-column>
<el-table-column prop="partNo" label="物料编码" min-width="180" show-overflow-tooltip></el-table-column>
<el-table-column prop="batchNo" label="批次号" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column prop="locationId" label="库位编码" min-width="150" show-overflow-tooltip></el-table-column>
<el-table-column prop="wdr" label="WDR" width="110" align="center"></el-table-column>
<el-table-column prop="qtyOnHand" label="现有库存" min-width="140" align="right">
<template slot-scope="scope">{{ formatQty(scope.row.qtyOnHand) }}</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
<el-pagination class="stock-pagination" :current-page="pageIndex" :page-size="pageSize"
:page-sizes="[20, 50, 100]" :total="totalCount" :disabled="queryLoading || exportLoading"
layout="total, sizes, prev, pager, next, jumper"
@size-change="sizeChangeHandle" @current-change="currentChangeHandle">
</el-pagination>
<column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
</div>
</template>
<script>
import column from "../common/column";
import {
searchSysLanguagePackList,
searchSysLanguageParam,
searchFunctionButtonList,
saveButtonList,
searchSysLanguage,
searchLanguageListByLanguageCode,
saveSysLanguageOne
} from "@/api/sysLanguage.js"
import getLodop from '@/utils/LodopFuncs.js'
import {
saveTableDefaultList,
saveTableUser,
getTableDefaultListLanguage,
getTableUserListLanguage,
removerDefault,
removerUser
} from "@/api/table.js"
import {
userFavoriteList,
saveUserFavorite,
removeUserFavorite,
} from '@/api/userFavorite.js'
import {
getInventoryStockList,
} from '@/api/warehouse/inventoryStock.js'
import Decimal from 'decimal.js'
import * as XLSX from 'xlsx'
import { getLabelInventoryStockList } from '@/api/warehouse/labelInventoryStock'
import { userFavoriteList, saveUserFavorite, removeUserFavorite } from '@/api/userFavorite'
// // - rqrq
const exportColumns = [
{ label: '工厂编码', prop: 'site' },
{ label: '仓库编码', prop: 'warehouseId' },
{ label: '物料编码', prop: 'partNo' },
{ label: '批次号', prop: 'batchNo' },
{ label: '库位编码', prop: 'locationId' },
{ label: 'WDR', prop: 'wdr' },
{ label: '现有库存', prop: 'qtyOnHand' }
]
export default {
components: {
column
},
data() {
name: 'WarehouseLabelInventoryStock',
data () {
return {
queryHeaderData: {
site: this.$store.state.user.site,
warehouseId: '',
partNo: '',
batchNo: '',
locationId: '',
freezeFlag: '',
page: 1,
size: 20
},
setUp: {
saveButton: false,
},
inputLabel: {
headerInput: {
label1: '工厂编码',
label2: '仓库编码',
label3: '物料编码',
label4: '批次号',
label5: '库位编码',
label6: '冻结状态',
label7: '库存信息',
label8: '现有库存',
label9: '预留库存',
label10: '生产日期',
label11: '过期日期',
label12: '供应商编码',
label13: '供应商类型',
},
},
selectList: {
select1: [{
value: 'N',
label: '正常'
}, {
value: 'Y',
label: '冻结'
}],
},
site: this.$store.state.user.site,
userName: this.$store.state.user.name,
// table
height: 450,
//
favorite: false,
addLanguage: false,
functionId: this.$route.meta.menuId,
tableId: this.$route.meta.menuId + 'INVS01',
value1: true,
visible: false,
showDefault: true,
// table
queryTable: {
functionId: this.$route.meta.menuId,
tableId: this.$route.meta.menuId + 'INVS01',
languageCode: this.$i18n.locale
},
// table
queryTableUser: {
userId: this.$store.state.user.name,
functionId: this.$route.meta.menuId,
tableId: this.$route.meta.menuId + 'INVS01',
status: true,
languageCode: this.$i18n.locale
},
//
querySysLanguageParam: {
languageCode: this.$i18n.locale
},
//
sysLanguageParams: [],
// table
userColumnList: [],
//
columnList: [
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501Site',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "site",
headerAlign: "center",
align: "center",
columnLabel: "工厂编码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501WarehouseId',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "warehouseId",
headerAlign: "center",
align: "center",
columnLabel: "仓库编码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501PartNo',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "partNo",
headerAlign: "center",
align: "center",
columnLabel: "物料编码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501BatchNo',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "batchNo",
headerAlign: "center",
align: "center",
columnLabel: "批次号",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501LocationId',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "locationId",
headerAlign: "center",
align: "center",
columnLabel: "库位编码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501LocationId',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "wdr",
headerAlign: "center",
align: "center",
columnLabel: "WDR",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501QtyOnHand',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "qtyOnHand",
headerAlign: "center",
align: "center",
columnLabel: "现有库存",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501QtyReserved',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "qtyReserved",
headerAlign: "center",
align: "center",
columnLabel: "预留库存",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501InQty',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "inQty",
headerAlign: "center",
align: "center",
columnLabel: "入库数量",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501OutQty',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "outQty",
headerAlign: "center",
align: "center",
columnLabel: "出库数量",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501FreezeFlag',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "freezeFlag",
headerAlign: "center",
align: "center",
columnLabel: "冻结状态",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501FirstInDate',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "firstInDate",
headerAlign: "center",
align: "center",
columnLabel: "首次入库日期",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501LatestInDate',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "latestInDate",
headerAlign: "center",
align: "center",
columnLabel: "最近入库日期",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
],
//
query: { site: '', warehouseId: '', partNo: '', batchNo: '', locationId: '' },
dataList: [],
queryButton: {
functionId: this.$route.meta.menuId,
tableId: this.$route.meta.menuId + 'INVS01',
languageCode: this.$i18n.locale,
objectType: 'button'
},
buttons: {
search: '查询',
download: '导出',
settingTable: '设置列表',
defaultTable: '设置默认配置'
},
// start
exportData: [],
exportName: "库存管理",
exportHeader: ["库存管理"],
exportFooter: [],
exportDefaultValue: "",
// end
buttonList: [
{
languageValue: '查询',
objectId: 'search',
objectType: "button",
tableId: this.$route.meta.menuId + 'INVS01',
},
{
languageValue: '导出',
objectId: 'download',
objectType: "button",
tableId: this.$route.meta.menuId + 'INVS01',
}
],
languageList: [],
languageColumnList: [],
languageDataList: [],
queryLanguage: {},
//
querySysLanguagePack: {
functionId: '',
page: 1,
limit: 1,
languageValue: '',
objectType: '',
objectId: ''
},
//
pageIndex: 1,
pageSize: 20,
totalPage: 0,
dataListLoading: false
totalCount: 0,
queryLoading: false,
exportLoading: false,
favoriteLoading: false,
favorite: false,
tableHeight: 450,
hasLoaded: false
}
},
mounted() {
this.$nextTick(() => {
this.height = window.innerHeight - 170;
})
created () {
// 使 - rqrq
this.query.site = this.$store.state.user.site || ''
},
mounted () {
this.updateTableHeight()
window.addEventListener('resize', this.updateTableHeight)
this.getDataList(true)
this.loadFavorite()
},
activated () {
// keep-alive - rqrq
if (this.hasLoaded) this.getDataList(false)
},
activated() {
this.getDataList()
this.getLanguageList()
beforeDestroy () {
window.removeEventListener('resize', this.updateTableHeight)
},
methods: {
//
favoriteIsOk() {
let userFavorite = {
userId: this.$store.state.user.id,
languageCode: this.$i18n.locale
}
userFavoriteList(userFavorite).then(({data}) => {
let size = data.list.filter(item => item.userId == userFavorite.menuId).length;
if (size > 0) {
this.favorite = true
} else {
this.favorite = false
}
})
// - rqrq
updateTableHeight () {
this.tableHeight = Math.max(280, window.innerHeight - 260)
},
// OR
favoriteFunction() {
let userFavorite = {
userId: this.$store.state.user.id,
functionId: this.$route.meta.menuId,
}
if (this.favorite) {
//
this.$confirm(`确定取消收藏`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeUserFavorite(userFavorite).then(({data}) => {
this.$message.success(data.msg)
this.favorite = false
})
})
} else {
//
saveUserFavorite(userFavorite).then(({data}) => {
this.$message.success(data.msg)
this.favorite = true
})
}
// BigDecimal使parseFloat - rqrq
formatQty (value) {
return new Decimal(value == null || value === '' ? 0 : value).toFixed()
},
//
saveLanguageList(val) {
saveSysLanguageOne(val).then(({data}) => {
if (data.code == 0) {
this.$message.success(data.msg)
} else {
this.$alert(data.msg, '错误', { confirmButtonText: '确定' })
}
})
// Promise - rqrq
showBusinessError (message) {
this.$alert(message || '库存查询失败', '提示', { confirmButtonText: '确定' }).catch(() => {})
},
//
addLanguageFun() {
if (this.querySysLanguagePack.languageCode) {
this.addLanguage = true
this.languageColumnList = []
let query = {
functionId: this.$route.meta.menuId,
tableId: "common1002",
languageCode: this.$i18n.locale
}
getTableDefaultListLanguage(query).then(({data}) => {
if (data.rows.length > 0) {
this.languageColumnList = data.rows
}
})
this.languageColumnList = this.columnList
searchLanguageListByLanguageCode(this.querySysLanguagePack).then(({data}) => {
this.languageDataList = data.rows
})
} else {
this.$message("请选中一种语言")
// - rqrq
buildQuery () {
const params = {}
Object.keys(this.query).forEach(key => { params[key] = String(this.query[key] || '').trim() })
if (!params.site) {
this.showBusinessError('请输入工厂编码')
return null
}
return params
},
//
getLanguageList() {
searchSysLanguage(this.queryLanguage).then(({data}) => {
this.languageList = data.rows
})
},
// button
getFunctionButtonList() {
searchFunctionButtonList(this.queryButton).then(({data}) => {
if (data.code == 0) {
this.buttons = data.data
// finally - rqrq
async getDataList (resetPage = false) {
if (this.queryLoading || this.exportLoading) return
const params = this.buildQuery()
if (!params) return
if (resetPage) this.pageIndex = 1
this.queryLoading = true
try {
const { data } = await getLabelInventoryStockList({ ...params, page: this.pageIndex, size: this.pageSize })
if (data && data.code === 0 && data.page) {
this.dataList = data.page.list || []
this.totalCount = data.page.totalCount || 0
this.pageIndex = data.page.currPage || 1
this.hasLoaded = true
} else {
// saveButtonList(this.buttonList).then(({data}) => {
// })
this.dataList = []
this.totalCount = 0
this.showBusinessError(data && data.msg)
}
})
},
//
getSysLanguageParamList() {
searchSysLanguageParam(this.querySysLanguageParam).then(({data}) => {
this.sysLanguageParams = data.rows
})
},
//
userSetting() {
this.visible = true;
let queryTable = {
userId: this.$store.state.user.name,
functionId: this.$route.meta.menuId,
tableId: this.$route.meta.menuId + 'INVS01',
languageCode: this.$i18n.locale
} catch (error) {
this.dataList = []
this.totalCount = 0
this.$message.error('库存查询网络异常,请重试')
} finally {
this.queryLoading = false
}
this.$nextTick(() => {
this.$refs.column.init(queryTable);
});
},
//
getTableUserColumn() {
getTableUserListLanguage(this.queryTableUser).then(({data}) => {
if (data.rows.length > 0) {
//this.columnList = []
this.columnList = data.rows
} else {
this.getColumnList()
}
})
// - rqrq
sizeChangeHandle (size) {
if (this.queryLoading || this.exportLoading) return
this.pageSize = size
this.getDataList(true)
},
//
async saveColumnList() {
//
if (this.userColumnList) {
// user
await removerUser(this.queryTable)
}
//
await removerDefault(this.queryTable)
// table
let sumColumnList = this.columnList;
sumColumnList = sumColumnList.map(item => {
return item = {
tableId: item.tableId,
tableName: item.tableName,
columnProp: item.columnProp,
columnLabel: item.columnLabel,
columnHidden: false,
columnImage: false,
columnSortable: false,
columnWidth: null,
format: null,
functionId: this.$route.meta.menuId,
sortLv: 0,
status: true,
fixed: '',
serialNumber: null,
columnType: null,
align: null
}
})
await saveTableDefaultList(sumColumnList)
// button label title
let buttons = this.buttonList.map(item => {
return item = {
functionId: this.$route.meta.menuId,
languageValue: item.languageValue,
objectId: item.objectId,
objectType: item.objectType,
tableId: item.tableId
}
})
await saveButtonList(buttons)
// this.getFunctionButtonList() //
this.getColumnList()
// - rqrq
currentChangeHandle (page) {
if (this.queryLoading || this.exportLoading) return
this.pageIndex = page
this.getDataList(false)
},
// tableDefault
getColumnList() {
getTableDefaultListLanguage(this.queryTable).then(({data}) => {
if (!data.rows.length == 0) {
// this.showDefault = false
this.columnList = data.rows
} else {
// this.showDefault = true
// size=999999NOLOCK - rqrq
async exportInventory () {
if (this.queryLoading || this.exportLoading) return
const params = this.buildQuery()
if (!params) return
this.exportLoading = true
try {
const rows = []
let totalPages = 1
for (let page = 1; page <= totalPages; page++) {
// 使 - rqrq
const { data } = await getLabelInventoryStockList({ ...params, page, size: 1000 })
if (!(data && data.code === 0 && data.page)) {
this.showBusinessError((data && data.msg) || '导出失败,未生成不完整文件')
return
}
if (page === 1) totalPages = data.page.totalPage || 1
const batch = data.page.list || []
rows.push(...batch)
if (!batch.length) break
}
if (!rows.length) {
this.$message.info('没有可导出的库存数据')
return
}
})
// Excel - rqrq
const sheetRows = [exportColumns.map(column => column.label)]
rows.forEach(row => sheetRows.push(exportColumns.map(column => column.prop === 'qtyOnHand'
? this.formatQty(row.qtyOnHand) : (row[column.prop] == null ? '' : String(row[column.prop])))))
const worksheet = XLSX.utils.aoa_to_sheet(sheetRows)
worksheet['!cols'] = [12, 16, 24, 30, 20, 14, 22].map(wch => ({ wch }))
const workbook = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(workbook, worksheet, '库存管理')
XLSX.writeFile(workbook, '库存管理.xlsx')
} catch (error) {
this.$message.error('导出失败,请检查网络后重试')
} finally {
this.exportLoading = false
}
},
//
getDataList() {
this.dataListLoading = true
getInventoryStockList(this.queryHeaderData).then(({data}) => {
// - rqrq
async loadFavorite () {
if (this.favoriteLoading) return
this.favoriteLoading = true
try {
const { data } = await userFavoriteList({ userId: this.$store.state.user.id, languageCode: this.$i18n.locale })
if (data && data.code === 0) {
this.dataList = data.page.list
this.pageIndex = data.page.currPage
this.pageSize = data.page.pageSize
this.totalPage = data.page.totalCount
// menuId - rqrq
this.favorite = (data.list || []).some(item => item && item.menuId != null &&
String(item.menuId) === String(this.$route.meta.menuId))
} else {
this.dataList = []
this.totalPage = 0
this.showBusinessError((data && data.msg) || '读取收藏状态失败')
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.queryHeaderData.page = 1
this.queryHeaderData.size = val
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.queryHeaderData.page = val
this.getDataList()
} catch (error) {
this.$message.error('读取收藏状态失败')
} finally {
this.favoriteLoading = false
}
},
//
fields() {
let json = "{"
this.columnList.forEach((item, index) => {
if (index == this.columnList.length - 1) {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
// /loading - rqrq
async toggleFavorite () {
if (this.favoriteLoading) return
this.favoriteLoading = true
try {
if (this.favorite) await this.$confirm('确定取消收藏?', '提示', { type: 'warning' })
const params = { userId: this.$store.state.user.id, functionId: this.$route.meta.menuId }
const { data } = await (this.favorite ? removeUserFavorite(params) : saveUserFavorite(params))
if (data && data.code === 0) {
this.favorite = !this.favorite
this.$message.success(data.msg || '操作成功')
} else {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
this.showBusinessError((data && data.msg) || '收藏操作失败')
}
})
json += "}"
let s = eval("(" + json + ")")
return s
},
async createExportData() {
// - rqrq
const queryParams = {
...this.queryHeaderData,
page: 1,
size: 999999 // - rqrq
}
const {data} = await getInventoryStockList(queryParams)
if (data && data.code === 0) {
return data.page.list || []
} catch (error) {
if (error !== 'cancel' && error !== 'close') this.$message.error('收藏操作网络异常')
} finally {
this.favoriteLoading = false
}
return []
},
startDownload() {
// this.exportData = this.dataList
},
finishDownload() {
}
},
created() {
this.getTableUserColumn()
this.getSysLanguageParamList()
// this.getFunctionButtonList() //
this.favoriteIsOk()
}
}
</script>
<style scoped>
.wrapper {
height: calc(100% - 40px);
}
.sl-input {
background-color: transparent;
border: 0 !important;
font-size: 12px !important;
height: 12px !important;
line-height: 14px !important;
background-color: transparent !important;
width: 140px;
}
.sl-input:focus, textarea:focus {
outline: none;
}
.sl-svg {
overflow: hidden;
float: right;
}
<style scoped>
.label-inventory-stock { position: relative; }
.label-inventory-stock /deep/ .el-input { width: 140px; }
.query-actions { margin-top: 20px; }
.favorite-button { position: absolute; top: -8px; right: 0; z-index: 1; }
.favorite-icon { width: 16px; height: 16px; }
.stock-note { margin: 0 0 10px; color: #909399; font-size: 12px; }
.stock-pagination { margin-top: 15px; }
</style>

772
src/views/modules/warehouse/inventoryStockold.vue

@ -0,0 +1,772 @@
<!-- 旧inventory_stock库存管理页面完整保留新入口inventoryStock.vue改用标签聚合供历史功能对照 - rqrq -->
<template>
<div class="mod-config">
<div>
<span @click="favoriteFunction()">
<icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
</span>
</div>
<el-form :inline="true" label-position="top">
<el-form-item :label="inputLabel.headerInput.label1">
<el-input style="width: 120px;" v-model="queryHeaderData.site" clearable @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item :label="inputLabel.headerInput.label2">
<el-input style="width: 120px;" v-model="queryHeaderData.warehouseId" clearable @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item :label="inputLabel.headerInput.label3">
<el-input style="width: 120px;" v-model="queryHeaderData.partNo" clearable @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item :label="inputLabel.headerInput.label4">
<el-input style="width: 120px;" v-model="queryHeaderData.batchNo" clearable @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item :label="inputLabel.headerInput.label5">
<el-input style="width: 120px;" v-model="queryHeaderData.locationId" clearable @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item :label="inputLabel.headerInput.label6">
<el-select v-model="queryHeaderData.freezeFlag" placeholder="请选择" style="width: 120px;">
<el-option label="全部" value=""></el-option>
<el-option
v-for="item in selectList.select1"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item style="margin-top: 20px;">
<el-button @click="getDataList('Y')" type="primary">{{ $t('warehouse.common.search') }}</el-button>
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:defaultValue="exportDefaultValue"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
:worksheet="$t('warehouse.common.exportWorksheet')"
class="el-button el-button--primary el-button--medium">
{{ $t('warehouse.common.download') }}
</download-excel>
</el-form-item>
</el-form>
<el-table
id="inventoryStock"
:height="height"
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%; margin-bottom: 15px;">
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
</div>
</template>
<script>
import column from "../common/column";
import {
searchSysLanguagePackList,
searchSysLanguageParam,
searchFunctionButtonList,
saveButtonList,
searchSysLanguage,
searchLanguageListByLanguageCode,
saveSysLanguageOne
} from "@/api/sysLanguage.js"
import getLodop from '@/utils/LodopFuncs.js'
import {
saveTableDefaultList,
saveTableUser,
getTableDefaultListLanguage,
getTableUserListLanguage,
removerDefault,
removerUser
} from "@/api/table.js"
import {
userFavoriteList,
saveUserFavorite,
removeUserFavorite,
} from '@/api/userFavorite.js'
import {
getInventoryStockList,
} from '@/api/warehouse/inventoryStock.js'
export default {
components: {
column
},
data() {
return {
queryHeaderData: {
site: this.$store.state.user.site,
warehouseId: '',
partNo: '',
batchNo: '',
locationId: '',
freezeFlag: '',
page: 1,
size: 20
},
setUp: {
saveButton: false,
},
inputLabel: {
headerInput: {
label1: '工厂编码',
label2: '仓库编码',
label3: '物料编码',
label4: '批次号',
label5: '库位编码',
label6: '冻结状态',
label7: '库存信息',
label8: '现有库存',
label9: '预留库存',
label10: '生产日期',
label11: '过期日期',
label12: '供应商编码',
label13: '供应商类型',
},
},
selectList: {
select1: [{
value: 'N',
label: '正常'
}, {
value: 'Y',
label: '冻结'
}],
},
site: this.$store.state.user.site,
userName: this.$store.state.user.name,
// table
height: 450,
//
favorite: false,
addLanguage: false,
functionId: this.$route.meta.menuId,
tableId: this.$route.meta.menuId + 'INVS01',
value1: true,
visible: false,
showDefault: true,
// table
queryTable: {
functionId: this.$route.meta.menuId,
tableId: this.$route.meta.menuId + 'INVS01',
languageCode: this.$i18n.locale
},
// table
queryTableUser: {
userId: this.$store.state.user.name,
functionId: this.$route.meta.menuId,
tableId: this.$route.meta.menuId + 'INVS01',
status: true,
languageCode: this.$i18n.locale
},
//
querySysLanguageParam: {
languageCode: this.$i18n.locale
},
//
sysLanguageParams: [],
// table
userColumnList: [],
//
columnList: [
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501Site',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "site",
headerAlign: "center",
align: "center",
columnLabel: "工厂编码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501WarehouseId',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "warehouseId",
headerAlign: "center",
align: "center",
columnLabel: "仓库编码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501PartNo',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "partNo",
headerAlign: "center",
align: "center",
columnLabel: "物料编码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501BatchNo',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "batchNo",
headerAlign: "center",
align: "center",
columnLabel: "批次号",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501LocationId',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "locationId",
headerAlign: "center",
align: "center",
columnLabel: "库位编码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501LocationId',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "wdr",
headerAlign: "center",
align: "center",
columnLabel: "WDR",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501QtyOnHand',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "qtyOnHand",
headerAlign: "center",
align: "center",
columnLabel: "现有库存",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501QtyReserved',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "qtyReserved",
headerAlign: "center",
align: "center",
columnLabel: "预留库存",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501InQty',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "inQty",
headerAlign: "center",
align: "center",
columnLabel: "入库数量",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501OutQty',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "outQty",
headerAlign: "center",
align: "center",
columnLabel: "出库数量",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501FreezeFlag',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "freezeFlag",
headerAlign: "center",
align: "center",
columnLabel: "冻结状态",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501FirstInDate',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "firstInDate",
headerAlign: "center",
align: "center",
columnLabel: "首次入库日期",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
serialNumber: 'inventoryStock2501LatestInDate',
tableId: this.$route.meta.menuId + 'INVS01',
tableName: "inventoryStockTable",
columnProp: "latestInDate",
headerAlign: "center",
align: "center",
columnLabel: "最近入库日期",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
],
//
dataList: [],
queryButton: {
functionId: this.$route.meta.menuId,
tableId: this.$route.meta.menuId + 'INVS01',
languageCode: this.$i18n.locale,
objectType: 'button'
},
buttons: {
search: '查询',
download: '导出',
settingTable: '设置列表',
defaultTable: '设置默认配置'
},
// start
exportData: [],
exportName: "库存管理",
exportHeader: ["库存管理"],
exportFooter: [],
exportDefaultValue: "",
// end
buttonList: [
{
languageValue: '查询',
objectId: 'search',
objectType: "button",
tableId: this.$route.meta.menuId + 'INVS01',
},
{
languageValue: '导出',
objectId: 'download',
objectType: "button",
tableId: this.$route.meta.menuId + 'INVS01',
}
],
languageList: [],
languageColumnList: [],
languageDataList: [],
queryLanguage: {},
//
querySysLanguagePack: {
functionId: '',
page: 1,
limit: 1,
languageValue: '',
objectType: '',
objectId: ''
},
//
pageIndex: 1,
pageSize: 20,
totalPage: 0,
dataListLoading: false
}
},
mounted() {
this.$nextTick(() => {
this.height = window.innerHeight - 170;
})
},
activated() {
this.getDataList()
this.getLanguageList()
},
methods: {
//
favoriteIsOk() {
let userFavorite = {
userId: this.$store.state.user.id,
languageCode: this.$i18n.locale
}
userFavoriteList(userFavorite).then(({data}) => {
let size = data.list.filter(item => item.userId == userFavorite.menuId).length;
if (size > 0) {
this.favorite = true
} else {
this.favorite = false
}
})
},
// OR
favoriteFunction() {
let userFavorite = {
userId: this.$store.state.user.id,
functionId: this.$route.meta.menuId,
}
if (this.favorite) {
//
this.$confirm(`确定取消收藏`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeUserFavorite(userFavorite).then(({data}) => {
this.$message.success(data.msg)
this.favorite = false
})
})
} else {
//
saveUserFavorite(userFavorite).then(({data}) => {
this.$message.success(data.msg)
this.favorite = true
})
}
},
//
saveLanguageList(val) {
saveSysLanguageOne(val).then(({data}) => {
if (data.code == 0) {
this.$message.success(data.msg)
} else {
this.$alert(data.msg, '错误', { confirmButtonText: '确定' })
}
})
},
//
addLanguageFun() {
if (this.querySysLanguagePack.languageCode) {
this.addLanguage = true
this.languageColumnList = []
let query = {
functionId: this.$route.meta.menuId,
tableId: "common1002",
languageCode: this.$i18n.locale
}
getTableDefaultListLanguage(query).then(({data}) => {
if (data.rows.length > 0) {
this.languageColumnList = data.rows
}
})
this.languageColumnList = this.columnList
searchLanguageListByLanguageCode(this.querySysLanguagePack).then(({data}) => {
this.languageDataList = data.rows
})
} else {
this.$message("请选中一种语言")
}
},
//
getLanguageList() {
searchSysLanguage(this.queryLanguage).then(({data}) => {
this.languageList = data.rows
})
},
// button
getFunctionButtonList() {
searchFunctionButtonList(this.queryButton).then(({data}) => {
if (data.code == 0) {
this.buttons = data.data
} else {
// saveButtonList(this.buttonList).then(({data}) => {
// })
}
})
},
//
getSysLanguageParamList() {
searchSysLanguageParam(this.querySysLanguageParam).then(({data}) => {
this.sysLanguageParams = data.rows
})
},
//
userSetting() {
this.visible = true;
let queryTable = {
userId: this.$store.state.user.name,
functionId: this.$route.meta.menuId,
tableId: this.$route.meta.menuId + 'INVS01',
languageCode: this.$i18n.locale
}
this.$nextTick(() => {
this.$refs.column.init(queryTable);
});
},
//
getTableUserColumn() {
getTableUserListLanguage(this.queryTableUser).then(({data}) => {
if (data.rows.length > 0) {
//this.columnList = []
this.columnList = data.rows
} else {
this.getColumnList()
}
})
},
//
async saveColumnList() {
//
if (this.userColumnList) {
// user
await removerUser(this.queryTable)
}
//
await removerDefault(this.queryTable)
// table
let sumColumnList = this.columnList;
sumColumnList = sumColumnList.map(item => {
return item = {
tableId: item.tableId,
tableName: item.tableName,
columnProp: item.columnProp,
columnLabel: item.columnLabel,
columnHidden: false,
columnImage: false,
columnSortable: false,
columnWidth: null,
format: null,
functionId: this.$route.meta.menuId,
sortLv: 0,
status: true,
fixed: '',
serialNumber: null,
columnType: null,
align: null
}
})
await saveTableDefaultList(sumColumnList)
// button label title
let buttons = this.buttonList.map(item => {
return item = {
functionId: this.$route.meta.menuId,
languageValue: item.languageValue,
objectId: item.objectId,
objectType: item.objectType,
tableId: item.tableId
}
})
await saveButtonList(buttons)
// this.getFunctionButtonList() //
this.getColumnList()
},
// tableDefault
getColumnList() {
getTableDefaultListLanguage(this.queryTable).then(({data}) => {
if (!data.rows.length == 0) {
// this.showDefault = false
this.columnList = data.rows
} else {
// this.showDefault = true
}
})
},
//
getDataList() {
this.dataListLoading = true
getInventoryStockList(this.queryHeaderData).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.pageIndex = data.page.currPage
this.pageSize = data.page.pageSize
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.queryHeaderData.page = 1
this.queryHeaderData.size = val
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.queryHeaderData.page = val
this.getDataList()
},
//
fields() {
let json = "{"
this.columnList.forEach((item, index) => {
if (index == this.columnList.length - 1) {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
} else {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
}
})
json += "}"
let s = eval("(" + json + ")")
return s
},
async createExportData() {
// - rqrq
const queryParams = {
...this.queryHeaderData,
page: 1,
size: 999999 // - rqrq
}
const {data} = await getInventoryStockList(queryParams)
if (data && data.code === 0) {
return data.page.list || []
}
return []
},
startDownload() {
// this.exportData = this.dataList
},
finishDownload() {
}
},
created() {
this.getTableUserColumn()
this.getSysLanguageParamList()
// this.getFunctionButtonList() //
this.favoriteIsOk()
}
}
</script>
<style scoped>
.wrapper {
height: calc(100% - 40px);
}
.sl-input {
background-color: transparent;
border: 0 !important;
font-size: 12px !important;
height: 12px !important;
line-height: 14px !important;
background-color: transparent !important;
width: 140px;
}
.sl-input:focus, textarea:focus {
outline: none;
}
.sl-svg {
overflow: hidden;
float: right;
}
</style>
Loading…
Cancel
Save