Blame view

src/views/resource/assetInventoryManageList.vue 11.6 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
fc7cb950   wuxw   开发完成采购功能
2
3
4
    <div class="asset-inventory-manage-container">
      <el-row :gutter="20">
        <el-col :span="4" class="">
c8004a7b   wuxw   采购中的转增记录 使用记录处理完成
5
6
7
8
9
         
          <div class="list-group-border-radius">
            <div class=" treeview">
              <ul class="list-group text-center ">
                <li v-for="(item, index) in assetInventoryManageInfo.storehouses" :key="index" @click="swatchStorehouse(item)"
fc7cb950   wuxw   开发完成采购功能
10
                  :class="{ 'vc-node-selected': assetInventoryManageInfo.conditions.shId == item.shId }"
c8004a7b   wuxw   采购中的转增记录 使用记录处理完成
11
                  class="list-group-item node-orgTree">
fc7cb950   wuxw   开发完成采购功能
12
13
14
15
                  {{ item.shName }}
                </li>
              </ul>
            </div>
c8004a7b   wuxw   采购中的转增记录 使用记录处理完成
16
          </div>
fc7cb950   wuxw   开发完成采购功能
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
        </el-col>
        <el-col :span="20">
          <el-row>
            <el-col :span="24">
              <el-card>
                <div slot="header" class="flex justify-between">
                  <span>{{ $t('assetInventoryManage.search.title') }}</span>
                </div>
                <el-row :gutter="20">
                  <el-col :span="4">
                    <el-input v-model.trim="assetInventoryManageInfo.conditions.staffName"
                      :placeholder="$t('assetInventoryManage.search.staffName')" clearable />
                  </el-col>
                  <el-col :span="4">
                    <el-select v-model="assetInventoryManageInfo.conditions.state"
                      :placeholder="$t('assetInventoryManage.search.state')" style="width:100%">
                      <el-option v-for="item in assetInventoryManageInfo.states" :key="item.statusCd" :label="item.name"
                        :value="item.statusCd" />
                    </el-select>
                  </el-col>
                  <el-col :span="4">
b25b036d   wuxw   v1.9 优化日期
38
                    <el-date-picker v-model="assetInventoryManageInfo.conditions.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"                    :placeholder="$t('assetInventoryManage.search.startTime')" style="width:100%"  />
fc7cb950   wuxw   开发完成采购功能
39
40
                  </el-col>
                  <el-col :span="4">
b25b036d   wuxw   v1.9 优化日期
41
                    <el-date-picker v-model="assetInventoryManageInfo.conditions.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"                    :placeholder="$t('assetInventoryManage.search.endTime')" style="width:100%"  />
fc7cb950   wuxw   开发完成采购功能
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
                  </el-col>
                  <el-col :span="4">
                    <el-button type="primary" @click="_queryAssetInventoryMethod">
                      <i class="el-icon-search"></i>
                      {{ $t('common.search') }}
                    </el-button>
                    <el-button @click="_resetAssetInventoryMethod">
                      <i class="el-icon-refresh"></i>
                      {{ $t('common.reset') }}
                    </el-button>
                  </el-col>
                </el-row>
              </el-card>
            </el-col>
          </el-row>
  
          <el-row class="margin-top">
            <el-col :span="24">
              <el-card>
                <div slot="header" class="flex justify-between">
                  <span>{{ $t('assetInventoryManage.list.title') }}</span>
                  <div style="float: right;">
                    <el-button type="primary" size="small" @click="_openAddAssetInventoryModal">
                      <i class="el-icon-plus"></i>
                      {{ $t('assetInventoryManage.list.inventory') }}
                    </el-button>
                    <el-button type="primary" size="small" @click="_exportAssetInventoryManage">
                      <i class="el-icon-download"></i>
                      {{ $t('common.export') }}
                    </el-button>
                  </div>
                </div>
                <el-table :data="assetInventoryManageInfo.assetInventorys" border style="width: 100%">
                  <el-table-column prop="aiId" :label="$t('assetInventoryManage.table.aiId')" align="center" />
                  <el-table-column prop="name" :label="$t('assetInventoryManage.table.name')" align="center" />
                  <el-table-column prop="invTime" :label="$t('assetInventoryManage.table.invTime')" align="center" />
                  <el-table-column prop="shName" :label="$t('assetInventoryManage.table.shName')" align="center" />
                  <el-table-column prop="staffName" :label="$t('assetInventoryManage.table.staffName')" align="center" />
                  <el-table-column prop="stateName" :label="$t('assetInventoryManage.table.state')" align="center" />
                  <el-table-column prop="createTime" :label="$t('assetInventoryManage.table.createTime')" align="center" />
                  <el-table-column :label="$t('common.operation')" align="center" width="300">
                    <template slot-scope="scope">
                      <el-button size="mini" @click="_openInStockAssetInventoryModel(scope.row)">
                        {{ $t('common.detail') }}
                      </el-button>
                      <el-button
                        v-if="scope.row.state == '1000' && scope.row.staffId == assetInventoryManageInfo.curStaffId"
                        size="mini" type="primary" @click="_openEditAssetInventoryModel(scope.row)">
                        {{ $t('common.edit') }}
                      </el-button>
                      <el-button
                        v-if="scope.row.state == '2000' && scope.row.staffId == assetInventoryManageInfo.curStaffId"
                        size="mini" type="warning" @click="_openCancelAssetInventoryModel(scope.row)">
                        {{ $t('assetInventoryManage.list.cancelApply') }}
                      </el-button>
                      <el-button v-if="scope.row.state == '2000'" size="mini" type="success"
                        @click="_openAuditAssetInventoryModel(scope.row)">
                        {{ $t('assetInventoryManage.list.audit') }}
                      </el-button>
                      <el-button
                        v-if="scope.row.state != '4000' && scope.row.staffId == assetInventoryManageInfo.curStaffId"
                        size="mini" type="danger" @click="_openDeleteAssetInventoryModel(scope.row)">
                        {{ $t('common.delete') }}
                      </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-col>
      </el-row>
  
      <delete-asset-inventory ref="deleteAssetInventory" @success="handleSuccess" />
      <cancel-asset-inventory ref="cancelAssetInventory" @success="handleSuccess" />
    </div>
  </template>
  
  <script>
  import { getDict } from '@/api/community/communityApi'
  import { getCommunityId } from '@/api/community/communityApi'
  import { listAssetInventory, exportAssetInventory, listStorehouses } from '@/api/resource/assetInventoryManageApi'
  import DeleteAssetInventory from '@/components/resource/deleteAssetInventory'
  import CancelAssetInventory from '@/components/resource/cancelAssetInventory'
  import {getUserId} from '@/api/user/userApi'
  
  export default {
    name: 'AssetInventoryManageList',
    components: {
      DeleteAssetInventory,
      CancelAssetInventory
    },
    data() {
      return {
        assetInventoryManageInfo: {
          assetInventorys: [],
          storehouses: [],
          total: 0,
          records: 1,
          moreCondition: false,
          aiId: '',
          states: [],
          conditions: {
            shId: '',
            staffName: '',
            state: '',
            startTime: '',
            endTime: '',
            communityId: ''
          },
          curStaffId: ''
        },
        page: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    created() {
      this.initData()
    },
    methods: {
      async initData() {
        this.assetInventoryManageInfo.curStaffId = getUserId()
        this.assetInventoryManageInfo.conditions.communityId = await getCommunityId()
        this._listShopHouses()
        this._listAssetInventorys(this.page.current, this.page.size)
        this.getDictData()
      },
      async getDictData() {
        try {
          const data = await getDict('asset_inventory', 'state')
          this.assetInventoryManageInfo.states = data
        } catch (error) {
          console.error('获取字典数据失败:', error)
        }
      },
      async _listAssetInventorys(page, size) {
        try {
          const params = {
            page: page,
            row: size,
            ...this.assetInventoryManageInfo.conditions
          }
          const { data, total } = await listAssetInventory(params)
          this.assetInventoryManageInfo.assetInventorys = data
          this.page.total = total
        } catch (error) {
          console.error('获取资产盘点列表失败:', error)
        }
      },
      async _listShopHouses() {
        try {
          const params = {
            page: 1,
            row: 100,
            communityId: this.assetInventoryManageInfo.conditions.communityId
          }
          const { data } = await listStorehouses(params)
          this.assetInventoryManageInfo.storehouses = [
            { shName: this.$t('common.all'), shId: '' },
            ...data
          ]
        } catch (error) {
          console.error('获取仓库列表失败:', error)
        }
      },
      _openAddAssetInventoryModal() {
        this.$router.push('/pages/property/assetInventoryIn')
      },
      _openEditAssetInventoryModel(assetInventory) {
        this.$router.push(`/pages/property/assetInventoryEdit?aiId=${assetInventory.aiId}`)
      },
      _openAuditAssetInventoryModel(assetInventory) {
        this.$router.push(`/pages/property/assetInventoryAudit?aiId=${assetInventory.aiId}`)
      },
      _openInStockAssetInventoryModel(assetInventory) {
        this.$router.push(`/pages/property/assetInventoryInStock?aiId=${assetInventory.aiId}`)
      },
      _openDeleteAssetInventoryModel(assetInventory) {
        this.$refs.deleteAssetInventory.open(assetInventory)
      },
      _openCancelAssetInventoryModel(assetInventory) {
        this.$refs.cancelAssetInventory.open(assetInventory)
      },
      _queryAssetInventoryMethod() {
        this.page.current = 1
        this._listAssetInventorys(this.page.current, this.page.size)
      },
      _resetAssetInventoryMethod() {
        this.assetInventoryManageInfo.conditions = {
          shId: '',
          staffName: '',
          state: '',
          startTime: '',
          endTime: '',
          communityId: this.assetInventoryManageInfo.conditions.communityId
        }
        this._listAssetInventorys(this.page.current, this.page.size)
      },
      async _exportAssetInventoryManage() {
        try {
          const params = {
            ...this.assetInventoryManageInfo.conditions,
            pagePath: 'assetInventoryManage'
          }
          await exportAssetInventory(params)
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
253
          this.$message.success(this.$t('common.operationSuccess'))
fc7cb950   wuxw   开发完成采购功能
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
          this.$router.push('/pages/property/downloadTempFile?tab=下载中心')
        } catch (error) {
          console.error('导出失败:', error)
          this.$message.error(this.$t('common.exportFailed'))
        }
      },
      swatchStorehouse(item) {
        this.assetInventoryManageInfo.conditions.shId = item.shId
        this._listAssetInventorys(this.page.current, this.page.size)
      },
      handleSizeChange(val) {
        this.page.size = val
        this._listAssetInventorys(this.page.current, this.page.size)
      },
      handleCurrentChange(val) {
        this.page.current = val
        this._listAssetInventorys(this.page.current, this.page.size)
      },
      handleSuccess() {
        this._listAssetInventorys(this.page.current, this.page.size)
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .asset-inventory-manage-container {
    padding: 20px;
  
    .border-radius {
      border-radius: 4px;
    }
  
    .margin-xs-r {
      margin-right: 5px;
    }
  
    .padding-r-0 {
      padding-right: 0;
    }
  
fc7cb950   wuxw   开发完成采购功能
295
  
fc7cb950   wuxw   开发完成采购功能
296
297
  }
  </style>