|
|
|
@ -1,17 +1,17 @@ |
|
|
|
<template> |
|
|
|
<div class="mod-config yzz"> |
|
|
|
<!-- 出入库记录 --> |
|
|
|
<!-- 出入库记录(单头 + 明细合并显示) --> |
|
|
|
<div class="trans-section"> |
|
|
|
<p class="section-title">出入库记录</p> |
|
|
|
<el-form :inline="true" label-position="top" style="margin-top: 0px"> |
|
|
|
<el-form-item label="工厂编码"> |
|
|
|
<el-input v-model="headerSearch.site" style="width: 100px" clearable/> |
|
|
|
<el-input v-model="searchForm.site" style="width: 100px" clearable/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="出入库单号"> |
|
|
|
<el-input v-model="headerSearch.transNo" style="width: 160px" clearable/> |
|
|
|
<el-input v-model="searchForm.transNo" style="width: 160px" clearable/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="出入库类型"> |
|
|
|
<el-select v-model="headerSearch.transType" style="width: 160px" clearable placeholder="全部"> |
|
|
|
<el-select v-model="searchForm.transType" style="width: 160px" clearable placeholder="全部"> |
|
|
|
<el-option label="全部" value=""/> |
|
|
|
<el-option |
|
|
|
v-for="item in transTypeOptions" |
|
|
|
@ -20,17 +20,40 @@ |
|
|
|
:value="item"/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="出入库方向"> |
|
|
|
<el-select v-model="searchForm.direction" style="width: 100px" clearable placeholder="全部"> |
|
|
|
<el-option label="全部" value=""/> |
|
|
|
<el-option label="入库" value="+"/> |
|
|
|
<el-option label="出库" value="-"/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="经手人"> |
|
|
|
<el-input v-model="headerSearch.receiver" style="width: 120px" clearable/> |
|
|
|
<el-input v-model="searchForm.receiver" style="width: 120px" clearable/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="工具实例编码"> |
|
|
|
<el-input v-model="searchForm.toolInstanceId" style="width: 160px" clearable/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="仓库编码"> |
|
|
|
<el-input v-model="searchForm.wareHouseId" style="width: 120px" clearable/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="库位编码"> |
|
|
|
<el-input v-model="searchForm.locationId" style="width: 120px" clearable/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="派工单号"> |
|
|
|
<el-input v-model="searchForm.orderRef3" style="width: 140px" clearable/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="'供应商'"> |
|
|
|
<span slot="label" @click="getBaseList(73)"><a >供应商名称</a></span> |
|
|
|
<el-input v-model="searchForm.supplierName" style="width: 180px" clearable @input="onSupplierInput"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label=" "> |
|
|
|
<el-button type="primary" @click="searchHeader()" :loading="dataListLoading">查询</el-button> |
|
|
|
<el-button type="primary" @click="search()" :loading="dataListLoading">查询</el-button> |
|
|
|
<!-- 导出功能 --> |
|
|
|
<!--download-excel |
|
|
|
:fields="headerFields()" |
|
|
|
:fields="mergeFields()" |
|
|
|
type="xls" |
|
|
|
:name="headerExportName" |
|
|
|
:fetch="createHeaderExportData" |
|
|
|
:name="exportName" |
|
|
|
:fetch="createExportData" |
|
|
|
worksheet="导出信息" |
|
|
|
class="el-button el-button--primary el-button--medium" |
|
|
|
style="margin-left: 8px;"> |
|
|
|
@ -40,15 +63,14 @@ |
|
|
|
</el-form> |
|
|
|
|
|
|
|
<el-table |
|
|
|
:data="headerList" |
|
|
|
:height="headerHeight" |
|
|
|
:data="dataList" |
|
|
|
:height="tableHeight" |
|
|
|
border |
|
|
|
highlight-current-row |
|
|
|
@row-click="handleHeaderRowClick" |
|
|
|
v-loading="dataListLoading" |
|
|
|
style="width: 100%;"> |
|
|
|
<el-table-column |
|
|
|
v-for="(item,index) in headerColumnList" |
|
|
|
v-for="(item,index) in columnList" |
|
|
|
:key="index" |
|
|
|
:sortable="item.columnSortable" |
|
|
|
:prop="item.columnProp" |
|
|
|
@ -65,86 +87,49 @@ |
|
|
|
</el-table> |
|
|
|
|
|
|
|
<el-pagination |
|
|
|
@size-change="headerSizeChange" |
|
|
|
@current-change="headerCurrentChange" |
|
|
|
:current-page="headerPageIndex" |
|
|
|
@size-change="sizeChange" |
|
|
|
@current-change="currentChange" |
|
|
|
:current-page="pageIndex" |
|
|
|
:page-sizes="[20, 50, 100]" |
|
|
|
:page-size="headerPageSize" |
|
|
|
:total="headerTotal" |
|
|
|
:page-size="pageSize" |
|
|
|
:total="total" |
|
|
|
layout="total, sizes, prev, pager, next, jumper"> |
|
|
|
</el-pagination> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 出入库明细 --> |
|
|
|
<div class="trans-section" style="margin-top: 10px;"> |
|
|
|
<p class="section-title">出入库明细</p> |
|
|
|
|
|
|
|
<el-table |
|
|
|
:data="detailList" |
|
|
|
:height="detailHeight" |
|
|
|
border |
|
|
|
highlight-current-row |
|
|
|
v-loading="dataListLoading" |
|
|
|
style="width: 100%;"> |
|
|
|
<el-table-column |
|
|
|
v-for="(item,index) in detailColumnList" |
|
|
|
:key="index" |
|
|
|
:sortable="item.columnSortable" |
|
|
|
:prop="item.columnProp" |
|
|
|
header-align="center" |
|
|
|
: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> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
<el-pagination |
|
|
|
@size-change="detailSizeChange" |
|
|
|
@current-change="detailCurrentChange" |
|
|
|
:current-page="detailPageIndex" |
|
|
|
:page-sizes="[20, 50, 100]" |
|
|
|
:page-size="detailPageSize" |
|
|
|
:total="detailTotal" |
|
|
|
layout="total, sizes, prev, pager, next, jumper"> |
|
|
|
</el-pagination> |
|
|
|
</div> |
|
|
|
<!-- 基础列表选择弹窗(供应商 tagNo=73) --> |
|
|
|
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
/** |
|
|
|
* 工具出入库记录查询页面 |
|
|
|
* 出入库单头(tool_trans_header) + 出入库明细(tool_trans_detail) 两个查询 |
|
|
|
* 出入库单头(tool_trans_header) + 出入库明细(tool_trans_detail) 合并为一个列表显示 |
|
|
|
*/ |
|
|
|
import { |
|
|
|
searchToolTransHeaderPage, |
|
|
|
searchToolTransDetailPage, |
|
|
|
searchToolTransMergePage, |
|
|
|
searchToolTransTypeList |
|
|
|
} from '@/api/production/tool.js' |
|
|
|
import Chooselist from '@/views/modules/common/Chooselist' |
|
|
|
|
|
|
|
/** 出入库单头列 */ |
|
|
|
const HEADER_COLUMN_SPECS = [ |
|
|
|
/** 合并列表列(单头字段 + 明细字段) */ |
|
|
|
const MERGE_COLUMN_SPECS = [ |
|
|
|
{ prop: 'site', label: '工厂编码', width: 70, align: 'center' }, |
|
|
|
{ prop: 'transNo', label: '出入库单号', width: 150, align: 'left', tooltip: true }, |
|
|
|
{ prop: 'transDate', label: '出入库日期', width: 110, align: 'center' }, |
|
|
|
{ prop: 'transType', label: '出入库类型', width: 130, align: 'left', tooltip: true }, |
|
|
|
{ prop: 'receiver', label: '经手人', width: 90, align: 'left' }, |
|
|
|
{ prop: 'status', label: '状态', width: 80, align: 'center' }, |
|
|
|
{ prop: 'remark', label: '备注', width: 180, align: 'left', tooltip: true } |
|
|
|
] |
|
|
|
|
|
|
|
/** 出入库明细列 */ |
|
|
|
const DETAIL_COLUMN_SPECS = [ |
|
|
|
//{ prop: 'batchNo', label: '批号', width: 130, align: 'left', tooltip: true }, |
|
|
|
{ prop: 'direction', label: '出入库方向', width: 90, align: 'center' }, |
|
|
|
{ prop: 'toolInstanceId', label: '工具实例编码', width: 130, align: 'left', tooltip: true }, |
|
|
|
{ prop: 'itemNo', label: '行号', width: 70, align: 'center' }, |
|
|
|
{ prop: 'wareHouseId', label: '仓库编码', width: 90, align: 'left' }, |
|
|
|
{ prop: 'locationId', label: '库位编码', width: 90, align: 'left' }, |
|
|
|
{ prop: 'orderRef3', label: '派工单号', width: 110, align: 'left', tooltip: true }, |
|
|
|
{ prop: 'supplierName', label: '供应商', width: 140, align: 'left', tooltip: true }, |
|
|
|
{ prop: 'createdBy', label: '创建人', width: 90, align: 'left' }, |
|
|
|
{ prop: 'createdDate', label: '创建时间', width: 145, align: 'center' }, |
|
|
|
{ prop: 'remark', label: '备注', width: 180, align: 'left', tooltip: true } |
|
|
|
] |
|
|
|
|
|
|
|
@ -174,51 +159,50 @@ function buildColumnList (specs, tableId, vm) { |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'toolInventoryLog', |
|
|
|
components: { |
|
|
|
Chooselist |
|
|
|
}, |
|
|
|
data () { |
|
|
|
return { |
|
|
|
headerHeight: 200, |
|
|
|
detailHeight: 200, |
|
|
|
tableHeight: 400, |
|
|
|
dataListLoading: false, |
|
|
|
|
|
|
|
// 当前打开的基础列表 tagNo(回调分发用) |
|
|
|
tagNo: 0, |
|
|
|
|
|
|
|
// 出入库类型下拉选项 |
|
|
|
transTypeOptions: [], |
|
|
|
|
|
|
|
// 出入库单头 |
|
|
|
headerSearch: { |
|
|
|
// 合并列表查询条件 |
|
|
|
searchForm: { |
|
|
|
site: '', |
|
|
|
transNo: '', |
|
|
|
transType: '', |
|
|
|
receiver: '' |
|
|
|
direction: '', |
|
|
|
receiver: '', |
|
|
|
toolInstanceId: '', |
|
|
|
wareHouseId: '', |
|
|
|
locationId: '', |
|
|
|
orderRef3: '', |
|
|
|
supplierId: '', |
|
|
|
supplierName: '' |
|
|
|
}, |
|
|
|
headerList: [], |
|
|
|
headerPageIndex: 1, |
|
|
|
headerPageSize: 20, |
|
|
|
headerTotal: 0, |
|
|
|
headerExportName: '工具出入库记录' + this.getStrDate(), |
|
|
|
|
|
|
|
// 出入库明细(根据上方出入库记录选中行联动加载) |
|
|
|
currentHeaderRow: null, |
|
|
|
detailList: [], |
|
|
|
detailPageIndex: 1, |
|
|
|
detailPageSize: 20, |
|
|
|
detailTotal: 0, |
|
|
|
detailExportName: '工具出入库明细' + this.getStrDate() |
|
|
|
dataList: [], |
|
|
|
pageIndex: 1, |
|
|
|
pageSize: 20, |
|
|
|
total: 0, |
|
|
|
exportName: '工具出入库记录' + this.getStrDate() |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
headerColumnList () { |
|
|
|
return buildColumnList(HEADER_COLUMN_SPECS, 'toolTransHeaderList', this) |
|
|
|
}, |
|
|
|
detailColumnList () { |
|
|
|
return buildColumnList(DETAIL_COLUMN_SPECS, 'toolTransDetailList', this) |
|
|
|
columnList () { |
|
|
|
return buildColumnList(MERGE_COLUMN_SPECS, 'toolTransMergeList', this) |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
mounted () { |
|
|
|
this.loadTransTypeOptions() |
|
|
|
this.$nextTick(() => { |
|
|
|
const total = window.innerHeight - 280 |
|
|
|
this.headerHeight = Math.floor(total * 0.5) - 30 |
|
|
|
this.detailHeight = Math.floor(total * 0.5) - 30 |
|
|
|
this.tableHeight = window.innerHeight - 300 |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -232,92 +216,73 @@ mounted () { |
|
|
|
this.transTypeOptions = [] |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** 查询出入库单头 */ |
|
|
|
searchHeader () { |
|
|
|
/** 查询出入库记录(单头 + 明细合并) */ |
|
|
|
search () { |
|
|
|
this.dataListLoading = true |
|
|
|
const payload = { |
|
|
|
site: this.headerSearch.site ? this.headerSearch.site.trim() : undefined, |
|
|
|
transNo: this.headerSearch.transNo ? this.headerSearch.transNo.trim() : undefined, |
|
|
|
transType: this.headerSearch.transType ? this.headerSearch.transType.trim() : undefined, |
|
|
|
receiver: this.headerSearch.receiver ? this.headerSearch.receiver.trim() : undefined, |
|
|
|
page: this.headerPageIndex, |
|
|
|
limit: this.headerPageSize |
|
|
|
site: this.searchForm.site ? this.searchForm.site.trim() : undefined, |
|
|
|
transNo: this.searchForm.transNo ? this.searchForm.transNo.trim() : undefined, |
|
|
|
transType: this.searchForm.transType ? this.searchForm.transType.trim() : undefined, |
|
|
|
direction: this.searchForm.direction ? this.searchForm.direction : undefined, |
|
|
|
receiver: this.searchForm.receiver ? this.searchForm.receiver.trim() : undefined, |
|
|
|
toolInstanceId: this.searchForm.toolInstanceId ? this.searchForm.toolInstanceId.trim() : undefined, |
|
|
|
wareHouseId: this.searchForm.wareHouseId ? this.searchForm.wareHouseId.trim() : undefined, |
|
|
|
locationId: this.searchForm.locationId ? this.searchForm.locationId.trim() : undefined, |
|
|
|
orderRef3: this.searchForm.orderRef3 ? this.searchForm.orderRef3.trim() : undefined, |
|
|
|
supplierId: this.searchForm.supplierId ? this.searchForm.supplierId : (this.searchForm.supplierName ? this.searchForm.supplierName.trim() : undefined), |
|
|
|
page: this.pageIndex, |
|
|
|
limit: this.pageSize |
|
|
|
} |
|
|
|
searchToolTransHeaderPage(payload).then(({ data }) => { |
|
|
|
searchToolTransMergePage(payload).then(({ data }) => { |
|
|
|
this.dataListLoading = false |
|
|
|
if (data && data.code === 0 && data.page) { |
|
|
|
this.headerList = data.page.list || [] |
|
|
|
this.headerTotal = data.page.totalCount |
|
|
|
this.dataList = data.page.list || [] |
|
|
|
this.total = data.page.totalCount |
|
|
|
} else { |
|
|
|
this.headerList = [] |
|
|
|
this.headerTotal = 0 |
|
|
|
this.dataList = [] |
|
|
|
this.total = 0 |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.dataListLoading = false |
|
|
|
this.$message.error('查询失败') |
|
|
|
}) |
|
|
|
}, |
|
|
|
headerSizeChange (val) { |
|
|
|
this.headerPageSize = val |
|
|
|
this.headerPageIndex = 1 |
|
|
|
this.searchHeader() |
|
|
|
sizeChange (val) { |
|
|
|
this.pageSize = val |
|
|
|
this.pageIndex = 1 |
|
|
|
this.search() |
|
|
|
}, |
|
|
|
headerCurrentChange (val) { |
|
|
|
this.headerPageIndex = val |
|
|
|
this.searchHeader() |
|
|
|
currentChange (val) { |
|
|
|
this.pageIndex = val |
|
|
|
this.search() |
|
|
|
}, |
|
|
|
|
|
|
|
/** 点击上方出入库记录时联动加载出入库明细 */ |
|
|
|
handleHeaderRowClick (row) { |
|
|
|
this.currentHeaderRow = row |
|
|
|
this.detailPageIndex = 1 |
|
|
|
this.queryDetail() |
|
|
|
}, |
|
|
|
/** 根据选中的出入库记录查询明细 */ |
|
|
|
queryDetail () { |
|
|
|
const row = this.currentHeaderRow |
|
|
|
if (!row || !row.transNo) { |
|
|
|
this.detailList = [] |
|
|
|
this.detailTotal = 0 |
|
|
|
return |
|
|
|
} |
|
|
|
this.dataListLoading = true |
|
|
|
const payload = { |
|
|
|
site: row.site ? String(row.site).trim() : undefined, |
|
|
|
transNo: row.transNo ? String(row.transNo).trim() : undefined, |
|
|
|
page: this.detailPageIndex, |
|
|
|
limit: this.detailPageSize |
|
|
|
} |
|
|
|
searchToolTransDetailPage(payload).then(({ data }) => { |
|
|
|
this.dataListLoading = false |
|
|
|
if (data && data.code === 0 && data.page) { |
|
|
|
this.detailList = data.page.list || [] |
|
|
|
this.detailTotal = data.page.totalCount |
|
|
|
} else { |
|
|
|
this.detailList = [] |
|
|
|
this.detailTotal = 0 |
|
|
|
/** 获取基础数据列表(供应商 tagNo=73) */ |
|
|
|
getBaseList (val) { |
|
|
|
this.tagNo = val |
|
|
|
this.$nextTick(() => { |
|
|
|
let strVal = '' |
|
|
|
if (val === 73) { |
|
|
|
strVal = this.searchForm.supplierId |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.dataListLoading = false |
|
|
|
this.$message.error('查询失败') |
|
|
|
this.$refs.baseList.init(val, strVal) |
|
|
|
}) |
|
|
|
}, |
|
|
|
detailSizeChange (val) { |
|
|
|
this.detailPageSize = val |
|
|
|
this.detailPageIndex = 1 |
|
|
|
this.queryDetail() |
|
|
|
/** 列表方法的回调 */ |
|
|
|
getBaseData (val) { |
|
|
|
if (this.tagNo === 73) { |
|
|
|
this.searchForm.supplierId = val.SupplierID || val.supplier_id || '' |
|
|
|
this.searchForm.supplierName = val.SupplierName || val.supplier_name || this.searchForm.supplierId |
|
|
|
} |
|
|
|
}, |
|
|
|
detailCurrentChange (val) { |
|
|
|
this.detailPageIndex = val |
|
|
|
this.queryDetail() |
|
|
|
/** 手动修改/清空供应商输入时,使已选 ID 失效(后端支持按输入内容模糊匹配编码或名称) */ |
|
|
|
onSupplierInput () { |
|
|
|
this.searchForm.supplierId = '' |
|
|
|
}, |
|
|
|
|
|
|
|
/** 动态导出列 */ |
|
|
|
headerFields () { |
|
|
|
return this.buildFields(this.headerColumnList) |
|
|
|
}, |
|
|
|
detailFields () { |
|
|
|
return this.buildFields(this.detailColumnList) |
|
|
|
mergeFields () { |
|
|
|
return this.buildFields(this.columnList) |
|
|
|
}, |
|
|
|
buildFields (columnList) { |
|
|
|
let json = '{' |
|
|
|
@ -329,11 +294,8 @@ mounted () { |
|
|
|
}, |
|
|
|
|
|
|
|
/** 导出当前页数据 */ |
|
|
|
createHeaderExportData () { |
|
|
|
return this.headerList |
|
|
|
}, |
|
|
|
createDetailExportData () { |
|
|
|
return this.detailList |
|
|
|
createExportData () { |
|
|
|
return this.dataList |
|
|
|
}, |
|
|
|
|
|
|
|
/** 导出文件名时间戳 */ |
|
|
|
|