| | |
| | | node-key="proId" |
| | | @check-change="handleCurrentChecked" |
| | | :default-checked-keys="checkedkey" |
| | | :filter-node-method="filterNode" |
| | | ref="tree" |
| | | :render-content="renderContent" |
| | | > |
| | |
| | | page: 1, |
| | | pageSize: 30, |
| | | nr: "", |
| | | xb: "", |
| | | }, |
| | | form: { |
| | | xianprice: null, |
| | |
| | | } |
| | | const filterTextLower = this.filterText.toLowerCase(); |
| | | this.filteredTreeData = this.filterNodes(this.originalTreeData, filterTextLower); |
| | | }, |
| | | filterNode(value, data) { |
| | | if (!value) return true; |
| | | console.log(value, 6666); |
| | | |
| | | return ( |
| | | data.proName.indexOf(value) !== -1 || |
| | | (data.proEngName && data.proEngName.indexOf(value) !== -1) |
| | | ); |
| | | }, |
| | | filterNodes(nodes, filterText) { |
| | | return nodes.filter(node => { |
| | |
| | | this.keywordList = response.rows; |
| | | }); |
| | | }, |
| | | sel(val) { |
| | | /* sel(val) { |
| | | let id = val; |
| | | this.keys = id.join(","); |
| | | }, */ |
| | | sel(val) { |
| | | const maleId = "4"; // “男”的 ID |
| | | const femaleId = "5"; // “女”的 ID |
| | | let selectedIds = [...val]; // 复制当前选中的 ID 数组 |
| | | |
| | | // 实现“男”和“女”互斥逻辑 |
| | | if (selectedIds.includes(maleId) && selectedIds.includes(femaleId)) { |
| | | selectedIds = selectedIds.slice(-1); // 保留最后选中的一个 |
| | | this.$message.warning("“男”和“女”关键字互斥,只能选择一个!"); |
| | | } |
| | | |
| | | // 更新 form.keywords 和 keys |
| | | this.form.keywords = selectedIds; |
| | | this.keys = selectedIds.join(","); |
| | | |
| | | // 调用 getDataList,传递所有选中的关键字 ID(逗号分隔) |
| | | // this.getDataList({ xb: this.keys }); |
| | | this.queryParams1.xb = this.keys; // 👈 更新查询参数 |
| | | this.queryParams1.page = 1; // 👈 切换条件时重置页码 |
| | | this.getDataList(); // 不需要再传参了 |
| | | }, |
| | | getCategory() { |
| | | this.loading = true; |
| | |
| | | </span> |
| | | ); |
| | | }, |
| | | getDataList() { |
| | | getDataList(params = {}) { |
| | | this.loading = true; |
| | | search(this.queryParams1).then((response) => { |
| | | const query = { ...this.queryParams1, ...params }; |
| | | search(query).then((response) => { |
| | | this.Treedata = response.data.list; |
| | | this.total1 = response.data.total; |
| | | this.pics = this.DataList.reduce((total, item) => total + item.priceOrd, 0); |
| | |
| | | this.$nextTick(() => { |
| | | this.$refs.tree.setCheckedKeys(this.checkedNodes); |
| | | this.initializing = false; |
| | | this.loading = false; |
| | | }); |
| | | this.loading = false; |
| | | }).catch(() => { |
| | | this.loading = false; |
| | | }); |