Blame view

src/views/resource/purchaseApplyManageList.vue 12.1 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
1cad66ad   wuxw   完成采购申请
2
3
4
5
6
    <div class="purchase-apply-manage-container">
  
      <div class="wrapper wrapper-content animated fadeInRight ecommerce">
        <el-row :gutter="20">
          <el-col :span="4" class="padding-r-0">
c412a802   wuxw   优化采购申请
7
8
9
10
11
12
13
14
15
            <div class="list-group-border-radius">
              <div class=" treeview">
                <ul class="list-group text-center ">
                  <li v-for="(item, index) in purchaseApplyManageInfo.states" :key="index" @click="swatchState(item)"
                    :class="{ 'vc-node-selected': purchaseApplyManageInfo.conditions.state === item.statusCd }"
                    class="list-group-item node-orgTree">
                    {{ item.name }}
                  </li>
                </ul>
1cad66ad   wuxw   完成采购申请
16
              </div>
c412a802   wuxw   优化采购申请
17
            </div>
1cad66ad   wuxw   完成采购申请
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-card>
              <div slot="header" class="flex justify-between">
                <span>{{ $t('purchaseApplyManage.search.title') }}</span>
              </div>
              <el-row :gutter="20">
                <el-col :span="4">
                  <el-input :placeholder="$t('purchaseApplyManage.search.applyOrderId')"
                    v-model.trim="purchaseApplyManageInfo.conditions.applyOrderId" clearable />
                </el-col>
                <el-col :span="4">
                  <el-input :placeholder="$t('purchaseApplyManage.search.name')"
                    v-model.trim="purchaseApplyManageInfo.conditions.name" clearable />
                </el-col>
                <el-col :span="4">
                  <el-input :placeholder="$t('purchaseApplyManage.search.resName')"
                    v-model.trim="purchaseApplyManageInfo.conditions.resName" clearable />
                </el-col>
                <el-col :span="4">
b25b036d   wuxw   v1.9 优化日期
38
                  <el-date-picker v-model="purchaseApplyManageInfo.conditions.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"                  :placeholder="$t('purchaseApplyManage.search.startTime')" style="width: 100%"  />
1cad66ad   wuxw   完成采购申请
39
40
                </el-col>
                <el-col :span="4">
b25b036d   wuxw   v1.9 优化日期
41
                  <el-date-picker v-model="purchaseApplyManageInfo.conditions.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"                  :placeholder="$t('purchaseApplyManage.search.endTime')" style="width: 100%"  />
1cad66ad   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
                </el-col>
                <el-col :span="4">
                  <el-button type="primary" @click="_queryPurchaseApplyMethod()" icon="el-icon-search">
                    {{ $t('common.search') }}
                  </el-button>
                  <el-button type="default" @click="_resetInspectionPlanMethod()" icon="el-icon-refresh">
                    {{ $t('common.reset') }}
                  </el-button>
                </el-col>
              </el-row>
            </el-card>
  
            <el-card class="margin-top">
              <div slot="header" class="flex justify-between">
                <div>{{ $t('purchaseApplyManage.list.title') }}</div>
                <div class="ibox-tools" style="top: 10px">
                  <el-button type="primary" size="small" @click="_openAddPurchaseApplyModal()" icon="el-icon-plus">
                    {{ $t('purchaseApplyManage.button.purchase') }}
                  </el-button>
                  <el-button type="primary" size="small" v-if="hasPrivilege('502021071043650029')"
                    @click="_openUrgentPurchaseApplyModal()" icon="el-icon-plus">
                    {{ $t('purchaseApplyManage.button.urgentPurchase') }}
                  </el-button>
                  <el-button type="primary" size="small" @click="_exportExcel()" icon="el-icon-download">
                    {{ $t('common.export') }}
                  </el-button>
                </div>
              </div>
              <el-table :data="purchaseApplyManageInfo.purchaseApplys" border style="width: 100%" v-loading="loading">
c412a802   wuxw   优化采购申请
71
72
                <el-table-column prop="applyOrderId" :label="$t('purchaseApplyManage.table.applyOrderId')"
                  align="center" />
1cad66ad   wuxw   完成采购申请
73
74
75
76
77
78
79
80
81
82
83
                <el-table-column prop="userName" :label="$t('purchaseApplyManage.table.userName')" align="center" />
                <el-table-column prop="endUserName" :label="$t('purchaseApplyManage.table.endUserName')" align="center" />
                <el-table-column prop="createUserName" :label="$t('purchaseApplyManage.table.createUserName')"
                  align="center" />
                <el-table-column prop="resourceNames" :label="$t('purchaseApplyManage.table.resourceNames')"
                  align="center" />
                <el-table-column prop="createTime" :label="$t('purchaseApplyManage.table.createTime')" align="center" />
                <el-table-column :label="$t('purchaseApplyManage.table.warehousingWay')" align="center">
                  <template slot-scope="scope">
                    {{
                      scope.row.warehousingWay == 10000
c412a802   wuxw   优化采购申请
84
85
86
87
                        ? $t('purchaseApplyManage.warehousingWay.direct')
                        : scope.row.warehousingWay == 20000
                          ? $t('purchaseApplyManage.warehousingWay.purchase')
                          : $t('purchaseApplyManage.warehousingWay.urgent')
1cad66ad   wuxw   完成采购申请
88
89
90
91
92
93
94
95
96
97
98
                    }}
                  </template>
                </el-table-column>
                <el-table-column prop="stateName" :label="$t('purchaseApplyManage.table.stateName')" align="center" />
                <el-table-column :label="$t('common.operation')" align="center" width="300">
                  <template slot-scope="scope">
                    <el-button size="mini" @click="_openDetailPurchaseApplyModel(scope.row)">
                      {{ $t('common.view') }}
                    </el-button>
                    <el-button size="mini" v-if="scope.row.warehousingWay != 10000 &&
                      scope.row.warehousingWay != 30000
c412a802   wuxw   优化采购申请
99
                    " @click="_openRunWorkflowImage(scope.row)">
1cad66ad   wuxw   完成采购申请
100
101
102
103
104
                      {{ $t('purchaseApplyManage.button.flowChart') }}
                    </el-button>
                    <el-button size="mini" type="danger" v-if="scope.row.state == '1000' &&
                      purchaseApplyManageInfo.currentUserId ==
                      scope.row.createUserId
c412a802   wuxw   优化采购申请
105
                    " @click="_openDeletePurchaseApplyModel(scope.row)">
1cad66ad   wuxw   完成采购申请
106
107
108
109
                      {{ $t('purchaseApplyManage.button.cancelApply') }}
                    </el-button>
                    <el-button size="mini" type="danger" v-else-if="scope.row.state == '1000' &&
                      hasPrivilege('502022032383620003')
c412a802   wuxw   优化采购申请
110
                    " @click="_openDeletePurchaseApplyModel(scope.row)">
1cad66ad   wuxw   完成采购申请
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
                      {{ $t('purchaseApplyManage.button.cancelApply') }}
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
              <el-pagination class="margin-top" :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>
      </div>
  
      <view-image ref="viewImage" />
      <edit-purchase-apply ref="editPurchaseApply" />
      <delete-purchase-apply ref="deletePurchaseApply" />
    </div>
  </template>
  
  <script>
  import { listPurchaseApplys, exportData, getWorkflowImage } from '@/api/resource/purchaseApplyManageApi'
  import { getDict } from '@/api/community/communityApi'
  import { getCommunityId } from '@/api/community/communityApi'
  import ViewImage from '@/components/system/viewImage'
  import EditPurchaseApply from '@/components/resource/editPurchaseApply'
  import DeletePurchaseApply from '@/components/resource/deletePurchaseApply'
  
  export default {
    name: 'PurchaseApplyManageList',
    components: {
      ViewImage,
      EditPurchaseApply,
      DeletePurchaseApply
    },
    data() {
      return {
        loading: false,
        purchaseApplyManageInfo: {
          purchaseApplys: [],
          total: 0,
          records: 1,
          moreCondition: false,
          states: [],
          currentUserId: '',
          conditions: {
            state: '',
            applyOrderId: '',
            userName: '',
            name: '',
            resOrderType: '10000',
            resName: '',
            startTime: '',
            endTime: '',
            userId: '',
            communityId: ''
          }
        },
        page: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    created() {
      this.purchaseApplyManageInfo.currentUserId = ''
      this.purchaseApplyManageInfo.conditions.userId = ''
      this.purchaseApplyManageInfo.conditions.communityId = getCommunityId()
      this._listPurchaseApplys(this.page.current, this.page.size)
      this.getDictData()
    },
    methods: {
      async getDictData() {
        try {
          const data = await getDict('purchase_apply', 'state')
          this.purchaseApplyManageInfo.states = [
            {
              statusCd: '',
              name: this.$t('common.all')
            },
            ...data
          ]
        } catch (error) {
          console.error('获取字典数据失败:', error)
        }
      },
      async _listPurchaseApplys(page, size) {
        this.loading = true
        try {
          const params = {
            ...this.purchaseApplyManageInfo.conditions,
            page,
            row: size
          }
          const { purchaseApplys, total } = await listPurchaseApplys(params)
          this.purchaseApplyManageInfo.purchaseApplys = purchaseApplys
          this.page.total = total
        } catch (error) {
          console.error('获取采购申请列表失败:', error)
        } finally {
          this.loading = false
        }
      },
      _openAddPurchaseApplyModal() {
        this.$router.push({
          path: '/views/resource/addPurchaseApply',
          query: {
            resOrderType: this.purchaseApplyManageInfo.conditions.resOrderType
          }
        })
      },
      _openUrgentPurchaseApplyModal() {
        this.$router.push({
          path: '/views/resource/urgentPurchaseApplyStep',
          query: {
            resOrderType: this.purchaseApplyManageInfo.conditions.resOrderType
          }
        })
      },
      _openDetailPurchaseApplyModel(purchaseApply) {
        this.$router.push({
          path: '/views/resource/purchaseApplyDetail',
          query: {
            applyOrderId: purchaseApply.applyOrderId,
            resOrderType: '10000'
          }
        })
      },
      _openDeletePurchaseApplyModel(purchaseApply) {
        this.$refs.deletePurchaseApply.open(purchaseApply)
      },
      _queryPurchaseApplyMethod() {
        this.page.current = 1
        this._listPurchaseApplys(this.page.current, this.page.size)
      },
      _resetInspectionPlanMethod() {
        this.purchaseApplyManageInfo.conditions = {
          ...this.purchaseApplyManageInfo.conditions,
          applyOrderId: '',
          name: '',
          resName: '',
          startTime: '',
          endTime: ''
        }
        this._listPurchaseApplys(this.page.current, this.page.size)
      },
      async _openRunWorkflowImage(purchaseApply) {
        try {
          const params = {
            businessKey: purchaseApply.applyOrderId,
            communityId: getCommunityId()
          }
          const { data } = await getWorkflowImage(params)
          this.$refs.viewImage.open({
            url: 'data:image/png;base64,' + data
          })
        } catch (error) {
          console.error('获取流程图失败:', error)
        }
      },
      async _exportExcel() {
        try {
          const params = {
            ...this.purchaseApplyManageInfo.conditions,
            pagePath: 'purchaseApplyManage'
          }
          await exportData(params)
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
278
          this.$message.success(this.$t('common.operationSuccess'))
b4962701   wuxw   测试采购相关功能
279
          this.$router.push('/pages/property/downloadTempFile?tab=下载中心')
1cad66ad   wuxw   完成采购申请
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
315
316
317
318
319
320
        } catch (error) {
          console.error('导出失败:', error)
        }
      },
      swatchState(item) {
        this.purchaseApplyManageInfo.conditions.state = item.statusCd
        this._listPurchaseApplys(this.page.current, this.page.size)
      },
      handleSizeChange(val) {
        this.page.size = val
        this._listPurchaseApplys(this.page.current, this.page.size)
      },
      handleCurrentChange(val) {
        this.page.current = val
        this._listPurchaseApplys(this.page.current, this.page.size)
      },
  
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .purchase-apply-manage-container {
    padding: 20px;
  
    .margin-top {
      margin-top: 20px;
    }
  
    .padding-r-0 {
      padding-right: 0;
    }
  
    .border-radius {
      border-radius: 4px;
    }
  
    .margin-xs-r {
      margin-right: 5px;
    }
  
c412a802   wuxw   优化采购申请
321
    
1cad66ad   wuxw   完成采购申请
322
323
  }
  </style>