Blame view

src/views/resource/allocationStorehouseManageList.vue 10.6 KB
fc7cb950   wuxw   开发完成采购功能
1
2
  <template>
    <div class="animated fadeInRight ecommerce">
b4962701   wuxw   测试采购相关功能
3
      <el-row :gutter="20">
fc7cb950   wuxw   开发完成采购功能
4
        <el-col :span="4" class="padding-r-0">
b4962701   wuxw   测试采购相关功能
5
6
7
8
9
10
          <div class="list-group-border-radius">
            <div class=" treeview">
              <ul class="list-group text-center ">
                <li v-for="(item, index) in states"  :key="index" @click="swatchState(item)"
                  :class="{ 'vc-node-selected':  conditions.state == item.statusCd  }"
                  class="list-group-item node-orgTree">
fc7cb950   wuxw   开发完成采购功能
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
313
314
                  {{ 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('allocationStorehouseManage.search.title') }}</span>
            </div>
            <el-row :gutter="20">
              <el-col :span="4">
                <el-input v-model.trim="conditions.startUserName"
                  :placeholder="$t('allocationStorehouseManage.search.startUserName')" clearable />
              </el-col>
              <el-col :span="4">
                <el-select v-model="conditions.applyType" :placeholder="$t('allocationStorehouseManage.search.applyType')"
                  style="width:100%">
                  <el-option v-for="(item, index) in applyTypes" :key="index" :label="item.name" :value="item.statusCd" />
                </el-select>
              </el-col>
              <el-col :span="4">
                <el-date-picker v-model="conditions.startTime" type="datetime"
                  :placeholder="$t('allocationStorehouseManage.search.startTime')" style="width:100%" />
              </el-col>
              <el-col :span="4">
                <el-date-picker v-model="conditions.endTime" type="datetime"
                  :placeholder="$t('allocationStorehouseManage.search.endTime')" style="width:100%" />
              </el-col>
              <el-col :span="4">
                <el-button type="primary" @click="_queryAllocationStorehouseMethod">
                  <i class="el-icon-search"></i>
                  {{ $t('common.search') }}
                </el-button>
                <el-button @click="_resetAllocationStorehouseMethod">
                  <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('allocationStorehouseManage.list.title') }}</span>
              <div style="float: right;">
                <el-button type="primary" size="small" @click="_openAllocationStorehouseApplyModal">
                  <i class="el-icon-plus"></i>
                  {{ $t('allocationStorehouseManage.list.allocation') }}
                </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="resourceStores" border style="width: 100%" v-loading="loading">
              <el-table-column prop="applyId" :label="$t('allocationStorehouseManage.table.applyId')" align="center" />
              <el-table-column prop="applyCount" :label="$t('allocationStorehouseManage.table.applyCount')"
                align="center" />
              <el-table-column prop="startUserName" :label="$t('allocationStorehouseManage.table.startUserName')"
                align="center" />
              <el-table-column prop="stateName" :label="$t('allocationStorehouseManage.table.stateName')" align="center" />
              <el-table-column prop="applyTypeName" :label="$t('allocationStorehouseManage.table.applyTypeName')"
                align="center" />
              <el-table-column prop="createTime" :label="$t('allocationStorehouseManage.table.createTime')"
                align="center" />
              <el-table-column :label="$t('common.operation')" align="center" width="200">
                <template slot-scope="scope">
                  <el-button v-if="scope.row.state == '1200' && currentUserId == scope.row.startUserId" type="text"
                    size="small" @click="_openDeleteResourceStoreModel(scope.row)">
                    {{ $t('allocationStorehouseManage.operation.cancel') }}
                  </el-button>
                  <el-button type="text" size="small" @click="_toDetail(scope.row)">
                    {{ $t('common.detail') }}
                  </el-button>
                  <el-button v-if="scope.row.applyType == '10000'" type="text" size="small"
                    @click="_openRunWorkflowImage(scope.row)">
                    {{ $t('allocationStorehouseManage.operation.flowChart') }}
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
              :current-page="page.current" :page-sizes="[10, 20, 30, 50]" :page-size="page.size"
              layout="total, sizes, prev, pager, next, jumper" :total="page.total" class="pagination" />
          </el-card>
        </el-col>
      </el-row>
  
      <view-image ref="viewImage" />
      <allocation-storehouse ref="allocationStorehouse" />
      <delete-storehouse-manage ref="deleteStorehouseManage" />
    </div>
  </template>
  
  <script>
  import { getDict, getCommunityId } from '@/api/community/communityApi'
  import { listAllocationStorehouseApplys, listStorehouses, exportData ,listRunWorkflowImage} from '@/api/resource/allocationStorehouseManageApi'
  import ViewImage from '@/components/system/viewImage'
  import AllocationStorehouse from '@/components/resource/allocationStorehouse'
  import DeleteStorehouseManage from '@/components/resource/deleteStorehouseManage'
  import { getUserId } from '@/api/user/userApi'
  
  export default {
    name: 'AllocationStorehouseManageList',
    components: {
      ViewImage,
      AllocationStorehouse,
      DeleteStorehouseManage
    },
    data() {
      return {
        loading: false,
        resourceStores: [],
        states: [],
        applyTypes: [],
        currentUserId: '',
        conditions: {
          applyId: '',
          resId: '',
          resName: '',
          resCode: '',
          shIda: '',
          shIdz: '',
          startTime: '',
          endTime: '',
          startUserId: '',
          startUserName: '',
          state: '',
          applyType: '',
          userId: '',
          communityId: ''
        },
        storehouses: [],
        page: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    created() {
      this.currentUserId = getUserId()
      this.conditions.userId = this.currentUserId
      this.conditions.communityId = getCommunityId()
      this.initData()
    },
    methods: {
      async initData() {
        try {
          // 获取字典数据
          const [states, applyTypes] = await Promise.all([
            getDict('allocation_storehouse_apply', 'state'),
            getDict('allocation_storehouse_apply', 'apply_type')
          ])
  
          this.states = [{ statusCd: '', name: this.$t('common.all') }, ...states]
          this.applyTypes = applyTypes
  
          // 获取仓库列表
          const storehouseRes = await listStorehouses({
            page: 1,
            row: 100,
            communityId: this.conditions.communityId
          })
          this.storehouses = storehouseRes.data
  
          // 获取调拨记录
          this._listAllocationStorehouses()
        } catch (error) {
          console.error('初始化数据失败:', error)
        }
      },
      async _listAllocationStorehouses() {
        try {
          this.loading = true
          const params = {
            ...this.conditions,
            page: this.page.current,
            row: this.page.size
          }
  
          const res = await listAllocationStorehouseApplys(params)
          this.resourceStores = res.data
          this.page.total = res.total
        } catch (error) {
          console.error('获取调拨记录失败:', error)
        } finally {
          this.loading = false
        }
      },
      _queryAllocationStorehouseMethod() {
        this.page.current = 1
        this._listAllocationStorehouses()
      },
      _resetAllocationStorehouseMethod() {
        this.conditions = {
          applyId: '',
          resId: '',
          resName: '',
          resCode: '',
          shIda: '',
          shIdz: '',
          startTime: '',
          endTime: '',
          startUserId: '',
          startUserName: '',
          state: '',
          applyType: '',
          userId: this.currentUserId,
          communityId: this.conditions.communityId
        }
        this._listAllocationStorehouses()
      },
      _openDeleteResourceStoreModel(row) {
        this.$refs.deleteStorehouseManage.open(row)
      },
      _toDetail(item) {
        this.$router.push({
          path: '/pages/common/allocationStorehouseDetail',
          query: {
            applyId: item.applyId,
            applyType: item.applyType,
            applyTypeName: item.applyTypeName
          }
        })
      },
      _openAllocationStorehouseApplyModal() {
        this.$router.push('/pages/common/allocationStorehouseApply')
      },
      async _openRunWorkflowImage(purchaseApply) {
        try {
          const res = await listRunWorkflowImage({
            communityId: this.conditions.communityId,
            businessKey: purchaseApply.applyId
          })
  
          if (res.code !== '0') {
            this.$message.error(res.msg)
            return
          }
  
          this.$refs.viewImage.open({
            url: 'data:image/png;base64,' + res.data
          })
        } catch (error) {
          console.error('获取流程图失败:', error)
        }
      },
      async _exportExcel() {
        try {
          const params = {
            ...this.conditions,
            pagePath: 'allocationStorehouseManage'
          }
  
          const res = await exportData(params)
          this.$message.success(res.msg)
  
          if (res.code === 0) {
            this.$router.push({
              path: '/pages/property/downloadTempFile',
              query: { tab: this.$t('common.downloadCenter') }
            })
          }
        } catch (error) {
          console.error('导出失败:', error)
        }
      },
      swatchState(item) {
        this.conditions.state = item.statusCd
        this._listAllocationStorehouses()
      },
      handleSizeChange(val) {
        this.page.size = val
        this._listAllocationStorehouses()
      },
      handleCurrentChange(val) {
        this.page.current = val
        this._listAllocationStorehouses()
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .ecommerce {
    padding: 20px;
  }
  
  .padding-r-0 {
    padding-right: 0 !important;
  }
  
  .border-radius {
    border-radius: 4px;
  }
  
  .margin-xs-r {
    margin-right: 5px;
  }
  
fc7cb950   wuxw   开发完成采购功能
315
  
fc7cb950   wuxw   开发完成采购功能
316
317
318
319
320
321
322
323
324
325
326
327
328
329
  
  .text-center {
    text-align: center;
  }
  
  .margin-top {
    margin-top: 20px;
  }
  
  .pagination {
    margin-top: 20px;
    text-align: right;
  }
  </style>