model.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { commServer } from './server.js';
  2. import {dateHandle} from "../../utils/dateHandle.js";
  3. const initState = {
  4. showCheckMapDetail: false,
  5. showCheckMapAdd: false,
  6. showCheckPlan1: true,
  7. needReload: true, // 切换页面是否需要获取新数据
  8. stepActive: 0, // 步骤进度
  9. theme: {id: null, title: null, des: null}, // 主题选中数据(id: 0个案 1系统)
  10. condition: { // 条件页面数据
  11. options: [], // 树形节点数据
  12. conditionIds: [], // 选中的key
  13. depType: 1, // 门急诊类型 1-门诊 2-急诊
  14. defaultOpen: [], // 默认展开的项
  15. },
  16. checkRent: { // 查核组页面数据
  17. list: [],
  18. checkedItem: {id: null}
  19. },
  20. checkMap: { // 查核地图数据
  21. list: [], // 列表数据
  22. actionItem: {id: '', pointList: []}, // 当前操作的列表项
  23. deptList: [], // 新增单位数据
  24. },
  25. checkPlan: { // 查核计划
  26. checkedItem: {id: 'month', value: 2, label: '每月', model: 30}, // 选中的取模方式对象
  27. dateObj: { // 保存开始日期结束日期的对象
  28. start: dateHandle.todayDate(),
  29. end: '',
  30. dayNum: 0 // 两个日期间隔的天数
  31. },
  32. checkList: [], // 核查计划数组
  33. },
  34. situationPreview: { // 预览
  35. sitName: null,
  36. description: null,
  37. preDay: null,
  38. preH: null,
  39. startDay: null
  40. },
  41. editConfig: null // 编辑时候的原始数据
  42. };
  43. export default {
  44. namespaced: true,
  45. state: JSON.parse(JSON.stringify(initState)),
  46. mutations: {
  47. comChangeState(state, {key, data}) {
  48. state[key] = data;
  49. },
  50. setInit(state) {
  51. let _initState = JSON.parse(JSON.stringify(initState));
  52. console.log({_initState});
  53. for(let key in _initState) {
  54. state[key] = _initState[key];
  55. }
  56. }
  57. },
  58. actions: {
  59. commActions({ commit, state }, { key, data }) {
  60. return commServer(key, data);
  61. },
  62. }
  63. }