leisure-core 0.4.84 → 0.4.86

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 CHANGED
@@ -4,7 +4,6 @@ import {
4
4
  formatMoney,
5
5
  formatCurrency,
6
6
  } from "leisure-js/common/dformat";
7
- import LeCommonPage from "./le-common-page/index.js";
8
7
  import LeLogin from "./le-login/index.js";
9
8
  import LeHome from "./le-home/index.js";
10
9
  import LeButton from "./le-button/index.js";
@@ -37,6 +36,11 @@ import LeFormItem from "./le-form-item/index";
37
36
  import LeInputNumber from "./le-input-number/index.js";
38
37
  import LeSelectOption from "./le-select-option/index.js";
39
38
  import LeVideo from "./le-video/index.js";
39
+ import LeList from "./le-list/index.js";
40
+ import LeListForm from "./le-list-form/index.js";
41
+ import LeDatePicker from "./le-date-picker/index.js";
42
+ import LeUrl from "./le-url/index.js";
43
+ import LeSpan from "./le-span/index.js";
40
44
 
41
45
  const components = [
42
46
  LeArea,
@@ -64,7 +68,6 @@ const components = [
64
68
  LeHelp,
65
69
  LeHelpDetail,
66
70
  LeSelectUser,
67
- LeCommonPage,
68
71
  LeSelect,
69
72
  LeSelectSearch,
70
73
  LeInput,
@@ -73,6 +76,11 @@ const components = [
73
76
  LeFormItem,
74
77
  LeSelectOption,
75
78
  LeVideo,
79
+ LeListForm,
80
+ LeList,
81
+ LeDatePicker,
82
+ LeSpan,
83
+ LeUrl,
76
84
  ];
77
85
 
78
86
  const install = function (Vue) {
@@ -168,7 +176,6 @@ export default {
168
176
  LeHelp,
169
177
  LeHelpDetail,
170
178
  LeSelectUser,
171
- LeCommonPage,
172
179
  LeSelect,
173
180
  LeSelectSearch,
174
181
  LeInput,
@@ -177,4 +184,9 @@ export default {
177
184
  LeFormItem,
178
185
  LeSelectOption,
179
186
  LeVideo,
187
+ LeListForm,
188
+ LeList,
189
+ LeDatePicker,
190
+ LeUrl,
191
+ LeSpan,
180
192
  };
@@ -0,0 +1,7 @@
1
+ import LeDatePicker from "./src/main.vue";
2
+
3
+ LeDatePicker.install = function (Vue) {
4
+ Vue.component(LeDatePicker.name, LeDatePicker);
5
+ };
6
+
7
+ export default LeDatePicker;
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <el-date-picker
3
+ v-model="internalValue"
4
+ v-bind="$attrs"
5
+ v-on="$listeners"
6
+ :class="['customClass', $attrs.class]"
7
+ :style="$attrs.style"
8
+ :type="type"
9
+ ></el-date-picker>
10
+ </template>
11
+
12
+ <script>
13
+ export default {
14
+ name: "le-date-picker",
15
+ props: {
16
+ value: {
17
+ type: [Number, Date, String], // 可以接收时间戳、Date 对象或日期字符串
18
+ default: null,
19
+ },
20
+ type: {
21
+ type: String,
22
+ default: "date",
23
+ },
24
+ translateDate: {
25
+ type: Boolean,
26
+ default: false,
27
+ },
28
+ },
29
+ data() {
30
+ return {
31
+ internalValue: this.convertValueToInternal(this.value), // 初始化内部值
32
+ };
33
+ },
34
+ watch: {
35
+ // value(newVal) {
36
+ // this.internalValue = this.convertValueToInternal(newVal);
37
+ // },
38
+ // internalValue(newVal) {
39
+ // const outputValue = this.convertValueToOutput(newVal);
40
+ // this.$emit("input", outputValue);
41
+ // },
42
+ },
43
+ methods: {
44
+ convertValueToInternal(value) {
45
+ if (this.translateDate && typeof value === "number") {
46
+ return new Date(value * 1000);
47
+ } else if (value instanceof Date) {
48
+ return value;
49
+ } else if (typeof value === "string" && !isNaN(Date.parse(value))) {
50
+ return new Date(value);
51
+ } else {
52
+ return null;
53
+ }
54
+ },
55
+ convertValueToOutput(value) {
56
+ if (this.translateDate && value instanceof Date) {
57
+ return Math.floor(value.getTime() / 1000);
58
+ } else {
59
+ return value;
60
+ }
61
+ },
62
+ },
63
+ mounted() {
64
+ // 如果需要在组件挂载后执行某些操作,可以在这里添加代码。
65
+ },
66
+ };
67
+ </script>
@@ -1,13 +1,23 @@
1
1
  <template>
2
- <el-dialog :width="width" :title="title" :visible.sync="dialogShow" :close-on-click-modal="closeMode" append-to-body
3
- @close="closeDialog" v-el-drag-dialog>
2
+ <el-dialog
3
+ :width="width"
4
+ :title="title"
5
+ :visible.sync="dialogShow"
6
+ :close-on-click-modal="closeMode"
7
+ append-to-body
8
+ @close="closeDialog"
9
+ v-el-drag-dialog
10
+ >
4
11
  <slot v-if="dialogShow" />
5
12
  <div slot="footer" v-if="showFooter" class="dialog-footer">
6
13
  <template>
7
- <el-button type="info" v-if="showCloseBtn" @click="closeDialog">关闭</el-button>
8
- <el-button type="primary" v-if="showSaveBtn" @click="saveData">{{
14
+ <slot name="le-footer"></slot>
15
+ <le-button type="primary" v-if="showSaveBtn" @click="saveData">{{
9
16
  saveBtnText
10
- }}</el-button>
17
+ }}</le-button>
18
+ <le-button type="info" v-if="showCloseBtn" @click="closeDialog"
19
+ >关闭</le-button
20
+ >
11
21
  </template>
12
22
  </div>
13
23
  </el-dialog>
@@ -0,0 +1,3 @@
1
+ import Vue from "vue";
2
+
3
+ export const EventBus = new Vue();
@@ -0,0 +1,7 @@
1
+ import LeList from "./src/main.vue";
2
+
3
+ LeList.install = function (Vue) {
4
+ Vue.component(LeList.name, LeList);
5
+ };
6
+
7
+ export default LeList;
@@ -31,64 +31,30 @@
31
31
  :width="column.width"
32
32
  >
33
33
  <template #default="scope">
34
- <span v-if="column.type && column.type === 'url'">
35
- <a :href="scope.row[column.prop]" target="_blank">{{
36
- scope.row[column.prop]
37
- }}</a>
38
- </span>
39
- <span v-else-if="column.type && column.type === 'bool'">
40
- {{ scope.row[column.prop] == 1 ? "是" : "否" }}
41
- </span>
42
- <span v-else>
43
- <template v-if="column.formatter">
44
- {{
45
- column.formatter(
46
- scope.rows,
47
- scope.column,
48
- scope.row[column.prop]
49
- )
50
- }}
51
- </template>
52
- <template v-else>
53
- {{ scope.row[column.prop] }}
54
- </template>
55
- </span>
34
+ <!-- <span v-html="renderColumnContent(column, scope)"></span> -->
35
+ <component
36
+ :is="renderColumnContent(column)"
37
+ v-bind="getComponentProps(column, scope)"
38
+ ></component>
56
39
  </template>
57
40
  </el-table-column>
58
41
  <el-table-column
59
42
  fixed="right"
60
43
  label="操作"
61
- :width="opWidht"
44
+ :width="btnCellWidht"
62
45
  align="center"
63
46
  >
64
47
  <template slot-scope="scope">
65
48
  <div class="rowBtns">
66
- <el-button
67
- v-if="disBtn === 'edit'"
68
- type="primary"
69
- size="small"
70
- @click="editItem(scope.row)"
49
+ <le-button @click="editItem(scope.row)" v-if="disBtn === 'edit'">
50
+ 编辑</le-button
71
51
  >
72
- 编辑
73
- </el-button>
74
- <el-button
75
- v-if="disBtn === 'detail'"
76
- type="primary"
77
- size="small"
78
- @click="detail(scope.row)"
79
- >详情
80
- </el-button>
81
- <el-popconfirm
82
- v-if="isDispDelBtn"
83
- :title="`该操作不可逆,确定删除?`"
84
- @confirm="del(scope.row.id)"
52
+ <le-button @click="detail(scope.row)" v-if="disBtn === 'detail'">
53
+ 详情</le-button
54
+ >
55
+ <le-button-msg @click="del(scope.row.id)" v-if="isDispDelBtn"
56
+ >删除</le-button-msg
85
57
  >
86
- <template #reference>
87
- <el-button type="danger" size="small" style="margin-left: 10px"
88
- >删除
89
- </el-button>
90
- </template>
91
- </el-popconfirm>
92
58
  <div class="rowBtnsExt">
93
59
  <slot name="rowBtns" :scope="scope"></slot>
94
60
  </div>
@@ -108,44 +74,26 @@
108
74
  </el-pagination>
109
75
  </div>
110
76
  <le-dialog-container
111
- :title="popFormTitle"
112
- :width="popFormWidth"
77
+ :title="dialogTitle"
78
+ :width="dialogWidth"
113
79
  :showDialog="showDialog"
114
80
  >
115
- <le-common-page-sub
116
- :rulePop="rules"
117
- :popFormLabelWidth="popFormLabelWidth"
118
- :formColumns="formColumns"
119
- :field-options="fieldOptions"
120
- :formData="rowItem"
121
- :isEditMode="isEditMode"
122
- @closeDialog="closeDialog"
123
- @saveData="saveData"
124
- v-if="showDialog && isUserInnerSub"
125
- >
126
- </le-common-page-sub>
127
- <slot name="sub" v-if="showDialog && !isUserInnerSub"></slot>
81
+ <slot name="sub" v-if="showDialog" :rowItem="rowItem"></slot>
128
82
  </le-dialog-container>
129
83
  </div>
130
84
  </template>
131
85
  <script>
132
- import { Number } from "core-js";
133
86
  import leMixins from "../../le-libs/mixins/main";
134
- import LeCommonPageSub from "./sub.vue";
135
- import LeButton from "../../le-button/index";
87
+ import { EventBus } from "../../le-libs/js/event.js";
136
88
  export default {
137
- name: "le-common-page",
89
+ name: "le-list",
138
90
  mixins: [leMixins],
139
- components: {
140
- LeCommonPageSub,
141
- LeButton,
142
- },
143
91
  props: {
144
92
  tableData: {
145
93
  type: Array,
146
94
  default: () => [],
147
95
  },
148
- opWidht: {
96
+ btnCellWidht: {
149
97
  type: String,
150
98
  default: "130px",
151
99
  },
@@ -157,18 +105,10 @@ export default {
157
105
  type: Array,
158
106
  default: () => [],
159
107
  },
160
- isUserInnerSub: {
161
- type: Boolean,
162
- default: true,
163
- },
164
108
  formColumns: {
165
109
  type: Array,
166
110
  default: () => [],
167
111
  },
168
- queryParams: {
169
- type: Object,
170
- default: () => {},
171
- },
172
112
  rules: {
173
113
  type: Object,
174
114
  default: () => {},
@@ -185,22 +125,14 @@ export default {
185
125
  type: Boolean,
186
126
  default: false,
187
127
  },
188
- popFormWidth: {
128
+ dialogWidth: {
189
129
  type: String,
190
130
  default: "60%",
191
131
  },
192
- popFormLabelWidth: {
193
- type: String,
194
- default: "100px",
195
- },
196
- popFormTitle: {
132
+ dialogTitle: {
197
133
  type: String,
198
134
  default: "标题",
199
135
  },
200
- popLabelWidth: {
201
- type: String,
202
- default: "100px",
203
- },
204
136
  fieldOptions: {
205
137
  type: Object,
206
138
  default: () => {},
@@ -233,19 +165,55 @@ export default {
233
165
  pageSize: 10,
234
166
  },
235
167
  showDialog: false,
236
- isEditMode: true,
168
+ handleStatus: 0, //处理状态 0:详情 1:新增 2:编辑
169
+ componentMap: {
170
+ url: {
171
+ component: "le-url",
172
+ prop: "value",
173
+ },
174
+ text: {
175
+ component: "le-span",
176
+ prop: "value",
177
+ },
178
+ image: {
179
+ component: "le-image",
180
+ prop: "src",
181
+ style: { width: "40px", height: "40px" },
182
+ },
183
+ },
237
184
  };
238
185
  },
239
186
  computed: {},
187
+ created() {
188
+ EventBus.$on("closeDialog", () => {
189
+ this.closeDialog();
190
+ });
191
+ },
192
+ destroyed() {
193
+ EventBus.$off("closeDialog");
194
+ },
240
195
  mounted() {
196
+ EventBus;
241
197
  this.getList();
242
198
  },
243
199
  methods: {
244
- initFormItem() {
245
- this.rowItem = this.formColumns.reduce((acc, item) => {
246
- acc[item.prop] = item.default;
247
- return acc;
248
- }, {});
200
+ renderColumnContent(column) {
201
+ return this.componentMap[column.type]?.component || "le-span";
202
+ },
203
+ getComponentProps(column, scope) {
204
+ let value = scope.row[column.prop];
205
+ if (column.formatter) {
206
+ value = column.formatter(scope.rows, scope.column, value);
207
+ }
208
+ let ctype = this.componentMap[column.type];
209
+ value = this.format(ctype, value);
210
+ let prop = ctype?.prop || "value";
211
+ let param = {};
212
+ param[prop] = value || "";
213
+ if (ctype?.style) {
214
+ param.style = ctype.style;
215
+ }
216
+ return param;
249
217
  },
250
218
  onClickQuery() {
251
219
  this.searchData.pageNo = 1;
@@ -265,43 +233,34 @@ export default {
265
233
  });
266
234
  },
267
235
  editItem(row) {
268
- this.isEditMode = true;
269
- if (this.$listeners["handleData"]) {
270
- this.$emit("handleData", row, (res) => {
271
- this.rowItem = res;
272
- });
273
- } else {
274
- this.rowItem = row;
275
- }
236
+ this.handleStatus = 2;
237
+ this.$emit("handleStatus", this.handleStatus);
238
+ this.rowItem = row;
276
239
  this.showDialog = true;
277
240
  },
278
241
  detail(row) {
279
- this.isEditMode = false;
280
- if (this.$listeners["handleData"]) {
281
- this.$emit("handleData", row, (res) => {
282
- this.rowItem = res;
283
- this.showDialog = true;
284
- });
285
- } else {
286
- this.rowItem = row;
287
- this.showDialog = true;
288
- }
242
+ this.handleStatus = 0;
243
+ this.rowItem = row;
244
+ this.$emit("handleStatus", this.handleStatus);
245
+ this.showDialog = true;
289
246
  },
290
247
  addItem() {
291
- this.isEditMode = true;
292
- this.initFormItem();
248
+ this.handleStatus = 1;
249
+ this.$emit("handleStatus", this.handleStatus);
293
250
  this.showDialog = true;
294
- this.$emit("newAddData")
295
- },
296
- saveData(params) {
297
- this.$emit("saveForm", params, () => {
298
- this.getList();
299
- this.closeDialog();
300
- });
251
+ this.rowItem = {};
301
252
  },
302
253
  closeDialog() {
303
254
  this.showDialog = false;
304
255
  },
256
+ format(type, value) {
257
+ const renderers = {
258
+ bool: () => (value == 1 ? "是" : "否"),
259
+ date: () => this.parseTime(value),
260
+ currency: () => `$${parseFloat(value).toFixed(2)}`,
261
+ };
262
+ return renderers[type]?.() || value;
263
+ },
305
264
  },
306
265
  };
307
266
  </script>
@@ -0,0 +1,7 @@
1
+ import LeListForm from "./src/main.vue";
2
+
3
+ LeListForm.install = function (Vue) {
4
+ Vue.component(LeListForm.name, LeListForm);
5
+ };
6
+
7
+ export default LeListForm;
@@ -0,0 +1,157 @@
1
+ <template>
2
+ <el-form
3
+ :model="formPop"
4
+ :rules="rules"
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
+ >
14
+ <div class="comContainerClass">
15
+ <component
16
+ :is="componentType(item.type)"
17
+ v-bind="mergeProps(getComponentProps(item.type), item.attr || {})"
18
+ v-model="formPop[item.prop]"
19
+ v-on="item.event"
20
+ >
21
+ <template v-if="item.type === 'radio'">
22
+ <el-radio
23
+ v-for="(option, index) in item.options"
24
+ :label="option.id"
25
+ :key="index + '_radio'"
26
+ >{{ option.label }}</el-radio
27
+ >
28
+ </template>
29
+ <template v-else-if="item.type === 'select'">
30
+ <le-select-option
31
+ :options="fieldOptions[item.prop]"
32
+ :label="item.kv.label"
33
+ :value="item.kv.key"
34
+ :keyNum="item.keyNum"
35
+ />
36
+ </template>
37
+ </component>
38
+ </div>
39
+ </el-form-item>
40
+ <el-form-item v-rfooter>
41
+ <le-button
42
+ type="primary"
43
+ @click="saveData"
44
+ v-if="handleStatus == 1 || handleStatus == 2"
45
+ >保存</le-button
46
+ >
47
+ <le-button type="info" @click="close()">关闭</le-button>
48
+ </el-form-item>
49
+ </el-form>
50
+ </template>
51
+ <script>
52
+ import { EventBus } from "../../le-libs/js/event.js";
53
+ export default {
54
+ name: "le-list-form",
55
+ props: {
56
+ formColumns: {
57
+ type: Array,
58
+ default: () => [],
59
+ },
60
+ formData: {
61
+ type: Object,
62
+ default: () => {},
63
+ },
64
+ rules: {
65
+ type: Object,
66
+ default: () => {},
67
+ },
68
+ labelWidth: {
69
+ type: String,
70
+ default: "100px",
71
+ },
72
+ fieldOptions: {
73
+ type: Object,
74
+ default: () => {},
75
+ },
76
+ handleStatus: {
77
+ type: Number,
78
+ default: 0, //0:详情 1:新增 2:编辑
79
+ },
80
+ },
81
+ watch: {
82
+ formData: {
83
+ handler(val) {
84
+ this.formPop = val;
85
+ },
86
+ deep: true,
87
+ immediate: true,
88
+ },
89
+ fieldOptions: {
90
+ handler(val) {
91
+ this.options = val;
92
+ },
93
+ deep: true,
94
+ immediate: true,
95
+ },
96
+ },
97
+ data() {
98
+ return {
99
+ componentMap: {
100
+ input: {
101
+ component: "le-input",
102
+ props: { placeholder: "请输入" },
103
+ },
104
+ number: {
105
+ component: "le-input-number",
106
+ props: { min: 1, max: 999999999 },
107
+ },
108
+ radio: { component: "el-radio-group", props: {} },
109
+ date: {
110
+ component: "le-date-picker",
111
+ props: {
112
+ format: "yyyy-MM-dd",
113
+ "value-format": "timestamp",
114
+ translateDate: true,
115
+ },
116
+ },
117
+ select: { component: "le-select", props: {} },
118
+ },
119
+ formPop: {},
120
+ options: {}, //{field1:[{value:1,label:'选项1'},{value:2,label:'选项2'}]}
121
+ };
122
+ },
123
+ computed: {},
124
+ mounted() {},
125
+ methods: {
126
+ componentType(type) {
127
+ return this.componentMap[type]?.component || "le-input";
128
+ },
129
+
130
+ getComponentProps(type) {
131
+ return this.componentMap[type]?.props || {};
132
+ },
133
+ mergeProps(defaultProps, customProps) {
134
+ return { ...defaultProps, ...customProps };
135
+ },
136
+ close() {
137
+ EventBus.$emit("closeDialog");
138
+ this.$emit("closeDialog");
139
+ },
140
+ saveData() {
141
+ this.$refs["ruleForm"].validate((valid) => {
142
+ if (valid) {
143
+ this.$emit("saveData", this.formPop, () => {});
144
+ } else {
145
+ return false;
146
+ }
147
+ });
148
+ },
149
+ },
150
+ };
151
+ </script>
152
+ <style lang="scss" scoped>
153
+ .comContainerClass {
154
+ display: flex;
155
+ display: -webkit-flex;
156
+ }
157
+ </style>
@@ -33,7 +33,6 @@
33
33
  style="width: 200px; height: 200px"
34
34
  v-if="item.types == 1"
35
35
  :src="item.url"
36
- alt=""
37
36
  />
38
37
  <le-video :src="item.url" v-else controls></le-video>
39
38
  <div class="name">
@@ -0,0 +1,7 @@
1
+ import LeSpan from "./src/main.vue";
2
+
3
+ LeSpan.install = function (Vue) {
4
+ Vue.component(LeSpan.name, LeSpan);
5
+ };
6
+
7
+ export default LeSpan;
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <span :class="['text-class', customClass]" :style="customStyle">{{
3
+ value
4
+ }}</span>
5
+ </template>
6
+ <script>
7
+ export default {
8
+ name: "le-span",
9
+ props: {
10
+ value: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ customClass: {
15
+ type: [String, Array, Object],
16
+ default: "",
17
+ },
18
+ customStyle: {
19
+ type: Object,
20
+ default: () => ({}),
21
+ },
22
+ },
23
+ methods: {},
24
+ };
25
+ </script>
26
+ <style lang="scss" scoped>
27
+ .text-class {
28
+ }
29
+ </style>
@@ -0,0 +1,7 @@
1
+ import LeUrl from "./src/main.vue";
2
+
3
+ LeUrl.install = function (Vue) {
4
+ Vue.component(LeUrl.name, LeUrl);
5
+ };
6
+
7
+ export default LeUrl;
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <a :href="value" target="_blank" rel="noopener noreferrer">
3
+ {{ value }}
4
+ </a>
5
+ </template>
6
+ <script>
7
+ export default {
8
+ name: "le-url",
9
+ props: {
10
+ value: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ },
15
+ methods: {},
16
+ };
17
+ </script>
18
+ <style lang="scss" scoped>
19
+ a {
20
+ color: #007bff;
21
+ text-decoration: none;
22
+ }
23
+
24
+ a:hover {
25
+ text-decoration: underline;
26
+ }
27
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leisure-core",
3
- "version": "0.4.84",
3
+ "version": "0.4.86",
4
4
  "description": "leisure-core是京心数据基于vue2.x开发的一套后台管理系统桌面端组件库,封装了大量实用的UI控件模板,非常方便开发者快速搭建前端应用",
5
5
  "private": false,
6
6
  "author": "北方乐逍遥(zcx7878)",
@@ -1,7 +0,0 @@
1
- import LeCommonPage from "./src/main.vue";
2
-
3
- LeCommonPage.install = function (Vue) {
4
- Vue.component(LeCommonPage.name, LeCommonPage);
5
- };
6
-
7
- export default LeCommonPage;
@@ -1,152 +0,0 @@
1
- <template>
2
- <el-form
3
- :model="formPop"
4
- :rules="rulePop"
5
- ref="ruleForm"
6
- :label-width="popFormLabelWidth"
7
- >
8
- <el-form-item
9
- v-for="(item, index) in formColumns"
10
- :key="index"
11
- :label="item.label"
12
- :prop="item.prop"
13
- >
14
- <div class="comContainerClass">
15
- <le-input
16
- v-if="!item.type || item.type === 'input'"
17
- v-model="formPop[item.prop]"
18
- v-bind="item.attr || {}"
19
- v-on="item.event"
20
- />
21
- <le-input-number
22
- v-else-if="item.type === 'number'"
23
- v-model="formPop[item.prop]"
24
- v-bind="item.attr || {}"
25
- :min="item.min || 0"
26
- :max="item.max || 9999999999"
27
- label="item.label||''"
28
- v-on="item.event"
29
- />
30
- <el-radio-group
31
- v-else-if="item.type === 'radio'"
32
- v-model="formPop[item.prop]"
33
- v-on="item.event"
34
- >
35
- <el-radio
36
- v-for="(option, index) in item.options"
37
- :label="option.id"
38
- :key="index + '_radio'"
39
- >{{ option.label }}</el-radio
40
- >
41
- </el-radio-group>
42
- <el-date-picker
43
- v-else-if="item.type === 'date'"
44
- v-model="formPop[item.prop]"
45
- v-bind="item.attr || {}"
46
- value-format="timestamp"
47
- type="date"
48
- placeholder="选择日期"
49
- />
50
- <le-select
51
- v-else-if="item.type === 'select'"
52
- v-model="formPop[item.prop]"
53
- v-bind="item.attr || {}"
54
- v-on="item.event"
55
- placeholder="请选择"
56
- >
57
- <le-select-option
58
- :options="fieldOptions[item.prop]"
59
- :label="item.kv.label"
60
- :value="item.kv.key"
61
- :keyNum="item.keyNum"
62
- />
63
- </le-select>
64
- </div>
65
- </el-form-item>
66
- <el-form-item v-rfooter>
67
- <le-button type="primary" @click="saveData" v-if="isEditMode"
68
- >保存</le-button
69
- >
70
- <le-button type="info" @click="close()">关闭</le-button>
71
- </el-form-item>
72
- </el-form>
73
- </template>
74
- <script>
75
- // import LeSelect from "../../le-select/index";
76
- // import LeInput from "../../le-input/index";
77
- // import LeButton from "../../le-button/index";
78
- export default {
79
- name: "le-common-page-sub",
80
- // components: { LeSelect, LeInput, LeButton },
81
- props: {
82
- formColumns: {
83
- type: Array,
84
- default: () => [],
85
- },
86
- formData: {
87
- type: Object,
88
- default: () => {},
89
- },
90
- rulePop: {
91
- type: Object,
92
- default: () => {},
93
- },
94
- popFormLabelWidth: {
95
- type: String,
96
- default: "100px",
97
- },
98
- fieldOptions: {
99
- type: Object,
100
- default: () => {},
101
- },
102
- isEditMode: {
103
- type: Boolean,
104
- default: true,
105
- },
106
- },
107
- watch: {
108
- formData: {
109
- handler(val) {
110
- this.formPop = val;
111
- },
112
- deep: true,
113
- immediate: true,
114
- },
115
- fieldOptions: {
116
- handler(val) {
117
- this.options = val;
118
- },
119
- deep: true,
120
- immediate: true,
121
- },
122
- },
123
- data() {
124
- return {
125
- formPop: {},
126
- options: {}, //{field1:[{value:1,label:'选项1'},{value:2,label:'选项2'}]}
127
- };
128
- },
129
- computed: {},
130
- mounted() {},
131
- methods: {
132
- close() {
133
- this.$emit("closeDialog");
134
- },
135
- saveData() {
136
- this.$refs["ruleForm"].validate((valid) => {
137
- if (valid) {
138
- this.$emit("saveData", this.formPop, () => {});
139
- } else {
140
- return false;
141
- }
142
- });
143
- },
144
- },
145
- };
146
- </script>
147
- <style lang="scss" scoped>
148
- .comContainerClass {
149
- display: flex;
150
- display: -webkit-flex;
151
- }
152
- </style>