lkk
2025-01-21 47f3611b20b8ee9379e93c82b7b2f46edae56eb1
src/views/system/package/index.vue
@@ -550,16 +550,20 @@
        </el-table-column>
      </el-table> -->
      <el-row style="display: flex; width: 1300px;">
      <el-row style="display: flex; width: 1300px">
        <el-col>
          <div
            style="text-align: center; margin-bottom: 10px; margin-top: 10px"
          >
            项目列表
          </div>
          <el-input placeholder="输入关键字进行过滤" v-model="filterText">
          </el-input>
          <div class="tab3" style="height: 365px;">
          <el-input
            placeholder="输入关键字进行过滤"
            @input="handleFilterInput"
            v-model="queryParams1.nr"
            clearable
          />
          <div class="tab3" style="height: 365px">
            <el-tree
              class="filter-tree"
              v-loading="loading"
@@ -576,10 +580,10 @@
            </el-tree>
            <pagination
              small
              v-show="total > 0"
              :total="total"
              :page.sync="queryParams.page"
              :limit.sync="queryParams.pageSize"
              v-show="total1 > 0"
              :total="total1"
              :page.sync="queryParams1.page"
              :limit.sync="queryParams1.pageSize"
              @pagination="getDataList"
            />
          </div>
@@ -728,7 +732,11 @@
import { listCategory } from "@/api/mall/category";
import { listKeyword } from "@/api/mall/keyword";
// import { getProParentIdDxList, getProSonDxList } from "@/api/system/tijian";
import { getProParentIdDxList, getProSonDxList } from "@/api/system/package";
import {
  getProParentIdDxList,
  search,
  getProSonDxList,
} from "@/api/system/package";
import {
  getPacList,
  getPacInFo,
@@ -818,13 +826,18 @@
      pacId: "",
      // 总条数
      total: 0,
      total1: 0,
      // 查询参数
      queryParams: {
        page: 1,
        pageNum: 1,
        pageSize: 10,
        pacName: null,
        pacRemark: null,
      },
      queryParams1: {
        page: 1,
        pageSize: 30,
        nr: "",
      },
      // 表单参数
      form: {
@@ -864,11 +877,11 @@
      },
    };
  },
  watch: {
    filterText(val) {
      this.$refs.tree.filter(val);
    },
  },
  // watch: {
  //   filterText(val) {
  //     this.$refs.tree.filter(val);
  //   },
  // },
  created() {
    this.getList();
@@ -912,6 +925,7 @@
        this.loading = false;
      });
    },
    /** 查询关键字列表 */
    getKeyword() {
      this.loading = true;
@@ -1257,64 +1271,95 @@
    },
    getDataList() {
      this.loading = true;
      getProParentIdDxList(this.queryParams).then((response) => {
        this.Treedata = response.data.list;
        /*  if (this.form.tjProjectList) {
          this.form.tjProjectList.forEach((item) => {
            this.Treedata.forEach((item1) => {
              if (item.proId == item1.proId) {
                this.checkedkey.push(item1.proId);
                this.DataList.push(item1);
                this.DataList.forEach((item1) => {
                  item1.limits = 10;
                  if (item1.limits > 10) {
                    item1.limits = 10; // 强制将值设置为最大值
                  } else if (item1.limits < 0) {
                    item1.limits = 0; // 强制将值设置为最小值
                  }
                  this.updateProPrice(item1); // 更新价格或其他逻辑
                });
              }
            });
          });
        }  */ /* else {
          this.checkedkey.push(this.Treedata[0].proId);
          let proId = this.Treedata[0].proId;
          this.TreedataList = this.Treedata.filter(
            (item) => item.proId == proId
          ); */
      search(this.queryParams1).then((response) => {
        this.Treedata = response.data.list; // 更新树形数据
        this.total1 = response.data.total; // 更新总条数
        // 将第一个项目添加到 DataList
        // this.TreedataList.forEach((item) => {
        //   this.checkedListkey.push(item.proId);
        //   this.DataList.push(item);
        // });
        /*  getProSonDxList(proId).then((res) => {
            this.TreedataList = res.data.list;
            this.TreedataList.forEach((item) => {
              item.disabled = true;
              this.checkedListkey.push(item.proId);
              this.DataList.push(item);
              this.DataList.forEach((item) => {
                item.propinName = this.Treedata[0].proName;
                item.propinPrice = this.Treedata[0].proPrice;
              });
              this.pics = 0;
              this.DataList.forEach((item) => {
                this.pics += item.proPrice;
              });
            });
          }); */
        // }
        const selectedIds = this.DataList.map((item) => item.proId);
        // 更新 checkedkey 使得选中的项目保持选中状态
        this.checkedkey = selectedIds.filter((id) =>
          this.Treedata.some((item) => item.proId === id)
        );
        this.pics = this.DataList.reduce(
          (total, item) => total + item.priceOrd,
          0
        );
        this.loading = false;
      });
      this.loading = false;
    },
    // getDataList() {
    //   this.loading = true;
    //   getProParentIdDxList(this.queryParams).then((response) => {
    //     this.Treedata = response.data.list;
    //     /*  if (this.form.tjProjectList) {
    //       this.form.tjProjectList.forEach((item) => {
    //         this.Treedata.forEach((item1) => {
    //           if (item.proId == item1.proId) {
    //             this.checkedkey.push(item1.proId);
    //             this.DataList.push(item1);
    //             this.DataList.forEach((item1) => {
    //               item1.limits = 10;
    //               if (item1.limits > 10) {
    //                 item1.limits = 10; // 强制将值设置为最大值
    //               } else if (item1.limits < 0) {
    //                 item1.limits = 0; // 强制将值设置为最小值
    //               }
    //               this.updateProPrice(item1); // 更新价格或其他逻辑
    //             });
    //           }
    //         });
    //       });
    //     }  */ /* else {
    //       this.checkedkey.push(this.Treedata[0].proId);
    //       let proId = this.Treedata[0].proId;
    //       this.TreedataList = this.Treedata.filter(
    //         (item) => item.proId == proId
    //       ); */
    //     // 将第一个项目添加到 DataList
    //     // this.TreedataList.forEach((item) => {
    //     //   this.checkedListkey.push(item.proId);
    //     //   this.DataList.push(item);
    //     // });
    //     /*  getProSonDxList(proId).then((res) => {
    //         this.TreedataList = res.data.list;
    //         this.TreedataList.forEach((item) => {
    //           item.disabled = true;
    //           this.checkedListkey.push(item.proId);
    //           this.DataList.push(item);
    //           this.DataList.forEach((item) => {
    //             item.propinName = this.Treedata[0].proName;
    //             item.propinPrice = this.Treedata[0].proPrice;
    //           });
    //           this.pics = 0;
    //           this.DataList.forEach((item) => {
    //             this.pics += item.proPrice;
    //           });
    //         });
    //       }); */
    //     // }
    //     this.pics = this.DataList.reduce(
    //       (total, item) => total + item.priceOrd,
    //       0
    //     );
    //     this.loading = false;
    //   });
    // },
    handleFilterInput() {
      this.queryParams.page = 1; // 搜索时重置为第一页
      this.getDataList(); // 调用接口获取数据
    },
    // 分页事件
    handlePageChange({ page, pageSize }) {
      this.queryParams.page = page; // 更新当前页
      this.queryParams.pageSize = pageSize; // 更新每页条数
      this.getDataList(); // 调用接口获取数据
    },
    handleCurrentChecked(data, checked, checkedNodes) {
@@ -1330,7 +1375,6 @@
          limits: 10,
          priceNow: data.proPrice,
        });
      } else {
        let index = this.DataList.findIndex(
          (item) => item.proId === data.proId