@nstc-business/imes 1.0.0
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/package.json +71 -0
- package/src/components/common.js +419 -0
- package/src/components/model-calculate/index.vue +150 -0
- package/src/components/model-calculate/input-number.vue +294 -0
- package/src/components/model-calculate/modelCalcTest.vue +1222 -0
- package/src/components/model-calculate/tree.vue +135 -0
- package/src/index.js +24 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tree_wrap">
|
|
3
|
+
<el-tree
|
|
4
|
+
:data="treeVal"
|
|
5
|
+
node-key="id"
|
|
6
|
+
ref="tree"
|
|
7
|
+
draggable
|
|
8
|
+
:default-expand-all="true"
|
|
9
|
+
:expand-on-click-node="false"
|
|
10
|
+
v-bind="$attrs"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
class="custom-tree-node flex-box flex-v"
|
|
14
|
+
v-title
|
|
15
|
+
slot-scope="{ node, data }"
|
|
16
|
+
>
|
|
17
|
+
<i :class="data.type == 0 ? 'el-icon-folder' : 'el-icon-tickets'" />
|
|
18
|
+
<div class="custom-tree-label" v-title:tooltip>
|
|
19
|
+
{{ data.label}}
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</el-tree>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
export default {
|
|
28
|
+
name: 'Tree',
|
|
29
|
+
props: {
|
|
30
|
+
flag: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: true
|
|
33
|
+
},
|
|
34
|
+
modelTree: {
|
|
35
|
+
type: [Array, Object],
|
|
36
|
+
default: () => []
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
computed: {
|
|
40
|
+
treeVal: {
|
|
41
|
+
get() {
|
|
42
|
+
if (!this.flag) {
|
|
43
|
+
return this.modelTree?.map(item => this.buildTreeItem(item)) || []
|
|
44
|
+
}
|
|
45
|
+
return Array.isArray(this.modelTree)
|
|
46
|
+
? this.modelTree.map(item => this.buildModelTreeItem(item))
|
|
47
|
+
: [this.buildModelTreeItem(this.modelTree)]
|
|
48
|
+
},
|
|
49
|
+
set(v) {
|
|
50
|
+
this.$emit('update:modelTree', v)
|
|
51
|
+
return v
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
modelFlag: {
|
|
55
|
+
get() {
|
|
56
|
+
return this.flag
|
|
57
|
+
},
|
|
58
|
+
set(v) {
|
|
59
|
+
return v
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
data() {
|
|
64
|
+
return {}
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
buildTreeItem(treeData) {
|
|
68
|
+
const item = {
|
|
69
|
+
pid: treeData.pid,
|
|
70
|
+
sort: treeData.sort,
|
|
71
|
+
id: treeData.id,
|
|
72
|
+
label: treeData.name,
|
|
73
|
+
type: treeData.type,
|
|
74
|
+
kind: treeData.kind,
|
|
75
|
+
code: treeData.code,
|
|
76
|
+
children:
|
|
77
|
+
treeData.children?.map(child => this.buildTreeItem(child)) || []
|
|
78
|
+
}
|
|
79
|
+
return item
|
|
80
|
+
},
|
|
81
|
+
buildModelTreeItem(treeData) {
|
|
82
|
+
const item = {
|
|
83
|
+
...treeData,
|
|
84
|
+
id: treeData.tid,
|
|
85
|
+
label: treeData.name,
|
|
86
|
+
type: treeData.isLeaf,
|
|
87
|
+
validateRuleFlag: true,
|
|
88
|
+
children:
|
|
89
|
+
treeData.children?.map(child => this.buildModelTreeItem(child)) || []
|
|
90
|
+
}
|
|
91
|
+
item.modelRankRuleVOList?.forEach(r => {
|
|
92
|
+
r.validateRuleFlag = true
|
|
93
|
+
})
|
|
94
|
+
return item
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<style scoped lang="less">
|
|
101
|
+
.tree_wrap {
|
|
102
|
+
margin-top: 4px;
|
|
103
|
+
|
|
104
|
+
.el-tree {
|
|
105
|
+
width: 300px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
span {
|
|
109
|
+
/deep/ .el-input--mini .el-input__inner {
|
|
110
|
+
height: 24px;
|
|
111
|
+
line-height: 24px;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.custom-tree-node {
|
|
117
|
+
width: 300px;
|
|
118
|
+
overflow: hidden;
|
|
119
|
+
white-space: nowrap;
|
|
120
|
+
text-overflow: ellipsis;
|
|
121
|
+
|
|
122
|
+
.custom-tree-label {
|
|
123
|
+
width: 90%;
|
|
124
|
+
overflow: hidden;
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
text-overflow: ellipsis;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/deep/ .is-current > .el-tree-node__content {
|
|
131
|
+
background: #168bff;
|
|
132
|
+
position: relative;
|
|
133
|
+
color: white;
|
|
134
|
+
}
|
|
135
|
+
</style>
|
package/src/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// 组件导入
|
|
2
|
+
import ModelCalculate from './components/model-calculate/index.vue'
|
|
3
|
+
|
|
4
|
+
const components = [ModelCalculate]
|
|
5
|
+
|
|
6
|
+
const install = function (Vue, options = { prefix: 'N' }) {
|
|
7
|
+
components.forEach(component => {
|
|
8
|
+
let name = component.name
|
|
9
|
+
if (!name) return console.error('必须设置组件名称:', component)
|
|
10
|
+
name = options.prefix + name.replace(name[0], name[0].toUpperCase())
|
|
11
|
+
Vue.component(name, component)
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* istanbul ignore if */
|
|
16
|
+
if (typeof window !== 'undefined' && window.Vue) {
|
|
17
|
+
install(window.Vue)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
version: '1.0.0',
|
|
22
|
+
install,
|
|
23
|
+
CascaderArea,
|
|
24
|
+
}
|