Blame view

src/views/resource/storehouseManageList.vue 8.96 KB
66eb78ed   wuxw   开发采购功能
1
2
3
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
  <template>
    <div class="storehouse-manage-container">
      <el-row>
        <el-col :span="24">
          <el-card class="box-card">
            <div slot="header" class="flex justify-between">
              <div>{{ $t('storehouseManage.searchTitle') }}</div>
            </div>
            <el-form :model="conditions" label-width="auto" class="search-form">
              <el-row :gutter="20">
                <el-col :span="6">
                  <el-form-item>
                    <el-input v-model="conditions.shName" :placeholder="$t('storehouseManage.placeholders.shName')" />
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item>
                    <el-select v-model="conditions.isShow" :placeholder="$t('storehouseManage.placeholders.isShow')"
                      style="width:100%">
                      <el-option :label="$t('storehouseManage.options.all')" value=""></el-option>
                      <el-option :label="$t('storehouseManage.options.yes')" value="true"></el-option>
                      <el-option :label="$t('storehouseManage.options.no')" value="false"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item>
                    <el-input v-model="conditions.shId" :placeholder="$t('storehouseManage.placeholders.shId')" />
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item>
                    <el-button type="primary" @click="queryStorehouseMethod">
                      <i class="el-icon-search"></i>
                      {{ $t('storehouseManage.buttons.search') }}
                    </el-button>
                    <el-button @click="resetStorehouseMethod">
                      <i class="el-icon-refresh"></i>
                      {{ $t('storehouseManage.buttons.reset') }}
                    </el-button>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </el-card>
        </el-col>
      </el-row>
  
      <el-row class="margin-top">
        <el-col :span="24">
          <el-card class="box-card">
            <div slot="header" class="flex justify-between">
              <div>{{ $t('storehouseManage.listTitle') }}</div>
              <div style="float: right;">
                <el-button type="primary" size="small" @click="openAddStorehouseModal"
                  v-if="hasPrivilege('502021101638940007')">
                  <i class="el-icon-plus"></i>
                  {{ $t('storehouseManage.buttons.add') }}
                </el-button>
              </div>
            </div>
            <el-table :data="storehouses" border style="width:100%">
              <el-table-column prop="shId" :label="$t('storehouseManage.table.shId')" align="center" />
              <el-table-column prop="shName" :label="$t('storehouseManage.table.shName')" align="center" />
              <el-table-column :label="$t('storehouseManage.table.isShow')" align="center">
                <template slot-scope="scope">
47b8eddb   wuxw   优化完成 平凉客户反馈bug
67
68
                  {{ scope.row.isShow === 'true' ? $t('storehouseManage.options.yes') : $t('storehouseManage.options.no')
                  }}
66eb78ed   wuxw   开发采购功能
69
70
71
72
73
74
75
76
77
78
                </template>
              </el-table-column>
              <el-table-column :label="$t('storehouseManage.table.allowPurchase')" align="center">
                <template slot-scope="scope">
                  {{ scope.row.allowPurchase === 'ON' ? $t('storehouseManage.options.yes') :
                    $t('storehouseManage.options.no') }}
                </template>
              </el-table-column>
              <el-table-column :label="$t('storehouseManage.table.allowUse')" align="center">
                <template slot-scope="scope">
47b8eddb   wuxw   优化完成 平凉客户反馈bug
79
80
                  {{ scope.row.allowUse === 'ON' ? $t('storehouseManage.options.yes') : $t('storehouseManage.options.no')
                  }}
66eb78ed   wuxw   开发采购功能
81
82
83
84
                </template>
              </el-table-column>
              <el-table-column :label="$t('storehouseManage.table.purchaseSwitch')" align="center">
                <template slot-scope="scope">
47b8eddb   wuxw   优化完成 平凉客户反馈bug
85
86
                  {{ scope.row.purchaseSwitch === 'ON' ? scope.row.purchaseFlowName :
                    $t('storehouseManage.options.noAudit')
66eb78ed   wuxw   开发采购功能
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
                  }}
                </template>
              </el-table-column>
              <el-table-column :label="$t('storehouseManage.table.useSwitch')" align="center">
                <template slot-scope="scope">
                  {{ scope.row.useSwitch === 'ON' ? scope.row.useFlowName : $t('storehouseManage.options.noAudit') }}
                </template>
              </el-table-column>
              <el-table-column :label="$t('storehouseManage.table.allocationSwitch')" align="center">
                <template slot-scope="scope">
                  {{ scope.row.allocationSwitch === 'ON' ? scope.row.allocationFlowName :
                    $t('storehouseManage.options.noAudit') }}
                </template>
              </el-table-column>
              <el-table-column prop="createTime" :label="$t('storehouseManage.table.createTime')" align="center" />
              <el-table-column :label="$t('storehouseManage.table.shDesc')" align="center">
                <template slot-scope="scope">
                  {{ scope.row.shDesc && scope.row.shDesc !== '-1' ? scope.row.shDesc : '--' }}
                </template>
              </el-table-column>
              <el-table-column :label="$t('storehouseManage.table.operations')" align="center" fixed="right" width="250">
                <template slot-scope="scope">
                  <el-button v-if="hasPrivilege('502021101197710001')" size="mini" type="primary"
                    @click="openEditStorehouseModel(scope.row)">
                    {{ $t('storehouseManage.buttons.edit') }}
                  </el-button>
                  <el-button v-if="hasPrivilege('502021122129210001')" size="mini" type="danger"
                    @click="openDeleteStorehouseModel(scope.row)">
                    {{ $t('storehouseManage.buttons.delete') }}
                  </el-button>
                  <el-button size="mini" @click="openDetailStorehouseModel(scope.row)">
                    {{ $t('storehouseManage.buttons.detail') }}
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
47b8eddb   wuxw   优化完成 平凉客户反馈bug
123
124
125
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
              :current-page="currentPage" :page-sizes="[10, 20, 30, 50]" :page-size="pageSize"
              layout="total, sizes, prev, pager, next, jumper" :total="total" class="pagination">
66eb78ed   wuxw   开发采购功能
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
            </el-pagination>
          </el-card>
        </el-col>
      </el-row>
  
      <!-- 组件 -->
      <add-storehouse ref="addStorehouse" @success="listStorehouses" />
      <edit-storehouse ref="editStorehouse" @success="listStorehouses" />
      <delete-storehouse ref="deleteStorehouse" @success="listStorehouses" />
    </div>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import { listStorehouses } from '@/api/resource/storehouseManageApi'
  import AddStorehouse from '@/components/resource/AddStorehouse'
  import EditStorehouse from '@/components/resource/EditStorehouse'
  import DeleteStorehouse from '@/components/resource/DeleteStorehouse'
  
  export default {
    name: 'StorehouseManageList',
    components: {
      AddStorehouse,
      EditStorehouse,
      DeleteStorehouse
    },
    data() {
      return {
        currentPage: 1,
        pageSize: 10,
        total: 0,
        conditions: {
          shName: '',
          isShow: '',
          shId: '',
          communityId: ''
        },
        storehouses: []
      }
    },
    created() {
      this.conditions.communityId = getCommunityId()
      this.listStorehouses()
    },
    methods: {
      async listStorehouses() {
        try {
          const params = {
            page: this.currentPage,
            row: this.pageSize,
            ...this.conditions
          }
          const response = await listStorehouses(params)
          this.storehouses = response.data
          this.total = response.total
        } catch (error) {
          this.$message.error(this.$t('storehouseManage.messages.fetchError'))
        }
      },
      queryStorehouseMethod() {
        this.currentPage = 1
        this.listStorehouses()
      },
      resetStorehouseMethod() {
        this.conditions = {
          shName: '',
          isShow: '',
          shId: '',
          communityId: getCommunityId()
        }
        this.queryStorehouseMethod()
      },
      handleSizeChange(size) {
        this.pageSize = size
        this.listStorehouses()
      },
      handleCurrentChange(page) {
        this.currentPage = page
        this.listStorehouses()
      },
      openAddStorehouseModal() {
        this.$refs.addStorehouse.open()
      },
      openEditStorehouseModel(row) {
        this.$refs.editStorehouse.open(row)
      },
      openDeleteStorehouseModel(row) {
        this.$refs.deleteStorehouse.open(row)
      },
      openDetailStorehouseModel(row) {
        this.$router.push(`/pages/common/resourceStoreManage?shId=${row.shId}&flag=1`)
      },
    }
  }
  </script>
  
  <style scoped>
  .storehouse-manage-container {
    padding: 20px;
  }
  
  .search-form {
    margin-bottom: -20px;
  }
  
  .pagination {
    margin-top: 20px;
    text-align: right;
  }
  </style>