Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -7,4 +7,6 @@ public interface CallNumberVoiceConfigAppService {
|
|||||||
R<?> addCallNumberVoiceConfig(CallNumberVoiceConfig callNumberVoiceConfig);
|
R<?> addCallNumberVoiceConfig(CallNumberVoiceConfig callNumberVoiceConfig);
|
||||||
|
|
||||||
R<?> updateCallNumberVoiceConfig(CallNumberVoiceConfig callNumberVoiceConfig);
|
R<?> updateCallNumberVoiceConfig(CallNumberVoiceConfig callNumberVoiceConfig);
|
||||||
|
|
||||||
|
R<?> getCallNumberVoiceConfig();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.openhis.web.triageandqueuemanage.appservice.CallNumberVoiceConfigAppS
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class CallNumberVoiceConfigAppServiceImpl implements CallNumberVoiceConfigAppService {
|
public class CallNumberVoiceConfigAppServiceImpl implements CallNumberVoiceConfigAppService {
|
||||||
@@ -15,6 +16,12 @@ public class CallNumberVoiceConfigAppServiceImpl implements CallNumberVoiceConfi
|
|||||||
@Resource
|
@Resource
|
||||||
private CallNumberVoiceConfigService callNumberVoiceConfigService;
|
private CallNumberVoiceConfigService callNumberVoiceConfigService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<?> getCallNumberVoiceConfig() {
|
||||||
|
List<CallNumberVoiceConfig> list = callNumberVoiceConfigService.list();
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<?> addCallNumberVoiceConfig(CallNumberVoiceConfig callNumberVoiceConfig) {
|
public R<?> addCallNumberVoiceConfig(CallNumberVoiceConfig callNumberVoiceConfig) {
|
||||||
if(ObjectUtil.isNull(callNumberVoiceConfig)){
|
if(ObjectUtil.isNull(callNumberVoiceConfig)){
|
||||||
@@ -32,4 +39,5 @@ public class CallNumberVoiceConfigAppServiceImpl implements CallNumberVoiceConfi
|
|||||||
boolean updateById = callNumberVoiceConfigService.updateById(callNumberVoiceConfig);
|
boolean updateById = callNumberVoiceConfigService.updateById(callNumberVoiceConfig);
|
||||||
return R.ok(updateById);
|
return R.ok(updateById);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,16 @@ public class CallNumberVoiceConfigController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CallNumberVoiceConfigAppService callNumberVoiceConfigAppService;
|
private CallNumberVoiceConfigAppService callNumberVoiceConfigAppService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询叫号语音设置
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/get")
|
||||||
|
public R<?> getCallNumberVoiceConfig(){
|
||||||
|
return R.ok(callNumberVoiceConfigAppService.getCallNumberVoiceConfig());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增叫号语音设置实体
|
* 新增叫号语音设置实体
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -52,8 +52,23 @@
|
|||||||
<td class="sequence-number">{{ index + 1 }}</td>
|
<td class="sequence-number">{{ index + 1 }}</td>
|
||||||
<td class="employee-info">
|
<td class="employee-info">
|
||||||
<div class="input-container">
|
<div class="input-container">
|
||||||
<!-- 操作员字段始终不可编辑 -->
|
<!-- 超级管理员可以编辑操作员字段,普通用户不可编辑 -->
|
||||||
<span class="employee-name">{{ item.operator || '-' }}</span>
|
<select
|
||||||
|
v-if="item.isActive && isAdmin"
|
||||||
|
v-model="item.employeeId"
|
||||||
|
class="form-control"
|
||||||
|
@change="updateOperatorFromEmployeeId(item)"
|
||||||
|
>
|
||||||
|
<option value="">请选择操作员</option>
|
||||||
|
<option
|
||||||
|
v-for="user in userList"
|
||||||
|
:key="user.employeeId"
|
||||||
|
:value="user.employeeId"
|
||||||
|
>
|
||||||
|
{{ user.name }} ({{ user.employeeId }})
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<span v-else class="employee-name">{{ item.operator || '-' }}</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="employee-id-cell">
|
<td class="employee-id-cell">
|
||||||
@@ -180,7 +195,7 @@ export default {
|
|||||||
name: '',
|
name: '',
|
||||||
nickName: '',
|
nickName: '',
|
||||||
employeeId: '',
|
employeeId: '',
|
||||||
status: '' // 0: 启用(管理员), 1: 禁用(普通人员)
|
status: '' // 0: 启用, 1: 禁用(仅用于显示,不再控制权限)
|
||||||
},
|
},
|
||||||
// 用户列表,用于操作员下拉选择(将在created中从后端获取)
|
// 用户列表,用于操作员下拉选择(将在created中从后端获取)
|
||||||
userList: [],
|
userList: [],
|
||||||
@@ -195,10 +210,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// 计算属性:判断是否为管理员
|
// 计算属性:判断是否为超级管理员
|
||||||
isAdmin() {
|
isAdmin() {
|
||||||
// 管理员是指在用户管理界面中状态为启用的用户
|
// 只有用户名等于 'admin' 的用户才是超级管理员,可以查看所有数据
|
||||||
return this.currentUser.status === '0';
|
const userStore = useUserStore();
|
||||||
|
return userStore.name === 'admin';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -260,14 +276,25 @@ export default {
|
|||||||
},
|
},
|
||||||
// 从后端加载发票数据
|
// 从后端加载发票数据
|
||||||
loadInvoiceData() {
|
loadInvoiceData() {
|
||||||
|
// 准备查询参数
|
||||||
|
const queryParams = {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10000 // 进一步增大分页大小,确保能获取数据库中的所有记录
|
||||||
|
};
|
||||||
|
|
||||||
|
// 非超级管理员用户只能查询自己的发票数据
|
||||||
|
if (!this.isAdmin && this.currentUser.employeeId) {
|
||||||
|
queryParams.invoicingStaffId = this.currentUser.employeeId;
|
||||||
|
console.log('普通用户模式,只查询自己的发票数据,员工ID:', this.currentUser.employeeId);
|
||||||
|
} else {
|
||||||
|
console.log('超级管理员模式,查询所有发票数据');
|
||||||
|
}
|
||||||
|
|
||||||
// 使用request工具从后端API获取发票段数据
|
// 使用request工具从后端API获取发票段数据
|
||||||
request({
|
request({
|
||||||
url: '/basicmanage/invoice-segment/page', // 更新为发票段的API路径
|
url: '/basicmanage/invoice-segment/page', // 更新为发票段的API路径
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: queryParams
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 10000 // 进一步增大分页大小,确保能获取数据库中的所有记录
|
|
||||||
}
|
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log('获取到的发票段数据响应:', res);
|
console.log('获取到的发票段数据响应:', res);
|
||||||
// 添加更多调试信息
|
// 添加更多调试信息
|
||||||
@@ -400,24 +427,24 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 根据用户权限过滤数据
|
// 根据用户权限过滤数据(作为后端过滤的补充保障)
|
||||||
filterDataByPermission() {
|
filterDataByPermission() {
|
||||||
console.log('开始过滤数据,当前用户状态:', this.currentUser.status);
|
console.log('开始过滤数据,当前用户:', this.currentUser.name, '是否超级管理员:', this.isAdmin);
|
||||||
console.log('过滤前数据总量:', this.invoiceData.length);
|
console.log('过滤前数据总量:', this.invoiceData.length);
|
||||||
|
|
||||||
if (this.isAdmin) {
|
if (this.isAdmin) {
|
||||||
// 管理员可以看到所有数据
|
// 超级管理员可以看到所有数据
|
||||||
console.log('管理员模式,显示所有数据');
|
console.log('超级管理员模式,显示所有数据');
|
||||||
this.filteredData = [...this.invoiceData];
|
this.filteredData = [...this.invoiceData];
|
||||||
} else {
|
} else {
|
||||||
// 普通操作员只能看到自己的数据,确保类型一致
|
// 普通用户只能看到自己的数据,确保类型一致
|
||||||
console.log('操作员模式,过滤条件:', this.currentUser.employeeId);
|
console.log('普通用户模式,过滤条件:', this.currentUser.employeeId);
|
||||||
const currentEmployeeId = String(this.currentUser.employeeId);
|
const currentEmployeeId = String(this.currentUser.employeeId);
|
||||||
this.filteredData = this.invoiceData.filter(item =>
|
this.filteredData = this.invoiceData.filter(item =>
|
||||||
String(item.employeeId) === currentEmployeeId
|
String(item.employeeId) === currentEmployeeId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('过滤后显示的数据量:', this.filteredData.length);
|
console.log('过滤后显示的数据量:', this.filteredData.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -440,6 +467,15 @@ export default {
|
|||||||
updateEmployeeId(item, employeeId) {
|
updateEmployeeId(item, employeeId) {
|
||||||
item.employeeId = employeeId;
|
item.employeeId = employeeId;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 根据员工ID更新操作员名称(超级管理员使用)
|
||||||
|
updateOperatorFromEmployeeId(item) {
|
||||||
|
if (item.employeeId) {
|
||||||
|
item.operator = this.getUserNameById(item.employeeId);
|
||||||
|
} else {
|
||||||
|
item.operator = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// 根据员工ID获取用户名称
|
// 根据员工ID获取用户名称
|
||||||
getUserNameById(employeeId) {
|
getUserNameById(employeeId) {
|
||||||
@@ -449,7 +485,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addNewRow() {
|
addNewRow() {
|
||||||
// 新增行时自动填充当前用户信息
|
// 新增行时根据用户权限填充信息
|
||||||
// 使用负数作为临时ID,避免与后端数据库ID冲突
|
// 使用负数作为临时ID,避免与后端数据库ID冲突
|
||||||
let maxId = 0;
|
let maxId = 0;
|
||||||
if (this.invoiceData.length > 0) {
|
if (this.invoiceData.length > 0) {
|
||||||
@@ -458,12 +494,12 @@ export default {
|
|||||||
const newId = -(maxId + 1);
|
const newId = -(maxId + 1);
|
||||||
const newSegmentId = Date.now(); // 生成唯一的segmentId
|
const newSegmentId = Date.now(); // 生成唯一的segmentId
|
||||||
const currentDate = new Date().toISOString().split('T')[0];
|
const currentDate = new Date().toISOString().split('T')[0];
|
||||||
|
|
||||||
const newRecord = {
|
const newRecord = {
|
||||||
id: newId,
|
id: newId,
|
||||||
segmentId: newSegmentId, // 为新记录设置segmentId
|
segmentId: newSegmentId, // 为新记录设置segmentId
|
||||||
operator: this.currentUser.name, // 自动使用当前用户名称
|
operator: this.isAdmin ? '' : this.currentUser.name, // 超级管理员可选择,普通用户自动填充
|
||||||
employeeId: this.currentUser.employeeId,
|
employeeId: this.isAdmin ? '' : this.currentUser.employeeId, // 超级管理员可选择,普通用户自动填充
|
||||||
date: currentDate, // 自动填充当日日期
|
date: currentDate, // 自动填充当日日期
|
||||||
startNum: '',
|
startNum: '',
|
||||||
endNum: '',
|
endNum: '',
|
||||||
@@ -472,8 +508,8 @@ export default {
|
|||||||
isActive: true, // 新增行默认处于编辑状态
|
isActive: true, // 新增行默认处于编辑状态
|
||||||
isNewRecord: true // 添加标记表示这是新记录
|
isNewRecord: true // 添加标记表示这是新记录
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('添加新行,自动填充领用日期为当日:', { newRecord });
|
console.log('添加新行:', this.isAdmin ? '超级管理员模式,可选择操作员' : '普通用户模式,自动填充当前用户信息', { newRecord });
|
||||||
this.invoiceData.push(newRecord);
|
this.invoiceData.push(newRecord);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -496,8 +532,8 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 严格检查权限:只能删除自己维护的发票号码段
|
// 严格检查权限:超级管理员可以删除所有记录,普通用户只能删除自己维护的发票号码段
|
||||||
if (record.operator !== this.currentUser.name) {
|
if (!this.isAdmin && record.operator !== this.currentUser.name) {
|
||||||
alert('您没有权限删除此记录!只能删除自己维护的发票号码段。');
|
alert('您没有权限删除此记录!只能删除自己维护的发票号码段。');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ watch(
|
|||||||
|
|
||||||
getList();
|
getList();
|
||||||
function getList() {
|
function getList() {
|
||||||
|
// 验证是否已选择患者
|
||||||
|
if (!props.patientInfo || Object.keys(props.patientInfo).length === 0) {
|
||||||
|
return; // 不执行API调用
|
||||||
|
}
|
||||||
|
|
||||||
queryParams.value.organizationId = props.patientInfo.orgId;
|
queryParams.value.organizationId = props.patientInfo.orgId;
|
||||||
getAdviceBaseInfo(queryParams.value).then((res) => {
|
getAdviceBaseInfo(queryParams.value).then((res) => {
|
||||||
adviceBaseList.value = res.data.records;
|
adviceBaseList.value = res.data.records;
|
||||||
|
|||||||
@@ -412,6 +412,12 @@ function getRowDisabled(row) {
|
|||||||
|
|
||||||
// 新增医嘱
|
// 新增医嘱
|
||||||
function handleAddPrescription() {
|
function handleAddPrescription() {
|
||||||
|
// 验证是否已选择患者
|
||||||
|
if (!props.patientInfo || Object.keys(props.patientInfo).length === 0) {
|
||||||
|
proxy.$modal.msgWarning('请先选择患者');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isAdding.value) {
|
if (isAdding.value) {
|
||||||
proxy.$modal.msgWarning('请先保存当前医嘱');
|
proxy.$modal.msgWarning('请先保存当前医嘱');
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -795,3 +795,35 @@ export function getTestResult(queryParams) {
|
|||||||
params: queryParams,
|
params: queryParams,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取检验申请单列表
|
||||||
|
*/
|
||||||
|
export function getInspectionApplicationList(queryParams) {
|
||||||
|
return request({
|
||||||
|
url: '/doctor-station/inspection/application-list',
|
||||||
|
method: 'get',
|
||||||
|
params: queryParams,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存检验申请单
|
||||||
|
*/
|
||||||
|
export function saveInspectionApplication(data) {
|
||||||
|
return request({
|
||||||
|
url: '/doctor-station/inspection/application',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除检验申请单
|
||||||
|
*/
|
||||||
|
export function deleteInspectionApplication(id) {
|
||||||
|
return request({
|
||||||
|
url: '/doctor-station/inspection/application/' + id,
|
||||||
|
method: 'delete',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -161,6 +161,9 @@
|
|||||||
<el-tab-pane label="中医" name="tcm">
|
<el-tab-pane label="中医" name="tcm">
|
||||||
<tcmAdvice :patientInfo="patientInfo" ref="tcmRef" />
|
<tcmAdvice :patientInfo="patientInfo" ref="tcmRef" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="检验" name="inspection">
|
||||||
|
<inspectionApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="inspectionRef" />
|
||||||
|
</el-tab-pane>
|
||||||
<el-tab-pane label="电子处方" name="eprescription">
|
<el-tab-pane label="电子处方" name="eprescription">
|
||||||
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
|
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -214,6 +217,7 @@ import PrescriptionInfo from './components/prescription/prescriptionInfo.vue';
|
|||||||
import eprescriptionlist from './components/eprescriptionlist.vue';
|
import eprescriptionlist from './components/eprescriptionlist.vue';
|
||||||
import HospitalizationDialog from './components/hospitalizationDialog.vue';
|
import HospitalizationDialog from './components/hospitalizationDialog.vue';
|
||||||
import tcmAdvice from './components/tcm/tcmAdvice.vue';
|
import tcmAdvice from './components/tcm/tcmAdvice.vue';
|
||||||
|
import inspectionApplication from './components/inspection/inspectionApplication.vue';
|
||||||
import { formatDate, formatDateStr } from '@/utils/index';
|
import { formatDate, formatDateStr } from '@/utils/index';
|
||||||
import useUserStore from '@/store/modules/user';
|
import useUserStore from '@/store/modules/user';
|
||||||
import { nextTick } from 'vue';
|
import { nextTick } from 'vue';
|
||||||
@@ -263,6 +267,7 @@ const registerTime = ref(formatDate(new Date()));
|
|||||||
const patientDrawerRef = ref();
|
const patientDrawerRef = ref();
|
||||||
const prescriptionRef = ref();
|
const prescriptionRef = ref();
|
||||||
const tcmRef = ref();
|
const tcmRef = ref();
|
||||||
|
const inspectionRef = ref();
|
||||||
const emrRef = ref();
|
const emrRef = ref();
|
||||||
const diagnosisRef = ref();
|
const diagnosisRef = ref();
|
||||||
const waitCount = ref(0);
|
const waitCount = ref(0);
|
||||||
@@ -396,6 +401,9 @@ function handleClick(tab) {
|
|||||||
case 'tcm':
|
case 'tcm':
|
||||||
tcmRef.value.getDiagnosisInfo();
|
tcmRef.value.getDiagnosisInfo();
|
||||||
break;
|
break;
|
||||||
|
case 'inspection':
|
||||||
|
// 检验tab点击处理逻辑可以在这里添加
|
||||||
|
break;
|
||||||
case 'eprescription':
|
case 'eprescription':
|
||||||
eprescriptionRef.value.getList();
|
eprescriptionRef.value.getList();
|
||||||
break;
|
break;
|
||||||
@@ -453,6 +461,7 @@ function handleCardClick(item, index) {
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
prescriptionRef.value.getListInfo();
|
prescriptionRef.value.getListInfo();
|
||||||
tcmRef.value.getListInfo();
|
tcmRef.value.getListInfo();
|
||||||
|
inspectionRef.value.getList();
|
||||||
diagnosisRef.value.getList();
|
diagnosisRef.value.getList();
|
||||||
eprescriptionRef.value.getList();
|
eprescriptionRef.value.getList();
|
||||||
// emrRef.value.getDetail(item.encounterId);
|
// emrRef.value.getDetail(item.encounterId);
|
||||||
|
|||||||
27
openhis-ui-vue3/src/views/triageandqueuemanage/api.js
Normal file
27
openhis-ui-vue3/src/views/triageandqueuemanage/api.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询叫号语音设置
|
||||||
|
export function getCallNumberVoiceConfig() {
|
||||||
|
return request({
|
||||||
|
url: '/CallNumberVoice/get',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增叫号语音设置
|
||||||
|
export function addCallNumberVoiceConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: '/CallNumberVoice/add',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改叫号语音设置
|
||||||
|
export function updateCallNumberVoiceConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: '/CallNumberVoice/update',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,754 @@
|
|||||||
|
<template>
|
||||||
|
<div class="call-voice-settings">
|
||||||
|
<!-- 标题区域 -->
|
||||||
|
<div class="title-section">
|
||||||
|
<h1>叫号语音设置</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 语音设置模块 -->
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2 class="card-title">科室叫号语音设置</h2>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-primary" @click="saveSettings" :disabled="loading">
|
||||||
|
<span v-if="loading">保存中...</span>
|
||||||
|
<span v-else>保存设置</span>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-secondary" @click="cancelSettings" :disabled="loading">取消</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="settings-section">
|
||||||
|
<!-- 播放次数设置 -->
|
||||||
|
<div class="setting-item">
|
||||||
|
<div class="setting-title">
|
||||||
|
<div class="icon">🔢</div>
|
||||||
|
<div>播放次数</div>
|
||||||
|
</div>
|
||||||
|
<div class="setting-content">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">播放次数</label>
|
||||||
|
<select v-model="settings.playCount" class="form-control" :disabled="loading">
|
||||||
|
<option value="1">1次</option>
|
||||||
|
<option value="2">2次</option>
|
||||||
|
<option value="3">3次</option>
|
||||||
|
<option value="4">4次</option>
|
||||||
|
<option value="5">5次</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="play-controls">
|
||||||
|
<div class="play-btn" @click="testPlay" :disabled="loading">
|
||||||
|
<svg v-if="!isPlaying" width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||||
|
<path d="M8 5V19L19 12L8 5Z" fill="white"/>
|
||||||
|
</svg>
|
||||||
|
<svg v-else width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||||
|
<path d="M14 19H18V5H14V19ZM6 19H10V5H6V19Z" fill="white"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<span v-if="loading">加载中...</span>
|
||||||
|
<span v-else-if="isPlaying">正在播放...</span>
|
||||||
|
<span v-else>点击测试播放效果</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 语音内容设置 -->
|
||||||
|
<div class="setting-item">
|
||||||
|
<div class="setting-title">
|
||||||
|
<div class="icon">🗣️</div>
|
||||||
|
<div>语音内容</div>
|
||||||
|
</div>
|
||||||
|
<div class="setting-content">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">叫号前缀</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
placeholder="例如:请"
|
||||||
|
v-model="settings.prefix"
|
||||||
|
:disabled="loading"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">叫号后缀</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
placeholder="例如:到诊室就诊"
|
||||||
|
v-model="settings.suffix"
|
||||||
|
:disabled="loading"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">语音速度</label>
|
||||||
|
<select v-model="settings.voiceSpeed" class="form-control" :disabled="loading">
|
||||||
|
<option value="slow">较慢</option>
|
||||||
|
<option value="normal">正常</option>
|
||||||
|
<option value="fast">较快</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 其他设置 -->
|
||||||
|
<div class="setting-item">
|
||||||
|
<div class="setting-title">
|
||||||
|
<div class="icon">⚙️</div>
|
||||||
|
<div>其他设置</div>
|
||||||
|
</div>
|
||||||
|
<div class="setting-content">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">音量设置</label>
|
||||||
|
<input
|
||||||
|
type="range"
|
||||||
|
min="0"
|
||||||
|
max="100"
|
||||||
|
v-model="settings.volume"
|
||||||
|
class="form-control"
|
||||||
|
@input="updateVolume"
|
||||||
|
:disabled="loading"
|
||||||
|
>
|
||||||
|
<div style="text-align: center; margin-top: 5px; color: var(--text-light);">
|
||||||
|
{{ settings.volume }}%
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">播放间隔</label>
|
||||||
|
<select v-model="settings.playInterval" class="form-control" :disabled="loading">
|
||||||
|
<option value="3">3秒</option>
|
||||||
|
<option value="5">5秒</option>
|
||||||
|
<option value="10">10秒</option>
|
||||||
|
<option value="15">15秒</option>
|
||||||
|
<option value="20">20秒</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="switch-label">
|
||||||
|
<div class="switch">
|
||||||
|
<input type="checkbox" v-model="settings.repeatPlay" :disabled="loading">
|
||||||
|
<span class="slider"></span>
|
||||||
|
</div>
|
||||||
|
<span>开启重复播放</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
|
import { ElSelect, ElMessage } from 'element-plus'
|
||||||
|
import {
|
||||||
|
getCallNumberVoiceConfig,
|
||||||
|
addCallNumberVoiceConfig,
|
||||||
|
updateCallNumberVoiceConfig
|
||||||
|
} from '../api'
|
||||||
|
|
||||||
|
// 响应式数据
|
||||||
|
const isPlaying = ref(false)
|
||||||
|
const loading = ref(false)
|
||||||
|
|
||||||
|
const settings = reactive({
|
||||||
|
playCount: 2,
|
||||||
|
prefix: '请',
|
||||||
|
suffix: '到诊室就诊',
|
||||||
|
voiceSpeed: 'normal',
|
||||||
|
volume: 80,
|
||||||
|
playInterval: 10,
|
||||||
|
repeatPlay: true
|
||||||
|
})
|
||||||
|
|
||||||
|
// 存储原始设置,用于取消时恢复
|
||||||
|
const originalSettings = reactive({ ...settings })
|
||||||
|
|
||||||
|
// 速度值映射函数 - 后端期望中文值
|
||||||
|
const mapSpeedToDatabase = (frontendSpeed) => {
|
||||||
|
const speedMap = {
|
||||||
|
'slow': '较慢',
|
||||||
|
'normal': '正常',
|
||||||
|
'fast': '较快'
|
||||||
|
}
|
||||||
|
const result = speedMap[frontendSpeed] || '正常'
|
||||||
|
console.log(`🔄 mapSpeedToDatabase: ${frontendSpeed} -> ${result}`)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapSpeedToFrontend = (databaseSpeed) => {
|
||||||
|
console.log(`🔍 mapSpeedToFrontend 输入: ${databaseSpeed} (类型: ${typeof databaseSpeed})`)
|
||||||
|
|
||||||
|
const speedMap = {
|
||||||
|
'较慢': 'slow',
|
||||||
|
'正常': 'normal',
|
||||||
|
'较快': 'fast'
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = speedMap[databaseSpeed] || 'normal'
|
||||||
|
console.log(`✅ mapSpeedToFrontend 输出: ${databaseSpeed} -> ${result}`)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
// 方法
|
||||||
|
const saveSettings = async () => {
|
||||||
|
console.log('💾 开始保存设置...', settings)
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
// 验证必填数据
|
||||||
|
if (!settings.prefix || settings.prefix.trim() === '') {
|
||||||
|
throw new Error('请填写叫号前缀')
|
||||||
|
}
|
||||||
|
if (!settings.suffix || settings.suffix.trim() === '') {
|
||||||
|
throw new Error('请填写叫号后缀')
|
||||||
|
}
|
||||||
|
|
||||||
|
const configData = {
|
||||||
|
playCount: parseInt(settings.playCount),
|
||||||
|
callPrefix: settings.prefix.trim(),
|
||||||
|
callSuffix: settings.suffix.trim(),
|
||||||
|
speed: mapSpeedToDatabase(settings.voiceSpeed),
|
||||||
|
volume: parseInt(settings.volume),
|
||||||
|
intervalSeconds: parseInt(settings.playInterval),
|
||||||
|
cycleBroadcast: Boolean(settings.repeatPlay)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('📤 准备保存的数据:', configData)
|
||||||
|
|
||||||
|
// 验证ID是否存在
|
||||||
|
if (!originalSettings.id) {
|
||||||
|
console.log('⚠️ 未找到配置ID,尝试使用新增接口')
|
||||||
|
|
||||||
|
// 尝试新增配置
|
||||||
|
const response = await addCallNumberVoiceConfig(configData)
|
||||||
|
console.log('✅ 新增接口返回:', response)
|
||||||
|
|
||||||
|
if (response.data && response.data.id) {
|
||||||
|
configData.id = response.data.id
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('📝 使用更新接口,配置ID:', originalSettings.id)
|
||||||
|
configData.id = originalSettings.id
|
||||||
|
|
||||||
|
// 使用更新接口保存设置
|
||||||
|
const response = await updateCallNumberVoiceConfig(configData)
|
||||||
|
console.log('✅ 更新接口返回:', response)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新原始设置
|
||||||
|
Object.assign(originalSettings, {
|
||||||
|
id: configData.id,
|
||||||
|
playCount: configData.playCount,
|
||||||
|
callPrefix: configData.callPrefix,
|
||||||
|
callSuffix: configData.callSuffix,
|
||||||
|
speed: configData.speed,
|
||||||
|
volume: configData.volume,
|
||||||
|
intervalSeconds: configData.intervalSeconds,
|
||||||
|
cycleBroadcast: configData.cycleBroadcast
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('✅ 原始设置已更新:', originalSettings)
|
||||||
|
ElMessage.success('设置保存成功!')
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 保存失败:', error)
|
||||||
|
ElMessage.error('保存失败:' + (error.message || '请稍后重试'))
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const cancelSettings = () => {
|
||||||
|
if (confirm('确定要取消所有更改吗?')) {
|
||||||
|
// 恢复到从服务器加载的原始数据
|
||||||
|
if (originalSettings.id) {
|
||||||
|
Object.assign(settings, {
|
||||||
|
playCount: originalSettings.playCount || 2,
|
||||||
|
prefix: originalSettings.callPrefix || '请',
|
||||||
|
suffix: originalSettings.callSuffix || '到诊室就诊',
|
||||||
|
voiceSpeed: originalSettings.speed || 'normal',
|
||||||
|
volume: originalSettings.volume || 80,
|
||||||
|
playInterval: originalSettings.intervalSeconds || 10,
|
||||||
|
repeatPlay: originalSettings.cycleBroadcast !== undefined ? originalSettings.cycleBroadcast : true
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 如果没有原始数据,恢复到默认值
|
||||||
|
Object.assign(settings, {
|
||||||
|
playCount: 2,
|
||||||
|
prefix: '请',
|
||||||
|
suffix: '到诊室就诊',
|
||||||
|
voiceSpeed: 'normal',
|
||||||
|
volume: 80,
|
||||||
|
playInterval: 10,
|
||||||
|
repeatPlay: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
ElMessage.info('已恢复到原始设置')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadSettings = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const response = await getCallNumberVoiceConfig()
|
||||||
|
|
||||||
|
// 处理后端返回的数据结构:response.data.data
|
||||||
|
let data = response.data
|
||||||
|
if (response.data && response.data.data) {
|
||||||
|
data = response.data.data
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证数据有效性
|
||||||
|
if (data && data.id) {
|
||||||
|
// 播放次数处理 - 转换为字符串类型以匹配select选项
|
||||||
|
const playCountParsed = parseInt(data.playCount)
|
||||||
|
const playCountFinal = isNaN(playCountParsed) ? "2" : String(playCountParsed)
|
||||||
|
settings.playCount = playCountFinal
|
||||||
|
|
||||||
|
// 音量处理
|
||||||
|
const volumeParsed = parseInt(data.volume)
|
||||||
|
const volumeFinal = isNaN(volumeParsed) ? 80 : volumeParsed
|
||||||
|
settings.volume = volumeFinal
|
||||||
|
|
||||||
|
// 播放间隔处理 - 转换为字符串类型以匹配select选项
|
||||||
|
const intervalParsed = parseInt(data.intervalSeconds)
|
||||||
|
const intervalFinal = isNaN(intervalParsed) ? "10" : String(intervalParsed)
|
||||||
|
settings.playInterval = intervalFinal
|
||||||
|
|
||||||
|
// 其他字段处理
|
||||||
|
settings.prefix = data.callPrefix || '请'
|
||||||
|
settings.suffix = data.callSuffix || '到诊室就诊'
|
||||||
|
settings.voiceSpeed = mapSpeedToFrontend(data.speed) || 'normal'
|
||||||
|
settings.repeatPlay = data.cycleBroadcast !== undefined ? Boolean(data.cycleBroadcast) : true
|
||||||
|
|
||||||
|
// 存储原始设置
|
||||||
|
Object.assign(originalSettings, {
|
||||||
|
id: data.id,
|
||||||
|
playCount: data.playCount,
|
||||||
|
callPrefix: data.callPrefix,
|
||||||
|
callSuffix: data.callSuffix,
|
||||||
|
speed: data.speed,
|
||||||
|
volume: data.volume,
|
||||||
|
intervalSeconds: data.intervalSeconds,
|
||||||
|
cycleBroadcast: data.cycleBroadcast
|
||||||
|
})
|
||||||
|
|
||||||
|
ElMessage.success('配置加载成功')
|
||||||
|
} else {
|
||||||
|
// 如果没有有效配置数据,使用默认设置
|
||||||
|
if (data && Object.keys(data).length > 0) {
|
||||||
|
ElMessage.info('未找到现有配置,使用默认设置')
|
||||||
|
} else {
|
||||||
|
ElMessage.warning('未找到配置数据,将使用默认设置')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用默认配置
|
||||||
|
Object.assign(settings, {
|
||||||
|
playCount: "2",
|
||||||
|
prefix: '请',
|
||||||
|
suffix: '到诊室就诊',
|
||||||
|
voiceSpeed: 'normal',
|
||||||
|
volume: 80,
|
||||||
|
playInterval: "10",
|
||||||
|
repeatPlay: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('获取设置失败:' + (error.message || '请稍后重试'))
|
||||||
|
|
||||||
|
// 错误时使用默认配置
|
||||||
|
Object.assign(settings, {
|
||||||
|
playCount: "2",
|
||||||
|
prefix: '请',
|
||||||
|
suffix: '到诊室就诊',
|
||||||
|
voiceSpeed: 'normal',
|
||||||
|
volume: 80,
|
||||||
|
playInterval: "10",
|
||||||
|
repeatPlay: true
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组件挂载时加载设置
|
||||||
|
onMounted(() => {
|
||||||
|
loadSettings()
|
||||||
|
})
|
||||||
|
|
||||||
|
const testPlay = () => {
|
||||||
|
if (isPlaying.value) return
|
||||||
|
|
||||||
|
isPlaying.value = true
|
||||||
|
const playCount = parseInt(settings.playCount)
|
||||||
|
|
||||||
|
// 播放语音
|
||||||
|
for (let i = 0; i < playCount; i++) {
|
||||||
|
setTimeout(() => {
|
||||||
|
speak(`${settings.prefix}1001号${settings.suffix}`)
|
||||||
|
}, i * 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 恢复按钮状态
|
||||||
|
setTimeout(() => {
|
||||||
|
isPlaying.value = false
|
||||||
|
}, playCount * 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
const speak = (text) => {
|
||||||
|
// 使用Web Speech API进行语音合成
|
||||||
|
if ('speechSynthesis' in window) {
|
||||||
|
const utterance = new SpeechSynthesisUtterance()
|
||||||
|
utterance.text = text
|
||||||
|
utterance.lang = 'zh-CN'
|
||||||
|
utterance.volume = settings.volume / 100
|
||||||
|
|
||||||
|
// 设置语音速度
|
||||||
|
const speedMap = {
|
||||||
|
slow: 0.8,
|
||||||
|
normal: 1,
|
||||||
|
fast: 1.2
|
||||||
|
}
|
||||||
|
utterance.rate = speedMap[settings.voiceSpeed] || 1
|
||||||
|
|
||||||
|
window.speechSynthesis.speak(utterance)
|
||||||
|
} else {
|
||||||
|
// 当前浏览器不支持语音合成功能
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateVolume = () => {
|
||||||
|
// 音量更新逻辑(显示在界面上)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 基础样式重置 */
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host {
|
||||||
|
/* CSS变量定义,适配项目主题 */
|
||||||
|
--primary-color: #409EFF; /* Element Plus 主色调 */
|
||||||
|
--secondary-color: #909399; /* 次要色 - 中性灰 */
|
||||||
|
--accent-color: #E6A23C; /* 强调色 - 警告色 */
|
||||||
|
--background-color: #f5f7fa; /* 背景色 - 浅灰 */
|
||||||
|
--card-color: #ffffff; /* 卡片背景色 */
|
||||||
|
--text-color: #303133; /* 主文本色 */
|
||||||
|
--text-light: #606266; /* 次要文本色 */
|
||||||
|
--border-color: #dcdfe6; /* 边框色 */
|
||||||
|
--success-color: #67C23A; /* 成功色 */
|
||||||
|
--shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); /* Element Plus 阴影 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.call-voice-settings {
|
||||||
|
background-color: var(--background-color);
|
||||||
|
color: var(--text-color);
|
||||||
|
line-height: 1.6;
|
||||||
|
padding: 20px;
|
||||||
|
min-height: 100vh;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 标题区域 */
|
||||||
|
.title-section {
|
||||||
|
background: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 20px 30px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
box-shadow: 0 4px 15px rgba(64, 158, 255, 0.15);
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-section h1 {
|
||||||
|
color: #000000;
|
||||||
|
margin: 0;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 按钮样式 */
|
||||||
|
.btn-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-align: center;
|
||||||
|
background-image: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
outline: none;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background-color: #5b8fb9;
|
||||||
|
color: white;
|
||||||
|
border: 1px solid #5b8fb9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background-color: #6c757d;
|
||||||
|
color: white;
|
||||||
|
border: 1px solid #6c757d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:hover {
|
||||||
|
opacity: 0.9;
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #4a7a9a;
|
||||||
|
border-color: #4a7a9a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background-color: #5a6268;
|
||||||
|
border-color: #5a6268;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 语音设置卡片 */
|
||||||
|
.card {
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 15px rgba(230, 162, 60, 0.15);
|
||||||
|
padding: 25px;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
overflow: hidden;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--primary-color);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title::before {
|
||||||
|
content: "①";
|
||||||
|
margin-right: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 设置区域样式 */
|
||||||
|
.settings-section {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.setting-item {
|
||||||
|
background-color: rgba(64, 158, 255, 0.05);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 20px;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.setting-title {
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.setting-title .icon {
|
||||||
|
background-color: rgba(64, 158, 255, 0.1);
|
||||||
|
color: var(--primary-color);
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 6px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-right: 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.setting-content {
|
||||||
|
padding-left: 44px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表单控件样式 */
|
||||||
|
.form-group {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text-color);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control {
|
||||||
|
width: 100%;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
transition: border-color 0.3s, box-shadow 0.3s;
|
||||||
|
box-sizing: border-box;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control:focus {
|
||||||
|
border-color: var(--primary-color);
|
||||||
|
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
select.form-control {
|
||||||
|
appearance: none;
|
||||||
|
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: right 12px center;
|
||||||
|
background-size: 16px;
|
||||||
|
padding-right: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="range"].form-control {
|
||||||
|
height: 32px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 开关控件 */
|
||||||
|
.switch-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
width: 44px;
|
||||||
|
height: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch input {
|
||||||
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider {
|
||||||
|
position: absolute;
|
||||||
|
cursor: pointer;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #ccc;
|
||||||
|
transition: .4s;
|
||||||
|
border-radius: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider:before {
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
height: 18px;
|
||||||
|
width: 18px;
|
||||||
|
left: 2px;
|
||||||
|
bottom: 2px;
|
||||||
|
background-color: white;
|
||||||
|
transition: .4s;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked + .slider {
|
||||||
|
background-color: #4caf50;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked + .slider:before {
|
||||||
|
transform: translateX(22px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 播放控制区域 */
|
||||||
|
.play-controls {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 15px;
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.play-btn {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #f8a978;
|
||||||
|
color: white;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.play-btn:hover {
|
||||||
|
transform: scale(1.05);
|
||||||
|
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
|
||||||
|
background-color: #e69965;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 响应式布局 */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.title-section {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-section h1 {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-group {
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-section {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.setting-item {
|
||||||
|
min-width: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
50
迁移记录-DB变更记录/202512241430add_table_call_number_voice.sql
Normal file
50
迁移记录-DB变更记录/202512241430add_table_call_number_voice.sql
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
CREATE TABLE call_number_voice (
|
||||||
|
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||||
|
play_count INT NOT NULL CHECK (play_count BETWEEN 1 AND 5),
|
||||||
|
call_prefix VARCHAR(20),
|
||||||
|
call_suffix VARCHAR(50),
|
||||||
|
speed VARCHAR(10) NOT NULL CHECK (speed IN ('较慢', '正常', '较快')),
|
||||||
|
volume INT NOT NULL CHECK (volume BETWEEN 0 AND 100),
|
||||||
|
interval_seconds INT NOT NULL,
|
||||||
|
cycle_broadcast BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
-- 核心约束:循环播放与间隔的逻辑关联
|
||||||
|
CONSTRAINT chk_cycle_interval
|
||||||
|
CHECK (
|
||||||
|
(cycle_broadcast = false AND interval_seconds = 0)
|
||||||
|
OR
|
||||||
|
(cycle_broadcast = true AND interval_seconds > 0)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 1. 添加表注释(PostgreSQL 语法)
|
||||||
|
COMMENT ON TABLE call_number_voice IS '叫号语音配置表';
|
||||||
|
|
||||||
|
-- 2. 逐个添加字段注释(PostgreSQL 语法)
|
||||||
|
COMMENT ON COLUMN call_number_voice.id IS '主键ID,自增';
|
||||||
|
COMMENT ON COLUMN call_number_voice.play_count IS '播放次数(1-5次)';
|
||||||
|
COMMENT ON COLUMN call_number_voice.call_prefix IS '叫号前缀(如“请”)';
|
||||||
|
COMMENT ON COLUMN call_number_voice.call_suffix IS '叫号后缀(如“到1号窗口就诊”)';
|
||||||
|
COMMENT ON COLUMN call_number_voice.speed IS '语速(较慢/正常/较快)';
|
||||||
|
COMMENT ON COLUMN call_number_voice.volume IS '音量(0-100%)';
|
||||||
|
COMMENT ON COLUMN call_number_voice.interval_seconds IS '播报间隔(秒)';
|
||||||
|
COMMENT ON COLUMN call_number_voice.cycle_broadcast IS '是否循环播报(默认关闭)';
|
||||||
|
COMMENT ON COLUMN call_number_voice.create_time IS '创建时间(自动填充当前时间)';
|
||||||
|
COMMENT ON COLUMN call_number_voice.update_time IS '更新时间(自动更新)';
|
||||||
|
|
||||||
|
-- 实现update_time自动更新(PostgreSQL需通过触发器)
|
||||||
|
CREATE OR REPLACE FUNCTION update_call_number_voice_time()
|
||||||
|
RETURNS TRIGGER AS $$
|
||||||
|
BEGIN
|
||||||
|
NEW.update_time = CURRENT_TIMESTAMP;
|
||||||
|
RETURN NEW;
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
CREATE TRIGGER trigger_call_number_voice_update
|
||||||
|
BEFORE UPDATE ON call_number_voice
|
||||||
|
FOR EACH ROW
|
||||||
|
EXECUTE FUNCTION update_call_number_voice_time();
|
||||||
|
|
||||||
|
INSERT INTO call_number_voice (play_count, call_prefix, call_suffix, speed, volume, interval_seconds, cycle_broadcast) VALUES (2,'请','到诊室就诊','正常',80,10,TRUE);
|
||||||
Reference in New Issue
Block a user