| | |
| | | icon="el-icon-edit" |
| | | size="mini" |
| | | :disabled="single" |
| | | @click="handleUp" |
| | | @click="handleUpdate" |
| | | v-hasPermi="['system:package:edit']" |
| | | >修改</el-button |
| | | > |
| | |
| | | </template> |
| | | </el-table-column>--> |
| | | </el-table> |
| | | <!-- <h3 style="font-weight: 600">合计:{{ pics }}元</h3> --> |
| | | <!-- 添加项目总数显示 --> |
| | | <div style="margin-top: 10px; text-align: right;font-size: 14px"> |
| | | 共计 <span style="font-weight: bold;">{{ DataList.length }}</span> 条项目 |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | }); |
| | | }, |
| | | |
| | | handleUp() { |
| | | this.title = "体检套餐信息维护"; |
| | | this.open = true; |
| | | // getPacTjProjectList().then((response) => { |
| | | // this.allList = response.data; |
| | | // this.loading = false; |
| | | // }); |
| | | getPacInFo(this.forms.pacId).then((response) => { |
| | | this.form = response.data; |
| | | console.log(this.form, 2233); |
| | | |
| | | this.form.keywords = this.form.keywords.slice(0, -1); |
| | | this.form.keywords = this.form.keywords.split(","); |
| | | // this.DataList = []; |
| | | |
| | | // this.pics = 0; |
| | | this.DataList = []; |
| | | this.checkedkey = []; |
| | | this.checkedListkey = []; |
| | | this.DataList = response.data.packageProjects; |
| | | this.DataList.forEach((item) => { |
| | | this.checkedkey.push(item.proId); |
| | | this.checkedListkey.push(item.proId); |
| | | }); |
| | | |
| | | // 获取新的数据列表(如果需要) |
| | | this.getDataList(); |
| | | }); |
| | | }, |
| | | |
| | | /** 修改按钮操作 */ |
| | | handleUpdate(row) { |
| | | this.title = "体检套餐信息维护"; |
| | | this.open = true; |
| | | // 重置数据 |
| | | this.DataList = []; |
| | | this.checkedkey = []; |
| | | this.checkedListkey = []; |
| | | this.checkedNodes = []; // 添加这行,重置选中节点 |
| | | |
| | | getPacInFo(row.pacId).then((response) => { |
| | | this.form = response.data; |
| | | console.log(this.form, 445); |
| | | |
| | | // 处理关键字 |
| | | if (this.form.keywords) { |
| | | this.form.keywords = this.form.keywords.slice(0, -1); |
| | | this.form.keywords = this.form.keywords.split(","); |
| | | } |
| | | |
| | | this.form.keywords = this.form.keywords.slice(0, -1); |
| | | this.form.keywords = this.form.keywords.split(","); |
| | | this.DataList = []; |
| | | this.checkedkey = []; |
| | | this.checkedListkey = []; |
| | | this.DataList = response.data.packageProjects; |
| | | this.DataList.forEach((item) => { |
| | | this.checkedkey.push(item.proId); |
| | | this.checkedListkey.push(item.proId); |
| | | }); |
| | | // 处理项目数据 |
| | | if (response.data.packageProjects && response.data.packageProjects.length > 0) { |
| | | this.DataList = response.data.packageProjects; |
| | | |
| | | // 更新选中状态 |
| | | this.DataList.forEach((item) => { |
| | | this.checkedkey.push(item.proId); |
| | | this.checkedListkey.push(item.proId); |
| | | this.checkedNodes.push(item.proId); // 添加到选中节点数组 |
| | | }); |
| | | |
| | | // 获取新的数据列表(如果需要) |
| | | // 计算总价和折扣 |
| | | this.pics = this.DataList.reduce((total, item) => total + item.priceOrd, 0); |
| | | this.form.xianprice = this.DataList.reduce((total, item) => total + item.priceNow, 0); |
| | | this.youhui = this.DataList[0]?.limits || 10; |
| | | } |
| | | |
| | | // 获取新的数据列表 |
| | | this.getDataList(); |
| | | }); |
| | | }, |
| | |
| | | }); |
| | | 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.queryParams1.page = 1; // 搜索时重置为第一页 |
| | | this.getDataList(); // 调用接口获取数据 |
| | |
| | | |
| | | handleCurrentChecked(data, checked, indeterminate) { |
| | | if (checked) { |
| | | // 如果已选列表中不存在此项目,则添加 |
| | | if (!this.DataList.some((item) => item.proId === data.proId)) { |
| | | // 检查是否已存在 |
| | | if (!this.DataList.some(item => item.proId === data.proId)) { |
| | | // 添加新项目时使用与已有项目相同的折扣率 |
| | | const currentDiscount = this.DataList.length > 0 ? this.DataList[0].limits : 10; |
| | | const priceNow = new Big(data.proPrice).times(new Big(currentDiscount).div(10)).toNumber(); |
| | | |
| | | this.DataList.push({ |
| | | proId: data.proId, |
| | | proName: data.proName, |
| | | priceOrd: data.proPrice, |
| | | limits: 10, |
| | | priceNow: data.proPrice, |
| | | limits: currentDiscount, |
| | | priceNow: priceNow |
| | | }); |
| | | } |
| | | // 添加到 checkedNodes 数组 |
| | | if (!this.checkedNodes.includes(data.proId)) { |
| | | this.checkedNodes.push(data.proId); |
| | | |
| | | if (!this.checkedNodes.includes(data.proId)) { |
| | | this.checkedNodes.push(data.proId); |
| | | } |
| | | } |
| | | } else { |
| | | // 取消选中时,从DataList中移除 |
| | | this.DataList = this.DataList.filter( |
| | | (item) => item.proId !== data.proId |
| | | ); |
| | | // 从 checkedNodes 中移除 |
| | | // 移除项目 |
| | | this.DataList = this.DataList.filter(item => item.proId !== data.proId); |
| | | const index = this.checkedNodes.indexOf(data.proId); |
| | | if (index > -1) { |
| | | this.checkedNodes.splice(index, 1); |
| | | } |
| | | } |
| | | |
| | | // 更新优惠价和总价 |
| | | // 更新总价和折扣 |
| | | this.updateTotalPrice(); |
| | | }, |
| | | updateTotalPrice() { |
| | |
| | | } |
| | | } |
| | | } |
| | | return this.DataList; |
| | | }, |
| | | |
| | | // 点击获取每个树节点 |
| | |
| | | this.getList(); |
| | | }); |
| | | }, |
| | | /* submitForm() { |
| | | if (this.form.pacName) { |
| | | this.form.tjProjectList = []; |
| | | if (this.DataList.length != 0) { |
| | | this.treeList = JSON.parse(JSON.stringify(this.DataList)); |
| | | for (var i = 0; i < this.treeList.length; i++) { |
| | | for (var j = i + 1; j < this.treeList.length; j++) { |
| | | if ( |
| | | this.treeList[i].proParentId == this.treeList[j].proParentId |
| | | ) { |
| | | this.treeList.splice(j, 1); |
| | | j--; |
| | | } |
| | | } |
| | | } |
| | | this.treeList.forEach((item) => { |
| | | this.form.tjProjectList.push({ |
| | | // id: 0, |
| | | proName: item.propinName, |
| | | // allSonProName: item.proName + ",", |
| | | proPrice: item.propinPrice, |
| | | priceNow: item.propinPrice, |
| | | proId: item.proParentId, |
| | | }); |
| | | }); |
| | | } |
| | | this.$refs["form"].validate((valid) => { |
| | | if (valid) { |
| | | if (this.form.pacId != null) { |
| | | // if (this.form.pacStatus === "启用") { |
| | | // this.form.pacStatus = 0; |
| | | // } else { |
| | | // this.form.pacStatus = 1; |
| | | // } |
| | | if (this.keys) { |
| | | this.form.keywords = this.keys; |
| | | } else { |
| | | this.form.keywords = this.form.keywords.toString(); |
| | | } |
| | | |
| | | updatePackage(this.form).then((response) => { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | this.form.keywords = this.keys; |
| | | // if (this.form.pacStatus === "启用") { |
| | | // this.form.pacStatus = 0; |
| | | // } else { |
| | | // this.form.pacStatus = 1; |
| | | // } |
| | | // return; |
| | | addPackage(this.form).then((response) => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | Message.warning("请先填写套餐名称"); |
| | | } |
| | | }, */ |
| | | /** 删除按钮操作 */ |
| | | handleDelete(row) { |
| | | const pacIds = row.pacId || this.ids; |
| | |
| | | `package_${new Date().getTime()}.xlsx` |
| | | ); |
| | | }, |
| | | // 套餐详情 |
| | | // handleSeach(row) { |
| | | // this.Seachopen = true; |
| | | // this.loading = true; |
| | | // const pacId = row.pacId; |
| | | // this.pacId = row.pacId |
| | | // let data = { |
| | | // pacId: pacId, |
| | | // }; |
| | | // getAllPackage(data).then((response) => { |
| | | // this.allpackageList = response.data.tjProjectList; |
| | | // this.loading = false; |
| | | // let arr = []; |
| | | // this.allpackageList.forEach((item) => { |
| | | // arr.push(item.proName); |
| | | // }); |
| | | // this.newproName = arr; |
| | | // }); |
| | | |
| | | // getAllPackageList().then((response) => { |
| | | // this.allList = response.data; |
| | | // this.loading = false; |
| | | // }); |
| | | // }, |
| | | // // 全选 |
| | | // handleCheckAllChange(val) { |
| | | // this.newproName = val ? this.allList : []; |
| | | // this.isIndeterminate = false; |
| | | // }, |
| | | |
| | | // handleCheckedCitiesChange(value) { |
| | | // let checkedCount = value.length; |
| | | // this.checkAll = checkedCount === this.allList.length; |
| | | // this.isIndeterminate = |
| | | // checkedCount > 0 && checkedCount < this.allList.length; |
| | | // }, |
| | | |
| | | submitcheckbox() { |
| | | let _this = this; |
| | | let proIds = []; |