| | |
| | | :props="defaultProps" |
| | | show-checkbox |
| | | node-key="proId" |
| | | @check="handleCurrentChecked" |
| | | @check-change="handleCurrentChecked" |
| | | :default-checked-keys="checkedkey" |
| | | :filter-node-method="filterNode" |
| | | ref="tree" |
| | |
| | | :props="defaultProp" |
| | | show-checkbox |
| | | node-key="id" |
| | | @check="handlepackage" |
| | | @check-change="handlepackage" |
| | | :default-checked-keys="checkedkeys" |
| | | :filter-node-method="filterpackage" |
| | | ref="treas" |
| | |
| | | :props="defaultProps" |
| | | show-checkbox |
| | | node-key="proId" |
| | | @check="handleCurrentChecked" |
| | | @check-change="handleCurrentChecked" |
| | | :default-checked-keys="checkedkey" |
| | | :filter-node-method="filterNode" |
| | | ref="tree" |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- <h3 style="font-weight: 600">合计:{{ marryalls }}元</h3> --> |
| | | <h3 style="font-weight: 600">合计:{{ marryalls }}元</h3> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | // } |
| | | } |
| | | }, |
| | | |
| | | handlepackage(data, checked, checkedNodes) { |
| | | if (checked == true) { |
| | | this.$refs.treas.setCheckedKeys([data.id]); |
| | | let datas = { |
| | | zhId: data.id, |
| | | }; |
| | | |
| | | getlistByZhId(datas).then((res) => { |
| | | this.packagedataList = res.data.tjProjectList; |
| | | for (var i = 0; i < this.packagedataList.length; i++) { |
| | | let proId = this.packagedataList[i].proId; |
| | | getProSonDxList(proId).then((res) => { |
| | | this.TreedataList = res.data.list; |
| | | this.TreedataList.forEach((item) => { |
| | | this.Datalists.push(item); |
| | | }); |
| | | |
| | | // 合并 Datalists 和 DataList 到 DataList3 |
| | | this.DataList3 = this.DataList.concat(this.Datalists); |
| | | |
| | | // 清空累加器 |
| | | this.marryalls = 0; |
| | | this.TotalPrice1 = 0; |
| | | |
| | | // 重新计算价格 |
| | | this.DataList3.forEach((item) => { |
| | | console.log(item.proPrice); |
| | | this.TotalPrice1 += item.proPrice * item.sl; |
| | | this.marryalls += item.proPrice; |
| | | }); |
| | | |
| | | // 为每个项目添加 propinName |
| | | this.Datalists.forEach((item1) => { |
| | | this.packagedataList.forEach((item3) => { |
| | | if (item1.proParentId == item3.proId) { |
| | | item1.propinName = item3.proName; |
| | | } |
| | | }); |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | } else if (checked == false) { |
| | | let datas = { |
| | | zhId: data.id, |
| | | }; |
| | | |
| | | this.marryalls = 0; |
| | | |
| | | // 清空 Datalists 和 DataList3 |
| | | this.Datalists = []; |
| | | this.DataList3 = [...this.DataList]; // 重新设置 DataList3,仅包含原始 DataList |
| | | |
| | | getlistByZhId(datas).then((res) => { |
| | | this.packagedataList = res.data.tjProjectList; |
| | | for (var i = 0; i < this.packagedataList.length; i++) { |
| | | let proId = this.packagedataList[i].proId; |
| | | getProSonDxList(proId).then((res) => { |
| | | this.TreedataList = res.data.list; |
| | | this.checkedListkey = this.checkedListkey.filter( |
| | | (id) => id !== proId |
| | | ); |
| | | |
| | | // 从 DataList3 中移除相关的子项 |
| | | this.DataList3 = this.DataList3.filter( |
| | | (item) => item.proParentId !== proId |
| | | ); |
| | | |
| | | // 更新总价格 |
| | | this.TotalPrice1 = 0; // 清空价格 |
| | | this.DataList3.forEach((item) => { |
| | | this.TotalPrice1 += item.proPrice; |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | /* handlepackage(data, checked, checkedNodes) { |
| | | console.log(checked, 3333); |
| | | |
| | | if (checked.checkedNodes.length != 0) { |
| | | this.$refs.treas.setCheckedKeys([data.id]); |
| | | let datas = { |
| | |
| | | this.marryalls += item1.proPrice; |
| | | // this.TotalPrice1 = this.marryalls; |
| | | this.TotalPrice1 = 0; |
| | | console.log(this.DataList3, 9999999999); |
| | | |
| | | if (this.DataList3.length != 0) { |
| | | this.DataList3.forEach((item) => { |
| | | console.log(item.proPrice); |
| | |
| | | }); |
| | | } else if (checked.checkedNodes.length == 0) { |
| | | } |
| | | }, |
| | | }, */ |
| | | |
| | | renderContent(h, { node, data, store }) { |
| | | return ( |
| | |
| | | }, |
| | | |
| | | // 点击获取每个树节点 |
| | | handleCurrentChecked(data, checked, checkedNodes) { |
| | | /* handleCurrentChecked(data, checked, checkedNodes) { |
| | | this.dataObj = data; |
| | | if (checked.checkedNodes.length != 0) { |
| | | this.checkedObj = checked; |
| | | if (checked == true) { |
| | | this.$refs.tree.setCheckedKeys([data.proId]); |
| | | let proId = data.proId; |
| | | getProSonDxList(proId).then((res) => { |
| | |
| | | // } |
| | | // } |
| | | }); |
| | | } else if (checked.checkedNodes.length == 0) { |
| | | } else if (checked == false) { |
| | | let proId = data.proId; |
| | | getProSonDxList(proId).then((res) => { |
| | | this.TreedataList = res.data.list; |
| | | this.checkedListkey = []; |
| | | this.TreedataList.forEach((item) => { |
| | | item.disabled = true; |
| | | }); |
| | | this.DataList3.forEach((item, index) => { |
| | | if (item.proParentId == this.dataObj.proId) { |
| | | this.DataList3.splice(index, this.TreedataList.length); |
| | | } |
| | | }); |
| | | |
| | | // 手动更新总价格 |
| | | this.TotalPrice1 = 0; |
| | | this.DataList3.forEach((item, index) => { |
| | | this.TotalPrice1 += item.proPrice * item.sl; |
| | | }); |
| | | }); |
| | | } |
| | | }, */ |
| | | handleCurrentChecked(data, checked, checkedNodes) { |
| | | this.dataObj = data; |
| | | this.checkedObj = checked; |
| | | |
| | | if (checked === true) { |
| | | this.$refs.tree.setCheckedKeys([data.proId]); |
| | | let proId = data.proId; |
| | | getProSonDxList(proId).then((res) => { |
| | | this.TreedataList = res.data.list; |
| | | this.TreedataList.forEach((item) => { |
| | | item.disabled = true; |
| | | this.checkedListkey.push(item.proId); |
| | | this.DataList3.push(item); |
| | | this.spliceData(); |
| | | this.DataList3.forEach((item1) => { |
| | | this.TotalPrice1 += item1.proPrice * item1.sl; |
| | | if (item1.proParentId == data.proId) { |
| | | item1.propinName = data.proName; |
| | | item1.propinPrice = this.dataObj.proPrice; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 更新总价格 |
| | | this.TotalPrice1 = 0; |
| | | this.DataList3.forEach((item) => { |
| | | this.TotalPrice1 += item.proPrice * item.sl; |
| | | }); |
| | | }); |
| | | } else if (checked === false) { |
| | | // 当取消选中时 |
| | | let proId = data.proId; |
| | | getProSonDxList(proId).then((res) => { |
| | | this.TreedataList = res.data.list; |
| | | |
| | | // 从已选列表中移除该项目的 ID |
| | | this.checkedListkey = this.checkedListkey.filter( |
| | | (id) => id !== proId |
| | | ); |
| | | |
| | | // 从 DataList3 中移除相关的子项 |
| | | this.DataList3 = this.DataList3.filter( |
| | | (item) => item.proParentId !== proId |
| | | ); |
| | | |
| | | // 更新总价格 |
| | | this.TotalPrice1 = 0; |
| | | this.DataList3.forEach((item) => { |
| | | this.TotalPrice1 += item.proPrice * item.sl; |
| | | }); |
| | | }); |
| | | } |
| | | }, |