Blame view

src/views/oa/copyWorkList.vue 10.5 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
0fbb1447   wuxw   vcFramework.js 转v...
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
    <div class="copy-work-container">
      <el-row :gutter="20">
        <el-col :span="4">
          <div class="border-radius">
            <div class="margin-xs-r treeview">
              <ul class="list-group text-center border-radius">
                <li
                  v-for="(item,index) in copyWorkInfo.states"
                  :key="index"
                  class="list-group-item node-orgTree"
                  :class="{'vc-node-selected':copyWorkInfo.conditions.state == item.state}"
                  @click="swatchWorkState(item)"
                >
                  {{ $t(`copyWork.state.${item.state || 'all'}`) }}
                </li>
              </ul>
            </div>
          </div>
        </el-col>
        <el-col :span="20">
          <el-card class="box-card">
            <div slot="header" class="flex justify-between">
              <h5>{{ $t('copyWork.search.title') }}</h5>
            </div>
            <div class="search-wrapper">
              <el-row :gutter="20">
                <el-col :span="4">
                  <el-input
                    v-model="copyWorkInfo.conditions.workName"
                    :placeholder="$t('copyWork.search.workName')"
                    clearable
                  />
                </el-col>
                <el-col :span="4">
                  <el-input
                    v-model="copyWorkInfo.conditions.createUserNameLike"
                    :placeholder="$t('copyWork.search.createUser')"
                    clearable
                  />
                </el-col>
                <el-col :span="4">
                  <el-date-picker
                    v-model="copyWorkInfo.conditions.queryStartTime"
b25b036d   wuxw   v1.9 优化日期
45
46
                    type="datetime" value-format="yyyy-MM-dd HH:mm:ss"                  :placeholder="$t('copyWork.search.startTime')"
                    style="width: 100%" 
0fbb1447   wuxw   vcFramework.js 转v...
47
48
49
50
51
                  />
                </el-col>
                <el-col :span="4">
                  <el-date-picker
                    v-model="copyWorkInfo.conditions.queryEndTime"
b25b036d   wuxw   v1.9 优化日期
52
53
                    type="datetime" value-format="yyyy-MM-dd HH:mm:ss"                  :placeholder="$t('copyWork.search.endTime')"
                    style="width: 100%" 
0fbb1447   wuxw   vcFramework.js 转v...
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
                  />
                </el-col>
                <el-col :span="4">
                  <el-button type="primary" @click="_queryCopyWorkMethod">
                    <i class="el-icon-search"></i>
                    {{ $t('common.search') }}
                  </el-button>
                  <el-button @click="_resetCopyWorkMethod">
                    <i class="el-icon-refresh"></i>
                    {{ $t('common.reset') }}
                  </el-button>
                </el-col>
              </el-row>
            </div>
          </el-card>
  
          <el-card class="box-card">
            <div slot="header" class="flex justify-between">
              <div>{{ $t('copyWork.list.title') }}</div>
            </div>
            <el-table
              :data="copyWorkInfo.works"
              border
              style="width: 100%"
              v-loading="loading"
            >
              <el-table-column
                prop="workId"
                :label="$t('copyWork.table.id')"
                align="center"
              />
              <el-table-column
                prop="workName"
                :label="$t('copyWork.table.workName')"
                align="center"
              />
              <el-table-column
                prop="typeName"
                :label="$t('copyWork.table.typeName')"
                align="center"
              />
              <el-table-column
                :label="$t('copyWork.table.workCycle')"
                align="center"
              >
                <template slot-scope="scope">
                  {{ scope.row.workCycle == '1001' ? $t('copyWork.cycle.once') : $t('copyWork.cycle.periodic') }}
                </template>
              </el-table-column>
              <el-table-column
                prop="startTime"
                :label="$t('copyWork.table.startTime')"
                align="center"
              />
              <el-table-column
                prop="endTime"
                :label="$t('copyWork.table.endTime')"
                align="center"
              />
              <el-table-column
                prop="createUserName"
                :label="$t('copyWork.table.createUser')"
                align="center"
              />
              <el-table-column
                prop="curStaffName"
                :label="$t('copyWork.table.handler')"
                align="center"
              >
                <template slot-scope="scope">
                  {{ scope.row.curStaffName || '-' }}
                </template>
              </el-table-column>
              <el-table-column
                prop="curCopyName"
                :label="$t('copyWork.table.copyUser')"
                align="center"
              >
                <template slot-scope="scope">
                  {{ scope.row.curCopyName || '-' }}
                </template>
              </el-table-column>
              <el-table-column
                prop="stateName"
                :label="$t('copyWork.table.status')"
                align="center"
              />
              <el-table-column
                prop="createTime"
                :label="$t('copyWork.table.createTime')"
                align="center"
              />
              <el-table-column
                :label="$t('common.operation')"
                align="center"
                width="180"
              >
                <template slot-scope="scope">
                  <el-button
                    v-if="scope.row.state != 'C'"
                    size="mini"
                    type="primary"
                    @click="_openCopyWorkModel(scope.row)"
                  >
                    {{ $t('common.process') }}
                  </el-button>
                  <el-button
                    size="mini"
                    @click="_toWorkDetailPage(scope.row)"
                  >
                    {{ $t('common.detail') }}
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-pagination
              :current-page.sync="page.current"
              :page-sizes="[10, 20, 30, 50]"
              :page-size="page.size"
              :total="page.total"
              layout="total, sizes, prev, pager, next, jumper"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
            />
          </el-card>
        </el-col>
      </el-row>
  
      <el-dialog
        :title="$t('copyWork.audit.title')"
        :visible.sync="auditDialogVisible"
        width="50%"
      >
        <el-form>
          <el-form-item :label="$t('copyWork.audit.message')">
            <el-input
              type="textarea"
              :placeholder="$t('copyWork.audit.messagePlaceholder')"
              v-model="copyWorkInfo.audit.auditMessage"
              :rows="4"
            />
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="auditDialogVisible = false">
            {{ $t('common.cancel') }}
          </el-button>
          <el-button type="primary" @click="_auditSubmit">
            {{ $t('common.submit') }}
          </el-button>
        </span>
      </el-dialog>
    </div>
  </template>
  
  <script>
  import { queryCopyWork, finishWorkCopy } from '@/api/oa/copyWorkApi'
  
  export default {
    name: 'CopyWorkList',
    data() {
      return {
        loading: false,
        auditDialogVisible: false,
        page: {
          current: 1,
          size: 10,
          total: 0
        },
        copyWorkInfo: {
          works: [],
          states: [
            {
              name: '全部',
              state: ''
            }, {
              name: '待处理',
              state: 'W'
            }, {
              name: '已处理',
              state: 'C'
            }
          ],
          audit: {
            copyId: '',
            auditMessage: '',
          },
          conditions: {
            workName: '',
            state: '',
            typeName: '',
            timeout: '',
            queryEndTime: '',
            queryStartTime: '',
            createUserNameLike: '',
            page: 1,
            row: 10
          }
        }
      }
    },
    created() {
      this._listCopyWorks(this.page.current, this.page.size)
    },
    methods: {
      async _listCopyWorks(page, size) {
        try {
          this.loading = true
          this.copyWorkInfo.conditions.page = page
          this.copyWorkInfo.conditions.row = size
          const { data, total } = await queryCopyWork(this.copyWorkInfo.conditions)
          this.copyWorkInfo.works = data
          this.page.total = total
        } catch (error) {
          this.$message.error(this.$t('copyWork.fetchError'))
        } finally {
          this.loading = false
        }
      },
      _queryCopyWorkMethod() {
        this.page.current = 1
        this._listCopyWorks(this.page.current, this.page.size)
      },
      _resetCopyWorkMethod() {
        this.copyWorkInfo.conditions = {
          workName: '',
          state: '',
          typeName: '',
          timeout: '',
          queryEndTime: '',
          queryStartTime: '',
          createUserNameLike: '',
          page: 1,
          row: 10
        }
        this._listCopyWorks(this.page.current, this.page.size)
      },
      swatchWorkState(state) {
        this.copyWorkInfo.conditions.state = state.state
        this._listCopyWorks(this.page.current, this.page.size)
      },
      _toWorkDetailPage(work) {
8d7bf383   wuxw   v1.9 优化工作单相关bug
296
        this.$router.push(`/views/oa/workDetail?workId=${work.workId}`)
0fbb1447   wuxw   vcFramework.js 转v...
297
298
      },
      _openCopyWorkModel(work) {
8d7bf383   wuxw   v1.9 优化工作单相关bug
299
        this.$router.push(`/views/oa/doCopyWork?workId=${work.workId}&copyId=${work.copyId}`)
0fbb1447   wuxw   vcFramework.js 转v...
300
301
302
303
      },
      async _auditSubmit() {
        try {
          await finishWorkCopy(this.copyWorkInfo.audit)
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
304
          this.$message.success(this.$t('common.operationSuccess'))
0fbb1447   wuxw   vcFramework.js 转v...
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
          this.auditDialogVisible = false
          this._listCopyWorks(this.page.current, this.page.size)
        } catch (error) {
          this.$message.error(error.message || this.$t('common.submitFailed'))
        }
      },
      handleSizeChange(val) {
        this.page.size = val
        this._listCopyWorks(this.page.current, this.page.size)
      },
      handleCurrentChange(val) {
        this.page.current = val
        this._listCopyWorks(this.page.current, this.page.size)
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .copy-work-container {
    padding: 20px;
  
    .border-radius {
      border-radius: 4px;
      overflow: hidden;
    }
  
    .margin-xs-r {
      margin-right: 10px;
    }
  
    .list-group {
      list-style: none;
      padding: 0;
      margin: 0;
  
      .list-group-item {
        padding: 10px 15px;
        border: 1px solid #ddd;
        margin-bottom: -1px;
        cursor: pointer;
        background-color: #fff;
  
        &:hover {
          background-color: #f5f5f5;
        }
  
        &.vc-node-selected {
          background-color: #409EFF;
          color: #fff;
        }
      }
    }
  
    .box-card {
      margin-bottom: 20px;
    }
  
    .search-wrapper {
      margin-bottom: 20px;
    }
  }
  </style>