7 changed files with 1463 additions and 28 deletions
-
388src/components/commonTable/CommonTable.vue
-
304src/components/commonTable/CommonTableEdit.vue
-
294src/components/commonTable/CommonTableTypeEdit.vue
-
464src/components/commonTable/commonTableType.vue
-
6src/router/index.js
-
8src/store/index.js
-
27src/views/doctorCheck/lisResultImport.vue
@ -0,0 +1,388 @@ |
|||
<template> |
|||
<div> |
|||
<div> |
|||
<div class="contenttitle"> |
|||
明细记录 |
|||
</div> |
|||
<!--公共表分类信息--> |
|||
<div style="display: flex; font-size: 14px"> |
|||
<div :style="'display: block;width:' + (window.pageWidth - window.pageMarginWidth - 110 - 5) + 'px;'"> |
|||
<el-table :data="commonTables" ref="commonTable" row-key="id" border :height="`${tableHeight }px`" 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="dataCode" label="dataCode" min-width="100" /> |
|||
<el-table-column prop="displayName" label="名称" min-width="150" /> |
|||
<el-table-column prop="commonTableTypeId" label="分类" min-width="150" /> |
|||
<el-table-column prop="simpleCode" label="简码" min-width="60" /> |
|||
<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 label="修改时间" min-width="150" align="center"> |
|||
<template slot-scope="scope"> |
|||
{{ scope.row.lastModificationTime ? moment(scope.row.lastModificationTime).format("yyyy-MM-DD HH:mm:ss") |
|||
: "" }} |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="操作" align="center"> |
|||
<template> |
|||
<el-tag class="move" style=" |
|||
cursor: move; |
|||
background-color: rgb(245, 245, 245); |
|||
border: none; |
|||
" draggable="true"> |
|||
<i class="el-icon-d-caret" style="width: 1rem; height: 1rem; color: rgb(113, 113, 113)"></i> |
|||
</el-tag> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
<!--按钮--> |
|||
<div style="display: block; margin-left: 5px"> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="commonbutton" @click="btnAdd('')">新增</el-button> |
|||
</div> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="commonbutton" @click="btnEdit">编辑</el-button> |
|||
</div> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="deleteButton" @click="btnDel">删除</el-button> |
|||
</div> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="commonbutton" @click="btnSetTop">置顶</el-button> |
|||
</div> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="commonbutton" @click="btnSetBottom">置底</el-button> |
|||
</div> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="commonbutton" @click="btnSort" :disabled="!isDrag">保存排序</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 新增或者编辑弹框 --> |
|||
<el-dialog :title="dataTransOpts.tableS.common_table.id ? '编辑' : '新增'" :close-on-click-modal="false" |
|||
:visible.sync="dialogWin.CommonTableEdit" width="600px" @close="close_dialogWinCommonTableEdit"> |
|||
<CommonTableEdit :params="CommonTableEditParams" /> |
|||
</el-dialog> |
|||
<!-- --> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import moment from "moment"; |
|||
import Sortable from "sortablejs"; |
|||
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|||
import { mapState } from "vuex"; |
|||
import { |
|||
getPagePriv, |
|||
checkPagePriv, |
|||
dddw, |
|||
deepCopy, |
|||
objCopy, |
|||
arrayExistObj, |
|||
} from "../../utlis/proFunc"; |
|||
|
|||
import CommonTableEdit from "./CommonTableEdit.vue"; |
|||
|
|||
export default { |
|||
components: { |
|||
CommonTableEdit |
|||
}, |
|||
data() { |
|||
return { |
|||
pagePriv: { |
|||
routeUrlorPageName: "commonTable", //当前页面归属路由或归属页面权限名称 |
|||
privs: [], // 页面权限 |
|||
}, |
|||
|
|||
commonTables: [], // 公共表 |
|||
curCommonTable: {}, // 当前选中公共表 |
|||
CommonTableEditParams: {}, //公共表 新增时 用到参数 |
|||
|
|||
isDrag: false, |
|||
|
|||
}; |
|||
}, |
|||
computed: { |
|||
...mapState(["personnelUnit", "window", "dict", "dialogWin", "dataTransOpts"]), |
|||
|
|||
tableHeight(){ |
|||
let h = this.window.pageHeight < 600 ? 600:this.window.pageHeight |
|||
return h - this.window.pageHeaderHeight - this.window.cardHeaderHeight - this.window.pageMarginHeight - 260 |
|||
}, |
|||
}, |
|||
|
|||
created() { |
|||
//获取用户当前页面的权限 |
|||
let userPriv = window.sessionStorage.getItem("userPriv"); |
|||
if (userPriv) |
|||
this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName)); |
|||
|
|||
// 清除当前选中的分组ID |
|||
this.dataTransOpts.tableS.common_table.id = '' |
|||
|
|||
this.rowDrop(); |
|||
|
|||
}, |
|||
|
|||
mounted() { |
|||
//获取初始数据(单位、适用性别) |
|||
this.dictInit(); |
|||
}, |
|||
methods: { |
|||
moment, |
|||
checkPagePriv, |
|||
dddw, |
|||
deepCopy, |
|||
|
|||
// 确定排序 |
|||
btnSort() { |
|||
const result = []; |
|||
this.commonTables.forEach((item, index) => { |
|||
result.push({ id: item.id, displayOrder: index }); |
|||
}); |
|||
putapi("/api/app/customerorggroup/updatesortmany", { |
|||
itemList: result, |
|||
}).then((res) => { |
|||
console.log("操作成功"); |
|||
this.isDrag = false; |
|||
}); |
|||
}, |
|||
|
|||
//初始化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.commonTables.splice(oldIndex, 1)[0]; |
|||
// _this.commonTables.splice(newIndex, 0, currRow); |
|||
// _this.commonTables.map((item, index) => { |
|||
// if (index == newIndex && index == oldIndex) { |
|||
// } else if (index == oldIndex) { |
|||
// } else if (index == newIndex) { |
|||
// } |
|||
// }); |
|||
// console.log(_this.commonTables.map((item) => item.displayOrder)); |
|||
// }, |
|||
// }); |
|||
// }); |
|||
|
|||
this.$nextTick(() => { |
|||
const el = document.querySelector(".el-table__body-wrapper tbody"); |
|||
//console.log('el0',el) |
|||
const that = this; |
|||
Sortable.create(el, { |
|||
handle: ".move", |
|||
animation: 300, |
|||
//拖拽结束 |
|||
onEnd({ newIndex, oldIndex }) { |
|||
that.isDrag = true; |
|||
const currRow = that.commonTables.splice(oldIndex, 1)[0]; |
|||
that.commonTables.splice(newIndex, 0, currRow); |
|||
console.log("el", el); |
|||
}, |
|||
}); |
|||
}); |
|||
}, |
|||
|
|||
//置底 |
|||
btnSetBottom() { |
|||
if (!this.dataTransOpts.tableS.common_table.id) { |
|||
this.$message.warning("请选择操作的数据"); |
|||
return; |
|||
} |
|||
let lfind = arrayExistObj(this.commonTables, "id", this.dataTransOpts.tableS.common_table.id); |
|||
let currentRow = {}; |
|||
|
|||
putapi( |
|||
`/api/app/customerorggroup/updatemanysort?id=${this.dataTransOpts.tableS.common_table.id}&SortType=2` |
|||
).then((res) => { |
|||
console.log("操作成功"); |
|||
currentRow = this.commonTables.splice(lfind, 1)[0]; //删除并赋值 |
|||
this.commonTables.push(currentRow); |
|||
this.$refs["commonTables"].setCurrentRow(currentRow); |
|||
}); |
|||
}, |
|||
|
|||
//置顶 |
|||
btnSetTop() { |
|||
if (!this.dataTransOpts.tableS.common_table.id) { |
|||
this.$message.warning("请选择操作的数据"); |
|||
return; |
|||
} |
|||
|
|||
let lfind = arrayExistObj(this.commonTables, "id", this.dataTransOpts.tableS.common_table.id); |
|||
let currentRow = {}; |
|||
|
|||
putapi( |
|||
`/api/app/customerorggroup/updatemanysort?id=${this.dataTransOpts.tableS.common_table.id}&SortType=1` |
|||
).then((res) => { |
|||
console.log("操作成功"); |
|||
currentRow = this.commonTables.splice(lfind, 1)[0]; |
|||
this.commonTables.unshift(currentRow); |
|||
this.$refs["commonTables"].setCurrentRow(currentRow); |
|||
}); |
|||
}, |
|||
|
|||
//选中颜色 |
|||
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() { |
|||
//获取单位列表 |
|||
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); |
|||
} |
|||
}); |
|||
|
|||
}, |
|||
|
|||
|
|||
//点击分组 |
|||
rowClick(row) { |
|||
this.dataTransOpts.tableS.common_table.id = row.id |
|||
this.curCommonTable = row; |
|||
}, |
|||
|
|||
// 新增(编辑调用时,传入id值) 弹框 |
|||
btnAdd(id) { |
|||
|
|||
if (!id) this.dataTransOpts.tableS.common_table.id = '' |
|||
|
|||
this.CommonTableEditParams = { |
|||
id, |
|||
commonTableTypeId: this.dataTransOpts.tableS.common_table_type.id, |
|||
} |
|||
|
|||
this.dialogWin.CommonTableEdit = true; |
|||
}, |
|||
|
|||
//编辑弹框 |
|||
btnEdit() { |
|||
if (!this.dataTransOpts.tableS.common_table.id) { |
|||
this.$message.warning("请先选择要操作的记录"); |
|||
return; |
|||
} |
|||
this.btnAdd(this.dataTransOpts.tableS.common_table.id) |
|||
}, |
|||
|
|||
//删除 |
|||
btnDel() { |
|||
if (!this.dataTransOpts.tableS.common_table.id) { |
|||
this.$message.warning("请选择需要操作的数据"); |
|||
return; |
|||
} |
|||
if (this.customerOrgRegister.isComplete.toUpperCase() == "Y") { |
|||
this.$message.warning("该单位体检次数已完成,不允许删除分组"); |
|||
return; |
|||
} |
|||
|
|||
this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", { |
|||
confirmButtonText: "是", |
|||
cancelButtonText: " 否 ", |
|||
type: "warning", |
|||
}) |
|||
.then(() => { |
|||
return deletapi(`/api/app/customer-org-group/${this.dataTransOpts.tableS.common_table.id}`); |
|||
}) |
|||
.then((res) => { |
|||
if (res.code != -1) { |
|||
console.log("删除成功"); |
|||
let lfind = arrayExistObj(this.commonTables, "id", this.dataTransOpts.tableS.common_table.id); |
|||
if (lfind > -1) this.commonTables.splice(lfind, 1); |
|||
this.dataTransOpts.tableS.common_table.id = '' |
|||
setTimeout(() => { |
|||
this.dataTransOpts.refresh.common_table_detail.M++ |
|||
}, 20); |
|||
} |
|||
}) |
|||
.catch((err) => { |
|||
if (err == "cancel") { |
|||
console.log("已取消删除"); |
|||
// this.$message.info("已取消删除"); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
// 关闭 分组 新增/编辑 |
|||
close_dialogWinCommonTableEdit() { |
|||
let id = this.dataTransOpts.tableS.common_table.id |
|||
if (id) { |
|||
// 点编辑 或 新增有提交 |
|||
getapi(`/api/app/customer-org-group/${id}`) |
|||
.then(res => { |
|||
if (res.code != -1) { |
|||
let lfind = -1 |
|||
lfind = arrayExistObj(this.commonTables, 'id', id) |
|||
if (lfind > -1) { |
|||
objCopy(res.data, this.commonTables[lfind]) |
|||
} else { |
|||
lfind = this.commonTables.length |
|||
this.commonTables.push(res.data) |
|||
} |
|||
|
|||
// 选中当前操作的列 |
|||
this.$refs["commonTables"].setCurrentRow(); //清除选择 |
|||
this.$refs["commonTables"].setCurrentRow(this.commonTables[lfind]); |
|||
|
|||
// 更新 common_table_detail 参数 |
|||
this.curCommonTable = deepCopy(res.data); |
|||
this.curCommonTable.isComplete = this.customerOrgRegister.isComplete; |
|||
} |
|||
}) |
|||
} else { |
|||
// 点 新增 但未提交 |
|||
this.dataTransOpts.tableS.common_table.id = this.curCommonTable.id || '' |
|||
} |
|||
}, |
|||
}, |
|||
|
|||
//监听事件 |
|||
watch: { |
|||
// 刷新公共表数据 |
|||
"dataTransOpts.refresh.common_table.M":{ |
|||
// immediate:true, |
|||
handler(newVal, oldVal) { |
|||
console.log(`watch 公共表分类 newVal:${newVal} oldVal:${oldVal} commonTableTypeId: ${this.dataTransOpts.tableS.common_table_type.id}`); |
|||
if(newVal != oldVal) this.close_dialogWinCommonTableEdit(); |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped> |
|||
@import "../../assets/css/global_button.css"; |
|||
@import "../../assets/css/global_dialog.css"; |
|||
@import "../../assets/css/global_table.css"; |
|||
@import "../../assets/css/global_form.css"; |
|||
@import "../../assets/css/global_input.css"; |
|||
@import "../../assets/css/global.css"; |
|||
|
|||
.btnClass { |
|||
width: 100px; |
|||
margin-bottom: 5px; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,304 @@ |
|||
<template> |
|||
<div> |
|||
<el-form :model="form" label-width="80px" :rules="rules" ref="form"> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<el-form-item prop="commonTableTypeId" label="分类"> |
|||
<el-select v-model="form.commonTableTypeId" placeholder="请选择" size="small"> |
|||
<el-option v-for="item in dict.commonTableType" :key="item.id" :label="item.displayName" :value="item.id"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<el-form-item prop="dataCode" label="dataCode"> |
|||
<el-input v-model="form.dataCode" size="small" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<el-form-item prop="displayName" label="分组名称"> |
|||
<el-input v-model="form.displayName" size="small" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<div style="display: flex;margin-top: 15px;justify-content:space-between;"> |
|||
<div></div> |
|||
<div style="display: flex;"> |
|||
<el-button class="commonbutton" @click="dialogWin.CommonTableEdit = false">关闭</el-button> |
|||
<!-- |
|||
<el-button type="success" @click="computePrice">同比折算组合项目价格</el-button> |
|||
--> |
|||
<el-button class="commonbutton" type="primary" @click="onSubmit('form')">确定</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import moment from "moment"; |
|||
|
|||
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|||
import { mapState } from "vuex"; |
|||
import { |
|||
dddw, |
|||
deepCopy, |
|||
objCopy, |
|||
arrayExistObj, |
|||
} from "../../utlis/proFunc"; |
|||
|
|||
import CustomerOrgGroupAsbitem from "../../components/customerOrg/customerOrgGroupAsbitem.vue"; |
|||
|
|||
export default { |
|||
components: { |
|||
CustomerOrgGroupAsbitem, |
|||
}, |
|||
props: ["params"], |
|||
data() { |
|||
return { |
|||
form: { |
|||
id: "", |
|||
commonTableTypeId: null, //所属体检次数 |
|||
displayName: "", |
|||
dataCode: "" |
|||
}, |
|||
formInit: {}, //表单初始值 |
|||
rules: { |
|||
commonTableTypeId: [{ required: true, message: "请填写分类名称", trigger: "blur" }], |
|||
dataCode: [{ required: true, message: "请填写dataCode", trigger: "blur" }], |
|||
displayName: [{ required: true, message: "请填写分组名称", trigger: "blur" }], |
|||
}, |
|||
}; |
|||
}, |
|||
computed: { |
|||
...mapState(["dict", "dialogWin", "dataTransOpts"]), |
|||
}, |
|||
created() { |
|||
this.form.id = this.params.id |
|||
this.form.commonTableTypeId = this.params.commonTableTypeId |
|||
}, |
|||
mounted() { |
|||
// 获取初始数据(单位、适用性别) |
|||
this.dictInit(); |
|||
this.getFormData(this.dataTransOpts.tableS.customer_org_group.id); |
|||
}, |
|||
methods: { |
|||
moment, dddw, deepCopy, |
|||
|
|||
// 获取初始数据 |
|||
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; |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
// 生成表单数据 |
|||
getFormData(id) { |
|||
if (id) { |
|||
getapi(`/api/app/customer-org-group/${id}`) |
|||
.then(res => { |
|||
if (res.code != -1) { |
|||
this.form = deepCopy(res.data) |
|||
} |
|||
}) |
|||
} else { |
|||
console.log('this.formInit',this.formInit) |
|||
this.form = deepCopy(this.formInit) |
|||
this.form.id = this.params.id |
|||
this.form.commonTableTypeId = this.params.commonTableTypeId |
|||
} |
|||
}, |
|||
|
|||
|
|||
onSubmit(formName) { |
|||
this.$refs[formName].validate((valid, fields) => { |
|||
if (!valid) { |
|||
this.$message.warning(fields[Object.keys(fields)[0]][0].message); |
|||
return false; |
|||
} |
|||
|
|||
if (!this.form.id && !this.form.customerOrgRegisterId) { |
|||
this.$message.warning("请选择单位体检次数!"); |
|||
return false; |
|||
} |
|||
|
|||
let body = deepCopy(this.form); |
|||
delete body.id; |
|||
delete body.customerOrgId; |
|||
delete body.isComplete; |
|||
|
|||
if (this.form.id) { |
|||
let customerOrgGroupId = this.form.id; |
|||
|
|||
|
|||
// 合并事务更新明细金额 |
|||
putapi(`/api/app/customer-org-group/${this.form.id}`, body) |
|||
.then((res) => { |
|||
// console.log(res) |
|||
if (res.code != -1) { |
|||
console.log("保存分组成功!"); |
|||
this.dataTransOpts.refresh.customer_org_group_detail.M |
|||
} |
|||
}) |
|||
|
|||
} else { |
|||
//新增 |
|||
postapi("/api/customerorggroup/createcustomerorggroupincustomerorgregister", body) |
|||
.then(res => { |
|||
if (res.code != -1) { |
|||
console.log("操作成功!"); |
|||
this.dataTransOpts.tableS.customer_org_group.id = res.data.id |
|||
this.dialogWin.CommonTableEdit = false; |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
// |
|||
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); |
|||
} |
|||
} |
|||
}) |
|||
.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); |
|||
// } |
|||
// }, |
|||
|
|||
// 体检分组ID未切换换时 也可以强制刷新数据 |
|||
"dataTransOpts.refresh.customer_org_group.S": { |
|||
// immediate: true, |
|||
handler(newVal, oldVal) { |
|||
console.log(`watch 体检分组 newVal:${newVal} oldVal:${oldVal} customerOrgGroupId: ${this.dataTransOpts.tableS.customer_org_group.id}`); |
|||
this.getFormData(this.dataTransOpts.tableS.customer_org_group.id); |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped> |
|||
@import "../../assets/css/global_button.css"; |
|||
@import "../../assets/css/global_dialog.css"; |
|||
@import "../../assets/css/global_table.css"; |
|||
@import "../../assets/css/global_form.css"; |
|||
@import "../../assets/css/global_input.css"; |
|||
@import "../../assets/css/global.css"; |
|||
|
|||
.btnClass { |
|||
width: 100px; |
|||
margin-bottom: 5px; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,294 @@ |
|||
<template> |
|||
<div> |
|||
<el-form :model="form" label-width="80px" :rules="rules" ref="form"> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<el-form-item prop="id" label="编号"> |
|||
<el-input v-model="form.id" size="small" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<el-form-item prop="displayName" label="分类名称"> |
|||
<el-input v-model="form.displayName" size="small" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<div style="display: flex;margin-top: 15px;justify-content:space-between;"> |
|||
<div></div> |
|||
<div style="display: flex;"> |
|||
<el-button class="commonbutton" @click="dialogWin.CommonTableTypeEdit = false">关闭</el-button> |
|||
<!-- |
|||
<el-button type="success" @click="computePrice">同比折算组合项目价格</el-button> |
|||
--> |
|||
<el-button class="commonbutton" type="primary" @click="onSubmit('form')">确定</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import moment from "moment"; |
|||
|
|||
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|||
import { mapState } from "vuex"; |
|||
import { |
|||
dddw, |
|||
deepCopy, |
|||
objCopy, |
|||
arrayExistObj, |
|||
} from "../../utlis/proFunc"; |
|||
|
|||
import CustomerOrgGroupAsbitem from "../../components/customerOrg/customerOrgGroupAsbitem.vue"; |
|||
|
|||
export default { |
|||
components: { |
|||
CustomerOrgGroupAsbitem, |
|||
}, |
|||
props: ["params"], |
|||
data() { |
|||
return { |
|||
form: { |
|||
id: "", |
|||
displayName: "", |
|||
}, |
|||
formOri: {}, //用于对比分析哪些信息更改了(主要是价格) |
|||
formInit: {}, //表单初始值 |
|||
rules: { |
|||
id: [{ required: true, message: "请填写编号", trigger: "blur" }], |
|||
displayName: [{ required: true, message: "请填写分类名称", trigger: "blur" }], |
|||
}, |
|||
}; |
|||
}, |
|||
computed: { |
|||
...mapState(["dict", "dialogWin", "dataTransOpts"]), |
|||
}, |
|||
created() { |
|||
this.formInit = deepCopy(this.form); |
|||
this.form.customerOrgId = this.params.customerOrgId |
|||
this.form.customerOrgRegisterId = this.params.customerOrgRegisterId |
|||
}, |
|||
mounted() { |
|||
// 获取初始数据(单位、适用性别) |
|||
this.dictInit(); |
|||
this.getFormData(this.dataTransOpts.tableS.customer_org_group.id); |
|||
}, |
|||
methods: { |
|||
moment, dddw, deepCopy, |
|||
|
|||
// 获取初始数据 |
|||
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; |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
// 生成表单数据 |
|||
getFormData(id) { |
|||
if (id) { |
|||
getapi(`/api/app/customer-org-group/${id}`) |
|||
.then(res => { |
|||
if (res.code != -1) { |
|||
this.formOri = deepCopy(res.data) |
|||
this.form = deepCopy(res.data) |
|||
} |
|||
}) |
|||
} else { |
|||
console.log('this.formInit',this.formInit) |
|||
this.form = deepCopy(this.formInit) |
|||
this.form.customerOrgId = this.params.customerOrgId |
|||
this.form.customerOrgRegisterId = this.params.customerOrgRegisterId |
|||
} |
|||
}, |
|||
|
|||
|
|||
onSubmit(formName) { |
|||
this.$refs[formName].validate((valid, fields) => { |
|||
if (!valid) { |
|||
this.$message.warning(fields[Object.keys(fields)[0]][0].message); |
|||
return false; |
|||
} |
|||
|
|||
if (!this.form.id && !this.form.customerOrgRegisterId) { |
|||
this.$message.warning("请选择单位体检次数!"); |
|||
return false; |
|||
} |
|||
|
|||
let body = deepCopy(this.form); |
|||
delete body.id; |
|||
delete body.customerOrgId; |
|||
delete body.isComplete; |
|||
|
|||
if (this.form.id) { |
|||
let customerOrgGroupId = this.form.id; |
|||
let customerOrgGroupAsbitems = []; //分组包含的套餐 |
|||
|
|||
// 合并事务更新明细金额 |
|||
putapi(`/api/app/customer-org-group/${this.form.id}`, body) |
|||
.then((res) => { |
|||
// console.log(res) |
|||
if (res.code != -1) { |
|||
console.log("保存分组成功!"); |
|||
this.dataTransOpts.refresh.customer_org_group_detail.M |
|||
} |
|||
}) |
|||
|
|||
} else { |
|||
//新增 |
|||
postapi("/api/customerorggroup/createcustomerorggroupincustomerorgregister", body) |
|||
.then(res => { |
|||
if (res.code != -1) { |
|||
console.log("操作成功!"); |
|||
this.dataTransOpts.tableS.customer_org_group.id = res.data.id |
|||
this.dialogWin.CommonTableTypeEdit = false; |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
// |
|||
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); |
|||
} |
|||
} |
|||
}) |
|||
.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); |
|||
// } |
|||
// }, |
|||
|
|||
// 体检分组ID未切换换时 也可以强制刷新数据 |
|||
"dataTransOpts.refresh.customer_org_group.S": { |
|||
// immediate: true, |
|||
handler(newVal, oldVal) { |
|||
console.log(`watch 体检分组 newVal:${newVal} oldVal:${oldVal} customerOrgGroupId: ${this.dataTransOpts.tableS.customer_org_group.id}`); |
|||
this.getFormData(this.dataTransOpts.tableS.customer_org_group.id); |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped> |
|||
@import "../../assets/css/global_button.css"; |
|||
@import "../../assets/css/global_dialog.css"; |
|||
@import "../../assets/css/global_table.css"; |
|||
@import "../../assets/css/global_form.css"; |
|||
@import "../../assets/css/global_input.css"; |
|||
@import "../../assets/css/global.css"; |
|||
|
|||
.btnClass { |
|||
width: 100px; |
|||
margin-bottom: 5px; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,464 @@ |
|||
<template> |
|||
<div> |
|||
<div> |
|||
<div class="contenttitle"> |
|||
基础资料 /<span class="contenttitleBold">公共表</span> |
|||
</div> |
|||
<!--公共表分类信息--> |
|||
<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-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="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 label="修改时间" min-width="150" align="center"> |
|||
<template slot-scope="scope"> |
|||
{{ scope.row.lastModificationTime ? moment(scope.row.lastModificationTime).format("yyyy-MM-DD HH:mm:ss") : "" }} |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="操作" align="center"> |
|||
<template> |
|||
<el-tag class="move" style=" |
|||
cursor: move; |
|||
background-color: rgb(245, 245, 245); |
|||
border: none; |
|||
" draggable="true"> |
|||
<i class="el-icon-d-caret" style="width: 1rem; height: 1rem; color: rgb(113, 113, 113)"></i> |
|||
</el-tag> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
<!--按钮--> |
|||
<div style="display: block; margin-left: 5px"> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="commonbutton" @click="btnAdd('')">新增</el-button> |
|||
</div> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="commonbutton" @click="btnEdit">编辑</el-button> |
|||
</div> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="deleteButton" @click="btnDel">删除</el-button> |
|||
</div> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="commonbutton" @click="btnSetTop">置顶</el-button> |
|||
</div> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="commonbutton" @click="btnSetBottom">置底</el-button> |
|||
</div> |
|||
<div style="margin-top: 5px"> |
|||
<el-button class="commonbutton" @click="btnSort" :disabled="!isDrag">保存排序</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!--分组项目信息 --> |
|||
<div> |
|||
<CommonTable :commonTableType="curCommonTableType" /> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 新增或者编辑弹框 --> |
|||
<el-dialog :title="dataTransOpts.tableS.common_table_type.id ? '编辑' : '新增'" :close-on-click-modal="false" |
|||
:visible.sync="dialogWin.CommonTableTypeEdit" width="600px" @close="close_dialogWinCommonTableTypeEdit"> |
|||
<CommonTableTypeEdit :params="CommonTableTypeEditParams" /> |
|||
</el-dialog> |
|||
<!-- --> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import moment from "moment"; |
|||
import Sortable from "sortablejs"; |
|||
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|||
import { mapState } from "vuex"; |
|||
import { |
|||
getPagePriv, |
|||
checkPagePriv, |
|||
dddw, |
|||
deepCopy, |
|||
objCopy, |
|||
arrayExistObj, |
|||
} from "../../utlis/proFunc"; |
|||
|
|||
import CommonTable from "./CommonTable.vue"; |
|||
import CommonTableTypeEdit from "./CommonTableTypeEdit.vue"; |
|||
|
|||
export default { |
|||
components: { |
|||
CommonTable, CommonTableTypeEdit |
|||
}, |
|||
data() { |
|||
return { |
|||
pagePriv: { |
|||
routeUrlorPageName: "commonTable", //当前页面归属路由或归属页面权限名称 |
|||
privs: [], // 页面权限 |
|||
}, |
|||
commonTableTypes: [], //公共表分类 |
|||
|
|||
|
|||
curCommonTableType: {}, // 当前选中分组 |
|||
CommonTableTypeEditParams: {}, //分组 新增时 用到参数 |
|||
|
|||
isDrag: false, |
|||
|
|||
|
|||
|
|||
|
|||
}; |
|||
}, |
|||
computed: { |
|||
...mapState(["personnelUnit", "window", "dict", "dialogWin", "dataTransOpts"]), |
|||
}, |
|||
created() { |
|||
//获取用户当前页面的权限 |
|||
let userPriv = window.sessionStorage.getItem("userPriv"); |
|||
if (userPriv) |
|||
this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName)); |
|||
|
|||
// 清除当前选中的分组ID |
|||
this.dataTransOpts.tableS.common_table_type.id = '' |
|||
|
|||
this.rowDrop(); |
|||
}, |
|||
mounted() { |
|||
//获取初始数据(单位、适用性别) |
|||
this.dictInit(); |
|||
}, |
|||
methods: { |
|||
moment, |
|||
checkPagePriv, |
|||
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 = []; |
|||
this.commonTableTypes.forEach((item, index) => { |
|||
result.push({ id: item.id, displayOrder: index }); |
|||
}); |
|||
putapi("/api/app/customerorggroup/updatesortmany", { |
|||
itemList: result, |
|||
}).then((res) => { |
|||
console.log("操作成功"); |
|||
this.isDrag = false; |
|||
}); |
|||
}, |
|||
|
|||
//初始化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) |
|||
const that = this; |
|||
Sortable.create(el, { |
|||
handle: ".move", |
|||
animation: 300, |
|||
//拖拽结束 |
|||
onEnd({ newIndex, oldIndex }) { |
|||
that.isDrag = true; |
|||
const currRow = that.commonTableTypes.splice(oldIndex, 1)[0]; |
|||
that.commonTableTypes.splice(newIndex, 0, currRow); |
|||
console.log("el", el); |
|||
}, |
|||
}); |
|||
}); |
|||
}, |
|||
|
|||
//置底 |
|||
btnSetBottom() { |
|||
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 = {}; |
|||
|
|||
putapi( |
|||
`/api/app/customerorggroup/updatemanysort?id=${this.dataTransOpts.tableS.common_table_type.id}&SortType=2` |
|||
).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 = {}; |
|||
|
|||
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); |
|||
}); |
|||
}, |
|||
|
|||
//选中颜色 |
|||
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() { |
|||
//获取单位列表 |
|||
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) => { |
|||
if (res.code != -1) { |
|||
this.dict.forMaritalStatus = res.data; |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
|
|||
//点击分组 |
|||
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); |
|||
}, |
|||
|
|||
// 新增(编辑调用时,传入id值) 弹框 |
|||
btnAdd(id) { |
|||
if (!id) this.dataTransOpts.tableS.common_table_type.id = '' |
|||
if (!id) this.dataTransOpts.refresh.common_table.M++; //新增则清掉已选组合项目 |
|||
|
|||
|
|||
this.CommonTableTypeEditParams = { |
|||
id |
|||
} |
|||
this.dialogWin.CommonTableTypeEdit = true; |
|||
}, |
|||
|
|||
//编辑弹框 |
|||
btnEdit() { |
|||
if (!this.dataTransOpts.tableS.common_table_type.id) { |
|||
this.$message.warning("请先选择体检分组"); |
|||
return; |
|||
} |
|||
this.btnAdd(this.dataTransOpts.tableS.common_table_type.id) |
|||
}, |
|||
|
|||
//删除 |
|||
btnDel() { |
|||
if (!this.dataTransOpts.tableS.common_table_type.id) { |
|||
this.$message.warning("请选择需要操作的数据"); |
|||
return; |
|||
} |
|||
if (this.customerOrgRegister.isComplete.toUpperCase() == "Y") { |
|||
this.$message.warning("该单位体检次数已完成,不允许删除分组"); |
|||
return; |
|||
} |
|||
|
|||
this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", { |
|||
confirmButtonText: "是", |
|||
cancelButtonText: " 否 ", |
|||
type: "warning", |
|||
}) |
|||
.then(() => { |
|||
return deletapi(`/api/app/customer-org-group/${this.dataTransOpts.tableS.common_table_type.id}`); |
|||
}) |
|||
.then((res) => { |
|||
if (res.code != -1) { |
|||
console.log("删除成功"); |
|||
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); |
|||
} |
|||
}) |
|||
.catch((err) => { |
|||
if (err == "cancel") { |
|||
console.log("已取消删除"); |
|||
// this.$message.info("已取消删除"); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
|
|||
|
|||
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}`) |
|||
.then(res => { |
|||
if (res.code != -1) { |
|||
let lfind = -1 |
|||
lfind = arrayExistObj(this.commonTableTypes, 'id', id) |
|||
if (lfind > -1) { |
|||
objCopy(res.data, this.commonTableTypes[lfind]) |
|||
} else { |
|||
lfind = this.commonTableTypes.length |
|||
this.commonTableTypes.push(res.data) |
|||
} |
|||
|
|||
// 选中当前操作的列 |
|||
this.$refs["commonTableTypes"].setCurrentRow(); //清除选择 |
|||
this.$refs["commonTableTypes"].setCurrentRow(this.commonTableTypes[lfind]); |
|||
|
|||
// 更新 common_table 参数 |
|||
this.curCommonTableType = deepCopy(res.data); |
|||
this.curCommonTableType.isComplete = this.customerOrgRegister.isComplete; |
|||
} |
|||
}) |
|||
} else { |
|||
// 点 新增 但未提交 |
|||
this.dataTransOpts.tableS.common_table_type.id = this.curCommonTableType.id || '' |
|||
} |
|||
|
|||
this.dataTransOpts.refresh.common_table.M++; |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped> |
|||
@import "../../assets/css/global_button.css"; |
|||
@import "../../assets/css/global_dialog.css"; |
|||
@import "../../assets/css/global_table.css"; |
|||
@import "../../assets/css/global_form.css"; |
|||
@import "../../assets/css/global_input.css"; |
|||
@import "../../assets/css/global.css"; |
|||
|
|||
.btnClass { |
|||
width: 100px; |
|||
margin-bottom: 5px; |
|||
} |
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue