From 5da871a9345d1b80767623cdbe74a45e3ff5532b Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期四, 03 四月 2025 13:56:06 +0800
Subject: [PATCH] 1

---
 src/components/public/index.vue |  474 ++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 293 insertions(+), 181 deletions(-)

diff --git a/src/components/public/index.vue b/src/components/public/index.vue
index 6d83be2..ae1d682 100644
--- a/src/components/public/index.vue
+++ b/src/components/public/index.vue
@@ -1,197 +1,309 @@
 <template>
-    <div>
-        <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
-            <h3 v-if="fList.proResult ">妫�娴嬮」鐩� :{{ fList.project.proName }}</h3>
-            <h3 v-if="fList.proResult ">妫�娴嬬粨鏋� :{{ fList.proResult }}{{fList.project.proMetering}}</h3>
-            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
-                <el-form-item label="鐥呯鍚嶇О" prop="bingzhong">
-                    <el-input v-model="queryParams.bingzhong" placeholder="璇疯緭鍏ョ畝绉�" clearable
-                        @keyup.enter.native="handleQuery" style="width: 120px;" />
-                </el-form-item>
-                <el-form-item label="鎷奸煶鐮�" prop="bzPinyin">
-                    <el-input v-model="queryParams.bzPinyin" placeholder="璇疯緭鍏ユ嫾闊崇爜" clearable
-                        @keyup.enter.native="handleQuery" style="width: 130px;" />
-                </el-form-item>
-                <el-form-item>
-                    <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
-                </el-form-item>
-            </el-form>
-            <el-table :data="dataList" ref="multipleTable" v-loading="loading" @selection-change="handleSelectionChange"
-                border height="320px
-        ">
-                <el-table-column type="selection" width="40" align="center" />
-                <el-table-column label="搴忓彿" type="index" width="80px" />
-                <el-table-column label="瑙勫垯" align="center" prop="ruleStr" />
-                <el-table-column label="鐥呯鍚嶇О" align="center" prop="bingzhong" />
-            </el-table>
-            <h3>宸查�夐」鐩�</h3>
-            <el-form :model="form" ref="queryForm" size="small" :inline="true" label-width="68px">
-                <el-form-item>
-                    <el-input type="textarea" v-model="form.desc" style="width: 560px"></el-input>
-                </el-form-item>
-            </el-form>
-            <span slot="footer" class="dialog-footer">
-                <el-button @click="open = false">鍙� 娑�</el-button>
-                <el-button type="primary" @click="handleOk">纭� 瀹�</el-button>
-            </span>
-        </el-dialog>
-
-    </div>
+  <div>
+    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
+      <h3 v-if="fList.proResult">妫�娴嬮」鐩� :{{ fList.project.proName }}</h3>
+      <h3 v-if="fList.proResult">
+        妫�娴嬬粨鏋� :{{ fList.proResult }}{{ fList.project.proMetering }}
+      </h3>
+      <el-form
+        :model="queryParams"
+        ref="queryForm"
+        size="small"
+        :inline="true"
+        label-width="68px"
+      >
+        <el-form-item label="鐥呯鍚嶇О" prop="bingzhong">
+          <el-input
+            v-model="queryParams.bingzhong"
+            placeholder="璇疯緭鍏ョ畝绉�"
+            clearable
+            @keyup.enter.native="handleQuery"
+            style="width: 120px"
+          />
+        </el-form-item>
+        <el-form-item label="鎷奸煶鐮�" prop="bzPinyin">
+          <el-input
+            v-model="queryParams.bzPinyin"
+            placeholder="璇疯緭鍏ユ嫾闊崇爜"
+            clearable
+            @keyup.enter.native="handleQuery"
+            style="width: 130px"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            size="mini"
+            @click="handleQuery"
+            >鎼滅储</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <el-table
+        :data="dataList"
+        ref="multipleTable"
+        v-loading="loading"
+        @selection-change="handleSelectionChange"
+        border
+        height="320px
+        "
+      >
+        <el-table-column type="selection" width="40" align="center" />
+        <el-table-column label="搴忓彿" type="index" width="80px" />
+        <!-- <el-table-column label="瑙勫垯" align="center" prop="ruleStr" /> -->
+        <el-table-column label="妫�鏌ョ粨璁�" align="center" prop="ruleStr" />
+        <el-table-column label="妫�鏌ユ墍瑙�" align="center" prop="yxbx" />
+      </el-table>
+      <div class="pag">
+        <div class="pag1">
+          <pagination
+            v-show="total > 0"
+            :total="total"
+            :page.sync="queryParams.pageNum"
+            :limit.sync="queryParams.pageSize"
+            @pagination="getList"
+          />
+        </div>
+      </div>
+      <h3>宸查�夐」鐩�</h3>
+      <el-form
+        :model="form"
+        ref="queryForm"
+        size="small"
+        :inline="true"
+        label-width="68px"
+      >
+        <el-form-item>
+          <el-input
+            type="textarea"
+            v-model="form.desc"
+            style="width: 560px"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="open = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="handleOk">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
+  </div>
 </template>
   
 <script>
-import {
-    getlist, getlistByRuleStr
-} from "@/api/doctor/check";
+import { getlist, getlistByRuleStr } from "@/api/doctor/check";
 export default {
-    name: 'Public',
+  name: "Public",
 
-    props: {
-        row: {
-            type: Object,
-        }
-
+  /*  props: {
+    row: {
+      type: Object,
     },
-    data() {
-        return {
-            open: false,
-            // 寮瑰嚭灞傛爣棰�
-            title: "",
-            dataList: [],
-            // 閬僵灞�
-            loading: false,
-            form: {
-                desc: ""
-            },
-            queryParams: {
-                bingzhong: "",
-                bzPinyin: "",
-            },
-            list: [],
-            fList: {}
-        };
+  }, */
+  props: {
+    lastDesc: {
+      type: String,
+      default: "",
     },
-    watch: {
-        'row'(val, newVla) {
-            // console.log(val,newVla)
-            this.fList = val
-            // if (this.fList) {
-            //     this.getList()
-            // }
-        }
+  },
+  data() {
+    return {
+      open: false,
+      // 寮瑰嚭灞傛爣棰�
+      title: "",
+      yxbx:"",
+      //   lastDesc: "",
+      total: 0,
+      dataList: [],
+      // 閬僵灞�
+      loading: false,
+      form: {
+        // desc: "",
+        desc: this.lastDesc,
+      },
+      queryParams: {
+        bingzhong: "",
+        bzPinyin: "",
+        pageNum: 1,
+        pageSize: 10,
+      },
+      list: [],
+      fList: {},
+      selectedItems: [],
+    };
+  },
+  watch: {
+    row(val, newVla) {
+      // console.log(val,newVla)
+      //   this.fList = val;
+      // if (this.fList) {
+      //     this.getList()
+      // }
     },
-    mounted() {
-
+    lastDesc(newVal) {
+      this.form.desc = newVal; // 鏇存柊 form.desc
+      console.log(newVal, 666);
     },
+  },
+  mounted() {},
 
-    created() {
-
-    },
-    methods: {
-        getList(row,date) {
-            if (row.proId) {
-                let fList = row
-                // if (this.fList.proResult == "") {
-                let data = {
-                    proId: fList.proId,
-                    // ruleStr: fList.proResult,
-                }
-                getlist(data).then(res => {
-                    this.dataList = res.rows
-                    this.$nextTick(() => {
-                        this.dataList.forEach(item => {
-                            this.fList.rulesList.forEach(item1 => {
-                                if (item.aid == item1.aid) {
-                                    this.$refs.multipleTable.toggleRowSelection(item, true);
-                                }
-                            })
-                        })
-                    })
-
-                })
-                // }else{
-                //     let data = {
-                //         proId: this.fList.proId,
-                //         bingzhong: this.queryParams.bingzhong,
-                //         ruleStr: this.fList.proResult,
-                //     }
-                //     getlistByRuleStr(data).then(res => {
-                //         this.dataList = res.rows
-                //         this.$nextTick(() => {
-                //             this.dataList.forEach(item => {
-                //                 this.fList.rulesList.forEach(item1 => {
-                //                     if (item.aid == item1.aid) {
-                //                         this.$refs.multipleTable.toggleRowSelection(item, true);
-                //                     }
-                //                 })
-                //             })
-                //         })
-
-                //     })
-                // }
-            }else{
-                let data = {
-                    proId: row,
-                }
-                getlist(data).then(res => {
-                    this.dataList = res.rows
-                    // this.$nextTick(() => {
-                    //     this.dataList.forEach(item => {
-                    //         this.fList.rulesList.forEach(item1 => {
-                    //             if (item.aid == item1.aid) {
-                    //                 this.$refs.multipleTable.toggleRowSelection(item, true);
-                    //             }
-                    //         })
-                    //     })
-                    // })
-
-                })
-            }
-
-
-        },
-        handleQuery() {
-            let data = {
-                proId: this.fList.proId,
-                bingzhong: this.queryParams.bingzhong,
-                bzPinyin: this.queryParams.bzPinyin,
-            }
-            getlist(data).then(res => {
-                this.dataList = res.rows
-                this.$nextTick(() => {
-                    this.dataList.forEach(item => {
-                        this.fList.rulesList.forEach(item1 => {
-                            if (item.aid == item1.aid) {
-                                this.$refs.multipleTable.toggleRowSelection(item, true);
-                            }
-                        })
-                    })
-                })
-
-            })
-        },
-        handleSelectionChange(selection) {
-            this.list = []
-            this.list = selection
-            this.form.desc = ""
-            this.list.forEach(element => {
-                if( element.bingzhong){
-this.form.desc += element.bingzhong + ","
-                }else{
-                    this.form.desc += element.ruleStr + ","
-                }
-                
+  created() {},
+  methods: {
+    getList(row, date) {
+      let data = {
+        //   proId: fList.proId,
+        // ruleStr: fList.proResult,
+      };
+      getlist(data).then((res) => {
+        this.dataList = res.rows;
+        this.$nextTick(() => {
+          /* this.dataList.forEach((item) => {
+            this.fList.rulesList.forEach((item1) => {
+              if (item.aid === item1.aid) {
+                this.$refs.multipleTable.toggleRowSelection(item, true);
+              }
             });
-        },
-        handleOk() {
-            this.open = false
-            if (this.form.desc) {
-                this.$emit('add', this.form.desc, this.list);
-            }
-            this.form.desc = ""
+          }); */
+        });
+      });
+    },
+    /* getList(row, date) {
+      if (row.proId) {
+        let fList = row;
+        // if (this.fList.proResult == "") {
+        let data = {
+        //   proId: fList.proId,
+          // ruleStr: fList.proResult,
+        };
+        getlist(data).then((res) => {
+          this.dataList = res.rows;
+
+          this.$nextTick(() => {
+            this.dataList.forEach((item) => {
+              this.fList.rulesList.forEach((item1) => {
+                if (item.aid == item1.aid) {
+                  this.$refs.multipleTable.toggleRowSelection(item, true);
+                }
+              });
+            });
+          });
+        });
+        // }else{
+        //     let data = {
+        //         proId: this.fList.proId,
+        //         bingzhong: this.queryParams.bingzhong,
+        //         ruleStr: this.fList.proResult,
+        //     }
+        //     getlistByRuleStr(data).then(res => {
+        //         this.dataList = res.rows
+        //         this.$nextTick(() => {
+        //             this.dataList.forEach(item => {
+        //                 this.fList.rulesList.forEach(item1 => {
+        //                     if (item.aid == item1.aid) {
+        //                         this.$refs.multipleTable.toggleRowSelection(item, true);
+        //                     }
+        //                 })
+        //             })
+        //         })
+
+        //     })
+        // }
+      } else {
+        let data = {
+        //   proId: row,
+        };
+        getlist(data).then((res) => {
+          this.dataList = res.rows;
+          console.log(res,888);
+          
+          // this.$nextTick(() => {
+          //     this.dataList.forEach(item => {
+          //         this.fList.rulesList.forEach(item1 => {
+          //             if (item.aid == item1.aid) {
+          //                 this.$refs.multipleTable.toggleRowSelection(item, true);
+          //             }
+          //         })
+          //     })
+          // })
+        });
+      }
+    }, */
+    handleQuery() {
+      let data = {
+        proId: this.fList.proId,
+        bingzhong: this.queryParams.bingzhong,
+        bzPinyin: this.queryParams.bzPinyin,
+      };
+      getlist(data).then((res) => {
+        this.dataList = res.rows;
+        this.$nextTick(() => {
+          this.dataList.forEach((item) => {
+            this.fList.rulesList.forEach((item1) => {
+              if (item.aid == item1.aid) {
+                this.$refs.multipleTable.toggleRowSelection(item, true);
+              }
+            });
+          });
+        });
+      });
+    },
+    handleSelectionChange(selection) {
+        console.log(selection[0].yxbx,123);
+        
+      this.list = [];
+      this.list = selection;
+      this.yxbx = selection[0].yxbx
+
+      //   this.form.desc = "";
+      this.list.forEach((element) => {
+        if (element.bingzhong) {
+          this.form.desc += element.bingzhong + ",";
+        } else {
+          this.form.desc += element.ruleStr + ",";
         }
-    }
-}
+      });
+    },
+    /* handleSelectionChange(selection) {
+      // 褰撳墠閫変腑鐨勯」
+        const newSelection = selection;
+
+
+      // 1. 澶勭悊鍙栨秷閫変腑鐨勯」
+      const removedItems = this.selectedItems.filter(
+        (item) => !newSelection.includes(item)
+      );
+
+      // 浠� form.desc 涓Щ闄ゅ彇娑堥�変腑鐨勬暟鎹�
+      removedItems.forEach((item) => {
+        const itemToRemove = item.bingzhong || item.ruleStr;
+        this.form.desc = this.form.desc.replace(
+          new RegExp(itemToRemove + ",?", "g"), // 浣跨敤姝e垯纭繚绉婚櫎鎵�鏈夐噸澶嶉」
+          ""
+        );
+      });
+
+      // 2. 鏇存柊宸查�変腑鐨勬暟鎹垪琛�
+      this.selectedItems = newSelection;
+
+      // 3. 娣诲姞鏂伴�変腑鐨勯」鍒� form.desc
+      newSelection.forEach((element) => {
+        const itemToAdd = element.bingzhong || element.ruleStr;
+        if (!this.form.desc.includes(itemToAdd)) {
+          this.form.desc += itemToAdd + ",";
+        }
+      });
+    }, */
+    handleOk() {
+      this.open = false;
+      if (this.form.desc) {
+        // this.$emit("add", this.form.desc, this.list);
+        this.$emit("add", this.form.desc,this.yxbx);
+        // this.lastDesc = this.form.desc;
+      }
+      //   this.form.desc = "";
+    },
+  },
+};
 </script>
   
 <style scoped></style>

--
Gitblit v1.8.0