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
<template>
  <a-card :bordered="false">
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="detailTable"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">
      </a-table>
    </div>
    <!-- table区域-end -->
 
  </a-card>
</template>
 
<script>
  import '@/assets/less/TableExpand.less'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { getAction } from '@api/manage'
 
  export default {
    name: 'EamMaintenanceStandardDetailList',
    mixins: [JeecgListMixin],
    props: {
      standardId: {
        type: String,
        required: true,
        default: '-1'
      }
    },
    data() {
      return {
        description: '保养标准明细管理页面',
        // 表头
        columns: [
          {
            title: '序号',
            align: 'center',
            dataIndex: 'itemCode',
            width: 60
          },
          {
            title: '部位',
            align: 'center',
            dataIndex: 'itemPart',
            ellipsis: true
          },
          {
            title: '保养项分类',
            align: 'center',
            dataIndex: 'itemCategory_dictText',
            ellipsis: true
          },
          {
            title: '保养项目',
            align: 'center',
            dataIndex: 'itemName',
            ellipsis: true
          },
          {
            title: '保养规范或要求',
            align: 'center',
            dataIndex: 'itemDemand',
            ellipsis: true
          }
        ],
        url: {
          list: '/eam/eamMaintenanceStandardDetail/list'
        }
      }
    },
    watch: {
      standardId: {
        immediate: true,
        handler(val) {
          if (val) {
            this.loadData(1)
          } else {
            this.clearList()
          }
        }
      }
    },
    created() {
    },
    computed: {},
    methods: {
      loadData(arg) {
        if (!this.url.list) {
          this.$message.error('请设置url.list属性!')
          return
        }
        if (this.standardId && this.standardId === '-1') {
          this.clearList()
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1
        }
        let params = this.getQueryParams()//查询条件
        if (!params) {
          return false
        }
        this.dataSource = []
        params.standardId = this.standardId
        this.loading = true
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            // console.log(res)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            this.dataSource = res.result.records || res.result
            if (res.result.total) {
              this.ipagination.total = res.result.total
            } else {
              this.ipagination.total = 0
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          } else {
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading = false
        })
      },
      clearList() {
        this.dataSource = []
        this.selectedRowKeys = []
        this.ipagination.current = 1
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>