123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <template>
- <view style="width: 100%;height: 100%;">
- <view id="header">
- <u-row customStyle="border-bottom:1rpx solid lightgrey;height:80rpx">
- <u-col span="6">
- <picker mode="date" fields="year" :value="year" @change="(e)=>{year=e.target.value;getdata()}">
- <text>年度:{{year}}</text>
- </picker>
- </u-col>
- <u-col span="6">
- <picker mode="selector" :range="months" :value="index" @change="(e)=>{index= e.target.value ;month=months[e.target.value];getdata()}">
- <text>月度:{{months[index]}}</text>
- </picker>
- </u-col>
- </u-row>
- </view>
- <view>
- <uni-group title="本月工作总结">
- <textarea v-model="report.content"></textarea>
- </uni-group>
- <uni-group title="下月工作计划">
- <textarea v-model="report.nextPlan"></textarea>
- </uni-group>
- <u-button @click="btnOk" text="确定" type="primary" ></u-button>
- </view>
- </view>
- </template>
- <script>
- import taskReport from '../../api/taskReport.js'
- import auth from "../../utils/js/auth.js"
- export default {
- data() {
- return {
- year:"",
- month:"",
- index:0,
- months:["1","2","3","4","5","6","7","8","9","10","11","12"],
- report:{}
- }
- },
- onLoad() {
- let date = new Date();
- this.year=date.getFullYear()
- let mon= date.getMonth()+1
- let day = date.getDate()
- if(day>26){
- mon+=1
- }
- this.month=mon.toString()
-
- this.index=this.months.indexOf(this.month)
-
- this.getdata()
- },
- methods: {
- getdata(){
- let param={"year":this.year,"month":this.month,"sequence":0,"userId":auth.getId()}
-
- taskReport.getReportFormData(param).then(res=>{
- if(res.data.success){
- this.report=res.data.data||{}
- }
- })
- },
- btnOk(){
- if(!this.report.content){
- uni.showModal({
- title:"本月工作总结不允许为空",
- showCancel:false
- })
- return
- }
- if(!this.report.nextPlan){
- uni.showModal({
- title:"下月计划不允许为空",
- showCancel:false
- })
- return
- }
-
- if(!this.report.files){
- this.report.files=[]
- }
- this.report.needDeleteFileIds=[]
-
- if(this.report.id){
- taskReport.monthReportEdit(this.report).then(res=>{
- if(res.data.success){
- uni.showToast({
- title:"编辑成功",
- icon:"none"
- })
- }
- })
- }else{
- this.report.year=this.year
- this.report.month=this.month
- this.report.sequence=0
- taskReport.monthReportAdd(this.report).then(res=>{
- if(res.data.success){
- uni.showToast({
- title:"新增成功",
- icon:"none"
- })
- }
- })
- }
- }
- }
- }
- </script>
- <style>
- </style>
|