kz-ui-base 1.0.130 → 1.0.132

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.
@@ -258,9 +258,19 @@ export default {
258
258
  }
259
259
  this.$store
260
260
  .dispatch("Login", this.loginForm)
261
- .then(() => {
261
+ .then((rs) => {
262
262
  getAllRouters().then((res) => {
263
263
  localforage.setItem("getAllRouters", res.data);
264
+ if (rs.code == 209) {
265
+ this.$router.push({
266
+ path: "/changePassword",
267
+ query: {
268
+ password: 1,
269
+ tenantName: this.$route.query.tenantName,
270
+ },
271
+ });
272
+ return;
273
+ }
264
274
  this.$router
265
275
  .push({ path: this.redirect || "/" })
266
276
  .catch(() => {});
@@ -248,9 +248,19 @@ export default {
248
248
  }
249
249
  this.$store
250
250
  .dispatch("Login", this.loginForm)
251
- .then(() => {
251
+ .then((rs) => {
252
252
  getAllRouters().then((res) => {
253
253
  localforage.setItem("getAllRouters", res.data);
254
+ if (rs.code == 209) {
255
+ this.$router.push({
256
+ path: "/changePassword",
257
+ query: {
258
+ password: 1,
259
+ tenantName: this.$route.query.tenantName,
260
+ },
261
+ });
262
+ return;
263
+ }
254
264
  this.$router
255
265
  .push({ path: this.redirect || "/" })
256
266
  .catch(() => {});
@@ -1,130 +1,118 @@
1
1
  <template>
2
- <div class="">
2
+ <div class="form-container">
3
+ <!-- 非Tab区域 -->
3
4
  <template v-for="item in areaSetting">
4
- <div
5
- v-if="item.visible && item.type != 'tab' && item.text"
6
- :key="item.type"
7
- class="borderClass"
8
- >
9
- <i :class="item.icon"></i>{{ item.text }}
10
- </div>
11
- <el-col
12
- v-for="(column, index) in columns"
13
- :key="index"
14
- :span="column.width || 12"
15
- :disabled="column.disabled"
16
- :class="column.alteration?'alterationRed':''"
17
- :style="{
18
- height:
19
- column.displayType == 'Upload'
20
- ? ''
21
- : column.displayType == 'Editor'
22
- ? '280px'
23
- : '',
24
- clear: column.wrap ? 'both' : '',
25
- }"
5
+ <template v-if="item.type !== 'tab'">
6
+ <!-- 区域标题 -->
7
+ <div
8
+ v-if="item.visible && item.text"
9
+ :key="`title-${item.type}`"
10
+ class="area-title borderClass"
11
+ >
12
+ <i v-if="item.icon" :class="item.icon"></i>{{ item.text }}
13
+ </div>
14
+
15
+ <!-- 区域内容 -->
16
+ <el-row
17
+ v-if="item.visible"
18
+ :key="`content-${item.type}`"
19
+ :gutter="20"
20
+ class="area-content"
21
+ >
22
+ <!-- 折叠面板区域 -->
23
+ <template v-if="item.name === 'basic'">
24
+ <el-col :span="24" v-if="hasFoldColumns">
25
+ <el-collapse v-model="activeName" accordion>
26
+ <el-collapse-item title="折叠区域" name="fold-area">
27
+ <el-row :gutter="20">
28
+ <el-col
29
+ v-for="(column, index) in foldColumns"
30
+ :key="`fold-${index}`"
31
+ :span="column.width || 12"
32
+ :class="column.alteration ? 'alterationRed' : ''"
33
+ class="form-item-col"
34
+ >
35
+ <component
36
+ ref="editDialog"
37
+ :disabled="column.disabled"
38
+ :is="getComponentType(column)"
39
+ :columns="columns"
40
+ :column="column"
41
+ :entity.sync="entity"
42
+ :setting.sync="column.setting"
43
+ :value="entity[column.property]"
44
+ @assignment="assignment"
45
+ @change="onChangeEvent"
46
+ @onSearch="onSearch"
47
+ />
48
+ </el-col>
49
+ </el-row>
50
+ </el-collapse-item>
51
+ </el-collapse>
52
+ </el-col>
53
+ </template>
54
+
55
+ <!-- 普通字段区域 -->
56
+ <template v-for="(column, index) in getAreaColumns(item.name)">
57
+ <el-col
58
+ v-if="shouldRenderColumn(column, item)"
59
+ :key="`${item.name}-${index}`"
60
+ :span="column.width || 12"
61
+ :class="column.alteration ? 'alterationRed' : ''"
62
+ class="form-item-col"
63
+ :style="getColumnStyle(column)"
64
+ >
65
+ <component
66
+ ref="editDialog"
67
+ :disabled="column.disabled"
68
+ :is="getComponentType(column)"
69
+ :columns="columns"
70
+ :column="column"
71
+ :entity.sync="entity"
72
+ :setting.sync="column.setting"
73
+ :value="entity[column.property]"
74
+ @assignment="assignment"
75
+ @change="onChangeEvent"
76
+ @clickDialog="clickDialog"
77
+ @onSearch="onSearch"
78
+ />
79
+ </el-col>
80
+ </template>
81
+ </el-row>
82
+ </template>
83
+ </template>
84
+
85
+ <!-- Tab区域 -->
86
+ <el-tabs v-model="activeTabName" class="tab-container">
87
+ <el-tab-pane
88
+ v-for="(tab, index) in tabList"
89
+ :key="`tab-${index}`"
90
+ :label="tab.text"
91
+ :name="tab.name"
26
92
  >
27
- <el-collapse class="el-col el-col-24" v-if="item.name=='basic'&&column.setting&&column.setting.fold&&column.setting.folds" v-model="activeName" accordion>
28
- <el-collapse-item :title="column.text" name="1">
29
- <div class="el-col el-col-12" v-for="(column, index) in columns" v-if="column.setting&&column.setting.fold">
93
+ <el-row :gutter="20" class="tab-content">
94
+ <el-col
95
+ v-for="(column, colIndex) in getTabColumns(tab.name)"
96
+ :key="`tab-col-${colIndex}`"
97
+ :span="column.width || 12"
98
+ :class="column.alteration ? 'alterationRed' : ''"
99
+ class="form-item-col"
100
+ :style="getColumnStyle(column)"
101
+ >
30
102
  <component
31
103
  ref="editDialog"
32
- :key="index"
33
104
  :disabled="column.disabled"
34
- :is="
35
- column.displayType != null
36
- ? 'KZ_' + column.displayType
37
- : 'KZ_TextBox'
38
- "
105
+ :is="getComponentType(column)"
39
106
  :columns="columns"
40
107
  :column="column"
41
108
  :entity.sync="entity"
42
109
  :setting.sync="column.setting"
43
110
  :value="entity[column.property]"
44
- @assignment="assignment"
45
111
  @change="onChangeEvent"
46
112
  @onSearch="onSearch"
47
- >
48
- </component>
49
- </div>
50
-
51
- </el-collapse-item>
52
- </el-collapse>
53
- <template v-else-if="column.setting&&column.setting.fold"></template>
54
- <template
55
- v-else-if="
56
- (column.visible == undefined || column.visible != false) &&
57
- (item.name == column.area || !column.area) &&
58
- item.type != 'tab'
59
- ">
60
- <component
61
- ref="editDialog"
62
- :key="index"
63
- :disabled="column.disabled"
64
- :is="
65
- column.displayType != null
66
- ? 'KZ_' + column.displayType
67
- : 'KZ_TextBox'
68
- "
69
- :columns="columns"
70
- :column="column"
71
- :entity.sync="entity"
72
- :setting.sync="column.setting"
73
- :value="entity[column.property]"
74
- @assignment="assignment"
75
- @change="onChangeEvent"
76
- @clickDialog="clickDialog"
77
- @onSearch="onSearch"
78
- >
79
- </component>
80
- </template>
81
-
82
- </el-col>
83
- </template>
84
- <el-tabs style="width: 100%; display: inline-block" v-model="activeName">
85
- <el-tab-pane
86
- v-for="(it, ix) in tabList"
87
- :key="ix"
88
- :label="it.text"
89
- :name="it.text"
90
- >
91
- <el-col
92
- v-for="(column, index) in columns"
93
- :key="index"
94
- v-if="
95
- (column.visible == undefined || column.visible != false) &&
96
- it.name == column.area
97
- "
98
- :span="column.width || 12"
99
- :disabled="column.disabled"
100
- :style="{
101
- height:
102
- column.displayType == 'Upload'
103
- ? ''
104
- : column.displayType == 'Editor'
105
- ? '280px'
106
- : '',
107
- clear: column.wrap ? 'both' : '',
108
- }"
109
- >
110
- <component
111
- ref="editDialog"
112
- :disabled="column.disabled"
113
- :is="
114
- column.displayType != null
115
- ? 'KZ_' + column.displayType
116
- : 'KZ_TextBox'
117
- "
118
- :columns="columns"
119
- :column="column"
120
- :entity.sync="entity"
121
- :setting.sync="column.setting"
122
- :value="entity[column.property]"
123
- @change="onChangeEvent"
124
- @onSearch="onSearch"
125
- >
126
- </component>
127
- </el-col>
113
+ />
114
+ </el-col>
115
+ </el-row>
128
116
  </el-tab-pane>
129
117
  </el-tabs>
130
118
  </div>
@@ -137,13 +125,11 @@ import KZ_TextBox from "./textBox.vue";
137
125
  import KZ_Cascader from "./cascader.vue";
138
126
  import KZ_CheckBox from "./checkBox.vue";
139
127
  import KZ_TreeDownList from "./treeDownList";
140
- // import KZ_ColorPicker from "@components/customForm/colorPicker";
141
128
  import KZ_DatePicker from "./datePicker.vue";
142
129
  import KZ_Switch from "./switch.vue";
143
130
  import KZ_Upload from "./upload.vue";
144
131
  import KZ_UploadButton from "./uploadButton";
145
132
  import KZ_TextArea from "./textarea.vue";
146
- // import KZ_Editor from "@components/customForm/editor";
147
133
  import KZ_Lookup from "./lookup.vue";
148
134
  import KZ_Text from "./text.vue";
149
135
  import KZ_Radio from "./radio.vue";
@@ -155,13 +141,11 @@ import KZ_CustomButton from "./customButton.vue";
155
141
  KZ_TextBox,
156
142
  KZ_Cascader,
157
143
  KZ_CheckBox,
158
- // KZ_ColorPicker,
159
144
  KZ_DatePicker,
160
145
  KZ_Switch,
161
146
  KZ_Upload,
162
147
  KZ_UploadButton,
163
148
  KZ_TextArea,
164
- // KZ_Editor,
165
149
  KZ_Lookup,
166
150
  KZ_Text,
167
151
  KZ_Radio,
@@ -170,75 +154,227 @@ import KZ_CustomButton from "./customButton.vue";
170
154
  },
171
155
  })
172
156
  export default class FormColumns extends Vue {
173
- @Prop()
174
- entity;
175
- @Prop()
176
- rules;
177
- @Prop()
178
- columns;
157
+ @Prop() entity: any;
158
+ @Prop() rules: any;
159
+ @Prop() columns: any[];
179
160
  @Prop({
180
161
  type: Array,
181
- default: function () {
182
- return [
183
- {
184
- name: "basic",
185
- visible: true,
186
- icon: "ion-plus-round",
187
- text: "",
188
- type: "area",
189
- },
190
- ];
191
- },
162
+ default: () => [{
163
+ name: "basic",
164
+ visible: true,
165
+ icon: "ion-plus-round",
166
+ text: "",
167
+ type: "area",
168
+ }],
192
169
  })
193
- areaSetting;
194
- private tabList = [];
195
- private activeName = "";
196
- private onChangeEvent(args) {
197
- this.$emit("change", args);
170
+ areaSetting: any[];
171
+
172
+ private tabList: any[] = [];
173
+ private activeName: string[] = [];
174
+ private activeTabName: string = "";
175
+
176
+ // 计算属性:获取折叠的列
177
+ get foldColumns() {
178
+ return (this.columns || []).filter(col =>
179
+ col.setting && col.setting.fold && !col.setting.folds
180
+ );
181
+ }
182
+
183
+ // 计算属性:是否有折叠列
184
+ get hasFoldColumns() {
185
+ return this.foldColumns.length > 0;
186
+ }
187
+
188
+ // 获取区域内的列
189
+ getAreaColumns(areaName: string) {
190
+ return (this.columns || []).filter(col =>
191
+ col.area === areaName || (!col.area && areaName === 'basic')
192
+ );
198
193
  }
199
- assignment(value, type) {
200
- this.$emit("change", value, type);
194
+
195
+ // 获取Tab内的列
196
+ getTabColumns(tabName: string) {
197
+ return (this.columns || []).filter(col =>
198
+ (col.visible === undefined || col.visible !== false) &&
199
+ col.area === tabName
200
+ );
201
+ }
202
+
203
+ // 判断是否应该渲染列
204
+ shouldRenderColumn(column: any, item: any): boolean {
205
+ if (column.setting && column.setting.fold) return false;
206
+ if (column.visible === false) return false;
207
+ if (!item.name || column.area === item.name) return true;
208
+ if (!column.area && item.name === 'basic') return true;
209
+ return false;
201
210
  }
202
- clickDialog(value){
203
- this.$emit("clickDialog",value);
211
+
212
+ // 获取组件类型
213
+ getComponentType(column: any): string {
214
+ return column.displayType ? `KZ_${column.displayType}` : 'KZ_TextBox';
204
215
  }
205
- onSearch(value) {
206
- this.$emit("onSearch", value);
216
+
217
+ // 获取列样式
218
+ getColumnStyle(column: any): any {
219
+ const style: any = {};
220
+
221
+ if (column.wrap) {
222
+ style.clear = 'both';
223
+ }
224
+
225
+ // 高度设置
226
+ if (column.displayType === 'Upload') {
227
+ style.minHeight = '40px';
228
+ } else if (column.displayType === 'Editor') {
229
+ style.height = '280px';
230
+ style.minHeight = '280px';
231
+ }
232
+
233
+ // 响应式调整
234
+ style.marginBottom = '20px';
235
+
236
+ return style;
207
237
  }
238
+
239
+ @Emit('change')
240
+ private onChangeEvent(args: any) {
241
+ return args;
242
+ }
243
+
244
+ @Emit('change')
245
+ private assignment(value: any, type?: string) {
246
+ return { value, type };
247
+ }
248
+
249
+ @Emit('clickDialog')
250
+ private clickDialog(value: any) {
251
+ return value;
252
+ }
253
+
254
+ @Emit('onSearch')
255
+ private onSearch(value: any) {
256
+ return value;
257
+ }
258
+
208
259
  created() {
209
- this.areaSetting &&
210
- this.areaSetting.forEach((item) => {
211
- if (item.type == "tab") {
212
- this.tabList.push(item);
213
- // console.log(this.tabList);
214
- this.activeName = this.tabList[0].text;
215
- }
216
- });
260
+ this.initTabs();
261
+ }
262
+
263
+ private initTabs() {
264
+ if (!this.areaSetting) return;
265
+
266
+ this.tabList = this.areaSetting.filter(item => item.type === 'tab');
267
+
268
+ if (this.tabList.length > 0) {
269
+ this.activeTabName = this.tabList[0].name;
270
+ }
217
271
  }
218
272
  }
219
273
  </script>
220
- <style>
221
- .rowclass {
222
- /* display: flex; */
223
- /* flex-wrap: wrap; */
224
- }
225
- </style>
274
+
226
275
  <style scoped>
227
- .borderClass {
228
- display: inline-block;
276
+ .form-container {
229
277
  width: 100%;
278
+ box-sizing: border-box;
279
+ }
280
+
281
+ .area-title {
230
282
  font-weight: 600;
231
283
  line-height: 40px;
232
284
  border-bottom: solid 2px rgb(223, 228, 237);
233
- margin-bottom: 15px;
285
+ margin-bottom: 20px;
286
+ margin-top: 10px;
287
+ font-size: 16px;
288
+ }
289
+
290
+ .area-content,
291
+ .tab-content {
292
+ margin-bottom: 20px;
293
+ }
294
+
295
+ .form-item-col {
296
+ margin-bottom: 20px;
297
+ box-sizing: border-box;
298
+ }
299
+
300
+ .tab-container {
301
+ width: 100%;
302
+ margin-top: 10px;
303
+ }
304
+
305
+ /* 响应式调整 */
306
+ @media screen and (max-width: 1200px) {
307
+ .form-item-col {
308
+ margin-bottom: 15px;
309
+ }
310
+ }
311
+
312
+ @media screen and (max-width: 992px) {
313
+ .form-item-col {
314
+ width: 100% !important;
315
+ max-width: 100% !important;
316
+ flex: 0 0 100% !important;
317
+ margin-bottom: 15px;
318
+ }
319
+
320
+ .area-title {
321
+ font-size: 15px;
322
+ line-height: 36px;
323
+ margin-bottom: 15px;
324
+ }
234
325
  }
235
- ::v-deep.alterationRed .el-input__inner{
326
+
327
+ @media screen and (max-width: 768px) {
328
+ .form-item-col {
329
+ margin-bottom: 12px;
330
+ }
331
+
332
+ .area-content,
333
+ .tab-content {
334
+ margin-bottom: 15px;
335
+ }
336
+ }
337
+
338
+ ::v-deep.alterationRed .el-input__inner {
236
339
  border-color: red !important;
237
340
  }
238
- ::v-deep.alterationRed .el-textarea__inner{
341
+
342
+ ::v-deep.alterationRed .el-textarea__inner {
239
343
  border-color: red !important;
240
344
  }
241
- ::v-deep.alterationRed .el-upload{
345
+
346
+ ::v-deep.alterationRed .el-upload {
242
347
  border-color: red !important;
243
348
  }
349
+
350
+ /* 确保所有组件容器正确显示 */
351
+ ::v-deep .el-form-item {
352
+ width: 100%;
353
+ margin-bottom: 0;
354
+ }
355
+
356
+ ::v-deep .el-collapse-item__content {
357
+ padding-bottom: 0;
358
+ }
359
+
360
+ ::v-deep .el-tabs__content {
361
+ overflow: visible;
362
+ }
363
+
364
+ ::v-deep .el-row {
365
+ flex-wrap: wrap;
366
+ }
367
+ </style>
368
+
369
+ <style>
370
+ /* 全局样式,确保布局正确 */
371
+ .el-col {
372
+ box-sizing: border-box;
373
+ }
374
+
375
+ .el-row {
376
+ box-sizing: border-box;
377
+ display: flex;
378
+ flex-wrap: wrap;
379
+ }
244
380
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kz-ui-base",
3
- "version": "1.0.130",
3
+ "version": "1.0.132",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {