2 changed files with 254 additions and 0 deletions
@ -0,0 +1,8 @@ |
|||||
|
/** |
||||
|
* 模具/工具实例查询 API - rqrq |
||||
|
*/ |
||||
|
import { createAPI } from '@/utils/httpRequest.js' |
||||
|
|
||||
|
// 模具实例分页查询 - rqrq
|
||||
|
export const searchToolInstancePage = data => |
||||
|
createAPI('/production/tool/searchToolInstancePage', 'post', data) |
||||
@ -0,0 +1,246 @@ |
|||||
|
<template> |
||||
|
<div class="mod-config yzz"> |
||||
|
<el-form label-position="top" style="margin-top: 1px; margin-left: 0px;"> |
||||
|
<el-form :inline="true" label-position="top" style="margin-top: 0px"> |
||||
|
<el-form-item label="工厂编码"> |
||||
|
<el-input v-model="searchData.site" style="width: 100px" clearable/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="工具编码"> |
||||
|
<el-input v-model="searchData.toolId" style="width: 140px" clearable/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="工具实例ID"> |
||||
|
<el-input v-model="searchData.toolInstanceId" style="width: 160px" clearable/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="库位"> |
||||
|
<el-input v-model="searchData.locationId" style="width: 120px" clearable/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="派工单号"> |
||||
|
<el-input v-model="searchData.lastSeqNoInput" style="width: 120px" clearable/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="生产订单号"> |
||||
|
<el-input v-model="searchData.lastOrderNo" style="width: 160px" clearable/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label=" "> |
||||
|
<el-button type="primary" @click="searchTable()" :loading="dataListLoading">查询</el-button> |
||||
|
<!-- rqrq - 与 cancelSfdc 相同:fields + fetch,列名仅在 columnList 维护 --> |
||||
|
<download-excel |
||||
|
:fields="fields()" |
||||
|
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-form> |
||||
|
|
||||
|
<el-table |
||||
|
:data="dataList" |
||||
|
:height="height" |
||||
|
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.slotKey === 'operator'" v-show="!item.columnHidden"> |
||||
|
{{ scope.row.operatorName }} |
||||
|
<span v-if="scope.row.operatorId" style="color:#909399">({{ scope.row.operatorId }})</span> |
||||
|
</span> |
||||
|
<span v-else-if="item.slotKey === 'percent'" v-show="!item.columnHidden"> |
||||
|
{{ scope.row.lifespanUsagePercent != null ? scope.row.lifespanUsagePercent : '-' }} |
||||
|
</span> |
||||
|
<span |
||||
|
v-else-if="item.slotKey === 'reminder'" |
||||
|
v-show="!item.columnHidden" |
||||
|
:style="{ color: scope.row.repairReminder ? '#E6A23C' : '' }"> |
||||
|
{{ scope.row.repairReminder || '-' }} |
||||
|
</span> |
||||
|
<span v-else-if="!item.columnHidden && !item.columnImage">{{ 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> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
/** |
||||
|
* 模具实例查询页面 - rqrq |
||||
|
*/ |
||||
|
import { searchToolInstancePage } from '@/api/production/tool.js' |
||||
|
|
||||
|
/** rqrq - 仅需在此维护列;columnList 由 computed 转为与 cancelSfdcForWareHouse 相同字段结构 */ |
||||
|
const TOOL_INSTANCE_COLUMN_SPECS = [ |
||||
|
{ prop: 'site', label: '工厂编码', width: 60, align: 'left', tooltip: true }, |
||||
|
{ prop: 'toolId', label: '工具编码', width: 80, align: 'left', tooltip: true }, |
||||
|
{ prop: 'toolInstanceId', label: '工具实例ID', width: 120, align: 'left', tooltip: true }, |
||||
|
{ prop: 'spec', label: '型号描述', width: 120, align: 'left', tooltip: true }, |
||||
|
{ prop: 'warehouseId', label: '默认仓库', width: 80, align: 'left' }, |
||||
|
{ prop: 'locationId', label: '库位号', width: 60, align: 'left' }, |
||||
|
{ prop: 'supplierName', label: '模具供应商', width: 140, align: 'left', tooltip: true }, |
||||
|
{ prop: 'lastOrderNo', label: '最后订单', width: 100, align: 'left', tooltip: true }, |
||||
|
{ prop: 'lastSeqNo', label: '最后派工单', width: 100, align: 'right' }, |
||||
|
{ prop: 'operatorCombo', label: '操作员', width: 80, align: 'left', tooltip: true, slotKey: 'operator' }, |
||||
|
{ prop: 'standardLifeQty', label: '标准寿命(次)', width: 100, align: 'right' }, |
||||
|
{ prop: 'cumulativeUseCount', label: '累计使用次数', width: 100, align: 'right' }, |
||||
|
{ prop: 'repairCount', label: '维修次数', width: 90, align: 'right' }, |
||||
|
{ prop: 'lifespanUsagePercent', label: '当前寿命(%)', width: 100, align: 'right', slotKey: 'percent' }, |
||||
|
{ prop: 'repairReminder', label: '维修提醒', width: 220, align: 'left', tooltip: true, slotKey: 'reminder' } |
||||
|
] |
||||
|
|
||||
|
export default { |
||||
|
name: 'toolInstanceQuery', |
||||
|
data () { |
||||
|
return { |
||||
|
height: 200, |
||||
|
dataListLoading: false, |
||||
|
dataList: [], |
||||
|
exportName: '模具实例查询' + this.getStrDate(), |
||||
|
searchData: { |
||||
|
site: '', |
||||
|
toolId: '', |
||||
|
toolInstanceId: '', |
||||
|
locationId: '', |
||||
|
lastSeqNoInput: '', |
||||
|
lastOrderNo: '' |
||||
|
}, |
||||
|
pageIndex: 1, |
||||
|
pageSize: 20, |
||||
|
totalPage: 0 |
||||
|
} |
||||
|
}, |
||||
|
computed: { |
||||
|
// rqrq - 声明方式对齐 cancelSfdcForWareHouse:tableId/columnProp/columnLabel/align 等与导出 fields() 一致 |
||||
|
columnList () { |
||||
|
const vm = this |
||||
|
return TOOL_INSTANCE_COLUMN_SPECS.map(spec => ({ |
||||
|
tableId: 'toolInstanceList', |
||||
|
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: spec.slotKey || '' |
||||
|
})) |
||||
|
} |
||||
|
}, |
||||
|
mounted () { |
||||
|
this.$nextTick(() => { |
||||
|
this.height = window.innerHeight - 280 |
||||
|
}) |
||||
|
this.searchTable() |
||||
|
}, |
||||
|
methods: { |
||||
|
searchTable () { |
||||
|
this.dataListLoading = true |
||||
|
const seqStr = String(this.searchData.lastSeqNoInput || '').trim() |
||||
|
const parsedSeq = seqStr === '' ? NaN : Number(seqStr) |
||||
|
const payload = { |
||||
|
site: this.searchData.site ? this.searchData.site.trim() : undefined, |
||||
|
toolId: this.searchData.toolId ? this.searchData.toolId.trim() : undefined, |
||||
|
toolInstanceId: this.searchData.toolInstanceId ? this.searchData.toolInstanceId.trim() : undefined, |
||||
|
locationId: this.searchData.locationId ? this.searchData.locationId.trim() : undefined, |
||||
|
lastOrderNo: this.searchData.lastOrderNo ? this.searchData.lastOrderNo.trim() : undefined, |
||||
|
page: this.pageIndex, |
||||
|
limit: this.pageSize |
||||
|
} |
||||
|
if (Number.isFinite(parsedSeq)) { |
||||
|
payload.lastSeqNo = parsedSeq |
||||
|
} |
||||
|
searchToolInstancePage(payload).then(({ data }) => { |
||||
|
this.dataListLoading = false |
||||
|
if (data && data.code === 0 && data.page) { |
||||
|
this.dataList = data.page.list || [] |
||||
|
this.totalPage = data.page.totalCount |
||||
|
} else { |
||||
|
this.dataList = [] |
||||
|
this.totalPage = 0 |
||||
|
} |
||||
|
}).catch(() => { |
||||
|
this.dataListLoading = false |
||||
|
this.$message.error('查询失败') |
||||
|
}) |
||||
|
}, |
||||
|
sizeChangeHandle (val) { |
||||
|
this.pageSize = val |
||||
|
this.pageIndex = 1 |
||||
|
this.searchTable() |
||||
|
}, |
||||
|
currentChangeHandle (val) { |
||||
|
this.pageIndex = val |
||||
|
this.searchTable() |
||||
|
}, |
||||
|
|
||||
|
/** rqrq - 动态导出列(与 cancelSfdcForWareHouse 相同实现) */ |
||||
|
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 += '}' |
||||
|
return eval('(' + json + ')') |
||||
|
}, |
||||
|
|
||||
|
/** rqrq - 导出当前页数据;补全表格/Excel 用到的派生字段,避免再写一套导出映射 */ |
||||
|
createExportData () { |
||||
|
return this.dataList.map(row => ({ |
||||
|
...row, |
||||
|
operatorCombo: [row.operatorName, row.operatorId ? '(' + row.operatorId + ')' : ''].filter(Boolean).join(' ').trim(), |
||||
|
lifespanUsagePercent: row.lifespanUsagePercent != null ? row.lifespanUsagePercent : '-', |
||||
|
repairReminder: row.repairReminder || '-' |
||||
|
})) |
||||
|
}, |
||||
|
|
||||
|
/** rqrq - 导出文件名时间戳(同 cancelSfdc) */ |
||||
|
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> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue