适用班组数
This commit is contained in:
parent
e6048259b1
commit
50446a7579
|
|
@ -17,7 +17,7 @@
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<uni-section title="任务信息" type="line"></uni-section>
|
<uni-section title="任务信息" type="line"></uni-section>
|
||||||
<uni-forms ref="form" :rules="rules" :model="formData" label-width="80px">
|
<uni-forms ref="form" :rules="rules" :model="formData" label-width="90px">
|
||||||
<uni-forms-item label="领料班组" required name="teamId">
|
<uni-forms-item label="领料班组" required name="teamId">
|
||||||
<uni-data-select
|
<uni-data-select
|
||||||
v-if="!opts.isEdit"
|
v-if="!opts.isEdit"
|
||||||
|
|
@ -64,6 +64,16 @@
|
||||||
maxlength="200"
|
maxlength="200"
|
||||||
></uni-easyinput>
|
></uni-easyinput>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
|
<uni-forms-item label="适用班组数" name="fitNum" v-if="!opts.isOut">
|
||||||
|
<uni-easyinput
|
||||||
|
v-model="formData.fitNum"
|
||||||
|
type="number"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
maxlength="10"
|
||||||
|
:clearable="false"
|
||||||
|
@blur="fitNumChange"
|
||||||
|
></uni-easyinput>
|
||||||
|
</uni-forms-item>
|
||||||
<uni-section title="领用工具器" type="line" />
|
<uni-section title="领用工具器" type="line" />
|
||||||
<eselect
|
<eselect
|
||||||
v-model="equipmentId"
|
v-model="equipmentId"
|
||||||
|
|
@ -191,7 +201,9 @@ const formData = reactive({
|
||||||
phone: '',
|
phone: '',
|
||||||
isOut: 1,
|
isOut: 1,
|
||||||
remark: '',
|
remark: '',
|
||||||
|
fitNum: 1,
|
||||||
})
|
})
|
||||||
|
const lastFitNum = ref(formData.fitNum)
|
||||||
const equipmentId = ref()
|
const equipmentId = ref()
|
||||||
const teamRange = ref([]) // 班组
|
const teamRange = ref([]) // 班组
|
||||||
const prodRange = ref([]) // 工程
|
const prodRange = ref([]) // 工程
|
||||||
|
|
@ -214,6 +226,25 @@ const tableData = ref([])
|
||||||
const popup = ref()
|
const popup = ref()
|
||||||
const popupRow = ref({})
|
const popupRow = ref({})
|
||||||
|
|
||||||
|
// 适用班组数
|
||||||
|
const fitNumChange = () => {
|
||||||
|
const newVal = Math.min(5, Math.max(1, parseInt(formData.fitNum) || 1))
|
||||||
|
|
||||||
|
// 计算变化比例
|
||||||
|
const ratio = newVal / lastFitNum.value
|
||||||
|
|
||||||
|
// 更新每条数据的预领数量
|
||||||
|
tableData.value.forEach((item) => {
|
||||||
|
// 仅当是数字才执行,避免 null 或空
|
||||||
|
if (typeof item.preNum === 'number') {
|
||||||
|
item.preNum = Math.max(1, Math.floor(item.preNum * ratio)) // 向下取整,且至少为1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 更新 formData.fitNum 和记录的 lastFitNum
|
||||||
|
formData.fitNum = newVal
|
||||||
|
lastFitNum.value = newVal
|
||||||
|
}
|
||||||
// 编辑获取详情
|
// 编辑获取详情
|
||||||
const getDetailsById = async () => {
|
const getDetailsById = async () => {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue