jinlin
2024-12-02 18f682f736914e427070b9bb769df538ad9f6d1c
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
<template>
  <zt-dialog ref="dialog" column="2" append-to-body title="评定数据管理" :editAble="false" :hasConfirm="false">
    <el-form :inline="true" label-width="100px" :model="dataForm">
      <el-form-item label="总体节点" prop="shipName" style="width: 26%">
        <el-input v-model="dataForm.shipName" :readonly="true"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" size="small" style="margin-left:20px;font-size: 15px" @click="exportData()">下载数据模板
        </el-button>
        <el-button type="primary" @click="add()">新增</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="assessData" border highlight-current-row
              :header-cell-style="{'text-align':'center'}">
      <el-table-column prop="name" label="评定数据名称" align="center"/>
      <el-table-column width="100">
        <template v-slot="{row}">
          <zt-table-button type="primary" @click="updateAssess(row)">修改</zt-table-button>
          <zt-table-button type="primary" @click="deleteAssess(row)">删除</zt-table-button>
        </template>
      </el-table-column>
    </el-table>
    <add-or-update @refreshDataList="refreshData" ref="addOrUpdate"/>
  </zt-dialog>
</template>
 
<script>
  import addOrUpdate from "./RelisbilityAssess-AddOrUpdate";
 
  export default {
    name: 'assess-Manage',
    data() {
      return {
        dataForm: {
          shipName: '',
          name: '',
          productId: ''
        },
        assessData: [],
        productList: [],
      }
    },
    components: {
      addOrUpdate
    },
    methods: {
      async init(id, param) {
        this.dataForm.productId = param.productId
        this.dataForm.shipName = param.shipName
        this.getAssessDataList()
      },
      refreshData(){
        this.getAssessDataList()
      },
      async getAssessDataList() {
        let params = {
          productId: this.dataForm.productId
        }
        let res = await this.$http.get(`/taskReliability/ReliabilityAssess/getAssessDataList`, {params: params})
        if (res.success) {
          this.assessData = res.data
        }
      },
      add() {
        this.$refs.addOrUpdate.$refs.dialog.init(null, {
          productId: this.dataForm.productId,
          shipName: this.dataForm.shipName
        })
      },
      updateAssess(row) {
        this.$refs.addOrUpdate.$refs.dialog.init(row.id, {
          productId: row.productId,
          shipName: this.dataForm.shipName,
          name: row.name
        })
      },
      async deleteAssess(row) {
        let params = {
          id: row.id
        }
        let res = await this.$http.get(`/taskReliability/ReliabilityAssess/delete`, {params: params})
        if (res.success) {
          this.getAssessDataList()
        }
      },
      exportData() {
        window.location.href = './评定数据导入模板.xlsx'
      },
    }
  }
</script>