Blame view

src/views/resource/allocationStorehouseDetailList.vue 10.6 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
b4962701   wuxw   测试采购相关功能
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
    <div class="allocation-storehouse-detail-container">
      <el-row :gutter="20">
        <el-col :span="24">
          <el-card>
            <div slot="header" class="flex justify-between">
              <span>{{ $t('allocationStorehouseDetail.applyInfo') }}</span>
              <div class="card-header-actions">
                <el-button type="primary" size="small" @click="printAllocationStorehouse">
                  <i class="el-icon-printer"></i>
                  {{ $t('allocationStorehouseDetail.print') }}
                </el-button>
                <el-button type="primary" size="small" @click="callBackListPurchaseApply">
                  <i class="el-icon-close"></i>
                  {{ $t('common.back') }}
                </el-button>
              </div>
            </div>
            <el-form :model="allocationStorehouseDetailInfo" label-width="120px" class="text-left">
19bafb73   wuxw   v1.9 优化采购相关bug
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
              <el-row :gutter="20">
                <el-col :span="8">
                  <el-form-item :label="$t('allocationStorehouseDetail.applicant')">
                    <span>{{ allocationStorehouseDetailInfo.startUserName }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item :label="$t('allocationStorehouseDetail.applyTime')">
                    <span>{{ allocationStorehouseDetailInfo.createTime }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item :label="$t('allocationStorehouseDetail.type')">
                    <span>{{ allocationStorehouseDetailInfo.applyTypeName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="20">
                <el-col :span="8">
                  <el-form-item :label="$t('allocationStorehouseDetail.status')">
                    <span>{{ allocationStorehouseDetailInfo.stateName }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="16">
                  <el-form-item :label="$t('allocationStorehouseDetail.applyRemark')">
                    <span>{{ allocationStorehouseDetailInfo.remark }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
b4962701   wuxw   测试采购相关功能
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
          </el-card>
        </el-col>
      </el-row>
  
      <el-row :gutter="20" class="mt-20">
        <el-col :span="24">
          <el-card>
            <div slot="header" class="flex justify-between">
              <span>{{ $t('allocationStorehouseDetail.allocationGoods') }}</span>
            </div>
            <el-table :data="allocationStorehouseDetailInfo.resourceStores" border style="width: 100%">
              <el-table-column prop="resId" :label="$t('allocationStorehouseDetail.goodsId')" align="center" />
              <el-table-column :label="$t('allocationStorehouseDetail.goodsType')" align="center">
                <template slot-scope="scope">
                  {{ scope.row.parentRstName }} > {{ scope.row.rstName }}
                </template>
              </el-table-column>
              <el-table-column prop="resName" :label="$t('allocationStorehouseDetail.goodsName')" align="center" />
              <el-table-column :label="$t('allocationStorehouseDetail.goodsSpec')" align="center">
                <template slot-scope="scope">
                  {{ scope.row.specName || '-' }}
                </template>
              </el-table-column>
              <el-table-column prop="resCode" :label="$t('allocationStorehouseDetail.goodsCode')" align="center" />
              <el-table-column prop="isFixedName" :label="$t('allocationStorehouseDetail.fixedGoods')" align="center" />
              <el-table-column
                :label="allocationStorehouseDetailInfo.applyType === '10000' || allocationStorehouseDetailInfo.applyType === '30000' ? $t('allocationStorehouseDetail.transferredWarehouse') : $t('allocationStorehouseDetail.returnPerson')"
                align="center">
                <template slot-scope="scope">
                  {{ allocationStorehouseDetailInfo.applyType === '10000' || allocationStorehouseDetailInfo.applyType ===
                    '30000' ? scope.row.shaName : allocationStorehouseDetailInfo.startUserName }}
                </template>
              </el-table-column>
              <el-table-column prop="shzName" :label="$t('allocationStorehouseDetail.targetWarehouse')" align="center" />
              <el-table-column
                :label="$t('allocationStorehouseDetail.originalStock') + '(' + (allocationStorehouseDetailInfo.applyType === '30000' ? $t('allocationStorehouseDetail.targetWarehouse') : $t('allocationStorehouseDetail.transferredWarehouse')) + ')'"
                align="center">
                <template slot-scope="scope">
                  {{ scope.row.originalStock }}{{ scope.row.unitCodeName }}
                </template>
              </el-table-column>
              <el-table-column :label="$t('allocationStorehouseDetail.allocationQuantity')" align="center">
                <template slot-scope="scope">
                  {{ scope.row.stock }}{{ scope.row.applyType === '20000' ? scope.row.miniUnitCodeName :
                    scope.row.unitCodeName }}
                </template>
              </el-table-column>
            </el-table>
          </el-card>
        </el-col>
      </el-row>
  
      <el-row :gutter="20" class="mt-20"
        v-if="allocationStorehouseDetailInfo.applyType === '10000' && allocationStorehouseDetailInfo.auditUsersCount > 0">
        <el-col :span="24">
          <el-card>
19bafb73   wuxw   v1.9 优化采购相关bug
106
            <div slot="header" class="flex justify-between">
b4962701   wuxw   测试采购相关功能
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
              <span>{{ $t('allocationStorehouseDetail.workflow') }}</span>
            </div>
            <el-table :data="allocationStorehouseDetailInfo.auditUsers" border style="width: 100%">
              <el-table-column :label="$t('allocationStorehouseDetail.serialNumber')" align="center">
                <template slot-scope="scope">
                  {{ scope.$index + 1 }}
                </template>
              </el-table-column>
              <el-table-column :label="$t('allocationStorehouseDetail.handler')" align="center">
                <template slot-scope="scope">
                  {{ scope.row.userName || scope.row.auditName }}
                </template>
              </el-table-column>
              <el-table-column prop="stateName" :label="$t('allocationStorehouseDetail.status')" align="center" />
              <el-table-column prop="auditTime" :label="$t('allocationStorehouseDetail.processTime')" align="center" />
              <el-table-column prop="duration" :label="$t('allocationStorehouseDetail.timeConsuming')" align="center" />
              <el-table-column prop="message" :label="$t('allocationStorehouseDetail.opinion')" align="center" />
            </el-table>
          </el-card>
        </el-col>
      </el-row>
19bafb73   wuxw   v1.9 优化采购相关bug
128
129
130
      <div class="mt-20">
        <allocation-audit-div v-if="allocationStorehouseDetailInfo.action === 'audit'" ref="auditDiv" />
      </div>
b4962701   wuxw   测试采购相关功能
131
132
133
134
135
136
137
138
139
    </div>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import {
    listAllocationStorehouseApplys,
    listAllocationStorehouses,
    listWorkflowAuditInfo
19bafb73   wuxw   v1.9 优化采购相关bug
140
    // auditAllocationStoreOrder
b4962701   wuxw   测试采购相关功能
141
  } from '@/api/resource/allocationStorehouseDetailApi'
19bafb73   wuxw   v1.9 优化采购相关bug
142
  import AllocationAuditDiv from '@/components/resource/allocationAuditDiv'
b4962701   wuxw   测试采购相关功能
143
144
145
146
  
  export default {
    name: 'AllocationStorehouseDetailList',
    components: {
19bafb73   wuxw   v1.9 优化采购相关bug
147
      AllocationAuditDiv
b4962701   wuxw   测试采购相关功能
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
    },
    data() {
      return {
        communityId: '',
        allocationStorehouseDetailInfo: {
          applyId: '',
          resourceStores: [],
          remark: '',
          startUserName: '',
          createTime: '',
          auditUsers: [],
          auditUsersCount: 0,
          stateName: '',
          applyType: '',
          applyTypeName: '',
          action: '',
19bafb73   wuxw   v1.9 优化采购相关bug
164
165
          taskId: '',
          flowId: ''
b4962701   wuxw   测试采购相关功能
166
167
168
169
170
171
172
173
174
175
        }
      }
    },
    created() {
      this.communityId = getCommunityId()
      this.allocationStorehouseDetailInfo.applyId = this.$route.query.applyId
      this.allocationStorehouseDetailInfo.applyType = this.$route.query.applyType
      this.allocationStorehouseDetailInfo.applyTypeName = this.$route.query.applyTypeName
      this.allocationStorehouseDetailInfo.action = this.$route.query.action
      this.allocationStorehouseDetailInfo.taskId = this.$route.query.taskId
19bafb73   wuxw   v1.9 优化采购相关bug
176
      this.allocationStorehouseDetailInfo.flowId = this.$route.query.flowId
b4962701   wuxw   测试采购相关功能
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
      this.listAllocationStorehouseApply()
      this.listPurchaseApply(1, 100)
    },
    methods: {
      async listPurchaseApply(page, rows) {
        try {
          const params = {
            page,
            row: rows,
            applyId: this.allocationStorehouseDetailInfo.applyId
          }
          const { data } = await listAllocationStorehouses(params)
          this.allocationStorehouseDetailInfo.resourceStores = data
        } catch (error) {
          console.error('请求失败:', error)
        }
      },
      async listAllocationStorehouseApply() {
        try {
          const params = {
            page: 1,
            row: 1,
            applyId: this.allocationStorehouseDetailInfo.applyId
          }
          const { data } = await listAllocationStorehouseApplys(params)
          const purchaseApply = data[0]
          Object.assign(this.allocationStorehouseDetailInfo, purchaseApply)
  
          if (this.allocationStorehouseDetailInfo.applyType === '10000') {
            this.loadAuditUser()
          }
  
          if (this.allocationStorehouseDetailInfo.action === 'audit') {
            this.$refs.auditDiv.open({
              createUserId: purchaseApply.startUserId,
              action: this.allocationStorehouseDetailInfo.action,
              taskId: this.allocationStorehouseDetailInfo.taskId,
19bafb73   wuxw   v1.9 优化采购相关bug
214
              flowId: this.allocationStorehouseDetailInfo.flowId,
b4962701   wuxw   测试采购相关功能
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
              url: '/resourceStore.auditAllocationStoreOrder',
              id: purchaseApply.applyId,
            })
          }
        } catch (error) {
          console.error('请求失败:', error)
        }
      },
      async loadAuditUser() {
        try {
          const params = {
            businessKey: this.allocationStorehouseDetailInfo.applyId,
            communityId: this.communityId,
          }
          const { data } = await listWorkflowAuditInfo(params)
          this.allocationStorehouseDetailInfo.auditUsers = data
          this.allocationStorehouseDetailInfo.auditUsersCount = data.length
        } catch (error) {
          console.error('请求失败:', error)
        }
      },
      callBackListPurchaseApply() {
        this.$router.go(-1)
      },
      printAllocationStorehouse() {
f5128dde   wuxw   优化打印404 问题
240
        window.open(`/#/pages/property/printAllocationStorehouse?applyId=${this.allocationStorehouseDetailInfo.applyId}`)
b4962701   wuxw   测试采购相关功能
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
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .allocation-storehouse-detail-container {
    padding: 20px;
  
    .mt-20 {
      margin-top: 20px;
    }
  
    .card-header-actions {
      float: right;
    }
  
    .el-form-item {
      margin-bottom: 0;
  
      span {
        display: inline-block;
        padding: 0 10px;
      }
    }
  }
  </style>