|
|
|
@ -7,22 +7,22 @@ |
|
|
|
<!--公共表分类信息--> |
|
|
|
<div style="display: flex; font-size: 14px"> |
|
|
|
<div :style="'display: block;width:' + (window.pageWidth - window.pageMarginWidth - 110 - 5) + 'px;'"> |
|
|
|
<el-table :data="commonTableTypes" ref="commonTableType" row-key="id" border |
|
|
|
height="240px" size="small" highlight-current-row :row-class-name="handleRowClassName" |
|
|
|
@row-click="rowClick"> |
|
|
|
<el-table :data="commonTableTypes" ref="commonTableTypes" row-key="id" border height="240px" size="small" |
|
|
|
highlight-current-row :row-class-name="handleRowClassName" @row-click="rowClick"> |
|
|
|
<el-table-column type="index" label="序号" width="50" align="center" /> |
|
|
|
<el-table-column label="编号" prop="id" min-width="200" align="center" /> |
|
|
|
<el-table-column prop="displayName" label="分类名称" min-width="150" /> |
|
|
|
<el-table-column prop="displayName" label="分类名称" min-width="150" /> |
|
|
|
<el-table-column prop="creatorName" label="创建者" min-width="80" align="center" /> |
|
|
|
<el-table-column label="创建时间" min-width="150" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
{{ scope.row.creationTime ? moment(scope.row.creationTime).format("yyyy-MM-DD HH:mm:ss") : "" }} |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="lastModificationName" label="修改者" min-width="80" align="center" /> |
|
|
|
<el-table-column prop="lastModifierName" label="修改者" min-width="80" align="center" /> |
|
|
|
<el-table-column label="修改时间" min-width="150" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
{{ scope.row.lastModificationTime ? moment(scope.row.lastModificationTime).format("yyyy-MM-DD HH:mm:ss") : "" }} |
|
|
|
{{ scope.row.lastModificationTime ? moment(scope.row.lastModificationTime).format("yyyy-MM-DD HH:mm:ss") |
|
|
|
: "" }} |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="操作" align="center"> |
|
|
|
@ -39,7 +39,7 @@ |
|
|
|
</el-table> |
|
|
|
</div> |
|
|
|
<!--按钮--> |
|
|
|
<div style="display: block; margin-left: 5px"> |
|
|
|
<div style="display: block; margin-left: 5px"> |
|
|
|
<div style="margin-top: 5px"> |
|
|
|
<el-button class="commonbutton" @click="btnAdd('')">新增</el-button> |
|
|
|
</div> |
|
|
|
@ -50,10 +50,10 @@ |
|
|
|
<el-button class="deleteButton" @click="btnDel">删除</el-button> |
|
|
|
</div> |
|
|
|
<div style="margin-top: 5px"> |
|
|
|
<el-button class="commonbutton" @click="btnSetTop">置顶</el-button> |
|
|
|
<el-button class="commonbutton" @click="btnSetTopOrBottom(1)">置顶</el-button> |
|
|
|
</div> |
|
|
|
<div style="margin-top: 5px"> |
|
|
|
<el-button class="commonbutton" @click="btnSetBottom">置底</el-button> |
|
|
|
<el-button class="commonbutton" @click="btnSetTopOrBottom(2)">置底</el-button> |
|
|
|
</div> |
|
|
|
<div style="margin-top: 5px"> |
|
|
|
<el-button class="commonbutton" @click="btnSort" :disabled="!isDrag">保存排序</el-button> |
|
|
|
@ -101,15 +101,15 @@ export default { |
|
|
|
pagePriv: { |
|
|
|
routeUrlorPageName: "commonTable", //当前页面归属路由或归属页面权限名称 |
|
|
|
privs: [], // 页面权限 |
|
|
|
}, |
|
|
|
}, |
|
|
|
commonTableTypes: [], //公共表分类 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curCommonTableType: {}, // 当前选中分组 |
|
|
|
CommonTableTypeEditParams: {}, //分组 新增时 用到参数 |
|
|
|
|
|
|
|
isDrag: false, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -139,30 +139,13 @@ export default { |
|
|
|
dddw, |
|
|
|
deepCopy, |
|
|
|
|
|
|
|
// 复制上一次分组 |
|
|
|
btnCopyPreGroup() { |
|
|
|
if (!this.customerOrgRegister.id) { |
|
|
|
this.$message.warning("请选择体检次数"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
postapi('/api/app/CustomerOrgGroup/CopyLastGrouping', { customerOrgRegisterId: this.customerOrgRegister.id }) |
|
|
|
.then(res => { |
|
|
|
if (res.code > -1) { |
|
|
|
// 刷新体检次数的分组 |
|
|
|
this.getCustomerOrgGroup(this.customerOrgRegister.id); |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//确定排序 |
|
|
|
btnSort() { |
|
|
|
const result = []; |
|
|
|
let result = []; |
|
|
|
this.commonTableTypes.forEach((item, index) => { |
|
|
|
result.push({ id: item.id, displayOrder: index }); |
|
|
|
}); |
|
|
|
putapi("/api/app/customerorggroup/updatesortmany", { |
|
|
|
postapi("/api/app/CommonTableType/UpdateSortMany", { |
|
|
|
itemList: result, |
|
|
|
}).then((res) => { |
|
|
|
console.log("操作成功"); |
|
|
|
@ -172,27 +155,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.commonTableTypes.splice(oldIndex, 1)[0]; |
|
|
|
// _this.commonTableTypes.splice(newIndex, 0, currRow); |
|
|
|
// _this.commonTableTypes.map((item, index) => { |
|
|
|
// if (index == newIndex && index == oldIndex) { |
|
|
|
// } else if (index == oldIndex) { |
|
|
|
// } else if (index == newIndex) { |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// console.log(_this.commonTableTypes.map((item) => item.displayOrder)); |
|
|
|
// }, |
|
|
|
// }); |
|
|
|
// }); |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
const el = document.querySelector(".el-table__body-wrapper tbody"); |
|
|
|
//console.log('el0',el) |
|
|
|
@ -211,8 +173,8 @@ export default { |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
//置底 |
|
|
|
btnSetBottom() { |
|
|
|
// 置顶 置底 |
|
|
|
btnSetTopOrBottom(sortType) { |
|
|
|
if (!this.dataTransOpts.tableS.common_table_type.id) { |
|
|
|
this.$message.warning("请选择操作的数据"); |
|
|
|
return; |
|
|
|
@ -220,32 +182,18 @@ export default { |
|
|
|
let lfind = arrayExistObj(this.commonTableTypes, "id", this.dataTransOpts.tableS.common_table_type.id); |
|
|
|
let currentRow = {}; |
|
|
|
|
|
|
|
putapi( |
|
|
|
`/api/app/customerorggroup/updatemanysort?id=${this.dataTransOpts.tableS.common_table_type.id}&SortType=2` |
|
|
|
// ?id=${this.dataTransOpts.tableS.common_table_type.id}&SortType=2` |
|
|
|
|
|
|
|
postapi('/api/app/CommonTableType/UpdateManySort', { commonTableTypeId: this.dataTransOpts.tableS.common_table_type.id, sortType } |
|
|
|
).then((res) => { |
|
|
|
console.log("操作成功"); |
|
|
|
currentRow = this.commonTableTypes.splice(lfind, 1)[0]; //删除并赋值 |
|
|
|
this.commonTableTypes.push(currentRow); |
|
|
|
this.$refs["commonTableTypes"].setCurrentRow(currentRow); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
//置顶 |
|
|
|
btnSetTop() { |
|
|
|
if (!this.dataTransOpts.tableS.common_table_type.id) { |
|
|
|
this.$message.warning("请选择操作的数据"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
let lfind = arrayExistObj(this.commonTableTypes, "id", this.dataTransOpts.tableS.common_table_type.id); |
|
|
|
let currentRow = {}; |
|
|
|
if (sortType == 2) { |
|
|
|
this.commonTableTypes.push(currentRow); |
|
|
|
} else { |
|
|
|
this.commonTableTypes.unshift(currentRow); |
|
|
|
} |
|
|
|
|
|
|
|
putapi( |
|
|
|
`/api/app/customerorggroup/updatemanysort?id=${this.dataTransOpts.tableS.common_table_type.id}&SortType=1` |
|
|
|
).then((res) => { |
|
|
|
console.log("操作成功"); |
|
|
|
currentRow = this.commonTableTypes.splice(lfind, 1)[0]; |
|
|
|
this.commonTableTypes.unshift(currentRow); |
|
|
|
this.$refs["commonTableTypes"].setCurrentRow(currentRow); |
|
|
|
}); |
|
|
|
}, |
|
|
|
@ -264,27 +212,11 @@ export default { |
|
|
|
|
|
|
|
//获取初始数据 |
|
|
|
dictInit() { |
|
|
|
//获取单位列表 |
|
|
|
getapi("/api/app/customer-org/parent-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); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//获取适用性别 |
|
|
|
getapi("/api/app/for-sex").then((res) => { |
|
|
|
if (res.code != -1) { |
|
|
|
this.dict.forSex = res.data; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//获取适用婚姻 |
|
|
|
postapi("/api/app/MaritalStatus/GetForMaritalStatusList").then((res) => { |
|
|
|
postapi("/api/app/CommonTableType/GetList").then((res) => { |
|
|
|
if (res.code != -1) { |
|
|
|
this.dict.forMaritalStatus = res.data; |
|
|
|
this.commonTableTypes = res.data; |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
@ -293,29 +225,25 @@ export default { |
|
|
|
//点击分组 |
|
|
|
rowClick(row) { |
|
|
|
this.dataTransOpts.tableS.common_table_type.id = row.id |
|
|
|
this.curCommonTableType = deepCopy(row); |
|
|
|
this.curCommonTableType.isComplete = this.customerOrgRegister.isComplete; |
|
|
|
setTimeout(() => { |
|
|
|
this.dataTransOpts.refresh.common_table.M++; |
|
|
|
}, 20); |
|
|
|
this.curCommonTableType = row; |
|
|
|
this.dataTransOpts.refresh.common_table.M++; |
|
|
|
}, |
|
|
|
|
|
|
|
// 新增(编辑调用时,传入id值) 弹框 |
|
|
|
btnAdd(id) { |
|
|
|
if (!id) this.dataTransOpts.tableS.common_table_type.id = '' |
|
|
|
if (!id) this.dataTransOpts.refresh.common_table.M++; //新增则清掉已选组合项目 |
|
|
|
|
|
|
|
|
|
|
|
this.CommonTableTypeEditParams = { |
|
|
|
id |
|
|
|
} |
|
|
|
this.dataTransOpts.refresh.common_table_type.S++ |
|
|
|
this.dialogWin.CommonTableTypeEdit = true; |
|
|
|
}, |
|
|
|
|
|
|
|
//编辑弹框 |
|
|
|
btnEdit() { |
|
|
|
if (!this.dataTransOpts.tableS.common_table_type.id) { |
|
|
|
this.$message.warning("请先选择体检分组"); |
|
|
|
this.$message.warning("请先选择分类记录"); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.btnAdd(this.dataTransOpts.tableS.common_table_type.id) |
|
|
|
@ -327,10 +255,6 @@ export default { |
|
|
|
this.$message.warning("请选择需要操作的数据"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (this.customerOrgRegister.isComplete.toUpperCase() == "Y") { |
|
|
|
this.$message.warning("该单位体检次数已完成,不允许删除分组"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", { |
|
|
|
confirmButtonText: "是", |
|
|
|
@ -338,7 +262,7 @@ export default { |
|
|
|
type: "warning", |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
return deletapi(`/api/app/customer-org-group/${this.dataTransOpts.tableS.common_table_type.id}`); |
|
|
|
return postapi('/api/app/CommonTableType/Delete', { commonTableTypeId: this.dataTransOpts.tableS.common_table_type.id }); |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
if (res.code != -1) { |
|
|
|
@ -346,9 +270,7 @@ export default { |
|
|
|
let lfind = arrayExistObj(this.commonTableTypes, "id", this.dataTransOpts.tableS.common_table_type.id); |
|
|
|
if (lfind > -1) this.commonTableTypes.splice(lfind, 1); |
|
|
|
this.dataTransOpts.tableS.common_table_type.id = '' |
|
|
|
setTimeout(() => { |
|
|
|
this.dataTransOpts.refresh.common_table.M++ |
|
|
|
}, 20); |
|
|
|
this.dataTransOpts.refresh.common_table.M++ |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
@ -360,69 +282,15 @@ 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); //commonTableTypeDetailMoney |
|
|
|
}); |
|
|
|
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.commonTableTypeDetailPrice = Math.round(e.price * discount) / 100; |
|
|
|
e.commonTableTypeDetailMoney = |
|
|
|
Math.round( |
|
|
|
e.commonTableTypeDetailPrice * e.commonTableTypeDetailAmount * 100 |
|
|
|
) / 100; |
|
|
|
oldTotal += Number(e.commonTableTypeDetailMoney); |
|
|
|
}); |
|
|
|
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].commonTableTypeDetailAmount == 1) { |
|
|
|
oldGroupAsbitems[i].commonTableTypeDetailPrice = |
|
|
|
Math.round( |
|
|
|
(Number(oldGroupAsbitems[i].commonTableTypeDetailPrice) + |
|
|
|
Number(didTotal)) * |
|
|
|
100 |
|
|
|
) / 100; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
oldGroupAsbitems.forEach((e) => { |
|
|
|
newGroupAsbitems.push({ |
|
|
|
commonTableTypeId: e.commonTableTypeId, |
|
|
|
asbitemId: e.asbitemId, |
|
|
|
price: e.commonTableTypeDetailPrice, |
|
|
|
amount: e.commonTableTypeDetailAmount, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
return newGroupAsbitems; |
|
|
|
}, |
|
|
|
|
|
|
|
// 关闭 分组 新增/编辑 |
|
|
|
close_dialogWinCommonTableTypeEdit() { |
|
|
|
let id = this.dataTransOpts.tableS.common_table_type.id |
|
|
|
if (id) { |
|
|
|
// 点编辑 或 新增有提交 |
|
|
|
getapi(`/api/app/customer-org-group/${id}`) |
|
|
|
postapi('/api/app/CommonTableType/Get', { commonTableTypeId: id }) |
|
|
|
.then(res => { |
|
|
|
if (res.code != -1) { |
|
|
|
let lfind = -1 |
|
|
|
lfind = arrayExistObj(this.commonTableTypes, 'id', id) |
|
|
|
if (res.code > -1) { |
|
|
|
let lfind = arrayExistObj(this.commonTableTypes, 'id', id) |
|
|
|
if (lfind > -1) { |
|
|
|
objCopy(res.data, this.commonTableTypes[lfind]) |
|
|
|
} else { |
|
|
|
@ -436,7 +304,6 @@ export default { |
|
|
|
|
|
|
|
// 更新 common_table 参数 |
|
|
|
this.curCommonTableType = deepCopy(res.data); |
|
|
|
this.curCommonTableType.isComplete = this.customerOrgRegister.isComplete; |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
|