Blame view

src/views/resource/itemOutManageList.vue 10.8 KB
fc7cb950   wuxw   开发完成采购功能
1
2
  <template>
    <div class="item-out-manage-container">
b4962701   wuxw   测试采购相关功能
3
      <el-row class="wrapper" :gutter="10">
fc7cb950   wuxw   开发完成采购功能
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
        <el-col :span="4" class="padding-r-0">
          <div class="border-radius">
            <div class="margin-xs-r treeview attendance-staff">
              <ul class="list-group text-center border-radius">
                <li v-for="(item, index) in itemOutManageInfo.states" :key="index" class="list-group-item node-orgTree"
                  :class="{ 'vc-node-selected': itemOutManageInfo.conditions.state === item.statusCd }"
                  @click="swatchState(item)">
                  {{ item.name }}
                </li>
              </ul>
            </div>
          </div>
        </el-col>
        <el-col :span="20">
          <el-card class="box-card">
            <div slot="header" class="flex justify-between">
              <span>{{ $t('itemOutManage.search.title') }}</span>
            </div>
            <el-row :gutter="20">
              <el-col :span="4">
                <el-input v-model.trim="itemOutManageInfo.conditions.applyOrderId"
                  :placeholder="$t('itemOutManage.search.applyOrderId')" clearable />
              </el-col>
              <el-col :span="4">
                <el-input v-model.trim="itemOutManageInfo.conditions.applyUserName"
                  :placeholder="$t('itemOutManage.search.applyUserName')" clearable />
              </el-col>
              <el-col :span="4">
                <el-input v-model.trim="itemOutManageInfo.conditions.resName"
                  :placeholder="$t('itemOutManage.search.resName')" clearable />
              </el-col>
              <el-col :span="4">
                <el-date-picker v-model="itemOutManageInfo.conditions.startTime" type="datetime"
                  :placeholder="$t('itemOutManage.search.startTime')" style="width: 100%" />
              </el-col>
              <el-col :span="4">
                <el-date-picker v-model="itemOutManageInfo.conditions.endTime" type="datetime"
                  :placeholder="$t('itemOutManage.search.endTime')" style="width: 100%"
                  :disabled="!itemOutManageInfo.conditions.startTime" :picker-options="endDateOptions" />
              </el-col>
              <el-col :span="4">
                <el-button type="primary" @click="_queryInspectionPlanMethod">
                  <i class="el-icon-search"></i>
                  {{ $t('common.search') }}
                </el-button>
                <el-button @click="_resetInspectionPlanMethod">
                  <i class="el-icon-refresh"></i>
                  {{ $t('common.reset') }}
                </el-button>
              </el-col>
            </el-row>
          </el-card>
  
          <el-card class="box-card margin-top">
            <div slot="header" class="flex justify-between">
              <span>{{ $t('itemOutManage.list.title') }}</span>
              <div style="float: right">
                <el-button type="primary" size="small" @click="_openAddItemOutModal">
                  <i class="el-icon-plus"></i>
                  {{ $t('itemOutManage.list.apply') }}
                </el-button>
                <el-button type="primary" size="small" @click="_exportExcel">
                  <i class="el-icon-download"></i>
                  {{ $t('common.export') }}
                </el-button>
              </div>
            </div>
            <el-table :data="itemOutManageInfo.itemOuts" border style="width: 100%" v-loading="loading">
              <el-table-column prop="applyOrderId" :label="$t('itemOutManage.table.applyOrderId')" align="center" />
              <el-table-column prop="resourceNames" :label="$t('itemOutManage.table.resourceNames')" align="center" />
              <el-table-column prop="userName" :label="$t('itemOutManage.table.userName')" align="center" />
              <el-table-column prop="createUserName" :label="$t('itemOutManage.table.createUserName')" align="center" />
              <el-table-column prop="createTime" :label="$t('itemOutManage.table.createTime')" align="center" />
              <el-table-column prop="stateName" :label="$t('itemOutManage.table.stateName')" align="center" />
              <el-table-column :label="$t('itemOutManage.table.warehousingWay')" align="center">
                <template slot-scope="scope">
                  {{ scope.row.warehousingWay === 10000 ? $t('itemOutManage.table.directOut') :
                    $t('itemOutManage.table.auditOut') }}
                </template>
              </el-table-column>
              <el-table-column :label="$t('common.operation')" align="center" width="220">
                <template slot-scope="scope">
                  <el-button size="mini" @click="_openDetailItemOutModel(scope.row)">
                    {{ $t('common.view') }}
                  </el-button>
                  <el-button v-if="scope.row.warehousingWay !== 10000" size="mini"
                    @click="_openRunWorkflowImage(scope.row)">
                    {{ $t('itemOutManage.table.flowChart') }}
                  </el-button>
                  <el-button v-if="scope.row.state === '1000' && itemOutManageInfo.currentUserId === scope.row.createUserId"
                    size="mini" type="danger" @click="_openDeleteItemOutModel(scope.row)">
                    {{ $t('itemOutManage.table.cancelApply') }}
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-pagination class="pagination" :current-page.sync="pagination.currentPage" :page-sizes="[10, 20, 30, 50]"
              :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"
              @size-change="handleSizeChange" @current-change="handleCurrentChange" />
          </el-card>
        </el-col>
      </el-row>
  
      <delete-item-out ref="deleteItemOut" @success="handleSuccess" />
      <view-image ref="viewImage" />
    </div>
  </template>
  
  <script>
  import { listPurchaseApplys, exportData,listRunWorkflowImage } from '@/api/resource/itemOutManageApi'
  import { getDict } from '@/api/community/communityApi'
  import { getCommunityId } from '@/api/community/communityApi'
  import DeleteItemOut from '@/components/resource/deleteItemOut'
  import ViewImage from '@/components/system/viewImage'
  import {getUserId} from '@/api/user/userApi'
  
  export default {
    name: 'ItemOutManageList',
    components: {
      DeleteItemOut,
      ViewImage
    },
    data() {
      return {
        loading: false,
        itemOutManageInfo: {
          itemOuts: [],
b4962701   wuxw   测试采购相关功能
131
          states: [{ statusCd: '', name: this.$t('common.all') }],
fc7cb950   wuxw   开发完成采购功能
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
          currentUserId: '',
          conditions: {
            applyOrderId: '',
            state: '',
            applyUserName: '',
            resOrderType: '20000',
            resName: '',
            startTime: '',
            endTime: '',
            communityId: ''
          }
        },
        pagination: {
          currentPage: 1,
          pageSize: 10,
          total: 0
        },
        endDateOptions: {
          disabledDate: (time) => {
            if (this.itemOutManageInfo.conditions.startTime) {
              return time.getTime() < new Date(this.itemOutManageInfo.conditions.startTime).getTime()
            }
            return false
          }
        }
      }
    },
    created() {
      this.itemOutManageInfo.currentUserId = getUserId()
      this.itemOutManageInfo.conditions.communityId = getCommunityId()
      this.initData()
    },
    methods: {
      async initData() {
        await this.getDictData()
        this._listItemOuts()
      },
      async getDictData() {
        try {
          const data = await getDict('purchase_apply', 'state')
          this.itemOutManageInfo.states = [{ statusCd: '', name: this.$t('common.all') }, ...data]
        } catch (error) {
          console.error('获取字典数据失败:', error)
        }
      },
      async _listItemOuts() {
        this.loading = true
        try {
          const params = {
            page: this.pagination.currentPage,
            row: this.pagination.pageSize,
            ...this.itemOutManageInfo.conditions
          }
          const { data, total } = await listPurchaseApplys(params)
          this.itemOutManageInfo.itemOuts = data
          this.pagination.total = total
        } catch (error) {
          console.error('获取数据失败:', error)
        } finally {
          this.loading = false
        }
      },
      _openAddItemOutModal() {
        this.$router.push({
          path: '/views/resource/addItemOut',
          query: { resOrderType: this.itemOutManageInfo.conditions.resOrderType }
        })
      },
      _openDetailItemOutModel(itemOut) {
        this.$router.push({
b4962701   wuxw   测试采购相关功能
202
          path: '/views/resource/purchaseApplyDetail',
fc7cb950   wuxw   开发完成采购功能
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
          query: {
            applyOrderId: itemOut.applyOrderId,
            resOrderType: this.itemOutManageInfo.conditions.resOrderType
          }
        })
      },
      _openDeleteItemOutModel(itemOut) {
        this.$refs.deleteItemOut.open(itemOut)
      },
      _queryInspectionPlanMethod() {
        this.pagination.currentPage = 1
        this._listItemOuts()
      },
      _resetInspectionPlanMethod() {
        this.itemOutManageInfo.conditions = {
          applyOrderId: '',
          state: '',
          applyUserName: '',
          resOrderType: '20000',
          resName: '',
          startTime: '',
          endTime: '',
          communityId: getCommunityId()
        }
        this.pagination.currentPage = 1
        this._listItemOuts()
      },
      async _openRunWorkflowImage(itemOut) {
        try {
          const params = {
            businessKey: itemOut.applyOrderId,
            communityId: getCommunityId()
          }
          const { data } = await listRunWorkflowImage(params)
          this.$refs.viewImage.open({ url: 'data:image/png;base64,' + data })
        } catch (error) {
          console.error('获取流程图失败:', error)
        }
      },
      async _exportExcel() {
        try {
          const params = {
            ...this.itemOutManageInfo.conditions,
            pagePath: 'itemOutManage'
          }
          await exportData(params)
          this.$message.success(this.$t('common.exportSuccess'))
b4962701   wuxw   测试采购相关功能
250
          this.$router.push('/pages/property/downloadTempFile?tab=downloadCenter')
fc7cb950   wuxw   开发完成采购功能
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
        } catch (error) {
          console.error('导出失败:', error)
        }
      },
      swatchState(item) {
        this.itemOutManageInfo.conditions.state = item.statusCd
        this._listItemOuts()
      },
      handleSuccess() {
        this._listItemOuts()
      },
      handleSizeChange(val) {
        this.pagination.pageSize = val
        this._listItemOuts()
      },
      handleCurrentChange(val) {
        this.pagination.currentPage = val
        this._listItemOuts()
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .item-out-manage-container {
    padding: 20px;
  
    .wrapper {
      width: 100%;
    }
  
    .border-radius {
      border-radius: 4px;
    }
  
    .margin-xs-r {
      margin-right: 5px;
    }
  
    .list-group {
      padding: 0;
      margin: 0;
      list-style: none;
  
      .list-group-item {
        padding: 10px 15px;
        margin-bottom: -1px;
        background-color: #fff;
fc7cb950   wuxw   开发完成采购功能
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
        cursor: pointer;
  
        &:hover {
          background-color: #f5f5f5;
        }
  
        &.vc-node-selected {
          background-color: #409eff;
          color: #fff;
        }
      }
    }
  
    .margin-top {
      margin-top: 20px;
    }
  
    .pagination {
      margin-top: 20px;
      text-align: right;
    }
  }
  </style>