From 31cb4bc988bdbb3a171d0cc704ff09eeeeccb524 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期五, 23 五月 2025 17:26:28 +0800
Subject: [PATCH] qx

---
 src/views/system/manual/index.vue |  167 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 114 insertions(+), 53 deletions(-)

diff --git a/src/views/system/manual/index.vue b/src/views/system/manual/index.vue
index 32281a4..1dda597 100644
--- a/src/views/system/manual/index.vue
+++ b/src/views/system/manual/index.vue
@@ -27,7 +27,12 @@
 
         <el-row :gutter="20">
           <el-col :span="11" :xs="24">
-            <el-table border v-loading="loading" :data="groupingList" height="350" @selection-change="handleChange">
+            <el-table :data="groupingList" border height="484" v-loading="loading" @row-click="handleChange">
+              <el-table-column :prop="item" :label="item" v-for="(item, index) in table" :key="index"
+                :width="columnWidth(item)" align="center">
+              </el-table-column>
+            </el-table>
+            <!-- <el-table border v-loading="loading" :data="groupingList" height="350" @selection-change="handleChange">
               <el-table-column type="selection" width="40px" align="center" />
               <el-table-column label="搴忓彿" align="center" prop="newID" width="50px" />
               <el-table-column label="鍒嗙粍鍚嶇О" align="center" prop="groupingName" />
@@ -35,37 +40,23 @@
                 <template slot-scope="scope">
                   <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex" />
                 </template>
-              </el-table-column>
-              <el-table-column label="濂楅鍚嶇О" align="center" prop="pacName" />
-              <el-table-column label="缁撶畻鏂瑰紡" align="center" prop="payType">
-                <template slot-scope="scope">
+</el-table-column>
+<el-table-column label="濂楅鍚嶇О" align="center" prop="pacName" />
+<el-table-column label="缁撶畻鏂瑰紡" align="center" prop="payType">
+  <template slot-scope="scope">
                   <dict-tag :options="dict.type.reservation_pay_type" :value="scope.row.payType" />
                 </template>
-              </el-table-column>
-              <el-table-column label="鎶樻墸" align="center" prop="limits" />
-              <el-table-column label="鍘熶环" align="center" prop="price" />
-              <el-table-column label="搴旀敹" align="center" prop="ysPrice" />
-            </el-table>
+</el-table-column>
+<el-table-column label="鎶樻墸" align="center" prop="limits" />
+<el-table-column label="鍘熶环" align="center" prop="price" />
+<el-table-column label="搴旀敹" align="center" prop="ysPrice" />
+</el-table> -->
           </el-col>
           <el-col :span="11" :xs="24">
-            <el-table border v-loading="loading" :data="groupingList" height="350">
-              <el-table-column type="selection" width="40px" align="center" />
-              <el-table-column label="搴忓彿" align="center" prop="newID" width="50px" />
-              <el-table-column label="鍒嗙粍鍚嶇О" align="center" prop="groupingName" />
-              <el-table-column label="鎬у埆" align="center" prop="sex">
-                <template slot-scope="scope">
-                  <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex" />
-                </template>
+            <el-table :data="xxList" border height="484" v-loading="loading" @row-click="handleChange">
+              <el-table-column :prop="item" :label="item" v-for="(item, index) in xxtable" :key="index"
+                :width="columnWidths(item)" align="center">
               </el-table-column>
-              <el-table-column label="濂楅鍚嶇О" align="center" prop="pacName" />
-              <el-table-column label="缁撶畻鏂瑰紡" align="center" prop="payType">
-                <template slot-scope="scope">
-                  <dict-tag :options="dict.type.reservation_pay_type" :value="scope.row.payType" />
-                </template>
-              </el-table-column>
-              <el-table-column label="鎶樻墸" align="center" prop="limits" />
-              <el-table-column label="鍘熶环" align="center" prop="price" />
-              <el-table-column label="搴旀敹" align="center" prop="ysPrice" />
             </el-table>
           </el-col>
         </el-row>
@@ -89,24 +80,10 @@
             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
           </el-form-item>
         </el-form>
-        <el-table border v-loading="loading" :data="groupingList" height="350">
-          <el-table-column type="selection" width="40px" align="center" />
-          <el-table-column label="搴忓彿" align="center" prop="newID" width="50px" />
-          <el-table-column label="鍒嗙粍鍚嶇О" align="center" prop="groupingName" />
-          <el-table-column label="鎬у埆" align="center" prop="sex">
-            <template slot-scope="scope">
-              <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex" />
-            </template>
+        <el-table :data="groupingList" border height="484" v-loading="loading">
+          <el-table-column :prop="item" :label="item" v-for="(item, index) in table" :key="index"
+            :width="columnWidth(item)" align="center">
           </el-table-column>
-          <el-table-column label="濂楅鍚嶇О" align="center" prop="pacName" />
-          <el-table-column label="缁撶畻鏂瑰紡" align="center" prop="payType">
-            <template slot-scope="scope">
-              <dict-tag :options="dict.type.reservation_pay_type" :value="scope.row.payType" />
-            </template>
-          </el-table-column>
-          <el-table-column label="鎶樻墸" align="center" prop="limits" />
-          <el-table-column label="鍘熶环" align="center" prop="price" />
-          <el-table-column label="搴旀敹" align="center" prop="ysPrice" />
         </el-table>
       </div>
 
@@ -155,14 +132,13 @@
     return {
       loading: false,
       tjStatus: 0,
-      groupingList: [
-        {
-          price: 10
-        }
-      ],
+      groupingList: [],
+      xxList: [],
+      table: [],
+      xxtable: [],
       queryParams: {
         tjh: null,
-        tblx: "jy",
+        tblx: "",
       },
       forms: {
         tjNum: null,
@@ -186,6 +162,9 @@
   },
   created() {
     //   this.handleManual();
+    if(this.tjStatus == 0){
+ this.queryParams.tblx = "jy"
+    }
   },
   methods: {
     radioChange(value) {
@@ -194,7 +173,7 @@
       } else if (value == 1) {
         this.queryParams.tblx = "jc"
       }
-
+      this.resetQuery()
     },
     handleManual() {
       shoudongtbjyjcwsxmjg(this.queryParams).then(res => {
@@ -207,7 +186,11 @@
       })
     },
     resetQuery() {
-      this.resetForm("queryForm");
+      this.queryParams.tjh = null
+      this.groupingList = [];
+      this.table = [];
+      this.xxList = [];
+      this.xxtable = [];
     },
 
     idFn1(value) {
@@ -215,14 +198,92 @@
         console.log(value)
       }
     },
+
+
     handleQuery() {
+      this.loading = true
       chaxunjyjcwsxmjg(this.queryParams).then(res => {
         this.groupingList = res.data
+        this.loading = false
+        var array = []
+        for (var i = 0; i < this.groupingList.length; i++) {
+          array = Object.keys(this.groupingList[i]);
+          let reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/
+
+          array.forEach((element, index) => {
+            if (reg.test(element)) {
+              this.table.push(element)
+            }
+          });
+
+          this.table.sort(function (a, b) {
+            const numA = parseInt(a.match(/\d+/)[0], 10);
+            const numB = parseInt(b.match(/\d+/)[0], 10);
+            return numA - numB;
+          });
+          return i + 1;
+        }
       })
     },
-    handleChange(selection) {
+
+    columnWidth(item) {
+      const arr = this.groupingList.map((x) => x[item]);
+      if (arr.length > 0) {
+        arr.push(item);
+        return this.getMaxLength(arr) + 20 + "px";
+      }
+      return 20 + "px";
     },
 
+    columnWidths(item) {
+      const arr = this.groupingList.map((x) => x[item]);
+      if (arr.length > 0) {
+        arr.push(item);
+        return this.getMaxLength(arr) + 100 + "px";
+      }
+      return 100 + "px";
+    },
+    getMaxLength(arr) {
+      return arr.reduce((acc, item) => {
+        if (item) {
+          const calcLen = this.getTextWidth(item);
+          if (acc < calcLen) {
+            acc = calcLen;
+          }
+        }
+        return acc;
+      }, 0);
+    },
+    getTextWidth(str) {
+      let width = 0;
+      const html = document.createElement("span");
+      html.innerText = str;
+      html.className = "getTextWidth";
+      document.querySelector("body").appendChild(html);
+      width = document.querySelector(".getTextWidth").offsetWidth;
+      document.querySelector(".getTextWidth").remove();
+      return width;
+    },
+    handleChange(rowData, columnName) {
+      this.xxList = rowData.jybgd
+      var array = []
+      for (var i = 0; i < this.xxList.length; i++) {
+        array = Object.keys(this.xxList[i]);
+        let reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/
+        array.forEach((element, index) => {
+          if (reg.test(element)) {
+            this.xxtable.push(element)
+          }
+        });
+        this.xxtable.sort(function (a, b) {
+          const numA = parseInt(a.match(/\d+/)[0], 10);
+          const numB = parseInt(b.match(/\d+/)[0], 10);
+          return numA - numB;
+        });
+        return i + 1;
+      }
+    }
+
   }
 };
 </script>

--
Gitblit v1.8.0