<template>
|
<view class="page">
|
<!-- 刷新按钮 -->
|
<button @click="handleRefresh" class="refresh-btn">刷新</button>
|
<view>
|
<h4>说明:</br>开工时间=首件合格后取送检时间,</br>完工时间=报工数等于工单数的时间</h4>
|
</view>
|
<!-- 上半部分 -->
|
<!-- 开工完工 -->
|
|
<view class="top-section">
|
<!-- 左边工单按钮组和输入框,左右布局 -->
|
<view class="left-section">
|
<view class="item">
|
<button class="btn-disabled">开工</button>
|
<input class="input-box" v-model="startTime" disabled="true" placeholder="开工时间=首件合格后取送检时间" />
|
</view>
|
<view class="item">
|
<button class="btn-disabled">完工</button>
|
<input class="input-box" v-model="endTime" disabled="true" placeholder="报工数达到计划数后自动完工" />
|
</view>
|
<view class="item">
|
<button @click="stateCheck(2)" class="btn-blue">暂停</button>
|
<input class="input-box" v-model="suspendTime" disabled="true" placeholder="点暂停按钮时写入" />
|
</view>
|
<!--<view class="item">
|
<button @click="stateCheck(2)" class="btn-blue">反暂停</button>
|
<input class="input-box" v-model="suspendTime" disabled="true" placeholder="点暂停按钮时写入" />
|
</view>-->
|
<!-- <view class="item">
|
<button @click="stateCheck(3)" class="btn-blue">反完工</button>
|
<input class="input-box" v-model="reverseTime" disabled="true" placeholder="点反完工按钮写入" />
|
</view> -->
|
</view>
|
|
<!-- 右边工单状态 -->
|
<view class="right-section">
|
<text class="status-title">工单号</text>
|
<text class="status-title"><input class="status-title" type="text" v-model="orderNo" disabled="true" /></text>
|
<text class="status-title">工单状态</text>
|
<view class="status-circle">
|
<input class="status-input" v-model="workOrderStatus" disabled="true" />
|
</view>
|
</view>
|
</view>
|
|
<!-- 下半部分保存取消按钮 -->
|
<view class="bottom-section">
|
<button class="save-btn" @click="sumbit">提交</button>
|
<button class="cancel-btn" @click="clean">取消</button>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
props: {
|
orderNo: String,
|
orderId: Number,
|
machineNo: String
|
},
|
data() {
|
return {
|
workOrderStatus: "",
|
startTime: "",
|
endTime: "",
|
suspendTime: "",
|
reverseTime: "",
|
statusForm: {},
|
flag: -1
|
};
|
},
|
created() {
|
|
// let machine = uni.getStorageSync('machine');
|
// let orderId = uni.getStorageSync('orderId');
|
// let orderNo = uni.getStorageSync('orderNo');
|
|
// if (orderId) {
|
// this.orderId = orderId;
|
// } else {
|
// if (!this.orderId) {
|
// this.orderId = uni.getStorageSync('id');
|
// }
|
|
// }
|
|
// if (orderNo) {
|
// this.orderNo = orderNo;
|
// } else {
|
// if (!this.orderNo) {
|
// this.orderNo = uni.getStorageSync('daa001');
|
// }
|
// }
|
|
// if (machine) {
|
// this.machineNo = machine;
|
// } else {
|
// if (!this.machineNo) {
|
// this.machineNo = uni.getStorageSync('machineNo');
|
// }
|
// }
|
|
|
if (!this.orderId && !this.orderNo) {
|
return;
|
}
|
|
this.init();
|
},
|
methods: {
|
// 刷新方法
|
handleRefresh() {
|
this.init(); // 刷新数据
|
},
|
sumbit() {
|
this.$post({
|
url: "/MesOrderSta/UpdateTime",
|
data: {
|
startTime: this.startTime,
|
endTime: this.endTime,
|
suspendTime: this.suspendTime,
|
reverseTime: this.reverseTime,
|
id: this.statusForm.id,
|
orderId: this.orderId,
|
machineNo: this.machineNo,
|
flag: this.flag
|
}
|
}).then(res => {
|
if (res.data.tbBillList) {
|
this.init();
|
this.$showMessage("保存成功");
|
} else {
|
this.clean();
|
this.$showMessage("保存失败");
|
}
|
})
|
},
|
clean() {
|
this.startTime = this.statusForm.startTime;
|
this.endTime = this.statusForm.endTime;
|
this.suspendTime = this.statusForm.suspendTime;
|
this.reverseTime = this.statusForm.reverseTime;
|
},
|
init() {
|
this.$post({
|
url: "/MesOrderSta/init",
|
data: {
|
orderId: this.orderId,
|
orderNo: this.orderNo,
|
machineNo: this.machineNo
|
}
|
}).then(res => {
|
this.findByOrderId();
|
})
|
},
|
findByOrderId() {
|
this.$post({
|
url: "/MesOrderSta/FindByOrderNo",
|
data: {
|
orderId: this.orderId,
|
orderNo: this.orderNo
|
}
|
}).then(res => {
|
this.statusForm = res.data.tbBillList;
|
this.startTime = res.data.tbBillList.startTime;
|
this.endTime = res.data.tbBillList.endTime;
|
this.suspendTime = res.data.tbBillList.suspendTime;
|
this.reverseTime = res.data.tbBillList.reverseTime;
|
this.workOrderStatus = res.data.tbBillList.orderStatus;
|
})
|
},
|
stateCheck(item) {
|
this.$post({
|
url: "/MesOrderSta/StateCheck",
|
data: {
|
orderId: this.orderId,
|
flag: item
|
}
|
}).then(res => {
|
if (res.data.tbBillList) {
|
this.flag = item;
|
switch (item) {
|
case 0:
|
this.startTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
|
this.endTime = this.statusForm.endTime;
|
this.suspendTime = this.statusForm.suspendTime;
|
this.reverseTime = this.statusForm.reverseTime;
|
break;
|
case 1:
|
this.startTime = this.statusForm.startTime;
|
this.endTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
|
this.suspendTime = this.statusForm.suspendTime;
|
this.reverseTime = this.statusForm.reverseTime;
|
break;
|
case 2:
|
this.startTime = this.statusForm.startTime;
|
this.endTime = this.statusForm.endTime;
|
this.suspendTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
|
this.reverseTime = this.statusForm.reverseTime;
|
break;
|
case 3:
|
this.startTime = this.statusForm.startTime;
|
this.endTime = this.statusForm.endTime;
|
this.suspendTime = this.statusForm.suspendTime;
|
this.reverseTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
|
break;
|
}
|
} else {
|
this.$showMessage(res.message);
|
}
|
})
|
}
|
}
|
};
|
</script>
|
|
<style scoped>
|
.page {
|
padding: 2vh;
|
display: flex;
|
flex-direction: column;
|
box-sizing: border-box;
|
}
|
|
/* 刷新按钮样式 */
|
.refresh-btn {
|
position: absolute;
|
top: 10px;
|
right: 10px;
|
background-color: #00A2E9;
|
/* 蓝色背景 */
|
color: white;
|
padding: 10px 20px;
|
border: none;
|
border-radius: 5px;
|
font-size: 35px;
|
cursor: pointer;
|
}
|
|
/* 上半部分:左右布局 */
|
.top-section {
|
display: flex;
|
justify-content: space-between;
|
flex-grow: 1;
|
margin-bottom: 4vh;
|
}
|
|
/* 左边按钮和输入框部分(左右布局) */
|
.left-section {
|
width: 65%;
|
display: flex;
|
flex-direction: column;
|
}
|
|
.item {
|
display: flex;
|
align-items: center;
|
margin-bottom: 2.2vh; /* 间距略增 */
|
height: 7vh; /* 整体高度增大 */
|
}
|
|
/* 统一按钮和输入框的高度 */
|
button,
|
.input-box {
|
height: 6vh; /* 按钮和输入框更高 */
|
}
|
|
button {
|
width: 32%; /* 按钮略宽 */
|
padding: 0;
|
font-size: 2.2vw; /* 字体更大 */
|
margin-right: 1vw;
|
line-height: 6vh;
|
}
|
|
.btn-disabled {
|
background-color: #ccc;
|
color: #fff;
|
border: none;
|
}
|
|
.btn-blue {
|
background-color: #00A2E9;
|
color: #fff;
|
border: none;
|
}
|
|
.input-box {
|
width: 68%; /* 输入框略缩小,配合按钮变宽 */
|
padding: 0 1vw;
|
font-size: 1.8vw; /* 字体更大 */
|
border: 1px solid #ccc;
|
box-sizing: border-box;
|
}
|
|
/* 右边工单状态部分 */
|
.right-section {
|
width: 30%; /* 原来是30%,调大一点 */
|
display: flex;
|
flex-direction: column;
|
align-items: flex-start;
|
justify-content: flex-start;
|
text-align: center;
|
padding-top: 45px;
|
flex-wrap: wrap;
|
align-content: flex-start;
|
margin-top: -44px;
|
}
|
|
.status-title {
|
margin-bottom: 2vh;
|
font-size: 2vw;
|
/* Larger font size for titles */
|
}
|
|
.status-circle {
|
width: 11vw;
|
/* Enlarged status circle */
|
height: 11vw;
|
background-color: #00A2E9;
|
border-radius: 50%;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
}
|
|
.status-input {
|
color: white;
|
font-size: 2vw;
|
/* Increased font size for status input */
|
background: transparent;
|
border: none;
|
text-align: center;
|
width: 100%;
|
height: 100%;
|
outline: none;
|
}
|
|
/* 下半部分:保存和取消按钮 */
|
.bottom-section {
|
display: flex;
|
justify-content: space-between;
|
margin-top: 1vh;
|
height: 100%;
|
}
|
|
.save-btn,
|
.cancel-btn {
|
width: 48%;
|
padding: 1.5vh;
|
background-color: #00A2E9;
|
color: white;
|
border: none;
|
text-align: center;
|
font-size: 1.8vw;
|
/* Larger font for buttons */
|
height: 100%;
|
}
|
|
/* 让右侧工单号输入框变长 */
|
.status-title input.status-title {
|
width: 90%; /* 或 100%,根据实际需求调整 */
|
min-width: 320px; /* 可选,保证最小宽度 */
|
font-size: 2vw;
|
box-sizing: border-box;
|
}
|
</style>
|