lkk
2024-12-31 2f86e4951e782e8cb0bfe37276cfc6812fed9a62
团体管理
2个文件已修改
452 ■■■■■ 已修改文件
src/api/system/comp.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/comp/index.vue 444 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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'
  })
}
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("请填写必传项");
            }
          }
        }
      });