From 2f86e4951e782e8cb0bfe37276cfc6812fed9a62 Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期二, 31 十二月 2024 18:22:53 +0800
Subject: [PATCH] 团体管理

---
 src/api/system/comp.js          |    8 +
 src/views/system/comp/index.vue |  444 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 419 insertions(+), 33 deletions(-)

diff --git a/src/api/system/comp.js b/src/api/system/comp.js
index 236ecb7..164eacd 100644
--- a/src/api/system/comp.js
+++ b/src/api/system/comp.js
@@ -185,4 +185,12 @@
     method: 'post',
     data: data
   })
+}
+
+// 鏌ヨ鍗曚綅鍒嗙粍璇︾粏淇℃伅
+export function getDetails(id) {
+  return request({
+    url: `/hosp/dwgrouping/${id}`,
+    method: 'get'
+  })
 }
\ No newline at end of file
diff --git a/src/views/system/comp/index.vue b/src/views/system/comp/index.vue
index f37b562..204b9cc 100644
--- a/src/views/system/comp/index.vue
+++ b/src/views/system/comp/index.vue
@@ -379,6 +379,7 @@
                   placeholder="璇烽�夋嫨鎬у埆"
                   style="width: 120px"
                   clearable
+                  :disabled="isSexDisabled"
                 >
                   <el-option
                     v-for="dict in dict.type.sys_user_sex"
@@ -388,14 +389,14 @@
                   />
                 </el-select>
               </el-form-item>
-              <el-form-item label="濂楅鍚嶇О" prop="pacName">
+              <!-- <el-form-item label="濂楅鍚嶇О" prop="pacName">
                 <el-input
                   v-model="forms.pacName"
                   placeholder="璇疯緭鍏ュ椁愬悕绉�"
                   @focus="changeName"
                   style="width: 130px"
                 />
-              </el-form-item>
+              </el-form-item> -->
               <el-form-item label="鍘熶环" prop="price">
                 <el-input
                   v-model="forms.price"
@@ -408,17 +409,16 @@
                   v-model="forms.limits"
                   placeholder="璇疯緭鍏ユ姌鎵�"
                   style="width: 130px"
-                  :disabled="isfalse"
                   @change="numberChange"
                 />
+                <!-- :disabled="isfalse" -->
               </el-form-item>
 
-              <el-form-item label="搴旀敹" prop="ysPrice">
+              <el-form-item label="浼樻儬浠�" prop="ysPrice">
                 <el-input
                   v-model="forms.ysPrice"
                   placeholder="璇疯緭鍏ュ簲鏀�"
                   style="width: 120px"
-                  disabled
                 />
               </el-form-item>
               <el-form-item label="缁撶畻鏂瑰紡" prop="payType">
@@ -455,6 +455,15 @@
                   size="mini"
                   @click="handleGroup"
                   >淇濆瓨</el-button
+                >
+              </el-col>
+              <el-col :span="1.5">
+                <el-button
+                  type="primary"
+                  icon="el-icon-edit"
+                  size="mini"
+                  @click="xiangmuWh"
+                  >椤圭洰缁存姢</el-button
                 >
               </el-col>
               <el-col :span="1.5">
@@ -606,8 +615,13 @@
                 />
               </el-form-item>
               <el-form-item>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuerys">閲嶇疆</el-button>
-      </el-form-item>
+                <el-button
+                  icon="el-icon-refresh"
+                  size="mini"
+                  @click="resetQuerys"
+                  >閲嶇疆</el-button
+                >
+              </el-form-item>
             </el-form>
             <!-- <div style="color: red; font-size: 8px">
               娉ㄩ噴锛氶紶鏍囧乏閿弻鍑婚�変腑琛屽彲鍒犻櫎
@@ -702,6 +716,195 @@
         </el-row>
         <div slot="footer" class="dialog-footer1">
           <el-button type="primary" @click="submitrighr">纭� 瀹�</el-button>
+          <el-button @click="cancell">鍙� 娑�</el-button>
+        </div>
+      </el-dialog>
+    </div>
+
+    <div>
+      <el-dialog
+        :title="title"
+        :visible.sync="openOne"
+        width="1400px"
+        append-to-body
+        :close-on-click-modal="false"
+      >
+        <el-row :gutter="24">
+          <el-col :span="8" :xs="24">
+            <el-form
+              :model="queryParams"
+              ref="queryForm"
+              size="small"
+              :inline="true"
+              label-width="68px"
+            >
+              <el-form-item label="濂楅鍚嶇О" prop="pacName">
+                <el-input
+                  ref="inputName"
+                  v-model="queryParams.pacName"
+                  placeholder="璇疯緭鍏ュ椁愬悕绉�"
+                  clearable
+                  @keyup.enter.native="handleSearch"
+                  style="width: 140px"
+                />
+              </el-form-item>
+              <el-form-item>
+                <el-button
+                  type="primary"
+                  icon="el-icon-search"
+                  size="mini"
+                  @click="handleSearch"
+                  >鎼滅储</el-button
+                >
+                <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> -->
+              </el-form-item>
+            </el-form>
+            <el-table
+              ref="tbone"
+              border
+              v-loading="loading"
+              :data="newpacName"
+              @selection-change="handleChangeOne"
+              height="478"
+            >
+              <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="pacName"
+              >
+                <template slot-scope="scope">
+                  {{ scope.row.pacName + "/" + scope.row.price }}
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-col>
+          <el-col :span="6" :xs="24">
+            <el-form
+              :model="queryParams"
+              ref="queryForm"
+              size="small"
+              :inline="true"
+              label-width="46px"
+              style="height: 35px"
+            >
+              <el-form-item label="鍚堣" prop="price">
+                <el-input
+                  ref="inputName"
+                  v-model="queryParams.price"
+                  placeholder="鍚堣"
+                  clearable
+                  style="width: 140px"
+                />
+              </el-form-item>
+              <el-form-item>
+                <el-button
+                  icon="el-icon-refresh"
+                  size="mini"
+                  @click="resetQuerys"
+                  >閲嶇疆</el-button
+                >
+              </el-form-item>
+            </el-form>
+            <!-- <div style="color: red; font-size: 8px">
+              娉ㄩ噴锛氶紶鏍囧乏閿弻鍑婚�変腑琛屽彲鍒犻櫎
+            </div> -->
+            <!--       @row-dblclick="dbclick" -->
+            <el-table
+              border
+              v-loading="loading"
+              :data="OnenewpacName"
+              :row-class-name="tableRowClassName"
+              height="478"
+            >
+              <el-table-column
+                label="椤圭洰鍚嶇О/浠锋牸/鍏�"
+                align="center"
+                prop="proName"
+              >
+                <template slot-scope="scope">
+                  {{ scope.row.proName + "/" + scope.row.proPrice }}
+                </template>
+              </el-table-column>
+              <el-table-column label="鎿嶄綔" align="center" width="68">
+                <template slot-scope="scope">
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-delete"
+                    @click="handledbelete(scope.row)"
+                    >鍒犻櫎</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-col>
+          <el-col :span="2" :xs="24">
+            <div style="margin: 240% 6%">
+              <el-button
+                type="primary"
+                size="medium "
+                icon="el-icon-back"
+                @click="resetright"
+                >纭� 璁�</el-button
+              >
+            </div>
+          </el-col>
+          <el-col :span="8" :xs="24">
+            <el-form
+              :model="queryParams"
+              ref="queryForm"
+              size="small"
+              :inline="true"
+              v-show="showSearch"
+              label-width="68px"
+            >
+              <el-form-item label="椤圭洰鍚嶇О" prop="proName">
+                <el-input
+                  ref="inputName"
+                  v-model="queryParams.proName"
+                  placeholder="璇疯緭鍏ラ」鐩悕绉�"
+                  clearable
+                  @keyup.enter.native="handleSearchFor"
+                  style="width: 140px"
+                />
+              </el-form-item>
+              <el-form-item>
+                <el-button
+                  type="primary"
+                  icon="el-icon-search"
+                  size="mini"
+                  @click="handleSearchFor"
+                  >鎼滅储</el-button
+                >
+              </el-form-item>
+            </el-form>
+            <el-table
+              border
+              v-loading="loading"
+              ref="tre"
+              :data="Treedata"
+              @selection-change="handleChangesingle"
+              height="478"
+            >
+              <el-table-column type="selection" width="40px" align="center" />
+              <el-table-column label="椤圭洰鍚嶇О" align="center" prop="proName" />
+              <el-table-column
+                label="椤圭洰浠锋牸/鍏�"
+                align="center"
+                prop="proPrice"
+              />
+            </el-table>
+          </el-col>
+        </el-row>
+        <div slot="footer" class="dialog-footer1">
+          <el-button type="primary" @click="submitrighr">纭骞朵繚瀛�</el-button>
           <el-button @click="cancell">鍙� 娑�</el-button>
         </div>
       </el-dialog>
@@ -913,6 +1116,7 @@
   getProjectList,
   getPackageList,
   delegrouping,
+  getDetails,
 } from "@/api/system/comp";
 import { deptTreeSelect, projectGetList } from "@/api/system/tijian";
 import { getInfo } from "@/api/login";
@@ -943,6 +1147,8 @@
       id: "",
       // 閫変腑鏁扮粍
       ids: [],
+      // 鎺у埗鎬у埆閫夋嫨妗嗘槸鍚︾鐢�
+      isSexDisabled: false,
       dwIds: [],
       groupIds: [],
       deptList: [],
@@ -973,6 +1179,7 @@
       open: false,
       opens: false,
       openss: false,
+      openOne: false,
       // 鏌ヨ鍙傛暟
       queryParams: {
         pageNum: 1,
@@ -1007,9 +1214,9 @@
         gtAge: [{ required: true, validator: checkPhoneNum, trigger: "blur" }],
         limits: [{ required: true, validator: checkPhoneNum, trigger: "blur" }],
         ltAge: [{ required: true, validator: checkPhoneNum, trigger: "blur" }],
-        pacName: [
+        /*  pacName: [
           { required: true, validator: checkPhoneNum, trigger: "blur" },
-        ],
+        ], */
         payType: [
           { required: true, validator: checkPhoneNum, trigger: "blur" },
         ],
@@ -1084,6 +1291,7 @@
     // 鍙栨秷濂楅
     cancell() {
       this.openss = false;
+      this.openOne = false;
       this.reset();
     },
     // 琛ㄥ崟閲嶇疆
@@ -1139,10 +1347,10 @@
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    resetQuerys(){
-      this.OnenewpacName = [],
-      this.queryParams.price = 0,
-       this.$refs.tbone.toggleRowSelection(this.pacList[0], false);
+    resetQuerys() {
+      (this.OnenewpacName = []),
+        (this.queryParams.price = 0),
+        this.$refs.tbone.toggleRowSelection(this.pacList[0], false);
     },
     // 澶氶�夋閫変腑鏁版嵁
     handleSelectionChange(selection) {
@@ -1162,9 +1370,24 @@
       }
       this.dwIds = selection.map((item) => item.id);
       this.singleg = !selection.length;
-      if (this.selectionList[0].id) {
+      if (this.selectionList.length && this.selectionList[0].id) {
         this.beCurrent();
+      } else {
+        this.GroupUpdate();
       }
+
+      /* if (this.selectionList.length) {
+        // 濡傛灉绗竴涓〃鏍兼湁閫変腑椤癸紝閫変腑绗簩涓〃鏍煎搴旂殑鏁版嵁
+        const selectedDeptId = this.selectionList[0].id; // 鍋囪姣忎釜椤规湁涓�涓敮涓�鐨� id
+        const correspondingGroups = this.groupingList.filter(
+          (group) => group.deptId === selectedDeptId
+        );
+        this.groupList = correspondingGroups;
+      } else {
+        // 濡傛灉娌℃湁閫変腑浠讳綍椤癸紝娓呯┖绗簩涓〃鏍肩殑閫変腑椤�
+        this.groupList = [];
+        this.$refs.tbs.clearSelection();
+      } */
     },
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
@@ -1187,7 +1410,7 @@
       this.opens = true;
 
       this.groupingList = [];
-      
+
       if (this.form.drugManufacturerId) {
         this.beCurrentDept();
       }
@@ -1200,15 +1423,22 @@
       });
     },
     // 鎶樻墸
-    numberChange(currentValue, oldValue) {
+    numberChange(currentValue) {
+      console.log(this.forms.limits, 888);
+      console.log(currentValue, 666);
+
       this.forms.limits = currentValue;
-      if (this.forms.limits > this.getInfodis) {
+      /* if (this.forms.limits > this.getInfodis) {
         this.forms.limits = this.getInfodis;
         this.forms.ysPrice = (
           this.forms.price *
           (this.forms.limits / 10)
         ).toFixed(2);
-      }
+      } */
+      this.forms.ysPrice = (
+        this.forms.price *
+        (this.forms.limits / 10)
+      ).toFixed(2);
     },
 
     changegroupingName() {
@@ -1378,10 +1608,10 @@
         this.queryParams.price += item.proPrice;
       });
     },
-    handledbelete(row){
+    handledbelete(row) {
       this.queryParams.price = 0;
-      this.OnenewpacName.forEach((item,index) => {
-        if(item.proId == row.proId){
+      this.OnenewpacName.forEach((item, index) => {
+        if (item.proId == row.proId) {
           this.OnenewpacName.splice(index, 1);
         }
       });
@@ -1389,7 +1619,7 @@
         this.queryParams.price += item.proPrice;
       });
     },
-    submitrighr() {
+    /*  submitrighr() {
       if (this.pacList.length >= 1) {
         this.openss = false;
         this.forms.pacName = this.pacList[0].pacName;
@@ -1401,6 +1631,18 @@
       } else {
         this.$modal.msgError("璇烽�夋嫨濂楅");
       }
+    }, */
+    submitrighr() {
+      this.openOne = false;
+      // this.forms.pacName = this.pacList[0].pacName;
+      this.forms.price = this.queryParams.price;
+      this.forms.ysPrice = (
+        this.forms.price *
+        (this.forms.limits / 10)
+      ).toFixed(2);
+      // console.log(this.groupingList, 555);
+
+      this.handleGroup();
     },
     // 濂楅鍗曢」鑾峰彇
     handleChangeOne(selection) {
@@ -1409,6 +1651,7 @@
         this.$refs.tbone.toggleRowSelection(del_row, false); //璁剧疆杩欎竴琛屽彇娑堥�変腑
       }
       this.pacList = selection;
+
       this.dataLists = [];
       this.queryParams.price = 0;
       this.pacList.forEach((item) => {
@@ -1459,7 +1702,27 @@
 
     handleChange(selection) {
       this.groupList = selection;
-      this.groupList.forEach((item) => {
+
+      if (selection.length > 0) {
+        this.groupList.forEach((item) => {
+          this.forms.groupingName = item.groupingName;
+          this.forms.gtAge = item.gtAge;
+          this.forms.limits = item.limits;
+          this.forms.ltAge = item.ltAge;
+          this.forms.pacName = item.pacName;
+          this.forms.payType = item.payType;
+          this.forms.sex = item.sex;
+          this.forms.price = item.price;
+          this.forms.ysPrice = item.ysPrice;
+        });
+        this.isSexDisabled = true; // 绂佺敤鎬у埆閫夋嫨
+      } else {
+        // 濡傛灉娌℃湁閫変腑琛岋紝娓呯┖琛ㄥ崟骞跺彇娑堢鐢�
+        this.GroupUpdate();
+        this.isSexDisabled = false; // 鎭㈠鎬у埆閫夋嫨妗嗕负鍙敤
+      }
+
+      /* this.groupList.forEach((item) => {
         this.forms.groupingName = item.groupingName;
         this.forms.gtAge = item.gtAge;
         this.forms.limits = item.limits;
@@ -1474,11 +1737,58 @@
         let del_row = selection.shift();
         this.$refs.tbs.toggleRowSelection(del_row, false); //璁剧疆杩欎竴琛屽彇娑堥�変腑
       }
+      if(selection.length > 0) {
+        this.isSexDisabled = true;
+      }
+      else {
+        this.isSexDisabled = false;
+      } */
       this.groupIds = selection.map((item) => item.id);
       this.singlegg = !selection.length;
     },
+    xiangmuWh() {
+      this.openOne = true;
+      this.title = "鍒嗙粍椤圭洰缁存姢";
+      this.OnenewpacName = [];
+      this.queryParams.price = 0;
+      this.loading = true;
+      let id = this.groupList[0].id;
+      // console.log(this.groupList[0].id, 9966);
+
+      getDetails(id).then((res) => {
+        this.OnenewpacName = res.data.groupingProList;
+      });
+      if (this.forms.sex) {
+        deptTreeSelect(this.forms.sex).then((response) => {
+          // 濂楅鍚嶇О
+          this.newpacName = response.rows;
+
+          this.loading = false;
+          response.rows.forEach((item, index) => {
+            item.newID =
+              (this.queryParams.pageNum - 1) * this.queryParams.pageSize +
+              index +
+              1;
+          });
+        });
+      } else {
+        deptTreeSelect().then((response) => {
+          this.newpacName = response.rows;
+          this.loading = false;
+          response.rows.forEach((item, index) => {
+            item.newID =
+              (this.queryParams.pageNum - 1) * this.queryParams.pageSize +
+              index +
+              1;
+          });
+        });
+      }
+      getProjectList().then((response) => {
+        this.Treedata = response.data;
+      });
+    },
     //淇濆瓨鍒嗙粍
-    handleGroup() {
+    /* handleGroup() {
       if (this.selectionList.length <= 0) {
         this.$modal.msgError("璇峰厛閫変腑閮ㄩ棬鎴栨坊鍔犳柊鐨勯儴闂�");
       } else {
@@ -1530,6 +1840,7 @@
         dwgrouping(data).then((res) => {
           if (res.code == 200) {
             this.beCurrent();
+            this.groupingList = res.data.updatedGroupingList; 
             this.forms.groupingName = "";
             this.forms.sex = "";
             this.forms.pacName = "";
@@ -1539,10 +1850,74 @@
           }
         });
       }
+    }, */
+    handleGroup() {
+      // 濡傛灉娌℃湁閫変腑浠讳綍閮ㄩ棬锛堝嵆娌℃湁 selectionList锛夛紝鍙互鐩存帴浠� OnenewpacName 鑾峰彇鏁版嵁
+      // let mapList = [];
+      /*  this.OnenewpacName.forEach((item) => {
+        mapList.push({
+          proName: item.proName,
+          proId: item.proId,
+          proPrice: item.proPrice,
+        });
+      }); */
+
+      // 濡傛灉 selectionList 涓虹┖锛屼娇鐢� mapList 缁х画淇濆瓨
+      /* if (this.OnenewpacName.length === 0) {
+        this.$modal.msgError("璇峰厛閫変腑椤圭洰");
+        return; // 鎻愮ず鐢ㄦ埛閫変腑椤圭洰
+      } */
+
+      this.forms.ysPrice = (
+        this.forms.price *
+        (this.forms.limits / 10)
+      ).toFixed(2);
+
+      let data = {
+        groupingName: this.forms.groupingName,
+        gtAge: this.forms.gtAge,
+        limits: this.forms.limits,
+        ltAge: this.forms.ltAge,
+        pacName: this.forms.pacName,
+        payType: this.forms.payType,
+        sex: this.forms.sex,
+        dwDeptId: this.selectionList.length > 0 ? this.selectionList[0].id : "", // 濡傛灉娌℃湁閫変腑閮ㄩ棬锛岃缃负绌�
+        dwId: this.selectionList.length > 0 ? this.selectionList[0].dwId : "",
+        // mapList: mapList,
+        price: this.forms.price,
+        ysPrice: this.forms.ysPrice,
+        id: this.groupList[0].id,
+      };
+
+      // 鍙戦�佽姹備繚瀛樻暟鎹�
+      dwgrouping(data).then((res) => {
+        if (res.code == 200) {
+          this.beCurrent();
+          this.forms.groupingName = "";
+          this.forms.sex = "";
+          this.forms.pacName = "";
+          this.forms.price = "";
+          this.forms.ysPrice = "";
+          this.forms.payType = "";
+        }
+      });
     },
     // 淇敼鍒嗙粍
     GroupUpdate() {
-      this.forms = {};
+      // this.forms = {};
+      this.forms = {
+        groupingName: "",
+        gtAge: "",
+        limits: "",
+        ltAge: "",
+        pacName: "",
+        payType: "",
+        sex: "",
+        price: "",
+        ysPrice: "",
+      };
+
+      // this.$refs.forms.resetFields();
     },
     beCurrent() {
       let data = {
@@ -1550,6 +1925,7 @@
         dwId: this.selectionList[0].dwId,
       };
       getDwAndDwDept(data).then((response) => {
+        // 閮ㄩ棬鍚嶇О
         this.groupingList = response.data;
         response.data.forEach((item, index) => {
           item.newID =
@@ -1606,7 +1982,6 @@
 
     /** 鎻愪氦鎸夐挳 */
     submitForm() {
-      
       this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.drugManufacturerId != null) {
@@ -1616,16 +1991,19 @@
               this.getList();
             });
           } else {
-            if(this.form.cnName && this.form.contactPerson && this.form.contactPhone){
+            if (
+              this.form.cnName &&
+              this.form.contactPerson &&
+              this.form.contactPhone
+            ) {
               addComp(this.form).then((response) => {
-              this.$modal.msgSuccess("鏂板鎴愬姛");
-              this.open = false;
-              this.getList();
-            });
-            }else{
+                this.$modal.msgSuccess("鏂板鎴愬姛");
+                this.open = false;
+                this.getList();
+              });
+            } else {
               this.$modal.msgError("璇峰~鍐欏繀浼犻」");
             }
-           
           }
         }
       });

--
Gitblit v1.8.0