10 changed files with 1181 additions and 510 deletions
-
2src/assets/css/global_button.css
-
6src/assets/css/global_table.css
-
1src/components/customerOrg/ContactPerson.vue
-
624src/components/customerOrg/customerOrgGroupAsbitem.vue
-
483src/components/customerOrg/customerOrgGroupList.vue
-
3src/components/patientRegister/PatientRegisterItem.vue
-
16src/components/report/CusOrgOCX.vue
-
2src/views/Home.vue
-
550src/views/customerOrg/customerOrgGroup.vue
-
4src/views/customerOrg/patientRegister.vue
@ -0,0 +1,624 @@ |
|||
<template> |
|||
<div style="display: flex; margin-top:5px;"> |
|||
<div :style="'display: flex;width:' + (window.pageWidth - 45 - 110) + 'px;'"> |
|||
<!--未选组合项目--> |
|||
<div style="display: block; width:230px;"> |
|||
<div> |
|||
<span>项目类别</span> |
|||
<el-cascader :options="dict.itemTypeTree" v-model="itemTypeIds" style="margin-left: 3px;width:160px;" |
|||
:props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }" :show-all-levels="false" |
|||
clearable filterable @change="getAsbItemByItemType" size="small"> |
|||
</el-cascader> |
|||
</div> |
|||
<div class="box"> |
|||
<el-table :data="dict.asbItem" border size="small" highlight-current-row |
|||
:height="window.pageHeight < 668 ? 200:(window.pageHeight - 110 - 358)" |
|||
@row-dblclick="dbClickChoosedAsb" |
|||
@selection-change="handleSelectionChange" :row-class-name="handleRowClassName" |
|||
@row-click="chooseAsbItem"> |
|||
<!-- |
|||
<el-table-column type="selection" align="center" ></el-table-column> |
|||
--> |
|||
<el-table-column type="index" align="center" min-width="40"/> |
|||
<el-table-column |
|||
label="未选组合项目" min-width="170" |
|||
prop="displayName" align="center" |
|||
></el-table-column> |
|||
</el-table> |
|||
</div> |
|||
</div> |
|||
|
|||
<!--中间操作按钮--> |
|||
<div style="display: block;margin: 40px 10px 0 10px;"> |
|||
<div> |
|||
<el-button class="btnClass" @click="addAbs(asbItemChoosed,'choosed')" >添加 <i class="el-icon-arrow-right"></i></el-button> |
|||
</div> |
|||
<div> |
|||
<el-button class="btnClass" @click="addAbs(asbItemChoosed,'all')">全部添加</el-button> |
|||
</div> |
|||
<div> |
|||
<el-button class="btnClass" |
|||
@click="delAbs(patientRegisterAbsChoosed,'choosed')">移除 <i class="el-icon-arrow-left"></i |
|||
></el-button> |
|||
</div> |
|||
<div> |
|||
<el-button class="btnClass" @click="delAbs(patientRegisterAbsChoosed,'all')">全部移除</el-button> |
|||
</div> |
|||
<div> |
|||
<el-button class="btnClass" |
|||
@click="Onsubmit" |
|||
>保存 |
|||
</el-button> |
|||
</div> |
|||
</div> |
|||
|
|||
<!--已选组合项目--> |
|||
<div :style="'display: block; width:' + (window.pageWidth - 230 - 120 - 45 - 110) + 'px;'"> |
|||
<div style="height:32px;"> |
|||
<span>快速选择</span> |
|||
<el-select v-model="asbItemId" placeholder="快速选择组合项目" size="small" |
|||
filterable clearable remote automatic-dropdown |
|||
:remote-method="remoteMethod" @change="quickChoosedAsb" default-first-option ref="asbItemId" |
|||
style="margin-left: 3px;width:160px;"> |
|||
<el-option v-for="item in quickAsb" :key="item.id" :value="item.id" :label="item.displayName" /> |
|||
</el-select> |
|||
</div> |
|||
<div class="box"> |
|||
<el-table :data="customerOrgGroupAsbitems" border size="small" |
|||
@selection-change="selecteditems" highlight-current-row |
|||
:height="window.pageHeight < 668 ? 200:(window.pageHeight - 110 - 358)" |
|||
:summary-method="getSummaries" |
|||
show-summary :row-class-name="handleRowClassName" @row-dblclick="removeAbs" |
|||
@row-click="removeAsbItem"> |
|||
<!-- |
|||
<el-table-column type="selection"></el-table-column> |
|||
--> |
|||
<el-table-column type="index" min-width="40"/> |
|||
<el-table-column |
|||
label="已选组合项目" |
|||
min-width="120" |
|||
prop="displayName" |
|||
></el-table-column> |
|||
<el-table-column label="标准价格" prop="price" min-width="80" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-input |
|||
disabled |
|||
type="text" |
|||
v-model="scope.row.price" |
|||
/> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="折扣" prop="price" min-width="60" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-input |
|||
@change="discount(scope.$index)" |
|||
type="text" |
|||
v-model="scope.row.discount" |
|||
/> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="价格" prop="price" min-width="80" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-input |
|||
@input="changingprices(scope.row.price)" |
|||
type="text" |
|||
v-model="scope.row.price" |
|||
/> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!--批量操作按钮(复制套餐与分组)--> |
|||
<div style="display: block;margin-left: 10px;"> |
|||
<div style="margin-top: 50px;"> |
|||
<el-button class="btnClass">复制分组</el-button> |
|||
</div> |
|||
<div> |
|||
<el-button class="btnClass">复制套餐</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import { getapi, postapi } from "@/api/api"; |
|||
import { mapState } from "vuex"; |
|||
import { arrayExistObj, tcdate, arrayFilter, arrayReduce, deepCopy } from "../../utlis/proFunc"; |
|||
|
|||
export default { |
|||
props:['customerOrgGroup'], |
|||
data() { |
|||
return { |
|||
customerOrgGroupAsbitems:[], //分组包含组合项目 |
|||
itemTypeIds:[], //项目类别 |
|||
asbItemId:'', //当前快速选到的给合项目ID |
|||
quickAsb:[], //过滤显示的组合项目 |
|||
|
|||
asbItemChoosed: [], //勾选的 未选组合项目 |
|||
startPoint:-1, |
|||
|
|||
PstartPoint:-1, |
|||
|
|||
saveornot: true, //保存按钮 |
|||
selecteddata: [], //已选数据 |
|||
unselecteddata: [], //未选数据 |
|||
unselecteddata: [], //右边勾选中 |
|||
rightselctedata: [], //右侧已选 |
|||
options: [], |
|||
value: "", |
|||
dialogVisible: false, |
|||
copyGroupdialogVisible: false, |
|||
packagelist: [], |
|||
tabledata: [], |
|||
temporaryselection: [], //已选组合项目table |
|||
copegroupdata: [], //复制分组 |
|||
addrulst: [], //添加保存的Id |
|||
price: "", //价格 |
|||
title: 1, |
|||
}; |
|||
}, |
|||
computed: { |
|||
...mapState(["window","dict","customerOrg"]), |
|||
}, |
|||
|
|||
created() { |
|||
this.dictInit() |
|||
}, |
|||
|
|||
methods: { |
|||
//初始数据 |
|||
dictInit(){ |
|||
//体检类别 树结构 |
|||
getapi("/api/app/item-type/by-code-all").then((res) => { |
|||
if (res.code != -1) { |
|||
this.dict.itemTypeTree = res.data; |
|||
tcdate(this.dict.itemTypeTree); |
|||
} |
|||
}); |
|||
|
|||
//获取所有组合项目 |
|||
getapi("/api/app/asbitem/in-filter?Filter").then((res) => { |
|||
if (res.code != -1) { |
|||
this.dict.asbItemAll = res.data.items; |
|||
this.dict.asbItemAll.forEach(e => { |
|||
e.choosed = false |
|||
}) |
|||
this.dict.asbItem = deepCopy(this.dict.asbItemAll); |
|||
this.dict.asbItemQuick = deepCopy(res.data.items); |
|||
} |
|||
}); |
|||
|
|||
}, |
|||
|
|||
handleRowClassName({ row, rowIndex }) { |
|||
// highLightBg 为 'selected'的高亮 |
|||
//console.log(rowIndex, row) |
|||
//return row.highLightBg == 'selected' ? 'high-light-bg' : ''; |
|||
if (row.choosed) { |
|||
return 'current-row'; |
|||
} else { |
|||
return ''; |
|||
} |
|||
|
|||
}, |
|||
|
|||
//项目类别过滤 组合项目,未过滤已选择的组合项目 |
|||
getAsbItemByItemTypeAll() { |
|||
//console.log('getAsbItemByItemType', typeof this.itemTypeIds, this.itemTypeIds) |
|||
let lv = ""; |
|||
if (typeof this.itemTypeIds === "object") { |
|||
lv = this.itemTypeIds[this.itemTypeIds.length - 1]; |
|||
} |
|||
|
|||
if (lv) { |
|||
this.dict.asbItem = arrayFilter(this.dict.asbItemAll, "itemTypeId", lv); |
|||
} else { |
|||
this.dict.asbItem = deepCopy(this.dict.asbItemAll); |
|||
} |
|||
//console.log('lv,this.dict.asbItem', lv, this.dict.asbItem) |
|||
this.dict.asbItemQuick = deepCopy(this.dict.asbItemAll); |
|||
|
|||
}, |
|||
|
|||
//按项目类别显示组合项目,并过滤已选择的组合项目 |
|||
getAsbItemByItemType() { |
|||
this.getAsbItemByItemTypeAll() |
|||
//刷新显示 未选组合项目 |
|||
arrayReduce(this.dict.asbItem, [...this.customerOrgGroupAsbitems], "id=asbitemId"); |
|||
arrayReduce(this.dict.asbItemQuick, [...this.customerOrgGroupAsbitems], "id=asbitemId"); |
|||
}, |
|||
|
|||
//快速选择组合项目时,调整可按拼间简码及简称查找 |
|||
remoteMethod(keyWords) { |
|||
//console.log('remoteMethod',this.dict.asbItemQuick) |
|||
if (keyWords) { |
|||
this.quickAsb = []; |
|||
this.dict.asbItemQuick.forEach(item => { |
|||
if (item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1 |
|||
|| item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1 |
|||
|| item.shortName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1) { |
|||
this.quickAsb.push(item); |
|||
} |
|||
}); |
|||
} else { |
|||
this.quickAsb = [...this.dict.asbItemQuick]; |
|||
} |
|||
}, |
|||
|
|||
// 添加组合项目 |
|||
///api/app/register-asbitem/many/3fa85f64-5717-4562-b3fc-2c963f66afa6' |
|||
async addAbs(asbItemChoosed,oprType) { |
|||
if(!this.customerOrgGroup.id){ |
|||
this.$message.warning("请先选中单位分组") |
|||
return |
|||
} |
|||
|
|||
let checked = true |
|||
let lfind = -1 |
|||
|
|||
//勾选时不需要此操作 start |
|||
if(oprType && oprType == 'all'){ |
|||
asbItemChoosed = deepCopy(this.dict.asbItem) |
|||
}else if(oprType && oprType == 'choosed'){ |
|||
asbItemChoosed = [] |
|||
this.dict.asbItem.forEach(e =>{ |
|||
if(e.choosed){ |
|||
asbItemChoosed.push(e) |
|||
e.choosed = false |
|||
} |
|||
}) |
|||
} |
|||
//勾选时不需要此操作 end |
|||
|
|||
if (asbItemChoosed.length < 1) { |
|||
this.$message.warning("请选择要添加的组合项目") |
|||
return |
|||
} |
|||
|
|||
//性别、年龄判断 |
|||
// "displayName": "身高体重", |
|||
// "shortName": "哈f哈", |
|||
// "forSexId": "F", |
|||
// "itemTypeId": "3a0b16de-75b9-c910-c61b-844709a88940", |
|||
// "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 (asbItemChoosed[i].forSexId != this.customerOrgGroup.sexId) { |
|||
this.$message.warning(`所选项目:${asbItemChoosed[i].displayName},不适合当前人员性别`) |
|||
checked = false |
|||
break |
|||
} |
|||
} |
|||
//console.log(222,checked) |
|||
if (!checked) return |
|||
|
|||
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, |
|||
} |
|||
|
|||
this.customerOrgGroupAsbitems.push(pojo) |
|||
//this.customerOrgGroupAsbitems.push({ ...pojo, asbitemName: asbItemChoosed[i].displayName }) |
|||
|
|||
lfind = arrayExistObj(this.dict.asbItem, 'id', asbItemChoosed[i].id) |
|||
if (lfind > -1) this.dict.asbItem.splice(lfind, 1) |
|||
|
|||
lfind = arrayExistObj(this.dict.asbItemQuick, 'id', asbItemChoosed[i].id) |
|||
if (lfind > -1) this.dict.asbItemQuick.splice(lfind, 1) |
|||
|
|||
} |
|||
|
|||
|
|||
}, |
|||
|
|||
//双击选择组合项目 |
|||
dbClickChoosedAsb(row) { |
|||
this.addAbs([row]); |
|||
}, |
|||
//快速选择组合项目 |
|||
quickChoosedAsb(v) { |
|||
//远程查询时,设置了 value-key 也不管用,只能取到value console.log('quickChoosedAsb',v) |
|||
let lfind = -1 |
|||
if (v) { |
|||
lfind = arrayExistObj(this.dict.asbItemQuick, 'id', v) |
|||
if (lfind > -1) { |
|||
this.addAbs([this.dict.asbItemQuick[lfind]]) |
|||
} |
|||
} |
|||
|
|||
}, |
|||
|
|||
//选择 未选的组合项目 |
|||
chooseAsbItem(row){ |
|||
this.dict.asbItem.forEach((e,index) => { |
|||
e.index = index; |
|||
return e |
|||
}); |
|||
// 按住了shift键 |
|||
if (this.window.shift) { |
|||
//清除所有选择 |
|||
this.dict.asbItem.forEach(e => { |
|||
e.choosed = false; |
|||
return e |
|||
}); |
|||
|
|||
if (this.startPoint == - 1) { |
|||
this.dict.asbItem[row.index].choosed = true; |
|||
this.startPoint = row.index; |
|||
return |
|||
} |
|||
|
|||
if (this.startPoint > row.index) { |
|||
for (let i = row.index; i <= this.startPoint; i++) { |
|||
this.dict.asbItem[i].choosed = true |
|||
} |
|||
} else if (this.startPoint <= row.index) { |
|||
for (let i = this.startPoint; i <= row.index; i++) { |
|||
this.dict.asbItem[i].choosed = true |
|||
} |
|||
} |
|||
return |
|||
} |
|||
|
|||
// 按住了ctrl 键 |
|||
if (this.window.ctrl) { |
|||
console.log('this.window.ctrl',this.window.ctrl,this.dict.asbItem) |
|||
this.dict.asbItem[row.index].choosed = true; |
|||
this.startPoint = row.index; |
|||
return |
|||
} |
|||
|
|||
// 未按住了ctrl 、shift 键 |
|||
//清除所有选择 |
|||
//console.log('清除所有选择') |
|||
this.dict.asbItem.forEach(e => { |
|||
e.choosed = false; |
|||
return e |
|||
}); |
|||
this.dict.asbItem[row.index].choosed = true; |
|||
this.startPoint = row.index; |
|||
|
|||
}, |
|||
|
|||
//删除 人员已选中的组合项目 |
|||
///api/app/register-asbitem/many?RegisterAsbitemIds=3fa85f64-5717-4562-b3fc-2c963f66afa6 |
|||
delAbs(absForDel,oprType) { |
|||
let body = {} |
|||
let registerAsbitemIds = [] |
|||
let chargeComplete = '' |
|||
let lfind = -1 |
|||
|
|||
//勾选时不需要此操作 start |
|||
if(oprType && oprType == 'all'){ |
|||
absForDel = deepCopy(this.customerOrgGroupAsbitems) |
|||
}else if(oprType && oprType == 'choosed'){ |
|||
absForDel = [] |
|||
this.customerOrgGroupAsbitems.forEach(e =>{ |
|||
if(e.choosed){ |
|||
absForDel.push(deepCopy(e)) |
|||
e.choosed = false |
|||
} |
|||
}) |
|||
} |
|||
//勾选时不需要此操作 end |
|||
|
|||
if (absForDel.length < 1) { |
|||
this.$message.warning("请选择要移除的组合项目") |
|||
return |
|||
} |
|||
|
|||
for (let i = 0; i < absForDel.length; i++) { |
|||
|
|||
lfind = arrayExistObj(this.customerOrgGroupAsbitems, 'asbitemId', absForDel[i].asbitemId) |
|||
if (lfind > -1) this.customerOrgGroupAsbitems.splice(lfind, 1) |
|||
|
|||
absForDel.splice(i, 1) |
|||
i-- |
|||
continue |
|||
|
|||
} |
|||
|
|||
//刷新 |
|||
this.getAsbItemByItemType() |
|||
|
|||
}, |
|||
|
|||
//双击删除已选项目 |
|||
removeAbs(row) { |
|||
this.delAbs([row]); |
|||
}, |
|||
|
|||
//选择 已选的组合项目 |
|||
removeAsbItem(row){ |
|||
this.customerOrgGroupAsbitems.forEach((e,index) => { |
|||
e.index = index; |
|||
return e |
|||
}); |
|||
// 按住了shift键 |
|||
if (this.window.shift) { |
|||
//清除所有选择 |
|||
this.customerOrgGroupAsbitems.forEach(e => { |
|||
e.choosed = false; |
|||
return e |
|||
}); |
|||
|
|||
if (this.PstartPoint == - 1) { |
|||
this.customerOrgGroupAsbitems[row.index].choosed = true; |
|||
this.PstartPoint = row.index; |
|||
return |
|||
} |
|||
|
|||
if (this.PstartPoint > row.index) { |
|||
for (let i = row.index; i <= this.PstartPoint; i++) { |
|||
this.customerOrgGroupAsbitems[i].choosed = true |
|||
} |
|||
} else if (this.PstartPoint <= row.index) { |
|||
for (let i = this.PstartPoint; i <= row.index; i++) { |
|||
this.customerOrgGroupAsbitems[i].choosed = true |
|||
} |
|||
} |
|||
return |
|||
} |
|||
|
|||
// 按住了ctrl 键 |
|||
if (this.window.ctrl) { |
|||
console.log('this.window.ctrl',this.window.ctrl,this.customerOrgGroupAsbitems) |
|||
this.customerOrgGroupAsbitems[row.index].choosed = true; |
|||
this.PstartPoint = row.index; |
|||
return |
|||
} |
|||
|
|||
// 未按住了ctrl 、shift 键 |
|||
//清除所有选择 |
|||
//console.log('清除所有选择') |
|||
this.customerOrgGroupAsbitems.forEach(e => { |
|||
e.choosed = false; |
|||
return e |
|||
}); |
|||
this.customerOrgGroupAsbitems[row.index].choosed = true; |
|||
this.PstartPoint = row.index; |
|||
|
|||
}, |
|||
|
|||
//合计 |
|||
getSummaries(){ |
|||
|
|||
}, |
|||
|
|||
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); |
|||
}, |
|||
//保存按钮 |
|||
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); |
|||
} |
|||
); |
|||
} |
|||
|
|||
}, |
|||
//移除按钮 |
|||
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, |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
}, |
|||
//右侧勾选按钮 |
|||
selecteditems(val) { |
|||
this.rightselctedata = val; |
|||
console.log(this.rightselctedata); |
|||
}, |
|||
|
|||
|
|||
// 左侧未选 |
|||
handleSelectionChange(val) { |
|||
// this.selecteddata = val; |
|||
this.unselecteddata = val; |
|||
console.log(this.unselecteddata); |
|||
}, |
|||
|
|||
|
|||
//获取当前列列表数据 |
|||
getCustomerOrgGroupAsbitems(customerOrgGroupId) { |
|||
if(customerOrgGroupId){ |
|||
getapi( |
|||
`/api/app/customerorggroupdetail/getcustomerorggroupdetailinasbitem?CustomerOrgGroupId=${customerOrgGroupId}` |
|||
).then((res) => { |
|||
this.customerOrgGroupAsbitems = res.data; |
|||
}); |
|||
}else{ |
|||
this.customerOrgGroupAsbitems = [] |
|||
} |
|||
this.getAsbItemByItemTypeAll() |
|||
}, |
|||
|
|||
}, |
|||
|
|||
//监听事件 |
|||
watch: { |
|||
// |
|||
"customerOrgGroup.id"(newVal, oldVal) { |
|||
console.log("customerOrgGroup.id ",newVal,oldVal); |
|||
if (newVal != oldVal) { |
|||
this.getCustomerOrgGroupAsbitems(newVal); |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped> |
|||
|
|||
.box { |
|||
margin-top: 5px; |
|||
border: 1px solid #000; |
|||
} |
|||
|
|||
.btnClass { |
|||
width:100px; |
|||
margin-bottom: 5px |
|||
} |
|||
|
|||
</style> |
|||
@ -1,483 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<div> |
|||
<div style="display: flex;"> |
|||
<div> |
|||
<span>体检单位:</span> |
|||
<el-select |
|||
v-model="customerOrgId" |
|||
placeholder="请选择体检单位" filterable clearable |
|||
style="margin-left: 10px;" |
|||
@change="changeCustomerOrg" |
|||
size="small" |
|||
> |
|||
<el-option |
|||
v-for="item in customerOrg" |
|||
:key="item.id" |
|||
:label="item.displayName" |
|||
:value="item.id" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</div> |
|||
<div style="margin-left: 20px;"> |
|||
<span>单位体检次数:</span> |
|||
<el-select v-model="customerOrgRegister" placeholder="次数" style="width: 60px;margin-left: 10px;" size="small" |
|||
@change="changeTimes" value-key="id"> |
|||
<el-option v-for="item in customerOrgRegisterList" :key="item.id" :label="item.medicalTimes" |
|||
:value="item" /> |
|||
</el-select> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div style="display: flex;"> |
|||
<el-table |
|||
:data="customerOrgGroups" |
|||
style="margin-top: 2px" |
|||
row-key="id" border |
|||
height="300px" size="small" |
|||
highlight-current-row |
|||
@row-click="rowClick" |
|||
> |
|||
<el-table-column type="index" label="序号" min-width="50" align="center"/> |
|||
<el-table-column prop="displayName" label="名称" min-width="150" /> |
|||
<el-table-column prop="price" label="价格" min-width="60" align="center"/> |
|||
<el-table-column prop="forSexId" label="适用性别" min-width="60" align="center"> |
|||
<template slot-scope="scope"> |
|||
{{ dddw(dict.forSex,'id',scope.row.forSexId,'displayName') }} |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="maritalStatusId" label="适用婚姻状况" min-width="80" align="center"> |
|||
<template slot-scope="scope"> |
|||
{{ dddw(dict.forMaritalStatus,'id',scope.row.maritalStatusId,'displayName') }} |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="creatorName" label="创建者" min-width="60" 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 label="操作"> |
|||
<template> |
|||
<el-tag |
|||
class="move" |
|||
style="cursor: move; margin-left: 15px" |
|||
draggable="true" |
|||
> |
|||
<i class="el-icon-d-caret" style="width: 1rem; height: 1rem"></i> |
|||
</el-tag> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div style="margin-left: 10px;"> |
|||
<div style="margin-top: 10px"> |
|||
<el-button |
|||
type="" |
|||
@click="btnAdd" |
|||
class="commonbutton" |
|||
|
|||
>新增</el-button |
|||
> |
|||
</div> |
|||
<div style="margin-top: 10px"> |
|||
<el-button type="" @click="btnEdit" class="commonbutton" |
|||
>编辑</el-button |
|||
> |
|||
</div> |
|||
<div style="margin-top: 10px"> |
|||
<el-button type="" @click="btnDel" class="commonbutton" |
|||
>删除</el-button |
|||
> |
|||
</div> |
|||
<div style="margin-top: 10px"> |
|||
<el-button type="" @click="topping" class="commonbutton" |
|||
>置顶</el-button |
|||
> |
|||
</div> |
|||
<div style="margin-top: 10px"> |
|||
<el-button type="" @click="bottoming" class="commonbutton" |
|||
>置低</el-button |
|||
> |
|||
</div> |
|||
<div style="margin-top: 10px"> |
|||
<el-button |
|||
type="" |
|||
@click="sortok" |
|||
:disabled="isshow" |
|||
class="commonbutton" |
|||
>确定</el-button |
|||
> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<!-- 新增或者编辑弹框 --> |
|||
<el-dialog |
|||
:title="form.id ? '编辑' : '新增'" |
|||
:visible.sync="dialogVisible" |
|||
width="800px" |
|||
> |
|||
<el-form :model="form" label-width="80px" :rules="rules" ref='form'> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<el-form-item prop="displayName" label="分组名称"> |
|||
<el-input v-model="form.displayName"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="价格"> |
|||
<el-input v-model="form.price"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="适用性别"> |
|||
<el-select v-model="form.forSexId" placeholder="请选择"> |
|||
<el-option |
|||
v-for="item in dict.forSex" |
|||
:key="item.id" |
|||
:label="item.displayName" |
|||
:value="item.id" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="婚姻状况"> |
|||
<el-select |
|||
v-model="form.maritalStatusId" |
|||
placeholder="请选择" |
|||
style="width: 100%" |
|||
> |
|||
<el-option |
|||
v-for="item in dict.forMaritalStatus" |
|||
:key="item.id" |
|||
:label="item.displayName" |
|||
:value="item.id" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="年龄下限"> |
|||
<el-input v-model="form.ageLowerLimit"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="年龄上限"> |
|||
<el-input v-model="form.ageUpperLimit"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="适用职务"> |
|||
<el-input v-model="form.jobPost"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="适用职称"> |
|||
<el-input v-model="form.jobTitle"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="备注"> |
|||
<el-input v-model="form.remark"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<span slot="footer" class="dialog-footer"> |
|||
<el-button @click="dialogVisible = false">取 消</el-button> |
|||
<el-button type="primary" @click="onSubmit('form')">确 定</el-button> |
|||
</span> |
|||
</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 { dddw, deepCopy,objCopy,arrayExistObj } from "../../utlis/proFunc"; |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
customerOrg:[], //体检单位 |
|||
customerOrgGroups:[], //体检单位分组 |
|||
customerOrgId:'', //当前选中的体检单位id |
|||
customerOrgRegisterList:[], //体检次数列表 |
|||
customerOrgRegister:{}, //体检次数 |
|||
|
|||
isshow: true, |
|||
form: { //体检单位分组 |
|||
id:'', |
|||
customerOrgRegisterId:null, //所属体检次数 |
|||
displayName: "", |
|||
price: 0, |
|||
forSexId: "", |
|||
maritalStatusId: "", |
|||
ageLowerLimit: null, |
|||
ageUpperLimit: null, |
|||
jobPost: "", |
|||
jobTitle: "", |
|||
remark: "", |
|||
isMaxMedicalTimes:'N' |
|||
}, |
|||
formInit:{}, |
|||
rules:{ |
|||
displayName:[ |
|||
{ required: true, message: "请填写分组名称", trigger: "blur" }, |
|||
], |
|||
}, |
|||
|
|||
dialogVisible: false, |
|||
tableData: [], |
|||
initTableData: [], |
|||
// tableData: [ |
|||
|
|||
// ], |
|||
}; |
|||
}, |
|||
computed: { |
|||
...mapState(["personnelUnit","window","dict"]), |
|||
}, |
|||
created() { |
|||
this.rowDrop(); |
|||
this.formInit = deepCopy(this.form) |
|||
}, |
|||
mounted() { |
|||
//获取初始数据(单位、适用性别) |
|||
this.dictInit() |
|||
}, |
|||
methods: { |
|||
moment,dddw, |
|||
//确定排序 |
|||
sortok() { |
|||
const result = []; |
|||
this.tableData.forEach((item, index) => { |
|||
// index 从0开始的, 你的displayOrder从大到小排 |
|||
console.log(item.id); |
|||
// const currentDisplayOrder = this.tableData.length -1 |
|||
const currentDisplayOrder = this.initTableData[index].displayOrder; |
|||
if (item.displayOrder != currentDisplayOrder) { |
|||
// 如果它的displayOrder和它当前所在的位置不同代表挪动过位置 |
|||
result.push({ id: item.id, displayOrder: currentDisplayOrder }); |
|||
} |
|||
}); |
|||
putapi("/api/app/customerorggroup/updatesortmany", { |
|||
itemList: result, |
|||
}).then((res) => { |
|||
this.$message.success("操作成功"); |
|||
this.isshow = true; |
|||
}); |
|||
}, |
|||
//初始化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.isshow = 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)); |
|||
}, |
|||
}); |
|||
}); |
|||
}, |
|||
|
|||
//置低 |
|||
bottoming() { |
|||
if (this.form.id == undefined) { |
|||
this.$message.warning("请选择操作的数据"); |
|||
} else { |
|||
putapi( |
|||
`/api/app/customerorggroup/updatemanysort?id=${this.form.id}&SortType=2` |
|||
).then((res) => { |
|||
this.$message.success("操作成功"); |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
//置顶 |
|||
topping() { |
|||
if (this.form.id == undefined) { |
|||
this.$message.warning("请选择操作的数据"); |
|||
} else { |
|||
putapi( |
|||
`/api/app/customerorggroup/updatemanysort?id=${this.form.id}&SortType=1` |
|||
).then((res) => { |
|||
this.$message.success("操作成功"); |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
//获取初始数据 |
|||
dictInit() { |
|||
//获取单位列表 |
|||
getapi("/api/app/customer-org/parent-all").then((res) => { |
|||
this.customerOrg = res.data; |
|||
}); |
|||
|
|||
//获取适用性别 |
|||
getapi("/api/app/for-sex").then((res) => { |
|||
if(res.code != -1){ |
|||
this.dict.forSex = res.data |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
|
|||
|
|||
//获取体检次数下的分组 |
|||
getCustomerOrgGroup(customerOrgRegisterId) { |
|||
this.customerOrgGroups = [] |
|||
getapi(`/api/app/customerorggroup/getlistinfilter?CustomerOrgRegisterId=${customerOrgRegisterId}`).then(res => { |
|||
if (res.code != - 1) { |
|||
this.customerOrgGroups = res.data.items; |
|||
this.customerOrgGroups.forEach(e =>{ |
|||
e.customerOrgRegisterId = customerOrgRegisterId |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
//选择单位 |
|||
changeCustomerOrg(v) { |
|||
getapi(`/api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=${v}`).then( res => { |
|||
if(res.code != -1){ |
|||
this.customerOrgRegisterList = res.data |
|||
if(res.data.length > 0){ |
|||
this.customerOrgRegister = res.data[res.data.length - 1] |
|||
this.getCustomerOrgGroup(this.customerOrgRegister.id) |
|||
}else{ |
|||
this.customerOrgRegister = {} |
|||
this.customerOrgGroups = [] |
|||
} |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
//选择体检次数 |
|||
changeTimes(v){ |
|||
this.getCustomerOrgGroup(v.id) |
|||
}, |
|||
|
|||
//点击分组 |
|||
rowClick(row) { |
|||
objCopy(row,this.form) |
|||
}, |
|||
|
|||
//新增弹框 |
|||
btnAdd() { |
|||
if(!this.customerOrgRegister.id){ |
|||
this.$message.warning("请选择体检次数") |
|||
return |
|||
} |
|||
if(this.customerOrgRegister.isComplete.toUpperCase() == 'Y'){ |
|||
this.$message.warning("该单位的该次体检次数已完成,不能再添加分组!") |
|||
return |
|||
} |
|||
|
|||
this.form = deepCopy(this.formInit) |
|||
this.form.customerOrgRegisterId = this.customerOrgRegister.id |
|||
this.dialogVisible = true; |
|||
}, |
|||
|
|||
//编辑弹框 |
|||
btnEdit() { |
|||
this.dialogVisible = true; |
|||
}, |
|||
|
|||
//删除 |
|||
btnDel() { |
|||
if (!this.form.id) { |
|||
this.$message.warning("请选择需要操作的数据"); |
|||
return |
|||
} |
|||
|
|||
this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", { |
|||
confirmButtonText: "是", |
|||
cancelButtonText: " 否 ", |
|||
type: "warning", |
|||
}).then(() => { |
|||
return deletapi(`/api/app/customer-org-group/${this.form.id}`) |
|||
}).then(res =>{ |
|||
if(res.code != -1){ |
|||
this.$message.success("删除成功"); |
|||
let lfind = arrayExistObj(this.customerOrgGroups,'id',this.form.id) |
|||
if(lfind > -1) this.customerOrgGroups.splice(lfind,1) |
|||
} |
|||
}).catch(err =>{ |
|||
if (err == "cancel") { |
|||
this.$message.info("已取消删除"); |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
|
|||
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.customerOrgRegisterId){ |
|||
this.$message.warning("请选择单位体检次数!"); |
|||
return false |
|||
} |
|||
|
|||
let body = deepCopy(this.form) |
|||
delete body.id |
|||
|
|||
if(this.form.id){ |
|||
//编辑 |
|||
putapi(`/api/app/customer-org-group/${this.form.id}`,body).then(res =>{ |
|||
if(res.code != -1 ){ |
|||
this.$message.success("操作成功!") |
|||
let lfind = arrayExistObj(this.customerOrgGroups,'id',this.form.id) |
|||
if(lfind > -1) objCopy(this.form,this.customerOrgGroups[lfind]) |
|||
this.dialogVisible = false |
|||
} |
|||
}) |
|||
}else{ |
|||
//新增 |
|||
postapi('/api/customerorggroup/createcustomerorggroupincustomerorgregister',body).then(res =>{ |
|||
if(res.code != -1 ){ |
|||
this.$message.success("操作成功!") |
|||
this.form.id = res.data.id |
|||
this.customerOrgGroups.push(res.data) |
|||
this.dialogVisible = false |
|||
} |
|||
}) |
|||
} |
|||
|
|||
}) |
|||
}, |
|||
|
|||
|
|||
}, |
|||
}; |
|||
</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'; |
|||
</style> |
|||
@ -1,41 +1,561 @@ |
|||
<template> |
|||
<div> |
|||
<el-card> |
|||
<div slot="header">单位分组</div> |
|||
<div slot="header">单位分组</div> |
|||
<!--分组信息--> |
|||
<div style="display: flex;"> |
|||
<div :style="'display: block;width:' + (window.pageWidth - 45 - 110) + 'px;'"> |
|||
<div style="display: flex"> |
|||
<div> |
|||
<span>体检单位:</span> |
|||
<el-select |
|||
v-model="customerOrgId" |
|||
placeholder="请选择体检单位" |
|||
filterable |
|||
clearable automatic-dropdown |
|||
style="margin-left: 10px" |
|||
@change="changeCustomerOrg" |
|||
size="small" |
|||
> |
|||
<el-option |
|||
v-for="item in customerOrg" |
|||
:key="item.id" |
|||
:label="item.displayName" |
|||
:value="item.id" |
|||
> |
|||
{{ item.displayName }} |
|||
</el-option> |
|||
</el-select> |
|||
</div> |
|||
<div style="margin-left: 20px"> |
|||
<span>单位体检次数:</span> |
|||
<el-select |
|||
v-model="customerOrgRegister" |
|||
placeholder="次数" |
|||
style="width: 60px; margin-left: 10px" |
|||
size="small" |
|||
@change="changeTimes" |
|||
value-key="id" |
|||
> |
|||
<el-option |
|||
v-for="item in customerOrgRegisterList" |
|||
:key="item.id" |
|||
:label="item.medicalTimes" |
|||
:value="item" |
|||
/> |
|||
</el-select> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<el-table |
|||
:data="customerOrgGroups" |
|||
style="margin-top: 2px" |
|||
row-key="id" |
|||
border |
|||
height="240px" |
|||
size="small" |
|||
highlight-current-row |
|||
@row-click="rowClick" |
|||
> |
|||
<el-table-column |
|||
type="index" |
|||
label="序号" |
|||
min-width="50" |
|||
align="center" |
|||
/> |
|||
<el-table-column prop="displayName" label="名称" min-width="150" /> |
|||
<el-table-column |
|||
prop="price" |
|||
label="价格" |
|||
min-width="60" |
|||
align="center" |
|||
/> |
|||
<el-table-column |
|||
prop="forSexId" |
|||
label="适用性别" |
|||
min-width="60" |
|||
align="center" |
|||
> |
|||
<template slot-scope="scope"> |
|||
{{ dddw(dict.forSex, "id", scope.row.forSexId, "displayName") }} |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="maritalStatusId" |
|||
label="适用婚姻状况" |
|||
min-width="80" |
|||
align="center" |
|||
> |
|||
<template slot-scope="scope"> |
|||
{{ |
|||
dddw( |
|||
dict.forMaritalStatus, |
|||
"id", |
|||
scope.row.maritalStatusId, |
|||
"displayName" |
|||
) |
|||
}} |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="creatorName" |
|||
label="创建者" |
|||
min-width="60" |
|||
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 label="操作"> |
|||
<template> |
|||
<el-tag |
|||
class="move" |
|||
style="cursor: move; margin-left: 15px" |
|||
draggable="true" |
|||
> |
|||
<i class="el-icon-d-caret" style="width: 1rem; height: 1rem"></i> |
|||
</el-tag> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
</div> |
|||
<!--按钮--> |
|||
<div style="display: block;margin-left: 10px;"> |
|||
<div style="margin-top: 30px;"> |
|||
<el-button class="btnClass" @click="btnAdd">新增</el-button> |
|||
</div> |
|||
<div> |
|||
<el-button class="btnClass" @click="btnEdit" >编辑</el-button> |
|||
</div> |
|||
<div> |
|||
<el-button class="btnClass" @click="btnDel" >删除</el-button> |
|||
</div> |
|||
<div> |
|||
<el-button class="btnClass" @click="topping" >置顶</el-button> |
|||
</div> |
|||
<div> |
|||
<el-button class="btnClass" @click="bottoming" >置低</el-button> |
|||
</div> |
|||
<div> |
|||
<el-button class="btnClass" @click="sortok" :disabled="isshow" >确定</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!--分组项目信息--> |
|||
<div> |
|||
<CustomerOrgGroupList /> |
|||
<UnitGroupCategory /> |
|||
<CustomerOrgGroupAsbitem :customerOrgGroup="form" /> |
|||
</div> |
|||
</el-card> |
|||
</el-card> |
|||
|
|||
<!-- 新增或者编辑弹框 --> |
|||
<el-dialog |
|||
:title="form.id ? '编辑' : '新增'" |
|||
:visible.sync="dialogVisible" |
|||
width="800px" |
|||
> |
|||
<el-form :model="form" label-width="80px" :rules="rules" ref="form"> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<el-form-item prop="displayName" label="分组名称"> |
|||
<el-input v-model="form.displayName"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="价格"> |
|||
<el-input v-model="form.price"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="适用性别"> |
|||
<el-select v-model="form.forSexId" placeholder="请选择"> |
|||
<el-option |
|||
v-for="item in dict.forSex" |
|||
:key="item.id" |
|||
:label="item.displayName" |
|||
:value="item.id" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="婚姻状况"> |
|||
<el-select |
|||
v-model="form.maritalStatusId" |
|||
placeholder="请选择" |
|||
style="width: 100%" |
|||
> |
|||
<el-option |
|||
v-for="item in dict.forMaritalStatus" |
|||
:key="item.id" |
|||
:label="item.displayName" |
|||
:value="item.id" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="年龄下限"> |
|||
<el-input v-model="form.ageLowerLimit"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="年龄上限"> |
|||
<el-input v-model="form.ageUpperLimit"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="适用职务"> |
|||
<el-input v-model="form.jobPost"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="适用职称"> |
|||
<el-input v-model="form.jobTitle"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item label="备注"> |
|||
<el-input v-model="form.remark"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<span slot="footer" class="dialog-footer"> |
|||
<el-button @click="dialogVisible = false">取 消</el-button> |
|||
<el-button type="primary" @click="onSubmit('form')">确 定</el-button> |
|||
</span> |
|||
</el-dialog> |
|||
<!-- --> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import CustomerOrgGroupList from "../../components/customerOrg/customerOrgGroupList.vue"; |
|||
import UnitGroupCategory from "../../components/unitGrouping/unitGroupCategory.vue"; |
|||
import moment from "moment"; |
|||
import Sortable from "sortablejs"; |
|||
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|||
import { mapState } from "vuex"; |
|||
import { getapi } from "@/api/api"; |
|||
import { dddw, deepCopy, objCopy, arrayExistObj } from "../../utlis/proFunc"; |
|||
|
|||
import CustomerOrgGroupAsbitem from "../../components/customerOrg/customerOrgGroupAsbitem.vue"; |
|||
|
|||
export default { |
|||
components: { |
|||
CustomerOrgGroupList, |
|||
UnitGroupCategory, |
|||
CustomerOrgGroupAsbitem, |
|||
}, |
|||
data() { |
|||
return { |
|||
options: [], |
|||
value: "", |
|||
customerOrg: [], //体检单位 |
|||
customerOrgGroups: [], //体检单位分组 |
|||
customerOrgId: "", //当前选中的体检单位id |
|||
customerOrgRegisterList: [], //体检次数列表 |
|||
customerOrgRegister: {}, //体检次数 |
|||
|
|||
isshow: true, |
|||
form: { |
|||
//体检单位分组 |
|||
id: "", |
|||
customerOrgRegisterId: null, //所属体检次数 |
|||
displayName: "", |
|||
price: 0, |
|||
forSexId: "", |
|||
maritalStatusId: "", |
|||
ageLowerLimit: null, |
|||
ageUpperLimit: null, |
|||
jobPost: "", |
|||
jobTitle: "", |
|||
remark: "", |
|||
isMaxMedicalTimes: "N", |
|||
}, |
|||
formInit: {}, |
|||
rules: { |
|||
displayName: [ |
|||
{ required: true, message: "请填写分组名称", trigger: "blur" }, |
|||
], |
|||
}, |
|||
|
|||
dialogVisible: false, |
|||
tableData: [], |
|||
initTableData: [], |
|||
// tableData: [ |
|||
|
|||
// ], |
|||
}; |
|||
}, |
|||
computed: { |
|||
...mapState(["personnelUnit"]), |
|||
...mapState(["personnelUnit", "window", "dict"]), |
|||
}, |
|||
created() { |
|||
this.getitemtype(); |
|||
this.rowDrop(); |
|||
this.formInit = deepCopy(this.form); |
|||
}, |
|||
mounted() { |
|||
//获取初始数据(单位、适用性别) |
|||
this.dictInit(); |
|||
}, |
|||
methods: { |
|||
|
|||
moment, |
|||
dddw, |
|||
//确定排序 |
|||
sortok() { |
|||
const result = []; |
|||
this.tableData.forEach((item, index) => { |
|||
// index 从0开始的, 你的displayOrder从大到小排 |
|||
console.log(item.id); |
|||
// const currentDisplayOrder = this.tableData.length -1 |
|||
const currentDisplayOrder = this.initTableData[index].displayOrder; |
|||
if (item.displayOrder != currentDisplayOrder) { |
|||
// 如果它的displayOrder和它当前所在的位置不同代表挪动过位置 |
|||
result.push({ id: item.id, displayOrder: currentDisplayOrder }); |
|||
} |
|||
}); |
|||
putapi("/api/app/customerorggroup/updatesortmany", { |
|||
itemList: result, |
|||
}).then((res) => { |
|||
this.$message.success("操作成功"); |
|||
this.isshow = true; |
|||
}); |
|||
}, |
|||
//初始化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.isshow = 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)); |
|||
}, |
|||
}); |
|||
}); |
|||
}, |
|||
|
|||
//置低 |
|||
bottoming() { |
|||
if (this.form.id == undefined) { |
|||
this.$message.warning("请选择操作的数据"); |
|||
} else { |
|||
putapi( |
|||
`/api/app/customerorggroup/updatemanysort?id=${this.form.id}&SortType=2` |
|||
).then((res) => { |
|||
this.$message.success("操作成功"); |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
//置顶 |
|||
topping() { |
|||
if (this.form.id == undefined) { |
|||
this.$message.warning("请选择操作的数据"); |
|||
} else { |
|||
putapi( |
|||
`/api/app/customerorggroup/updatemanysort?id=${this.form.id}&SortType=1` |
|||
).then((res) => { |
|||
this.$message.success("操作成功"); |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
//获取初始数据 |
|||
dictInit() { |
|||
//获取单位列表 |
|||
getapi("/api/app/customer-org/parent-all").then((res) => { |
|||
if (res.code != -1) { |
|||
this.customerOrg = res.data; |
|||
let lfind = arrayExistObj(this.customerOrg,"id",this.dict.personOrgId); |
|||
if (lfind > -1) this.customerOrg.splice(lfind, 1); |
|||
} |
|||
}); |
|||
|
|||
//获取适用性别 |
|||
getapi("/api/app/for-sex").then((res) => { |
|||
if (res.code != -1) { |
|||
this.dict.forSex = res.data; |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
//获取体检次数下的分组 |
|||
getCustomerOrgGroup(customerOrgRegisterId) { |
|||
this.customerOrgGroups = []; |
|||
getapi( |
|||
`/api/app/customerorggroup/getlistinfilter?CustomerOrgRegisterId=${customerOrgRegisterId}` |
|||
).then((res) => { |
|||
if (res.code != -1) { |
|||
this.customerOrgGroups = res.data.items; |
|||
this.customerOrgGroups.forEach((e) => { |
|||
e.customerOrgRegisterId = customerOrgRegisterId; |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
//选择单位 |
|||
changeCustomerOrg(v) { |
|||
getapi( |
|||
`/api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=${v}` |
|||
).then((res) => { |
|||
if (res.code != -1) { |
|||
this.customerOrgRegisterList = res.data; |
|||
if (res.data.length > 0) { |
|||
this.customerOrgRegister = res.data[res.data.length - 1]; |
|||
this.getCustomerOrgGroup(this.customerOrgRegister.id); |
|||
} else { |
|||
this.customerOrgRegister = {}; |
|||
this.customerOrgGroups = []; |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
//选择体检次数 |
|||
changeTimes(v) { |
|||
this.getCustomerOrgGroup(v.id); |
|||
}, |
|||
|
|||
//自定义过滤 |
|||
remoteMethod(){ |
|||
|
|||
}, |
|||
|
|||
//点击分组 |
|||
rowClick(row) { |
|||
objCopy(row, this.form); |
|||
}, |
|||
|
|||
//新增弹框 |
|||
btnAdd() { |
|||
if (!this.customerOrgRegister.id) { |
|||
this.$message.warning("请选择体检次数"); |
|||
return; |
|||
} |
|||
if (this.customerOrgRegister.isComplete.toUpperCase() == "Y") { |
|||
this.$message.warning("该单位的该次体检次数已完成,不能再添加分组!"); |
|||
return; |
|||
} |
|||
|
|||
this.form = deepCopy(this.formInit); |
|||
this.form.customerOrgRegisterId = this.customerOrgRegister.id; |
|||
this.dialogVisible = true; |
|||
}, |
|||
|
|||
//编辑弹框 |
|||
btnEdit() { |
|||
this.dialogVisible = true; |
|||
}, |
|||
|
|||
//删除 |
|||
btnDel() { |
|||
if (!this.form.id) { |
|||
this.$message.warning("请选择需要操作的数据"); |
|||
return; |
|||
} |
|||
|
|||
this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", { |
|||
confirmButtonText: "是", |
|||
cancelButtonText: " 否 ", |
|||
type: "warning", |
|||
}) |
|||
.then(() => { |
|||
return deletapi(`/api/app/customer-org-group/${this.form.id}`); |
|||
}) |
|||
.then((res) => { |
|||
if (res.code != -1) { |
|||
this.$message.success("删除成功"); |
|||
let lfind = arrayExistObj( |
|||
this.customerOrgGroups, |
|||
"id", |
|||
this.form.id |
|||
); |
|||
if (lfind > -1) this.customerOrgGroups.splice(lfind, 1); |
|||
} |
|||
}) |
|||
.catch((err) => { |
|||
if (err == "cancel") { |
|||
this.$message.info("已取消删除"); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
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.customerOrgRegisterId) { |
|||
this.$message.warning("请选择单位体检次数!"); |
|||
return false; |
|||
} |
|||
|
|||
let body = deepCopy(this.form); |
|||
delete body.id; |
|||
|
|||
if (this.form.id) { |
|||
//编辑 |
|||
putapi(`/api/app/customer-org-group/${this.form.id}`, body).then( |
|||
(res) => { |
|||
if (res.code != -1) { |
|||
this.$message.success("操作成功!"); |
|||
let lfind = arrayExistObj( |
|||
this.customerOrgGroups, |
|||
"id", |
|||
this.form.id |
|||
); |
|||
if (lfind > -1) |
|||
objCopy(this.form, this.customerOrgGroups[lfind]); |
|||
this.dialogVisible = false; |
|||
} |
|||
} |
|||
); |
|||
} else { |
|||
//新增 |
|||
postapi( |
|||
"/api/customerorggroup/createcustomerorggroupincustomerorgregister", |
|||
body |
|||
).then((res) => { |
|||
if (res.code != -1) { |
|||
this.$message.success("操作成功!"); |
|||
this.form.id = res.data.id; |
|||
this.customerOrgGroups.push(res.data); |
|||
this.dialogVisible = false; |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
}, |
|||
}; |
|||
</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"; |
|||
|
|||
</style> |
|||
.btnClass { |
|||
width:100px; |
|||
margin-bottom: 5px |
|||
} |
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue