tanghaolin
2022-09-01 f904bd0c38237262f2f2fcee4ed8d2291d533c30
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
<template>
  <div>
    <van-collapse v-model="activeNames">
      <van-collapse-item :title="$t('detailPage.parameter.TR')">
        <div style="display: flex; margin-top: 0.1rem">
          <van-col :span="6">
            <div class="table_box">
              <div class="content2 table_head" style="border-top: 1px solid #e9e9e9">{{$t('detailPage.parameter.TR')}}</div>
            </div>
          </van-col>
          <van-col :span="12">
            <div class="table_box">
              <div class="content2 table_head" style="border-top: 1px solid #e9e9e9">{{$t('detailPage.data.TR')}}</div>
            </div>
          </van-col>
          <van-col :span="6">
            <div class="table_box">
              <div class="content3 table_head" style="border-top: 1px solid #e9e9e9">{{$t('detailPage.unit.TR')}}</div>
            </div>
          </van-col>
        </div>
        <div
          style="display: flex; flex-direction: column"
          v-for="(
            mainParas_item, mainParas_index
          ) in paraTable4Disp.nodeList"
          :key="'searchTable' + mainParas_index"
        >
          <div style="width: 100%">
            <van-col :span="24" style="display: flex; width: 100%">
              <van-col :span="6">
                <div class="table_box">
                  <div class="content2">{{ mainParas_item.Name }}</div>
                </div>
              </van-col>
              <van-col :span="12" style="display: flex">
                <div class="table_box">
                  <div class="content2" v-if="mainParas_item.IsEditAble">
                  <van-field v-if="mainParas_item.Tag == 'RequestPointH'" v-model="mainParas_item.Value" label />
                    <span
                      @click.stop="clickGridRowRefreshByDp"
                      v-if="mainParas_item.Tag == 'RequestPointH'"
                      class="el-icon-refresh-right refresh_style"
                    ></span>
                    <van-field
                      v-else-if="mainParas_item.Tag == 'MotorPower'"
                      readonly
                      clickable
                      style="text-align:center"
                      name="picker"
                      @click="showMotorValueComboxPicker(mainParas_index,mainParas_item)"
                    >
                      <template slot="input">
                        <div
                          style="text-decoration: underline;color: blue;width: 100%;text-align: center;font-size:12px;"
                        >{{mainParas_item.Value}}</div>
                      </template>
                    </van-field>
                    <van-field v-else v-model="mainParas_item.Value" label />
                    <van-popup
                      v-model="mainParas_item.isShowPicker"
                      position="bottom"
                    >
                      <van-picker
                        show-toolbar
                        :columns="getMotorValueList(mainParas_index)"
                        @confirm="onConfirmMotorValuChange"
                        @cancel="onCancelMotorValuChange"
                      />
                    </van-popup>
                  </div>
                  <div class="content2" v-else>{{ mainParas_item.Value }}</div>
                </div>
              </van-col>
              <van-col :span="6" style="display: flex">
                <div class="table_box">
                  <div class="content3">{{ mainParas_item.UnitName }}</div>
                </div>
              </van-col>
            </van-col>
          </div>
        </div>
      </van-collapse-item>
    </van-collapse>
  </div>
</template>
<script>
import UnitHelper from "@/utils/unit";
import languageMixin from "@/mixin/language";
export default {
  mixins: [languageMixin],
  data() {
    return {
        show:true,
      activeNames: ["1"],
      m_chartType: 0,
      paraTable4Disp: {}, //参数选型
      MainParaItemList: [], //参数选型列表
 
      unitSetting: {
        Q: UnitHelper.Default.Q,
        H: UnitHelper.Default.H,
        P: UnitHelper.Default.P
      } //默认单位
    };
  },
  methods: {
    //获取初始化
    initPumpInfoData(val) {
      //
      let pumpInfoData = val;
      if (pumpInfoData.SettingInfo == null) {
        return;
      }
      if (pumpInfoData.MainParaItemList == null) {
        return;
      }
      let _this = this;
 
      _this.ChartType = pumpInfoData.BaseInfo.ChartType;
      //console.log(_this.ChartType, 697);
      _this.unitSetting.Q = pumpInfoData.SettingInfo.UnitQ;
      _this.unitSetting.H = pumpInfoData.SettingInfo.UnitH;
      _this.unitSetting.P = pumpInfoData.SettingInfo.UnitP;
 
      _this.buildTable(pumpInfoData.MainParaItemList);
    },
    buildTable(mainParaItemList) {
      if (mainParaItemList == null) {
        return;
      }
      let _this = this;
      _this.MainParaItemList = mainParaItemList;
      //   console.log(mainParaItemList, "mainParaItemList");
        let langType = _this.getCurrentLanguageUrl();
      let pointTable = {};
      pointTable.title = `${this.$t("detailPage.parameterSelection.TR")}`;
      pointTable.isShow = true;
      pointTable.nodeList = [];
      for (let i = 0; i < mainParaItemList.length; i++) {
        let node = mainParaItemList[i];
       //判断当前是不是英文
        if(langType == "EN"){
          node.Name = _this.getTranslateString(node.Name)
        }
        if (node.Tag == "RequestPointQ") {
          node.userUnit = UnitHelper.Q_Value_List;
        } else if (node.Tag == "RequestPointH") {
          node.userUnit = UnitHelper.H_Value_List;
        } else {
          node.userUnit = [];
        }
        if (node.Tag == "MotorPower") {
          node.Value = parseFloat(node.Value);
          //将电机功率的值传给属性
          this.$emit("cbChangeMotorPower", parseFloat(node.Value));
        }
        //console.log(node, 602);
        pointTable.nodeList.push(node);
      }
    //   console.log(pointTable, 661);
    pointTable.nodeList.forEach(item=>{
        item.isShowPicker = false
    })
      this.paraTable4Disp = pointTable
    //   console.log(this.paraTable4Disp,158)
    },
    //修改设计点参数后 刷新
    refreshPumpInfoData(val) {
      //
      let _this = this;
      var mainParaItemList = val.MainParaItemList;
      for (var i = 0; i < mainParaItemList.length; i++) {
        var item = mainParaItemList[i];
        //console.log(item, 602);
        if (item.Tag == "WrkD2") {
          if (item.Value != null)
            item.Value = parseFloat(item.Value).toFixed(1);
        }
        _this.setMainParaItemValue(item.Tag, item.Value);
      }
    },
    //外部获取选型参数
    getDesignParas() {
      let obj = {};
      let nodeList = this.paraTable4Disp.nodeList;
      nodeList.forEach(item => {
        if (item.Tag == "RequestPointQ") {
          //流量
          obj.DpQ = item.Value;
          obj.DpQu = item.Unit;
        }
        if (item.Tag == "RequestPointH") {
          //扬程
          obj.DpH = item.Value;
          obj.DpHu = item.Unit;
        }
        if (item.Tag == "WrkSpeed") {
          //转速
          obj.WrkSpeed = item.Value;
        }
        if (item.Tag == "WrkD2") {
          //叶轮外径
          obj.WrkD2 = item.Value;
        }
      });
      return obj;
    },
    //点击刷新参数
    clickGridRowRefreshByDp() {
      //产品属性等信息变化后刷新图表等信息
      let dp = this.getDesignParas();
      //回调父窗体函数
      this.$emit("cbRefreshByDp", dp);
      //console.log(canShuXuanxing, obj);
      //if (this.cbRefreshByDp != null)
      //  this.cbRefreshByDp(obj);
    },
    //设置值
    setMainParaItemValue(tag, value) {
      var mainParaItemList = this.MainParaItemList;
      for (var i = 0; i < mainParaItemList.length; i++) {
        var item = mainParaItemList[i];
        if (item.Tag == tag) {
          item.Value = value;
          //console.log(item,380);
        }
      }
      this.MainParaItemList = mainParaItemList;
 
      var paraTable4Disp = this.paraTable4Disp;
      for (var i = 0; i < paraTable4Disp.nodeList.length; i++) {
        var item = paraTable4Disp.nodeList[i];
        if (item.Tag == tag) {
          item.Value = value;
          //console.log(item,390);
        }
      }
      this.paraTable4Disp = paraTable4Disp;
    },
    showMotorValueComboxPicker(index,item) {
      this.currentShowPicker = [index]
      item.isShowPicker = !item.isShowPicker
 
      this.$set(this.paraTable4Disp.nodeList, index, item)
    },
    getMotorValueList(index) {
      let list = this.paraTable4Disp.nodeList[index].Range;
      if (!list) {
        list = [];
      }
      return list;
    },
    //监听电机值选择
    onConfirmMotorValuChange(value) {
      let i = this.currentShowPicker[0];
      this.paraTable4Disp.nodeList[i].Value = value;
      this.paraTable4Disp.nodeList[i].isShowPicker = false;
      // console.log(value,252)
      this.$emit("cbChangeMotorPower", value);
    },
    //监听取消选择
    onCancelMotorValuChange() {
      let i = this.currentShowPicker[0];
      this.paraTable4Disp.nodeList[i].isShowPicker = false;
    },
    //翻译
    getTranslateString(cn) {
      //if (m_localizationType == 0)
      //    return cn;
      if (cn == "流量") return "Flow";
      else if (cn == "压力") return "Press";
      else if (cn == "扬程") return "Head";
      else if (cn == "效率") return "Eta";
      else if (cn == "功率") return "Power";
      else if (cn == "转速") return "Speed";
      else if (cn == "叶轮外径") return "Impeller Dia";
      else if (cn == "电机功率") return "Motor Power";
      else return cn;
    },
  }
};
</script>
<style lang="scss">
.table_box {
  width: 99%;
  height: 30px;
  display: flex;
  border-left: 1px solid #e9e9e9 !important;
  border-bottom: 1px solid #e9e9e9 !important;
  .content2 {
    position: relative;
    width: 100%;
    height: 100%;
    line-height: 30px;
    text-align: center;
    background-color: #fff;
    border-top: 1px solid #e9e9e9 !important;
    // border-right: 1px solid #e9e9e9;
    border-bottom: 1px solid #e9e9e9 !important;
    color: #000000;
    font-size: 12px;
    .van-cell {
      padding: 0;
      line-height: 30px;
      input {
        text-align: center;
        font-size: 12px;
      }
    }
  }
  .content3 {
    width: 100%;
    height: 100%;
    line-height: 30px;
    text-align: center;
    background-color: #fff;
    border-top: 1px solid #e9e9e9 !important;
    border-right: 1px solid #e9e9e9 !important;
    border-bottom: 1px solid #e9e9e9 !important;
    color: #000000;
    font-size: 12px;
  }
  .table_head {
    border-top: 1px solid #e9e9e9 !important;
    border-bottom: 1px solid #e9e9e9 !important;
  }
  .refresh_style {
    display: inline-block;
    font-size: 22px;
    color: rgb(64, 158, 255);
    font-weight: bold;
    position: absolute;
    right: 5px;
    top: 4px;
  }
}
.van-hairline--top-bottom::after,
.van-hairline-unset--top-bottom::after {
  border: unset;
}
</style>