<template>
|
<view>
|
<view class="form-container">
|
<form :modelValue="formData">
|
<view class="form-group">
|
<label class="form-label">生产车间:</label>
|
<superwei-combox :candidates="deptList" placeholder="请选择或输入"
|
v-model="formData.deptName"
|
:isJSON="true" keyName="deptName"
|
@select="checkDept"
|
class="picker form-input"
|
style="border: none;"></superwei-combox>
|
</view>
|
<view class="form-group">
|
<label class="form-label">产线编码:</label>
|
<superwei-combox :candidates="lineList" placeholder="请选择或输入"
|
v-model="formData.lineNo"
|
:isJSON="true" keyName="lineNo"
|
@select="checkLine"
|
class="picker form-input"
|
style="border: none;"></superwei-combox>
|
</view>
|
<view class="form-group">
|
<label class="form-label">线体名称:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.lineName"/>
|
</view>
|
</form>
|
</view>
|
<view class="list-container">
|
<uni-table ref="table" border emptyText="暂无更多数据">
|
<uni-tr>
|
<uni-th align="center" style="color: #FFFFFF;background-color: lightskyblue;">线体名称</uni-th>
|
<uni-th align="center" style="color: #FFFFFF;background-color: lightskyblue;">暂停时间</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in tableData" :key="index">
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.lineName"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.createDate"/>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
|
<view class="plus-button">
|
<button type="warn" @click="save">提交开启</button>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
formData: {},
|
deptList: [],
|
lineList: [],
|
tableData: []
|
}
|
},
|
onLoad(options) {
|
//初始化检验单号
|
this.$post({
|
url: "/Suspend/getOpenDept"
|
}).then(res => {
|
this.deptList = res.data.tbBillList;
|
});
|
},
|
methods: {
|
save() {
|
|
if(this.tableData.length === 0){
|
this.$showMessage("没有需要开启的机台");
|
return;
|
}
|
|
let data = this.tableData.filter(item => item.lineNo === this.formData.lineNo)[0];
|
|
let specifiedTime = new Date(data.createDate);
|
let currentTime = new Date();
|
|
// 计算时间差(单位:毫秒)
|
let timeDifference = currentTime.getTime() - specifiedTime.getTime();
|
|
// 将时间差转换为分钟
|
let minutesDifference = timeDifference / (1000 * 60);
|
|
this.formData.timeDifference = minutesDifference.toFixed(3);
|
|
this.formData.id = data.id;
|
|
this.formData.isSuspend = 1
|
|
this.$post({
|
url: "/Suspend/UpdateById",
|
data: {
|
entity: this.formData
|
}
|
}).then(res => {
|
if (res.data.tbBillList > 0) {
|
this.formData = {};
|
this.tableData = [];
|
this.$showMessage("开启成功");
|
} else {
|
this.$showMessage("开启失败");
|
}
|
});
|
|
},
|
checkDept(event) {
|
this.formData.deptNo = event.deptNo;
|
this.formData.deptName = event.deptName;
|
|
this.$post({
|
url: "/Suspend/getOpenLine",
|
data: {
|
deptCode: this.formData.deptNo
|
}
|
}).then(res => {
|
this.lineList = res.data.tbBillList;
|
});
|
|
this.$post({
|
url: "/Suspend/getAllByDeptNo",
|
data: {
|
deptCode: this.formData.deptNo
|
}
|
}).then(res1 => {
|
this.tableData = res1.data.tbBillList;
|
});
|
|
},
|
checkLine(event) {
|
this.formData.lineNo = event.lineNo;
|
this.formData.lineName = event.lineName;
|
},
|
radioChange(e) {
|
this.formData.isSuspend = e.detail.value;
|
},
|
}
|
}
|
</script>
|
|
<style>
|
.form-group {
|
display: flex;
|
align-items: center;
|
border-bottom: 1px solid #c9c9c9;
|
}
|
|
.form-label {
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
|
.form-input {
|
flex: 1;
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
|
.picker {
|
flex: 1;
|
margin-bottom: 0;
|
padding: 5px;
|
font-size: 12px;
|
}
|
|
/* 默认样式 */
|
.list-container {
|
height: 60vh;
|
/* 设置列表容器的高度为剩余空间,并减去表单容器的高度 */
|
overflow-y: auto;
|
/* 允许列表容器垂直滚动 */
|
padding: 10px;
|
/* 可选:添加一些内边距,使列表内容更美观 */
|
}
|
|
.form-container {
|
padding: 10px;
|
/* 可选:添加一些内边距,使表单内容更美观 */
|
}
|
|
.plus-button {
|
line-height: 59px;
|
font-size: 24px;
|
cursor: pointer;
|
z-index: 1000;
|
margin-bottom: 35px;
|
}
|
</style>
|