guidance.js 3.3 KB

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