@tongfun/tf-widget 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -46
- package/lib/tf-widget.common.js +460 -416
- package/lib/tf-widget.css +1 -1
- package/lib/tf-widget.umd.js +460 -416
- package/lib/tf-widget.umd.min.js +3 -3
- package/package/svg-icon/index.js +8 -8
- package/package/svg-icon/src/SvgIcon.vue +59 -59
- package/package/t-data-list/index.js +6 -6
- package/package/t-data-list/main.vue +193 -193
- package/package/t-data-list/src/condition-input/basic.vue +31 -31
- package/package/t-data-list/src/condition-input/date.vue +106 -106
- package/package/t-data-list/src/condition-input/index.vue +100 -100
- package/package/t-data-list/src/condition-input/input.vue +31 -31
- package/package/t-data-list/src/condition-input/number.vue +115 -115
- package/package/t-data-list/src/condition-input/select.vue +86 -86
- package/package/t-data-list/src/js/fieldTypeEnum.js +10 -10
- package/package/t-data-list/src/js/operatorEnum.js +108 -108
- package/package/t-data-list/src/js/qureyParamsEnum.js +4 -4
- package/package/t-data-list/src/js/util.js +34 -34
- package/package/t-data-list/src/mixins/button-controll-mixin.js +93 -93
- package/package/t-data-list/src/pushdown/push-down.vue +158 -158
- package/package/t-data-list/src/t-list-search.vue +36 -36
- package/package/t-data-list/src/t-plan/condition-always-item.vue +143 -143
- package/package/t-data-list/src/t-plan/condition-mult-item.vue +222 -222
- package/package/t-data-list/src/t-plan/index.vue +195 -195
- package/package/t-data-list/src/t-plan/plan-content.vue +389 -389
- package/package/t-data-list/src/t-table/index.vue +129 -129
- package/package/t-data-list/src/t-table/table-group-item-edit.vue +238 -238
- package/package/t-data-list/src/t-table/table-group-item.vue +87 -87
- package/package/t-data-list/src/t-table/table-group.vue +180 -180
- package/package/t-data-list/src/t-table/table-records-header-popover.vue +246 -246
- package/package/t-data-list/src/t-table/table-records-selected.vue +159 -159
- package/package/t-data-list/src/t-table/table-records.vue +337 -337
- package/package/t-input/children/address.vue +101 -101
- package/package/t-input/children/basic-display.vue +41 -41
- package/package/t-input/children/basic.vue +253 -253
- package/package/t-input/children/date.vue +89 -89
- package/package/t-input/children/group-components/group-dialog.vue +344 -344
- package/package/t-input/children/group.vue +126 -126
- package/package/t-input/children/input.vue +72 -72
- package/package/t-input/children/number.vue +74 -74
- package/package/t-input/children/select.vue +89 -89
- package/package/t-input/children/tfile/fiile-enclosure.vue +233 -233
- package/package/t-input/index.js +7 -7
- package/package/t-input/index.vue +337 -337
- package/package/t-input/tInputCache.js +24 -24
- package/package/tf-icon-picker/README.md +7 -7
- package/package/tf-icon-picker/index.js +8 -8
- package/package/tf-icon-picker/src/tf-icon-picker.vue +266 -266
- package/package/tf-layout/README.md +115 -115
- package/package/tf-layout/index.js +8 -8
- package/package/tf-layout/src/components/tf-labelbar.vue +394 -382
- package/package/tf-layout/src/components/tf-menu.vue +180 -180
- package/package/tf-layout/src/components/tf-right-menu.vue +89 -89
- package/package/tf-layout/src/components/tf-rotate-box.vue +50 -50
- package/package/tf-layout/src/tf-layout.vue +140 -120
- package/package/tf-widget/index.js +8 -8
- package/package/tf-widget/src/assets/common-input.less +10 -10
- package/package/tf-widget/src/children/basic-data/basic-data.vue +361 -361
- package/package/tf-widget/src/children/basic-data/dependcy/basic-data-selector.vue +1087 -1087
- package/package/tf-widget/src/children/basic-data/dependcy/common-table.vue +750 -750
- package/package/tf-widget/src/children/basic-data/dependcy/condition-filter.vue +519 -519
- package/package/tf-widget/src/children/basic-data/dependcy/pagination.vue +93 -93
- package/package/tf-widget/src/children/basic-data/dependcy/table-control.vue +240 -240
- package/package/tf-widget/src/children/basic-data/dependcy/view-picture.vue +108 -108
- package/package/tf-widget/src/children/date-time.vue +103 -103
- package/package/tf-widget/src/children/date.vue +103 -103
- package/package/tf-widget/src/children/decimal.vue +115 -115
- package/package/tf-widget/src/children/integer.vue +104 -104
- package/package/tf-widget/src/children/property.vue +59 -59
- package/package/tf-widget/src/children/single-line-text.vue +82 -82
- package/package/tf-widget/src/children/small-pictures.vue +223 -223
- package/package/tf-widget/src/children/text-area.vue +74 -74
- package/package/tf-widget/src/children/tf-select.vue +113 -113
- package/package/tf-widget/src/tf-widget.vue +175 -175
- package/package.json +44 -44
- package/src/api/edit.js +97 -97
- package/src/api/file-enclosure.js +26 -26
- package/src/api/push-down.js +19 -19
- package/src/api/table.js +294 -294
- package/src/api/tableV3.js +160 -160
- package/src/assets/images/icons/index.js +9 -9
- package/src/assets/images/icons/svg/add.svg +5 -5
- package/src/assets/images/icons/svg/push-down.svg +1 -1
- package/src/assets/images/icons/svg/remove.svg +1 -1
- package/src/assets/styles/common-table.less +202 -202
- package/src/directives/debounce.js +24 -24
- package/src/index.js +31 -31
- package/src/mixins/t-data-query-mixin.js +290 -290
- package/src/utils/auth.js +22 -22
- package/src/utils/request.js +42 -42
- package/src/utils/stato-anormale.js +59 -59
- package/src/utils/utils.js +109 -109
- package/src/utils/validate.js +84 -84
|
@@ -1,238 +1,238 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-dialog
|
|
3
|
-
:title="type === 'insert' ? '新增分组':'修改分组'"
|
|
4
|
-
:visible="visible"
|
|
5
|
-
width="30%"
|
|
6
|
-
:modal-append-to-body="false"
|
|
7
|
-
@update:visible="handleVisible"
|
|
8
|
-
@open="handleOpen"
|
|
9
|
-
@close="handleClose"
|
|
10
|
-
>
|
|
11
|
-
<el-form ref="formRef" :rules="rules" :model="form" label-width="80px">
|
|
12
|
-
<el-form-item label="分组名称" prop="name">
|
|
13
|
-
<el-input v-model="form.name" />
|
|
14
|
-
</el-form-item>
|
|
15
|
-
<el-form-item label="编码" prop="code">
|
|
16
|
-
<el-input v-model="form.code">
|
|
17
|
-
<div slot="suffix">
|
|
18
|
-
<el-tooltip v-model="toolTipShow" manual effect="dark" content="已复制" placement="right">
|
|
19
|
-
<i class="el-input__icon el-icon-document-copy clickable" @click="copyHoleCode" @mouseleave="toolTipShow = false" />
|
|
20
|
-
</el-tooltip>
|
|
21
|
-
</div>
|
|
22
|
-
</el-input>
|
|
23
|
-
</el-form-item>
|
|
24
|
-
<el-form-item label="父级编码" prop="code">
|
|
25
|
-
<el-input v-model="parentCodeStr" disabled />
|
|
26
|
-
</el-form-item>
|
|
27
|
-
<el-form-item label="父级名称" prop="parentId">
|
|
28
|
-
<el-cascader
|
|
29
|
-
v-model="form.parentId"
|
|
30
|
-
:options="nodeOptions"
|
|
31
|
-
:props="config"
|
|
32
|
-
:show-all-levels="false"
|
|
33
|
-
/>
|
|
34
|
-
</el-form-item>
|
|
35
|
-
</el-form>
|
|
36
|
-
|
|
37
|
-
<span slot="footer" class="dialog-footer">
|
|
38
|
-
<el-button type="primary" size="small" @click="handleVisible(false)">取消</el-button>
|
|
39
|
-
<el-button type="primary" size="small" @click="confirm">确定</el-button>
|
|
40
|
-
</span>
|
|
41
|
-
</el-dialog>
|
|
42
|
-
</template>
|
|
43
|
-
<script>
|
|
44
|
-
import { addGroupNode, updateGroupNode } from '@/api/tableV3'
|
|
45
|
-
import { getParentId } from '../js/util.js'
|
|
46
|
-
export default {
|
|
47
|
-
components: {
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
props: {
|
|
51
|
-
// 是否显示
|
|
52
|
-
visible: {
|
|
53
|
-
type: Boolean,
|
|
54
|
-
default: false
|
|
55
|
-
},
|
|
56
|
-
// 正在编辑的数据
|
|
57
|
-
editData: {
|
|
58
|
-
type: Object,
|
|
59
|
-
default: null
|
|
60
|
-
},
|
|
61
|
-
// 新增数据还是修改数据
|
|
62
|
-
type: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: ''
|
|
65
|
-
},
|
|
66
|
-
// 所有的节点
|
|
67
|
-
nodeOptions: {
|
|
68
|
-
type: Array,
|
|
69
|
-
default: null
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
inject: ['target'],
|
|
73
|
-
data () {
|
|
74
|
-
var checkBlank = (rule, value, callback) => {
|
|
75
|
-
const reg = /\s+/g
|
|
76
|
-
if (reg.test(value)) {
|
|
77
|
-
return callback(new Error('不能含有空格'))
|
|
78
|
-
}
|
|
79
|
-
callback()
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
toolTipShow: false,
|
|
83
|
-
form: {
|
|
84
|
-
name: '',
|
|
85
|
-
code: '',
|
|
86
|
-
parentId: ''
|
|
87
|
-
},
|
|
88
|
-
rules: {
|
|
89
|
-
name: [
|
|
90
|
-
{ required: true, message: '不能为空', trigger: 'blur' },
|
|
91
|
-
{ validator: checkBlank, trigger: 'blur' }
|
|
92
|
-
],
|
|
93
|
-
code: [
|
|
94
|
-
{ required: true, message: '不能为空', trigger: 'blur' }
|
|
95
|
-
],
|
|
96
|
-
parentId: [
|
|
97
|
-
{ required: true, message: '不能为空', trigger: 'blur' }
|
|
98
|
-
]
|
|
99
|
-
},
|
|
100
|
-
config: {
|
|
101
|
-
value: 'id',
|
|
102
|
-
label: 'name',
|
|
103
|
-
checkStrictly: true,
|
|
104
|
-
emitPath: false
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
computed: {
|
|
109
|
-
// 根据当前的id寻找父id
|
|
110
|
-
parentId () {
|
|
111
|
-
if (this.type === 'insert') {
|
|
112
|
-
return this.editData.id
|
|
113
|
-
}
|
|
114
|
-
return this.editData.id === '0'
|
|
115
|
-
? null
|
|
116
|
-
: getParentId(this.nodeOptions[0], this.editData.id)
|
|
117
|
-
},
|
|
118
|
-
parentCodeStr () {
|
|
119
|
-
if (this.type === 'insert') {
|
|
120
|
-
return this.editData.groupCode
|
|
121
|
-
}
|
|
122
|
-
const parentCodeArr = this.editData.groupCode.split('.')
|
|
123
|
-
parentCodeArr.pop()
|
|
124
|
-
|
|
125
|
-
let parentCodeStr = ''
|
|
126
|
-
if (parentCodeArr.length) {
|
|
127
|
-
parentCodeStr = parentCodeArr.join('.')
|
|
128
|
-
}
|
|
129
|
-
return parentCodeStr
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
methods: {
|
|
133
|
-
/**
|
|
134
|
-
* 弹窗操作
|
|
135
|
-
*/
|
|
136
|
-
// .sync 双向绑定
|
|
137
|
-
handleVisible (value) {
|
|
138
|
-
this.$emit('update:visible', value)
|
|
139
|
-
},
|
|
140
|
-
// 打开弹窗的时候对表单内容进行初始化
|
|
141
|
-
handleOpen () {
|
|
142
|
-
if (this.type === 'update') {
|
|
143
|
-
this.form.name = this.editData.name
|
|
144
|
-
this.form.code = this.editData.groupCode.split('.').pop()
|
|
145
|
-
}
|
|
146
|
-
this.form.parentId = this.parentId
|
|
147
|
-
},
|
|
148
|
-
// 关闭弹窗的时候清空校验和表单数据
|
|
149
|
-
handleClose () {
|
|
150
|
-
this.$refs.formRef.clearValidate()
|
|
151
|
-
this.form.name = ''
|
|
152
|
-
this.form.code = ''
|
|
153
|
-
this.form.parentId = ''
|
|
154
|
-
this.handleVisible(false)
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* 数据操作
|
|
159
|
-
*/
|
|
160
|
-
// 点击确定进行表单校验
|
|
161
|
-
confirm () {
|
|
162
|
-
this.$refs.formRef.validate(success => {
|
|
163
|
-
if (success) {
|
|
164
|
-
this.type === 'insert'
|
|
165
|
-
? this.addGroup()
|
|
166
|
-
: this.updateGroup()
|
|
167
|
-
}
|
|
168
|
-
})
|
|
169
|
-
},
|
|
170
|
-
// 复制编码到剪切板
|
|
171
|
-
copyHoleCode () {
|
|
172
|
-
if (this.type === 'insert') {
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
|
-
const tempInput = document.createElement('input')
|
|
176
|
-
tempInput.value = this.editData.groupCode
|
|
177
|
-
tempInput.setAttribute('id', 'temp_copy_input')
|
|
178
|
-
document.body.appendChild(tempInput)
|
|
179
|
-
tempInput.select()
|
|
180
|
-
document.execCommand('copy')
|
|
181
|
-
this.toolTipShow = true
|
|
182
|
-
document.getElementById('temp_copy_input').remove()
|
|
183
|
-
},
|
|
184
|
-
/**
|
|
185
|
-
* 无论添加还是修改分组,只允许用户修改当前节点的分组
|
|
186
|
-
* 但是最终传递给后端的分组节点的编码(groupCode),是包含了上一级别和当前级别的编码
|
|
187
|
-
* 上一级别的节点和当前节点,使用'.' 分割
|
|
188
|
-
*/
|
|
189
|
-
// 插入新的分组
|
|
190
|
-
async addGroup () {
|
|
191
|
-
const groupCode = this.parentCodeStr
|
|
192
|
-
? `${this.parentCodeStr}.${this.form.code}`
|
|
193
|
-
: this.form.code
|
|
194
|
-
const res = await addGroupNode(this.target, this.form.name, null, this.parentId, groupCode)
|
|
195
|
-
if (res.code !== 0) {
|
|
196
|
-
return this.$message.error(res.msg)
|
|
197
|
-
}
|
|
198
|
-
this.$emit('success')
|
|
199
|
-
this.$message.success('插入成功')
|
|
200
|
-
this.handleVisible(false)
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
// 修改已有分组
|
|
204
|
-
async updateGroup () {
|
|
205
|
-
const groupCode = this.parentCodeStr
|
|
206
|
-
? this.parentCodeStr + '.' + this.form.code
|
|
207
|
-
: this.form.code
|
|
208
|
-
const res = await updateGroupNode(
|
|
209
|
-
this.target,
|
|
210
|
-
this.form.name,
|
|
211
|
-
this.editData.id,
|
|
212
|
-
this.form.parentId,
|
|
213
|
-
groupCode)
|
|
214
|
-
|
|
215
|
-
if (res.code !== 0) {
|
|
216
|
-
return this.$message.error(res.msg)
|
|
217
|
-
}
|
|
218
|
-
this.$emit('success')
|
|
219
|
-
this.$message.success('修改成功')
|
|
220
|
-
this.handleVisible(false)
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
</script>
|
|
225
|
-
|
|
226
|
-
<style scoped>
|
|
227
|
-
.clickable {
|
|
228
|
-
cursor: pointer;
|
|
229
|
-
}
|
|
230
|
-
.el-cascader{
|
|
231
|
-
width: 100%;
|
|
232
|
-
}
|
|
233
|
-
::v-deep.el-button{
|
|
234
|
-
background-color: #0c4c8e!important;
|
|
235
|
-
border-color: #0c4c8e;
|
|
236
|
-
border-radius: 0;
|
|
237
|
-
}
|
|
238
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
:title="type === 'insert' ? '新增分组':'修改分组'"
|
|
4
|
+
:visible="visible"
|
|
5
|
+
width="30%"
|
|
6
|
+
:modal-append-to-body="false"
|
|
7
|
+
@update:visible="handleVisible"
|
|
8
|
+
@open="handleOpen"
|
|
9
|
+
@close="handleClose"
|
|
10
|
+
>
|
|
11
|
+
<el-form ref="formRef" :rules="rules" :model="form" label-width="80px">
|
|
12
|
+
<el-form-item label="分组名称" prop="name">
|
|
13
|
+
<el-input v-model="form.name" />
|
|
14
|
+
</el-form-item>
|
|
15
|
+
<el-form-item label="编码" prop="code">
|
|
16
|
+
<el-input v-model="form.code">
|
|
17
|
+
<div slot="suffix">
|
|
18
|
+
<el-tooltip v-model="toolTipShow" manual effect="dark" content="已复制" placement="right">
|
|
19
|
+
<i class="el-input__icon el-icon-document-copy clickable" @click="copyHoleCode" @mouseleave="toolTipShow = false" />
|
|
20
|
+
</el-tooltip>
|
|
21
|
+
</div>
|
|
22
|
+
</el-input>
|
|
23
|
+
</el-form-item>
|
|
24
|
+
<el-form-item label="父级编码" prop="code">
|
|
25
|
+
<el-input v-model="parentCodeStr" disabled />
|
|
26
|
+
</el-form-item>
|
|
27
|
+
<el-form-item label="父级名称" prop="parentId">
|
|
28
|
+
<el-cascader
|
|
29
|
+
v-model="form.parentId"
|
|
30
|
+
:options="nodeOptions"
|
|
31
|
+
:props="config"
|
|
32
|
+
:show-all-levels="false"
|
|
33
|
+
/>
|
|
34
|
+
</el-form-item>
|
|
35
|
+
</el-form>
|
|
36
|
+
|
|
37
|
+
<span slot="footer" class="dialog-footer">
|
|
38
|
+
<el-button type="primary" size="small" @click="handleVisible(false)">取消</el-button>
|
|
39
|
+
<el-button type="primary" size="small" @click="confirm">确定</el-button>
|
|
40
|
+
</span>
|
|
41
|
+
</el-dialog>
|
|
42
|
+
</template>
|
|
43
|
+
<script>
|
|
44
|
+
import { addGroupNode, updateGroupNode } from '@/api/tableV3'
|
|
45
|
+
import { getParentId } from '../js/util.js'
|
|
46
|
+
export default {
|
|
47
|
+
components: {
|
|
48
|
+
|
|
49
|
+
},
|
|
50
|
+
props: {
|
|
51
|
+
// 是否显示
|
|
52
|
+
visible: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
// 正在编辑的数据
|
|
57
|
+
editData: {
|
|
58
|
+
type: Object,
|
|
59
|
+
default: null
|
|
60
|
+
},
|
|
61
|
+
// 新增数据还是修改数据
|
|
62
|
+
type: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: ''
|
|
65
|
+
},
|
|
66
|
+
// 所有的节点
|
|
67
|
+
nodeOptions: {
|
|
68
|
+
type: Array,
|
|
69
|
+
default: null
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
inject: ['target'],
|
|
73
|
+
data () {
|
|
74
|
+
var checkBlank = (rule, value, callback) => {
|
|
75
|
+
const reg = /\s+/g
|
|
76
|
+
if (reg.test(value)) {
|
|
77
|
+
return callback(new Error('不能含有空格'))
|
|
78
|
+
}
|
|
79
|
+
callback()
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
toolTipShow: false,
|
|
83
|
+
form: {
|
|
84
|
+
name: '',
|
|
85
|
+
code: '',
|
|
86
|
+
parentId: ''
|
|
87
|
+
},
|
|
88
|
+
rules: {
|
|
89
|
+
name: [
|
|
90
|
+
{ required: true, message: '不能为空', trigger: 'blur' },
|
|
91
|
+
{ validator: checkBlank, trigger: 'blur' }
|
|
92
|
+
],
|
|
93
|
+
code: [
|
|
94
|
+
{ required: true, message: '不能为空', trigger: 'blur' }
|
|
95
|
+
],
|
|
96
|
+
parentId: [
|
|
97
|
+
{ required: true, message: '不能为空', trigger: 'blur' }
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
config: {
|
|
101
|
+
value: 'id',
|
|
102
|
+
label: 'name',
|
|
103
|
+
checkStrictly: true,
|
|
104
|
+
emitPath: false
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
computed: {
|
|
109
|
+
// 根据当前的id寻找父id
|
|
110
|
+
parentId () {
|
|
111
|
+
if (this.type === 'insert') {
|
|
112
|
+
return this.editData.id
|
|
113
|
+
}
|
|
114
|
+
return this.editData.id === '0'
|
|
115
|
+
? null
|
|
116
|
+
: getParentId(this.nodeOptions[0], this.editData.id)
|
|
117
|
+
},
|
|
118
|
+
parentCodeStr () {
|
|
119
|
+
if (this.type === 'insert') {
|
|
120
|
+
return this.editData.groupCode
|
|
121
|
+
}
|
|
122
|
+
const parentCodeArr = this.editData.groupCode.split('.')
|
|
123
|
+
parentCodeArr.pop()
|
|
124
|
+
|
|
125
|
+
let parentCodeStr = ''
|
|
126
|
+
if (parentCodeArr.length) {
|
|
127
|
+
parentCodeStr = parentCodeArr.join('.')
|
|
128
|
+
}
|
|
129
|
+
return parentCodeStr
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
methods: {
|
|
133
|
+
/**
|
|
134
|
+
* 弹窗操作
|
|
135
|
+
*/
|
|
136
|
+
// .sync 双向绑定
|
|
137
|
+
handleVisible (value) {
|
|
138
|
+
this.$emit('update:visible', value)
|
|
139
|
+
},
|
|
140
|
+
// 打开弹窗的时候对表单内容进行初始化
|
|
141
|
+
handleOpen () {
|
|
142
|
+
if (this.type === 'update') {
|
|
143
|
+
this.form.name = this.editData.name
|
|
144
|
+
this.form.code = this.editData.groupCode.split('.').pop()
|
|
145
|
+
}
|
|
146
|
+
this.form.parentId = this.parentId
|
|
147
|
+
},
|
|
148
|
+
// 关闭弹窗的时候清空校验和表单数据
|
|
149
|
+
handleClose () {
|
|
150
|
+
this.$refs.formRef.clearValidate()
|
|
151
|
+
this.form.name = ''
|
|
152
|
+
this.form.code = ''
|
|
153
|
+
this.form.parentId = ''
|
|
154
|
+
this.handleVisible(false)
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 数据操作
|
|
159
|
+
*/
|
|
160
|
+
// 点击确定进行表单校验
|
|
161
|
+
confirm () {
|
|
162
|
+
this.$refs.formRef.validate(success => {
|
|
163
|
+
if (success) {
|
|
164
|
+
this.type === 'insert'
|
|
165
|
+
? this.addGroup()
|
|
166
|
+
: this.updateGroup()
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
},
|
|
170
|
+
// 复制编码到剪切板
|
|
171
|
+
copyHoleCode () {
|
|
172
|
+
if (this.type === 'insert') {
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
const tempInput = document.createElement('input')
|
|
176
|
+
tempInput.value = this.editData.groupCode
|
|
177
|
+
tempInput.setAttribute('id', 'temp_copy_input')
|
|
178
|
+
document.body.appendChild(tempInput)
|
|
179
|
+
tempInput.select()
|
|
180
|
+
document.execCommand('copy')
|
|
181
|
+
this.toolTipShow = true
|
|
182
|
+
document.getElementById('temp_copy_input').remove()
|
|
183
|
+
},
|
|
184
|
+
/**
|
|
185
|
+
* 无论添加还是修改分组,只允许用户修改当前节点的分组
|
|
186
|
+
* 但是最终传递给后端的分组节点的编码(groupCode),是包含了上一级别和当前级别的编码
|
|
187
|
+
* 上一级别的节点和当前节点,使用'.' 分割
|
|
188
|
+
*/
|
|
189
|
+
// 插入新的分组
|
|
190
|
+
async addGroup () {
|
|
191
|
+
const groupCode = this.parentCodeStr
|
|
192
|
+
? `${this.parentCodeStr}.${this.form.code}`
|
|
193
|
+
: this.form.code
|
|
194
|
+
const res = await addGroupNode(this.target, this.form.name, null, this.parentId, groupCode)
|
|
195
|
+
if (res.code !== 0) {
|
|
196
|
+
return this.$message.error(res.msg)
|
|
197
|
+
}
|
|
198
|
+
this.$emit('success')
|
|
199
|
+
this.$message.success('插入成功')
|
|
200
|
+
this.handleVisible(false)
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
// 修改已有分组
|
|
204
|
+
async updateGroup () {
|
|
205
|
+
const groupCode = this.parentCodeStr
|
|
206
|
+
? this.parentCodeStr + '.' + this.form.code
|
|
207
|
+
: this.form.code
|
|
208
|
+
const res = await updateGroupNode(
|
|
209
|
+
this.target,
|
|
210
|
+
this.form.name,
|
|
211
|
+
this.editData.id,
|
|
212
|
+
this.form.parentId,
|
|
213
|
+
groupCode)
|
|
214
|
+
|
|
215
|
+
if (res.code !== 0) {
|
|
216
|
+
return this.$message.error(res.msg)
|
|
217
|
+
}
|
|
218
|
+
this.$emit('success')
|
|
219
|
+
this.$message.success('修改成功')
|
|
220
|
+
this.handleVisible(false)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
</script>
|
|
225
|
+
|
|
226
|
+
<style scoped>
|
|
227
|
+
.clickable {
|
|
228
|
+
cursor: pointer;
|
|
229
|
+
}
|
|
230
|
+
.el-cascader{
|
|
231
|
+
width: 100%;
|
|
232
|
+
}
|
|
233
|
+
::v-deep.el-button{
|
|
234
|
+
background-color: #0c4c8e!important;
|
|
235
|
+
border-color: #0c4c8e;
|
|
236
|
+
border-radius: 0;
|
|
237
|
+
}
|
|
238
|
+
</style>
|
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="tree-item" @mouseover="handleBtnShow(true)" @mouseleave="handleBtnShow(false)">
|
|
3
|
-
<div class="item-display-icon">
|
|
4
|
-
<span :class="[data.children ? 'el-icon-circle-plus':'el-icon-remove']" />
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
<div class="item-content" @click.stop="itemClick">
|
|
8
|
-
{{ data.name }}
|
|
9
|
-
</div>
|
|
10
|
-
<div class="item-icons">
|
|
11
|
-
|
|
12
|
-
<div v-show="btnShow" class="item-display-controll" @click.prevent>
|
|
13
|
-
<i class="el-icon-circle-plus-outline" @click.stop="addChild" />
|
|
14
|
-
<i v-if="data.id != 0" class="el-icon-edit" @click.stop="edit" />
|
|
15
|
-
<i v-if="data.id != 0" class="el-icon-delete" @click.stop="remove" />
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
20
|
-
<script>
|
|
21
|
-
export default {
|
|
22
|
-
components: {
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
props: {
|
|
26
|
-
data: {
|
|
27
|
-
type: Object,
|
|
28
|
-
default: null
|
|
29
|
-
},
|
|
30
|
-
node: {
|
|
31
|
-
type: Object,
|
|
32
|
-
default: null
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
data () {
|
|
36
|
-
return {
|
|
37
|
-
btnShow: false
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
inject: ['enableGroupEdit'],
|
|
41
|
-
methods: {
|
|
42
|
-
// 分组编辑按时是否展示的逻辑
|
|
43
|
-
handleBtnShow (show) {
|
|
44
|
-
if (!this.enableGroupEdit) {
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
this.btnShow = show
|
|
48
|
-
},
|
|
49
|
-
addChild () {
|
|
50
|
-
this.$emit('addChild', this.data)
|
|
51
|
-
},
|
|
52
|
-
edit () {
|
|
53
|
-
this.$emit('edit', this.data)
|
|
54
|
-
},
|
|
55
|
-
remove () {
|
|
56
|
-
this.$emit('remove', this.data)
|
|
57
|
-
},
|
|
58
|
-
itemClick () {
|
|
59
|
-
this.$emit('itemClick', this.data)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
<style lang="less" scoped>
|
|
66
|
-
.tree-item {
|
|
67
|
-
width:100%;
|
|
68
|
-
display:flex;
|
|
69
|
-
justify-content: flex-start;
|
|
70
|
-
text-align: start;
|
|
71
|
-
.item-content {
|
|
72
|
-
margin-left:5px;
|
|
73
|
-
// flex:1;
|
|
74
|
-
// background-color:pink;
|
|
75
|
-
}
|
|
76
|
-
.item-display-controll {
|
|
77
|
-
margin-left:7px;
|
|
78
|
-
margin-right:5px;
|
|
79
|
-
i {
|
|
80
|
-
margin-right:10px;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
.item-icons{
|
|
84
|
-
width: 72px;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tree-item" @mouseover="handleBtnShow(true)" @mouseleave="handleBtnShow(false)">
|
|
3
|
+
<div class="item-display-icon">
|
|
4
|
+
<span :class="[data.children ? 'el-icon-circle-plus':'el-icon-remove']" />
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="item-content" @click.stop="itemClick">
|
|
8
|
+
{{ data.name }}
|
|
9
|
+
</div>
|
|
10
|
+
<div class="item-icons">
|
|
11
|
+
|
|
12
|
+
<div v-show="btnShow" class="item-display-controll" @click.prevent>
|
|
13
|
+
<i class="el-icon-circle-plus-outline" @click.stop="addChild" />
|
|
14
|
+
<i v-if="data.id != 0" class="el-icon-edit" @click.stop="edit" />
|
|
15
|
+
<i v-if="data.id != 0" class="el-icon-delete" @click.stop="remove" />
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
<script>
|
|
21
|
+
export default {
|
|
22
|
+
components: {
|
|
23
|
+
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
data: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default: null
|
|
29
|
+
},
|
|
30
|
+
node: {
|
|
31
|
+
type: Object,
|
|
32
|
+
default: null
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
data () {
|
|
36
|
+
return {
|
|
37
|
+
btnShow: false
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
inject: ['enableGroupEdit'],
|
|
41
|
+
methods: {
|
|
42
|
+
// 分组编辑按时是否展示的逻辑
|
|
43
|
+
handleBtnShow (show) {
|
|
44
|
+
if (!this.enableGroupEdit) {
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
this.btnShow = show
|
|
48
|
+
},
|
|
49
|
+
addChild () {
|
|
50
|
+
this.$emit('addChild', this.data)
|
|
51
|
+
},
|
|
52
|
+
edit () {
|
|
53
|
+
this.$emit('edit', this.data)
|
|
54
|
+
},
|
|
55
|
+
remove () {
|
|
56
|
+
this.$emit('remove', this.data)
|
|
57
|
+
},
|
|
58
|
+
itemClick () {
|
|
59
|
+
this.$emit('itemClick', this.data)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<style lang="less" scoped>
|
|
66
|
+
.tree-item {
|
|
67
|
+
width:100%;
|
|
68
|
+
display:flex;
|
|
69
|
+
justify-content: flex-start;
|
|
70
|
+
text-align: start;
|
|
71
|
+
.item-content {
|
|
72
|
+
margin-left:5px;
|
|
73
|
+
// flex:1;
|
|
74
|
+
// background-color:pink;
|
|
75
|
+
}
|
|
76
|
+
.item-display-controll {
|
|
77
|
+
margin-left:7px;
|
|
78
|
+
margin-right:5px;
|
|
79
|
+
i {
|
|
80
|
+
margin-right:10px;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
.item-icons{
|
|
84
|
+
width: 72px;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
</style>
|