You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

592 lines
23 KiB

4 months ago
<template>
<div class="min-width pagePadding " style="background: #F5F7FA;">
<p class="pageTitle bold mb24">基础信息</p>
4 months ago
<div class="doctor-list-wrap ">
<p class="pageTitle">医生列表</p>
<el-form>
4 months ago
<div class="selectAllTable-wrap flex-between mt32">
4 months ago
<div class="left flex">
<div class="checkboxAll">
<el-checkbox @change="handleTotalCheckAllChange" v-model="allChecked"
:indeterminate="isIndeterminate">全选</el-checkbox>
4 months ago
</div>
<span class="totalCount">{{ totalNum }}已选{{ selectNum }}</span>
4 months ago
<GuipButton type="ignore" :btnstyle="{ width: '99px', height: '32px', margin: '0 26px' }"
@click="batchOperate('1')">批量禁用</GuipButton>
<GuipButton type="ignore" :btnstyle="{ width: '99px', height: '32px' }"
@click="batchOperate('2')">
批量启用</GuipButton>
4 months ago
</div>
4 months ago
<div class="right flex">
4 months ago
<span>搜索医生</span>
4 months ago
<GuipInput ref="GuipInput" style="margin:0 24px 0 12px" width="280px" height="32px"
placeholder="输入姓名" @blur="inputBlur" v-model="doctorName" />
4 months ago
<GuipButton @click="addDoctor" size="form">新增医生</GuipButton>
</div>
</div>
4 months ago
<div class="tableList mt32" v-for="(item, index) in doctorList" :key="index">
<div class="top flex-between mb24">
<div class="left left1 flex">
<el-checkbox @change="handleCheckAllChange(index)" v-model="item.checked"></el-checkbox>
<el-avatar :src="item.avatar"></el-avatar>
<span class="name">{{ item.name }}</span>
<span>{{ item.phone }}</span>
<GuipSwitch :modelValue="Boolean(item.status)" @change="onSwitchChange(item, index)">
4 months ago
</GuipSwitch>
<GuipButton type="text" @click="editDoctor(item, index)">编辑</GuipButton>
4 months ago
</div>
<div class="right">
<GuipButton type="system" size="form" @click="addHospital(item)">添加医院</GuipButton>
4 months ago
</div>
4 months ago
</div>
<GuipTable :tableData="item.departs" style="width: 100%" :ref="(el) => setPopoverRef(index, el)"
@selection-change="handleSelectionChange(index, $event)" :show-header="false"
:loading="loading">
4 months ago
<el-table-column type="selection" width="135">
</el-table-column>
<el-table-column prop="depart_name" label="出诊医院" min-width="295">
4 months ago
<template slot-scope="scope">
<div class="flex cell_render">
<span>{{ scope.row.depart_name }}</span>
4 months ago
</div>
</template>
</el-table-column>
<el-table-column prop="project_count" label="项目个数" min-width="135">
4 months ago
<template slot-scope="scope">
<div class="flex cell_render">
<span>{{ scope.row.project_count }}</span>
4 months ago
</div>
</template>
</el-table-column>
4 months ago
<el-table-column prop="classify_count" label="组别" min-width="135">
4 months ago
<template slot-scope="scope">
<div class="flex cell_render">
{{ scope.row.classify_count }}分组
4 months ago
</div>
</template>
</el-table-column>
<el-table-column prop="classify_count" label="套餐" min-width="165">
4 months ago
<template slot-scope="scope">
<div class="flex cell_render">
{{ scope.row.classify_count }}分组
4 months ago
</div>
</template>
</el-table-column>
<el-table-column prop="create" label="时间" min-width="250"> </el-table-column>
4 months ago
<el-table-column prop="stock" fixed="right" min-width="110">
<template slot-scope="scope">
<GuipSwitch :modelValue="scope.row.status" active-value="1" inactive-value="0" @change="onSwitchChange1(scope.row)"></GuipSwitch>
4 months ago
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" min-width="120px">
<template slot-scope="scope">
<div class="flex">
<el-button type="text" @click="handleClick(scope.row)">编辑</el-button>
</div>
</template>
</el-table-column>
4 months ago
</GuipTable>
</div>
</el-form>
</div>
</div>
</template>
<script>
4 months ago
// const cityOptions = ['上海', '北京', '广州', '深圳'];
4 months ago
import store from '@/store';
import GuipTable from '@/components/GuipTable.vue';
// import SvgIcon from '@/components/SvgIcon.vue';
import GuipButton from '@/components/GuipButton.vue';
import GuipSwitch from '@/components/GuipSwitch.vue';
import GuipInput from '@/components/GuipInput.vue';
import { mapState } from 'vuex';
4 months ago
export default {
data() {
return {
list: {
approver_phone: "18888888888",
code: "en4b1v",
create: "2025-05-19 16:20:58",
desc: "擅长运用麦粒灸治疗疑难杂症,特别是恶性肿瘤的治疗,显著改善患者免疫状态。",
detail: "北京中医药大学中医临床特聘专家,师从师怀堂和谢锡亮两大中医泰斗,从事针灸临床50余年,善治免疫系统及其它病症如:各种肿瘤癌症,血小板减少或增多,白细胞减少,经常性感冒、支气管哮喘、过敏性紫癜、妇女尿失禁、夜尿增多,痤疮,急慢性肠炎、痛风、颈椎管狭窄、颈肩腰腿痛、疲劳综合征、失眠,及小儿夜啼、厌食和发育不良等症。",
first_visit_audit: "1",
id: "1",
idcard: "510322197808271433",
label: "",
name: "张小琪",
phone: "18888888888",
uid: "46",
departs: {
1: [
{
classify_count: 3,
create: "2025-05-29 16:37:28",
depart_id: "1",
depart_name: "中医科",
doctor_id: "1",
hid: "1",
hispital_name: "武丽娜中医针灸",
id: "1",
is_fixed: "1",
project_count: 24,
status: "1",
type: "0"
}
],
2: [
{
classify_count: 3,
create: "2025-05-29 16:37:28",
depart_id: "12",
depart_name: "中医科",
doctor_id: "1",
hid: "1",
hispital_name: "武丽娜中医针灸",
id: "1",
is_fixed: "1",
project_count: 24,
status: "1",
type: "0"
},
{
classify_count: 3,
create: "2025-05-29 16:37:28",
depart_id: "11",
depart_name: "中医科",
doctor_id: "1",
hid: "1",
hispital_name: "武丽娜中医针灸",
id: "1",
is_fixed: "1",
project_count: 24,
status: "1",
type: "0"
},
]
}
},
tableSelections: [],//已选中数据
4 months ago
tableData: [
{
4 months ago
sort: 1
4 months ago
}
],
4 months ago
popoverRefs: {},
loading: false,
switchValue: true,
checked: false,
checked1: false,
4 months ago
totalNum: 0,
selectNum: 0,
doctorName: '',
4 months ago
isIndeterminate: false,
doctorList: [
{
id: 10,
checked: false,
name: '一二',
idcard: '532524198711223615',
desc: '就哈哈哈哈,嗷跳舞',
detail: '拉开是金德拉克撒娇了大数据连接拉萨。。。',
tag: '专业',
phone: '17785748373',
avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
status: 0,
list: [
{
hos: [
'第三人民医院 针灸科',
'第一人民医院 中医科',
],
time: '2054 - 10 - 03',
status: true,
group: '2',
setMenu: '4',
nums: '88',
checked: false,
},
]
},
{
id: 10,
checked: false,
name: '一二',
idcard: '532524198711223615',
desc: '就哈哈哈哈,嗷跳舞',
detail: '拉开是金德拉克撒娇了大数据连接拉萨。。。',
tag: '专业',
phone: '17785748373',
avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
status: 1,
list: [
{
hos: [
'第三人民医院 针灸科',
'第一人民医院 中医科',
],
time: '2054 - 10 - 03',
status: true,
group: '2',
setMenu: '4',
nums: '88',
checked: false,
},
{
hos: [
'第三人民医院 针灸科',
'第一人民医院 中医科',
],
time: '2054 - 10 - 03',
status: true,
group: '2',
setMenu: '4',
nums: '88',
checked: false,
},
]
},
{
id: 10,
checked: false,
name: '一二',
idcard: '532524198711223615',
desc: '就哈哈哈哈,嗷跳舞',
detail: '拉开是金德拉克撒娇了大数据连接拉萨。。。',
tag: '专业',
phone: '17785748373',
avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
status: 1,
list: [
4 months ago
]
},
4 months ago
],
allChecked: false,
4 months ago
}
},
components: {
// GuipToolTip,
// SvgIcon,
GuipInput,
GuipButton,
GuipSwitch,
GuipTable,
// CustomDropdown
},
created() {
store.commit('SET_PAGENAME', '医生管理'); // 登录页面不显示侧边栏
},
mounted() {
store.commit('SET_CUSTOMIZE', false);
store.commit('SET_SLIDER_MENU', 'menuData');
this.getInitData()
},
render() {
console.log("组件重新渲染");
return 'a';
},
4 months ago
computed: {
...mapState(['menuData']) // 从Vuex映射showSidebar状态到组件的计算属性中
4 months ago
},
methods: {
// 初始化请求
getInitData() {
this.$http('POST', '/api/admin/doctor_depart_list', {
}).then(response => {
if (response.code == 0 && Object.values(response.data).length > 0) {
const list = Object.values(response.data).map(item => {
return {
...item,
checked:false,
departs: item.departs ? Object.values(item.departs).flat() : []
}
})
this.doctorList = list
console.log(list,this.doctorList,'this.doctorList====');
this.calculateTotalNum()
}
}).catch(error => {
console.error(error, 'error')
})
},
inputBlur(val) {
console.log(val, '');
this.getInitData()
},
// 计算总条数
calculateTotalNum() {
4 months ago
this.totalNum = this.doctorList.reduce((total, doctor) => {
return total + (doctor.departs ? doctor.departs.length : 0);
4 months ago
}, 0);
},
handleClick(row) {
4 months ago
console.log(row);
// 跳转编辑页面
},
setPopoverRef(index, el) {
if (el) {
this.popoverRefs[index] = el
}
},
//获取当前实例
getPopoverRef(index) {
return this.popoverRefs[index]
},
// 点击价格单元格时触发
handlePriceClick(row, index, type) {
// 关闭其他行的弹框
this.popoverFlag = true;
this.doctorList.forEach((item, i) => {
if (i !== index) {
item[type + 'PopoverVisible'] = false;
}
});
// 打开当前行的弹框
row[type + 'PopoverVisible'] = true;
row['edit_' + type] = row[type]
// row.edit_price = row.price; // 初始化输入框的值
},
// 保存价格
savePrice(row, type) {
if (type == 'price' && row.edit_price === '') {
this.$message.warning('价格不能为空');
return;
}
if (type == 'word' && row.word && row.editWord === '') {
this.$message.warning('字符不能为空');
return;
}
if (row.edit_word) {
row.word = row.edit_word
}
row[type] = row['edit_' + type]; // 更新价格
row[type + 'PopoverVisible'] = false; // 关闭弹框
this.$message.success('保存成功');
this.$set(this.doctorList, row)
console.log('保存价格:', this.doctorList, row.price);
// 这里可以调用接口保存修改后的价格
},
// 取消编辑
cancelEdit(row, type) {
row[type + 'PopoverVisible'] = false;
this.popoverFlag = false
// row[type + '_popover'] = false; // 关闭弹框
this.$Message.info('已取消编辑');
4 months ago
},
4 months ago
popshow() {
var ariaEls = document.querySelectorAll('.el-popover')
ariaEls.forEach((item) => {
item.removeAttribute('aria-hidden')
})
ariaEls = document.querySelectorAll('.el-radio__original')
ariaEls.forEach((item) => {
item.removeAttribute('aria-hidden')
})
},
onSwitchChange1(row) {
console.log(row, '------flag');
row.status = !row.status;
this.$set(this.doctorList, row)
},
batchOperate(type) {
// this.tableSelections
console.log(this.tableSelections,'this.tableSelections----');
4 months ago
if (type == '1') {
4 months ago
// 禁用
// this.getInitData()
4 months ago
} else {
4 months ago
// 启用
}
},
onSwitchChange(item, index) {
item.status = item.status == 0 ? 1 : 0;
console.log(index, item, '====');
this.$set(this.doctorList, item)
// let depart_ids = ''
// 更新医生启用状态
// this.$http('POST', '/api/admin/depart_mutil_option', {
// doctor_id:item.id,
// depart_ids:'',
// status:''
// }).then(response => {
// if (response.code == 0) {
// this.doctorList = response.data
// }
// }).catch(error => {
// console.error(error, 'error')
// })
4 months ago
},
4 months ago
addDoctor() {
this.$router.push({
name: '医生信息',
})
// this.$router.push({
// name: '医生信息',
// // query: {
// // doctorId: 123,
// // from: 'home'
// // }
// })
// 生成的URL:/doctorInformation?doctorId=123&from=home
4 months ago
},
addHospital(item) {
// this.$router.push(`/hosInformation?doctorId=${item.id}`)
this.$router.push({
name: '医院信息',
query: { doctorId: item.id }
})
4 months ago
},
editDoctor(item) {
// this.$router.push(`/doctorInformation`)
this.$router.push({
name: '医生信息',
query: { doctorId: item.id }
})
// this.$router.push({
// name: '医生信息',
// query: {
// doctorId: item.id,
// }
// })
// this.$router.push(`/doctorInformation?doctorId=${item.id}`)
4 months ago
},
4 months ago
// 单个表格的选择变化
handleSelectionChange(index, selection) {
console.log(index,selection,'=====');
4 months ago
// 更新当前表格的选中状态
this.doctorList[index].checked = selection.length === this.doctorList[index].departs.length;
4 months ago
this.tableSelections[index] = selection;
4 months ago
// 更新全局状态
this.updateGlobalSelection();
},
4 months ago
// 单个表格的全选/取消
handleCheckAllChange(index) {
const table = this.doctorList[index];
const tableRef = this.getPopoverRef(index);
4 months ago
if (table.checked) {
// 全选当前表格
tableRef.$refs.guiptable.toggleAllSelection();
} else {
// 取消当前表格全选
tableRef.$refs.guiptable.clearSelection();
}
4 months ago
// 更新全局状态
this.updateGlobalSelection();
},
4 months ago
// 总全选控制
handleTotalCheckAllChange() {
if (this.allChecked) {
// 总全选:只选中未全选的表格
this.doctorList.forEach((table, index) => {
if (!table.checked) {
this.doctorList[index].checked = true;
this.getPopoverRef(index).$refs.guiptable.toggleAllSelection();
}
});
} else {
// 取消总全选:只取消已全选的表格
this.doctorList.forEach((table, index) => {
if (table.checked) {
this.doctorList[index].checked = false;
this.getPopoverRef(index).$refs.guiptable.clearSelection();
}
});
}
4 months ago
// 更新全局状态
this.updateGlobalSelection();
},
4 months ago
// 更新全局选中状态
updateGlobalSelection() {
// 计算总选中数
this.selectNum = Object.values(this.tableSelections).reduce((total, selection) => {
return total + (selection ? selection.length : 0);
}, 0);
4 months ago
// 计算总全选状态
const allTables = this.doctorList.length;
const checkedTables = this.doctorList.filter(table => table.checked).length;
4 months ago
this.allChecked = checkedTables === allTables && allTables > 0;
this.isIndeterminate = checkedTables > 0 && checkedTables < allTables;
4 months ago
},
}
}
</script>
<style lang="scss" scoped>
4 months ago
::v-deep .el-avatar {
4 months ago
width: 26px;
height: 26px;
}
4 months ago
::v-deep .el-table {
min-height: auto;
}
::v-deep .custom-popover {
position: fixed !important;
max-height: 290px;
overflow-y: auto;
margin-top: 0 !important;
margin-left: 0 !important;
transform: none !important;
}
4 months ago
.doctor-list-wrap {
background: #fff;
padding: 32px 36px;
height: 100%;
border-radius: 4px;
4 months ago
.left,
.right {
4 months ago
align-items: center;
}
4 months ago
.selectAllTable-wrap {
4 months ago
align-items: center;
4 months ago
.totalCount {
4 months ago
font-size: 12px;
font-weight: normal;
line-height: 13px;
letter-spacing: 0.08em;
color: #8A9099;
margin-left: 12px;
}
4 months ago
.right {
4 months ago
letter-spacing: 0.08em;
color: #626573;
}
}
4 months ago
.left1 {
4 months ago
gap: 12px;
}
4 months ago
}
::v-deep .el-form-item {
margin-bottom: 0 !important;
4 months ago
}
</style>