<template>
|
<view>
|
<view class="uni-container">
|
|
<view class="headTitle">浙江优步体育用品股份有限公司工序SOP</view>
|
|
|
<uni-forms ref="form" :modelValue="form" class="headForm">
|
<uni-forms-item label="车间名称" label-width='100' class="headFormItem">
|
<uni-data-select v-model="form.wkshopcode" @clear='search' :localdata="wkshopcodeArr"
|
@change="val=>search(val,'wkshopcode')"></uni-data-select>
|
<!-- <uni-easyinput type="text" v-model="form.wkshopcode" placeholder="请输入" @change='search'
|
@clear="search" /> -->
|
</uni-forms-item>
|
<uni-forms-item label="工单编号" label-width='100' class="headFormItem">
|
<uni-easyinput v-model="form.mesordercode" type="text" placeholder="请输入" @change='search'
|
@clear="search" />
|
</uni-forms-item>
|
<uni-forms-item label="源单单号" label-width='100' class="headFormItem">
|
<uni-easyinput v-model="form.sourceorder" type="text" placeholder="请输入" @change='search'
|
@clear="search" />
|
</uni-forms-item>
|
<uni-forms-item label="销售订单" label-width='100' class="headFormItem">
|
<uni-easyinput v-model="form.saleordercode" type="text" placeholder="请输入" @change='search'
|
@clear="search" />
|
</uni-forms-item>
|
<uni-forms-item label="产品编码" label-width='100' class="headFormItem">
|
<uni-easyinput v-model="form.partcode" type="text" placeholder="请输入" @change='search'
|
@clear="search" />
|
</uni-forms-item>
|
<uni-forms-item label="产品名称" label-width='100' class="headFormItem">
|
<uni-easyinput v-model="form.partname" type="text" placeholder="请输入" @change='search'
|
@clear="search" />
|
</uni-forms-item>
|
</uni-forms>
|
|
<uni-table ref="table" :loading="loading" border stripe emptyText="暂无更多数据" style="height: 52vh;">
|
<!-- @selection-change="selectionChange" type="selection" -->
|
<uni-tr>
|
<uni-th width="80" align="center">序号</uni-th>
|
<uni-th width="150" align="center">生产车间</uni-th>
|
<uni-th width="150" align="center">工单编号</uni-th>
|
<uni-th width="150" align="center">源单编号</uni-th>
|
<uni-th width="150" align="center">销售订单</uni-th>
|
<uni-th width="150" align="center">产品编码</uni-th>
|
<uni-th width="150" align="center">产品名称</uni-th>
|
<uni-th width="150" align="center">产品规格</uni-th>
|
<uni-th width="150" align="center">工艺路线</uni-th>
|
<uni-th width="150" align="center">工单数</uni-th>
|
<uni-th width="204" align="center">操作</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in tableData" :key="index">
|
<uni-td>{{ item.rowNum }}</uni-td>
|
<uni-td>
|
<!-- <view class="name">{{ item.wkshp_name }}</view> -->
|
{{ item.wkshp_name?item.wkshp_name:'/' }}
|
</uni-td>
|
<uni-td align="center">{{ item.wo_code? item.wo_code:'/' }}</uni-td>
|
<uni-td align="center">{{ item.m_po?item.m_po:'/' }}</uni-td>
|
<uni-td align="center">{{ item.saleOrderCode?item.saleOrderCode:'/' }}</uni-td>
|
<uni-td align="center">{{ item.partcode?item.partcode:'/' }}</uni-td>
|
<uni-td align="center">{{ item.partname? item.partname:'/' }}</uni-td>
|
<uni-td align="center">{{ item.partspec ? item.partspec:'/'}}</uni-td>
|
<uni-td align="center">{{ item.route_name? item.route_name:'/' }}</uni-td>
|
<uni-td align="center">{{ item.plan_qty? item.plan_qty:'/' }}</uni-td>
|
|
<uni-td>
|
<view class="uni-group">
|
<button class="uni-button" size="mini" type="primary" @click="trClick(item)">选择工单</button>
|
<!-- <button class="uni-button" size="mini" type="warn">删除</button> -->
|
</view>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
|
<view class="uni-pagination-box"><uni-pagination show-icon :page-size="form.rows" :current="form.page"
|
:total="total" @change="change" /></view>
|
|
|
|
<uni-table ref="table2" :loading="loading2" border stripe emptyText="请先选择工单" style="height: 28vh;">
|
<!-- @selection-change="selectionChange" type="selection" -->
|
<uni-tr>
|
<uni-th width="80" align="center">序号</uni-th>
|
|
<uni-th width="150" align="center">工序编码</uni-th>
|
<uni-th width="150" align="center">工序名称</uni-th>
|
<uni-th width="150" align="center">已生产数量</uni-th>
|
<uni-th width="150" align="center">合格数量</uni-th>
|
<uni-th width="150" align="center">不良数量</uni-th>
|
<uni-th width="150" align="center">工废数量</uni-th>
|
<uni-th width="150" align="center">料废数量</uni-th>
|
<uni-th width="150" align="center">总可报数量</uni-th>
|
<uni-th width="150" align="center">待产数量</uni-th>
|
<uni-th width="204" align="center">sop预览</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in sopTableData" :key="index">
|
<uni-td>{{ item.seq }}</uni-td>
|
|
<uni-td> {{ item.step_code}} </uni-td>
|
<uni-td align="center">{{ item.stepname }}</uni-td>
|
<uni-td align="center">{{ item.produceq_qty }}</uni-td>
|
<uni-td align="center">{{ item.good_qty}}</uni-td>
|
<uni-td align="center">{{ item.ng_qty }}</uni-td>
|
<uni-td align="center">{{ item.laborbad_qty }}</uni-td>
|
<uni-td align="center">{{ item.materielbad_qty }}</uni-td>
|
<uni-td align="center">{{ item.plan_qty }}</uni-td>
|
<uni-td align="center">{{ item.delive_qty }}</uni-td>
|
|
<uni-td>
|
<view class="uni-group">
|
<button class="uni-button" size="mini" type="primary" @click="sopClick(item)">工序预览</button>
|
<!-- <button class="uni-button" size="mini" type="warn">删除</button> -->
|
</view>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
SopSearchMesOrderSearch,
|
SopSearchUpdateMesOrderStepSearch,
|
SopSearchMesOrderProcessSopSearch,
|
PrentOrganizationNoCompany
|
} from '../../config/api.js';
|
|
export default {
|
data() {
|
return {
|
tableData: [],
|
// 数据总量
|
total: 0,
|
loading: false,
|
loading2: false,
|
form: {
|
wkshopcode: '', // 车间编码
|
mesorderstus: '', // 工单状态码
|
mesordercode: '', // 工单编号
|
partcode: '', // 产品编码
|
ordertype: '', // ordertype
|
sourceorder: '', // 源单单号
|
saleordercode: '', // 销售订单
|
partname: '', // 产品名称
|
partspec: '', // 产品规格
|
creatuser: '', // 创建人员
|
datatype: 'ED', // 日期类型(计划开工(PS)、计划完工(PE)、预计交付(ED)、创建日期(CT))
|
timeValue: [], // 查询日期
|
prop: 'lm_date', // 排序字段
|
order: 'desc', // 排序字段
|
page: 1, // 第几页
|
rows: 15 // 每页多少条
|
},
|
sopTableData: [],
|
wkshopcodeArr: [],
|
rowData: {} // 行点击事件存储值
|
|
}
|
},
|
onLoad() {
|
// this.selectedIndexs = []
|
this.getData(1)
|
},
|
mounted() {
|
this.getPrentOrganizationNoCompany()
|
},
|
methods: {
|
async getPrentOrganizationNoCompany() {
|
const res = await PrentOrganizationNoCompany()
|
this.wkshopcodeArr = res.data.map(({
|
torg_name,
|
torg_code
|
}) => ({
|
text: torg_name,
|
value: torg_code
|
}))
|
},
|
|
// // 多选处理
|
// selectedItems() {
|
// return this.selectedIndexs.map(i => this.tableData[i])
|
// },
|
// // 多选
|
// selectionChange(e) {
|
// console.log(e.detail.index)
|
// this.selectedIndexs = e.detail.index
|
// },
|
// //批量删除
|
// delTable() {
|
// console.log(this.selectedItems())
|
// },
|
|
// 选择工单
|
trClick(row) {
|
this.rowData = row
|
const data = {
|
sourceid: row.sourceid,
|
sourcewo: row.m_po,
|
wocode: row.wo_code,
|
data_sources: row.data_sources
|
}
|
this.loading2 = true
|
SopSearchUpdateMesOrderStepSearch(data).then(res => {
|
this.sopTableData = res.data.stepdata
|
this.loading2 = false
|
})
|
},
|
// 工序预览
|
async sopClick(row) {
|
|
const data = {
|
materielcode: this.rowData.partcode,
|
routecode: this.rowData.route_code,
|
stepcode: row.step_code
|
}
|
|
const {
|
data: res
|
} = await SopSearchMesOrderProcessSopSearch(data)
|
// console.log(res)
|
|
if (res.length === 0) {
|
return uni.$u.toast('此工序未上传sop,请先上传!')
|
} else {
|
// 跳转到sop页面,且传入sop信息和工单信息
|
const rowData = {
|
wo_code: this.rowData.wo_code,
|
partname: this.rowData.partname
|
}
|
uni.navigateTo({
|
url: './sop?sopArr=' + JSON.stringify(res) + '&mesOrderObj=' + JSON.stringify(rowData)
|
});
|
}
|
|
|
|
|
|
},
|
// 分页触发
|
change(e) {
|
// this.$refs.table.clearSelection()
|
// this.selectedIndexs.length = 0
|
this.getData(e.current)
|
},
|
// 搜索
|
search(val, type) {
|
if (type === 'wkshopcode') {
|
this.form.wkshopcode = val
|
}
|
this.getData(1)
|
},
|
// 获取数据
|
getData(pageCurrent) {
|
this.loading = true
|
this.form.page = pageCurrent
|
|
const data = {
|
wkshopcode: this.form.wkshopcode,
|
mesorderstus: this.form.mesorderstus, // 工单状态码
|
mesordercode: this.form.mesordercode, // 工单编号
|
partcode: this.form.partcode, // 产品编码
|
partname: this.form.partname, // 产品名称
|
partspec: this.form.partspec, // 产品规格
|
creatuser: this.form.creatuser, // 创建人员
|
sourceorder: this.form.sourceorder, // 源单单号
|
saleordercode: this.form.saleordercode, // 销售订单
|
ordertype: this.form.ordertype, // 单据类型
|
datatype: this.form.datatype,
|
searchdate: this.form.timeValue.join('~'),
|
// createdate: this.form.createdate.toString().length > 0 ? handleDatetime(this.form.createdate) : '', // 创建时间
|
prop: this.form.prop, // 排序字段
|
order: this.form.order, // 排序字段
|
page: this.form.page, // 第几页
|
rows: this.form.rows // 每页多少条
|
}
|
|
SopSearchMesOrderSearch(data).then(res => {
|
console.log(res)
|
this.tableData = res.data
|
this.total = res.count
|
this.loading = false
|
|
})
|
// this.request({
|
// pageSize: this.pageSize,
|
// pageCurrent: pageCurrent,
|
// value: value,
|
// success: res => {
|
// // console.log('data', res);
|
// this.tableData = res.data
|
// this.total = res.total
|
// this.loading = false
|
// }
|
// })
|
|
|
|
|
|
},
|
// 伪request请求
|
request(options) {
|
const {
|
pageSize,
|
pageCurrent,
|
success,
|
value
|
} = options
|
let total = tableData.length
|
let data = tableData.filter((item, index) => {
|
const idx = index - (pageCurrent - 1) * pageSize
|
return idx < pageSize && idx >= 0
|
})
|
if (value) {
|
data = []
|
tableData.forEach(item => {
|
if (item.name.indexOf(value) !== -1) {
|
data.push(item)
|
}
|
})
|
total = data.length
|
}
|
|
setTimeout(() => {
|
typeof success === 'function' &&
|
success({
|
data: data,
|
total: total
|
})
|
}, 500)
|
}
|
}
|
}
|
</script>
|
|
|
<style scoped>
|
/* #ifndef H5 */
|
/* page {
|
padding-top: 85px;
|
} */
|
/* #endif */
|
|
/* 固定表头 */
|
/* .uni-table {
|
height: 300px;
|
overflow-y: auto;
|
} */
|
|
.uni-table-th {
|
position: sticky;
|
top: 0;
|
background-color: #fff;
|
z-index: 2;
|
}
|
|
.uni-container {
|
/* background-color: #e8e8e8; */
|
}
|
|
.uni-group {
|
display: flex;
|
align-items: center;
|
}
|
|
::v-deep .uni-table-mask {
|
background-color: transparent !important;
|
}
|
|
.headTitle {
|
height: 6vh;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
font-size: 40rpx;
|
font-weight: bolder;
|
font-family: Arial;
|
}
|
|
.headForm {
|
height: 6vh;
|
/* border-bottom: 2rpx solid #000; */
|
|
span {
|
display: flex;
|
justify-content: space-evenly;
|
align-items: center;
|
}
|
|
.headFormItem {
|
width: 500rpx;
|
}
|
}
|
|
.uni-pagination-box {
|
height: 4vh;
|
margin: 1vh 0;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
background-color: #fff;
|
}
|
</style>
|