leisure-core 0.4.64 → 0.4.65
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 +3 -0
- package/le-common-page/src/main.vue +23 -5
- package/le-common-page/src/sub.vue +33 -11
- package/le-option/index.js +7 -0
- package/le-option/src/main.vue +49 -0
- package/le-select/src/main.vue +1 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -34,6 +34,7 @@ import LeInput from "./le-input/index.js";
|
|
|
34
34
|
import LeForm from "./le-form/index";
|
|
35
35
|
import LeFormItem from "./le-form-item/index";
|
|
36
36
|
import LeInputNumber from "./le-input-number/index.js";
|
|
37
|
+
import LeOption from "./le-option/index.js";
|
|
37
38
|
|
|
38
39
|
const components = [
|
|
39
40
|
LeArea,
|
|
@@ -67,6 +68,7 @@ const components = [
|
|
|
67
68
|
LeInputNumber,
|
|
68
69
|
LeForm,
|
|
69
70
|
LeFormItem,
|
|
71
|
+
LeOption,
|
|
70
72
|
];
|
|
71
73
|
|
|
72
74
|
const install = function (Vue) {
|
|
@@ -168,4 +170,5 @@ export default {
|
|
|
168
170
|
LeInputNumber,
|
|
169
171
|
LeForm,
|
|
170
172
|
LeFormItem,
|
|
173
|
+
LeOption,
|
|
171
174
|
};
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
:prop="column.prop"
|
|
28
28
|
:label="column.label"
|
|
29
29
|
:width="column.width"
|
|
30
|
-
:formatter="column.formatter"
|
|
31
30
|
>
|
|
32
31
|
<template #default="scope">
|
|
33
32
|
<span v-if="column.type && column.type === 'url'">
|
|
@@ -39,15 +38,29 @@
|
|
|
39
38
|
{{ scope.row[column.prop] == 1 ? "是" : "否" }}
|
|
40
39
|
</span>
|
|
41
40
|
<span v-else>
|
|
42
|
-
|
|
41
|
+
<template v-if="column.formatter">
|
|
42
|
+
{{
|
|
43
|
+
column.formatter(
|
|
44
|
+
scope.rows,
|
|
45
|
+
scope.column,
|
|
46
|
+
scope.row[column.prop]
|
|
47
|
+
)
|
|
48
|
+
}}
|
|
49
|
+
</template>
|
|
50
|
+
<template v-else>
|
|
51
|
+
{{ scope.row[column.prop] }}
|
|
52
|
+
</template>
|
|
43
53
|
</span>
|
|
44
54
|
</template>
|
|
45
55
|
</el-table-column>
|
|
46
56
|
<el-table-column fixed="right" label="操作" align="center">
|
|
47
57
|
<template slot-scope="scope">
|
|
48
58
|
<div class="rowBtns">
|
|
49
|
-
<el-button
|
|
50
|
-
|
|
59
|
+
<el-button
|
|
60
|
+
type="primary"
|
|
61
|
+
size="small"
|
|
62
|
+
@click="editItem(scope.row)"
|
|
63
|
+
>{{ editMode === "edit" ? "编辑" : "详情" }}</el-button
|
|
51
64
|
>
|
|
52
65
|
<el-popconfirm
|
|
53
66
|
v-if="isDispDelBtn"
|
|
@@ -89,6 +102,7 @@
|
|
|
89
102
|
:formColumns="formColumns"
|
|
90
103
|
:field-options="fieldOptions"
|
|
91
104
|
:formData="rowItem"
|
|
105
|
+
:editMode="editMode"
|
|
92
106
|
@closeDialog="closeDialog"
|
|
93
107
|
@saveData="saveData"
|
|
94
108
|
v-if="showDialog"
|
|
@@ -147,7 +161,7 @@ export default {
|
|
|
147
161
|
},
|
|
148
162
|
popFormWidth: {
|
|
149
163
|
type: String,
|
|
150
|
-
default: "
|
|
164
|
+
default: "60%",
|
|
151
165
|
},
|
|
152
166
|
popFormLabelWidth: {
|
|
153
167
|
type: String,
|
|
@@ -165,6 +179,10 @@ export default {
|
|
|
165
179
|
type: Object,
|
|
166
180
|
default: () => {},
|
|
167
181
|
},
|
|
182
|
+
editMode: {
|
|
183
|
+
type: String,
|
|
184
|
+
default: "edit",
|
|
185
|
+
},
|
|
168
186
|
},
|
|
169
187
|
watch: {
|
|
170
188
|
searchParam: {
|
|
@@ -14,10 +14,12 @@
|
|
|
14
14
|
<le-input
|
|
15
15
|
v-if="!item.type || item.type === 'input'"
|
|
16
16
|
v-model="formPop[item.prop]"
|
|
17
|
+
v-bind="item.attr || {}"
|
|
17
18
|
/>
|
|
18
19
|
<le-input-number
|
|
19
20
|
v-else-if="item.type === 'number'"
|
|
20
21
|
v-model="formPop[item.prop]"
|
|
22
|
+
v-bind="item.attr || {}"
|
|
21
23
|
:min="item.min || 0"
|
|
22
24
|
:max="item.max || 9999999999"
|
|
23
25
|
label="item.label||''"
|
|
@@ -33,21 +35,32 @@
|
|
|
33
35
|
>{{ option.label }}</el-radio
|
|
34
36
|
>
|
|
35
37
|
</el-radio-group>
|
|
38
|
+
<el-date-picker
|
|
39
|
+
v-else-if="item.type === 'date'"
|
|
40
|
+
v-model="formPop[item.prop]"
|
|
41
|
+
v-bind="item.attr || {}"
|
|
42
|
+
value-format="timestamp"
|
|
43
|
+
type="date"
|
|
44
|
+
placeholder="选择日期"
|
|
45
|
+
/>
|
|
36
46
|
<le-select
|
|
37
47
|
v-else-if="item.type === 'select'"
|
|
38
48
|
v-model="formPop[item.prop]"
|
|
49
|
+
v-bind="item.attr || {}"
|
|
39
50
|
placeholder="请选择"
|
|
40
51
|
>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
:
|
|
44
|
-
:
|
|
45
|
-
:
|
|
52
|
+
<le-option
|
|
53
|
+
:options="fieldOptions[item.prop]"
|
|
54
|
+
:label="item.kv.label"
|
|
55
|
+
:value="item.kv.key"
|
|
56
|
+
:keyNum="item.keyNum"
|
|
46
57
|
/>
|
|
47
58
|
</le-select>
|
|
48
59
|
</el-form-item>
|
|
49
60
|
<el-form-item v-rfooter>
|
|
50
|
-
<le-button type="primary" @click="saveData"
|
|
61
|
+
<le-button type="primary" @click="saveData" v-if="editMode === 'edit'"
|
|
62
|
+
>保存</le-button
|
|
63
|
+
>
|
|
51
64
|
<le-button type="info" @click="close()">关闭</le-button>
|
|
52
65
|
</el-form-item>
|
|
53
66
|
</el-form>
|
|
@@ -56,9 +69,10 @@
|
|
|
56
69
|
import LeSelect from "../../le-select/index";
|
|
57
70
|
import LeInput from "../../le-input/index";
|
|
58
71
|
import LeButton from "../../le-button/index";
|
|
72
|
+
import LeOption from "../../le-option/index";
|
|
59
73
|
export default {
|
|
60
74
|
name: "le-common-page-sub",
|
|
61
|
-
components: { LeSelect, LeInput, LeButton },
|
|
75
|
+
components: { LeSelect, LeInput, LeButton, LeOption },
|
|
62
76
|
props: {
|
|
63
77
|
formColumns: {
|
|
64
78
|
type: Array,
|
|
@@ -80,6 +94,10 @@ export default {
|
|
|
80
94
|
type: Object,
|
|
81
95
|
default: () => {},
|
|
82
96
|
},
|
|
97
|
+
editMode: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: "edit",
|
|
100
|
+
},
|
|
83
101
|
},
|
|
84
102
|
watch: {
|
|
85
103
|
formData: {
|
|
@@ -89,10 +107,18 @@ export default {
|
|
|
89
107
|
deep: true,
|
|
90
108
|
immediate: true,
|
|
91
109
|
},
|
|
110
|
+
fieldOptions: {
|
|
111
|
+
handler(val) {
|
|
112
|
+
this.options = val;
|
|
113
|
+
},
|
|
114
|
+
deep: true,
|
|
115
|
+
immediate: true,
|
|
116
|
+
},
|
|
92
117
|
},
|
|
93
118
|
data() {
|
|
94
119
|
return {
|
|
95
120
|
formPop: {},
|
|
121
|
+
options: {}, //{field1:[{value:1,label:'选项1'},{value:2,label:'选项2'}]}
|
|
96
122
|
};
|
|
97
123
|
},
|
|
98
124
|
computed: {},
|
|
@@ -110,10 +136,6 @@ export default {
|
|
|
110
136
|
}
|
|
111
137
|
});
|
|
112
138
|
},
|
|
113
|
-
getOptions(prop) {
|
|
114
|
-
let options = this.fieldOptions[`${prop}Options`] || [];
|
|
115
|
-
return options;
|
|
116
|
-
},
|
|
117
139
|
},
|
|
118
140
|
};
|
|
119
141
|
</script>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-option
|
|
4
|
+
v-for="item in options"
|
|
5
|
+
:key="handleKv('key', item)"
|
|
6
|
+
:label="handleKv('label', item)"
|
|
7
|
+
:value="handleKv('value', item)"
|
|
8
|
+
></el-option>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
name: "le-options",
|
|
14
|
+
props: {
|
|
15
|
+
options: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default() {
|
|
18
|
+
return [];
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
value: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "",
|
|
24
|
+
},
|
|
25
|
+
label: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "",
|
|
28
|
+
},
|
|
29
|
+
keyNum: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 1,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
handleKv(type, item) {
|
|
36
|
+
if (this.keyNum == 1) {
|
|
37
|
+
if (type == "key" || type == "value") {
|
|
38
|
+
return item[this.value];
|
|
39
|
+
} else if (type == "label") {
|
|
40
|
+
return item[this.label];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (this.keyNum == 2) {
|
|
44
|
+
return item[this.value] + "-" + item[this.label];
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
</script>
|
package/le-select/src/main.vue
CHANGED