jinlin
2024-08-06 e9d48b14eb8496737495a659a6f126d88ef7d353
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
<template>
  <zt-dialog ref="dialog" column="2" title="选择通用模型" append-to-body :editAble="false" :hasConfirm="true"
             @confirm="formSubmit">
    <el-card shadow="never" class="aui-card--fill">
      <div class="mod-tyProductModel-tyProductModel}">
        <zt-table-wraper :query-url=url
                         :paging='false'
                         v-slot="{ table }">
          <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()">
          </el-form>
          <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px" v-adaptive="{bottomOffset:70}"
                    border
                    @selection-change="changeRow">
            <el-table-column type="selection" width="40" align="center"/>
            <el-table-column prop="name" label="名称"/>
            <zt-table-column-dict v-if="!pageCode" prop="nodeType" label="节点类型" dict="product"/>
            <zt-table-column-dict v-else prop="productType" label="节点类型" dict="product"/>
            <el-table-column prop="sort" label="排序"/>
          </el-table>
        </zt-table-wraper>
      </div>
    </el-card>
  </zt-dialog>
</template>
 
<script>
  export default {
    name: 'SelectTyModel',
    data() {
      return {
        url: '/basicInfo/TyProductModel/page',
        selectList: [],
        data: '',
        dataForm: {
          type: 'noTree',
          nodeType: '',
          shipId:'',
          id: '',
          pid: '',
          name: '',
          namePath: '',
          operationalStatus: '',
          standbyState: '',
          faultState: '',
          sort: ''
        }
      }
    },
    components: {},
    methods: {
      init(id, params) {
        this.dataForm.nodeType = params.type
        this.dataForm.pid = params.id
        this.dataForm.shipId =params.shipId
        this.dataForm.namePath =params.namePath
        console.log(params, 'init()')
      },
      changeRow(selection) {
        console.log(selection, ' changeRow(selection)')
        let item = {}
        for (item of selection) {
          item.pid = this.dataForm.pid
          item.namePath = this.dataForm.namePath
          item.shipId = this.dataForm.shipId
        }
        this.selectList = selection
      },
      async formSubmit() {
        let res = await this.$http.post('/basicInfo/XhProductModel/get', this.selectList)
        if (res.success) {
          await this.$tip.success()
          this.$refs.dialog.close()
          this.$emit('refreshDataList')
        }
      }
    }
  }
</script>