Blame view

src/views/workflow/components/InformationTable.vue 4.15 KB
liangyifan committed
1 2
<template>
  <div>
3
    <lb-table :column="column" border :maxHeight="300" heightNumSetting :pagination="false" :key="key" :data="tableDataList">
任超 committed
4
    </lb-table>
任超 committed
5
    <addQlr v-model="dialog" :details="details" @updateDetail="updateDetail" />
liangyifan committed
6 7 8
  </div>
</template>
<script>
任超 committed
9
import addQlr from './addQlr.vue'
任超 committed
10
import { mapGetters } from 'vuex'
1  
liangyifan committed
11
export default {
任超 committed
12 13 14
  components: {
    addQlr
  },
任超 committed
15 16 17
  computed: {
    ...mapGetters(["dictData"]),
  },
任超 committed
18 19 20
  props: {
    tableData: {
      type: Array,
任超 committed
21 22 23
      default: function () {
        return []
      }
任超 committed
24 25 26 27
    },
    gyfs: {
      type: String,
      default: '1'
任超 committed
28 29
    }
  },
1  
liangyifan committed
30 31
  data () {
    return {
任超 committed
32
      key: 0,
任超 committed
33
      dataIndex: 0,
任超 committed
34
      dialog: false,
任超 committed
35
      details: {},
任超 committed
36
      tableDataList: [],
任超 committed
37 38
      InformationTable: [
        {
任超 committed
39
          width: '50',
liangyifan committed
40
          renderHeader: (h, scope) => {
任超 committed
41
            return <div> {
42
              this.$route.query.viewtype == 1 ? '序号' : <i class="el-icon-plus pointer" onClick={() => { this.addClick() }}></i>
任超 committed
43 44
            }
            </div>
liangyifan committed
45 46 47
          },
          render: (h, scope) => {
            return (
任超 committed
48 49 50
              <div>
                {
                  this.$route.query.viewtype == 1 ? <span>{scope.$index + 1}</span> :
51
                    <i class="el-icon-minus pointer" onClick={() => { this.deleClick(scope.$index, scope.row) }}></i>
任超 committed
52 53
                }
              </div>
liangyifan committed
54 55 56
            )
          }
        },
任超 committed
57 58 59 60 61 62 63 64
        {
          label: '身份证读卡器',
          align: 'center',
          render: (h, scope) => {
            return <el-button type="text" icon="el-icon-tickets" onClick={() => { this.readClick(scope) }}>读取</el-button>
          }
        },
        {
任超 committed
65
          prop: "sqrmc",
任超 committed
66
          label: "姓名/名称"
任超 committed
67 68
        },
        {
田浩浩 committed
69
          prop: "zjzl",
任超 committed
70
          label: "证件种类"
任超 committed
71 72
        },
        {
田浩浩 committed
73
          prop: "zjh",
任超 committed
74
          label: "证件号"
任超 committed
75 76
        },
        {
田浩浩 committed
77 78
          prop: "dh",
          label: "联系电话"
任超 committed
79 80 81
        },
        {
          label: '修改',
任超 committed
82 83
          render: (h, scope) => {
            return (
任超 committed
84
              <div>
任超 committed
85 86 87 88
                {
                  this.$route.query.viewtype == 1 ? <el-button
                    icon="el-icon-view"
                    type="text"
89
                    onClick={() => { this.queryViewClick(scope.$index, scope.row) }}>查看</el-button> : <el-button
任超 committed
90 91
                      icon="el-icon-edit-outline"
                      type="text"
92
                      onClick={() => { this.editClick(scope.$index, scope.row) }}>编辑</el-button>
任超 committed
93
                }
任超 committed
94
              </div>
任超 committed
95 96
            )
          }
liangyifan committed
97
        }
任超 committed
98 99
      ],
      column: this.InformationTable
任超 committed
100
    }
liangyifan committed
101
  },
liangyifan committed
102 103
  watch: {
    tableData: {
任超 committed
104 105 106
      handler: function (val, oldVal) {
        let that = this
        if (val.length == 0 || !val) {
任超 committed
107 108 109 110 111 112
          that.tableDataList = _.cloneDeep([{
            sqrmc: '',
            dlrzjlx: '',
            dlrzjh: '',
            fr: ''
          }])
任超 committed
113 114 115
        } else {
          that.tableDataList = _.cloneDeep(val)
        }
liangyifan committed
116
      },
任超 committed
117
      immediate: true,
liangyifan committed
118
      deep: true
任超 committed
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
    },
    gyfs: {
      handler (newVal, oldValue) {
        let dataList = _.cloneDeep(this.InformationTable)
        if (newVal == '1') {
          this.column = _.cloneDeep(dataList).slice(1, dataList.length)
        } else if ((newVal == '2')) {
          this.column = dataList
        } else {
          this.column = _.cloneDeep(dataList)
          this.column.splice(
            2, 0, {
            prop: "fs",
            label: "份数"
          })
        }
      },
      immediate: true
liangyifan committed
137 138
    }
  },
任超 committed
139
  methods: {
任超 committed
140 141
    updateDetail (value) {
      this.tableDataList[this.dataIndex] = value
任超 committed
142
      this.key++
任超 committed
143
      this.$emit('upDateQlrxxList', this.tableDataList)
任超 committed
144
    },
145 146 147
    
    // 新增
    addClick () {
任超 committed
148
      this.dialog = true
liangyifan committed
149
    },
150 151 152

    // 删除
    deleClick (index, row) {
liangyifan committed
153 154
      this.tableData.splice(index, 1)
    },
155

liangyifan committed
156
    // 身份证读取
任超 committed
157
    readClick () { },
158

liangyifan committed
159
    // 修改
160
    editClick (index, row) {
任超 committed
161
      console.log(row, 'rowrowrowrowrow');
任超 committed
162
      this.dataIndex = index
任超 committed
163
      this.dialog = true
任超 committed
164
      this.details = row
任超 committed
165
    },
166 167

    queryViewClick () {
任超 committed
168 169
      this.dialog = true
    }
liangyifan committed
170
  }
liangyifan committed
171 172 173
}
</script>
<style scoped lang='scss'>
任超 committed
174

liangyifan committed
175
</style>