From 8fbc9a090fb91f81c447a0bd461c3abd6c9f0501 Mon Sep 17 00:00:00 2001 From: pengjun <158915633@qq.com> Date: Mon, 23 Oct 2023 13:09:22 +0800 Subject: [PATCH 1/2] group --- .../customerOrg/customerOrgGroupAsbitem.vue | 203 ++++++++++-------- 1 file changed, 116 insertions(+), 87 deletions(-) diff --git a/src/components/customerOrg/customerOrgGroupAsbitem.vue b/src/components/customerOrg/customerOrgGroupAsbitem.vue index 8406a7e..913c9cd 100644 --- a/src/components/customerOrg/customerOrgGroupAsbitem.vue +++ b/src/components/customerOrg/customerOrgGroupAsbitem.vue @@ -46,7 +46,7 @@
保存
@@ -65,47 +65,45 @@
+ :summary-method="getSummaries" show-summary + :row-class-name="handleRowClassName" @row-dblclick="removeAbs" + @row-click="removeAsbItem" ref="tableCustomerOrgGroupAsbitems"> - + - - - - + + - + + + + + + +
@@ -165,8 +163,18 @@ export default { created() { this.dictInit() }, - + + updated () { + this.refreshTable('tableCustomerOrgGroupAsbitems') + }, methods: { + //表格强制刷新 + refreshTable(tableRef){ + this.$nextTick(() => { + this.$refs[tableRef].doLayout() + }) + }, + //初始数据 dictInit(){ //体检类别 树结构 @@ -284,8 +292,8 @@ export default { // "price": 0, console.log('asbItemChoosed.length', asbItemChoosed.length) for (let i = 0; i < asbItemChoosed.length; i++) { - if (this.customerOrgGroup.forSexId == 'U') break //未选性别时,无需判断组合项目性别限制 - if (asbItemChoosed[i].forSexId == 'A') continue + if (this.customerOrgGroup.forSexId == 'A') break //未选性别时,无需判断组合项目性别限制 + if (asbItemChoosed[i].forSexId == 'A' || asbItemChoosed[i].forSexId == 'U') continue if (asbItemChoosed[i].forSexId != this.customerOrgGroup.sexId) { this.$message.warning(`所选项目:${asbItemChoosed[i].displayName},不适合当前人员性别`) checked = false @@ -298,13 +306,16 @@ export default { for (let i = 0; i < asbItemChoosed.length; i++) { let pojo = { asbitemId: asbItemChoosed[i].id, - patientRegisterId: this.customerOrgGroup.id, - standardPrice: asbItemChoosed[i].price, - chargePrice: asbItemChoosed[i].price, - amount: 1, - total: asbItemChoosed[i].price, + displayName:asbItemChoosed[i].displayName, + discount:100, + customerOrgGroupDetailAmount:1, + price:asbItemChoosed[i].price, + customerOrgGroupDetailPrice:asbItemChoosed[i].price, + customerOrgGroupDetailMoney: asbItemChoosed[i].price, + asbitemMoney: asbItemChoosed[i].price, } + this.customerOrgGroupAsbitems.push(pojo) //this.customerOrgGroupAsbitems.push({ ...pojo, asbitemName: asbItemChoosed[i].displayName }) @@ -488,11 +499,49 @@ export default { }, + changePrices(index){ + this.customerOrgGroupAsbitems[index].customerOrgGroupDetailMoney = + (this.customerOrgGroupAsbitems[index].customerOrgGroupDetailPrice * this.customerOrgGroupAsbitems[index].customerOrgGroupDetailAmount).toFixed(2) + + this.customerOrgGroupAsbitems[index].discount = (this.customerOrgGroupAsbitems[index].customerOrgGroupDetailPrice * 100 / this.customerOrgGroupAsbitems[index].price).toFixed(2) + this.refreshTable('tableCustomerOrgGroupAsbitems') + }, + //合计 - getSummaries(){ + getSummaries(param) { + console.log('getSummaries param',param) + const { columns, data } = param; + const sumCol = [6, 7] //需合计的列 + const sums = []; + columns.forEach((column, index) => { + //console.log('column, index,data',column, index,data) + //显示合计列 + if (index === 1) { + sums[index] = '合计'; + return; + } + //不合计的列 + if (sumCol.indexOf(index) == -1) { + sums[index] = ''; + return; + } + + sums[index] = 0 + data.forEach(e => { + if (!isNaN(e[column.property])) sums[index] += e[column.property]// * e['amount'] + }) + sums[index] = sums[index].toFixed(2) //+ ' 元'; + + }); + //this.totalStand = sums[2]; + console.log('getSummaries',sums) + // if (!this.totalFoucs) this.total = sums[5]; + // if (!this.discountFoucs) this.discount = Number(this.total * 100 / this.totalStand).toFixed(2); + return sums; }, + changingprices(price) { this.price = price; }, @@ -509,63 +558,40 @@ export default { this.price = row.price; console.log(this.price); }, + //保存按钮 - Onsubmit() { - if (!this.personnelUnit.customerOrgGroupId) { - alert("请先选择单位分组"); - return; - } else { - console.log(this.personnelUnit.nogroupselected); - postapi("/api/app/customer-org-group-detail/many", this.addrulst).then( - (res) => { - this.$message.success("操作成功"); - console.log(this.addrulst); - } - ); + btnSave() { + if(!this.customerOrgGroup.id){ + this.$message.warning("请先选中单位分组") + return } - - }, - //移除按钮 - addselecteditems() { - let lfind = -1; - console.log(this.personnelUnit.id); - if (this.personnelUnit.form.id == "") { - alert("请先选择单位类别"); - } else { - // 让按钮恢复禁用 - this.saveornot = false; - //personnelUnit.nogroupselected - if (this.rightselctedata.length == 0) { - this.$message.warning("已选数据为空无法移动"); - } else { - // this.title = 2; - let count = this.rightselctedata.length - 1; - for (var i = count; i >= 0; i--) { - if ([...new Set(this.tabledata)]) { - this.tabledata.push(this.rightselctedata[i]); - this.personnelUnit.nogroupselected.splice(i, 1); - } - } - console.log(this.personnelUnit.customerOrgGroupId); - // this. - this.rightselctedata.forEach((item) => { - lfind = arrayExistObj( - this.personnelUnit.nogroupselected, - "id", - item.id - ); - - if (lfind > -1) this.personnelUnit.nogroupselected.splice(lfind, 1); - this.addrulst.push({ - asbitemId: item.id, - price: item.price, - // price: this.price, - customerOrgGroupId: this.personnelUnit.customerOrgGroupId, - }); - }); + let body = [] + // [ + // { + // "customerOrgGroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "asbitemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "price": 0, + // "amount": 0 + // } + // ] + this.customerOrgGroupAsbitems.forEach(e =>{ + body.push({ + customerOrgGroupId:this.customerOrgGroup.id, + asbitemId:e.asbitemId, + price:e.customerOrgGroupDetailPrice, + amount:e.customerOrgGroupDetailAmount + }) + }) + + postapi('/api/app/customerorggroupdetail/createcustomerorggroupdetailmany',body).then(res => { + if(res.code != -1){ + this.$message.success("操作成功"); } - } + }) + }, + + //右侧勾选按钮 selecteditems(val) { this.rightselctedata = val; @@ -586,13 +612,16 @@ export default { if(customerOrgGroupId){ getapi( `/api/app/customerorggroupdetail/getcustomerorggroupdetailinasbitem?CustomerOrgGroupId=${customerOrgGroupId}` - ).then((res) => { - this.customerOrgGroupAsbitems = res.data; + ).then((res) => { + if(res.code != -1){ + this.customerOrgGroupAsbitems = res.data; + this.getAsbItemByItemType() + } }); }else{ this.customerOrgGroupAsbitems = [] - } - this.getAsbItemByItemTypeAll() + this.getAsbItemByItemType() + } }, }, From 0c9eaa34b8f75b042701126b38c5a4ce061c3a66 Mon Sep 17 00:00:00 2001 From: pengjun <158915633@qq.com> Date: Mon, 23 Oct 2023 16:39:56 +0800 Subject: [PATCH 2/2] group --- .../customerOrg/customerOrgGroupAsbitem.vue | 88 +++++++++++-------- src/views/customerOrg/customerOrgGroup.vue | 50 +++++++---- 2 files changed, 85 insertions(+), 53 deletions(-) diff --git a/src/components/customerOrg/customerOrgGroupAsbitem.vue b/src/components/customerOrg/customerOrgGroupAsbitem.vue index 913c9cd..4d91de1 100644 --- a/src/components/customerOrg/customerOrgGroupAsbitem.vue +++ b/src/components/customerOrg/customerOrgGroupAsbitem.vue @@ -43,13 +43,7 @@
全部移除 -
-
- 保存 - -
+ @@ -83,7 +77,7 @@ + @@ -116,6 +117,9 @@
复制套餐
+
+ 保存 +
@@ -499,17 +503,39 @@ export default { }, + changeDiscount(index){ + + this.customerOrgGroupAsbitems[index].customerOrgGroupDetailPrice = + (this.customerOrgGroupAsbitems[index].discount * this.customerOrgGroupAsbitems[index].price/100).toFixed(2) + + + this.customerOrgGroupAsbitems[index].customerOrgGroupDetailMoney = + (this.customerOrgGroupAsbitems[index].customerOrgGroupDetailPrice * this.customerOrgGroupAsbitems[index].customerOrgGroupDetailAmount).toFixed(2) + + //this.getSummaries() + + }, + + //修改价格或数量 changePrices(index){ this.customerOrgGroupAsbitems[index].customerOrgGroupDetailMoney = (this.customerOrgGroupAsbitems[index].customerOrgGroupDetailPrice * this.customerOrgGroupAsbitems[index].customerOrgGroupDetailAmount).toFixed(2) this.customerOrgGroupAsbitems[index].discount = (this.customerOrgGroupAsbitems[index].customerOrgGroupDetailPrice * 100 / this.customerOrgGroupAsbitems[index].price).toFixed(2) - this.refreshTable('tableCustomerOrgGroupAsbitems') + //this.getSummaries() }, + //合计 getSummaries(param) { console.log('getSummaries param',param) + // if(!param){ + // param = { + // columns:[{}, {}, {}, {}, {}, {}, {property: 'asbitemMoney'},{property: 'customerOrgGroupDetailMoney'}], + // data:this.customerOrgGroupAsbitems + // } + // } + const { columns, data } = param; const sumCol = [6, 7] //需合计的列 const sums = []; @@ -529,7 +555,7 @@ export default { sums[index] = 0 data.forEach(e => { - if (!isNaN(e[column.property])) sums[index] += e[column.property]// * e['amount'] + if (!isNaN(e[column.property])) sums[index] += Number(e[column.property])// * e['amount'] }) sums[index] = sums[index].toFixed(2) //+ ' 元'; @@ -542,22 +568,8 @@ export default { }, - changingprices(price) { - this.price = price; - }, - discount(index) { - console.log(index); //100标准价格 - this.personnelUnit.nogroupselected[index].price = Math.round( - (100 * Number(this.personnelUnit.nogroupselected[index].queueTime)) / - 100, - 2 - ); - }, - inputchang(row, newVal) { - this.price = row.price; - console.log(this.price); - }, + //保存按钮 btnSave() { @@ -565,17 +577,23 @@ export default { this.$message.warning("请先选中单位分组") return } - let body = [] - // [ - // { - // "customerOrgGroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "asbitemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "price": 0, - // "amount": 0 - // } - // ] + let body = { + customerOrgGroupId:this.customerOrgGroup.id, + details:[] + } + // { + // "customerOrgGroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "details": [ + // { + // "customerOrgGroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "asbitemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "price": 0, + // "amount": 0 + // } + // ] + // } this.customerOrgGroupAsbitems.forEach(e =>{ - body.push({ + body.details.push({ customerOrgGroupId:this.customerOrgGroup.id, asbitemId:e.asbitemId, price:e.customerOrgGroupDetailPrice, diff --git a/src/views/customerOrg/customerOrgGroup.vue b/src/views/customerOrg/customerOrgGroup.vue index 6e63289..b344747 100644 --- a/src/views/customerOrg/customerOrgGroup.vue +++ b/src/views/customerOrg/customerOrgGroup.vue @@ -12,7 +12,7 @@ v-model="customerOrgId" placeholder="请选择体检单位" filterable - clearable automatic-dropdown + clearable style="margin-left: 10px" @change="changeCustomerOrg" size="small" @@ -35,6 +35,7 @@ style="width: 60px; margin-left: 10px" size="small" @change="changeTimes" + value-key="id" >
置低
- 确定 + 保存排序
- +
+ @@ -266,10 +268,10 @@ export default { customerOrgRegisterId: null, //所属体检次数 displayName: "", price: 0, - forSexId: "", - maritalStatusId: "", - ageLowerLimit: null, - ageUpperLimit: null, + forSexId: "A", + maritalStatusId: "A", + ageLowerLimit: 0, + ageUpperLimit: 200, jobPost: "", jobTitle: "", remark: "", @@ -374,6 +376,19 @@ export default { } }, + //选中颜色 + handleRowClassName({ row, rowIndex }) { + // highLightBg 为 'selected'的高亮 + //console.log(rowIndex, row) + //return row.highLightBg == 'selected' ? 'high-light-bg' : ''; + if (row.choosed) { + return 'current-row'; + } else { + return ''; + } + + }, + //获取初始数据 dictInit() { //获取单位列表 @@ -420,8 +435,9 @@ export default { this.getCustomerOrgGroup(this.customerOrgRegister.id); } else { this.customerOrgRegister = {}; - this.customerOrgGroups = []; + this.customerOrgGroups = []; } + objCopy(this.formInit,this.form) } }); }, @@ -431,13 +447,9 @@ export default { this.getCustomerOrgGroup(v.id); }, - //自定义过滤 - remoteMethod(){ - - }, - + //点击分组 - rowClick(row) { + rowClick(row) { objCopy(row, this.form); }, @@ -486,6 +498,7 @@ export default { this.form.id ); if (lfind > -1) this.customerOrgGroups.splice(lfind, 1); + objCopy(this.formInit,this.form) } }) .catch((err) => { @@ -536,7 +549,8 @@ export default { if (res.code != -1) { this.$message.success("操作成功!"); this.form.id = res.data.id; - this.customerOrgGroups.push(res.data); + this.customerOrgGroups.push(deepCopy(res.data)); + this.$refs['customerOrgGroups'].setCurrentRow(this.customerOrgGroups[this.customerOrgGroups.length - 1]); this.dialogVisible = false; } });