zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<template>
  <div class='app'>
      <a-tabs  default-active-key='1' style='background-color: white;text-align: center' @change='tabChange'>
        <a-tab-pane key='1' tab='周报'>
          <a-card :bordered='false'>
            <!-- 查询区域 -->
            <div class='table-page-search-wrapper'>
              <a-form :form="form" layout='inline'>
                <a-row :gutter='24' type="flex" justify="center" align="top">
                  <a-col :md='16' :sm='16'>
                    <a-form-item label='时间区间'>
                      <a-range-picker
                        style='width: 100%'
                        v-model='queryParam.dateRange'
                        format='YYYY-MM-DD'
                        :placeholder="['开始时间', '结束时间']"
                        @change='onDateChange'>
                      </a-range-picker>
                    </a-form-item>
                  </a-col>
 
                </a-row>
 
                <a-row :gutter='24' type="flex" justify="center" align="top">
                  <a-col :md='16' :sm='16'>
                    <a-form-item label='选择部门'>
                      <j-select-depart v-model="queryParam.sysOrgCode" :trigger-change="true" customReturnField="orgCode" :multi="true"></j-select-depart>
                    </a-form-item>
                  </a-col>
                </a-row>
 
                <a-row :gutter='24' type="flex" justify="center" align="top">
                  <a-col :md='16' :sm='16'>
                    <a-form-item label='选择项目'>
                      <j-select-multi-project v-model='queryParam.xm' />
                    </a-form-item>
                  </a-col>
                </a-row>
 
                <a-row :gutter='24' type="flex" justify="center" align="top">
                  <a-col :md='16' :sm='16'>
                    <a-form-item label='选择用户'>
                      <j-select-user-by-dep v-model='queryParam.user' :multi='true' />
                    </a-form-item>
                  </a-col>
                </a-row>
 
 
                <a-row :gutter='24' type="flex" justify="center" align="top">
                  <a-col :md='16' :sm='16'>
                    <a-form-item label='导出明细' style="text-align: left">
                      <a-radio-group v-model='queryParam.detailFlag' >
                        <a-radio :value='0'>
                          否
                        </a-radio>
                        <a-radio :value='1'>
                          是
                        </a-radio>
                      </a-radio-group>
                    </a-form-item>
                  </a-col>
                </a-row>
 
                <a-row :gutter='24' type="flex" justify="center" align="top">
                  <a-col  :md='16' :sm='16' >
            <span style='float: right;overflow: hidden;' class='table-page-search-submitButtons'>
              <a-button type='primary' @click='searchQuery' :loading="loading" icon='export'>导出</a-button>
              <a-button type='primary' @click='searchReset' icon='reload' style='margin-left: 8px'>重置</a-button>
            </span>
                  </a-col>
                </a-row>
 
              </a-form>
            </div>
          </a-card>
        </a-tab-pane>
        <a-tab-pane key='2' tab='绩效' force-render>
          <a-card :bordered='false'>
            <!-- 查询区域 -->
            <div class='table-page-search-wrapper'>
              <a-form :form="form2" layout='inline'>
                <a-row :gutter='24' type="flex" justify="center" align="top">
                  <a-col :md='16' :sm='16'>
                    <a-form-item label='选择年份'>
                      <a-month-picker    v-model='queryParam2.year' style='width: 100%' placeholder="选择年份" @change="onMonthChange" />
                    </a-form-item>
                  </a-col>
 
                  <a-col :md='16' :sm='16' style="text-align: left">
                    <a-form-item label='选择季度'>
                      <a-radio-group v-model='queryParam2.quarter' @change='onQuarterChange'>
                        <a-radio :value='0'>
                          全年
                        </a-radio>
                        <a-radio :value='1'>
                          一季度
                        </a-radio>
                        <a-radio :value='2'>
                          二季度
                        </a-radio>
                        <a-radio :value='3'>
                          三季度
                        </a-radio>
                        <a-radio :value='4'>
                          四季度
                        </a-radio>
                      </a-radio-group>
                    </a-form-item>
                  </a-col>
 
                </a-row>
 
                <a-row :gutter='24' type="flex" justify="center" align="top">
                  <a-col :md='16' :sm='16'>
                    <a-form-item label='选择部门'>
                      <j-select-depart v-model="queryParam2.sysOrgCode" :trigger-change="true" customReturnField="orgCode" :multi="true"></j-select-depart>
                    </a-form-item>
                  </a-col>
                </a-row>
 
 
 
                <a-row :gutter='24' type="flex" justify="center" align="top">
                  <a-col :md='16' :sm='16'>
                    <a-form-item label='选择用户'>
                      <j-select-user-by-dep v-model='queryParam2.user' :multi='true' />
                    </a-form-item>
                  </a-col>
                </a-row>
 
                <a-row :gutter='24' type="flex" justify="center" align="top">
                  <a-col  :md='16' :sm='16' >
            <span style='float: right;overflow: hidden;' class='table-page-search-submitButtons'>
              <a-button type='primary' @click='searchQuery2' :loading="loading" icon='export'>导出</a-button>
              <a-button type='primary' @click='searchReset2' icon='reload' style='margin-left: 8px'>重置</a-button>
            </span>
                  </a-col>
                </a-row>
 
              </a-form>
            </div>
          </a-card>
        </a-tab-pane>
 
      </a-tabs>
  </div>
</template>
 
<script>
import get from 'lodash.get'
import JSelectMultiProject from '@comp/jeecgbiz/JSelectMultiProject'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getLastWeek, getWeek } from '@/utils/util'
import moment from 'moment'
import { getAction } from '@api/manage'
export default {
  name: 'RightExportWeekly',
  components:{JSelectMultiProject},
  mixins: [JeecgListMixin],
  data(){
    return{
      loading:false,
      queryParam:{
        detailFlag:0
      },
      queryParam2:{},
      //默认查询全年
      queryQuarter:2,
      form: this.$form.createForm(this),
      form2: this.$form.createForm(this),
      disableMixinCreated:true,
      url: {
        exportUrl: "/wek/record/exportWeekly",
        exportEvaluateUrl: "/wek/evaluate/exportEvaluate",
      }
    }
  },
  created() {
    //默认查询上周数据
   let lastWeek = getLastWeek(1)
    this.initQuery(lastWeek.start, lastWeek.end)
    let week = getWeek()
    let quarter  = moment().quarter()
 
    this.queryParam2.year =  week.yearNo +"-01"
    this.queryParam2.quarter = quarter
 
  },
  methods:{
    onQuarterChange(e){
      let quarter = e.target.value
      this.queryParam2.quarter = quarter
      console.info(quarter)
      console.info(this.queryParam2.quarter)
      this.$forceUpdate()
    },
    onDateChange: function(value, dateString) {
      this.queryParam.ksrq = dateString[0]
      this.queryParam.jsrq = dateString[1]
      this.$forceUpdate()
    },
    searchReset() {
      this.queryParam = {
        detailFlag:0
      }
      let lastWeek = getLastWeek(1)
      this.initQuery(lastWeek.start, lastWeek.end)
    },
    searchReset2() {
      this.queryParam2 = {}
      let week = getWeek()
      this.queryParam2.year =  week.yearNo +"-01"
      let quarter  = moment().quarter()
      this.queryParam2.quarter = quarter
      this.$forceUpdate()
    },
 
 
    initQuery(start, end) {
      this.queryParam.ksrq = start
      this.queryParam.jsrq = end
      this.queryParam.dateRange = [
        moment(start, this.dateFormat),
        moment(end, this.dateFormat)
      ]
      this.$forceUpdate()
    },
    searchQuery(){
 
      let params = Object.assign({}, this.queryParam)
       if(params.dateRange){
        delete params.dateRange; //范围参数不传递后台
      }
      this.loading = true
      let that = this
      getAction(this.url.exportUrl,params).then((res) => {
        console.info(res)
        if (res.success) {
          const  size = get(res, 'result.size') || 0;
          this.openNotification("success",'查询到'+size+'条数据,正在导出文件!')
          this.down(res.result.filePath)
        }else {
          this.openNotification("error",res.message)
        }
      }).finally(() => {
        setTimeout(function() {
          that.loading = false
        },1000)
 
      })
 
    },
    searchQuery2(){
 
      let params = Object.assign({}, this.queryParam2)
      if(params.year){
        params.year = params.year.slice(0,4)
      }
      this.loading = true
      let that = this
      getAction(this.url.exportEvaluateUrl,params).then((res) => {
        console.info(res)
        if (res.success) {
          const  size = get(res, 'result.size') || 0;
          this.openNotification("success",'查询到'+size+'条数据,正在导出文件!')
          this.down(res.result.filePath)
        }else {
          this.openNotification("error",res.message + "")
        }
      }).finally(() => {
        setTimeout(function() {
          that.loading = false
        },1000)
 
      })
 
    },
    //提示
    openNotification(type,message) {
      this.$notification[type]({
        message: '提示',
        description:
          message,
        duration: 5,
      });
    },
 
    down(url){
      this.downloadFile(url +"?time="+ new Date().getTime())
    },
    tabChange(){
 
    },
    onMonthChange(date, dateString) {
      console.log(date, dateString);
      this.queryParam2.year = dateString
      this.$forceUpdate()
    },
  }
}
</script>
 
<style lang='less' scoped>
 
.app{
  width: 100%;
  height: 100%;
  background: white;
  min-height: calc(100vh - 140px);
}
 
</style>