Blame view

yanshouban/src/views/stockControl/stocksForewarn/index.vue 10.1 KB
6ee6b0b7   杨鑫   '最新'
1
2
3
4
5
6
  <!--  -->
  <template>
    <div class="pending">
      <div class="tab_show">
        <div class="" style="font-weight: 600;font-size: 12px;margin-bottom: 15px;display: flex;justify-content: space-between;">
          <div style="">库存预警</div>
b12ba7ef   杨鑫   '最新'
7
          <!-- <el-button  plain @click="setthreshold" size="mini" style="background-color: #3F9B6A;color: #fff;">库存阈值设置</el-button> -->
6ee6b0b7   杨鑫   '最新'
8
9
10
11
12
13
14
15
16
17
18
19
20
21
        </div>
        <!-- 搜索 -->
         <div class="filter-container">
           <div style="display:flex;justify-content: space-between;background-color: #f5f5f5;padding:10px">
            <div style="line-height:200%">筛选查询</div>
            <div>
              <button @click="toggleFilter">收起筛选</button>
              <el-button  plain @click="search" size="mini" style="background-color: #3F9B6A;color: #fff;">查询</el-button>
              <el-button plain @click="resetting" size="mini" style="color: #000;border-color:#d5d5d5;">重置</el-button>
            </div>
           </div>
           <div :class="fut?'formSearch':'collapsed'" ref="formSearch">
              <el-form :inline="true" :model="formSel" label-width="auto">
                <el-form-item label="商品名称">
341f183e   杨鑫   '最新'
22
                  <el-input v-model="formSel.productName" placeholder="请输入方案编号" size="mini" style="width: 178px;margin-right: 5px;"/>
6ee6b0b7   杨鑫   '最新'
23
                </el-form-item>
341f183e   杨鑫   '最新'
24
                <!-- <el-form-item label="入库人">
6ee6b0b7   杨鑫   '最新'
25
                  <el-input v-model="formSel.rkr" placeholder="请输入方案编号" size="mini" style="width: 178px;margin-right: 5px;"/>
341f183e   杨鑫   '最新'
26
                </el-form-item> -->
b12ba7ef   杨鑫   '最新'
27
                <!-- <el-form-item label="上架时间">
341f183e   杨鑫   '最新'
28
29
30
31
32
33
34
35
                   <el-date-picker
                        v-model="formSel.createTime"
                        type="datetime"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        prefix-icon="none"
                        style="width: 178px;margin-right: 5px;"
                        placeholder="选择日期时间">
                      </el-date-picker>
b12ba7ef   杨鑫   '最新'
36
                </el-form-item> -->
341f183e   杨鑫   '最新'
37
                <!-- <el-form-item label="入库时间">
6ee6b0b7   杨鑫   '最新'
38
                  <el-input v-model="formSel.rtime" placeholder="请输入方案编号" size="mini" style="width: 178px;margin-right: 5px;"/>
341f183e   杨鑫   '最新'
39
                </el-form-item> -->
6ee6b0b7   杨鑫   '最新'
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
                </el-form>
                </div>
          </div>
          <div style="background-color: #f5f5f5;padding:10px;margin-top: 20px;">
           <div style="line-height:200%;font-size: 12px;">数据列表</div>
          </div>
        <!-- 表格 -->
        <div class="tableBox">
          <el-table
            ref="multipleTable"
            v-loading="loading"
            :data="tableData"
            border
            tooltip-effect="dark"
             @selection-change="handleSelectionChange"
          :header-cell-style="{fontSize: '12px', backgroundColor: '#FAFAFA',color:'#000',fontWeight: 'normal'}"
            style="width: 100%;font-size:12px;"
          >
  
            <el-table-column
              prop="productId"
              label="商品id"
              show-overflow-tooltip
             min-width="8%"
            />
            <el-table-column label="商品主图" width="150" align="center">
              <template slot-scope="scope">
                <img height="80" width="80" :src="scope.row.image" alt srcset>
              </template>
            </el-table-column>
            <el-table-column prop="productName" label="商品名称" min-width="10%" />
            <el-table-column
              prop="stockNumber"
              label="属性"
              show-overflow-tooltip
              min-width="8%">
            <template slot-scope="scope">
              属性:1
              </template>
                </el-table-column>
            <el-table-column
              prop="stockNumber"
              label="库存数量"
              show-overflow-tooltip
              min-width="8%"
            />
            <el-table-column
              prop="stockNumber"
              label="预警状态"
              show-overflow-tooltip
              min-width="8%">
             <template slot-scope="scope">
               {{scope.row.stockNumber > kucunNum.minNum ?'充足': '低于最低值'}}
               </template>
                </el-table-column>
            <el-table-column
              prop=""
              label="补货信息"
              show-overflow-tooltip
              min-width="8%"
            />
  
          </el-table>
          <div class="fenye">
            <el-pagination
              :current-page="currentPage"
              :page-sizes="[5, 10, 20, 50, 100]"
              :page-size="10"
              layout="prev, pager, next,total, sizes,  jumper"
              :total="total"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
            />
          </div>
        </div>
      </div>
      <div class="setclass">
        <el-dialog
          title="阈值设置"
          :visible.sync="dialogVisible"
          width="30%"
          :show-close="false"
          :close-on-click-modal="false"
          :before-close="handleClose">
          <div class="formyuzhi">
            <el-form :inline="true" :model="kucunNum" label-width="auto" label-position="left">
              <el-form-item label="最小库存阈值">
                <el-input v-model="kucunNum.minNum" placeholder="请输入" size="mini" style="width: 100%;"/>
              </el-form-item>
              <el-form-item label="最大库存阈值">
                <el-input v-model="kucunNum.maxNum" placeholder="请输入" size="mini" style="width: 100%;"/>
              </el-form-item>
              <el-form-item label="安全库存量">
                <el-input v-model="kucunNum.anNum" placeholder="请输入" size="mini" style="width: 100%;"/>
              </el-form-item>
              </el-form>
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button plain @click="handleClose" size="mini" style="color: #000;border-color:#d5d5d5;">取消</el-button>
        <el-button  plain @click="kucunSet" size="mini" style="background-color: #3F9B6A;color: #fff;">确定</el-button>
  
          </span>
        </el-dialog>
      </div>
    </div>
  </template>
  
  <script>
    import {
      getClassifyGetAll,
      Forced,
      // setFictitious,
      examine,
      productExport
    } from '@/api/commodity';
    import{
      setThreshold,
      inventoryAlert
    } from '@/api/stocksForewarn'
  import { async } from 'q';
  export default {
    data () {
      // 这里存放数据
      return {
        activeName: 'first',
        kucunNum:{
          minNum:'',
          maxNum:'',
          anNum:'',
        },
        formSel:{
341f183e   杨鑫   '最新'
171
172
173
174
     productName:'',
     createTime:'',
     page: 1,
     pageSize: 10
6ee6b0b7   杨鑫   '最新'
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
        },
        formInline: {
          searchType: '1',
          search: '', // 搜索字段
          state: '',
          // afterState: '', // 售后状态 0-无售后 1-售后中 2-售后成功 3-售后关闭
          dates: [], // 下单时间数组
          page: 1,
          shopName: '',
          pageSize: 10
        },
        fut:true,
        total: 1,
        tableData: [],
        tableLoading: false,
        dialogVisible:false
      }
    },
    // 生命周期 - 挂载完成(可以访问DOM元素)
    mounted() {
      this.getAll(this.formInline)
    },
    // 方法集合
    methods: {
      toggleFilter(){
        this.fut = !this.fut
      },
      handleSizeChange (val) {
        this.formInline.pageSize = val
        this.getAll(this.formInline)
      },
      handleCurrentChange (val) {
        this.formInline.page = val
        this.getAll(this.formInline)
      },
      //  查询
      search () {
341f183e   杨鑫   '最新'
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
        this.total = 1;
        this.formSel.page = 1;
        this.getAll(this.formSel);
      },
      resetting(){
        this.formSel = {
        productName:'',
        createTime:'',
        page: 1,
        pageSize: 10
           }
           this.formInline =  {
             searchType: '1',
             search: '', // 搜索字段
             state: '',
             // afterState: '', // 售后状态 0-无售后 1-售后中 2-售后成功 3-售后关闭
             dates: [], // 下单时间数组
             page: 1,
             shopName: '',
             pageSize: 10
           }
             this.getAll(this.formInline)
6ee6b0b7   杨鑫   '最新'
234
235
236
      },
     async kucunSet(){
       const yuzhi={
b12ba7ef   杨鑫   '最新'
237
238
239
         minimumInventoryThresho:this.kucunNum.minNum,
         maximumInventoryThresho:this.kucunNum.maxNum,
         safetystock:this.kucunNum.anNum
6ee6b0b7   杨鑫   '最新'
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
278
279
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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
       }
       await setThreshold(yuzhi)
        this.dialogVisible = false
      },
      // 初始化查询所有数据
      async getAll (formInline) {
        this.tableLoading = true
       const res = await getClassifyGetAll(formInline);
       console.log(res.data)
       this.loading = false;
       this.total = res.data.total;
       this.tableData = res.data.list;
      },
      setthreshold(){
        this.dialogVisible = true
      },
       handleClose() {
  this.dialogVisible = false
        }
  
    }
  }
  </script>
  <style lang='scss' scoped>
  .pending{
    padding-left: 15px;
  }
  .tab_show{
    padding-top: 10px;
    padding-left: 10px;
    padding-right: 10px;
    background-color: #fff;
  }
  .filter-container {
  font-size:12px;
  border:1px solid #EBEEF5;
  
  }
  .formSearch{
    padding: 0 20px;
      height: 60px; /* 或者你想要的任何高度 */
      /* 过渡效果 */
      transition: height 0.3s ease-in-out; /* 动画的持续时间、类型 */
      overflow: hidden; /* 隐藏溢出的内容,这样高度变化时内容不会显示出来 */
  
  }
  .collapsed {
    padding: 0 10px;
    margin-top: 0px;
    height: 0;
      transition: height 0.3s ease-in-out; /* 动画的持续时间、类型 */
      overflow: hidden; /* 隐藏溢出的内容,这样高度变化时内容不会显示出来 */
  }
  ::v-deep .collapsed{
    .el-form--inline .el-form-item{
          margin-top: 10px;
      margin-right:20px;
      margin-bottom:0px;
    }
    .el-form-item__label{
      font-size:12px;
    }
  }
  ::v-deep .formSearch{
    .el-form--inline .el-form-item{
        margin-top: 10px;
      margin-right:20px;
      margin-bottom:0px;
    }
    .el-form-item__label{
      font-size:12px;
    }
  }
  .fenye {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
  }
  ::v-deep .setclass{
    .el-dialog__header{
      background-color:#fff;
    }
    .el-dialog__title{
       color:#000;
           font-size: 12px;
    }
  }
  ::v-deep .formyuzhi{
    .el-form--inline .el-form-item{
       margin-bottom:0px;
       width:100%
    }
  
    .el-form-item__content{
      width:75%
    }
    .el-form-item__label{
      font-weight: 400;
      font-size: 12px;
    }
  
  
  }
   ::v-deep .el-dialog__body{
       padding: 0 20px;
     }
  </style>