main
鹿和sa0ChunLuyu 1 week ago
parent 5060083763
commit c531468b29

@ -186,8 +186,12 @@ public function Save(Request $request)
$bitian_zh[]='星期'; $bitian_zh[]='星期';
} }
foreach ($bitian as $key => $field) { //必填项不能为空 foreach ($bitian as $key => $field) { //必填项不能为空
if (array_key_exists($field, $planInfo) && $planInfo[$field] !== '' && $planInfo[$field] !== null && $planInfo[$field] !== [] && $planInfo[$field] !== 0) { $allowZeroFields = ['max_total'];
} else { $isValid = array_key_exists($field, $planInfo) && $planInfo[$field] !== '' && $planInfo[$field] !== null && $planInfo[$field] !== [];
if (!in_array($field, $allowZeroFields)) {
$isValid = $isValid && $planInfo[$field] !== 0;
}
if (!$isValid) {
return \Yz::echoError1($bitian_zh[$key] . ' 不能为空'); return \Yz::echoError1($bitian_zh[$key] . ' 不能为空');
} }
} }
@ -524,8 +528,12 @@ public function SaveAdmin(Request $request)
$bitian_zh[]='星期'; $bitian_zh[]='星期';
} }
foreach ($bitian as $key => $field) { foreach ($bitian as $key => $field) {
if (array_key_exists($field, $planInfo) && $planInfo[$field] !== '' && $planInfo[$field] !== null && $planInfo[$field] !== [] && $planInfo[$field] !== 0) { $allowZeroFields = ['max_total'];
} else { $isValid = array_key_exists($field, $planInfo) && $planInfo[$field] !== '' && $planInfo[$field] !== null && $planInfo[$field] !== [];
if (!in_array($field, $allowZeroFields)) {
$isValid = $isValid && $planInfo[$field] !== 0;
}
if (!$isValid) {
return \Yz::echoError1($bitian_zh[$key] . ' 不能为空'); return \Yz::echoError1($bitian_zh[$key] . ' 不能为空');
} }
} }

@ -188,8 +188,8 @@
</div> </div>
<div class="qudao_k_input"> <div class="qudao_k_input">
<el-input v-if="CountType==1" style="width: 220px;" @input="MaxCountChange" type="number" <el-input v-if="CountType==1" style="width: 220px;" @input="MaxCountChange" type="number"
v-model="PlanInfo.max_total" :min="1" placeholder="0" v-model="PlanInfo.max_total" :min="0" placeholder="0"
oninput="value=value.replace(/^0|[^0-9]/g, '')" /> oninput="value=value.replace(/[^0-9]/g, '')" />
<el-input v-if="CountType==2" style="width: 220px;" @input="TimeLongChange" type="number" <el-input v-if="CountType==2" style="width: 220px;" @input="TimeLongChange" type="number"
v-model="PlanInfo.time_long" :min="1" placeholder="0" v-model="PlanInfo.time_long" :min="1" placeholder="0"
oninput="value=value.replace(/^0|[^0-9]/g, '')" /> oninput="value=value.replace(/^0|[^0-9]/g, '')" />
@ -200,8 +200,8 @@
<div class="qudao_k" v-for="(item,index) in PlanInfo.qudao_total" :key="index"> <div class="qudao_k" v-for="(item,index) in PlanInfo.qudao_total" :key="index">
<div style="width: 50px">{{ item.name }}</div> <div style="width: 50px">{{ item.name }}</div>
<div class="qudao_k_input" style="display: flex;"> <div class="qudao_k_input" style="display: flex;">
<el-input type="number" v-model="PlanInfo.qudao_total[index].count" :min="1" <el-input type="number" v-model="PlanInfo.qudao_total[index].count" :min="0"
placeholder="0" oninput="value=value.replace(/^0|[^0-9]/g, '')" /> placeholder="0" oninput="value=value.replace(/[^0-9]/g, '')" />
<div style="margin-left: 4px; color: #ccc;">{{item.ratio}}%</div> <div style="margin-left: 4px; color: #ccc;">{{item.ratio}}%</div>
</div> </div>
</div> </div>

@ -188,8 +188,8 @@
</div> </div>
<div class="qudao_k_input"> <div class="qudao_k_input">
<el-input v-if="CountType==1" style="width: 220px;" @input="MaxCountChange" type="number" <el-input v-if="CountType==1" style="width: 220px;" @input="MaxCountChange" type="number"
v-model="PlanInfo.max_total" :min="1" placeholder="0" v-model="PlanInfo.max_total" :min="0" placeholder="0"
oninput="value=value.replace(/^0|[^0-9]/g, '')" /> oninput="value=value.replace(/[^0-9]/g, '')" />
<el-input v-if="CountType==2" style="width: 220px;" @input="TimeLongChange" type="number" <el-input v-if="CountType==2" style="width: 220px;" @input="TimeLongChange" type="number"
v-model="PlanInfo.time_long" :min="1" placeholder="0" v-model="PlanInfo.time_long" :min="1" placeholder="0"
oninput="value=value.replace(/^0|[^0-9]/g, '')" /> oninput="value=value.replace(/^0|[^0-9]/g, '')" />
@ -200,8 +200,8 @@
<div class="qudao_k" v-for="(item,index) in PlanInfo.qudao_total" :key="index"> <div class="qudao_k" v-for="(item,index) in PlanInfo.qudao_total" :key="index">
<div style="width: 50px">{{ item.name }}</div> <div style="width: 50px">{{ item.name }}</div>
<div class="qudao_k_input" style="display: flex;"> <div class="qudao_k_input" style="display: flex;">
<el-input type="number" v-model="PlanInfo.qudao_total[index].count" :min="1" <el-input type="number" v-model="PlanInfo.qudao_total[index].count" :min="0"
placeholder="0" oninput="value=value.replace(/^0|[^0-9]/g, '')" /> placeholder="0" oninput="value=value.replace(/[^0-9]/g, '')" />
<div style="margin-left: 4px; color: #ccc;">{{item.ratio}}%</div> <div style="margin-left: 4px; color: #ccc;">{{item.ratio}}%</div>
</div> </div>
</div> </div>

Loading…
Cancel
Save