// src/store/modules/sms.js const state = { // 短信对话框是否可见 smsDialogVisible: false, // 患者数据 patientData: { sendname: '', age: '', telcode: '', deptname: '', leavehospitaldistrictname: '', }, // 短信模板 smsTemplate: '', }; const mutations = { // 打开短信对话框 OPEN_SMS_DIALOG(state, patientData) { console.log(11); state.smsDialogVisible = true; if (patientData) { state.patientData = { sendname: patientData.name || '', age: patientData.age || '', telcode: patientData.phone || '', deptname: patientData.deptName || '', leavehospitaldistrictname: patientData.wardName || '', }; state.smsTemplate = patientData.smsTemplate || ''; } }, // 关闭短信对话框 CLOSE_SMS_DIALOG(state) { state.smsDialogVisible = false; state.smsTemplate = ''; }, // 更新短信内容 UPDATE_SMS_CONTENT(state, content) { state.smsTemplate = content; }, }; const actions = { // 打开短信对话框 openSmsDialog({ commit }, patientData) { commit('OPEN_SMS_DIALOG', patientData); }, // 关闭短信对话框 closeSmsDialog({ commit }) { commit('CLOSE_SMS_DIALOG'); }, }; export default { namespaced: true, state, mutations, actions, };