getDataConfig.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import store from '@/store'
  2. export function getDataConfigs (module, field) {
  3. var storeConfigList = store.state.data.configList
  4. var moduleConfig = storeConfigList[module]
  5. if (moduleConfig == undefined) {
  6. return false
  7. }
  8. if (module === 'summary' || module === 'education' || module === 'nursing_record' || module === 'special_record') {
  9. var Aresult = []
  10. for (var j = 0; j < moduleConfig.length; j++) {
  11. var Atemp = []
  12. var Aconfig = moduleConfig[j]
  13. Atemp['id'] = Aconfig.value
  14. Atemp['value'] = Aconfig.content
  15. Atemp['text'] = Aconfig.title
  16. Aresult.push(Atemp)
  17. }
  18. return Aresult
  19. } else {
  20. for (var i = 0; i < moduleConfig.length; i++) {
  21. var newConfig = moduleConfig[i]
  22. if (newConfig.field_name === field) {
  23. var result = []
  24. if (newConfig.childs != null) {
  25. for (var j = 0; j < newConfig.childs.length; j++) {
  26. var tempconfig = newConfig.childs[j]
  27. var temp = []
  28. temp['id'] = tempconfig.value
  29. temp['name'] = tempconfig.name
  30. result.push(temp)
  31. }
  32. }
  33. return result
  34. }
  35. }
  36. }
  37. }