From 4a8efc53405efe0d20312694d39fbd8184badb39 Mon Sep 17 00:00:00 2001
From: yuyu <1981343953@qq.com>
Date: 星期二, 15 八月 2023 17:14:23 +0800
Subject: [PATCH] 8.15提交

---
 src/views/experiment/inspectionApplication/index.vue |  812 ++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 596 insertions(+), 216 deletions(-)

diff --git a/src/views/experiment/inspectionApplication/index.vue b/src/views/experiment/inspectionApplication/index.vue
index b53ff7c..219169e 100644
--- a/src/views/experiment/inspectionApplication/index.vue
+++ b/src/views/experiment/inspectionApplication/index.vue
@@ -17,17 +17,17 @@
               <el-form-item label="妫�楠岀被鍨�:">
                 <el-select v-model="searchData.type" placeholder="鍏ㄩ儴" style="width: 100px;margin-right: 20px;">
                   <el-option
-                    v-for="item in options"
+                    v-for="item in typeoptions"
                     :key="item.value"
                     :label="item.label"
                     :value="item.value">
                   </el-option>
                 </el-select>
               </el-form-item>
-              <el-form-item label="妫�楠岀姸鎬�:" style="margin-right: 20px;">
+              <el-form-item label="妫�楠岀粨鏋�:" style="margin-right: 20px;">
                 <el-select v-model="searchData.state" placeholder="鍏ㄩ儴" style="width: 100px;margin-right: 20px;">
                   <el-option
-                    v-for="item in options"
+                    v-for="item in stateoptions"
                     :key="item.value"
                     :label="item.label"
                     :value="item.value">
@@ -35,8 +35,8 @@
                 </el-select>
               </el-form-item>
               <el-form-item>
-                <el-button type="primary">鏌ヨ</el-button>
-                <el-button type="primary" plain>閲嶇疆</el-button>
+                <el-button type="primary" @click="searchInspections">鏌ヨ</el-button>
+                <el-button type="primary" plain @click="reset">閲嶇疆</el-button>
               </el-form-item>
             </el-form>
             <el-form class="rightBtn">
@@ -73,51 +73,42 @@
                   min-width="30px"
                 />
                 <el-table-column
-                  prop="applicationnum"
+                  prop="icode"
                   label="鐢宠鍗曞彿"
                   min-width="100px"
                 />
                 <el-table-column
-                  prop="checktype"
+                  prop="type"
                   label="妫�楠岀被鍨�"
-                  min-width="80px"
-                />
-                <el-table-column
-                  prop="checkstate"
-                  label="妫�楠岀姸鎬�"
-                  min-width="70px">
+                  min-width="80px">
                   <template slot-scope="scope">
-                    <div v-if="scope.row.checkstate === '1'">
-                        <span style="color: green;">宸叉娴�</span>
-                    </div>
-                    <div v-else>
-                        <span style="color: red;">鏈娴�</span>
-                    </div>
-                    
+                    <div v-if="scope.row.type === 0" ><span>鍘熸潗鏂欐楠�</span></div>
+                    <div v-if="scope.row.type === 1" ><span>濮旀墭妫�楠�</span></div>
+                    <div v-if="scope.row.type === 2" ><span>鎴愬搧妫�楠�</span></div>
                   </template>
                 </el-table-column>
                 <el-table-column
-                  prop="deliverydate"
+                  prop="formTime"
                   label="鏉ユ枡鏃ユ湡"
                   min-width="100px"
                 />
                 <el-table-column
-                  prop="provider"
+                  prop="supplier"
                   label="渚涘簲鍟嗗悕绉�"
                   min-width="150px"
                 />
                 <el-table-column
-                  prop="rawcode"
+                  prop="mcode"
                   label="鍘熸潗鏂欑紪鐮�"
-                  min-width="120px"
+                  min-width="150px"
                 />
                 <el-table-column
-                  prop="rawname"
+                  prop="name"
                   label="鍘熸潗鏂欏悕绉�"
                   min-width="80px"
                 />
                 <el-table-column
-                  prop="modelandspecification"
+                  prop="specifications"
                   label="瑙勬牸鍨嬪彿"
                   min-width="160px"
                 />
@@ -127,49 +118,34 @@
                   min-width="50px"
                 />
                 <el-table-column
-                  prop="amount"
+                  prop="num"
                   label="鏁伴噺"
                   min-width="50px"
                 />
                 <el-table-column
-                  prop="registrationdate"
+                  prop="createTime"
                   label="鐧昏鏃ユ湡"
                   min-width="80px"
                 />
                 <el-table-column
-                  prop="registrator"
+                  prop="userName"
                   label="鐧昏浜�"
                   min-width="80px"
                 />
                 <el-table-column
-                  prop="qualified"
-                  label="妫�楠岀姸鎬�"
+                  prop="inspection_status"
+                  label="妫�楠岀粨鏋�"
                   min-width="80px">
                   <template slot-scope="scope">
-                    <div v-if="scope.row.qualified === null">
-                        <span></span>
-                    </div>
-                    <div v-else>
-                    <el-tag :type="scope.row.qualified === '0' ? 'success' : 'danger'"
+                    <el-tag class="tag" :type="scope.row.inspection_status === 0 ? 'danger' : 'success'"
                     disable-transitions
-                  >{{ scope.row.qualified === '0' ? '鍚堟牸' : '涓嶅悎鏍�' }}</el-tag>
-                    </div>
+                  >{{ scope.row.inspection_status === 0 ? '涓嶅悎鏍�' : '鍚堟牸' }}</el-tag>
                   </template>
                 </el-table-column>
                 <el-table-column
-                  prop="applier"
-                  label="鐢宠浜�"
-                  min-width="80px"
-                />
-                <el-table-column
-                  prop="checker"
-                  label="妫�楠屼汉"
-                  min-width="80px"
-                />
-                <el-table-column
-                  prop="checktime"
+                  prop="checkdate"
                   label="妫�楠屾棩鏈�"
-                  min-width="80px"
+                  min-width="150px"
                 />
                 <el-table-column
                   label="鎿嶄綔"
@@ -188,7 +164,7 @@
                 <el-pagination
                   class="pagination"
                   :current-page="currentPage"
-                  :page-sizes="[100, 200, 300, 400]"
+                  :page-sizes="[5, 10, 20, 30]"
                   :page-size="pageSize"
                   layout="total, sizes, prev, pager, next, jumper"
                   :total="total"
@@ -205,76 +181,355 @@
               width="50%"
             >
               <div class="check-box">
-                <el-radio-group v-model="type">
+                <el-radio-group v-model="type" @change="handleRadioChange">
                   <el-radio :label="0" border>鍘熸潗鏂欐楠�</el-radio>
-                  <el-radio :label="1" border>鍗婃垚鍝佹楠�</el-radio>
+                  <el-radio :label="1" border>濮旀墭妫�楠�</el-radio>
                   <el-radio :label="2" border>鎴愬搧妫�楠�</el-radio>
                 </el-radio-group>
               </div>
-              <el-form :model="infoForm" ref="infoForm" class="infoForm" label-position="top" label-width="200px" size="mini">
-                <el-row :gutter="100">
-                    <el-col :span="10">
-                        <el-form-item label="鏉ユ枡鏃ユ湡锛�">
-                            <el-input style="width: 300px" type="text" :value="infoForm.deliverydate" placeholder="璇疯緭鍏ユ潵鏂欐棩鏈�" autocomplete="off" />  
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="10">
-                        <el-form-item label="渚涘簲鍟嗗悕绉帮細">
-                            <el-input style="width: 300px" type="text" :value="infoForm.name" placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О" autocomplete="off" /> 
-                        </el-form-item>
-                    </el-col>
-                    </el-row>
-                    <el-row :gutter="100">
-                    <el-col :span="10">
-                        <el-form-item label="鍘熸潗鏂欑紪鐮侊細">
-                            <el-input style="width: 300px" type="text" :value="infoForm.code" placeholder="璇疯緭鍏ュ師鏉愭枡缂栫爜" autocomplete="off" />  
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="10">
-                        <el-form-item label="鍘熸潗鏂欏悕绉帮細">
-                            <el-input style="width: 300px" type="text" :value="infoForm.name" placeholder="璇疯緭鍏ュ師鏉愭枡鍚嶇О" autocomplete="off" />  
-                        </el-form-item>
-                    </el-col>
-                    </el-row>
-                    <el-row :gutter="100">
-                    <el-col :span="10">
-                        <el-form-item label="瑙勬牸鍨嬪彿锛�">
-                            <el-input style="width: 300px" type="text" :value="infoForm.modelandspecification" placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�" autocomplete="off" />  
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="10">
-                        <el-form-item label="鍗曚綅锛�">
-                            <el-input style="width: 300px" type="text" :value="infoForm.unit" placeholder="璇疯緭鍏ュ崟浣�" autocomplete="off" />  
-                        </el-form-item>
-                    </el-col>
-                    </el-row>
-                    <el-row :gutter="100">
-                    <el-col :span="10">
-                        <el-form-item label="鏁伴噺锛�">
-                            <el-input style="width: 300px" type="text" :value="infoForm.amount" placeholder="璇疯緭鍏ユ暟閲�" autocomplete="off" />  
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="10">
-                        <el-form-item label="妫�楠屾椂闂达細">
+              <div v-if="type === 0 || type === ''">
+                <el-form :model="infoForm" ref="infoForm" class="checkTypeForm" label-position="top" label-width="200px" size="mini">
+                  <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="鏉ユ枡鏃ユ湡锛�">
+                              <el-input style="width: 300px" type="text" :value="infoForm.dateSurvey" placeholder="璇疯緭鍏ユ潵鏂欐棩鏈�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="渚涘簲鍟嗗悕绉帮細">
+                              <el-input style="width: 300px" type="text" :value="infoForm.supplierName" placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О" autocomplete="off" /> 
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                      <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="鍘熸潗鏂欑紪鐮侊細">
+                              <el-input style="width: 300px" type="text" :value="infoForm.materialCoding" placeholder="璇疯緭鍏ュ師鏉愭枡缂栫爜" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="鍘熸潗鏂欏悕绉帮細">
+                              <el-input style="width: 300px" type="text" :value="infoForm.materialName" placeholder="璇疯緭鍏ュ師鏉愭枡鍚嶇О" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                      <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="瑙勬牸鍨嬪彿锛�">
+                              <el-input style="width: 300px" type="text" :value="infoForm.specificationsModels" placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="鍗曚綅锛�">
+                              <el-input style="width: 300px" type="text" :value="infoForm.unit" placeholder="璇疯緭鍏ュ崟浣�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                      <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="鏁伴噺锛�">
+                              <el-input style="width: 300px" type="text" :value="infoForm.quantity" placeholder="璇疯緭鍏ユ暟閲�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="妫�楠屾椂闂达細">
+                              <el-date-picker
+                                  v-model="infoForm.checkdate"
+                                  type="daterange"
+                                  range-separator="鑷�"
+                                  start-placeholder="寮�濮嬫棩鏈�"
+                                  end-placeholder="缁撴潫鏃ユ湡"
+                                  style="width: 300px;">
+                              </el-date-picker>
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                </el-form>
+              </div>
+              <div v-if="type === 1">
+                <el-form :model="commisionSelection" ref="commisionTable" class="checkTypeForm" label-position="top" label-width="200px" size="mini">
+                  <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="鏉ユ枡鏃ユ湡锛�">
+                              <el-input style="width: 300px" type="text" :value="commisionSelection.formTime" placeholder="璇疯緭鍏ユ潵鏂欐棩鏈�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="渚涘簲鍟嗗悕绉帮細">
+                              <el-input style="width: 300px" type="text" :value="commisionSelection.supplier" placeholder="璇疯緭鍏ュ鎵樺崟浣�" autocomplete="off" /> 
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                      <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="濮旀墭缂栧彿锛�">
+                              <el-input style="width: 300px" type="text" :value="commisionSelection.mcode" placeholder="璇疯緭鍏ユ牱鍝佺紪鍙�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="濮旀墭鍚嶇О锛�">
+                              <el-input style="width: 300px" type="text" :value="commisionSelection.name" placeholder="璇疯緭鍏ユ牱鍝佸悕绉�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                      <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="瑙勬牸鍨嬪彿锛�">
+                              <el-input style="width: 300px" type="text" :value="commisionSelection.specifications" placeholder="璇疯緭鍏ュ瀷鍙疯鏍�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="鍗曚綅锛�">
+                            <el-input style="width: 300px" type="text" :value="commisionSelection.unit" placeholder="璇疯緭鍏ュ崟浣�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                      <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="鏁伴噺锛�">
+                            <el-input style="width: 300px" type="text" :value="commisionSelection.num" placeholder="璇疯緭鍏ユ暟閲�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="妫�楠屾棩鏈燂細">
                             <el-date-picker
-                                v-model="infoForm.checkdate"
-                                type="daterange"
-                                range-separator="鑷�"
-                                start-placeholder="寮�濮嬫棩鏈�"
-                                end-placeholder="缁撴潫鏃ユ湡"
-                                style="width: 300px;">
+                                  v-model="commisionSelection.checkdate"
+                                  type="daterange"
+                                  range-separator="鑷�"
+                                  start-placeholder="寮�濮嬫棩鏈�"
+                                  end-placeholder="缁撴潫鏃ユ湡"
+                                  style="width: 300px;">
                             </el-date-picker>
-                        </el-form-item>
-                    </el-col>
-                    </el-row>
-              </el-form>
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                </el-form>
+              </div>
+              <div v-if="type === 2">
+                <el-form :model="finishedTable" ref="finishedTable" class="checkTypeForm" label-position="top" label-width="200px" size="mini">
+                  <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="鏉ユ枡鏃ユ湡锛�">
+                              <el-input style="width: 300px" type="text" v-model="finishedTable.deliverydate" placeholder="璇疯緭鍏ユ潵鏂欐棩鏈�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="渚涘簲鍟嗗悕绉帮細">
+                              <el-input style="width: 300px" type="text" v-model="finishedTable.supplier" placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О" autocomplete="off" /> 
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                      <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="鍘熸潗鏂欑紪鐮侊細">
+                              <el-input style="width: 300px" type="text" v-model="finishedTable.code" placeholder="璇疯緭鍏ュ師鏉愭枡缂栫爜" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="鍘熸潗鏂欏悕绉帮細">
+                              <el-input style="width: 300px" type="text" v-model="finishedTable.name" placeholder="璇疯緭鍏ュ師鏉愭枡鍚嶇О" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                      <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="瑙勬牸鍨嬪彿锛�">
+                              <el-input style="width: 300px" type="text" v-model="finishedTable.modelandspecification" placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="鍗曚綅锛�">
+                              <el-input style="width: 300px" type="text" v-model="finishedTable.unit" placeholder="璇疯緭鍏ュ崟浣�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                      <el-row :gutter="100">
+                      <el-col :span="10">
+                          <el-form-item label="鏁伴噺锛�">
+                              <el-input style="width: 300px" type="text" v-model="finishedTable.amount" placeholder="璇疯緭鍏ユ暟閲�" autocomplete="off" />  
+                          </el-form-item>
+                      </el-col>
+                      <el-col :span="10">
+                          <el-form-item label="妫�楠屾椂闂达細">
+                              <el-date-picker
+                                  v-model="finishedTable.checkdate"
+                                  type="daterange"
+                                  range-separator="鑷�"
+                                  start-placeholder="寮�濮嬫棩鏈�"
+                                  end-placeholder="缁撴潫鏃ユ湡"
+                                  style="width: 300px;">
+                              </el-date-picker>
+                          </el-form-item>
+                      </el-col>
+                      </el-row>
+                </el-form>
+              </div>
               <span slot="footer" class="dialog-footer">
                 <el-button @click="checkTypeVisible = false">鍙� 娑�</el-button>
-                <el-button type="primary" @click="goToForInspectionDetail">纭� 瀹�</el-button>
+                <el-button type="primary" @click="addInspection">纭� 瀹�</el-button>
               </span>
             </el-dialog>
           </div>
         </div>
+        <!-- 鍘熸潗鏂欐楠屾ā鎬佹 -->
+        <el-dialog
+        title="鍘熸潗鏂欐楠�"
+        :visible.sync="rawmaterialVisible"
+        width="60%">
+          <div class="table-box">
+            <el-table
+              ref="multipleTable"
+              :max-height="800"
+              :cell-style="{textAlign: 'center'}"
+              :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}"
+              :data="rawMaterialTable"
+              style="width: 100%"
+              @selection-change="handleSelectionChange"
+            >
+              <el-table-column
+                type="selection"
+                label=""
+                min-width="10%"
+              /> 
+              <el-table-column
+                type="index"
+                label="搴忓彿"
+                min-width="8%"
+              />
+              <el-table-column
+                prop="dateSurvey"
+                label="鏉ユ枡鏃ユ湡"
+                min-width="8%"
+              />
+              <el-table-column
+                prop="supplierName"
+                label="渚涘簲鍟嗗悕绉�"
+                min-width="12%"
+              />
+              <el-table-column
+                prop="materialCoding"
+                label="鏉愭枡缂栫爜"
+                min-width="8%"
+              />
+              <el-table-column
+                prop="materialName"
+                label="鏉愭枡鍚嶇О"
+                min-width="8%"
+              />
+              <el-table-column
+                prop="specificationsModels"
+                label="瑙勬牸鍨嬪彿"
+                min-width="12%"
+              />
+              <el-table-column
+                prop="unit"
+                label="鍗曚綅"
+                min-width="5%"
+              />
+              <el-table-column
+                prop="quantity"
+                label="鏁伴噺"
+                min-width="5%"
+              />
+              <el-table-column
+                prop="inspectionDate"
+                label="鎶ユ鏃ユ湡"
+                min-width="8%"
+              />
+              <el-table-column
+                prop="surveyor"
+                label="妫�楠屼汉"
+                min-width="8%"
+              />
+              <el-table-column
+                prop="createTime"
+                label="妫�楠屾棩鏈�"
+                min-width="8%"
+              />
+              <el-table-column
+                prop="state"
+                label="鐘舵��"
+                min-width="8%"
+              >
+              <template slot-scope="scope">
+                <span :style="{ color: scope.row.state === 1 ? 'green' : 'red' }">
+                  {{ scope.row.state===1 ? '宸叉娴�':'寰呮娴�' }}
+                </span>
+              </template>
+              </el-table-column>
+            </el-table>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="rawmaterialVisible = false">鍙� 娑�</el-button>
+                <el-button type="primary" @click="handleRawMaterialSelection">纭� 瀹�</el-button>
+            </span>
+          </div>
+        </el-dialog>
+        <!-- 濮旀墭妫�楠屾ā鎬佹 -->
+        <el-dialog
+        title="濮旀墭妫�楠�"
+        :visible.sync="commisionVisible"
+        width="60%">
+          <div class="table-box">
+            <el-table
+                ref="multipleTable"
+                :max-height="800"
+                :cell-style="{textAlign: 'center'}"
+                :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}"
+                :data="commisionTable"
+                @selection-change="handleSelectionChange"
+                style="width: 100%"
+              >
+                <el-table-column
+                  type="selection"
+                  min-width="10%"
+                />
+                <el-table-column
+                  type="index"
+                  label="搴忓彿"
+                  min-width="10%"
+                />
+                <el-table-column
+                  prop="formTime"
+                  label="鏉ユ枡鏃ユ湡"
+                  min-width="10%"
+                />
+                <el-table-column
+                  prop="supplier"
+                  label="渚涘簲鍟嗗悕绉�"
+                  min-width="12%"
+                />
+                <el-table-column
+                  prop="mcode"
+                  label="鏉愭枡缂栫爜"
+                  min-width="8%"
+                />
+                <el-table-column
+                  prop="specifications"
+                  label="瑙勬牸鍨嬪彿"
+                  min-width="8%"
+                />
+                <el-table-column
+                  prop="unit"
+                  label="鍗曚綅"
+                  min-width="12%"
+                />
+                <el-table-column
+                  prop="num"
+                  label="鏁伴噺"
+                  min-width="8%"
+                />
+                <el-table-column
+                  prop="checkdate_"
+                  label="妫�楠屾棩鏈�"
+                  min-width="8%"
+                />
+              </el-table>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="commisionVisible = false">鍙� 娑�</el-button>
+                <el-button type="primary" @click="handleCommisionSelection">纭� 瀹�</el-button>
+              </span>
+          </div> 
+        </el-dialog>
       </template>
       <template v-else>
         <router-view />
@@ -283,7 +538,7 @@
   </template>
   
   <script>
-  import { getInspectionList } from '@/api/rawMaterials/reportForInspection'
+  import { selectInspectsList, selectAll, addInspect} from '@/api/experiment/planAssignments'
   export default {
     data() {
       return {
@@ -293,85 +548,72 @@
           type: '',
           state: ''
         },
-        inspectionTable: [{
-            applicationnum: 'QC22-09155',
-            checktype: '鍘熸潗鏂欐楠�',
-            checkstate: '1',
-            deliverydate: '2023-07-31',
-            provider: '鍥界綉灞变笢鐪佺數鍔涙湁闄愬叕鍙�',
-            rawcode: '1010010090124',
-            rawname: '閾濆寘閽㈢粸绾�',
-            modelandspecification: 'JLHA1/G1A-185/30-27/7',
-            unit: 'ml/kg',
-            amount: '1999',
-            registrationdate: '2022-09-23',
-            registrator: '鏉庡皬榫�',
-            qualified: '0',
-            applier: '鏉庡皬榫�',
-            checker: '鏉庡皬榫�',
-            checktime: '2023-12-09'
+        inspectionTable: [],
+        rawMaterialTable: [],
+        commisionTable: [{
+          specifications_models: "GGXH-AAAAA",
+          inspectionTime: "2023-08-03",
+          id: 2,
+          samples_number: 0,
+          dateSurvey: "2023-08-03",
+          entrusted: "闃块噷宸村反",
+          completionDeadline: "2023-08-03",
+          contacts: "灏忛粦",
+          entrust_coding: "SL20230803000003",
+          sample_name: "鍙戝姩鏈�",
+          inspection_status: 1
         },{
-            applicationnum: 'QC22-09155',
-            checktype: '鍘熸潗鏂欐楠�',
-            checkstate: '1',
-            deliverydate: '2023-07-31',
-            provider: '鍥界綉灞变笢鐪佺數鍔涙湁闄愬叕鍙�',
-            rawcode: '1010010090124',
-            rawname: '閾濆寘閽㈢粸绾�',
-            modelandspecification: 'JLHA1/G1A-185/30-27/7',
-            unit: 'ml/kg',
-            amount: '1999',
-            registrationdate: '2022-09-23',
-            registrator: '鏉庡皬榫�',
-            qualified: '0',
-            applier: '鏉庡皬榫�',
-            checker: '鏉庡皬榫�',
-            checktime: '2023-12-09'
-        },{
-            applicationnum: 'QC22-09155',
-            checktype: '鍘熸潗鏂欐楠�',
-            checkstate: '0',
-            deliverydate: '2023-07-31',
-            provider: '鍥界綉灞变笢鐪佺數鍔涙湁闄愬叕鍙�',
-            rawcode: '1010010090124',
-            rawname: '閾濆寘閽㈢粸绾�',
-            modelandspecification: 'JLHA1/G1A-185/30-27/7',
-            unit: 'ml/kg',
-            amount: '1999',
-            registrationdate: '2022-09-23',
-            registrator: '鏉庡皬榫�',
-            qualified: null,
-            applier: '鏉庡皬榫�',
-            checker: '鏉庡皬榫�',
-            checktime: '2023-12-09'
-        },{
-            applicationnum: 'QC22-09155',
-            checktype: '鍘熸潗鏂欐楠�',
-            checkstate: '1',
-            deliverydate: '2023-07-31',
-            provider: '鍥界綉灞变笢鐪佺數鍔涙湁闄愬叕鍙�',
-            rawcode: '1010010090124',
-            rawname: '閾濆寘閽㈢粸绾�',
-            modelandspecification: 'JLHA1/G1A-185/30-27/7',
-            unit: 'ml/kg',
-            amount: '1999',
-            registrationdate: '2022-09-23',
-            registrator: '鏉庡皬榫�',
-            qualified: '1',
-            applier: '鏉庡皬榫�',
-            checker: '鏉庡皬榫�',
-            checktime: '2023-12-09'
+          specifications_models: "GGXH-AAAAA",
+          inspectionTime: "2023-08-03",
+          id: 2,
+          samples_number: 0,
+          dateSurvey: "2023-08-03",
+          entrusted: "闃块噷宸村反",
+          completionDeadline: "2023-08-03",
+          contacts: "灏忛粦",
+          entrust_coding: "SL20230803000003",
+          sample_name: "鍙戝姩鏈�",
+          inspection_status: 1
         }],
-        infoForm:{
+        finishedTable: {
           deliverydate: '',
-          provider: '',
+          supplier: '',
           code: '',
           name: '',
           modelandspecification: '',
           unit: '',
           amount: '',
-          checkdate: ''
+          checkdate: []
         },
+        infoForm:'',
+        commisionSelection:{
+          entrust_coding: '',
+          entrusted: '',
+          samples_number: '',
+          sample_name: '',
+          specifications_models: '',
+          dateSurvey: '',
+          completionDeadline: '',
+          contacts: '',
+          inspectionTime: ''
+        },
+        typeoptions:[{
+          value: 0,
+          label:'鍘熸潗鏂欐楠�'
+        },{
+          value: 1,
+          label: '濮旀墭妫�楠�'
+        },{
+          value: 2,
+          label: '鎴愬搧妫�楠�'
+        }],
+        stateoptions:[{
+          value: 0,
+          label:'涓嶅悎鏍�'
+        },{
+          value: 1,
+          label:'鍚堟牸'
+        }],
         options:[{
           value: '0',
           label: '閫夐」1'
@@ -381,10 +623,13 @@
         }],
         currentPage: 1,
         total: 20, // 鎬绘潯鏁�
-        pageSize: 10, // 姣忛〉鐨勬暟鎹潯鏁�
+        pageSize: 5, // 姣忛〉鐨勬暟鎹潯鏁�
         radioValue: '鍏ㄩ儴',
         checkTypeVisible: false,
-        type: 0
+        type: '', // 榛樿涓嶉�変腑鐨勭姸鎬�
+        rawmaterialVisible: false,
+        commisionVisible: false,
+        tmp: ''
       }
     },
     watch: {
@@ -397,54 +642,178 @@
         deep: true
       }
     },
-    // beforeRouteEnter(to, from, next) {
-    //   console.log(to, from)
-    //   next()
-    //   // 鍦ㄦ覆鏌撹缁勪欢鐨勫搴旇矾鐢辫 confirm 鍓嶈皟鐢�
-    //   // 涓嶏紒鑳斤紒鑾峰彇缁勪欢瀹炰緥 `this`
-    //   // 鍥犱负褰撻挬瀛愭墽琛屽墠锛岀粍浠跺疄渚嬭繕娌¤鍒涘缓
-    // },
-    // beforeRouteUpdate(to, from, next) {
-    //   console.log(to, from)
-    //   if (to.name === 'ForInspectionDetail') this.showDetail = true
-    //   this.$nextTick(() => {
-    //     console.log(1)
-    //     this.showDetail = true
-    //   })
-    //   next()
-    //   // 鍦ㄥ綋鍓嶈矾鐢辨敼鍙橈紝浣嗘槸璇ョ粍浠惰澶嶇敤鏃惰皟鐢�
-    //   // 涓句緥鏉ヨ锛屽浜庝竴涓甫鏈夊姩鎬佸弬鏁扮殑璺緞 /foo/:id锛屽湪 /foo/1 鍜� /foo/2 涔嬮棿璺宠浆鐨勬椂鍊欙紝
-    //   // 鐢变簬浼氭覆鏌撳悓鏍风殑 Foo 缁勪欢锛屽洜姝ょ粍浠跺疄渚嬩細琚鐢ㄣ�傝�岃繖涓挬瀛愬氨浼氬湪杩欎釜鎯呭喌涓嬭璋冪敤銆�
-    //   // 鍙互璁块棶缁勪欢瀹炰緥 `this`
-    // },
     created() {
-      this.getInspectionTableData()
+      this.selectInspectsList()
     },
     updated() {
       if (this.$route.name === 'ForInspectionDetail') this.showDetail = true
     },
     methods: {
-      async getInspectionTableData() {
-        const res = await getInspectionList({ pageSize: this.currentPage, countSize: this.pageSize })
+      async selectInspectsList() {
+        // 鑾峰彇鍒嗛〉鍒楄〃
+        const res = await selectInspectsList({ countSize: this.pageSize, pageSize: this.currentPage })
         // this.inspectionTable = data
-        console.log(res)
+        // console.log(res.data.row)
+        const data = res.data.row
+        data.forEach((item) => {
+          var formTime = item["DATE_FORMAT(`form_time`,'%Y-%m-%d')"]
+          var startTime = item["DATE_FORMAT(i"]["`start_time`,'%Y-%m-%d')"]
+          var endTime = item["DATE_FORMAT(i"]["`end_time`,'%Y-%m-%d')"]
+          var checkdate = startTime + '~' + endTime
+          var createTime = item["DATE_FORMAT(i"]["`create_time`,'%Y-%m-%d')"]
+          item['formTime'] = formTime // 鏉ユ枡鏃ユ湡
+          item['checkdate'] = checkdate // 妫�楠屾棩鏈�
+          item['createTime'] = createTime // 鐧昏鏃ユ湡
+      })
+        this.inspectionTable = data
+        this.total = res.data.total
       },
-      goToForInspectionDetail() {
-        this.$router.push('/rawMaterials/reportForInspection/forInspectionDetail')
-      },
-      handleClick(row) {
-        console.log(row)
-      },
+      async searchInspections(){
+        const res = await selectInspectsList({countSize:this.pageSize,pageSize:this.currentPage,message:this.searchData.applicationnumber})
+        var data = res.data.row
+        data.forEach((item) => {
+          var formTime = item["DATE_FORMAT(`form_time`,'%Y-%m-%d')"]
+          var startTime = item["DATE_FORMAT(i"]["`start_time`,'%Y-%m-%d')"]
+          var endTime = item["DATE_FORMAT(i"]["`end_time`,'%Y-%m-%d')"]
+          var checkdate = startTime + '~' + endTime
+          var createTime = item["DATE_FORMAT(i"]["`create_time`,'%Y-%m-%d')"]
+          item['formTime'] = formTime // 鏉ユ枡鏃ユ湡
+          item['checkdate'] = checkdate // 妫�楠屾棩鏈�
+          item['createTime'] = createTime // 鐧昏鏃ユ湡
+      })
+      console.log('data:',data)
+      this.inspectionTable = data
+      if(this.searchData.type !== ''){
+        if(this.searchData.state !== ''){
+          this.inspectionTable = data.filter((item)=>{
+            return item.type===this.searchData.type && item.inspection_status === this.searchData.state
+          })
+        }else{
+          this.inspectionTable = data.filter((item)=>{
+            return item.type===this.searchData.type
+          })
+        }
+      }else{
+        if(this.searchData.state !== ''){
+          this.inspectionTable = data.filter((item)=>{
+            return item.inspection_status===this.searchData.state
+          })
+        }
+      }
+      this.total = this.inspectionTable.length
+    },
+    reset(){
+      this.searchData = {
+          applicationnumber: '',
+          type: '',
+          state: ''
+      }
+      this.selectInspectsList()
+    },
+    //琚�変腑鐨勪俊鎭� 鍗曢��    
+    handleSelectionChange(val) {
+      if (val.length > 1) {
+        this.$refs.multipleTable.clearSelection();        
+        this.$refs.multipleTable.toggleRowSelection(val.pop())
+      }
+      this.tmp = val[0]
+    },
+    handleCommisionSelection(){
+      this.commisionSelection = this.tmp
+      this.commisionVisible = false
+    },
+    handleRawMaterialSelection(){
+      this.infoForm = this.tmp
+      this.rawmaterialVisible = false
+    },
+    async handleRadioChange(){
+      console.log(this.type)
+      if(this.type === 0){
+        // 鍘熸潗鏂欐姤妫�
+        this.rawmaterialVisible = true
+        const res = await selectAll({type: this.type})
+        var data = res.data
+        data.forEach((item)=>{
+          var checkdate = []
+          checkdate.push(item['createTime'])
+          checkdate.push(item['updateTime'])
+          item['checkdate'] = checkdate // 妫�楠屾棩鏈�
+        })
+        this.rawMaterialTable = data
+      }else if(this.type === 1){
+        this.commisionVisible = true
+        const res = await selectAll({type: this.type})
+        var data = res.data
+        data.forEach((item)=>{
+          var checkdate = []
+          checkdate.push(item['startTime'])
+          checkdate.push(item['endTime'])
+          item['checkdate_'] = item['startTime'] + '~' + item['endTime']
+          item['checkdate'] = checkdate // 妫�楠屾棩鏈�
+        })
+        this.commisionTable = res.data
+      }
+    },
+    // 鏂板妫�楠�
+    async addInspection(){
+      if(this.type === 0){
+        await addInspect({endTime: this.infoForm.checkdate[1],
+          formTime: this.infoForm.dateSurvey,
+          mcode: this.infoForm.materialCoding,
+          name: this.infoForm.materialName,
+          num: this.infoForm.quantity,
+          specifications: this.infoForm.specificationsModels,
+          startTime: this.infoForm.checkdate[0] ,
+          supplier: this.infoForm.supplierName,
+          type: this.type,
+          unit: this.infoForm.unit})
+      }
+      if(this.type === 1){
+        console.log(this.commisionSelection)
+        const res = await addInspect({endTime: this.commisionSelection.checkdate[1],
+          formTime: this.commisionSelection.formTime,
+          mcode: this.commisionSelection.mcode,
+          name: this.commisionSelection.name,
+          num: this.commisionSelection.num,
+          specifications: this.commisionSelection.specifications,
+          startTime: this.commisionSelection.checkdate[0] ,
+          supplier: this.commisionSelection.supplier,
+          type: this.type,
+          unit: this.commisionSelection.unit})
+          console.log('res',res)
+      }
+      if(this.type === 2){
+        console.log(this.finishedTable)
+        const res = await addInspect({ endTime: '2023-08-15',
+          formTime: this.finishedTable.deliverydate,
+          mcode: this.finishedTable.code,
+          name: this.finishedTable.name,
+          num: parseInt(this.finishedTable.amount),
+          specifications: this.finishedTable.modelandspecification,
+          startTime: '2023-08-14',
+          supplier: this.finishedTable.supplier,
+          type: this.type,
+          unit: this.finishedTable.unit })
+      }
+      this.type = ''
+      this.checkTypeVisible = false
+      this.$message({
+          message: '娣诲姞鎴愬姛锛�',
+          type: 'success'
+        });
+    },
       // 姣忛〉鏉℃暟鏀瑰彉鏃惰Е鍙� 閫夋嫨涓�椤垫樉绀哄灏戣
       handleSizeChange(val) {
         console.log(`姣忛〉 ${val} 鏉)
-        this.currentPage = 1
+        // this.currentPage = 1
         this.pageSize = val
+        this.selectInspectsList()
       },
       // 褰撳墠椤垫敼鍙樻椂瑙﹀彂 璺宠浆鍏朵粬椤�
       handleCurrentChange(val) {
         console.log(`褰撳墠椤�: ${val}`)
         this.currentPage = val
+        this.selectInspectsList()
       }
     }
   }
@@ -514,7 +883,6 @@
   .library-table{
         background-color: #fff;
         flex: 1;
-        max-width: 100%;
         margin-left: -15px;
         margin-right: -15px;
         margin-top: 50px;
@@ -538,6 +906,9 @@
             flex-direction: column;
             .el-table {
               flex: 1;
+              .tag{
+                width: 80px;
+              }
             }
             >div:nth-child(2){
               display: flex;
@@ -547,12 +918,21 @@
             }
         }
       }
-.infoForm{
+.checkTypeForm{
     margin-top: 30px;
     margin-left: 50px;
     .el-row{
         margin-bottom: 10px;
     }
 }
+.pagination{
+  display: flex;
+  margin-top: 20px;
+  justify-content: end;
+}
+.dialog-footer{
+  display: flex;
+  margin-top: 20px;
+  justify-content: end;
+}
   </style>
-  
\ No newline at end of file

--
Gitblit v1.9.3