tanghaolin
2022-07-28 62aa8e0f0b366bc131309b72e1350d800d30be72
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
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<template>
  <div class="product-box" v-myTitle="{ title: m_Title }">
    <!-- 头部导航栏 -->
    <van-nav-bar style="background-color: #528abe">
      <template #left>
        <div @click="pageBack" style="display: flex; align-items: center">
          <van-icon name="arrow-left" size="18" />
          <span>{{$t('selectPage.index.TR')}}</span>
        </div>
      </template>
      <template #title>
        <label>{{$t('indexPage.byType.TR')}}</label>
      </template>
      <template #right>
        <!-- <van-icon name="search" size="18" /> -->
      </template>
    </van-nav-bar>
    <!-- 下拉过滤菜单 -->
    <van-dropdown-menu active-color="#528abe">
      <van-dropdown-item ref="CatalogType" :title="m_selectCatalogName">
        <van-cell
          center
          v-for="item in m_catalogSelectOption"
          @click="getCatalogSelectValue(item)"
          :key="item.value"
          :title="item.text"
        >
          <template #title>
            <span class="custom-title">{{ item.text }}</span>
            <van-tag
              style="margin-left: 5px"
              color="#528abe"
              round
              type="primary"
              >{{ item.nodeNum }}</van-tag
            >
          </template>
          <template #right-icon>
            <van-icon
              name="success"
              :color="item.value == m_catalogSelectValue ? '#528abe' : ''"
              v-show="item.value == m_catalogSelectValue"
            />
          </template>
        </van-cell>
      </van-dropdown-item>
      <van-dropdown-item :title="$t('ebookPage.screen.TR')" ref="item">
        <van-cell left :title="$t('ebookPage.motorFrequency.TR')">
          <template #right-icon>
            <span style="margin-right: 10px"
              >{{ m_MotorFrequece ? "60" : "50" }}Hz</span
            >
            <van-switch
              v-model="m_MotorFrequece"
              size="24"
              active-color="#528abe"
            />
          </template>
        </van-cell>
        <van-cell left title="UL">
          <template #right-icon>
            <van-switch v-model="m_isUL" size="24" active-color="#528abe" />
          </template>
        </van-cell>
        <van-cell left :title="$t('indexPage.firePump.TR')">
          <template #right-icon>
            <van-switch
              v-model="m_isFirePump"
              size="24"
              active-color="#528abe"
            />
          </template>
        </van-cell>
        <div style="padding: 5px 16px">
          <van-button color="#528abe" block round @click="getFilterValue"
            >{{$t('header.define.TR')}}</van-button
          >
        </div>
      </van-dropdown-item>
    </van-dropdown-menu>
    <!-- 公司标题 -->
    <div style="width: 100%">
      <!-- <img
        src="/static/img/Title.png"
        style="max-width: 100%; max-height: 100%; width: auto; height: 65px"
      /> -->
 
      <!-- <img src style="max-width: 100%; max-height: 100%; width: auto; height: 10px" /> -->
    </div>
    <!-- 显示内容 -->
    <div class="product-main">
      <van-cell-group
        :title="group_item.groupName"
        v-for="group_item in m_showPumpList"
        :key="group_item.groupName"
      >
        <van-cell
          v-for="item in group_item.nodeList"
          clickable
          is-link
          title-style="color:#000000 !important;margin-left:5px !important"
          :key="item.ID"
          :title="item.Name"
          @click="goPumpDetail(item.ID)"
        >
          <template #icon>
            <van-image :src="item.ThumbnailImage" width="80" height="45" />
          </template>
        </van-cell>
      </van-cell-group>
    </div>
  </div>
</template>
 
<script>
import languageMixin from "@/mixin/language";
export default {
  mixins: [languageMixin],
  data() {
    return {
      m_Title: "",
      m_activeNames: ["2"], //默认展开的项
      m_CatalogList: [], //类型列表
      m_pumpList: [], //泵列表
      m_showPumpList: [], //用于展示的泵列表
 
      m_MotorFrequece: false, //电机功率 默认50Hz 如果为true则表示60Hz
      m_isUL: false, //是否是UL
      m_isFirePump: false, //是否是消防泵
      m_selectCatalogName: "全部",
      m_catalogSelectValue: 0, //类型默认选择全部
      m_catalogSelectOption: [
        //类型选择列表
        { text: "全部", value: 0 },
      ],
    };
  },
  created() {},
  mounted() {
        this.m_selectCatalogName = `${this.$t('ebookPage.all.TR')}`,
    this.m_catalogSelectOption[0].text = `${this.$t('ebookPage.all.TR')}`
    let _this = this;
    _this.m_Title = _this.getSoftName();;
    _this.getCatalogList(function () {
      _this.getSeriesList();
    });
  },
  methods: {
    //获取产品列表
    getSeriesList() {
      let _this = this;
      let Toast = this.$toast;
      Toast.loading({
        duration: 0, //为0时 不关闭toast框
        message: "加载中...",
        forbidClick: true,
      });
      _this
        .$axios({
          methods: "get",
          url:
            _this.$globalConfig.WebApiUrl.MainUrl +
            "v1/Mobile/PumpSeries/GetAllBaseInfoList",
        })
        .then(function (res) {
          // console.log(res);
 
          let result = res.data;
          if (result.Code != 0) {
            return;
          }
          if (result.Data) {
            Toast.clear();
            let pumpList = [];
            result.Data.forEach((item) => {
              let productItem = {
                CatalogID: item.CatalogID,
                ID: item.ID,
                CatalogName: item.CatalogName,
                Name: item.Name,
                KingName: item.KingName,
                ChartType: item.ChartType,
                ThumbnailImage:
                  _this.$globalConfig.WebApiUrl.FileUrl + item.ThumbnailImage,
                Version: item.Version,
                RealFileName: item.RealFileName,
                WordDescription: item.WordDescription.replace(/<br\/>/g, "\n"),
                ShortDescription: item.ShortDescription.replace(
                  /<br\/>/g,
                  "\n"
                ),
                MotorFrequece: item.MotorFrequece,
                DriveType: item.DriveType,
                FirePumpType: item.FirePumpType,
              };
              pumpList.push(productItem);
            });
            _this.m_pumpList = pumpList;
            //  console.log( _this.m_pumpList,178)
            let motorFrequece = _this.m_MotorFrequece ? "60" : "50";
            // console.log(motorFrequece,_this.m_catalogSelectValue,"电机频率和类型")
            _this.m_showPumpList = _this.filterSeriseList(
              motorFrequece,
              _this.m_catalogSelectValue
            );
            // console.log(_this.m_showPumpList,181)
            _this.getCatalogNodeNum();
          }
        })
        .catch(function (err) {
          Toast.clear();
          console.log(err);
        });
    },
    //获取类型列表
    getCatalogList(cbGetSeries) {
      let _this = this;
      _this
        .$axios({
          methods: "get",
          url:
            _this.$globalConfig.WebApiUrl.MainUrl +
            "v1/Mobile/PumpCatalog/GetAllBaseInfoList",
          params: {
            lang: 0,
          },
        })
        .then(function (res) {
          // console.log(res,"类型列表");
          let result = res.data;
          if (result.Code != 0) {
            return;
          }
          if (result.Data) {
            _this.m_CatalogList = result.Data;
            _this.m_activeNames.push(result.Data[0].ID);
            result.Data.forEach((item) => {
              let catalogOption = {
                text: item.Name,
                value: item.ID,
              };
              _this.m_catalogSelectOption.push(catalogOption);
            });
 
            // _this.getSeriesList();
            cbGetSeries();
          }
        })
        .catch(function (err) {
          console.log(err);
        });
    },
    //获取类型下拉菜单选择的值
    getCatalogSelectValue(item) {
      this.m_catalogSelectValue = item.value;
      this.m_selectCatalogName = item.text;
      let motorFrequece = this.m_MotorFrequece ? "60" : "50";
      this.m_showPumpList = this.filterSeriseList(motorFrequece, item.value);
      this.$refs.CatalogType.toggle();
    },
    //获取电机功率的值
    getFilterValue() {
      this.$refs.item.toggle();
      //console.log(val,777)
      let motorFrequece = this.m_MotorFrequece ? "60" : "50";
      this.m_showPumpList = this.filterSeriseList(
        motorFrequece,
        this.m_catalogSelectValue
      );
      this.getCatalogNodeNum();
    },
    //跳转到详情
    goPumpDetail(ID) {
      this.$router.push({
        path: `/${this.$getCurrentLanguageUrl()}/EBook/SeriesDetailPump`,
        query: { ID: ID },
      });
    },
    //筛选系列列表
    filterSeriseList(MotorFrequece, CatalogID) {
      // console.log(MotorFrequece,CatalogID,"筛选方法中的电机频率和类型")
      let showSeriesArr = [];
      let showCatalogArr = [];
 
      if (CatalogID == 0) {
        // console.log(this.m_CatalogList,this.m_pumpList,"类型列表和本列表")
        this.m_CatalogList.forEach((item) => {
          let groupItem = {};
          groupItem.groupName = "";
          groupItem.nodeList = [];
          this.m_pumpList.forEach((seriesItem) => {
            //判断类型是否是全部
            if (
              item.Name == seriesItem.CatalogName &&
              seriesItem.MotorFrequece == MotorFrequece
            ) {
              // console.log('111111')
              groupItem.groupName = item.Name;
              groupItem.nodeList.push(seriesItem);
            }
          });
          // console.log(22222)
          showSeriesArr.push(groupItem);
        });
        // console.log(showSeriesArr,279)
      } else {
        this.m_CatalogList.forEach((item) => {
          if (item.ID == CatalogID) {
            showCatalogArr.push(item);
          }
        });
        showCatalogArr.forEach((item) => {
          let groupItem = {};
          groupItem.groupName = "";
          groupItem.nodeList = [];
          this.m_pumpList.forEach((seriesItem) => {
            //判断类型是否是全部
            if (
              CatalogID == seriesItem.CatalogID &&
              seriesItem.MotorFrequece == MotorFrequece
            ) {
              // console.log(CatalogID, seriesItem.CatalogID);
              groupItem.groupName = item.Name;
              groupItem.nodeList.push(seriesItem);
            }
          });
          showSeriesArr.push(groupItem);
        });
      }
      return showSeriesArr;
    },
    getCatalogNodeNum() {
      this.m_catalogSelectOption.forEach((catalog) => {
        let growNum = 0;
        if (catalog.value != 0) {
          catalog.nodeNum = 0;
        }
        this.m_showPumpList.forEach((series) => {
          series.nodeList.forEach((node) => {
            if (catalog.value == node.CatalogID && catalog.value != 0) {
              growNum++;
              catalog.nodeNum = growNum;
            }
          });
        });
      });
    },
    //返回上一页
    pageBack() {
      this.$router.push({
        path: `/${this.$getCurrentLanguageUrl()}/Index`,
      });
    },
  },
};
</script>
 
<style lang="scss">
@import url("../../assets/css/page.css");
.product-box {
  background: #fafafa;
  width: 100%;
  height: 100vh;
 
  .van-dropdown-item__content {
    max-height: 34%;
  }
  .van-cell__title {
    text-align: start;
  }
  .product-main {
    width: 100%;
    height: calc(100% - 95px);
    overflow: auto;
    .van-cell {
      color: #528abe;
    }
    .van-cell__right-icon {
      color: #528abe;
    }
    .van-collapse-item__content {
      padding: 0px 0px;
    }
    .van-card__content {
      text-align: start;
      width: calc(100% - 88px);
    }
    .van-card__title {
      font-size: 14px;
      font-weight: 600;
    }
    .van-card {
      padding: 0px 0px;
      width: 100%;
      background-color: #ffffff;
    }
    .van-cell {
      padding: 0px 16px;
    }
    .van-card__desc {
      color: #aaaaaa;
      width: 235px;
      height: 50px;
    }
    .van-cell {
      color: #528abe;
    }
    .van-cell__right-icon {
      color: #006782;
    }
    .van-cell {
      padding: 10px 16px !important;
      align-items: center;
    }
    .van-cell-group__title {
      padding: 7px 16px 7px !important;
      text-align: left;
      background: #aaaaaa;
      font-weight: 600;
      color: #000000;
    }
    .van-cell__title,
    .van-cell__value {
      text-align: left;
      font-size: 13px;
      color: #36489e;
      font-weight: 600;
    }
  }
}
</style>