guoyujia hai 1 ano
pai
achega
e266cb2174

+ 5 - 4
src/views/business/outsource/form.vue

@@ -23,7 +23,7 @@
         </el-button> -->
 
         <el-button
-          v-if="editStatus && form.isSubmit==1"
+          v-show="editStatus && form.isSubmit==1"
           type="primary"
           icon="Download"
           @click="handleExport"
@@ -31,7 +31,7 @@
           >导出</el-button
         >
         <el-button
-          v-if="!editStatus"
+          v-show="editStatus && form.isSubmit==1"
           type="warning"
           icon="Download"
           @click="handlePrint"
@@ -211,7 +211,7 @@
       <!-- 渲染数据区 -->
       <div class="form-details-btns-container">
         <el-button
-          v-if="editStatus"
+          v-show="editStatus"
           type="primary"
           icon="Plus"
           @click="handleShowDialogProducts"
@@ -582,7 +582,7 @@ function selectText(value, data) {
 /** 取消按钮 */
 function cancel() {
   visible.value = false;
-  reset();
+  // reset();
 }
 
 const handleDelete = (index) => {
@@ -597,6 +597,7 @@ const handleDelete = (index) => {
 
 /** 表单重置 */
 function reset() {
+  // console.log(proxy.parseTime(new Date(), "{y}-{m}-{d}"))
   form.value = {
     id: null,
     tenantId: null,

+ 37 - 20
src/views/business/productionBatch/computedMaterialForm.vue

@@ -23,14 +23,13 @@
               prop="materialpickUpQuantity"
               label-width="100px"
             >
-              <el-input-number
-                v-model="form.materialpickUpQuantity"
-                :min="0"
-                :precision="2"
-                controls-position="right"
-                style="width: 200px; margin-left: 30px"
-                @input="handleInputMaterialpickUpQuantity"
-              />
+            <el-input
+              v-model="form.materialpickUpQuantity"
+              placeholder="0"
+              type="text"
+              style="width: 200px; margin-left: 30px"
+              @input="handleInputMaterialpickUpQuantity"
+            />
             </el-form-item>
           </el-col>
         </el-row>
@@ -41,6 +40,7 @@
               v-model="form.peqty"
               prop="peqty"
               label-width="100px"
+              
               style="margin-top: 30px"
             >
               <span style="margin-left: 40px">{{ form.peqty }}</span>
@@ -62,8 +62,8 @@
         </el-row>
       </el-form>
       <div class="bottom-buttons">
-        <el-button size="large" style="width: 200px;height: 50px;" type="info"  @click="cancel">取 消</el-button>
-      <el-button size="large" style="width: 200px;height: 50px;" type="primary"  @click="handleInputLotNumber"
+        <el-button size="large" style="width: 160px;height: 50px;" type="info"  @click="cancel">取 消</el-button>
+      <el-button size="large" style="width: 160px;height: 50px;" type="primary"  @click="handleInputLotNumber"
         >填入</el-button
       >
     </div>
@@ -93,13 +93,15 @@ const detailInfo = ref({})
 function open(data) {
   reset();
   detailInfo.value = proxy.deepClone(data);
-  getProductionLotAmount({lotno:detailInfo.value.productionPlanNo,lotseq:detailInfo.value.lineNumber}).then(res =>{
-    if(res.code == 200) {
-      form.value.peqty = res.data[0].peqty
-       visible.value = true;
-    }
-  }
-)
+  form.value.peqty = 22.8
+  visible.value =true
+//   getProductionLotAmount({lotno:detailInfo.value.productionPlanNo,lotseq:detailInfo.value.lineNumber}).then(res =>{
+//     if(res.code == 200) {
+//       form.value.peqty = res.data[0].peqty
+//        visible.value = true;
+//     }
+//   }
+// )
  
 }
 
@@ -113,14 +115,29 @@ function cancel() {
 function reset() {
   form.value = {
     lotNumber: 0,
-    materialpickUpQuantity:0
+    materialpickUpQuantity:''
   };
   proxy.resetForm("formRef");
 }
 //填写领料量
 function handleInputMaterialpickUpQuantity(data) {
-   form.value.lotNumber = Math.ceil(data / form.value.peqty);
-}
+  // if (data < 0) {
+  //       form.value.materialpickUpQuantity = 0;
+  //     }else{
+  //  form.value.lotNumber = Math.ceil(data / form.value.peqty);
+  //     }
+  const regex =/^(?!0+(?:\.0+)?$)[1-9]\d*(\.\d*)?$/;
+      // 检查输入值是否符合正则表达式规则
+      if (!regex.test(data)) {
+        // 如果不符合规则,清空输入或设置为0
+        form.value.materialpickUpQuantity = '';
+      } else {
+        // 如果符合规则,更新模型
+        form.value.materialpickUpQuantity = data;
+        form.value.lotNumber = Math.ceil(data / form.value.peqty);
+      }
+      
+    };
 
 // 投产批数带回
 function handleInputLotNumber(){