zhaoxiaoqiang1
2026-01-04 f1d30d03186c79ca2cbcfe60d6d2ce7d73fba97b
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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
<template>
  <div class="list_main">
    <SearchCondition
      :info="formItems"
      ref="condRef"
      :conForm="conForm"
      :isShowDetail="isShowDetail"
      :screenWidth="screenWidth"
      @handleOnSeach="handleOnSeach"
      @handleOnRest="handleOnRest"
      @handleClick="isShowDetail = !isShowDetail"
    />
    <div />
    <el-row class="add-button">
      <el-col :span="24">
        <el-button
          type="primary"
          size="small"
          icon="el-icon-circle-plus-outline"
          @click="handleAddPage"
          class="add-btn"
          >新增产品</el-button
        >
      </el-col>
    </el-row>
    <ProTable
      :pageInfo="pageInfo"
      @doAction="doAction"
      @handleCurrentChange="handleCurrentChange"
      @handleSizeChange="handleSizeChange"
      :isAutoIndex="true"
      :list="records"
      :header="tableHeader"
      :loading="loading"
    />
    <el-dialog
      :title="cancelTitle"
      :visible.sync="cancelDialogVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :destroy-on-close="true"
      width="500"
      center
      custom-class="pricing_dialog del_dialog"
    >
      <div>{{ cancelDialogContent }}</div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancelDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="handleSure">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="复制产品确认"
      :visible.sync="copyDialogVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :destroy-on-close="true"
      :show-close="false"
      width="500"
      center
      custom-class="pricing_dialog copy_dialog"
    >
      <CreateForms
        ref="copyPro"
        v-if="copyDialogVisible"
        :screenWidth="1280"
        :formItems="copyFormItems"
        :defValues="copyDefValues"
        :formRules="copyFormRules"
      />
      <span slot="footer" class="dialog-footer">
        <el-button @click="copyDialogVisible = false" :disabled="btnLoading"
          >取 消</el-button
        >
        <el-button
          type="primary"
          :loading="btnLoading"
          @click="copyDialogSubmit"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>
 
<script>
import { PRODUCTLISTITEMS, PRODUCTLISTDEF } from "../utils/condtionConfig";
import { PRODUCTMANAGECOLUMN } from "../utils/columnConfig";
import { COPYPROFORM } from "../utils/formsConfig";
import { COPYPRODEFVALUE } from "../utils/defValueConfig";
import { COPYPRORULES } from "../utils/formRulesConfig";
import {
  qryProductListInManager,
  qryCondition,
  qryQryProductDetailParams,
  cancelProductApply,
  productFlowReset,
  productChangeApply,
  productReapply,
  copyProduct
} from "../api/productManage.api";
import ProTable from "../components/ProTable.vue";
import CreateForms from "../components/CreateForms.vue";
import SearchCondition from "../components/SearchCondition.vue";
 
export default {
  data() {
    return {
      formItems: [...PRODUCTLISTITEMS],
      copyFormItems: [...COPYPROFORM],
      copyDefValues: { ...COPYPRODEFVALUE },
      copyFormRules: { ...COPYPRORULES },
      restFormItems: [...PRODUCTLISTITEMS],
      tableHeader: [...PRODUCTMANAGECOLUMN],
      conForm: { ...PRODUCTLISTDEF },
      pageInfo: {
        currentPage: 1,
        pageSize: 10,
        total: 0
      },
      records: [],
      newTypeno: "",
      screenWidth: document.body.offsetWidth,
      cancelTitle: "取消申请确认",
      condtionValue: {}, // 表单value集合
      isShowDetail: false, // 是否显示所有表单项
      loading: false,
      btnLoading: false,
      copyDialogVisible: false,
      cancelDialogVisible: false,
      cancelDialogContent: "",
      openAddPage: false // 打开新增产品管理页面
    };
  },
  components: {
    SearchCondition,
    ProTable,
    CreateForms
  },
  created() {
    // 当前阶段:phaseNo
    // 产品类型:ProductCode
    // 产品状态:EffStatus
    const opyionItems = [
      { name: "currentphasename", code: "phaseNo" },
      { name: "producttype", code: "ProductCode" },
      { name: "productstatus", code: "EffStatus" }
    ];
    opyionItems.forEach(item => {
      this.getCondition(item.name, item.code);
    });
  },
  mounted() {
    window.addEventListener("resize", this.getScreenWidth);
    this.$router.afterEach((to, from, next) => {
      window.scrollTo(0, 0);
    });
    this.getProductList();
  },
  destroyed() {
    window.removeEventListener("resize", this.getScreenWidth);
  },
  methods: {
    /**
     * 获取下拉选择项
     */
    async getCondition(name, conditionName) {
      const params = { conditionName };
      const re = await qryCondition(params);
      if (re.code && re.code === "00") {
        const options = re.result;
        this.setOrGetFormInfo(name, { options }, "settingDef");
      }
    },
    getScreenWidth() {
      this.$set(this, "screenWidth", document.body.offsetWidth);
    },
    // 弹框确认事件
    handleSure() {
      const clickAll = {
        取消申请确认: this.cancelProductApply,
        撤回申请确认: this.recallProductFlow,
        变更申请确认: this.changeProductApply,
        重新申请确认: this.reapplyProduct
      };
      clickAll[this.cancelTitle]();
    },
    // 获取产品列表
    async getProductList() {
      const { currentPage, pageSize } = this.pageInfo;
      const {
        currentphasename,
        endEffecttime,
        endFailuretime,
        productstatus,
        producttype,
        startFailuretime,
        starteEffecttime,
        typename,
        typeno
      } = this.condtionValue;
      const loading = this.$loading({
        lock: true,
        text: "",
        background: "hsla(0,0%,100%,.9)"
      });
      setTimeout(() => {
        loading.close();
      }, 1500);
      const params = {
        currentPage,
        pageSize,
        currentphaseno: currentphasename,
        effectTimeSearch: {
          begintime: starteEffecttime,
          endtime: endEffecttime
        },
        failureTimeSearch: {
          begintime: startFailuretime,
          endtime: endFailuretime
        },
        productstatus,
        producttype,
        typename,
        typeno
      };
      const res = await qryProductListInManager(params);
      loading.close();
      if (res.code && res.code === "00") {
        this.$set(this, "records", res.result && res.result.records);
        this.$set(this.pageInfo, "total", res.result && res.result.total);
      }
    },
    // 更新表单数据或查找某项数据
    setOrGetFormInfo(nameKey, newInfo, def) {
      const { formItems, restFormItems } = this;
      const index = formItems.findIndex(({ name }) => name === nameKey);
      let result = {};
      if (!isNaN(index)) {
        this.$set(this.formItems, index, { ...formItems[index], ...newInfo });
        if (def) {
          this.$set(this.restFormItems, index, {
            ...restFormItems[index],
            ...newInfo
          });
        }
        result = this.formItems[index];
      }
      if (typeof newInfo === "undefined") {
        return result;
      }
    },
 
    // 搜索列表
    handleOnSeach() {
      const conRef = this.$refs.condRef;
      this.$set(this, "condtionValue", conRef.$refs["conform"].model);
      this.$set(this, "pageInfo", { currentPage: 1, pageSize: 10, total: 0 });
      this.getProductList();
    },
 
    // 获取筛选条件value
    setValueInfo(condtions) {
      this.$set(this, "condtionValue", condtions);
    },
 
    // 重置
    handleOnRest(proListForm) {
      this.$set(this, "condtionValue", {});
      // this.$set(this, 'pageInfo', { currentPage: 1, pageSize: 10, total: 0 })
      // this.getProductList()
    },
    // 产品复制
    async copyDialogSubmit() {
      const copyProForm = this.$refs.copyPro;
      copyProForm.$refs["createForm"].validate(async valid => {
        if (valid) {
          const { newtypeno, typename } = copyProForm.formValues;
          const params = {
            newtypeno,
            oldtypeno: this.newTypeno,
            typename
          };
          this.btnLoading = true;
          const loading = this.$loading({
            lock: true,
            text: "正在复制,请耐心等待!",
            background: "hsla(0,0%,100%,.9)"
          });
          this.cancelDialogVisible = false;
          setTimeout(() => {
            loading.close();
          }, 30000);
          const copyRes = await copyProduct(params);
          loading.close();
          this.copyDialogVisible = false;
          this.btnLoading = false;
          if (!copyRes || copyRes.code !== "00") {
            return false;
          }
          this.$router.push({
            name: "editProduct",
            query: {
              type: "edit",
              serialno: copyRes.result.serialno,
              objecttype: copyRes.result.objecttype,
              productid: copyRes.result.typeno
            }
          });
          // this.getProductList()
        } else {
          this.$message.error("请输入产品信息!");
          return false;
        }
      });
    },
    // 产品变更
    async changeProductApply() {
      const params = { typeNo: this.newTypeno };
      const loading = this.$loading({
        lock: true,
        text: "正在变更,请耐心等待!",
        background: "hsla(0,0%,100%,.9)"
      });
      this.cancelDialogVisible = false;
      setTimeout(() => {
        loading.close();
      }, 30000);
      const changeRes = await productChangeApply(params);
      loading && loading.close();
      if (!changeRes || changeRes.code !== "00") {
        return false;
      }
      this.getProductList();
      this.cancelDialogVisible = false;
      this.$router.push({
        name: "editProduct",
        query: {
          type: "edit",
          serialno: changeRes.result.serialno,
          objecttype: changeRes.result.objecttype,
          productid: changeRes.result.typeno
        }
      });
    },
    // 取消申请
    async cancelProductApply() {
      const params = { typeno: this.newTypeno };
      const cancelRes = await cancelProductApply(params);
      if (!cancelRes || cancelRes.code !== "00") {
        return false;
      }
      this.getProductList();
      this.cancelDialogVisible = false;
    },
    // 重新申请
    async reapplyProduct() {
      const params = { typeNo: this.newTypeno };
      const reapplyRes = await productReapply(params);
      if (!reapplyRes || reapplyRes.code !== "00") {
        return false;
      }
      this.cancelDialogVisible = false;
      this.getProductList();
      this.$router.push({
        name: "editProduct",
        query: {
          type: "edit",
          serialno: reapplyRes.result.serialno,
          objecttype: reapplyRes.result.objecttype,
          productid: reapplyRes.result.typeno
        }
      });
    },
    // 撤回申请
    async recallProductFlow() {
      const params = { typeno: this.newTypeno };
      const cancelRes = await productFlowReset(params);
      if (!cancelRes && cancelRes.code !== "00") {
        return false;
      }
      this.getProductList();
      this.cancelDialogVisible = false;
    },
    // 表单事件回调
    async doAction(name, item, { key, label }) {
      if (key === "details") {
        const param = {
          clicktype: "1",
          searchtype: "1",
          serialno: "",
          typeno: item.typeno
        };
        const listPam = await this.qryQryProductDetailParams(param);
        this.$router.push({
          name: "productDetail",
          query: {
            serialno: listPam.serialno,
            productid: listPam.typeno,
            objecttype: listPam.objecttype
          }
        });
        return false;
      }
      if (key === "cancel") {
        this.newTypeno = item.typeno;
        this.cancelTitle = "取消申请确认";
        this.cancelDialogVisible = true;
        const applyType = {
          "jbo.app.BUSINESS_TYPE": "准入",
          "jbo.app.BUSINESS_TYPE_CHANGE": "变更"
        };
        this.cancelDialogContent = `请确认是否需要取消${item.typeno}${
          item.typename
        }的${applyType[item.objecttype]}申请`;
        return false;
      }
      if (key === "withdraw") {
        this.cancelTitle = "撤回申请确认";
        this.newTypeno = item.typeno;
        this.cancelDialogVisible = true;
        const applyType = {
          "jbo.app.BUSINESS_TYPE": "准入",
          "jbo.app.BUSINESS_TYPE_CHANGE": "变更"
        };
        this.cancelDialogContent = `请确认是否需要撤回${item.typeno}${
          item.typename
        }的${applyType[item.objecttype]}申请`;
        return false;
      }
      if (key === "change") {
        this.cancelTitle = "变更申请确认";
        this.newTypeno = item.typeno;
        this.cancelDialogVisible = true;
        this.cancelDialogContent = `请确认是否需要变更${item.typeno}${item.typename}的申请`;
        return false;
      }
      if (key === "reset") {
        this.cancelTitle = "重新申请确认";
        this.newTypeno = item.typeno;
        this.cancelDialogVisible = true;
        const applyType = {
          "jbo.app.BUSINESS_TYPE": "准入",
          "jbo.app.BUSINESS_TYPE_CHANGE": "变更"
        };
        this.cancelDialogContent = `请确认是否需要重新申请${item.typeno}${
          item.typename
        }的${applyType[item.objecttype]}申请`;
        return false;
      }
      if (key === "copy") {
        this.newTypeno = item.typeno;
        this.copyDefValues = { ...COPYPRODEFVALUE };
        this.copyDialogVisible = true;
        return false;
      }
      if (key === "modify") {
        const param = {
          clicktype: "0",
          searchtype: "1",
          serialno: "",
          typeno: item.typeno
        };
        const listPam = await this.qryQryProductDetailParams(param);
        this.$router.push({
          name: "editProduct",
          query: {
            type: "edit",
            serialno: listPam.serialno,
            objecttype: listPam.objecttype,
            productid: listPam.typeno
          }
        });
      }
    },
    // 获取产品详情参数
    async qryQryProductDetailParams(param) {
      const res = await qryQryProductDetailParams(param);
      if (!res || res.code !== "00") {
        return "";
      }
      return res.result;
    },
    // 新增产品管理
    handleAddPage() {
      this.$router.push({ name: "NewProduct", query: { isNew: "new" } });
    },
    // 修改翻页条数
    handleSizeChange(val) {
      this.pageInfo.pageSize = val;
      this.getProductList();
    },
 
    // 修改翻页数
    handleCurrentChange(val) {
      this.pageInfo.currentPage = val;
      this.getProductList();
    }
  }
};
</script>
 
<style lang="stylus" scoped>
.list_main {
  padding: 16px 0px 0 20px;
  & >>> .pricing_dialog {
    width: 500px;
    & .el-dialog__footer {
      & .dialog-footer {
        & .el-button--default {
          width: 120px;
          height: 30px;
          line-height: 7px;
          border-radius: 4px;
          border: 1px solid rgba(204, 204, 204, 1);
        }
        & .el-button--primary {
          width: 120px;
          height: 30px;
          line-height: 7px;
          background: #0081f0;
          border-color: #0081f0;
          border-radius: 4px;
          margin-left: 40px;
        }
      }
    }
  }
  & >>> .copy_dialog {
    width: 950px;
  }
  & >>> .del_dialog {
    width: 450px;
    & .el-dialog__body {
      text-align: center;
    }
  }
  & .add-button {
    padding: 2px 0 30px 0;
  }
}
</style>