<template>
	<ifrm ref="ifrm">
		<!-- 工序接收 -->
		<uni-forms ref="form" err-show-type="toast">
			<uni-forms-item name="allegation">
				<input type="text" v-model="value" @confirm="confirm" class="uni-input-border" :focus="twoInputFcous" placeholder="流程卡" />
			</uni-forms-item>
		</uni-forms>
		<t-table style="margin-top:20rpx">
			<t-tr>
				<t-td>流程卡号</t-td>
				<t-td>{{ workOrder.cardNo }}</t-td>
			</t-tr>
			<t-tr>
				<t-td>车间订单号</t-td>
				<t-td>{{ workOrder.woCode }}</t-td>
			</t-tr>
			<t-tr>
				<t-td>订单状态</t-td>
				<t-td>{{ workOrder.runStatusTitle }}</t-td>
			</t-tr>
			<t-tr>
				<t-td>批次号</t-td>
				<t-td>{{ workOrder.batchNo }}</t-td>
			</t-tr>
			<t-tr>
				<t-td>零件编码</t-td>
				<t-td>{{ workOrder.pjYieldOrder.partCode }}</t-td>
			</t-tr>
			<t-tr>
				<t-td>零件名称</t-td>
				<t-td>{{ workOrder.pjYieldOrder.partName }}</t-td>
			</t-tr>
			<t-tr>
				<t-td>本工序号-名称</t-td>
				<t-td>{{prWorkPlan.frontOrders !=null ? prWorkPlan.frontOrders+'--'+prWorkPlan.frontProcedureSet.ppsName : ""}}</t-td>
			</t-tr>
			<t-tr>
				<t-td>班组</t-td>
				<t-td>{{prWorkPlan.makeTeam != null ? prWorkPlan.makeTeam.tsName:prWorkPlan.oemCustomer.ocName}}</t-td>
			</t-tr>
			<t-tr>
				<t-td>数量</t-td>
				<t-td>{{workOrder.makeQty}}</t-td>
			</t-tr>
			<t-tr>
				<t-td>工序状态</t-td>
				<t-td>{{prWorkPlan.status == 1 ? '未开始':prWorkPlan.status == 2 ? '已接收' :prWorkPlan.status == 3 ? '已报工' : prWorkPlan.status == 5 ? '已完成' :'' }}</t-td>
			</t-tr>
			
		</t-table>
	</ifrm>
</template>
<script>
import ifrm from '@/pages/index/ifrm';
import tTable from '@/components/t-table/t-table.vue';
import tTh from '@/components/t-table/t-th.vue';
import tTr from '@/components/t-table/t-tr.vue';
import tTd from '@/components/t-table/t-td.vue';
import scan from '../../mixin/scan.js';
export default {
	mixins: [scan],
	components: {
		ifrm,
		tTable,
		tTh,
		tTr,
		tTd
	},
	data() {
		return {
			value: '',
			workOrder: { pjYieldOrder: {} },
			prWorkPlan: {frontProcedureSet:{},makeTeam:{},oemCustomer:{}},
			qty: '',
			twoInputFcous: true
		};
	},
	methods: {},
	onNavigationBarButtonTap(btn) {
		this.$refs.ifrm.topMenuClick(btn);
	},
	onShow() {},
	methods: {
		getBarCode(code, isConfirm = false) {
			this.getData(code);
		},
		confirm(e) {
			this.getBarCode(e.target.value, true);
		},
		getData(code) {
			this.twoInputFcous = false;
			if (!code) return;
			this.value = code;
			this.$ajax.request({
				url: 'pdaLoad/orderStatusQuery',
				data: {
					cardNo: code
				},
				method: 'POST',
				success: res => {
					this.value = '';
					if (res != null) {
						this.workOrder = res.workOrder;
						this.prWorkPlan = res.prWorkPlan;
						uni.showToast({
							title: '数据获取成功'
						});
					} else {
						uni.showToast({
							icon: 'none',
							title: '订单不存在'
						});
					}
					this.twoInputFcous = true;
				}
			});
		},
	}
};
</script>

<style scoped></style>
