monthreport.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view style="width: 100%;height: 100%;">
  3. <view id="header">
  4. <u-row customStyle="border-bottom:1rpx solid lightgrey;height:80rpx">
  5. <u-col span="6">
  6. <picker mode="date" fields="year" :value="year" @change="(e)=>{year=e.target.value;getdata()}">
  7. <text>年度:{{year}}</text>
  8. </picker>
  9. </u-col>
  10. <u-col span="6">
  11. <picker mode="selector" :range="months" :value="index" @change="(e)=>{index= e.target.value ;month=months[e.target.value];getdata()}">
  12. <text>月度:{{months[index]}}</text>
  13. </picker>
  14. </u-col>
  15. </u-row>
  16. </view>
  17. <view>
  18. <uni-group title="本月工作总结">
  19. <textarea v-model="report.content"></textarea>
  20. </uni-group>
  21. <uni-group title="下月工作计划">
  22. <textarea v-model="report.nextPlan"></textarea>
  23. </uni-group>
  24. <u-button @click="btnOk" text="确定" type="primary" ></u-button>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import taskReport from '../../api/taskReport.js'
  30. import auth from "../../utils/js/auth.js"
  31. export default {
  32. data() {
  33. return {
  34. year:"",
  35. month:"",
  36. index:0,
  37. months:["1","2","3","4","5","6","7","8","9","10","11","12"],
  38. report:{}
  39. }
  40. },
  41. onLoad() {
  42. let date = new Date();
  43. this.year=date.getFullYear()
  44. let mon= date.getMonth()+1
  45. let day = date.getDate()
  46. if(day>26){
  47. mon+=1
  48. }
  49. this.month=mon.toString()
  50. this.index=this.months.indexOf(this.month)
  51. this.getdata()
  52. },
  53. methods: {
  54. getdata(){
  55. let param={"year":this.year,"month":this.month,"sequence":0,"userId":auth.getId()}
  56. taskReport.getReportFormData(param).then(res=>{
  57. if(res.data.success){
  58. this.report=res.data.data||{}
  59. }
  60. })
  61. },
  62. btnOk(){
  63. if(!this.report.content){
  64. uni.showModal({
  65. title:"本月工作总结不允许为空",
  66. showCancel:false
  67. })
  68. return
  69. }
  70. if(!this.report.nextPlan){
  71. uni.showModal({
  72. title:"下月计划不允许为空",
  73. showCancel:false
  74. })
  75. return
  76. }
  77. if(!this.report.files){
  78. this.report.files=[]
  79. }
  80. this.report.needDeleteFileIds=[]
  81. if(this.report.id){
  82. taskReport.monthReportEdit(this.report).then(res=>{
  83. if(res.data.success){
  84. uni.showToast({
  85. title:"编辑成功",
  86. icon:"none"
  87. })
  88. }
  89. })
  90. }else{
  91. this.report.year=this.year
  92. this.report.month=this.month
  93. this.report.sequence=0
  94. taskReport.monthReportAdd(this.report).then(res=>{
  95. if(res.data.success){
  96. uni.showToast({
  97. title:"新增成功",
  98. icon:"none"
  99. })
  100. }
  101. })
  102. }
  103. }
  104. }
  105. }
  106. </script>
  107. <style>
  108. </style>