You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
326 lines
11 KiB
326 lines
11 KiB
<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="searchForm.site" style="width: 100px" clearable/>
|
|
</el-form-item>
|
|
<el-form-item label="出入库单号">
|
|
<el-input v-model="searchForm.transNo" style="width: 160px" clearable/>
|
|
</el-form-item>
|
|
<el-form-item label="出入库类型">
|
|
<el-select v-model="searchForm.transType" style="width: 160px" clearable placeholder="全部">
|
|
<el-option label="全部" value=""/>
|
|
<el-option
|
|
v-for="item in transTypeOptions"
|
|
:key="item"
|
|
:label="item"
|
|
: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="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="search()" :loading="dataListLoading">查询</el-button>
|
|
<!-- 导出功能 -->
|
|
<!--download-excel
|
|
:fields="mergeFields()"
|
|
type="xls"
|
|
:name="exportName"
|
|
:fetch="createExportData"
|
|
worksheet="导出信息"
|
|
class="el-button el-button--primary el-button--medium"
|
|
style="margin-left: 8px;">
|
|
导出
|
|
</download-excel-->
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<el-table
|
|
:data="dataList"
|
|
:height="tableHeight"
|
|
border
|
|
highlight-current-row
|
|
v-loading="dataListLoading"
|
|
style="width: 100%;">
|
|
<el-table-column
|
|
v-for="(item,index) in columnList"
|
|
: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="sizeChange"
|
|
@current-change="currentChange"
|
|
:current-page="pageIndex"
|
|
:page-sizes="[20, 50, 100]"
|
|
:page-size="pageSize"
|
|
:total="total"
|
|
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) 合并为一个列表显示
|
|
*/
|
|
import {
|
|
searchToolTransMergePage,
|
|
searchToolTransTypeList
|
|
} from '@/api/production/tool.js'
|
|
import Chooselist from '@/views/modules/common/Chooselist'
|
|
|
|
/** 合并列表列(单头字段 + 明细字段) */
|
|
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: '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 }
|
|
]
|
|
|
|
/** 列配置转为与 cancelSfdcForWareHouse 相同的字段结构 */
|
|
function buildColumnList (specs, tableId, vm) {
|
|
return specs.map(spec => ({
|
|
tableId: tableId,
|
|
tableName: vm.$route.meta.title,
|
|
columnProp: spec.prop,
|
|
columnLabel: spec.label,
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
columnWidth: spec.width,
|
|
format: null,
|
|
functionId: vm.$route.meta.menuId,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
serialNumber: null,
|
|
columnType: null,
|
|
align: spec.align || 'left',
|
|
showOverflowTooltip: !!spec.tooltip,
|
|
slotKey: ''
|
|
}))
|
|
}
|
|
|
|
export default {
|
|
name: 'toolInventoryLog',
|
|
components: {
|
|
Chooselist
|
|
},
|
|
data () {
|
|
return {
|
|
tableHeight: 400,
|
|
dataListLoading: false,
|
|
|
|
// 当前打开的基础列表 tagNo(回调分发用)
|
|
tagNo: 0,
|
|
|
|
// 出入库类型下拉选项
|
|
transTypeOptions: [],
|
|
|
|
// 合并列表查询条件
|
|
searchForm: {
|
|
site: '',
|
|
transNo: '',
|
|
transType: '',
|
|
direction: '',
|
|
receiver: '',
|
|
toolInstanceId: '',
|
|
wareHouseId: '',
|
|
locationId: '',
|
|
orderRef3: '',
|
|
supplierId: '',
|
|
supplierName: ''
|
|
},
|
|
dataList: [],
|
|
pageIndex: 1,
|
|
pageSize: 20,
|
|
total: 0,
|
|
exportName: '工具出入库记录' + this.getStrDate()
|
|
}
|
|
},
|
|
computed: {
|
|
columnList () {
|
|
return buildColumnList(MERGE_COLUMN_SPECS, 'toolTransMergeList', this)
|
|
}
|
|
},
|
|
mounted () {
|
|
this.loadTransTypeOptions()
|
|
this.$nextTick(() => {
|
|
this.tableHeight = window.innerHeight - 300
|
|
})
|
|
},
|
|
methods: {
|
|
/** 加载出入库类型下拉 */
|
|
loadTransTypeOptions () {
|
|
searchToolTransTypeList({}).then(({ data }) => {
|
|
if (data && data.code === 0) {
|
|
this.transTypeOptions = data.list || []
|
|
}
|
|
}).catch(() => {
|
|
this.transTypeOptions = []
|
|
})
|
|
},
|
|
/** 查询出入库记录(单头 + 明细合并) */
|
|
search () {
|
|
this.dataListLoading = true
|
|
const payload = {
|
|
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
|
|
}
|
|
searchToolTransMergePage(payload).then(({ data }) => {
|
|
this.dataListLoading = false
|
|
if (data && data.code === 0 && data.page) {
|
|
this.dataList = data.page.list || []
|
|
this.total = data.page.totalCount
|
|
} else {
|
|
this.dataList = []
|
|
this.total = 0
|
|
}
|
|
}).catch(() => {
|
|
this.dataListLoading = false
|
|
this.$message.error('查询失败')
|
|
})
|
|
},
|
|
sizeChange (val) {
|
|
this.pageSize = val
|
|
this.pageIndex = 1
|
|
this.search()
|
|
},
|
|
currentChange (val) {
|
|
this.pageIndex = val
|
|
this.search()
|
|
},
|
|
|
|
/** 获取基础数据列表(供应商 tagNo=73) */
|
|
getBaseList (val) {
|
|
this.tagNo = val
|
|
this.$nextTick(() => {
|
|
let strVal = ''
|
|
if (val === 73) {
|
|
strVal = this.searchForm.supplierId
|
|
}
|
|
this.$refs.baseList.init(val, strVal)
|
|
})
|
|
},
|
|
/** 列表方法的回调 */
|
|
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
|
|
}
|
|
},
|
|
/** 手动修改/清空供应商输入时,使已选 ID 失效(后端支持按输入内容模糊匹配编码或名称) */
|
|
onSupplierInput () {
|
|
this.searchForm.supplierId = ''
|
|
},
|
|
|
|
/** 动态导出列 */
|
|
mergeFields () {
|
|
return this.buildFields(this.columnList)
|
|
},
|
|
buildFields (columnList) {
|
|
let json = '{'
|
|
columnList.forEach((item, index) => {
|
|
json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + (index === columnList.length - 1 ? '' : ',')
|
|
})
|
|
json += '}'
|
|
return eval('(' + json + ')')
|
|
},
|
|
|
|
/** 导出当前页数据 */
|
|
createExportData () {
|
|
return this.dataList
|
|
},
|
|
|
|
/** 导出文件名时间戳 */
|
|
getStrDate () {
|
|
const dd = new Date()
|
|
const Y = dd.getFullYear()
|
|
const M = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1)
|
|
const D = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate()
|
|
const H = dd.getHours() < 10 ? '0' + dd.getHours() : dd.getHours()
|
|
const MM = dd.getMinutes() < 10 ? '0' + dd.getMinutes() : dd.getMinutes()
|
|
const S = dd.getSeconds() < 10 ? '0' + dd.getSeconds() : dd.getSeconds()
|
|
return Y + '' + M + D + H + MM + S
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.trans-section {
|
|
border: 1px solid #e4e7ed;
|
|
padding: 10px 10px 6px 10px;
|
|
}
|
|
.section-title {
|
|
margin: 0 0 6px 0;
|
|
font-size: 16px;
|
|
font-weight: bold;
|
|
}
|
|
</style>
|