centaline-data-driven 1.5.71 → 1.5.72

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/README.md CHANGED
@@ -153,9 +153,10 @@ execServerScript(action, object, successCallback)
153
153
  * @param {boolean} center 是否居中。
154
154
  * @param {number} duration 显示时间,1500毫秒。设为 0 则不会自动关闭。
155
155
  * @param {boolean} showClose 是否显示关闭按钮。
156
+ * @param {boolean} dangerouslyUseHTMLString 是否将 message 属性作为 HTML 片段处理。
156
157
  * @desc 消息提示。常用于主动操作后的反馈提示。
157
158
  */
158
- message(message, type, center, duration, showClose)
159
+ message(message, type, center, duration, showClose,dangerouslyUseHTMLString)
159
160
 
160
161
  ```
161
162
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "centaline-data-driven",
3
- "version": "1.5.71",
3
+ "version": "1.5.72",
4
4
  "description": "ccai",
5
5
  "author": "hjc <3226136347@qq.com>",
6
6
  "private": false,
package/release-log.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## v1.5.72
2
+ 2023-11-01
3
+ 优化
4
+
5
+ 日历组件右键操作栏位置计算逻辑
6
+
7
+ 树组件右键操作栏位置计算逻辑
8
+
9
+ FormList 提示优化
10
+
11
+ 日历组件优化刷新
12
+
13
+
1
14
  ## v1.5.71
2
15
  2023-10-30
3
16
 
@@ -351,6 +351,9 @@ const common = {
351
351
  else if (parent.$options.name === 'DataDrivenSearchTree') {
352
352
  return parent;
353
353
  }
354
+ else if (parent.$options.name === 'DataDrivenEmployeeClassList') {
355
+ return parent;
356
+ }
354
357
  else {
355
358
  return this.getParentPane(parent);
356
359
  }
@@ -1,7 +1,5 @@
1
1
  <template>
2
- <div>
3
- <!-- <ct-searchScreen ref="screen" :api="searchConditionApi" :screenPara="apiParam" @search="search" @loaded="screenLoaded" @resetSearch="resetSearch()"
4
- @clickHandler="rolRouterClickHandler" style="margin-bottom: 10px;"></ct-searchScreen> -->
2
+ <div id="canlendarBox">
5
3
  <ct-searchScreen
6
4
  ref="screen"
7
5
  :api="searchConditionApi"
@@ -20,16 +18,19 @@
20
18
  :class="[theme ? theme : '']"
21
19
  v-loading="loading"
22
20
  >
23
- <div class="canlendar_content flex flex-wrap">
21
+ <div class="canlendar_content flex flex-wrap" id="fieldNameBox">
24
22
  <div
25
23
  class="header-item flex flex-column flex-center"
26
24
  v-for="item in weekArr"
27
25
  :key="item"
26
+ @contextmenu.prevent.stop="closeRightClick"
28
27
  >
29
28
  <div>{{ item }}</div>
30
29
  </div>
31
30
  <div
32
- v-for="(value, index) in dayArr" @contextmenu.prevent.stop="rightClick($event, value)"
31
+ id="fieldName"
32
+ v-for="(value, index) in dayArr"
33
+ @contextmenu.prevent.stop="openRightClick($event, value)"
33
34
  :key="index"
34
35
  :class="[
35
36
  value.isCurrentMonth ? '' : 'item-disabled',
@@ -38,32 +39,35 @@
38
39
  'item canlendar_item flex flex-column flex-center',
39
40
  ]"
40
41
  >
41
- <div
42
+ <section
42
43
  v-for="(item, index) in getDayData(value.day)"
43
44
  :key="index"
44
- v-if="model.columns"
45
+ v-if="model.columns"
45
46
  >
46
- <div v-for="(col, index) in model.columns" :key="index" >
47
- <div
48
-
49
- v-if="col.fieldName != 'operation'"
50
- >
47
+ <div v-for="(col, index) in model.columns" :key="index">
48
+ <div v-if="col.fieldName != 'operation'">
51
49
  <span v-if="col.fieldName == 'date'" class="date-text">
52
50
  {{ extractedDate(item[col.fieldName]) }}
53
51
  </span>
54
- <span v-else>
55
- {{ item[col.fieldName] }}
56
- </span>
52
+ <span v-else v-html="item[col.fieldName]"> </span>
57
53
  </div>
58
54
  </div>
59
- </div>
55
+ </section>
60
56
  </div>
61
57
  </div>
62
58
  </div>
63
-
64
- <div class="box-menu" v-if="menuVisible && model.actionRouter"
65
- :style="{ left: menu_left + 'px', top: menu_top + 'px' }">
66
- <div class="opertion" @click="routerClickHandler(item)" v-for="(item, index) in model.actionRouter" :key="index">
59
+ <div
60
+ class="box-menu"
61
+ id="boxMenu"
62
+ v-show="menuVisible && actionRouter"
63
+ :style="{ left: menu_left + 'px', top: menu_top + 'px' }"
64
+ >
65
+ <div
66
+ class="opertion"
67
+ v-for="(item, index) in actionRouter"
68
+ :key="index"
69
+ @click="routerClickHandler(item)"
70
+ >
67
71
  <div v-if="currentData[item.rightField] == 1">
68
72
  <div class="memuItem">{{ item.label }}</div>
69
73
  </div>
@@ -81,24 +85,24 @@ export default {
81
85
  mixins: [dynamicElement],
82
86
  // 注册局部组件
83
87
  components: {
84
- "ct-searchScreen": dynamicSearchScreen
88
+ "ct-searchScreen": dynamicSearchScreen,
85
89
  },
86
90
  props: {
87
91
  width: {
88
92
  type: [Number, String],
89
- default: "100%"
93
+ default: "100%",
90
94
  },
91
95
  height: {
92
96
  type: [Number, String],
93
- default: ""
97
+ default: "",
94
98
  },
95
99
  theme: {
96
100
  type: String,
97
- default: ""
101
+ default: "",
98
102
  },
99
103
  autoMonthSwitch: {
100
104
  type: Boolean,
101
- default: true
105
+ default: true,
102
106
  },
103
107
  vmodel: Object,
104
108
  api: String,
@@ -107,16 +111,16 @@ export default {
107
111
  searchDataApi: String,
108
112
  apiParam: {
109
113
  type: Object,
110
- default: () => {}
111
- }
114
+ default: () => {},
115
+ },
112
116
  },
113
117
  computed: {
114
118
  getCalerndarStyle() {
115
119
  return {
116
120
  width: this.width,
117
- height: this.height
121
+ height: this.height,
118
122
  };
119
- }
123
+ },
120
124
  },
121
125
  created() {},
122
126
  data() {
@@ -125,7 +129,7 @@ export default {
125
129
  let day = moment().date();
126
130
  return {
127
131
  loaded: {
128
- screenLoaded: false
132
+ screenLoaded: false,
129
133
  },
130
134
  currentTime: "",
131
135
  today: moment().format("YYYY-MM-DD"),
@@ -140,11 +144,14 @@ export default {
140
144
  "星期三",
141
145
  "星期四",
142
146
  "星期五",
143
- "星期六"
147
+ "星期六",
144
148
  ],
145
149
  loading: true,
146
150
  menuVisible: false,
147
- currentData: {}
151
+ currentData: {},
152
+ menu_top: 0,
153
+ menu_left: 0,
154
+ actionRouter: [],
148
155
  };
149
156
  },
150
157
  mounted() {},
@@ -155,15 +162,9 @@ export default {
155
162
  },
156
163
  getDayData(day) {
157
164
  if (this.model && this.model.listData) {
158
- let fileList = this.model.listData.filter(item => {
159
- return (
160
- item.date
161
- .split("-")
162
- .slice(2)
163
- .join("-") == day
164
- );
165
+ let fileList = this.model.listData.filter((item) => {
166
+ return item.date.split("-").slice(2).join("-") == day;
165
167
  });
166
- console.log(fileList);
167
168
  return fileList;
168
169
  }
169
170
  return [];
@@ -175,13 +176,12 @@ export default {
175
176
  screenLoaded() {
176
177
  var self = this;
177
178
  self.search(self.$refs.screen.model);
178
- },
179
+ },
179
180
  initdate() {
180
181
  if (this.currentTime && moment(this.currentTime).isValid()) {
181
182
  this.day = moment(this.currentTime).date();
182
183
  this.month = moment(this.currentTime).month() + 1;
183
184
  this.year = moment(this.currentTime).year();
184
-
185
185
  }
186
186
  this.build();
187
187
  },
@@ -195,14 +195,15 @@ export default {
195
195
  this.$refs.screen.model.defaultSearch,
196
196
  self.load
197
197
  );
198
-
198
+
199
199
  this.$emit("search", self.$refs.screen.model);
200
200
  }
201
201
  },
202
202
  load(data) {
203
203
  var self = this;
204
204
  self.model = data;
205
- self.$nextTick(function() {
205
+ self.actionRouter = self.model.actionRouter;
206
+ self.$nextTick(function () {
206
207
  if (self.model.listData.length > 0) {
207
208
  self.currentTime = self.model.listData[0].date;
208
209
  this.model.value = 0;
@@ -210,32 +211,91 @@ export default {
210
211
  }
211
212
  });
212
213
  self.loading = false;
213
- },
214
- rightClick(event, object) {
215
- this.currentData = this.getDayData(object.day)[0]; // 定义变量接收该节点所对应的对象
216
- if (this.model.actionRouter) {
217
- this.model.actionRouter.forEach(v => {
218
- if (this.currentData[v.rightField] == "1") {
219
- this.menuVisible = true; //显示增删改的div
220
- }
214
+ document
215
+ .getElementById("canlendar")
216
+ .addEventListener("contextmenu", function (e) {
217
+ e.preventDefault();
221
218
  });
219
+ this.closeRightClick()
220
+ },
221
+ openRightClick(event, object) {
222
+ if (object.isCurrentMonth) {
223
+ // 获取单元格的宽高
224
+ // let fieldNameWidth = document.getElementById('fieldName').offsetWidth;
225
+ let fieldNameHeight = document.getElementById("fieldName").offsetHeight;
226
+ // 获取父元素
227
+ const canlendarEle = document.getElementById("canlendar");
228
+ // 获取目标元素
229
+ const clickedElement = event.target;
230
+ var centerX;
231
+ var centerY;
232
+ if (event.target.tagName === "DIV") {
233
+ centerX = canlendarEle.offsetLeft + clickedElement.offsetLeft;
234
+ centerY =
235
+ canlendarEle.offsetTop + clickedElement.offsetTop + fieldNameHeight;
236
+ } else if (event.target.tagName === "SECTION") {
237
+ centerX =
238
+ canlendarEle.offsetLeft + clickedElement.parentElement.offsetLeft;
239
+ centerY =
240
+ canlendarEle.offsetTop +
241
+ clickedElement.parentElement.offsetTop +
242
+ fieldNameHeight;
243
+ } else if (event.target.tagName === "SPAN") {
244
+ centerX =
245
+ canlendarEle.offsetLeft +
246
+ clickedElement.parentElement.parentElement.parentElement
247
+ .parentElement.offsetLeft;
248
+ centerY =
249
+ canlendarEle.offsetTop +
250
+ clickedElement.parentElement.parentElement.parentElement
251
+ .parentElement.offsetTop +
252
+ fieldNameHeight;
253
+ }
254
+ // 获取文本内容的宽高
255
+ let mainHeight = document.getElementById("app-Class").offsetHeight;
256
+ let mainWidth = document.getElementById("app-Class").offsetWidth;
257
+ if (centerX + 150 > mainWidth) {
258
+ this.menu_left = centerX - (centerX + 150 - mainWidth) - 10;
259
+ } else {
260
+ this.menu_left = centerX;
261
+ }
262
+ if (centerY + 72 > mainHeight) {
263
+ this.menu_top = centerY - fieldNameHeight * 2 - 10;
264
+ } else {
265
+ this.menu_top = centerY;
266
+ }
267
+ this.currentData = this.getDayData(object.day)[0]; // 定义变量接收该节点所对应的对象
268
+ if (this.model.actionRouter) {
269
+ this.model.actionRouter.forEach((v) => {
270
+ if (this.currentData[v.rightField] == "1") {
271
+ this.menuVisible = true; //显示增删改的div
272
+ document
273
+ .getElementById("boxMenu")
274
+ .addEventListener("contextmenu", function (e) {
275
+ e.preventDefault();
276
+ });
277
+ }
278
+ });
279
+ }
280
+ // 监听事件鼠标点击事件,若点击则隐藏菜单
281
+ document.addEventListener("click", this.foo);
282
+ }else{
283
+ this.menuVisible = false;
222
284
  }
223
- // 监听事件鼠标点击事件,若点击则隐藏菜单
224
- document.addEventListener("click", this.foo);
225
- // 以下两句话将菜单显示在鼠标点击旁边定位
226
- this.menu_left = event.clientX ;
227
- this.menu_top = event.clientY;
228
285
  },
229
286
  foo() {
230
287
  this.menuVisible = false;
231
288
  //  要及时关掉监听,不关掉的是一个坑,不信你试试,虽然前台显示的时候没有啥毛病,加一个alert你就知道了
232
289
  document.removeEventListener("click", this.foo);
233
290
  },
291
+ closeRightClick() {
292
+ this.menuVisible = false;
293
+ },
234
294
  // 打开弹层
235
295
  openDialog(field, apiParam, callBack) {
236
296
  var self = this;
237
297
  field.apiParam = apiParam;
238
- var clickAcion = function() {
298
+ var clickAcion = function () {
239
299
  if (field.isOpenForm) {
240
300
  // 对话框
241
301
  let dialogOption = {
@@ -249,27 +309,27 @@ export default {
249
309
  apiParam: field.apiParam,
250
310
  showTitle: true,
251
311
  width: field.dialogWidth + "px",
252
- height: field.dialogHeight + "px"
312
+ height: field.dialogHeight + "px",
253
313
  },
254
314
  on: {
255
315
  submit(ev) {
256
316
  if (callBack) {
257
- callBack(ev.responseData.content[0]);
317
+ callBack(ev.responseData);
258
318
  }
259
319
  self.$common.closeDialog(dialogOption.dialog);
260
- }
261
- }
262
- }
263
- ]
320
+ },
321
+ },
322
+ },
323
+ ],
264
324
  };
265
325
  self.$common.openDialog(dialogOption);
266
326
  } else {
267
327
  self.model.getCurrentRowApiData(
268
328
  field.action,
269
329
  field.apiParam,
270
- function(data) {
271
- if (data) {
272
- callBack();
330
+ function (response) {
331
+ if (response) {
332
+ callBack(response);
273
333
  }
274
334
  }
275
335
  );
@@ -281,7 +341,7 @@ export default {
281
341
  confirmButtonText: field.alertOKButtonText,
282
342
  cancelButtonText: field.alertCancelButtonText,
283
343
  //type: 'warning'
284
- center: field.alertCenter
344
+ center: field.alertCenter,
285
345
  })
286
346
  .then(() => {
287
347
  clickAcion();
@@ -295,27 +355,27 @@ export default {
295
355
  routerClickHandler(action) {
296
356
  let self = this;
297
357
  var actionRouterData = {};
298
- action.submitFormField.forEach(v => {
358
+ action.submitFormField.forEach((v) => {
299
359
  actionRouterData[v] = self.currentData[v];
300
360
  });
301
361
  actionRouterData.actionType = action.actionType;
302
-
303
- self.openDialog(action, actionRouterData, function(newData) {
362
+
363
+ self.openDialog(action, actionRouterData, function (newData) {
304
364
  // 在页面增加删除修改
305
- self.model.doAction(action, newData, self.currentNode);
365
+ self.model.doAction(action, newData,self.searchDataApi);
306
366
  });
307
367
  },
308
- //删除树节点
309
- remove(newData) {
368
+ //删除树节点
369
+ remove(newData) {
310
370
  let self = this;
311
- self.getNextClickNode()
371
+ self.getNextClickNode();
312
372
  this.$refs.Tree.remove(self.currentNode);
313
373
  },
314
374
  //新增树节点
315
375
  add(newData) {
316
376
  let self = this;
317
- this.$refs.Tree.append(newData, self.currentNode)
318
- this.handleNodeClick(newData,true)
377
+ this.$refs.Tree.append(newData, self.currentNode);
378
+ this.handleNodeClick(newData, true);
319
379
  },
320
380
  change() {
321
381
  let fullDate = moment(
@@ -324,7 +384,7 @@ export default {
324
384
  ).format();
325
385
  this.$emit("change", fullDate);
326
386
  },
327
- build: function(year, month, day, labelName) {
387
+ build: function (year, month, day, labelName) {
328
388
  year = year || this.year;
329
389
  month === 0 ? (month = -1) : (month = month || this.month);
330
390
  day = day || this.day;
@@ -361,7 +421,7 @@ export default {
361
421
  this.dayArr.push({
362
422
  day: lastMonthDay,
363
423
  month: month - 1,
364
- isCurrentMonth: false
424
+ isCurrentMonth: false,
365
425
  });
366
426
  }
367
427
  //构建当前月份的日期
@@ -370,20 +430,19 @@ export default {
370
430
  year + "-" + month + "-" + i,
371
431
  "YYYY-MM-DD"
372
432
  ).format("YYYY-MM-DD");
373
- let isToday = false ,
374
- isSelected = false;
433
+ let isToday = false,
434
+ isSelected = false;
375
435
  if (fullDate === this.today) {
376
436
  isToday = true;
377
- isSelected= true;
378
- }
379
- this.dayArr.push({
380
- month: month,
381
- day: i,
382
- isCurrentMonth: true,
383
- isSelected: isSelected,
384
- isToday: isToday
385
- });
386
-
437
+ isSelected = true;
438
+ }
439
+ this.dayArr.push({
440
+ month: month,
441
+ day: i,
442
+ isCurrentMonth: true,
443
+ isSelected: isSelected,
444
+ isToday: isToday,
445
+ });
387
446
  }
388
447
  //构建下个月的日期
389
448
  let nextMonthDay = 1;
@@ -391,7 +450,7 @@ export default {
391
450
  this.dayArr.push({
392
451
  day: nextMonthDay,
393
452
  month: month + 1,
394
- isCurrentMonth: false
453
+ isCurrentMonth: false,
395
454
  });
396
455
  nextMonthDay++;
397
456
  }
@@ -403,14 +462,14 @@ export default {
403
462
  this.dayArr.push({
404
463
  day: nextMonthDay,
405
464
  month: month + 1,
406
- isCurrentMonth: false
465
+ isCurrentMonth: false,
407
466
  });
408
467
  nextMonthDay++;
409
468
  }
410
469
  }
411
470
  this.change();
412
- }
413
- }
471
+ },
472
+ },
414
473
  };
415
474
  </script>
416
475
 
@@ -137,7 +137,7 @@
137
137
  .canlendar .canlendar_today {
138
138
  /* background: var(--color-primary-light); */
139
139
  /* color: var(--chinaRed); */
140
- border-radius: 12%;
140
+ /* border-radius: 12%; */
141
141
  text-align: center;
142
142
  }
143
143
 
@@ -333,11 +333,7 @@
333
333
  var rtnBool = true;
334
334
  for (let i of self.model.tableData) {
335
335
  if (i.isSet) {
336
- self.$message({
337
- message: "请先保存表格编辑项",
338
- type: 'warning',
339
- showClose:true,
340
- });
336
+ self.validMessage= "请先保存表格编辑项";
341
337
  rtnBool = false;
342
338
  }
343
339
  };
@@ -185,23 +185,36 @@ export default {
185
185
  this.firstLevel = false // 否则视为叶子节点不添加同级选项
186
186
 
187
187
  }
188
+ let actionIndex = 0;
188
189
  if (this.model.actionRouter) {
189
190
  this.model.actionRouter.forEach(v => {
190
191
  if (this.currentData[v.rightField] == '1') {
191
192
  this.menuVisible = true //显示增删改的div
193
+ actionIndex +=1;
192
194
  }
193
195
  })
194
196
  }
195
197
  document.addEventListener('click', this.foo)  // 监听事件鼠标点击事件,若点击则隐藏菜单
196
- let sideWidth = 0;
197
- if (document.getElementsByClassName('sidebar-container')[0]) {
198
- sideWidth = document.getElementsByClassName('sidebar-container')[0].clientWidth + 10 || 0;
199
- }
200
- // 以下两句话将菜单显示在鼠标点击旁边定位
201
- this.menu_left = event.clientX - document.getElementById('mytree').offsetLeft - sideWidth;
202
- this.menu_top = event.clientY - document.getElementById('mytree').offsetTop + 10;
198
+ // 获取树状图的高度
199
+ let treeHeight = document.getElementById("mytree").offsetHeight;
200
+ // 获取文本内容的宽高
201
+ let mainHeight = document.getElementById("app-Tree").offsetHeight;
202
+ let mainWidth = document.getElementById("app-Tree").offsetWidth;
203
+ // 10是padding 获取查询条件高度
204
+ let screenHeight = document.getElementById("mytree").parentElement.offsetHeight - treeHeight - 10;
205
+ let windowWidth = window.innerWidth;
206
+ let windowHeight = window.innerHeight;
207
+ // 将菜单显示在鼠标点击旁边定位
208
+ this.menu_left = event.clientX -( windowWidth - mainWidth);
209
+ // 18是节点文本的高度
210
+ this.menu_top =event.clientY - ( windowHeight -mainHeight) - screenHeight + actionIndex*30 +18;
211
+ // 微调
212
+ if (document.getElementById("uplink")) {
213
+ this.menu_top = this.menu_top -8;
214
+ } else if(document.getElementById("onecard")){
215
+ this.menu_top = this.menu_top +10;
216
+ }
203
217
  },
204
-
205
218
  foo() {
206
219
  this.menuVisible = false
207
220
  //  要及时关掉监听,不关掉的是一个坑,不信你试试,虽然前台显示的时候没有啥毛病,加一个alert你就知道了
@@ -86,7 +86,8 @@ export default {
86
86
  }
87
87
 
88
88
  });
89
- }
89
+ }
90
+ this.$emit('loaded');
90
91
  },
91
92
  setsearchtreeHeight(){
92
93
  let self = this;