@@ -78,13 +77,13 @@ import {
deepCopy,
objCopy,
arrayExistObj,
+ tcdate
} from "../../utlis/proFunc";
-import CustomerOrgGroupAsbitem from "../../components/customerOrg/customerOrgGroupAsbitem.vue";
export default {
components: {
- CustomerOrgGroupAsbitem,
+
},
props: ["params"],
data() {
@@ -124,14 +123,19 @@ export default {
moment, dddw, deepCopy,
// 获取初始数据
- dictInit() {
- //获取单位列表
- getapi("/api/app/customer-org/parent-all").then((res) => {
+ dictInit() {
+ //获取体检中心
+ getapi("/api/app/organization-units/by-code-all").then((res) => {
+ if (res.code > -1) {
+ this.dict.medicalCenter = res.data;
+ }
+ });
+
+ // 项目类别 树结构
+ getapi("/api/app/item-type/by-code-all").then((res) => {
if (res.code != -1) {
- this.customerOrgAll = res.data;
- let lfind = arrayExistObj(this.customerOrgAll, "id", this.dict.personOrgId);
- if (lfind > -1) this.customerOrgAll.splice(lfind, 1);
- this.customerOrg = deepCopy(this.customerOrgAll);
+ this.dict.itemTypeTree = res.data;
+ tcdate(this.dict.itemTypeTree);
}
});
@@ -144,11 +148,11 @@ export default {
},
// 生成表单数据
- getFormData(id) {
- if (id) {
- getapi(`/api/app/customer-org-group/${id}`)
+ getFormData(roomId) {
+ if (roomId) {
+ postapi('/api/app/Room/Get', { roomId })
.then(res => {
- if (res.code != -1) {
+ if (res.code > -1) {
this.form = deepCopy(res.data)
}
})
@@ -169,143 +173,43 @@ export default {
let body = deepCopy(this.form);
body.roomId = body.id
- if(Array.isArray(this.form.itemTypeId) && this.form.itemTypeId.length > 0){
+ if (Array.isArray(this.form.itemTypeId) && this.form.itemTypeId.length > 0) {
body.itemTypeId = this.form.itemTypeId[this.form.itemTypeId.length - 1]
- }else{
+ } else {
body.itemTypeId = this.form.itemTypeId
}
- if(!body.itemTypeId){
+ if (!body.itemTypeId) {
this.$message.warning("必须选择项目类别");
return false;
}
-
+
let url = "/api/app/Room/Create"
if (this.form.id) {
url = "/api/app/Room/Update"
}
- postapi(url,body).then(res => {
- if(res.code > -1){
- this.dialogWin.RommEdit = false
- this.dataTransOpts.refresh.room_detail.M++
- }
- })
- });
- },
-
- //
- computePrice() {
- if (!this.form.id) {
- this.$message.warning("尚未保存信息,不可执行此操作!");
- return;
- }
- let customerOrgGroupId = this.form.id;
- let customerOrgGroupAsbitems = []; //分组包含的套餐
-
- getapi(`/api/app/customerorggroupdetail/getcustomerorggroupdetailinasbitem?CustomerOrgGroupId=${customerOrgGroupId}`)
- .then((res) => {
- if (res.code != -1) {
- customerOrgGroupAsbitems = res.data;
-
- if (customerOrgGroupAsbitems.length < 1) {
- this.$message.warning("当前分组尚未设置组合项目,不可执行此操作!");
- } else {
- let body = {
- customerOrgGroupId,
- details: this.madeNewGroupAsbitems(
- customerOrgGroupAsbitems,
- this.form.price
- ),
- };
- console.log("body", body);
- return postapi("/api/app/customerorggroupdetail/createcustomerorggroupdetailmany", body);
+ postapi(url, body).then(res => {
+ if (res.code > -1) {
+ if(!this.form.id){
+ this.form.id = res.data.id
}
+ this.dataTransOpts.tableS.room.id = this.form.id
+ this.dialogWin.RommEdit = false
}
})
- .then((res) => {
- if (res.code != -1) {
- //console.log("操作成功");
- //触发分组明细刷新
- this.form.id = "";
- //要做延时处理,否则不会触发监听
- setTimeout(() => {
- this.form.id = customerOrgGroupId;
- this.onSubmit("form");
- }, 100);
- }
- });
- },
-
- madeNewGroupAsbitems(oldGroupAsbitems, newTotal) {
- newTotal = Math.round(Number(newTotal) * 100) / 100;
- let newGroupAsbitems = [];
- let oldTotal = Number(0);
- oldGroupAsbitems.forEach((e) => {
- oldTotal += Number(e.asbitemMoney); //customerOrgGroupDetailMoney
- });
- oldTotal = Math.round(Number(oldTotal) * 100) / 100;
-
- let discount = 0;
- if (oldTotal != 0) discount = Math.round((newTotal * 10000) / oldTotal) / 100;
-
- oldTotal = Number(0);
- oldGroupAsbitems.forEach((e) => {
- e.customerOrgGroupDetailPrice = Math.round(e.price * discount) / 100;
- e.customerOrgGroupDetailMoney =
- Math.round(
- e.customerOrgGroupDetailPrice * e.customerOrgGroupDetailAmount * 100
- ) / 100;
- oldTotal += Number(e.customerOrgGroupDetailMoney);
});
- oldTotal = Math.round(Number(oldTotal) * 100) / 100;
-
- //console.log('discount,oldTotal',discount,oldTotal)
-
- let didTotal = Math.round(Number(newTotal - oldTotal) * 100) / 100;
- if (didTotal != 0) {
- for (let i = 0; i < oldGroupAsbitems.length; i++) {
- if (oldGroupAsbitems[i].customerOrgGroupDetailAmount == 1) {
- oldGroupAsbitems[i].customerOrgGroupDetailPrice =
- Math.round(
- (Number(oldGroupAsbitems[i].customerOrgGroupDetailPrice) +
- Number(didTotal)) *
- 100
- ) / 100;
- break;
- }
- }
- }
-
- oldGroupAsbitems.forEach((e) => {
- newGroupAsbitems.push({
- customerOrgGroupId: e.customerOrgGroupId,
- asbitemId: e.asbitemId,
- price: e.customerOrgGroupDetailPrice,
- amount: e.customerOrgGroupDetailAmount,
- });
- });
-
- return newGroupAsbitems;
},
-
+
},
//监听事件
- watch: {
- //
- // "customerOrgGroup.id"(newVal, oldVal) {
- // console.log("customerOrgGroup.id ",newVal,oldVal);
- // if (newVal != oldVal) {
- // this.getCustomerOrgGroupAsbitems(newVal);
- // }
- // },
-
+ watch: {
// 体检分组ID未切换换时 也可以强制刷新数据
"dataTransOpts.refresh.room.S": {
// immediate: true,
handler(newVal, oldVal) {
console.log(`watch 体检分组 newVal:${newVal} oldVal:${oldVal} customerOrgGroupId: ${this.dataTransOpts.tableS.room.id}`);
- this.getFormData(this.dataTransOpts.tableS.room.id);
+ if (newVal != oldVal) this.getFormData(this.dataTransOpts.tableS.room.id);
}
},
},
diff --git a/src/components/room/room.vue b/src/components/room/room.vue
index 693a643..d810ccc 100644
--- a/src/components/room/room.vue
+++ b/src/components/room/room.vue
@@ -10,9 +10,8 @@
体检中心:
-
+
{{ item.displayName }}
@@ -25,7 +24,7 @@
-
+
{{ dddw(dict.medicalCenter, "id", scope.row.medicalCenterId, "displayName") }}
@@ -46,7 +45,7 @@
-
+
{{ scope.row.isActive == 'Y' ? '√' : '' }}
@@ -83,10 +82,10 @@
删除
- 置顶
+ 置顶
- 置底
+ 置底
保存排序
@@ -96,12 +95,12 @@
-
+
-
@@ -138,38 +137,22 @@ export default {
},
tableData: [], //体检单位分组
- customerOrgId: "", //当前选中的体检单位id
- customerOrgRegisterList: [], //体检次数列表
- customerOrgRegister: {}, //体检次数
-
- curCustomerOrgGroup: {}, // 当前选中分组
- RoomEditParams: {}, //分组 新增时 用到参数
+ curRoom: {}, // 当前选中房间
+ RoomEditParams: {}, //房间 新增时 用到参数
medicalCenterId: "", // 体检中心
isDrag: false,
form: {
- //体检单位分组
- customerOrgId: "", //复制分组时用到(预留查历次分组)
- isComplete: "N", //体检次数是否完成,如完成不允许调整分组项目
id: "",
- medicalCenterId: null, //所属体检次数
displayName: "",
- price: 0,
+ itemTypeId: "",
+ medicalCenterId: "",
forSexId: "A",
- maritalStatusId: "A",
- ageLowerLimit: 0,
- ageUpperLimit: 200,
- jobPost: "",
- jobTitle: "",
- remark: "",
- isMaxMedicalTimes: "N",
+ roomTypeFlag: "0",
+ queueTime: 0,
+ isActive: "Y"
},
- formOri: {}, //用于对比分析哪些信息更改了
formInit: {}, //表单初始值
- rules: {
- displayName: [{ required: true, message: "请填写分组名称", trigger: "blur" }],
- },
-
};
},
computed: {
@@ -211,7 +194,7 @@ export default {
this.tableData.forEach((item, index) => {
result.push({ id: item.id, displayOrder: index });
});
- putapi("/api/app/customerorggroup/updatesortmany", {
+ postapi("/api/app/Room/updatesortmany", {
itemList: result,
}).then((res) => {
console.log("操作成功");
@@ -221,26 +204,6 @@ export default {
//初始化Sortable组件
rowDrop() {
- // this.$nextTick(() => {
- // const tbody = document.querySelector(".el-table__body-wrapper tbody");
- // const _this = this;
- // Sortable.create(tbody, {
- // handle: ".move",
- // animation: 300,
- // onEnd({ newIndex, oldIndex }) {
- // _this.isDrag = false;
- // const currRow = _this.tableData.splice(oldIndex, 1)[0];
- // _this.tableData.splice(newIndex, 0, currRow);
- // _this.tableData.map((item, index) => {
- // if (index == newIndex && index == oldIndex) {
- // } else if (index == oldIndex) {
- // } else if (index == newIndex) {
- // }
- // });
- // console.log(_this.tableData.map((item) => item.displayOrder));
- // },
- // });
- // });
this.$nextTick(() => {
const el = document.querySelector(".el-table__body-wrapper tbody");
@@ -260,45 +223,36 @@ export default {
});
},
- //置底
- btnSetBottom() {
- if (!this.dataTransOpts.tableS.customer_org_group.id) {
+ // 置底 或 置顶
+ btnSetBottomOrTop(sortType) {
+ if (!this.dataTransOpts.tableS.room.id) {
this.$message.warning("请选择操作的数据");
return;
}
- let lfind = arrayExistObj(this.tableData, "id", this.dataTransOpts.tableS.customer_org_group.id);
- let currentRow = {};
-
- putapi(
- `/api/app/customerorggroup/updatemanysort?id=${this.dataTransOpts.tableS.customer_org_group.id}&SortType=2`
- ).then((res) => {
- console.log("操作成功");
- currentRow = this.tableData.splice(lfind, 1)[0]; //删除并赋值
- this.tableData.push(currentRow);
- this.$refs["tableData"].setCurrentRow(currentRow);
- });
- },
-
- //置顶
- btnSetTop() {
- if (!this.dataTransOpts.tableS.customer_org_group.id) {
- this.$message.warning("请选择操作的数据");
- return;
+ let body = {
+ roomId: this.dataTransOpts.tableS.room.id,
+ sortType
}
-
- let lfind = arrayExistObj(this.tableData, "id", this.dataTransOpts.tableS.customer_org_group.id);
- let currentRow = {};
-
- putapi(
- `/api/app/customerorggroup/updatemanysort?id=${this.dataTransOpts.tableS.customer_org_group.id}&SortType=1`
- ).then((res) => {
- console.log("操作成功");
- currentRow = this.tableData.splice(lfind, 1)[0];
- this.tableData.unshift(currentRow);
- this.$refs["tableData"].setCurrentRow(currentRow);
- });
+ postapi('/api/app/Room/UpdateManySort', body)
+ .then((res) => {
+ if (res.code > -1) {
+ console.log("操作成功");
+ let lfind = arrayExistObj(this.tableData, "id", body.roomId);
+ if (lfind > -1) {
+ let currentRow = {};
+ currentRow = this.tableData.splice(lfind, 1)[0]; //删除并赋值
+ if (sortType == 2) {
+ this.tableData.push(currentRow);
+ } else {
+ this.tableData.unshift(currentRow);
+ }
+ this.$refs["tableData"].setCurrentRow(currentRow);
+ }
+ }
+ });
},
+
//选中颜色
handleRowClassName({ row, rowIndex }) {
// highLightBg 为 'selected'的高亮
@@ -339,6 +293,8 @@ export default {
//获取房间列表
getRoom(medicalCenterId) {
+ this.dataTransOpts.tableS.room.id = ""
+ this.curRoom = {}
this.isDrag = false;
objCopy(this.formInit, this.form);
this.form.medicalCenterId = medicalCenterId;
@@ -352,7 +308,7 @@ export default {
});
},
- //选择体检中心
+ //选择体检中心
changeMedicalCenter(v) {
// console.log('changeMedicalCenter', v)
this.getRoom(v)
@@ -360,21 +316,18 @@ export default {
//点击房间
rowClick(row) {
- this.dataTransOpts.tableS.customer_org_group.id = row.id
- this.curCustomerOrgGroup = deepCopy(row);
- this.curCustomerOrgGroup.isComplete = this.customerOrgRegister.isComplete;
- setTimeout(() => {
- this.dataTransOpts.refresh.customer_org_group_detail.M++;
- }, 20);
+ this.curRoom = row
+ this.dataTransOpts.tableS.room.id = row.id
+ this.dataTransOpts.refresh.room_detail.M++;
},
// 新增(编辑调用时,传入id值) 弹框
btnAdd(id) {
if (!id) this.dataTransOpts.tableS.room.id = ''
-
+
this.dataTransOpts.refresh.room.S++
if (!id) this.dataTransOpts.refresh.room_detail.M++; //新增则清掉已选组合项目
-
+
this.RoomEditParams = {
medicalCenterId: this.medicalCenterId
}
@@ -383,23 +336,19 @@ export default {
//编辑弹框
btnEdit() {
- if (!this.dataTransOpts.tableS.customer_org_group.id) {
- this.$message.warning("请先选择体检分组");
+ if (!this.dataTransOpts.tableS.room.id) {
+ this.$message.warning("请先选择分诊叫号房间");
return;
}
- this.btnAdd(this.dataTransOpts.tableS.customer_org_group.id)
+ this.btnAdd(this.dataTransOpts.tableS.room.id)
},
//删除
btnDel() {
- if (!this.dataTransOpts.tableS.customer_org_group.id) {
+ if (!this.dataTransOpts.tableS.room.id) {
this.$message.warning("请选择需要操作的数据");
return;
}
- if (this.customerOrgRegister.isComplete.toUpperCase() == "Y") {
- this.$message.warning("该单位体检次数已完成,不允许删除分组");
- return;
- }
this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
confirmButtonText: "是",
@@ -407,17 +356,15 @@ export default {
type: "warning",
})
.then(() => {
- return deletapi(`/api/app/customer-org-group/${this.dataTransOpts.tableS.customer_org_group.id}`);
+ return postapi('/api/app/Room/Delete', { roomId: this.dataTransOpts.tableS.room.id });
})
.then((res) => {
if (res.code != -1) {
console.log("删除成功");
- let lfind = arrayExistObj(this.tableData, "id", this.dataTransOpts.tableS.customer_org_group.id);
+ let lfind = arrayExistObj(this.tableData, "id", this.dataTransOpts.tableS.room.id);
if (lfind > -1) this.tableData.splice(lfind, 1);
- this.dataTransOpts.tableS.customer_org_group.id = ''
- setTimeout(() => {
- this.dataTransOpts.refresh.customer_org_group_detail.M++
- }, 20);
+ this.dataTransOpts.tableS.room.id = ''
+ this.dataTransOpts.refresh.room_detail.M++
}
})
.catch((err) => {
@@ -428,66 +375,12 @@ export default {
});
},
-
-
- madeNewGroupAsbitems(oldGroupAsbitems, newTotal) {
- newTotal = Math.round(Number(newTotal) * 100) / 100;
- let newGroupAsbitems = [];
- let oldTotal = Number(0);
- oldGroupAsbitems.forEach((e) => {
- oldTotal += Number(e.asbitemMoney); //customerOrgGroupDetailMoney
- });
- oldTotal = Math.round(Number(oldTotal) * 100) / 100;
-
- let discount = 0;
- if (oldTotal != 0) discount = Math.round((newTotal * 10000) / oldTotal) / 100;
-
- oldTotal = Number(0);
- oldGroupAsbitems.forEach((e) => {
- e.customerOrgGroupDetailPrice = Math.round(e.price * discount) / 100;
- e.customerOrgGroupDetailMoney =
- Math.round(
- e.customerOrgGroupDetailPrice * e.customerOrgGroupDetailAmount * 100
- ) / 100;
- oldTotal += Number(e.customerOrgGroupDetailMoney);
- });
- oldTotal = Math.round(Number(oldTotal) * 100) / 100;
-
- //console.log('discount,oldTotal',discount,oldTotal)
-
- let didTotal = Math.round(Number(newTotal - oldTotal) * 100) / 100;
- if (didTotal != 0) {
- for (let i = 0; i < oldGroupAsbitems.length; i++) {
- if (oldGroupAsbitems[i].customerOrgGroupDetailAmount == 1) {
- oldGroupAsbitems[i].customerOrgGroupDetailPrice =
- Math.round(
- (Number(oldGroupAsbitems[i].customerOrgGroupDetailPrice) +
- Number(didTotal)) *
- 100
- ) / 100;
- break;
- }
- }
- }
-
- oldGroupAsbitems.forEach((e) => {
- newGroupAsbitems.push({
- customerOrgGroupId: e.customerOrgGroupId,
- asbitemId: e.asbitemId,
- price: e.customerOrgGroupDetailPrice,
- amount: e.customerOrgGroupDetailAmount,
- });
- });
-
- return newGroupAsbitems;
- },
-
// 关闭 分组 新增/编辑
close_dialogWinRoomEdit() {
- let id = this.dataTransOpts.tableS.customer_org_group.id
+ let id = this.dataTransOpts.tableS.room.id
if (id) {
// 点编辑 或 新增有提交
- getapi(`/api/app/customer-org-group/${id}`)
+ postapi('/api/app/Room/Get', { roomId:id })
.then(res => {
if (res.code != -1) {
let lfind = -1
@@ -504,16 +397,18 @@ export default {
this.$refs["tableData"].setCurrentRow(this.tableData[lfind]);
// 更新 customer_org_group_detail 参数
- this.curCustomerOrgGroup = deepCopy(res.data);
- this.curCustomerOrgGroup.isComplete = this.customerOrgRegister.isComplete;
+ this.curRoom = deepCopy(res.data);
+
+ this.dataTransOpts.refresh.room_detail.M++;
}
})
} else {
// 点 新增 但未提交
- this.dataTransOpts.tableS.customer_org_group.id = this.curCustomerOrgGroup.id || ''
+ this.dataTransOpts.tableS.room.id = this.curRoom.id || ''
+ this.dataTransOpts.refresh.room_detail.M++;
}
- this.dataTransOpts.refresh.customer_org_group_detail.M++;
+
},
},
};