<template>
|
<GlobalWindow :title="title" width="1182px" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm">
|
<div style="min-width:1150px">
|
<el-form :model="form" ref="form" label-width="100px" label-suffix=":" inline>
|
<div style="margin-bottom:15px">
|
<span class="text-code">{{ form.procedureName + ' | ' + form.mmodel.name + ' ' + form.mmodel.code }}</span>
|
<!-- 0已创建、1已备料、2已完工检、3已检验、4已报工、、6已取消 -->
|
<span v-if="form.status == 0" style="background-color: #305ED5;" class="status-log">已创建</span>
|
<span v-else-if="form.status == 6" style="background-color: #BBBBBB;" class="status-log">已取消</span>
|
<span v-else style="background-color: #03AF76;" class="status-log">{{ form.status == 1 ? '已备料' : form.status == 2 ?
|
'已完工检' : form.status == 3 ? '已检验' : '已报工' }}</span>
|
<!-- <span v-if="form.status==3" style="background-color: #BBBBBB;" class="status-log">已取消</span> -->
|
</div>
|
<el-form-item label="工单编号" prop="workorderCode" class="count-style">
|
{{ form.code }}
|
</el-form-item>
|
<el-form-item label="生产日期" prop="proTime" class="count-style">
|
{{ form.planDate }}
|
</el-form-item>
|
<el-form-item label="生产批次号" prop="batch" class="count-style">
|
{{ form.batch }}
|
</el-form-item>
|
<!-- <el-form-item label="计划人员" prop="planUser" class="count-style" >
|
{{ form.planUser }}
|
</el-form-item>
|
<el-form-item label="计划日期" prop="planDate" class="count-style" >
|
{{ form.pmodel.createTime }}
|
</el-form-item> -->
|
<el-form-item label="生产数量" prop="machine" class="count-style">
|
{{ form.planNum ? (form.planNum + (form.umodel.name ? form.umodel.name : '')) : '0' }}
|
</el-form-item>
|
<!-- <el-form-item label="计划数量" prop="planNum" class="count-style" >
|
{{ form.pmodel.num }}
|
</el-form-item> -->
|
<el-form-item label="工单来源" prop="origin" class="count-style">
|
{{ originToStr(form.originId) }}
|
</el-form-item>
|
<!-- <el-form-item label="发布日期" prop="startDate" class="count-style" >
|
{{ form.pmodel.publishDate }}
|
</el-form-item> -->
|
<el-form-item label="原工单号" prop="originWorkorderId" class="count-style">
|
{{ form.originWorkorderId }}
|
</el-form-item>
|
<el-form-item label="分配人员" prop="distributeUser" class="count-style">
|
{{ form.userName }}
|
</el-form-item>
|
<el-form-item label="分配时间" prop="distributeTime" class="count-style">
|
{{ form.createTime }}
|
</el-form-item>
|
<el-form-item label="生产人员" prop="proUser" class="count-style">
|
|
<div v-for="(item, index) in form.proUserList" :key="index">{{ item.proUserDepartName }}</div>
|
<!-- {{ form.proUserName + (form.proUserDepartName ? ('/' + form.proUserDepartName) : '') }} -->
|
</el-form-item>
|
<el-form-item label="生产设备" prop="machine" class="count-style">
|
{{ form.pgmodel && `【${form.pgmodel.code}】${form.pgmodel.name}` }}
|
</el-form-item>
|
|
<el-form-item label="合格数量" prop="qualifiedNum" class="count-style">
|
{{ form.qualifiedNum ? (form.qualifiedNum + (form.umodel.name ? form.umodel.name : '')) : '0' }}
|
</el-form-item>
|
<el-form-item label="不良数量" prop="unqualifiedNum" class="count-style">
|
{{ form.unqualifiedNum ? (form.unqualifiedNum + (form.umodel.name ? form.umodel.name : '')) : '0' }}
|
</el-form-item>
|
</el-form>
|
<!-- 表格和分页 -->
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
<el-tab-pane label="生产报工" name="first">
|
<el-table v-loading="isSearch" :data="report" border show-summary :summary-method="getReportSummaries">
|
<!-- stripe -->
|
<el-table-column prop="createTime" label="报工时间" min-width="140px"></el-table-column>
|
<el-table-column label="生产人员" show-overflow-tooltip min-width="100px">
|
<template slot-scope="{row}">
|
<span class="long-title-style">{{ row.procedureName }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="machine" label="生产设备" min-width="100px">
|
{{ form.pgmodel && `【${form.pgmodel.code}】${form.pgmodel.name}` }}
|
</el-table-column>
|
<!-- <el-table-column prop="amodel.code" label="工装容器编号" show-overflow-tooltip="" min-width="100px"></el-table-column> -->
|
<el-table-column prop="mmodel.name" label="物料名称" show-overflow-tooltip min-width="100px"></el-table-column>
|
<el-table-column prop="qualifiedNum" label="合格数量" min-width="100px">
|
<template slot-scope="{row}">
|
<span class="valid-style">{{ row.qualifiedNum + row.umodel.name }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="unqualifiedNum" label="不良数量" min-width="100px">
|
<template slot-scope="{row}">
|
<span class="unvalid-style">{{ row.unqualifiedNum + row.umodel.name }}</span>
|
<!-- <span :class="row.materialDonetype==0 ? 'valid-style' : ''">{{ row.num + row.umodel.name }}</span> -->
|
</template>
|
</el-table-column>
|
<el-table-column prop="num" label="报工数量" min-width="100px">
|
<template slot-scope="{row}">
|
<span>{{ row.num + row.umodel.name }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="duration" label="报工时长" min-width="100px">
|
<template slot-scope="{row}">
|
<span>{{ timesToStr(row.duration) }}</span>
|
</template>
|
</el-table-column>
|
<!-- <el-table-column prop="doneType" label="报工类型" min-width="60px">
|
<template slot-scope="{row}">
|
<span v-if="row.doneType==0" class="valid-style">合格</span>
|
<span v-else-if="row.doneType==1" class="unvalid-style">不良</span>
|
<span v-else-if="row.doneType==2" class="scrap-style">报废</span>
|
<span v-else>-</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="num" label="生产数量" show-overflow-tooltip min-width="100px">
|
<template slot-scope="{row}">
|
<span :class="row.doneType==0 ? 'valid-style' : (row.doneType==1 ? 'unvalid-style' :(row.doneType==2 ? 'scrap-style' : ''))">{{ row.num ? (row.num + (row.umodel.name ? row.umodel.name : '')) : '0' }}</span>
|
</template>
|
</el-table-column> -->
|
</el-table>
|
</el-tab-pane>
|
<el-tab-pane label="生产检验" name="second">
|
<el-table v-loading="isSearch" :data="verify" stripe border>
|
<el-table-column prop="code" label="检验记录编号" min-width="140px"></el-table-column>
|
<el-table-column prop="createTime" label="检验时间" min-width="140px"></el-table-column>
|
<el-table-column prop="smodelRealName" label="检验人员" min-width="100px"></el-table-column>
|
<el-table-column prop="num" label="生产数量" min-width="100px">
|
<template slot-scope="{row}">
|
<!-- {{ row.num + row.umodel.name }} -->
|
{{ row.num ? (row.num + (row.umodel.name ? row.umodel.name : '')) : '0' }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="qualifiedNum" label="合格数量" min-width="100px">
|
<template slot-scope="{row}">
|
{{ row.qualifiedNum ? (row.qualifiedNum + (row.umodel.name ? row.umodel.name : '')) : '0' }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="unqualifiedNum" label="不良数量" min-width="100px">
|
<template slot-scope="{row}">
|
{{ row.unqualifiedNum ? (row.unqualifiedNum + (row.umodel.name ? row.umodel.name : '')) : '0' }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="verifyType" label="检验类型" min-width="100px">
|
<template slot-scope="{row}">
|
<!-- 0巡线、1巡检、2终检 -->
|
{{ row.checkType == 0 ? '巡线' : row.checkType == 1 ? '巡检' : '完工检' }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="devmodel.code" label="生产设备" min-width="100px">
|
<template slot-scope="{row}">
|
{{ row.devmodel && `【${row.devmodel.code}】${row.devmodel.name}` }}
|
</template>
|
</el-table-column>
|
<!-- <el-table-column prop="proUserids" label="生产人员" show-overflow-tooltip min-width="100px"></el-table-column> -->
|
</el-table>
|
</el-tab-pane>
|
<el-tab-pane label="生产投料" name="third">
|
<el-table v-loading="isSearch" :data="feeds" stripe border show-summary :summary-method="getPutSummaries">
|
<el-table-column prop="createTime" label="投料时间" min-width="140px"></el-table-column>
|
<!-- <el-table-column prop="amodel.code" label="工装容器编号" min-width="100px"></el-table-column> -->
|
<el-table-column prop="mmodel.name" label="物料名称" min-width="100px"></el-table-column>
|
<el-table-column prop="promodel.name" label="工序名称" min-width="100px"></el-table-column>
|
<el-table-column label="质量属性" min-width="100px">
|
<template slot-scope="{row}">
|
<span v-if="row.materialDonetype == 0" class="valid-style">合格</span>
|
<span v-else-if="row.materialDonetype == 1" class="unvalid-style">不良</span>
|
<span v-else-if="row.materialDonetype == 2" class="scrap-style">报废</span>
|
<span v-else>-</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="num" label="投入数量" min-width="100px">
|
<template slot-scope="{row}">
|
{{ row.num ? (row.num + (row.umodel.name ? row.umodel.name : '')) : '0' }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="proUserids" label="投料人员" min-width="100px">
|
<template slot-scope="{row}">
|
<span class="long-title-style">{{ row.procedureName }}</span>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-tab-pane>
|
<el-tab-pane label="生产点检" name="fourth">
|
<el-table v-loading="isSearch" :data="check" stripe border>
|
<el-table-column prop="createTime" label="记录时间" min-width="140px"></el-table-column>
|
<el-table-column prop="userName" label="操作人员" min-width="100px"></el-table-column>
|
<el-table-column prop="attrName" label="检点属性" min-width="100px"></el-table-column>
|
<el-table-column prop="val" label="检点属性值" min-width="100px"></el-table-column>
|
</el-table>
|
<!-- <el-table
|
:show-header="false"
|
:data="check"
|
:cell-style="columnStyle"
|
style="width: 100%; margin-top: 20px"
|
>
|
<el-table-column prop="name" width="140px" align="right">
|
<template slot-scope="{row}">
|
{{ row.name + ':' }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="value" align="left"></el-table-column>
|
</el-table> -->
|
</el-tab-pane>
|
<Pagination style="margin-top:10px" @size-change="handleSizeChange" @current-change="handlePageChange"
|
:pagination="pagination"></Pagination>
|
</el-tabs>
|
</div>
|
<div slot="footer" class="window__header">
|
<el-button type="primary" @click="cancel">返回</el-button>
|
</div>
|
</GlobalWindow>
|
</template>
|
|
<script>
|
import BaseOpera from '@/components/base/BaseOpera'
|
import GlobalWindow from '@/components/common/GlobalWindow'
|
import Pagination from '@/components/common/Pagination'
|
import { fetchList as workorderCheck } from '@/api/ext/workorderCheckExt'
|
import { workorderRecordExtPage, workorderCheckAttrExttPage } from '@/api/ext/workorderExt'
|
import { addPrecision } from '@/utils/util'
|
|
export default {
|
name: 'OperaWorkorderDetailWindow',
|
extends: BaseOpera,
|
components: { GlobalWindow, Pagination },
|
data() {
|
return {
|
// 表单数据
|
form: {
|
id: null,
|
code: null,
|
planNum: null,
|
batch: null,
|
createTime: null, // 分配日期
|
planDate: null, // 生产日期
|
procedureName: null, // 工序名称
|
proUserName: null,
|
originId: null,
|
status: null,
|
startDate: null,
|
originWorkorderId: null,
|
userName: null,
|
distributeTime: null,
|
pgmodel: {},
|
mmodel: {},
|
pmodel: {},
|
umodel: {},
|
proTime: null,
|
num: null,
|
qualifiedNum: null,
|
unqualifiedNum: null,
|
proUserList: []
|
},
|
// 验证规则
|
rules: {
|
},
|
activeName: 'first',
|
isSearch: false,
|
pagination: {
|
pageIndex: 1,
|
pageSize: 10,
|
total: 1
|
},
|
// origins: [],
|
status: [
|
// 0已分配、1已领料、2已完工检、3已检验、4已返工、5已入库、6已暂停、7已取消、8已关闭
|
{ name: '已分配', id: 0 },
|
{ name: '已领料', id: 1 },
|
{ name: '已完工检', id: 2 },
|
{ name: '已检验', id: 3 },
|
{ name: '已返工', id: 4 },
|
{ name: '已入库', id: 5 },
|
{ name: '已暂停', id: 6 },
|
{ name: '已取消', id: 7 },
|
{ name: '已关闭', id: 8 }
|
],
|
report: [],
|
verify: [],
|
feeds: [],
|
check: []
|
}
|
},
|
inject: ['origins'],
|
created() {
|
this.config({
|
api: '/ext/materialExt',
|
'field.id': 'id'
|
})
|
// queryListByCode('?dicCode=WORKORDER_SOURCE')
|
// .then(res => {
|
// // console.log(res)
|
// this.origins = res
|
// })
|
// .catch(err => {
|
// console.log(err)
|
// })
|
},
|
methods: {
|
open(title, target) {
|
this.title = title
|
this.visible = true
|
this.activeName = 'first',
|
// 编辑
|
this.$nextTick(() => {
|
for (const key in this.form) {
|
this.form[key] = target[key]
|
}
|
// console.log('this.form', this.form)
|
workorderRecordExtPage(
|
{
|
capacity: this.pagination.pageSize,
|
model: {
|
type: 1,
|
workorderId: this.form.id
|
},
|
page: this.pagination.pageIndex,
|
sorts: null
|
})
|
.then(res => {
|
// console.log(res)
|
this.report = res.records
|
this.pagination.pageIndex = res.page
|
this.pagination.total = res.total
|
this.pagination.pageSize = res.capacity
|
})
|
.catch(err => {
|
console.log(err)
|
})
|
})
|
},
|
cancel() {
|
this.$refs.form.resetFields()
|
this.activeName = 'first'
|
this.pagination.pageIndex = 1
|
this.pagination.pageSize = 10
|
this.pagination.total = 0
|
this.visible = false
|
},
|
statusToStr(status) {
|
for (const item of this.status) {
|
if (item.id === status) {
|
return item.name
|
}
|
}
|
},
|
originToStr(id) {
|
for (const item of this.origins()) {
|
if (item.id === id) {
|
return item.code
|
}
|
}
|
},
|
columnStyle({ row, column, rowIndex, columnIndex }) {
|
if (rowIndex % 2 === 0) {
|
// 修改每行第一个单元格的背景色
|
return 'background:#f3f6fc;'
|
} else {
|
return 'background:#ffffff;'
|
}
|
},
|
handleClick(tab, event) {
|
this.pagination.pageIndex = 1
|
this.pagination.pageSize = 10
|
this.pagination.total = 0
|
this.search()
|
},
|
handleSizeChange(pageSize) {
|
this.pagination.pageSize = pageSize
|
this.search()
|
},
|
handlePageChange(pageIndex) {
|
this.pagination.pageIndex = pageIndex
|
// console.log('获取数据')
|
this.search()
|
},
|
search() {
|
if (this.activeName === 'first') {
|
workorderRecordExtPage(
|
{
|
capacity: this.pagination.pageSize,
|
model: {
|
type: 1,
|
workorderId: this.form.id
|
},
|
page: this.pagination.pageIndex,
|
sorts: [{ direction: "DESC", property: "CREATE_TIME" }]
|
})
|
.then(res => {
|
// console.log(res)
|
this.report = res.records
|
this.pagination.pageIndex = res.page
|
this.pagination.total = res.total
|
this.pagination.pageSize = res.capacity
|
})
|
.catch(err => {
|
this.$tip.error(err)
|
})
|
} else if (this.activeName === 'second') {
|
workorderCheck({
|
capacity: this.pagination.pageSize,
|
model: {
|
workorderId: this.form.id
|
},
|
page: this.pagination.pageIndex,
|
sorts: [{ direction: "DESC", property: "CREATE_TIME" }]
|
})
|
.then(res => {
|
// console.log(res.records)
|
this.verify = res.records
|
this.pagination.pageIndex = res.page
|
this.pagination.total = res.total
|
this.pagination.pageSize = res.capacity
|
})
|
.catch(err => {
|
this.$tip.error(err)
|
})
|
} else if (this.activeName === 'third') {
|
workorderRecordExtPage(
|
{
|
capacity: this.pagination.pageSize,
|
model: {
|
type: 0,
|
workorderId: this.form.id
|
},
|
page: this.pagination.pageIndex,
|
sorts: [{ direction: "DESC", property: "CREATE_TIME" }]
|
})
|
.then(res => {
|
// console.log(res)
|
this.feeds = res.records
|
this.pagination.pageIndex = res.page
|
this.pagination.total = res.total
|
this.pagination.pageSize = res.capacity
|
})
|
.catch(err => {
|
this.$tip.error(err)
|
})
|
} else {
|
workorderCheckAttrExttPage(
|
{
|
capacity: this.pagination.pageSize,
|
model: {
|
workorderId: this.form.id
|
},
|
page: this.pagination.pageIndex,
|
sorts: [{ direction: "DESC", property: "CREATE_TIME" }]
|
})
|
.then(res => {
|
// console.log(res)
|
this.check = res.records
|
this.pagination.pageIndex = res.page
|
this.pagination.total = res.total
|
this.pagination.pageSize = res.capacity
|
})
|
.catch(err => {
|
this.$tip.error(err)
|
})
|
}
|
},
|
getPutSummaries(param) {
|
const { columns, data } = param;
|
const sums = [];
|
columns.forEach((column, index) => {
|
if (index === 0) {
|
sums[index] = '合计';
|
return;
|
} else if (index === 3) {
|
sums[index] = '-';
|
return;
|
} else if (index === 5) {
|
sums[index] = '-';
|
return;
|
}
|
const values = data.map(item => Number(item[column.property]));
|
if (!values.every(value => isNaN(value))) {
|
sums[index] = 0
|
values.forEach(item => {
|
sums[index] = addPrecision(item, sums[index])
|
})
|
} else {
|
sums[index] = '-';
|
}
|
});
|
return sums
|
},
|
getReportSummaries(param) {
|
const { columns, data } = param;
|
const sums = [];
|
columns.forEach((column, index) => {
|
if (index === 0) {
|
sums[index] = '合计';
|
return;
|
}
|
const values = data.map(item => Number(item[column.property]));
|
if (!values.every(value => isNaN(value))) {
|
sums[index] = 0
|
values.forEach(item => {
|
sums[index] = addPrecision(item, sums[index])
|
})
|
if (index===7) {
|
sums[index] = this.timesToStr(sums[index])
|
}
|
} else {
|
sums[index] = '-';
|
}
|
});
|
return sums
|
},
|
timesToStr(times) {
|
if (times==0||!times) {
|
return '-'
|
}
|
// let sec = times%60
|
let lesMin = Math.floor(times/60)
|
let min = lesMin%60
|
let hours = Math.floor(lesMin/60)
|
return `${hours}时${min}分`
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.count-style {
|
display: inline-block;
|
width: 23%;
|
// height: 32px;
|
}
|
|
::v-deep .el-form-item {
|
margin-bottom: 8px !important;
|
}
|
|
.text-code {
|
color: #333;
|
font-weight: 500;
|
padding-right: 15px;
|
font-size: 15px;
|
vertical-align: middle;
|
}
|
|
.status-log {
|
padding: 1px 5px;
|
border-radius: 3px;
|
font-size: 12px;
|
color: #fff;
|
vertical-align: middle;
|
}
|
</style>
|