djqxsd.vue
5.16 KB
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
<!--
功能:登记情形设定
-->
<template>
<div class='该组件名称'>
<el-form :model="ruleForm" :rules="rules">
<el-row>
<el-col :span="5">
<el-form-item label="登记业务编码">
{{ ruleForm.djywbm }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="登记业务名称">
{{ ruleForm.djywmc }}
</el-form-item>
</el-col>
</el-row>
</el-form>
<lb-table :column="column" border :key="key" :heightNum="390" :pagination="false" heightNumSetting
:data="tableData">
</lb-table>
</div>
</template>
<script>
import { upward, down } from '@/utils/operation'
export default {
props: {
djqxList: { type: Array, default: [] },
ruleForm: {
type: Object, default: {}
}
},
data () {
return {
key: 0,
rules: {
djywbm: [
{ required: true, message: '登记业务编码', trigger: 'blur' },
],
djywmc: [
{ required: true, message: '登记业务名称', trigger: 'blur' },
],
},
column: [
{
width: '60',
renderHeader: (h, scope) => {
return <i class="el-icon-plus pointer" onClick={() => { this.handleAdd() }} style="color:#409EFF"></i>
},
render: (h, scope) => {
return (
<i class="el-icon-minus pointer" onClick={() => { this.handleMinus(scope.$index, scope.row) }}></i>
)
}
},
{
width: '60',
label: '序号',
type: 'index'
},
{
prop: 'djywbm',
width: '100',
label: '登记情形编码',
render: (h, scope) => {
return (
<el-input placeholder="登记情形编码" disabled={scope.row.sftsdjqx == '1'} value={scope.row[scope.column.property]}
onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
)
}
},
{
prop: 'djywmc',
label: '登记情形名称',
render: (h, scope) => {
return (
<el-input placeholder="登记情形名称" disabled={scope.row.sftsdjqx == '1'} value={scope.row[scope.column.property]}
onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
)
}
},
{
label: '是否启用登记情形',
width: '140',
render: (h, scope) => {
return (
<el-radio-group v-model={scope.row.enabled} disabled={scope.row.sftsdjqx == '1'} onChange={(val) => { scope.row[scope.column.property] = val }}>
<el-radio label={'1'}>启用</el-radio>
<el-radio label={'0'}>禁用</el-radio>
</el-radio-group>
)
}
},
{
prop: 'djyy',
label: '登记原因模板',
render: (h, scope) => {
return (
<el-input placeholder="登记原因模板" disabled={scope.row.sftsdjqx == '1'} value={scope.row[scope.column.property]}
onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
)
}
},
{
label: '是否启用模板',
width: '140',
render: (h, scope) => {
return (
<el-radio-group v-model={scope.row.sfqydjyymb} disabled={scope.row.sftsdjqx == '1'} onChange={(val) => { scope.row[scope.column.property] = val }}>
<el-radio label={'1'}>启用</el-radio>
<el-radio label={'0'}>禁用</el-radio>
</el-radio-group>
)
}
},
{
label: '移动',
width: '80',
render: (h, scope) => {
return (
<div>
<i class="el-icon-top pointer move" disabled={scope.$index == 0} onClick={() => { this.moveUpward(scope.$index, scope.row) }}></i>
<i class="el-icon-bottom pointer move" disabled={(scope.$index + 1) == this.tableData.length} onClick={() => { this.moveDown(scope.$index, scope.row) }}></i>
</div>
)
}
}
],
tableData: []
}
},
watch: {
djqxList: {
handler: function (newValue) {
this.tableData = newValue
console.log(this.tableData, 'this.tableDatathis.tableDatathis.tableData');
},
deep: true,
immediate: true
},
tableData: {
handler (newValue, oldValue) {
this.$emit('updateValue', newValue)
},
deep: true
}
},
methods: {
handleAdd () {
this.tableData.push(
{
djqxmc: '',
djqxbm: '',
djyymb: '',
sfqymb: 0,
sfqy: 0
}
)
this.key++
},
handleMinus (index, row) {
this.tableData.splice(index, 1)
},
// 上移下移
moveUpward (index, row) {
upward(index, this.tableData)
this.key++
},
moveDown (index, row) {
down(index, this.tableData)
this.key++
},
}
}
</script>
<style scoped lang='scss'>
/deep/.el-radio {
margin-right: 5px;
}
</style>