From ef9633e0d1689fd8869170f3aa0af6c90c2e5e7f Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 07 九月 2022 16:18:24 +0800
Subject: [PATCH] 1.优化项目2.搜索栏多行的变为一行可展开

---
 src/views/scgl/gd.vue |  255 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 179 insertions(+), 76 deletions(-)

diff --git a/src/views/scgl/gd.vue b/src/views/scgl/gd.vue
index 6ba0ea3..aabe2ac 100644
--- a/src/views/scgl/gd.vue
+++ b/src/views/scgl/gd.vue
@@ -57,28 +57,21 @@
                   :label="item.name"
                   :value="item.code"
                 />
-              </el-select>            </el-form-item>
+              </el-select>
+            </el-form-item>
             <el-form-item label="浜у搧缂栫爜" style=" display: flex;">
-              <!--              <el-select v-model="form.partcode" :popper-append-to-body="false" style="width: 200px" placeholder="璇烽�夋嫨">-->
-              <!--                <el-option-->
-              <!--                  v-for="item in OrgTypeArr"-->
-              <!--                  :key="item.code"-->
-              <!--                  :label="item.name"-->
-              <!--                  :value="item.code"-->
-              <!--                />-->
-              <!--              </el-select>-->
               <el-input v-model="form.partcode" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
-            <el-form-item label="浜у搧鍚嶇О" style=" display: flex;">
+            <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;">
               <el-input v-model="form.partname" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
-            <el-form-item label="浜у搧瑙勬牸" style=" display: flex;">
+            <el-form-item v-show="isExpandForm" label="浜у搧瑙勬牸" style=" display: flex;">
               <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
-            <el-form-item label="鍒涘缓浜哄憳" style=" display: flex;">
+            <el-form-item v-show="isExpandForm" label="鍒涘缓浜哄憳" style=" display: flex;">
               <el-input v-model="form.creatuser" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
-            <el-form-item label="鍒涘缓鏃堕棿" style=" display: flex;">
+            <el-form-item v-show="isExpandForm" label="鍒涘缓鏃堕棿" style=" display: flex;">
               <!--              <el-date-picker-->
               <!--                v-model="form.createdate"-->
               <!--                type="daterange"-->
@@ -99,7 +92,7 @@
               />
             </el-form-item>
           </div>
-          <div style="min-height: 100px">
+          <div>
             <div style="display: flex;align-items: start;justify-content:end;margin-top: 5px;z-index: 2">
               <el-button type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button>
               <el-button type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
@@ -121,17 +114,27 @@
         </el-form>
       </div>
 
-      <div class="elTableDiv">
+      <div
+        class="bodyTopFormExpand"
+        @click="isExpandForm=!isExpandForm"
+      >
+        <i
+          :class="!isExpandForm?'el-icon-arrow-down':'el-icon-arrow-up'"
+          :style="{color:'#42B983'}"
+        /></div>
+
+      <div class="elTableDiv" style="margin-top: 0">
         <el-table
           :data="tableData"
-          :height="tableHeight+'px'"
+          :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
           border
           :row-class-name="tableRowClassName"
-          :style="{width: 100+'%',height:tableHeight+'px',}"
+          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px'}"
           highlight-current-row
           :header-cell-style="this.$headerCellStyle"
           :cell-style="this.$cellStyle"
           @sort-change="sortChange"
+          @row-click="rowClick"
         >
           <!--          <el-table-column-->
           <!--            type="selection"-->
@@ -240,7 +243,7 @@
             label="宸ヨ壓璺嚎"
             show-tooltip-when-overflow
             sortable="custom"
-            min-width="140"
+            width="180"
           >
             <template slot-scope="{row}">
               <div v-if="row.route_name">{{ row.route_name }}</div>
@@ -311,11 +314,16 @@
           >
             <template slot-scope="{row}">
               <div class="operationClass">
-                <el-tooltip class="item" effect="dark" content="宸ュ簭浠诲姟" placement="top">
+                <el-tooltip class="item" effect="dark" content="鎵撳嵃宸ュ崟" placement="top">
+                  <!--                  <i-->
+                  <!--                    class="el-icon-tickets"-->
+                  <!--                    style="cursor: pointer;color: #42b983;margin-right: 15px"-->
+                  <!--                    @click="check(row)"-->
+                  <!--                  />-->
                   <i
                     class="el-icon-tickets"
                     style="cursor: pointer;color: #42b983;margin-right: 15px"
-                    @click="check(row)"
+                    @click="handlePrint(row.wo_code)"
                   />
                 </el-tooltip>
                 <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
@@ -336,6 +344,81 @@
         popper-class="select_bottom"
         @pagination="getMesOrderSearch"
       />
+
+      <div class="elTableDiv">
+        <el-table
+          :data="tableDataDetail"
+          border
+          height="161px"
+          :row-class-name="tableRowClassName"
+          highlight-current-row
+          :header-cell-style="this.$headerCellStyle"
+          :cell-style="this.$cellStyle"
+        >
+          <!--          <el-table-column-->
+          <!--            width="50"-->
+          <!--            type="index"-->
+          <!--            prop="搴忓彿"-->
+          <!--            fixed-->
+          <!--          />   -->
+          <el-table-column
+            width="50"
+            prop="seq"
+            label="搴忓彿"
+            fixed
+          />
+          <el-table-column
+            prop="wo_code"
+            label="宸ュ崟缂栧彿"
+          />
+
+          <el-table-column
+            prop="partcode"
+            label="浜у搧缂栫爜"
+          />
+          <el-table-column
+            prop="partname"
+            label="浜у搧鍚嶇О"
+          />
+
+          <el-table-column
+            label="宸ュ簭缂栫爜"
+            prop="partcode"
+          />
+          <el-table-column
+            label="宸ュ簭鍚嶇О"
+            prop="partname"
+          />
+          <el-table-column
+            label="浠诲姟鏁伴噺"
+            prop="plan_qty"
+          />
+          <el-table-column
+            label="鍚堟牸鏁伴噺"
+            prop="good_qty"
+          />
+          <el-table-column
+            label="涓嶈壇鏁伴噺"
+            prop="ng_qty"
+          />
+          <el-table-column
+            label="鎿嶄綔"
+            width="120"
+          >
+            <template slot-scope="{row}">
+              <div class="operationClass">
+                <el-tooltip class="item" effect="dark" content="鎵撳嵃宸ュ簭" placement="top">
+                  <i
+                    class="el-icon-tickets"
+                    style="cursor: pointer;color: #42b983;margin-right: 15px"
+                    @click="supplementSmallClick(row)"
+                  />
+                </el-tooltip>
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
     </div>
     <!--鏂板娲惧彂瀵硅瘽妗�-->
     <el-dialog
@@ -759,20 +842,20 @@
                 />
               </el-select>
             </el-form-item>
-            <el-form-item v-show="isExpand" label="璁㈠崟缂栧彿" style=" display: flex;">
+            <el-form-item v-show="isExpandDialog" label="璁㈠崟缂栧彿" style=" display: flex;">
               <el-input v-model="sourceForm.erpordercode" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
-            <el-form-item v-show="isExpand" label="浜у搧缂栫爜" style=" display: flex;">
+            <el-form-item v-show="isExpandDialog" label="浜у搧缂栫爜" style=" display: flex;">
               <el-input v-model="sourceForm.partcode" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
 
-            <el-form-item v-show="isExpand" label="浜у搧鍚嶇О" style=" display: flex;">
+            <el-form-item v-show="isExpandDialog" label="浜у搧鍚嶇О" style=" display: flex;">
               <el-input v-model="sourceForm.partname" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
-            <el-form-item v-show="isExpand" label="浜у搧瑙勬牸" style=" display: flex;">
+            <el-form-item v-show="isExpandDialog" label="浜у搧瑙勬牸" style=" display: flex;">
               <el-input v-model="sourceForm.partspec" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
-            <el-form-item v-show="isExpand" label="鍒涘缓浜哄憳" style=" display: flex;">
+            <el-form-item v-show="isExpandDialog" label="鍒涘缓浜哄憳" style=" display: flex;">
               <el-input v-model="sourceForm.creatuser" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
 
@@ -785,14 +868,14 @@
           </div>
         </el-form>
       </div>
-      <!--      <el-tooltip  :content="!isExpand?'鐐瑰嚮灞曠ず鏇村':'鏀惰捣'" placement="bottom">-->
+      <!--      <el-tooltip  :content="!isExpandDialog?'鐐瑰嚮灞曠ず鏇村':'鏀惰捣'" placement="bottom">-->
       <div
         style="display:flex;justify-content: center;
           align-items:center;background-color:#eee;cursor: pointer"
-        @click="isExpand=!isExpand"
+        @click="isExpandDialog=!isExpandDialog"
       >
         <i
-          :class="!isExpand?'el-icon-arrow-down':'el-icon-arrow-up'"
+          :class="!isExpandDialog?'el-icon-arrow-down':'el-icon-arrow-up'"
           :style="{color:'#42B983'}"
         /></div>
       <!--      </el-tooltip>-->
@@ -997,36 +1080,36 @@
             <el-form
               ref="formApprove"
               :model="formApprove"
-              label-width="100px"
+              label-width="80px"
               inline
               style="display: flex;justify-content: space-between"
             >
               <div class="elForm">
-                <el-form-item label="宸ュ崟缂栧彿锛�" class="formContent">
+                <el-form-item label="宸ュ崟缂栧彿:" class="formContent">
                   {{ formApprove.mesordercode }}
                 </el-form-item>
-                <el-form-item label="婧愬崟鍗曞彿锛�" class="formContent">
+                <el-form-item label="婧愬崟鍗曞彿:" class="formContent">
                   {{ formApprove.m_po }}
                 </el-form-item>
-                <el-form-item label="浜у搧缂栫爜锛�" class="formContent">
+                <el-form-item label="浜у搧缂栫爜:" class="formContent">
                   {{ formApprove.partcode }}
                 </el-form-item>
-                <el-form-item label="浜у搧鍚嶇О锛�" class="formContent">
+                <el-form-item label="浜у搧鍚嶇О:" class="formContent">
                   {{ formApprove.partname }}
                 </el-form-item>
-                <el-form-item label="浜у搧瑙勬牸锛�" class="formContent">
+                <el-form-item label="浜у搧瑙勬牸:" class="formContent">
                   {{ formApprove.partspec }}
                 </el-form-item>
-                <el-form-item label="宸ュ崟鏁伴噺锛�" class="formContent">
+                <el-form-item label="宸ュ崟鏁伴噺:" class="formContent">
                   {{ formApprove.plan_qty }}
                 </el-form-item>
-                <el-form-item label="宸ヨ壓璺嚎锛�" class="formContent">
+                <el-form-item label="宸ヨ壓璺嚎:" class="formContent">
                   {{ formApprove.routename }}
                 </el-form-item>
-                <el-form-item label="鎵撳嵃浜哄憳锛�" class="formContent">
+                <el-form-item label="鎵撳嵃浜哄憳:" class="formContent">
                   {{ username }}
                 </el-form-item>
-                <el-form-item label="鎵撳嵃鏃堕棿锛�" class="formContent">
+                <el-form-item label="鎵撳嵃鏃堕棿:" class="formContent">
                   {{ formApprove.lm_date }}
                 </el-form-item>
               </div>
@@ -1295,8 +1378,14 @@
             fixed="right"
           >
             <template slot-scope="{row}">
-              <div v-if="row.enable==='Y'"><svg-icon icon-class="circleYes" style="margin-right: 2px" />鏄�</div>
-              <div v-if="row.enable==='N'"><svg-icon icon-class="circleNo" style="margin-right: 2px" />鍚�</div>
+              <div v-if="row.enable==='Y'">
+                <svg-icon icon-class="circleYes" style="margin-right: 2px" />
+                鏄�
+              </div>
+              <div v-if="row.enable==='N'">
+                <svg-icon icon-class="circleNo" style="margin-right: 2px" />
+                鍚�
+              </div>
             </template>
           </el-table-column>
         </el-table>
@@ -1322,31 +1411,19 @@
   SelectRouteStep
 } from '@/api/scgl'
 import { InventoryFileAssociationRoute, PartSelect, SaveInventoryFile } from '@/api/zzmx'
-import { handleDatetime, handleDatetime2 } from '@/utils/global'
+import { handleDatetime, handleDatetime2, validateCode } from '@/utils/global'
 import { getCookie } from '@/utils/auth'
 import { MesOrderPrintSearch1, PrintOrder } from '@/api/utils'
 import { urlAddRandomNo, webapp_ws_ajax_run, webapp_ws_autoupdate } from '@/utils/grwebapp'
 import QRCode from 'qrcodejs2'
 import $ from 'jquery'
 
-const SER_HZ = /^[\u4e00-\u9fa5]+$/
 export default {
   name: 'GD',
   components: {
     Pagination
   },
   data() {
-    const validateName = (rule, value, callback) => {
-      if (!value) {
-        return callback(new Error('璇疯緭鍏ョ紪鐮�'))
-      } else {
-        if (SER_HZ.test(value)) {
-          return callback(new Error('缂栫爜涓嶈兘涓轰腑鏂�'))
-        } else {
-          callback()
-        }
-      }
-    }
     return {
       isIpad: false,
       mainHeight: 0,
@@ -1422,7 +1499,7 @@
           { required: true, message: '璇烽�夋嫨浜у搧淇℃伅', trigger: ['blur', 'change'] }
         ],
         mesordercode: [
-          { required: true, validator: validateName, trigger: ['blur', 'change'] }
+          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
         ],
         mesqty: [
           { required: true, message: '璇疯緭鍏ュ伐鍗曟暟閲�', trigger: ['blur', 'change'] }
@@ -1535,7 +1612,7 @@
       },
       sourceFormTotal: 10,
       radioSelectedId: '',
-      isExpand: false, // 鏄惁寮犲紑锛岄粯璁や笉灞曞紑
+      isExpandDialog: false, // 瀵硅瘽妗嗚〃鍗曟槸鍚﹀睍寮�锛岄粯璁や笉灞曞紑
       dialogVisibleRoute: false,
       dialogFormRoute: {
         projectName: '', // 浜у搧鍚嶇О
@@ -1544,7 +1621,9 @@
       },
       defaultroute_code: '', // 榛樿宸ヨ壓璺嚎閫変腑鍊�
       defaultroute_codeArr: '', // 榛樿宸ヨ壓璺嚎鏁扮粍
-      projectTableData: []// 璁惧鍒楄〃
+      projectTableData: [], // 璁惧鍒楄〃
+      isExpandForm: false, // 琛ㄥ崟鏄惁灞曞紑锛岄粯璁や笉灞曞紑
+      tableDataDetail: []// 鐐瑰嚮宸ュ崟琛ㄧ殑琛� 鏄剧ず璇︾粏淇℃伅
     }
   },
   created() {
@@ -1910,7 +1989,8 @@
     getHeight() {
       this.$nextTick(() => {
         this.mainHeight = window.innerHeight - 85
-        this.tableHeight = this.mainHeight - 260
+        // this.tableHeight = this.mainHeight - 250
+        this.tableHeight = this.mainHeight - 420
         if (window.innerHeight < 769) {
           this.tableHeight = this.tableHeight - 20
         }
@@ -1930,14 +2010,14 @@
       this.dialogVisibleSearch = false
     },
     // 澶勭悊鎵撳嵃
-    handlePrint() {
+    handlePrint(wo_code) {
       // const number = Math.random() * Math.random()
       // this.number = number === 0 ? (10 + Math.random()) : number
       // console.log(number)
 
       const data2 = {
         username: getCookie('admin'),
-        mesordercode: this.dialogForm.mesordercode
+        mesordercode: wo_code || this.dialogForm.mesordercode
       }
       MesOrderPrintSearch1(data2).then(res2 => {
         if (res2.code === '200') {
@@ -2043,17 +2123,21 @@
     // 琛ユ墦灏忔爣绛�
     supplementSmallClick(row) {
       // let obj = {}
-
-      this.taskTableData.forEach((item, index) => {
+      console.log(row, 21)
+      // this.taskTableData.forEach((item, index) => {
+      this.tableDataDetail.forEach((item, index) => {
         if (item.seq === row.seq) {
           console.log(item)
           this.qrForm = {
-            qrvalue: item.seq === this.taskTableData.length ? item.wo_code + ';' + item.stepcode : item.wo_code + ';' + this.taskTableData[item.seq].stepcode,
-            startqty: item.seq === this.taskTableData.length ? item.plan_qty : this.taskTableData[item.seq].plan_qty,
+            // qrvalue: item.seq === this.taskTableData.length ? item.wo_code + ';' + item.stepcode : item.wo_code + ';' + this.taskTableData[item.seq].stepcode,
+            qrvalue: item.seq === this.tableDataDetail.length ? item.wo_code + ';' + item.stepcode : item.wo_code + ';' + this.tableDataDetail[item.seq].stepcode,
+            // startqty: item.seq === this.taskTableData.length ? item.plan_qty : this.taskTableData[item.seq].plan_qty,
+            startqty: item.seq === this.tableDataDetail.length ? item.plan_qty : this.tableDataDetail[item.seq].plan_qty,
             wo_code: item.wo_code,
             partcode: item.partcode,
             partname: item.partname,
-            nextstepname: item.seq === this.taskTableData.length ? item.stepname : this.taskTableData[item.seq].stepname,
+            // nextstepname: item.seq === this.taskTableData.length ? item.stepname : this.taskTableData[item.seq].stepname,
+            nextstepname: item.seq === this.tableDataDetail.length ? item.stepname : this.tableDataDetail[item.seq].stepname,
             operator: getCookie('username'),
             operatorTime: handleDatetime2(new Date())
           }
@@ -2100,7 +2184,7 @@
 
       this.dialogVisibleSource = true
     },
-    async   getErpOrderSearch() {
+    async getErpOrderSearch() {
       let tempDate2 = this.sourceForm.paystartdate
       if (tempDate2.length > 0) {
         tempDate2 = handleDatetime(tempDate2[0]) + '~' + handleDatetime(tempDate2[1])
@@ -2164,7 +2248,7 @@
       this.sourceForm.creatuser = ''
       this.sourceForm.createdate = ''
 
-      this.isExpand = false
+      this.isExpandDialog = false
       this.sourceTableData = []
     },
     dialogVisibleSourceBack() {
@@ -2273,6 +2357,17 @@
         this.defaultroute_code = ''
       }
       this.defaultroute_codeArr = this.dialogFormRoute.routeOperationArr.filter(item => item.isSelected2)
+    },
+    //  琛岀偣鍑讳簨浠�
+    async   rowClick(row, event, column) {
+      console.log(row, event, column)
+      console.log(row.wo_code, event, column)
+      const { data: res } = await SearchWorkStep({ wo_code: row.wo_code })
+      this.tableDataDetail = res
+    },
+    // 鎵撳嵃宸ュ崟
+    printOrder() {
+
     }
   }
 }
@@ -2339,17 +2434,20 @@
     }
   }
 }
+
 .dialogVisibleRoute {
   ::v-deep .el-dialog__body {
     padding: 20px 20px !important;
   }
 }
-.defaultroute_code ::v-deep .el-input__suffix-inner{
+
+.defaultroute_code ::v-deep .el-input__suffix-inner {
   display: flex;
   align-items: center;
   justify-content: center;
   margin-top: -3px;
 }
+
 .el-date-editor {
   font-size: 14px;
 }
@@ -2396,9 +2494,10 @@
 }
 
 //.elTableDiv {
-  ::v-deep .el-radio__label {
-    display: none;
-  }
+::v-deep .el-radio__label {
+  display: none;
+}
+
 //}
 
 .el-table::before {
@@ -2439,19 +2538,23 @@
 <style lang="scss" scoped>
 $main_color: #42b983;
 
-::v-deep  .el-range-input{
+::v-deep .el-range-input {
   font-size: 14px !important;
 }
-::v-deep .el-range__icon{
+
+::v-deep .el-range__icon {
   line-height: 28px !important;
 }
-::v-deep .el-range-separator{
+
+::v-deep .el-range-separator {
   line-height: 28px !important;
 }
-::v-deep .el-range-input{
-  font-size: 14px ;
+
+::v-deep .el-range-input {
+  font-size: 14px;
 }
-::v-deep .el-range-separator{
+
+::v-deep .el-range-separator {
   display: flex;
   justify-content: center;
   align-items: center;

--
Gitblit v1.9.3