马宇豪
2025-04-23 34ec919649adfefeecd0418284dd7b02e9ed49b8
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
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
<template>
    <div class="app-container">
        <div class="filter-container">
            <div class="basic_search">
                <span>区域:</span>
                <el-select v-model="listQuery.filter.provinceCode" clearable filterable
                           @change="changeArea('province')">
                    <el-option
                        v-for="item in provinceList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.code"
                    >
                    </el-option>
                </el-select>
            </div>
            <div class="basic_search">
                <el-select v-model="listQuery.filter.cityCode" prop="city" clearable filterable
                           @change="changeArea('city')">
                    <el-option
                        v-for="item in cityList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.code"
                    >
                    </el-option>
                </el-select>
            </div>
            <div class="basic_search">
                <el-select v-model="listQuery.filter.areaCode" clearable filterable>
                    <el-option
                        v-for="item in districtList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.code"
                    >
                    </el-option>
                </el-select>
            </div>
            <div class="basic_search" style="margin-right: 10px;padding-top: 10px">
                <span>企业名称:</span>
                <el-input v-model.trim="listQuery.filter.companyName" style="width: 300px"/>
            </div>
            <div class="basic_search" style="margin-right: 10px">
                <el-button style="margin-left: 10px;" type="primary" @click="reset()">重置</el-button>
                <el-button style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="search()">查询
                </el-button>
            </div>
        </div>
        <div class="table_content">
            <el-table
                v-loading="listLoading"
                :data="dataList"
                border
                :stripe="false"
                style="width: 100%;"
            >
                <el-table-column label="行政区划" align="center">
                    <template slot-scope="scope">
                        {{ scope.row.provinceName}}
                    </template>
                </el-table-column>
                <el-table-column label="企业名称" prop="companyName" align="center"></el-table-column>
                <el-table-column label="仓库名称" prop="storeName" align="center"></el-table-column>
                <el-table-column label="仓库编号" prop="storeNum" align="center"></el-table-column>
                <el-table-column label="面积/㎡" prop="acreage" align="center"></el-table-column>
                <el-table-column label="危险等级" prop="dangerLevel" align="center">
                    <template slot-scope="scope">
                        {{ scope.row.dangerLevel == '1'?'1.1级库房':scope.row.dangerLevel == '2'?'1.3级库房': '无药库房'}}
                    </template>
                </el-table-column>
                <el-table-column label="核定药量/kg" prop="dosage" align="center"></el-table-column>
                <el-table-column label="核定人员" prop="personLimit" align="center"></el-table-column>
                <el-table-column label="创建人" prop="createBy" align="center"></el-table-column>
                <el-table-column label="修改人" prop="updateBy" align="center"></el-table-column>
                <el-table-column label="创建时间" prop="createDate" align="center"></el-table-column>
                <el-table-column label="修改时间" prop="updateDate" align="center"></el-table-column>
                <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width"
                                 fixed="right">
                    <template slot-scope="scope">
                        <el-button type="text" @click="openStock(scope.row)">查看</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <br>
            <div style="display: flex;justify-content: right">
                <el-pagination
                    v-show="recordTotal>0"
                    :current-page="currentPage"
                    :page-sizes="[10, 20, 30, 50]"
                    :page-size="listQuery.pageSize"
                    :total="recordTotal"
                    layout="total, sizes, prev, pager, next, jumper"
                    background
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                />
            </div>
            <add-stock ref="addStock"></add-stock>
        </div>
    </div>
</template>
 
<script>
import {computePageCount} from "../../../utils";
import addStock from "./components/addStock"
// import deliverUsage from "./components/deliverUsage"
// import stockRecords from "./components/stockRecords"
// import editStock from "./components/editStock"
// import enterpriseStock from "./components/enterpriseStock"
import Cookies from "js-cookie"
import {getOriginalPerson, getStorePageList} from "../../../api/monitorAlert";
import {getCityListData, getProvinceListData} from "../../../api/area";
 
export default {
    name: "stockManage",
    components: {addStock},
    data() {
        return {
            tableKey: '',
            recordTotal: 0,
            currentPage: 1,
            provinceList: [],
            cityList: [],
            districtList: [],
            areaListQuery: {},
            Cookies: Cookies,
            listLoading: false,
            dataList: [],
            isAdmin: false,
            listQuery: {
                filter: {
                    companyCode: '',
                    companyName: '',
                    provinceCode: '',
                    cityCode: '',
                    areaCode: ''
                },
                pageIndex: 1,
                pageSize: 10
            }
        }
    },
    created() {
        const t = this
        t.getDataList()
        t.getProvince()
        const roles = JSON.parse(Cookies.get('roles'))
        if (roles.find(i => i.name == '管理员' || i.name == '监管部门')) {
            this.isAdmin = true
        } else {
            this.isAdmin = false
        }
    },
    mounted() {
    },
    watch: {},
    methods: {
        handleSizeChange: function (val) {
            this.listQuery.pageSize = val
            this.getDataList()
        },
        handleCurrentChange: function (val) {
            this.listQuery.pageIndex = val
            this.getDataList()
        },
        reset() {
            this.listQuery = {
                filter: {
                    companyCode: '',
                    companyName: '',
                    provinceCode: '',
                    cityCode: '',
                    areaCode: ''
                },
                pageIndex: 1,
                pageSize: 10
            }
            this.cityList = []
            this.districtList = []
            this.getDataList()
        },
        search() {
            this.listQuery.pageIndex = 1
            this.getDataList()
        },
        async getProvince() {
            let res = await getProvinceListData()
            if (res.data.code === "200") {
                this.provinceList = res.data.result.provinceList
            }
        },//获取省
        async changeArea(value) {
            if (value === 'province') {
                this.listQuery.filter.cityCode = ''
                this.listQuery.filter.areaCode = ''
                this.areaListQuery = {
                    type: 2,
                    parenttype: 1,
                    parentname: this.provinceList.find(i => i.code == this.listQuery.filter.provinceCode).name
                }
                let res = await getCityListData(this.areaListQuery)
                if (res.data.code === "200") {
                    this.cityList = res.data.result
                }
            } else {
                this.listQuery.filter.areaCode = ''
                this.areaListQuery = {
                    type: 3,
                    parenttype: 2,
                    parentname: this.cityList.find(i => i.code == this.listQuery.filter.cityCode).name
                }
                let res = await getCityListData(this.areaListQuery)
                if (res.data.code === "200") {
                    this.districtList = res.data.result
                }
            }
        },//市、镇、街道、委员会
        async getDataList() {
            const res = await getStorePageList(this.listQuery)
            if (res.data.code === "200") {
                const data = res.data.result
                if (Array.isArray(data.records)) {
                    this.dataList = data.records
                    this.recordTotal = data.total
                    this.currentPage = data.current
                } else {
                    this.dataList = []
                }
            } else {
                this.$message({
                    type: 'warning',
                    message: res.data.message
                })
            }
            this.listLoading = false
        },
 
        openStock(data) {
            const t = this
            t.$refs.addStock.open(data)
        },
        openRecord(row) {
            const t = this
            t.$refs.stockRecords.open(row)
        },
        showEnterprises(row) {
            const t = this
            t.$refs.enterStock.open(row, '管理')
        },
        deliverUsage(row) {
            const t = this
            t.$refs.deliverUsage.open(row)
        },
 
        stockEdit(row) {
            const t = this
            t.$refs.editStock.open(row)
 
        }
    },
}
</script>
<style>
.el-table .hovered-row {
    background: #f5f7fa;
}
</style>
<style scoped>
.basic_search {
    display: inline-block;
}
 
/deep/ .el-table .el-table__body-wrapper table tr:nth-child(2n) td {
    background: #fff !important;
}
</style>