@tripup-company/element-ui-extended 0.0.1 → 0.0.2
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/dist/element-ui-extended.common.js +1514 -172
- package/dist/element-ui-extended.common.js.map +1 -1
- package/dist/element-ui-extended.css +1 -0
- package/dist/element-ui-extended.umd.js +1518 -176
- package/dist/element-ui-extended.umd.js.map +1 -1
- package/dist/element-ui-extended.umd.min.js +1 -1
- package/dist/element-ui-extended.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/App.vue +2 -7
- package/src/components/CreateForm/index.vue +97 -0
- package/src/components/EditableField/index.vue +185 -0
- package/src/components/NewField/index.vue +132 -0
- package/src/components/PartColumn/EditColumn.vue +95 -0
- package/src/components/PartColumn/NewColumn.vue +101 -0
- package/src/components/PartForm/index.vue +36 -0
- package/src/components/UpdateForm/index.vue +137 -0
- package/src/components/Test/index.vue +0 -22
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div id="app">
|
|
3
3
|
<img alt="Vue logo" src="./assets/logo.png" />
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
</div>
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
8
|
<script lang="ts">
|
|
9
9
|
import { Component, Vue } from "vue-property-decorator";
|
|
10
|
-
import HelloWorld from "./components/HelloWorld.vue";
|
|
11
|
-
import Test from "./components/Test/index.vue";
|
|
12
10
|
@Component({
|
|
13
|
-
components: {
|
|
14
|
-
HelloWorld,
|
|
15
|
-
Test,
|
|
16
|
-
},
|
|
11
|
+
components: {},
|
|
17
12
|
})
|
|
18
13
|
export default class App extends Vue {}
|
|
19
14
|
</script>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-form
|
|
3
|
+
ref="form"
|
|
4
|
+
:rules="config.rules"
|
|
5
|
+
:model="formLocal"
|
|
6
|
+
class="m-w-1200"
|
|
7
|
+
label-position="left"
|
|
8
|
+
label-width="140px"
|
|
9
|
+
>
|
|
10
|
+
<el-card shadow="always">
|
|
11
|
+
<div slot="header" class="clearfix">
|
|
12
|
+
<el-row type="flex" justify="space-between">
|
|
13
|
+
<el-col class="flex align-center justify-start" :span="6">
|
|
14
|
+
<h3 class="m-b-0">New {{ formLocal.object }}</h3>
|
|
15
|
+
</el-col>
|
|
16
|
+
<el-col class="flex align-center justify-end" :span="6">
|
|
17
|
+
<el-button type="success" class="fr" @click="saveForm"
|
|
18
|
+
>Save</el-button
|
|
19
|
+
>
|
|
20
|
+
</el-col>
|
|
21
|
+
</el-row>
|
|
22
|
+
</div>
|
|
23
|
+
<el-row :gutter="20">
|
|
24
|
+
<el-col
|
|
25
|
+
:xl="colResolutionLg.xl"
|
|
26
|
+
:lg="colResolutionLg.lg"
|
|
27
|
+
:md="colResolutionLg.md"
|
|
28
|
+
:sm="colResolutionLg.sm"
|
|
29
|
+
:xs="colResolutionLg.xs"
|
|
30
|
+
>
|
|
31
|
+
<new-column
|
|
32
|
+
:data="formLocal"
|
|
33
|
+
:fields="config.formFields"
|
|
34
|
+
:errors="errors"
|
|
35
|
+
/>
|
|
36
|
+
</el-col>
|
|
37
|
+
</el-row>
|
|
38
|
+
</el-card>
|
|
39
|
+
</el-form>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import getResolution from "@/services/resolutions";
|
|
44
|
+
import NewColumn from "../PartColumn/NewColumn";
|
|
45
|
+
import { BaseModel } from '../../models/base-model';
|
|
46
|
+
export default {
|
|
47
|
+
name: "CreateForm",
|
|
48
|
+
components: { NewColumn },
|
|
49
|
+
props: {
|
|
50
|
+
form: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => {
|
|
53
|
+
return new BaseModel();
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
errors: {
|
|
57
|
+
type: Object,
|
|
58
|
+
default: () => {},
|
|
59
|
+
},
|
|
60
|
+
config: {
|
|
61
|
+
type: Object,
|
|
62
|
+
default: () => {
|
|
63
|
+
return {
|
|
64
|
+
rules: null,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
data() {
|
|
70
|
+
return {
|
|
71
|
+
colResolutionLg: getResolution("fullResolution"),
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
computed: {
|
|
75
|
+
formLocal: {
|
|
76
|
+
get() {
|
|
77
|
+
return this.form;
|
|
78
|
+
},
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
80
|
+
set(value) {
|
|
81
|
+
this.$emit("create:form", this.form);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
methods: {
|
|
86
|
+
saveForm() {
|
|
87
|
+
this.$refs["form"].validate((valid) => {
|
|
88
|
+
if (!valid) {
|
|
89
|
+
this.$message.error("Fill all required fields");
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
this.$emit("save", this.form);
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
</script>
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="editable-cell">
|
|
3
|
+
<div
|
|
4
|
+
v-if="!isEditMode"
|
|
5
|
+
class="editable-cell__text"
|
|
6
|
+
>
|
|
7
|
+
<slot class="editable-cell__text__slot">
|
|
8
|
+
<el-col :span="23">
|
|
9
|
+
<div v-if="value && ['input', 'textarea', 'number'].includes(type)" v-html="value" />
|
|
10
|
+
<el-checkbox v-else-if="type === 'checkbox'" v-model="value" disabled />
|
|
11
|
+
<el-date-picker v-else-if="type === 'date-picker'" v-model="value" type="date" format="dd.MM.yyyy" value-format="yyyy-MM-dd" disabled placeholder="Pick a day" class="w-100 el-date-transparent" />
|
|
12
|
+
<div v-else-if="isSelectValue" v-html="createList()" />
|
|
13
|
+
<div v-else> {{ placeholder ? placeholder : '-' }}</div>
|
|
14
|
+
</el-col>
|
|
15
|
+
<el-col :span="1">
|
|
16
|
+
<el-button
|
|
17
|
+
class="edit-icon pull-right"
|
|
18
|
+
icon="el-icon-edit"
|
|
19
|
+
circle
|
|
20
|
+
type="primary"
|
|
21
|
+
size="mini"
|
|
22
|
+
@click="handleDoubleClick"
|
|
23
|
+
/>
|
|
24
|
+
</el-col>
|
|
25
|
+
</slot>
|
|
26
|
+
</div>
|
|
27
|
+
<div v-if="isEditMode" class="editable-cell__editor">
|
|
28
|
+
<el-checkbox v-if="type === 'checkbox'" v-model="model" />
|
|
29
|
+
<el-input-number v-else-if="type === 'number'" v-model="model" :precision="precision" class="w-70" />
|
|
30
|
+
<el-select v-else-if="type === 'select'" v-model="model" :span="24" clearable :filterable="filterable" :remote="remote" :remote-method="remoteMethodHandler" placeholder="Select" :multiple="selectMultiple" class="w-100">
|
|
31
|
+
<el-option
|
|
32
|
+
v-for="item in selectListLocal"
|
|
33
|
+
:key="item[selectKey]"
|
|
34
|
+
:label="item[selectLabel]"
|
|
35
|
+
:value="item[selectValue]"
|
|
36
|
+
/>
|
|
37
|
+
</el-select>
|
|
38
|
+
<el-date-picker v-else-if="type === 'date-picker'" v-model="model" format="dd.MM.yyyy" value-format="yyyy-MM-dd" type="date" placeholder="Pick a day" class="w-100" />
|
|
39
|
+
<el-input
|
|
40
|
+
v-else
|
|
41
|
+
v-model="model"
|
|
42
|
+
:rows="3"
|
|
43
|
+
:type="type"
|
|
44
|
+
:placeholder="placeholder"
|
|
45
|
+
class="editable-cell__input"
|
|
46
|
+
/>
|
|
47
|
+
<el-button-group class="editable-cell__actions">
|
|
48
|
+
<el-button v-if="isEditMode" type="success" size="mini" icon="el-icon-check" @click="handleSave" />
|
|
49
|
+
<el-button v-if="isEditMode" type="warning" size="mini" icon="el-icon-close" @click="handleClose" />
|
|
50
|
+
</el-button-group>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script>
|
|
56
|
+
|
|
57
|
+
export default {
|
|
58
|
+
name: 'EditableField',
|
|
59
|
+
model: {
|
|
60
|
+
props: 'value',
|
|
61
|
+
event: 'input',
|
|
62
|
+
},
|
|
63
|
+
props: {
|
|
64
|
+
field: {
|
|
65
|
+
type: [String, Boolean],
|
|
66
|
+
default: '',
|
|
67
|
+
},
|
|
68
|
+
value: {
|
|
69
|
+
type: [String, Boolean, Date, Number, Array],
|
|
70
|
+
default: '',
|
|
71
|
+
},
|
|
72
|
+
filterable: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: false,
|
|
75
|
+
},
|
|
76
|
+
type: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: 'input',
|
|
79
|
+
},
|
|
80
|
+
placeholder: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: '',
|
|
83
|
+
},
|
|
84
|
+
selectList: {
|
|
85
|
+
type: Array,
|
|
86
|
+
default: () => [],
|
|
87
|
+
},
|
|
88
|
+
selectMultiple: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: false,
|
|
91
|
+
},
|
|
92
|
+
selectKey: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: '',
|
|
95
|
+
},
|
|
96
|
+
selectLabel: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: '',
|
|
99
|
+
},
|
|
100
|
+
selectValue: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: '',
|
|
103
|
+
},
|
|
104
|
+
precision: {
|
|
105
|
+
type: Number,
|
|
106
|
+
default: 0,
|
|
107
|
+
},
|
|
108
|
+
step: {
|
|
109
|
+
type: Number,
|
|
110
|
+
default: 1,
|
|
111
|
+
},
|
|
112
|
+
remoteMethod: {
|
|
113
|
+
type: Object,
|
|
114
|
+
default: null,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
data: () => {
|
|
118
|
+
return {
|
|
119
|
+
isEditMode: false,
|
|
120
|
+
model: '',
|
|
121
|
+
selectListLocal: [],
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
computed: {
|
|
125
|
+
isSelectValue: {
|
|
126
|
+
get() {
|
|
127
|
+
return (this.value || this.value === false) && this.type === 'select';
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
remote: {
|
|
131
|
+
get() {
|
|
132
|
+
return this.remoteMethod !== null;
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
remoteMethodHandler: {
|
|
136
|
+
get() {
|
|
137
|
+
if (this.remoteMethod !== null) {
|
|
138
|
+
return this.remoteCall;
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
mounted() {
|
|
145
|
+
this.selectListLocal = this.selectList;
|
|
146
|
+
},
|
|
147
|
+
methods: {
|
|
148
|
+
createList() {
|
|
149
|
+
let label = '';
|
|
150
|
+
if (this.selectMultiple) {
|
|
151
|
+
this.value.forEach(element => {
|
|
152
|
+
label = label + ' ' + this.selectList.find(({ value }) => value === element).name;
|
|
153
|
+
});
|
|
154
|
+
} else if (this.selectList.length) {
|
|
155
|
+
label = this.selectList.find(x =>
|
|
156
|
+
x[this.selectKey] === this.value)[this.selectLabel];
|
|
157
|
+
} else {
|
|
158
|
+
label = this.value;
|
|
159
|
+
}
|
|
160
|
+
return label;
|
|
161
|
+
},
|
|
162
|
+
handleDoubleClick() {
|
|
163
|
+
this.$emit('editable:open');
|
|
164
|
+
this.isEditMode = true;
|
|
165
|
+
this.model = this.value;
|
|
166
|
+
},
|
|
167
|
+
handleClose() {
|
|
168
|
+
this.isEditMode = false;
|
|
169
|
+
this.$emit('editable:close');
|
|
170
|
+
},
|
|
171
|
+
async remoteCall(query) {
|
|
172
|
+
this.loading = true;
|
|
173
|
+
const response = await this.remoteMethod.all({ search: this.selectLabel + ':' + query, searchFields: this.selectLabel + ':like' });
|
|
174
|
+
this.selectListLocal = response.data;
|
|
175
|
+
this.loading = false;
|
|
176
|
+
},
|
|
177
|
+
async handleSave() {
|
|
178
|
+
this.isEditMode = false;
|
|
179
|
+
this.$emit('editable:close');
|
|
180
|
+
this.$emit('editable:save', { 'field': this.field, 'value': this.model });
|
|
181
|
+
this.$emit('update:value', { 'field': this.field, 'value': this.model });
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
</script>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="editable-cell">
|
|
3
|
+
<div class="editable-cell__editor">
|
|
4
|
+
<slot class="editable-cell__text__slot">
|
|
5
|
+
<el-col :span="24">
|
|
6
|
+
<el-checkbox v-if="type === 'checkbox'" v-model="dataModel" />
|
|
7
|
+
<el-select v-else-if="type === 'select'" v-model="dataModel" :filterable="filterable" :loading="loading" :remote="remote" :remote-method="remoteMethodHandler" :span="24" clearable placeholder="Select" :multiple="selectMultiple" class="w-100">
|
|
8
|
+
<el-option
|
|
9
|
+
v-for="item in selectListLocal"
|
|
10
|
+
:key="item[selectKey]"
|
|
11
|
+
:label="item[selectLabel]"
|
|
12
|
+
:value="item[selectValue]"
|
|
13
|
+
/>
|
|
14
|
+
</el-select>
|
|
15
|
+
<el-date-picker v-else-if="type === 'date-picker'" v-model="dataModel" format="dd.MM.yyyy" value-format="yyyy-MM-dd" type="date" placeholder="Pick a day" class="w-100" />
|
|
16
|
+
<el-input-number v-else-if="type === 'number'" v-model="dataModel" :step="step" :precision="precision" class="w-100" />
|
|
17
|
+
<el-input
|
|
18
|
+
v-else
|
|
19
|
+
v-model="dataModel"
|
|
20
|
+
:type="type"
|
|
21
|
+
:placeholder="placeholder"
|
|
22
|
+
class="editable-cell__input"
|
|
23
|
+
/>
|
|
24
|
+
</el-col>
|
|
25
|
+
</slot>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
name: 'NewField',
|
|
34
|
+
props: {
|
|
35
|
+
field: {
|
|
36
|
+
type: [String, Boolean],
|
|
37
|
+
default: '',
|
|
38
|
+
},
|
|
39
|
+
filterable: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
value: {
|
|
44
|
+
type: [String, Boolean, Date, Number, Array],
|
|
45
|
+
default: '',
|
|
46
|
+
},
|
|
47
|
+
type: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: 'input',
|
|
50
|
+
},
|
|
51
|
+
placeholder: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: '',
|
|
54
|
+
},
|
|
55
|
+
selectList: {
|
|
56
|
+
type: Array,
|
|
57
|
+
default: () => {
|
|
58
|
+
return [];
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
selectMultiple: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false,
|
|
64
|
+
},
|
|
65
|
+
selectKey: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: '',
|
|
68
|
+
},
|
|
69
|
+
selectLabel: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: '',
|
|
72
|
+
},
|
|
73
|
+
selectValue: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: '',
|
|
76
|
+
},
|
|
77
|
+
precision: {
|
|
78
|
+
type: Number,
|
|
79
|
+
default: 0,
|
|
80
|
+
},
|
|
81
|
+
step: {
|
|
82
|
+
type: Number,
|
|
83
|
+
default: 1,
|
|
84
|
+
},
|
|
85
|
+
remoteMethod: {
|
|
86
|
+
type: Object,
|
|
87
|
+
default: null,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
data() {
|
|
91
|
+
return {
|
|
92
|
+
loading: false,
|
|
93
|
+
selectListLocal: [],
|
|
94
|
+
dataModel: window._.cloneDeep(this.value),
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
computed: {
|
|
98
|
+
remote: {
|
|
99
|
+
get() {
|
|
100
|
+
return this.remoteMethod !== null;
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
remoteMethodHandler: {
|
|
104
|
+
get() {
|
|
105
|
+
if (this.remoteMethod !== null) {
|
|
106
|
+
return this.remoteCall;
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
watch: {
|
|
113
|
+
dataModel: function() {
|
|
114
|
+
this.$emit('editable:save', { 'field': this.field, 'value': this.dataModel });
|
|
115
|
+
},
|
|
116
|
+
value: function() {
|
|
117
|
+
this.dataModel = this._.cloneDeep(this.value);
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
mounted() {
|
|
121
|
+
this.selectListLocal = this.selectList;
|
|
122
|
+
},
|
|
123
|
+
methods: {
|
|
124
|
+
async remoteCall(query) {
|
|
125
|
+
this.loading = true;
|
|
126
|
+
const response = await this.remoteMethod.all({ search: this.selectLabel + ':' +query, searchFields: this.selectLabel + ':like' });
|
|
127
|
+
this.selectListLocal = response.data;
|
|
128
|
+
this.loading = false;
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
</script>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-col :xl="colResolution.lg" :lg="colResolution.lg" :md="colResolution.md" :sm="colResolution.sm" :xs="colResolution.xs" class="p-r-5 p-l-5">
|
|
3
|
+
<template v-for="(field) of fields">
|
|
4
|
+
<el-col
|
|
5
|
+
:key="field.prop"
|
|
6
|
+
:xl="fieldResolution(field, 'xl')"
|
|
7
|
+
:lg="fieldResolution(field, 'lg')"
|
|
8
|
+
:md="fieldResolution(field, 'md')"
|
|
9
|
+
:sm="fieldResolution(field, 'sm')"
|
|
10
|
+
:xs="fieldResolution(field, 'xs')"
|
|
11
|
+
class="p-r-5 p-l-5"
|
|
12
|
+
>
|
|
13
|
+
<el-form-item :prop="propPrefix + field.prop" :label="field.label" :error="errors[field.prop] ? errors[field.prop][0] : ''">
|
|
14
|
+
<editable-field
|
|
15
|
+
v-model="data[field.prop]"
|
|
16
|
+
:type="field.selectList ? 'select' : (field.type? field.type :'input')"
|
|
17
|
+
:select-list="field.selectList ? field.selectList : []"
|
|
18
|
+
:select-multiple="field.selectMultiple"
|
|
19
|
+
:select-key="field.selectList ? (field.selectKey ? field.selectKey : 'value' ) : ''"
|
|
20
|
+
:select-label="field.selectList ? (field.selectLabel ? field.selectLabel : 'name' ) : ''"
|
|
21
|
+
:select-value="field.selectList ? (field.selectValue ? field.selectValue : 'value' ) : ''"
|
|
22
|
+
:field="field.prop"
|
|
23
|
+
:precision="field.precision ? field.precision : 0"
|
|
24
|
+
:remote-method="field.remoteMethod ? field.remoteMethod : null"
|
|
25
|
+
:filterable="field.filterable ? field.filterable : null"
|
|
26
|
+
@editable:save="updateValue"
|
|
27
|
+
/>
|
|
28
|
+
</el-form-item>
|
|
29
|
+
</el-col>
|
|
30
|
+
</template>
|
|
31
|
+
</el-col>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
|
|
36
|
+
import Vue from 'vue';
|
|
37
|
+
import getResolution from '../../services/resolutions';
|
|
38
|
+
import EditableField from '../EditableField';
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
name: 'PartColumnEdit',
|
|
42
|
+
components: { EditableField },
|
|
43
|
+
props: {
|
|
44
|
+
colResolution: {
|
|
45
|
+
type: Object,
|
|
46
|
+
default: () => {
|
|
47
|
+
return getResolution('fullResolution');
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
colInnerResolution: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => {
|
|
53
|
+
return getResolution('fullResolution');
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
columnName: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: '',
|
|
59
|
+
},
|
|
60
|
+
propPrefix: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: '',
|
|
63
|
+
},
|
|
64
|
+
fields: {
|
|
65
|
+
type: Array,
|
|
66
|
+
default: () => [],
|
|
67
|
+
},
|
|
68
|
+
data: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default: () => {},
|
|
71
|
+
},
|
|
72
|
+
errors: {
|
|
73
|
+
type: Object,
|
|
74
|
+
default: () => {
|
|
75
|
+
return {};
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
methods: {
|
|
80
|
+
fieldResolution(field, size) {
|
|
81
|
+
return field.colResolution ? field.colResolution[size] : this.colInnerResolution[size];
|
|
82
|
+
},
|
|
83
|
+
updateValue(newValue) {
|
|
84
|
+
Vue.set(this.data, newValue.field, newValue.value);
|
|
85
|
+
this.$emit('save', { field: newValue.field, value: newValue.value, prefix: this.propPrefix });
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
</script>
|
|
90
|
+
<style>
|
|
91
|
+
.el-form-item--medium .el-form-item__label {
|
|
92
|
+
line-height: 22px;
|
|
93
|
+
padding-top: 6px;
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-col :xl="colResolution.lg" :lg="colResolution.lg" :md="colResolution.md" :sm="colResolution.sm" :xs="colResolution.xs" class="p-r-5 p-l-5">
|
|
3
|
+
<template v-for="(field) of fields">
|
|
4
|
+
<el-col
|
|
5
|
+
:key="field.prop"
|
|
6
|
+
:xl="fieldResolution(field, 'xl')"
|
|
7
|
+
:lg="fieldResolution(field, 'lg')"
|
|
8
|
+
:md="fieldResolution(field, 'md')"
|
|
9
|
+
:sm="fieldResolution(field, 'sm')"
|
|
10
|
+
:xs="fieldResolution(field, 'xs')"
|
|
11
|
+
class="p-r-5 p-l-5"
|
|
12
|
+
>
|
|
13
|
+
<el-form-item :prop="propPrefix + field.prop" :label="field.label" :error="errors[field.prop] ? errors[field.prop][0] : ''">
|
|
14
|
+
<new-field
|
|
15
|
+
v-model="dataModel[field.prop]"
|
|
16
|
+
:type="field.selectList ? 'select' : (field.type? field.type :'input')"
|
|
17
|
+
:select-list="field.selectList ? field.selectList : []"
|
|
18
|
+
:select-multiple="field.selectMultiple"
|
|
19
|
+
:select-key="field.selectList ? (field.selectKey ? field.selectKey : 'value' ) : ''"
|
|
20
|
+
:select-label="field.selectList ? (field.selectLabel ? field.selectLabel : 'name' ) : ''"
|
|
21
|
+
:select-value="field.selectList ? (field.selectValue ? field.selectValue : 'value' ) : ''"
|
|
22
|
+
:field="field.prop"
|
|
23
|
+
:precision="field.precision ? field.precision : 0"
|
|
24
|
+
:remote-method="field.remoteMethod ? field.remoteMethod : null"
|
|
25
|
+
:filterable="field.filterable ? field.filterable : null"
|
|
26
|
+
@editable:save="updateValue"
|
|
27
|
+
/>
|
|
28
|
+
</el-form-item>
|
|
29
|
+
</el-col>
|
|
30
|
+
</template>
|
|
31
|
+
</el-col>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
|
|
36
|
+
import Vue from 'vue';
|
|
37
|
+
import getResolution from '../../services/resolutions';
|
|
38
|
+
import NewField from '../NewField';
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
name: 'PartColumnNew',
|
|
42
|
+
components: { NewField },
|
|
43
|
+
props: {
|
|
44
|
+
colResolution: {
|
|
45
|
+
type: Object,
|
|
46
|
+
default: () => {
|
|
47
|
+
return getResolution('fullResolution');
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
colInnerResolution: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => {
|
|
53
|
+
return getResolution('fullResolution');
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
propPrefix: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: '',
|
|
59
|
+
},
|
|
60
|
+
columnName: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: '',
|
|
63
|
+
},
|
|
64
|
+
fields: {
|
|
65
|
+
type: Array,
|
|
66
|
+
default: () => [],
|
|
67
|
+
},
|
|
68
|
+
data: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default() {
|
|
71
|
+
return {};
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
errors: {
|
|
75
|
+
type: Object,
|
|
76
|
+
default: () => {
|
|
77
|
+
return {};
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
data() {
|
|
82
|
+
return {
|
|
83
|
+
dataModel: window._.cloneDeep(this.data),
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
watch: {
|
|
87
|
+
data: function() {
|
|
88
|
+
this.dataModel = window._.cloneDeep(this.data);
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
methods: {
|
|
92
|
+
fieldResolution(field, size) {
|
|
93
|
+
return field.colResolution ? field.colResolution[size] : this.colInnerResolution[size];
|
|
94
|
+
},
|
|
95
|
+
updateValue(newValue) {
|
|
96
|
+
Vue.set(this.data, newValue.field, newValue.value);
|
|
97
|
+
this.$emit('save', { 'field': newValue.field, 'value': newValue.value });
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-row>
|
|
3
|
+
<div class="part-form">
|
|
4
|
+
<div v-if="$slots.header || header" class="part-form__header">
|
|
5
|
+
<slot name="header">{{ header }}</slot>
|
|
6
|
+
<el-divider />
|
|
7
|
+
</div>
|
|
8
|
+
<div class="part-form__body" :style="bodyStyle">
|
|
9
|
+
<slot />
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</el-row>
|
|
13
|
+
</template>
|
|
14
|
+
<script>
|
|
15
|
+
import getResolution from '../../services/resolutions';
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'PartForm',
|
|
19
|
+
props: {
|
|
20
|
+
header: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: '',
|
|
23
|
+
},
|
|
24
|
+
bodyStyle: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: '',
|
|
27
|
+
},
|
|
28
|
+
rowResolution: {
|
|
29
|
+
type: Object,
|
|
30
|
+
default: function() {
|
|
31
|
+
return getResolution('fullFromSm');
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
</script>
|