调机记录功能修改
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="form-container">
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-forms-item label="作业编码:" :labelWidth='90' name="pwoJobCode">
|
||||
<uni-easyinput @confirm="searchData" suffixIcon="scan" @iconClick="scanBar" type="text"
|
||||
@@ -33,17 +33,18 @@
|
||||
<uni-forms-item label="人员:" :labelWidth='90' name="staff">
|
||||
<uni-easyinput type="text" v-model="formData.staff" @confirm="searchStaff" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="调试单价:" :labelWidth='90' name="programmingDebuggingUnitPrice">
|
||||
<uni-easyinput type="text" v-model="formData.programmingDebuggingUnitPrice" />
|
||||
</uni-forms-item>
|
||||
<view class="form-row">
|
||||
<uni-forms-item label="调机时长:" :labelWidth='90' name="timeTake" class="form-col">
|
||||
<uni-easyinput type="text" v-model="timeTake" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="时间单位:" :labelWidth='90' name="timeUnit" class="form-col">
|
||||
<uni-data-select v-model="timeUnit" :localdata="unitOptions" placeholder="选择时间单位" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<uni-row>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="调机时长:" :labelWidth='90' name="timeTake" class="form-col">
|
||||
<uni-easyinput type="text" v-model="timeTake" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="时间单位:" :labelWidth='90' name="timeUnit" class="form-col">
|
||||
<uni-data-select v-model="timeUnit" :localdata="unitOptions" placeholder="选择时间单位" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
@@ -52,7 +53,7 @@
|
||||
<script>
|
||||
import { addRecord } from "@/api/mes/mesMachineSetUpRecord.js";
|
||||
import { listPwoJob } from "@/api/mes/jobReport.js";
|
||||
import { getUserInfo } from "@/api/system/user.js"
|
||||
import { getEmployeeByCode } from "@/api/basic/employee.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -77,7 +78,7 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$set(this.formData, "staff", this.$store.state.user.name);
|
||||
this.$set(this.formData, "staff", this.$store.state.employee.empName);
|
||||
},
|
||||
methods: {
|
||||
scanBar() {
|
||||
@@ -92,8 +93,12 @@ export default {
|
||||
},
|
||||
searchStaff() {
|
||||
const _this = this;
|
||||
getUserInfo(_this.formData.staff).then(async res => {
|
||||
_this.$set(_this.formData, "staff", res.data.userName);
|
||||
getEmployeeByCode(_this.formData.staff).then(async res => {
|
||||
if(res.data != null){
|
||||
_this.$set(_this.formData, "staff", res.data.name);
|
||||
}else{
|
||||
_this.$modal.msg("未查询到该员工!");
|
||||
}
|
||||
})
|
||||
},
|
||||
searchData() {
|
||||
@@ -155,7 +160,7 @@ export default {
|
||||
addRecord(_this.formData).then(res => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$modal.msgSuccess("提交成功!");
|
||||
_this.reset();
|
||||
// _this.reset();
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
@@ -193,62 +198,9 @@ export default {
|
||||
// 拼接为 "YYYY-MM-DD HH:mm" 格式
|
||||
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
|
||||
},
|
||||
reset() {
|
||||
this.timeTake = null;
|
||||
this.timeUnit = 'h';
|
||||
this.formData = {
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
pwoJobCode: null,
|
||||
pwoCode: null,
|
||||
ptNoTar: null,
|
||||
ptTitleTar: null,
|
||||
opCode: null,
|
||||
opTitle: null,
|
||||
machineAdjustmentDuration: null
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.form-container {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
/* 两个项之间的间距 */
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
/* 与上下表单项保持默认间距 */
|
||||
}
|
||||
|
||||
/* 并列项平分宽度 */
|
||||
.form-col {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* 可选:统一并列项的label样式(避免对齐错乱) */
|
||||
:deep(.form-col .uni-forms-item__label) {
|
||||
width: 80px !important;
|
||||
/* 固定label宽度 */
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* 其他表单项保持默认样式,无需额外修改 */
|
||||
:deep(.uni-forms-item) {
|
||||
margin-bottom: 80px;
|
||||
/* 统一所有表单项的底部间距 */
|
||||
}
|
||||
|
||||
.u-button {
|
||||
height: 10% !important;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user