guidance.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. var Request = GetRequest();
  2. new Vue({
  3. el: '#app',
  4. data: {
  5. guidances:[
  6. {name:'日吸烟量',type:1,value:"",unit:'支',key:"DAILY_SMOKING"},
  7. {name:'日吸烟量期望',type:1,value:"",unit:'支',key:"SOMKING_EXP"},
  8. {name:'心理调整',type:2,value:"",unit:'',key:"PSY_ADJUST_RESULT_CODE",
  9. options:[{key: "1",value:"理想"},{key: "2",value: "良好"},{key: "3",value: "一般"},{key: "4",value: "差"}]
  10. },
  11. {name:'日饮酒量',type:1,value:"",unit:'两',key:"DAILY_DRINKING"},
  12. {name:'日饮酒量期望',type:1,value:"",unit:'两',key:"DRINK_EXP"},
  13. {name:'医德行为',type:2,value:"",unit:'',key:"COMPLIANCE_RESULT_CODE",
  14. options:[{key: "1",value:"理想"},{key: "2",value: "良好"},{key: "3",value: "一般"},{key: "4",value: "差"}]
  15. },
  16. {name:'摄盐情况',type:2,value:"",unit:'',key:"SALT_TAKEN_LEVEL_CODE",
  17. options:[{key: "1",value:"轻"},{key: "2",value: "中"},{key: "3",value: "重"}]
  18. },
  19. {name:'摄盐情况期望',type:2,value:"",unit:'',key:"SALT_TAKEN_LEVEL_EXP",
  20. options:[{key: "1",value:"轻"},{key: "2",value: "中"},{key: "3",value: "重"}]
  21. },
  22. {name:'主食',type:1,value:"",unit:'克/天',key:"DAILY_STAPLE"},
  23. {name:'运动频率',type:2,value:"",unit:'',key:"EXERCISE_FREQ_CODE",
  24. options:[{key: "1",value:"每周 <= 三次"},{key: "2",value: "每周 > 三次"},{key: "3",value: "极少运动"},{key: "4",value: "残疾、关节等原因不能运动"},{key: "99",value: "不详"}]
  25. },
  26. {name:'运动时长',type:1,value:"",unit:'分钟/次',key:"EXERCISE_DURATION_MINS"},
  27. {name:'运动频率期望',type:2,value:"",unit:'',key:"EXERCISE_FREQ_CODE_EXP",
  28. options:[{key: "1",value:"每周 <= 三次"},{key: "2",value: "每周 > 三次"},{key: "3",value: "极少运动"},{key: "4",value: "残疾、关节等原因不能运动"},{key: "99",value: "不详"}]
  29. },
  30. {name:'运动时长期望',type:1,value:"",unit:'分钟/次',key:"EXERCISE_DURATION_MINS_EXP"},
  31. ],
  32. objData:''
  33. },
  34. mounted: function() {
  35. var vm = this
  36. var Request = GetRequest();
  37. recordAPI.getFollowupProjectData({id:Request["id"],followupProject:4}).then(function(res){
  38. if(res.status==200){
  39. var data = res.data;
  40. vm.objData = res.data
  41. // delete data["create_time"];delete data["followup_id"];delete data["followup_project"];delete data["id"];
  42. var allData = vm.guidances;
  43. for(var key in data){
  44. for(var j=0;j<allData.length;j++){
  45. if(allData[j].key == key){
  46. allData[j].value = data[key]
  47. break;
  48. }
  49. }
  50. }
  51. }
  52. })
  53. },
  54. methods:{
  55. saveButton:function(){
  56. var vm = this;
  57. params = {id: Request["id"], followupProject:4}
  58. var checkID = {}
  59. $(".inline-container input").each(function(i,v){//把所有被选中的复选框的值存入数组
  60. checkID[$(this).attr('name')] = $(this).val()
  61. });
  62. $(".inline-container select").each(function(i,v){//把所有被选中的复选框的值存入数组
  63. checkID[$(this).attr('name')] = $(this).val()
  64. });
  65. console.log(checkID)
  66. params.followupProjectData = JSON.stringify(checkID);
  67. recordAPI.ModifyFollowupResult(params).then(function(res){
  68. if(res.status==200){
  69. toastr.info("保存成功")
  70. }else{
  71. toastr.error(res.msg)
  72. }
  73. })
  74. }
  75. }
  76. })