<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="departmentname"
|
@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>
|
<view class="form-group">
|
<label class="form-label">暂停原因:</label>
|
<radio-group name="gender" ref="suspendRadio" v-model="formData.isSuspend" @change="radioChange">
|
<label>
|
<radio value="0"/>
|
<text>故障/异常</text>
|
</label>
|
<label>
|
<radio value="0"/>
|
<text>产线休息</text>
|
</label>
|
</radio-group>
|
</view>
|
<view class="form-group">
|
<label class="form-label">备注:</label>
|
<input class="form-input" type="text" v-model="formData.remarks"/>
|
</view>
|
</form>
|
</view>
|
|
<view class="plus-button">
|
<button type="warn" @click="save">提交暂停</button>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
formData: {},
|
deptList: [],
|
lineList: [],
|
}
|
},
|
onLoad(options) {
|
//初始化检验单号
|
this.$post({
|
url: "/Suspend/getDept"
|
}).then(res => {
|
this.deptList = res.data.tbBillList;
|
});
|
},
|
methods: {
|
save() {
|
|
if (!this.formData.deptName) {
|
this.$showMessage("请选择生产车间");
|
return;
|
}
|
|
if (!this.formData.lineNo) {
|
this.$showMessage("请选择产线编码");
|
return;
|
}
|
|
if (this.formData.isSuspend != '0') {
|
this.$showMessage("请选择暂停原因");
|
return;
|
}
|
|
this.$post({
|
url: "/Suspend/save",
|
data: {
|
entity: this.formData
|
}
|
}).then(res => {
|
if (res.data.tbBillList > 0) {
|
this.formData = {};
|
this.formData.isSuspend = 0;
|
// 取消选中单选框
|
// this.$refs.suspendRadio.radioList.forEach(radio => {
|
// radio.radioChecked = false;
|
// });
|
this.$showMessage("暂停成功");
|
} else {
|
this.$showMessage("暂停失败");
|
}
|
});
|
|
},
|
checkDept(event) {
|
this.formData.deptNo = event.departmentcode;
|
this.formData.deptName = event.departmentname;
|
|
this.$post({
|
url: "/Suspend/getDeptCode",
|
data: {
|
deptCode: this.formData.deptNo
|
}
|
}).then(res => {
|
this.lineList = res.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;
|
}
|
|
.form-container {
|
padding: 10px;
|
/* 可选:添加一些内边距,使表单内容更美观 */
|
}
|
|
.plus-button {
|
line-height: 59px;
|
font-size: 24px;
|
cursor: pointer;
|
z-index: 1000;
|
margin-bottom: 35px;
|
}
|
|
</style>
|