<template>
|
<view class="page">
|
|
<view>
|
<h4>说明:多工单模式时换模是统一的</h4>
|
</view>
|
<view class="refresh-btn" @click="handleRefresh">刷新</view>
|
<!-- 顶部表单部分 -->
|
<view class="top-section">
|
<view class="form-group">
|
<label>模具编号:</label>
|
<input class="input" v-model="order.moldId" placeholder="工单带出" disabled="true" />
|
</view>
|
<view class="form-group">
|
<label>使用次数:</label>
|
<input class="input" v-model="order.moldInseptionQty" placeholder="模具带出" disabled="true" />
|
</view>
|
<view class="form-group">
|
<label>提醒保养次数:</label>
|
<input class="input" v-model="order.modlLifeWorning" placeholder="模具带出" disabled="true" />
|
</view>
|
</view>
|
|
<!-- 中间状态部分,上下结构 -->
|
<view class="middle-section">
|
<view class="item">
|
<button class="btn-disabled">换模开始(=前工单完工)</button>
|
<input class="txt-inp" v-model="startTime" placeholder="输入换模开始时间" />
|
</view>
|
<view class="item">
|
<button @click="stateCheck(1)" class="btn-blue">换模完成(点击按钮)</button>
|
<input class="txt-inp" v-model="endTime" placeholder="点击换模完成写入" />
|
</view>
|
</view>
|
|
<!-- 底部保存/取消按钮 -->
|
<view class="bottom-section">
|
<button class="save-btn" @click="save">保存并生效</button>
|
<button class="cancel-btn" @click="cancel">取消</button>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
props: {
|
orderNo: String,
|
orderId: Number,
|
machineNo: String
|
},
|
data() {
|
return {
|
startTime: '',
|
endTime: '',
|
order: {},
|
statusForm: {}
|
}
|
},
|
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.getOrderById();
|
|
this.findByOrderId();
|
},
|
methods: {
|
|
handleRefresh() {
|
this.getOrderById();
|
this.findByOrderId();
|
},
|
|
save() {
|
if (!this.statusForm.id) {
|
this.$showMessage("id为空,不允许推送");
|
return;
|
}
|
|
this.$post({
|
url: "/MesOrderSta/ChangeMoldTime",
|
data: {
|
changeMoldStartTime: this.startTime,
|
changeMoldEndTime: this.endTime,
|
id: this.statusForm.id,
|
orderId: this.orderId,
|
machineNo: this.machineNo,
|
flag: this.flag
|
}
|
}).then(res => {
|
if (res.data.tbBillList) {
|
this.$showMessage("保存成功");
|
this.findByOrderId();
|
|
uni.showToast({
|
icon: 'success',
|
title: '保存成功',
|
duration: 30001,
|
});
|
|
} else {
|
this.$showMessage("保存失败");
|
this.cancel();
|
}
|
})
|
},
|
cancel() {
|
this.startTime = this.statusForm.changeMoldStartTime;
|
this.endTime = this.statusForm.changeMoldEndTime;
|
},
|
getOrderById() {
|
this.$post({
|
url: "/Womdaa/GetWomdaaById",
|
data: {
|
orderId: this.orderId,
|
orderNo: this.orderNo
|
}
|
}).then(res => {
|
this.order = res.data.tbBillList;
|
})
|
},
|
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.changeMoldStartTime;
|
this.endTime = res.data.tbBillList.changeMoldEndTime;
|
})
|
},
|
stateCheck(item) {
|
switch (item) {
|
case 0:
|
this.startTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
|
this.endTime = this.statusForm.changeMoldEndTime;
|
break;
|
case 1:
|
this.startTime = this.statusForm.changeMoldStartTime;
|
this.endTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
|
break;
|
}
|
this.flag = item;
|
}
|
}
|
};
|
</script>
|
|
<style scoped>
|
/* 页面撑满窗体 */
|
.page {
|
padding: 2vh;
|
display: flex;
|
flex-direction: column;
|
justify-content: space-between;
|
box-sizing: border-box;
|
}
|
|
.refresh-btn {
|
position: absolute;
|
top: -5px;
|
right: 40px;
|
background-color: #00A2E9;
|
color: white;
|
padding: 10px 15px;
|
font-size: 35px;
|
border-radius: 5px;
|
cursor: pointer;
|
}
|
|
.refresh-btn:disabled {
|
background-color: #ccc;
|
}
|
|
/* 顶部表单部分 */
|
.top-section {
|
/* display: flex;
|
justify-content: space-between;
|
margin-bottom: 2vh; */
|
display: flex;
|
margin-bottom: 2vh;
|
flex-direction: row;
|
flex-wrap: nowrap;
|
align-content: center;
|
justify-content: space-between;
|
align-items: baseline;
|
}
|
|
.form-group {
|
display: flex;
|
align-items: center;
|
margin-bottom: 1.5vh;
|
}
|
|
label {
|
/* margin-right: 1vw;
|
font-size: 1.6vw; */
|
/* Larger font size for labels */
|
float: left;
|
/* margin-right: 1vw; */
|
font-size: 1.6vw;
|
margin-top: 24px;
|
}
|
|
.input {
|
padding: 1vh;
|
font-size: 1.5vw;
|
/* Larger font size for input fields */
|
border: 1px solid #ccc;
|
width: 20vw;
|
/* Set relative width for input fields */
|
}
|
|
/* 中间状态部分,上下布局 */
|
.middle-section {
|
display: flex;
|
flex-direction: column;
|
margin-bottom: 4vh;
|
}
|
|
.item {
|
display: flex;
|
flex-direction: row;
|
/* Arrange items vertically */
|
align-items: flex-start;
|
margin-bottom: 2vh;
|
}
|
|
button {
|
width: 100%;
|
/* Full width for buttons */
|
padding: 1.5vh;
|
font-size: 1.5vw;
|
/* Larger font size for buttons */
|
border: none;
|
text-align: center;
|
}
|
|
.btn-disabled {
|
background-color: #ccc;
|
color: white;
|
}
|
|
.btn-blue {
|
background-color: #00A2E9;
|
color: white;
|
}
|
|
input {
|
margin-top: 10px;
|
padding: 10px;
|
font-size: 14px;
|
border: 1px solid #ccc;
|
width: 100%;
|
/* 输入框撑满宽度 */
|
}
|
|
/* 底部保存/取消按钮 */
|
.bottom-section {
|
display: flex;
|
justify-content: space-between;
|
margin-top: 4vh;
|
margin-bottom: 4vh;
|
}
|
|
.save-btn,
|
.cancel-btn {
|
width: 48%;
|
/* Half-width buttons */
|
padding: 1.5vh;
|
background-color: #00A2E9;
|
color: white;
|
font-size: 1.6vw;
|
/* Larger font size for save/cancel buttons */
|
border: none;
|
text-align: center;
|
}
|
|
.txt-inp {
|
height: 8vh;
|
padding: 1vh;
|
font-size: 1.5vw;
|
/* Increased font size */
|
width: 100%;
|
/* Full width for input in middle section */
|
box-sizing: border-box;
|
}
|
</style>
|