From d33eacc1f85ac3a736b33ba4713a19aae466d711 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期五, 05 八月 2022 16:42:53 +0800
Subject: [PATCH] 1.做适应平板显示的内容大小

---
 src/views/zzmx/jpgj.vue |  101 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 65 insertions(+), 36 deletions(-)

diff --git a/src/views/zzmx/jpgj.vue b/src/views/zzmx/jpgj.vue
index 736c146..ae07edf 100644
--- a/src/views/zzmx/jpgj.vue
+++ b/src/views/zzmx/jpgj.vue
@@ -13,11 +13,14 @@
             <el-form-item label="浜у搧鍚嶇О" style=" display: flex;">
               <el-select
                 v-model="form.partcode"
+                filterable
                 :popper-append-to-body="false"
                 style="width: 200px"
                 placeholder="璇烽�夋嫨"
+
                 @change="partChange"
               >
+                <!--                @focus="getPartSelect"-->
                 <el-option
                   v-for="item in partArr"
                   :key="item.partcode"
@@ -29,6 +32,7 @@
             <el-form-item label="宸ヨ壓璺嚎" style=" display: flex;">
               <el-select
                 v-model="form.routecode"
+                filterable
                 :disabled="form.partcode===''"
                 :popper-append-to-body="false"
                 style="width: 200px"
@@ -63,6 +67,7 @@
             <el-form-item label="鍏宠仈璁惧" style=" display: flex;">
               <el-select
                 v-model="form.eqpcode"
+                filterable
                 :disabled="form.stepcode===''"
                 :popper-append-to-body="false"
                 style="width: 200px"
@@ -109,41 +114,48 @@
             prop="RowNum"
             width="50"
             label="搴忓彿"
+            fixed
           />
           <el-table-column
             prop="partcode"
+            min-width="160"
             label="浜у搧缂栫爜"
             sortable="custom"
           />
           <el-table-column
             prop="partname"
             label="浜у搧鍚嶇О"
+            min-width="160"
             sortable="custom"
           />
           <el-table-column
             prop="partspec"
             label="浜у搧瑙勬牸"
-            width="110"
+            min-width="110"
             sortable="custom"
           />
           <el-table-column
             prop="wksp_name"
             label="鐢熶骇杞﹂棿"
+            min-width="110"
             sortable="custom"
           />
           <el-table-column
             prop="route_name"
             label="宸ヨ壓璺嚎"
             sortable="custom"
+            min-width="120"
           />
           <el-table-column
             prop="stepname"
             label="鍔犲伐宸ュ簭"
             sortable="custom"
+            min-width="110"
           />
           <el-table-column
             prop="eqp_name"
             label="鍔犲伐璁惧"
+            min-width="110"
             sortable="custom"
           />
           <el-table-column
@@ -173,10 +185,12 @@
 
           <el-table-column
             label="鎿嶄綔"
+            fixed="right"
+            width="120"
           >
             <template slot-scope="{row}">
               <div class="operationClass">
-                <el-button type="text" @click="edit('edit',row)">淇敼</el-button>
+                <el-button type="text" @click="edit('edit',row)">缂栬緫</el-button>
                 <el-button type="text" @click="del(row)">鍒犻櫎</el-button>
               </div>
             </template>
@@ -197,10 +211,10 @@
     </div>
 
     <el-dialog
-      :title="operation==='add'?'鏂板':'淇敼'"
+      :title="operation==='add'?'鏂板':'缂栬緫'"
       :visible.sync="dialogVisible"
-      width="70%"
-      top="15vh"
+      width="1000px"
+      :top="isIpad?'5vh':'15vh'"
       :close-on-click-modal="false"
       @closed="handleClose"
       @close="handleClose"
@@ -212,13 +226,16 @@
             <el-select
               v-show="operation==='add'"
               v-model="dialogForm.partcode"
+              filterable
               style="width: 220px"
               placeholder="璇烽�夋嫨"
               :popper-append-to-body="false"
+
               @change="partDialogChange"
             >
+              <!--              @focus="getPartSelect2"-->
               <el-option
-                v-for="item in partArr"
+                v-for="item in partArr2"
                 :key="item.partcode"
                 :label="item.partname"
                 :value="item.partcode"
@@ -236,6 +253,7 @@
               v-show="operation==='add'"
               v-model="dialogForm.routecode"
               style="width: 220px"
+              filterable
               :disabled="dialogForm.partcode===''"
               placeholder="璇烽�夋嫨"
               :popper-append-to-body="false"
@@ -281,7 +299,8 @@
 
         <el-table
           :data="eqpDialogArr"
-          height="400"
+          :height="tableHeight"
+          :style="{width: 100+'%',height:tableHeight-50+'px',}"
           border
           stripe
           highlight-current-row
@@ -298,16 +317,19 @@
             prop="eqpcode"
             label="璁惧缂栫爜"
             sortable="custom"
+            min-width="110"
           />
           <el-table-column
             prop="eqpname"
             label="璁惧鍚嶇О"
+            min-width="110"
             sortable="custom"
           />
           <el-table-column
             prop="wksp_name"
             sortable="custom"
             label="鐢熶骇杞﹂棿"
+            min-width="110"
           />
           <el-table-column
             sortable="custom"
@@ -393,12 +415,13 @@
           :page.sync="eqpTable.page"
           :limit.sync="eqpTable.rows"
           align="right"
-          style="padding-top: 20px"
+          style="padding-top: 20px;"
           layout="prev, pager, next,sizes"
           popper-class="select_bottom"
           @pagination="getEqpTable"
         />
       </div>
+      <div v-if="eqpTableLength===0" style="width: 100px;height: 84px;" />
 
       <span slot="footer" class="dialog-footer">
         <div class="footerButton">
@@ -413,8 +436,6 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-import { AddUpdateOrganization, DeleteOrganization } from '@/api/jcsz'
-import { getCookie } from '@/utils/auth'
 import {
   BeatRateSearch, DeleteBeatRate,
   PartSelect,
@@ -426,7 +447,7 @@
 
 const SER_HZ = /^[\u4e00-\u9fa5]+$/
 export default {
-  name: 'Zzjg',
+  name: 'JPGJ',
   components: {
     Pagination
   },
@@ -450,6 +471,7 @@
       }
     }
     return {
+      isIpad: false,
       mainHeight: 0,
       tableHeight: 0,
       form: {
@@ -463,6 +485,7 @@
         rows: 20 // 姣忛〉澶氬皯鏉�
       },
       partArr: [], // 浜у搧闆嗗悎
+      partArr2: [], // 浜у搧闆嗗悎瀵硅瘽妗�
       routeArr: [], // 浜у搧闆嗗悎
       stepArr: [], // 浜у搧闆嗗悎
       eqpArr: [], // 浜у搧闆嗗悎
@@ -516,18 +539,27 @@
     }
   },
   created() {
-    this.getBeatRateSearch()
-    this.getPartSelect()
+    this.handleRequest()
   },
   mounted() {
     window.addEventListener('resize', this.getHeight)
     this.getHeight()
   },
   methods: {
+
+    handleRequest() {
+      this.getBeatRateSearch().then(res => {
+        if (res.code === '200') {
+          this.getPartSelect()
+        }
+      })
+    },
+
     async getBeatRateSearch() {
       const res = await BeatRateSearch(this.form)
       this.tableData = res.data
       this.total = res.count
+      return { code: res.code }
     },
     // 鎺掑簭鏀瑰彉鏃�
     sortChange({ column, prop, order }) {
@@ -549,6 +581,10 @@
     async getPartSelect() {
       const { data: res } = await PartSelect()
       this.partArr = res
+    },
+    async getPartSelect2() {
+      const { data: res } = await PartSelect()
+      this.partArr2 = res
     },
     async partChange(val) {
       const { data: res } = await PartSelectRpute({ partcode: val })
@@ -578,27 +614,18 @@
     },
     async partDialogChange(val) {
       const { data: res } = await PartSelectRpute({ partcode: val })
-      console.log(this.routeDialogArr = res, 888)
+      this.routeDialogArr = res
       this.stepDialogArr = []
       this.eqpDialogArr = []
     },
     async routeDialogChange(val) {
       const { data: res } = await RouteSelectStep({ routecode: val })
       this.stepDialogArr = res
-      // this.stepDialogArr = [
-      //   { code: '1001', name: '娴嬭瘯宸ュ簭1' },
-      //   { code: '1002', name: '娴嬭瘯宸ュ簭2' },
-      //   { code: '1003', name: '娴嬭瘯宸ュ簭3' },
-      //   { code: '1004', name: '娴嬭瘯宸ュ簭4' },
-      //   { code: '1005', name: '娴嬭瘯宸ュ簭5' },
-      //   { code: '1006', name: '娴嬭瘯宸ュ簭6' },
-      //   { code: '1007', name: '娴嬭瘯宸ュ簭7' },
-      //   { code: '1008', name: '娴嬭瘯宸ュ簭8' },
-      //   { code: '1009', name: '娴嬭瘯宸ュ簭9' }
-      // ]
       this.eqpDialogArr = []
     },
     radioChange(val) {
+      this.isEqpTableEdit = true
+
       // this.dialogForm.stepcode = this.stepDialogArr.find(item => item.name === val).code
       this.getEqpTable(val)
     },
@@ -646,7 +673,7 @@
         cavity_qty: row.cavity_qty, // 鍨嬭厰鏁�
         unprice: row.unprice//  璁′欢鍗曚环
       }
-      console.log(data, 7)
+
       // row.isVisible = 0
       const res = await SaveBeatRate(data)
       if (res.code === '200') {
@@ -671,7 +698,6 @@
     },
     // 澶嶅埗琛�
     async  copyRow(row) {
-      console.log(row)
       let currentData = {}// 褰撳墠琛屽璞�
       let nextData = {}// 涓嬩竴琛屽璞�
       if (row.RowNum === this.eqpDialogArr.length) {
@@ -684,8 +710,6 @@
           }
         })
       }
-      console.log(currentData, 2)
-      console.log(nextData, 3)
       const newData = {
         partcode: this.eqpTable.partcode, //  浜у搧缂栫爜
         routecode: this.eqpTable.routecode, //  宸ヨ壓璺嚎缂栫爜
@@ -697,7 +721,7 @@
         cavity_qty: currentData.cavity_qty, // 鍨嬭厰鏁�
         unprice: currentData.unprice//  璁′欢鍗曚环
       }
-      console.log(newData, 4)
+
       const res = await SaveBeatRate(newData)
       if (res.code === '200') {
         this.$message.success('澶嶅埗鎴愬姛锛�')
@@ -724,12 +748,12 @@
     add(operation) {
       this.operation = operation
       this.dialogVisible = true
+      this.getPartSelect2()
     },
     // 淇敼鎸夐挳
     async  edit(operation, row) {
       this.operation = operation
       this.dialogVisible = true
-      console.log(row)
 
       this.editPartName = row.partname
       this.editRouteName = row.route_name
@@ -752,12 +776,11 @@
         type: 'warning'
       }).then(() => {
         const data = {
-          partcode: this.eqpTable.partcode,
-          routecode: this.eqpTable.routecode,
-          stepcode: this.eqpTable.stepcode,
+          partcode: row.partcode,
+          routecode: row.route_code,
+          stepcode: row.stepcode,
           eqpcode: row.eqp_code
         }
-        console.log(data)
         DeleteBeatRate(data).then(res => {
           if (res.code === '200') {
             this.$message.success('鍒犻櫎鎴愬姛!')
@@ -779,10 +802,12 @@
       this.dialogForm.stand_value = ''
       this.dialogForm.cavity_qty = ''
       this.dialogForm.unprice = ''
+      this.eqpTableLength = 0
       this.routeDialogArr = []
       this.stepDialogArr = []
       this.eqpDialogArr = []
       this.$refs.dialogForm.clearValidate()
+      this.getBeatRateSearch()
     },
     // 瀵硅瘽妗嗗彇娑�
     dialogVisibleCancel() {
@@ -814,7 +839,11 @@
     getHeight() {
       this.$nextTick(() => {
         this.mainHeight = window.innerHeight - 250
-        this.tableHeight = this.mainHeight - 100
+        this.tableHeight = this.mainHeight - 50
+        if (window.innerHeight < 769) {
+          this.tableHeight = this.tableHeight - 50
+        }
+        this.isIpad = window.innerHeight < 769 && window.innerWidth < 1367
       })
     }
   }

--
Gitblit v1.9.3