leisure-core 0.5.1 → 0.5.4
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/index.js +4 -0
- package/le-input-advanced/index.js +7 -0
- package/le-input-advanced/src/main.vue +71 -0
- package/le-list/src/main.vue +31 -61
- package/le-list-form/src/main.vue +41 -49
- package/le-menu/src/main.vue +6 -27
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -41,6 +41,8 @@ import LeListForm from "./le-list-form/index.js";
|
|
|
41
41
|
import LeDatePicker from "./le-date-picker/index.js";
|
|
42
42
|
import LeUrl from "./le-url/index.js";
|
|
43
43
|
import LeSpan from "./le-span/index.js";
|
|
44
|
+
import LeInputAdvanced from "./le-input-advanced/index.js";
|
|
45
|
+
|
|
44
46
|
|
|
45
47
|
const components = [
|
|
46
48
|
LeArea,
|
|
@@ -81,6 +83,7 @@ const components = [
|
|
|
81
83
|
LeDatePicker,
|
|
82
84
|
LeSpan,
|
|
83
85
|
LeUrl,
|
|
86
|
+
LeInputAdvanced
|
|
84
87
|
];
|
|
85
88
|
|
|
86
89
|
const install = function (Vue) {
|
|
@@ -189,4 +192,5 @@ export default {
|
|
|
189
192
|
LeDatePicker,
|
|
190
193
|
LeUrl,
|
|
191
194
|
LeSpan,
|
|
195
|
+
LeInputAdvanced
|
|
192
196
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="le-input-money">
|
|
3
|
+
<el-input-number v-model="displayValue" v-bind="mergedAttrs" :class="['customClass', $attrs.class]"
|
|
4
|
+
:style="$attrs.style" :precision="precision" clearable></el-input-number>
|
|
5
|
+
单位:{{ unit }}
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
<script>
|
|
9
|
+
export default {
|
|
10
|
+
name: "le-input-advanced",
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
props: {
|
|
13
|
+
value: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: 0
|
|
16
|
+
},
|
|
17
|
+
converted: {//是否进行转换
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
},
|
|
21
|
+
scale: {//转换比例
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 100
|
|
24
|
+
},
|
|
25
|
+
precision: {//小数位数
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 2
|
|
28
|
+
},
|
|
29
|
+
unit: {//单位
|
|
30
|
+
type: String,
|
|
31
|
+
default: '元'
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
computed: {
|
|
35
|
+
displayValue: {
|
|
36
|
+
get() {
|
|
37
|
+
if (this.converted) {
|
|
38
|
+
return this.value / this.scale;
|
|
39
|
+
}
|
|
40
|
+
return this.value;
|
|
41
|
+
},
|
|
42
|
+
set(val) {
|
|
43
|
+
let value = val !== null && val !== undefined ? val : null;
|
|
44
|
+
if (this.converted) {
|
|
45
|
+
value = val !== null && val !== undefined ? Math.round(val * this.scale) : null;
|
|
46
|
+
}
|
|
47
|
+
this.$emit('input', value);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
mergedAttrs() {
|
|
51
|
+
const { value, min, max, step, ...attrs } = this.$attrs;
|
|
52
|
+
const converted = {};
|
|
53
|
+
['min', 'max', 'step'].forEach(attr => {
|
|
54
|
+
if (typeof this.$attrs[attr] === 'number') {
|
|
55
|
+
converted[attr] = this.$attrs[attr] / 100
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
return { ...attrs, ...converted }
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
<style lang="scss" scoped>
|
|
65
|
+
.le-input-money {
|
|
66
|
+
width: 100%;
|
|
67
|
+
display: flex;
|
|
68
|
+
display: -webkit-flex;
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
</style>
|
package/le-list/src/main.vue
CHANGED
|
@@ -5,79 +5,46 @@
|
|
|
5
5
|
<el-form-item>
|
|
6
6
|
<slot></slot>
|
|
7
7
|
<le-button type="primary" @click="onClickQuery()">查询</le-button>
|
|
8
|
-
<le-button type="primary" @click="addItem()" v-if="isDispAddBtn"
|
|
9
|
-
>新建</le-button
|
|
10
|
-
>
|
|
8
|
+
<le-button type="primary" @click="addItem()" v-if="isDispAddBtn">新建</le-button>
|
|
11
9
|
<slot name="headerBtns" :params="searchData"></slot>
|
|
12
10
|
</el-form-item>
|
|
13
11
|
</el-form>
|
|
14
|
-
<el-table
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
:
|
|
18
|
-
|
|
19
|
-
row-key="id"
|
|
20
|
-
:header-cell-style="{ 'text-align': 'center' }"
|
|
21
|
-
:cell-style="{ 'text-align': 'center' }"
|
|
22
|
-
stripe
|
|
23
|
-
style="width: 100%"
|
|
24
|
-
>
|
|
25
|
-
<el-table-column
|
|
26
|
-
v-for="column in tableColumns"
|
|
27
|
-
show-overflow-tooltip
|
|
28
|
-
:key="column.prop"
|
|
29
|
-
:prop="column.prop"
|
|
30
|
-
:label="column.label"
|
|
31
|
-
:width="column.width"
|
|
32
|
-
>
|
|
12
|
+
<el-table ref="eltablemain" :max-height="elTableMaxHeight" :data="tableData" border row-key="id"
|
|
13
|
+
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }" stripe
|
|
14
|
+
style="width: 100%">
|
|
15
|
+
<el-table-column v-for="column in tableColumns" show-overflow-tooltip :key="column.prop" :prop="column.prop"
|
|
16
|
+
:label="column.label" :width="column.width">
|
|
33
17
|
<template #default="scope">
|
|
34
18
|
<!-- <span v-html="renderColumnContent(column, scope)"></span> -->
|
|
35
|
-
<component
|
|
36
|
-
:is="renderColumnContent(column)"
|
|
37
|
-
v-bind="getComponentProps(column, scope)"
|
|
38
|
-
></component>
|
|
19
|
+
<component :is="renderColumnContent(column)" v-bind="getComponentProps(column, scope)"></component>
|
|
39
20
|
</template>
|
|
40
21
|
</el-table-column>
|
|
41
|
-
<el-table-column
|
|
42
|
-
fixed="right"
|
|
43
|
-
label="操作"
|
|
44
|
-
:width="btnCellWidht"
|
|
45
|
-
align="center"
|
|
46
|
-
>
|
|
22
|
+
<el-table-column fixed="right" label="操作" :width="btnCellWidht" align="center">
|
|
47
23
|
<template slot-scope="scope">
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
24
|
+
<template v-if="$scopedSlots.rowAllBtns">
|
|
25
|
+
<slot name="rowAllBtns" :rowdata="scope.row"></slot>
|
|
26
|
+
</template>
|
|
27
|
+
<template v-else>
|
|
28
|
+
<div class="rowBtns">
|
|
29
|
+
<le-button @click="editItem(scope.row)" v-if="disBtn === 'edit'">
|
|
30
|
+
编辑</le-button>
|
|
31
|
+
<le-button @click="detail(scope.row)" v-if="disBtn === 'detail'">
|
|
32
|
+
详情</le-button>
|
|
33
|
+
<le-button-msg @click="del(scope.row.id)" v-if="isDispDelBtn">删除</le-button-msg>
|
|
34
|
+
<div class="rowBtnsExt">
|
|
35
|
+
<slot name="rowBtns" :scope="scope"></slot>
|
|
36
|
+
</div>
|
|
60
37
|
</div>
|
|
61
|
-
</
|
|
38
|
+
</template>
|
|
62
39
|
</template>
|
|
63
40
|
</el-table-column>
|
|
64
41
|
</el-table>
|
|
65
42
|
<div style="text-align: center; margin-top: 30px">
|
|
66
|
-
<el-pagination
|
|
67
|
-
|
|
68
|
-
layout="prev, pager, next"
|
|
69
|
-
:current-page="searchData.pageNo"
|
|
70
|
-
:total="searchData.total"
|
|
71
|
-
:page-size="searchData.pageSize"
|
|
72
|
-
@current-change="current_change"
|
|
73
|
-
>
|
|
43
|
+
<el-pagination background layout="prev, pager, next" :current-page="searchData.pageNo" :total="searchData.total"
|
|
44
|
+
:page-size="searchData.pageSize" @current-change="current_change">
|
|
74
45
|
</el-pagination>
|
|
75
46
|
</div>
|
|
76
|
-
<le-dialog-container
|
|
77
|
-
:title="dialogTitle"
|
|
78
|
-
:width="dialogWidth"
|
|
79
|
-
:showDialog="showDialog"
|
|
80
|
-
>
|
|
47
|
+
<le-dialog-container :title="dialogTitle" :width="dialogWidth" :showDialog="showDialog">
|
|
81
48
|
<slot name="sub" v-if="showDialog" :rowItem="rowItem"></slot>
|
|
82
49
|
</le-dialog-container>
|
|
83
50
|
</div>
|
|
@@ -107,7 +74,7 @@ export default {
|
|
|
107
74
|
},
|
|
108
75
|
searchParam: {
|
|
109
76
|
type: Object,
|
|
110
|
-
default: () => {},
|
|
77
|
+
default: () => { },
|
|
111
78
|
},
|
|
112
79
|
isDispAddBtn: {
|
|
113
80
|
type: Boolean,
|
|
@@ -190,8 +157,10 @@ export default {
|
|
|
190
157
|
if (column.formatter) {
|
|
191
158
|
value = column.formatter(scope.rows, scope.column, value);
|
|
192
159
|
}
|
|
160
|
+
if (column.type) {
|
|
161
|
+
value = this.format(column.type, value);
|
|
162
|
+
}
|
|
193
163
|
let ctype = this.componentMap[column.type];
|
|
194
|
-
value = this.format(ctype, value);
|
|
195
164
|
let prop = ctype?.prop || "value";
|
|
196
165
|
let param = {};
|
|
197
166
|
param[prop] = value || "";
|
|
@@ -245,7 +214,8 @@ export default {
|
|
|
245
214
|
date: () => this.parseTime(value),
|
|
246
215
|
currency: () => `$${parseFloat(value).toFixed(2)}`,
|
|
247
216
|
};
|
|
248
|
-
|
|
217
|
+
let result = renderers[type]?.() || value;
|
|
218
|
+
return result;
|
|
249
219
|
},
|
|
250
220
|
},
|
|
251
221
|
};
|
|
@@ -1,50 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-form
|
|
3
|
-
:
|
|
4
|
-
|
|
5
|
-
ref="ruleForm"
|
|
6
|
-
:label-width="labelWidth"
|
|
7
|
-
>
|
|
8
|
-
<el-form-item
|
|
9
|
-
v-for="(item, index) in formColumns"
|
|
10
|
-
:key="index"
|
|
11
|
-
:label="item.label"
|
|
12
|
-
:prop="item.prop"
|
|
13
|
-
class="leisure-form-item-class"
|
|
14
|
-
>
|
|
2
|
+
<el-form :model="formPop" :rules="rules" ref="ruleForm" :label-width="labelWidth">
|
|
3
|
+
<el-form-item v-for="(item, index) in formColumns" :key="index" :label="item.label" :prop="item.prop"
|
|
4
|
+
class="leisure-form-item-class">
|
|
15
5
|
<div class="comContainerClass">
|
|
16
|
-
<component
|
|
17
|
-
|
|
18
|
-
v-model="formPop[item.prop]"
|
|
19
|
-
v-bind="mergeProps(getComponentProps(item.type), item.attr || {})"
|
|
20
|
-
v-on="item.event"
|
|
21
|
-
>
|
|
6
|
+
<component :is="componentType(item.type)" v-model="formPop[item.prop]"
|
|
7
|
+
v-bind="mergeProps(getComponentProps(item), item.attr || {})" v-on="item.event" class="compontClass">
|
|
22
8
|
<template v-if="item.type === 'radio'">
|
|
23
|
-
<el-radio
|
|
24
|
-
|
|
25
|
-
:label="option.id"
|
|
26
|
-
:key="index + '_radio'"
|
|
27
|
-
>{{ option.lable }}</el-radio
|
|
28
|
-
>
|
|
9
|
+
<el-radio v-for="(option, index) in item.options" :label="option.id" :key="index + '_radio'">{{ option.lable
|
|
10
|
+
}}</el-radio>
|
|
29
11
|
</template>
|
|
30
12
|
<template v-else-if="item.type === 'select'">
|
|
31
|
-
<le-select-option
|
|
32
|
-
:
|
|
33
|
-
:label="item.kv.label"
|
|
34
|
-
:value="item.kv.key"
|
|
35
|
-
:keyNum="item.keyNum"
|
|
36
|
-
/>
|
|
13
|
+
<le-select-option :options="fieldOptions[item.prop]" :label="item.kv.label" :value="item.kv.key"
|
|
14
|
+
:keyNum="item.keyNum" />
|
|
37
15
|
</template>
|
|
38
16
|
</component>
|
|
17
|
+
<slot :name="item.prop"></slot>
|
|
39
18
|
</div>
|
|
40
19
|
</el-form-item>
|
|
20
|
+
<slot></slot>
|
|
41
21
|
<el-form-item v-rfooter>
|
|
42
|
-
<le-button
|
|
43
|
-
type="primary"
|
|
44
|
-
@click="saveData"
|
|
45
|
-
v-if="handleStatus == 1 || handleStatus == 2"
|
|
46
|
-
>保存</le-button
|
|
47
|
-
>
|
|
22
|
+
<le-button type="primary" @click="saveData" v-if="handleStatus == 1 || handleStatus == 2">保存</le-button>
|
|
48
23
|
<le-button type="info" @click="close()">关闭</le-button>
|
|
49
24
|
</el-form-item>
|
|
50
25
|
</el-form>
|
|
@@ -60,11 +35,11 @@ export default {
|
|
|
60
35
|
},
|
|
61
36
|
formData: {
|
|
62
37
|
type: Object,
|
|
63
|
-
default: () => {},
|
|
38
|
+
default: () => { },
|
|
64
39
|
},
|
|
65
40
|
rules: {
|
|
66
41
|
type: Object,
|
|
67
|
-
default: () => {},
|
|
42
|
+
default: () => { },
|
|
68
43
|
},
|
|
69
44
|
labelWidth: {
|
|
70
45
|
type: String,
|
|
@@ -72,7 +47,7 @@ export default {
|
|
|
72
47
|
},
|
|
73
48
|
fieldOptions: {
|
|
74
49
|
type: Object,
|
|
75
|
-
default: () => {},
|
|
50
|
+
default: () => { },
|
|
76
51
|
},
|
|
77
52
|
handleStatus: {
|
|
78
53
|
type: Number,
|
|
@@ -84,6 +59,7 @@ export default {
|
|
|
84
59
|
handler(val) {
|
|
85
60
|
if (val) {
|
|
86
61
|
this.formPop = JSON.parse(JSON.stringify(val));
|
|
62
|
+
this.$emit("itemChange", this.formPop);
|
|
87
63
|
}
|
|
88
64
|
},
|
|
89
65
|
deep: true,
|
|
@@ -109,6 +85,10 @@ export default {
|
|
|
109
85
|
props: {},
|
|
110
86
|
},
|
|
111
87
|
radio: { component: "el-radio-group", props: {} },
|
|
88
|
+
money: {
|
|
89
|
+
component: "le-input-advanced",
|
|
90
|
+
props: {},
|
|
91
|
+
},
|
|
112
92
|
date: {
|
|
113
93
|
component: "le-date-picker",
|
|
114
94
|
props: {
|
|
@@ -118,21 +98,29 @@ export default {
|
|
|
118
98
|
},
|
|
119
99
|
},
|
|
120
100
|
select: { component: "le-select", props: {} },
|
|
101
|
+
image: { component: "le-image-container", props: {} },
|
|
121
102
|
},
|
|
122
103
|
formPop: {},
|
|
123
104
|
options: {}, //{field1:[{value:1,label:'选项1'},{value:2,label:'选项2'}]}
|
|
124
105
|
};
|
|
125
106
|
},
|
|
126
107
|
computed: {},
|
|
127
|
-
mounted() {},
|
|
108
|
+
mounted() { },
|
|
128
109
|
methods: {
|
|
129
110
|
componentType(type) {
|
|
130
111
|
let result = this.componentMap[type]?.component || "le-input";
|
|
131
112
|
return result;
|
|
132
113
|
},
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
114
|
+
getComponentProps(item) {
|
|
115
|
+
let type = item.type;
|
|
116
|
+
let props = this.componentMap[type]?.props || {};
|
|
117
|
+
if (type === "image") {
|
|
118
|
+
let images = [];
|
|
119
|
+
images.push(this.formPop[item.prop]);
|
|
120
|
+
props = { ...props, "images": images };
|
|
121
|
+
return props;
|
|
122
|
+
}
|
|
123
|
+
return this.componentMap[item.type]?.props || {};
|
|
136
124
|
},
|
|
137
125
|
mergeProps(defaultProps, customProps) {
|
|
138
126
|
return { ...defaultProps, ...customProps };
|
|
@@ -144,7 +132,7 @@ export default {
|
|
|
144
132
|
saveData() {
|
|
145
133
|
this.$refs["ruleForm"].validate((valid) => {
|
|
146
134
|
if (valid) {
|
|
147
|
-
this.$emit("saveData", this.formPop, () => {});
|
|
135
|
+
this.$emit("saveData", this.formPop, () => { });
|
|
148
136
|
} else {
|
|
149
137
|
return false;
|
|
150
138
|
}
|
|
@@ -154,11 +142,15 @@ export default {
|
|
|
154
142
|
};
|
|
155
143
|
</script>
|
|
156
144
|
<style lang="scss" scoped>
|
|
157
|
-
.leisure-form-item-class {
|
|
158
|
-
|
|
145
|
+
.leisure-form-item-class {}
|
|
146
|
+
|
|
159
147
|
.comContainerClass {
|
|
160
|
-
|
|
161
|
-
|
|
148
|
+
display: flex;
|
|
149
|
+
display: -webkit-flex;
|
|
162
150
|
line-height: inherit;
|
|
151
|
+
|
|
152
|
+
.compontClass {
|
|
153
|
+
flex: 1
|
|
154
|
+
}
|
|
163
155
|
}
|
|
164
156
|
</style>
|
package/le-menu/src/main.vue
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="le-menu-mainClass">
|
|
3
3
|
<div class="titleClass">角色:{{ roleInfo.roleName }}的功能菜单</div>
|
|
4
|
-
<el-tree
|
|
5
|
-
:data="menus"
|
|
6
|
-
ref="elTree"
|
|
7
|
-
show-checkbox
|
|
8
|
-
node-key="id"
|
|
9
|
-
:props="props"
|
|
10
|
-
>
|
|
4
|
+
<el-tree :data="menus" ref="elTree" show-checkbox node-key="id" :props="props">
|
|
11
5
|
<span class="custom-tree-node" slot-scope="{ node, data }">
|
|
12
6
|
<span>{{ node.label }}</span>
|
|
13
7
|
<span v-if="!data.children && data.btns && data.btns.length > 0">
|
|
14
|
-
<el-button
|
|
15
|
-
type="text"
|
|
16
|
-
size="mini"
|
|
17
|
-
@click="() => buttonPermission(data)"
|
|
18
|
-
>
|
|
8
|
+
<el-button type="text" size="mini" @click="() => buttonPermission(data)">
|
|
19
9
|
页面按钮
|
|
20
10
|
</el-button>
|
|
21
11
|
</span>
|
|
@@ -26,21 +16,10 @@
|
|
|
26
16
|
<el-button type="primary" @click="saveAll">保 存</el-button>
|
|
27
17
|
</div>
|
|
28
18
|
<div>
|
|
29
|
-
<el-dialog
|
|
30
|
-
width="50%"
|
|
31
|
-
title="页面按钮"
|
|
32
|
-
append-to-body
|
|
33
|
-
:visible.sync="showDialog"
|
|
34
|
-
:close-on-click-modal="true"
|
|
35
|
-
>
|
|
19
|
+
<el-dialog width="50%" title="页面按钮" append-to-body :visible.sync="showDialog" :close-on-click-modal="true">
|
|
36
20
|
<el-form>
|
|
37
21
|
<el-checkbox-group v-model="checkBtnList">
|
|
38
|
-
<el-checkbox
|
|
39
|
-
v-for="item in btnsList"
|
|
40
|
-
:label="item.id"
|
|
41
|
-
:key="item.id"
|
|
42
|
-
>{{ item.name }}</el-checkbox
|
|
43
|
-
>
|
|
22
|
+
<el-checkbox v-for="item in btnsList" :label="item.id" :key="item.id">{{ item.name }}</el-checkbox>
|
|
44
23
|
</el-checkbox-group>
|
|
45
24
|
</el-form>
|
|
46
25
|
<span slot="footer" class="dialog-footer">
|
|
@@ -59,7 +38,7 @@ export default {
|
|
|
59
38
|
props: {
|
|
60
39
|
roleInfo: {
|
|
61
40
|
type: Object,
|
|
62
|
-
default: () => {},
|
|
41
|
+
default: () => { },
|
|
63
42
|
},
|
|
64
43
|
},
|
|
65
44
|
data() {
|
|
@@ -193,7 +172,7 @@ export default {
|
|
|
193
172
|
});
|
|
194
173
|
},
|
|
195
174
|
saveAll() {
|
|
196
|
-
this.save().then(() => {});
|
|
175
|
+
this.save().then(() => { });
|
|
197
176
|
},
|
|
198
177
|
getMenus() {
|
|
199
178
|
let param = {};
|