From d5379b4f64dc7e317758339e721c4acbb371baae Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期三, 10 四月 2024 17:49:29 +0800
Subject: [PATCH] 庄口,车间,组别,规格都修改为必填+根据车间获取组别的接口联调,重组得到的数据以便下拉数据的使用

---
 src/views/productManage/productRegisterForm/addProductRegisterPage.vue |  805 +++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 658 insertions(+), 147 deletions(-)

diff --git a/src/views/productManage/productRegisterForm/addProductRegisterPage.vue b/src/views/productManage/productRegisterForm/addProductRegisterPage.vue
index 51564e9..a54c344 100644
--- a/src/views/productManage/productRegisterForm/addProductRegisterPage.vue
+++ b/src/views/productManage/productRegisterForm/addProductRegisterPage.vue
@@ -2,14 +2,27 @@
   <div class="add-product-page">
     <div class="top-view">
       <div class="t-left">
-        <el-button type="primary" size="small">鏀惧純</el-button>
-        <el-button type="primary" size="small">淇濆瓨</el-button>
-        <el-divider direction="vertical"></el-divider>
-        <el-button type="primary" size="small" @click="quitClick">閫�鍑�</el-button>
+        <el-button type="primary" size="small" @click="cancelClickOne"
+          >鏀惧純</el-button
+        >
+        <el-button
+          type="primary"
+          size="small"
+          :loading="isAddloading"
+          @click="saveClickOne('ruleForm')"
+          >淇濆瓨</el-button
+        >
+        <!-- <el-divider direction="vertical"></el-divider> -->
+        <!-- <el-button type="primary" size="small" @click="quitClick">閫�鍑�</el-button> -->
       </div>
       <div class="t-right">
-        <div class="t-right-circle" :class="isDeviceConnectStatus ? 't-r-bg-green ' : 't-r-bg-red '"></div>
-        <div :class="isDeviceConnectStatus ? 't-right-green' : 't-right-red'">璁¢噺浠櫒杩炴帴姝e父</div>
+        <div
+          class="t-right-circle"
+          :class="isDeviceConnectStatus ? 't-r-bg-green ' : 't-r-bg-red '"
+        ></div>
+        <div :class="isDeviceConnectStatus ? 't-right-green' : 't-right-red'">
+          璁¢噺浠櫒杩炴帴姝e父
+        </div>
       </div>
     </div>
     <div class="body-card">
@@ -19,7 +32,7 @@
             :model="ruleForm"
             :rules="rules"
             ref="ruleForm"
-            label-width="80px"
+            label-width="85px"
             label-position="right"
             class="demo-ruleForm"
           >
@@ -28,186 +41,505 @@
                 <el-form-item label="缂栧彿" prop="number">
                   <el-input v-model="ruleForm.number" size="small"></el-input>
                 </el-form-item>
-                <el-form-item label="鐢熶骇鐢ㄦ椂" prop="productTime">
-                  <el-input v-model="ruleForm.productTime" size="small"></el-input>
+                <el-form-item label="鐢熶骇鐢ㄦ椂" prop="record">
+                  <el-input
+                    v-model.number="ruleForm.record"
+                    size="small"
+                  ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="3">
-                <el-form-item label="鐢熶骇鏃ユ湡" prop="productDate">
+                <el-form-item label="鐢熶骇鏃ユ湡" prop="createTime">
                   <el-date-picker
+                    value-format="yyyy-MM-dd"
                     type="date"
                     placeholder="閫夋嫨鏃ユ湡"
-                    v-model="ruleForm.productDate"
+                    v-model="ruleForm.createTime"
                     size="small"
                     style="width: 100%"
                   ></el-date-picker>
                 </el-form-item>
-                <el-form-item label="鍥炴暟" prop="numTimes">
-                  <el-input v-model="ruleForm.numTimes" size="small"></el-input>
+                <el-form-item label="鍥炴暟" prop="circle">
+                  <el-input
+                    v-model.number="ruleForm.circle"
+                    size="small"
+                  ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="3">
-                <el-form-item label="搴勫彛" prop="lots">
-                  <el-select v-model="ruleForm.lots" placeholder="璇烽�夋嫨搴勫彛" size="small">
-                    <el-option label="搴勫彛涓�" value="搴勫彛涓�"></el-option>
-                    <el-option label="搴勫彛浜�" value="搴勫彛浜�"></el-option>
+                <el-form-item label="搴勫彛" prop="marketId">
+                  <el-select
+                    v-model="ruleForm.marketId"
+                    placeholder="璇烽�夋嫨"
+                    class="select-width"
+                  >
+                    <el-option
+                      v-for="item in marketList"
+                      :key="item.ID"
+                      :label="item.name"
+                      :value="item.ID"
+                    >
+                    </el-option>
                   </el-select>
                 </el-form-item>
-                <el-form-item label="钀戒笣鑼ч噺" prop="silkCocoonCount">
-                  <el-input v-model="ruleForm.silkCocoonCount" size="small"></el-input>
+                <el-form-item label="钀戒笣鑼ч噺" prop="fallingSilkCocoonNumber">
+                  <el-input
+                    v-model.number="ruleForm.fallingSilkCocoonNumber"
+                    size="small"
+                  ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="3">
-                <el-form-item label="杞﹂棿" prop="workshop">
-                  <el-select v-model="ruleForm.workshop" placeholder="璇烽�夋嫨杞﹂棿" size="small">
-                    <el-option label="杞﹂棿涓�" value="杞﹂棿涓�"></el-option>
-                    <el-option label="杞﹂棿浜�" value="杞﹂棿浜�"></el-option>
-                    <el-option label="杞﹂棿涓�" value="杞﹂棿涓�"></el-option>
-                    <el-option label="杞﹂棿鍥�" value="杞﹂棿鍥�"></el-option>
+                <el-form-item label="杞﹂棿" prop="workshopId">
+                  <el-select
+                    v-model="ruleForm.workshopId"
+                    placeholder="璇烽�夋嫨"
+                    class="select-width"
+                    @change='getGroupNumber'
+                  >
+                    <el-option
+                      v-for="item in nameList"
+                      :key="item.number"
+                      :label="item.name"
+                      :value="item.number"
+                    >
+                    </el-option>
                   </el-select>
                 </el-form-item>
-                <el-form-item label="姣忔《鑼ч噺" prop="barrelCocoonCount">
+                <el-form-item label="姣忔《鑼ч噺" prop="bucketCocoonNumber">
                   <div style="display: flex">
-                    <el-input v-model="ruleForm.silkCocoonCount" size="small"></el-input>
-                    <span>鍏�</span>
+                    <el-input
+                      v-model.number="ruleForm.bucketCocoonNumber"
+                      size="small"
+                    ></el-input>
+                    <span class='margin_left_5px'>鍏�</span>
                   </div>
                 </el-form-item>
               </el-col>
               <el-col :span="3">
-                <el-form-item label="缁勫埆" prop="group">
-                  <el-select v-model="ruleForm.group" placeholder="璇烽�夋嫨缁勫埆" size="small">
+                <el-form-item label="缁勫埆" prop="groupNumber">
+                  <el-select
+                    v-model="ruleForm.groupNumber"
+                    placeholder="璇峰厛閫夋嫨杞﹂棿"
+                    no-data-text='璇峰厛閫夋嫨杞﹂棿'
+                    class="select-width"
+                    @change='getGroupNumber'
+                  >
                     <el-option
-                      v-for="item in groupOptions"
-                      :key="item.id"
-                      :label="item.value"
-                      :value="item.id"
-                    ></el-option>
+                      v-for="item in workshopGroupList"
+                      :key="item"
+                      :label="item"
+                      :value="item"
+                    >
+                    </el-option>
                   </el-select>
                 </el-form-item>
-                <el-form-item label="瀹為檯杞﹂��" prop="actualSpeed">
-                  <el-input v-model="ruleForm.actualSpeed" size="small"></el-input>
+                <el-form-item label="瀹為檯杞﹂��" prop="vehicleSpeed">
+                  <el-input
+                    v-model.number="ruleForm.vehicleSpeed"
+                    size="small"
+                  ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="3">
                 <el-form-item label="瑙勬牸" prop="spec">
-                  <el-input v-model="ruleForm.spec" size="small"></el-input>
+                  <el-select
+                    v-model="ruleForm.spec"
+                    placeholder="璇烽�夋嫨"
+                    class="select-width"
+                  >
+                    <el-option
+                      v-for="item in specList"
+                      :key="item.ID"
+                      :label="item.name"
+                      :value="item.name"
+                    >
+                    </el-option>
+                  </el-select>
                 </el-form-item>
-                <el-form-item label="涔欑彮鏃堕棿" prop="bShiftTime">
-                  <el-input v-model="ruleForm.bShiftTime" size="small"></el-input>
+                <el-form-item label="涔欑彮鏃堕棿" prop="timeYi">
+                  <el-date-picker
+                    value-format="yyyy-MM-dd"
+                    type="date"
+                    placeholder="閫夋嫨鏃ユ湡"
+                    v-model="ruleForm.timeYi"
+                    size="small"
+                    style="width: 100%"
+                  ></el-date-picker>
                 </el-form-item>
               </el-col>
               <el-col :span="3">
-                <el-form-item label="鏄惁缁撳簞" prop="end">
-                  <el-input v-model="ruleForm.spec" size="small"></el-input>
+                <el-form-item label="鏄惁缁撳簞" prop="jieZhuang">
+                  <el-input
+                    v-model="ruleForm.jieZhuang"
+                    size="small"
+                  ></el-input>
                 </el-form-item>
-                <el-form-item label="鐢茬彮鏃堕棿" prop="aShiftTime">
-                  <el-input v-model="ruleForm.aShiftTime" size="small"></el-input>
+                <el-form-item label="鐢茬彮鏃堕棿" prop="timeJia">
+                  <el-date-picker
+                    value-format="yyyy-MM-dd"
+                    type="date"
+                    placeholder="閫夋嫨鏃ユ湡"
+                    v-model="ruleForm.timeJia"
+                    size="small"
+                    style="width: 100%"
+                  ></el-date-picker>
                 </el-form-item>
               </el-col>
               <el-col :span="3">
-                <el-form-item label="绛夌骇" prop="grade">
-                  <el-input v-model="ruleForm.grade" size="small"></el-input>
+                <el-form-item label="绛夌骇" prop="level">
+                  <el-input
+                    disabled
+                    v-model="ruleForm.level"
+                    size="small"
+                  ></el-input>
                 </el-form-item>
-                <el-form-item label="杞︾粍缂姌" prop="reelingDiscount">
-                  <el-input v-model="ruleForm.reelingDiscount" size="small"></el-input>
+
+                <el-form-item label="杞︾粍缂姌" prop="groupReelingdiscount">
+                  <el-input
+                    v-model="ruleForm.groupReelingdiscount"
+                    size="small"
+                  ></el-input>
                 </el-form-item>
               </el-col>
             </el-row>
             <el-row>
               <el-col :span="16">
-                <el-form-item label="钀戒笣妗舵暟:" prop="doffBarrelage">
+                <el-form-item label="钀戒笣妗舵暟:" prop="fallingSilkBucket">
                   <div class="doff-barrelage-card">
-                    <div class="d-b-common">
-                      <el-input v-model="ruleForm.oneInput" size="small" class="d-b-c-input"></el-input>
-                      <el-checkbox v-model="ruleForm.isOneDoff"></el-checkbox>
+                    <div class="select-width">
+                      <el-form-item
+                        label=""
+                        @input="inputStart"
+                        label-width="0"
+                        prop="fallingSilkBucketOne"
+                        class='margin_right_10px select-width-input'
+                      >
+                        <el-input
+                          v-model="ruleForm.fallingSilkBucketOne"
+                          size="small"
+                          class="d-b-c-input"
+                        ></el-input>
+                      </el-form-item>
+                      <el-checkbox
+                        v-model="ruleForm.isfallingSilkBucketOne"
+                      ></el-checkbox>
                     </div>
-                    <div class="d-b-common">
-                      <el-input v-model="ruleForm.twoInput" size="small" class="d-b-c-input"></el-input>
-                      <el-checkbox v-model="ruleForm.isTwoDoff"></el-checkbox>
+                    <div class="select-width">
+                      <el-form-item
+                        label=""
+                        @input="inputStart"
+                        label-width="0"
+                        prop="fallingSilkBucketTwo"
+                        class='margin_right_10px select-width-input'
+                      >
+                        <el-input
+                          v-model="ruleForm.fallingSilkBucketTwo"
+                          size="small"
+                          class="d-b-c-input"
+                        ></el-input>
+                      </el-form-item>
+                      <el-checkbox
+                        v-model="ruleForm.isfallingSilkBucketTwo"
+                      ></el-checkbox>
                     </div>
-                    <div class="d-b-common">
-                      <el-input v-model="ruleForm.threeInput" size="small" class="d-b-c-input"></el-input>
-                      <el-checkbox v-model="ruleForm.isThreeDoff"></el-checkbox>
+                    <div class="select-width">
+                      <el-form-item
+                        label=""
+                        @input="inputStart"
+                        label-width="0"
+                        prop="fallingSilkBucketThree"
+                        class='margin_right_10px select-width-input'
+                      >
+                        <el-input
+                          v-model="ruleForm.fallingSilkBucketThree"
+                          size="small"
+                          class="d-b-c-input"
+                        ></el-input>
+                      </el-form-item>
+                      <el-checkbox
+                        v-model="ruleForm.isfallingSilkBucketThree"
+                      ></el-checkbox>
                     </div>
                   </div>
                 </el-form-item>
-                <el-form-item label="鍙峰甫棰滆壊:" prop="numBandColor">
+                <el-form-item label="鍙峰甫棰滆壊:" prop="back">
                   <div class="doff-barrelage-card">
                     <div class="d-b-common">
-                      <div class="n-m-c-label">绗竴鍥�</div>
-                      <el-input v-model="ruleForm.oneInput" size="small" class="d-b-c-input"></el-input>
+                      <el-form-item
+                        label="绗竴鍥�"
+                        @input="inputStartTwo"
+                        label-width="90px"
+                        prop="oneBack"
+                        class="select-width"
+                      >
+                        <el-input
+                          v-model="ruleForm.oneBack" 
+                          size="small"
+                        ></el-input>
+                      </el-form-item>
                     </div>
                     <div class="d-b-common">
-                      <div class="n-m-c-label">绗簩鍥�</div>
-                      <el-input v-model="ruleForm.twoInput" size="small" class="d-b-c-input"></el-input>
+                      <el-form-item
+                        label="绗簩鍥�"
+                        @input="inputStartTwo"
+                        label-width="90px"
+                        prop="twoBack"
+                        class="select-width"
+                      >
+                        <el-input
+                          v-model="ruleForm.twoBack"
+                          size="small"
+                        ></el-input>
+                      </el-form-item>
                     </div>
                     <div class="d-b-common">
-                      <div class="n-m-c-label">绗笁鍥�</div>
-                      <el-input v-model="ruleForm.threeInput" size="small" class="d-b-c-input"></el-input>
+                      <el-form-item
+                        label="绗笁鍥�"
+                        @input="inputStartTwo"
+                        label-width="90px"
+                        prop="threeBack"
+                        class="select-width"
+                      >
+                        <!-- <div class="n-m-c-label">绗笁鍥�</div> -->
+                        <el-input
+                          v-model="ruleForm.threeBack"
+                          size="small"
+                        ></el-input>
+                      </el-form-item>
                     </div>
                   </div>
                 </el-form-item>
               </el-col>
               <el-col :span="4">
-                <el-form-item label="鐞嗚涓濋噺" prop="theorySilkCount">
-                  <el-input v-model="ruleForm.theorySilkCount" size="small"></el-input>
+                <el-form-item label="鐞嗚涓濋噺" prop="theorySilkAmount">
+                  <el-input
+                    v-model.number="ruleForm.theorySilkAmount"
+                    size="small"
+                  ></el-input>
                 </el-form-item>
-                <el-form-item label="鎬讳骇閲�" prop="totalOutput">
+                <el-form-item label="鎬讳骇閲�" prop="total">
                   <div style="display: flex">
-                    <el-input v-model="ruleForm.totalOutput" size="small"></el-input>
-                    <span>kg</span>
+                    <el-input
+                      v-model.number="ruleForm.total"
+                      size="small"
+                    ></el-input>
+                    <span class='margin_left_5px'>kg</span>
                   </div>
                 </el-form-item>
               </el-col>
               <el-col :span="4">
-                <el-form-item label="鍙版椂浜ч噺" prop="platformTimeOutput">
-                  <el-input v-model="ruleForm.platformTimeOutput" size="small"></el-input>
+                <el-form-item label="鍙版椂浜ч噺" prop="hourYield">
+                  <el-input
+                    v-model.number="ruleForm.hourYield"
+                    size="small"
+                  ></el-input>
                 </el-form-item>
               </el-col>
             </el-row>
           </el-form>
         </div>
         <div class="b-t-right">
-          <div class="b-t-r-icon" :class="isDeviceConnectStatus ? 'c-p' : 'c-n'" @click="deviceConnectClick">
+          <div
+            class="b-t-r-icon"
+            :class="isDeviceConnectStatus ? 'c-p' : 'c-n'"
+            @click="deviceConnectClick"
+          >
             <i class="el-icon-d-arrow-left"></i>
           </div>
         </div>
       </div>
       <div class="body-table">
         <div class="b-t-unit">鍗曚綅锛氬厠</div>
-        <el-table :data="tableData" style="width: 100%" border>
-          <el-table-column prop="carNum" label="杞﹀彿" width="99" align="center"> </el-table-column>
+        <el-table
+          :data="tableData"
+          style="width: 100%"
+          border
+          :height="'calc(100% - 0px)'"
+        >
+          <el-table-column
+            prop="carNumber"
+            label="杞﹀彿"
+            width="99"
+            align="center"
+          >
+          </el-table-column>
           <el-table-column label="绗竴鍥�" align="center">
-            <el-table-column prop="fist1" label="1" width="60" align="center"> </el-table-column>
-            <el-table-column prop="fist2" label="2" width="60" align="center"> </el-table-column>
-            <el-table-column prop="fist3" label="3" width="60" align="center"> </el-table-column>
-            <el-table-column prop="fist4" label="4" width="60" align="center"> </el-table-column>
+            <el-table-column
+              prop="pieceNumber11"
+              label="1"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="pieceNumber12"
+              label="2"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="pieceNumber13"
+              label="3"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="pieceNumber14"
+              label="4"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
           </el-table-column>
           <el-table-column label="绗簩鍥�" align="center">
-            <el-table-column prop="two1" label="1" width="60" align="center"> </el-table-column>
-            <el-table-column prop="two2" label="2" width="60" align="center"> </el-table-column>
-            <el-table-column prop="two3" label="3" width="60" align="center"> </el-table-column>
-            <el-table-column prop="two4" label="4" width="60" align="center"> </el-table-column>
+            <el-table-column
+              prop="pieceNumber21"
+              label="1"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="pieceNumber22"
+              label="2"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="pieceNumber23"
+              label="3"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="pieceNumber24"
+              label="4"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
           </el-table-column>
           <el-table-column label="绗笁鍥�" align="center">
-            <el-table-column prop="three1" label="1" width="60" align="center"> </el-table-column>
-            <el-table-column prop="three2" label="2" width="60" align="center"> </el-table-column>
-            <el-table-column prop="three3" label="3" width="60" align="center"> </el-table-column>
-            <el-table-column prop="three4" label="4" width="60" align="center"> </el-table-column>
+            <el-table-column
+              prop="pieceNumber31"
+              label="1"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="pieceNumber32"
+              label="2"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="pieceNumber33"
+              label="3"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="pieceNumber34"
+              label="4"
+              width="60"
+              align="center"
+            >
+            </el-table-column>
           </el-table-column>
-          <el-table-column prop="date" label="鍙颁骇閲�" align="center"> </el-table-column>
-          <el-table-column prop="date" label="涓汉浜ч噺" width="60" align="center"> </el-table-column>
-          <el-table-column prop="date" label="鍙版椂浜ч噺" width="60" align="center"> </el-table-column>
-          <el-table-column prop="date" label="涓汉缂姌" width="60" align="center"> </el-table-column>
-          <el-table-column prop="date" label="涓�鍥炰骇閲�" width="60" align="center"> </el-table-column>
-          <el-table-column prop="date" label="涓�鍥炲彴浜�" width="60" align="center"> </el-table-column>
-          <el-table-column prop="date" label="涓�鍥炵极鎶�" width="60" align="center"> </el-table-column>
-          <el-table-column prop="date" label="浜屽洖浜ч噺" width="60" align="center"> </el-table-column>
-          <el-table-column prop="date" label="浜屽洖鍙颁骇" width="60" align="center"> </el-table-column>
-          <el-table-column prop="date" label="浜屽洖缂姌" width="60" align="center"> </el-table-column>
-          <el-table-column prop="date" label="涓夊洖浜ч噺" width="60" align="center"> </el-table-column>
-          <el-table-column prop="date" label="涓夊洖鍙颁骇" width="60" align="center"> </el-table-column>
-          <el-table-column prop="date" label="涓夊洖缂姌" width="60" align="center"> </el-table-column>
+          <el-table-column prop="oneYield" label="鍙颁骇閲�" align="center">
+          </el-table-column>
+          <el-table-column
+            prop="peopleYield"
+            label="涓汉浜ч噺"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="hourYield"
+            label="鍙版椂浜ч噺"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="personReelingdiscount"
+            label="涓汉缂姌"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="allYield1"
+            label="涓�鍥炰骇閲�"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="oneYield1"
+            label="涓�鍥炲彴浜�"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="reelingdiscount1"
+            label="涓�鍥炵极鎶�"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="allYield2"
+            label="浜屽洖浜ч噺"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="oneYield2"
+            label="浜屽洖鍙颁骇"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="reelingdiscount2"
+            label="浜屽洖缂姌"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="allYield3"
+            label="涓夊洖浜ч噺"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="oneYield3"
+            label="涓夊洖鍙颁骇"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="reelingdiscount3"
+            label="涓夊洖缂姌"
+            width="60"
+            align="center"
+          >
+          </el-table-column>
         </el-table>
       </div>
     </div>
@@ -217,7 +549,16 @@
 </template>
 
 <script>
-import addProductDialog from "./components/addProductDialog"
+import addProductDialog from "./components/addProductDialog";
+import {
+  // getYieldRegisterInfo,
+  saveYieldRegister,
+  getWorkshopManageCar,
+  getWorkshopManageGroup,
+} from "@/api/productManage/productRegisterForm.js";
+import {
+  getDictList,
+} from "@/api/productManage/silkRegisterForm.js";
 export default {
   name: "addProductRegisterPage",
   props: {},
@@ -227,67 +568,229 @@
   data() {
     return {
       isDeviceConnectStatus: true,
+      marketList: [], //搴勫彛
+      nameList: [], //杞﹂棿
+      workshopGroupList: [], //缁勫埆
+      specList: [], //瑙勬牸
       ruleForm: {
         number: "",
-        productTime: "",
-        productDate: "",
-        numTimes: "",
-        lots: "搴勫彛涓�",
-        silkCocoonCount: "",
-        workshop: "杞﹂棿涓�",
-        barrelCocoonCount: "",
-        group: 1,
-        actualSpeed: "",
+        record: "",
+        createTime: "",
+        circle: "",
+        marketId: "",
+        fallingSilkCocoonNumber: "",
+        workshopId: "",
+        bucketCocoonNumber: "",
+        groupNumber: "",
+        vehicleSpeed: "",
         spec: "",
-        bShiftTime: "",
-        aShiftTime: "",
-        end: false,
-        reelingDiscount: "",
-        grade: "",
-        oneInput: "",
-        isOneDoff: false,
-        twoInput: "",
-        isTwoDoff: false,
-        threeInput: "",
-        isThreeDoff: false,
-        theorySilkCount: "",
-        totalOutput: "",
-        platformTimeOutput: ""
+        timeYi: "",
+        jieZhuang: "",
+        timeJia: "",
+        level: "",
+        groupReelingdiscount: "",
+        fallingSilkBucket: "",
+        fallingSilkBucketOne: "",
+        isfallingSilkBucketOne: "",
+        fallingSilkBucketTwo: "",
+        isfallingSilkBucketTwo: "",
+        fallingSilkBucketThree: "",
+        isfallingSilkBucketThree: "",
+        back: "",
+        oneBack: "",
+        twoBack: "",
+        threeBack: "",
+        theorySilkAmount: "",
+        total: "",
+        hourYield: "",
       },
       rules: {
-        number: [{ required: true, message: "璇疯緭鍏ョ紪鍙�", trigger: "blur" }],
-        productDate: [{ required: true, message: "璇烽�夋嫨鐢熶骇鏃ユ湡", trigger: "change" }],
-        workshop: [{ type: "date", required: true, message: "璇烽�夋嫨杞﹂棿", trigger: "change" }]
+        number: [{ required: true, message: "璇疯緭鍏ョ紪鍙�", trigger:  ["change", "blur"] }],
+        createTime: [
+          { required: true, message: "璇烽�夋嫨鐢熶骇鏃ユ湡", trigger:  ["change", "blur"] },
+        ],
+        marketId:  [
+          { required: true, message: "璇烽�夋嫨", trigger:  ["change", "blur"] },
+        ],
+        workshopId:  [
+          { required: true, message: "璇烽�夋嫨", trigger:  ["change", "blur"] },
+        ],
+        groupNumber:  [
+          { required: true, message: "璇烽�夋嫨", trigger:  ["change", "blur"] },
+        ],
+        spec:  [
+          { required: true, message: "璇烽�夋嫨", trigger:  ["change", "blur"] },
+        ],
       },
-      groupOptions: [
-        { id: 1, value: 1 },
-        { id: 2, value: 2 },
-        { id: 3, value: 3 },
-        { id: 4, value: 4 },
-        { id: 5, value: 5 },
-        { id: 6, value: 6 },
-        { id: 7, value: 7 },
-        { id: 8, value: 8 },
-        { id: 9, value: 9 }
-      ],
-      tableData: []
-    }
+      tableData: [],
+      isAddloading: false,
+      productRegisterId:null,
+      productRegisterNumber:null,
+    };
   },
-  created() {},
+  mounted() {
+    let query = this.$route.query;
+    if (query) {
+      this.productRegisterId = query.id ? query.id : "";
+      this.productRegisterNumber = query.number ? query.number : "";
+    }
+    this.getSelectDataList();
+  },
   methods: {
+    getSelectDataList() {
+      //杞﹂棿
+      getDictList({
+        dictType: 1,
+      }).then((res) => {
+        if (res.code == 200) {
+          this.nameList = res.data || [];
+        }
+      });
+      //瑙勬牸
+      getDictList({
+        dictType: 3,
+      }).then((res) => {
+        if (res.code == 200) {
+          this.specList = res.data || [];
+        }
+      });
+      //搴勫彛
+      getDictList({
+        dictType: 0,
+      }).then((res) => {
+        if (res.code == 200) {
+          this.marketList = res.data || [];
+        }
+      });
+    },
+    getGroupNumber(){
+      if(this.ruleForm.workshopId){
+        //缁勫埆
+        getWorkshopManageGroup({number:this.ruleForm.workshopId}).then((res) => {
+           if (res.code == 200) {
+              this.workshopGroupList=[]
+              let workshopGroupList = res.data || {};
+              if(Object.keys(workshopGroupList).length>0){
+                for(let i in workshopGroupList){
+                  this.workshopGroupList.push(workshopGroupList[i])
+                }
+              }
+            }
+          });
+          if(this.ruleForm.groupNumber){
+            getWorkshopManageCar({
+              workshopNumber:this.ruleForm.workshopId+'',
+              groupNumber:this.ruleForm.groupNumber,
+            }).then((res) => {
+              if (res.code == 200) {
+                this.tableData=[]
+                let data = JSON.parse(JSON.stringify(res.data)) || {};
+               if(Object.keys(data).length>0){
+                for(let i in data){
+                  for(let j in data[i]){
+                    this.tableData.push({carNumber:data[i][j],perList:data[i]})
+                  }
+                }
+               }
+              }
+            });
+          }
+      }else{
+        this.workshopGroupList =[]
+      }
+    },
+    inputStart() {
+      this.ruleForm.fallingSilkBucket = this.ruleForm.fallingSilkBucketOne + "-" + this.ruleForm.fallingSilkBucketTwo+"-" + this.ruleForm.fallingSilkBucketThree;   
+    },
+    inputStartTwo() {     
+      this.ruleForm.back = this.ruleForm.oneBack + "-" + this.ruleForm.twoBack+"-" + this.ruleForm.threeBack;   
+    },
     // 浠櫒杩炴帴寮圭獥
     deviceConnectClick() {
-      console.log("dddd")
       if (this.isDeviceConnectStatus) {
-        this.$refs.addProductDialog.editDialogVisible = true
+        this.$refs.addProductDialog.editDialogVisible = true;
       }
     },
     // 閫�鍑�
     quitClick() {
-      this.$router.go(-1)
-    }
-  }
-}
+      this.$router.go(-1);
+    },
+    // 鏀惧純
+    cancelClickOne() {
+      this.form = {
+        number: "",
+        finishDate: "",
+        market: "",
+        name: "",
+        spec: "",
+        workshopGroup: "",
+        circleTwo: "",
+        circle: "",
+        totalCircle: "",
+        position: "",
+      };
+      this.$refs.form.resetFields();
+      this.productId = 1;
+      this.tableList.tableData = [
+        {
+          productId: 1,
+          position: "",
+          fineness: 0,
+          quantity: 0,
+          sum: "",
+        },
+      ];
+    },
+    // 淇濆瓨
+    saveClickOne(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          let form = JSON.parse(JSON.stringify(this.form));
+          // params.workshopGroup=Number(params.workshopGroup)
+          this.isAddloading = true;
+          delete form.circleTwo;
+          let finenessList = JSON.parse(
+            JSON.stringify(this.tableList.tableData)
+          );
+          for (let i in finenessList) {
+            delete finenessList[i].productId;
+          }
+          let params = {
+            finenessList: finenessList,
+            ...form,
+          };
+          // 缂栬緫
+          if (this.inspectID) {
+            params.ID = this.form.ID ? this.form.ID : Number(this.inspectID);
+          }
+          saveYieldRegister(params)
+            .then((res) => {
+              if (res.code == 200) {
+                this.isRegisterSave = true;
+                this.$message({
+                  message: "淇濆瓨鎴愬姛锛�",
+                  type: "success",
+                });
+                this.$router.push({
+                  path: "/productManage/silkRegisterForm",
+                });
+              }
+              this.isAddloading = false;
+            })
+            .catch(() => {
+              setTimeout(() => {
+                this.isAddloading = false;
+              }, 3000);
+            });
+        } else {
+          console.log("error submit!!");
+
+          return false;
+        }
+      });
+    },
+  },
+};
 </script>
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
@@ -322,6 +825,12 @@
     padding: 10px 15px;
     height: calc(100% - 180px);
     border-radius: 4px;
+    .select-width {
+      width: calc(100%  - 20px);
+      .select-width-input{
+        width:calc(100% - 200px);float:left;
+      }
+    }
     .body-top {
       display: flex;
       .b-t-left {
@@ -361,6 +870,8 @@
       }
     }
     .body-table {
+      width:100%;
+      height:calc(100% - 263px);
       position: relative;
       .b-t-unit {
         position: absolute;

--
Gitblit v1.8.0