centaline-data-driven-v3 0.1.59 → 0.1.60

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.
@@ -6,11 +6,15 @@
6
6
  </template>
7
7
  <script setup>
8
8
  import { h, ref, onActivated, resolveComponent, onBeforeUnmount } from 'vue'
9
+ import { useDraggable } from '../../utils/useDraggable'
10
+
9
11
  const emit = defineEmits(['close'])
10
12
  const props = defineProps({
11
13
  vmodel: Object,
12
14
  zindex: Number
13
15
  })
16
+ const { containerStyle, startDrag, hasDragged } = useDraggable('.ct-dialog_draggable')
17
+
14
18
  const contentTop = ref(0)
15
19
  const content = ref()
16
20
  const captionBarButtons = ref([])
@@ -63,10 +67,12 @@ const render = () => {
63
67
  }, [
64
68
 
65
69
  h('div', {
70
+ class: 'ct-dialog_draggable', // 增加 class
66
71
  style: {
67
- 'margin': 'auto',
68
- 'position': 'relative'
69
- },
72
+ 'cursor': 'move',
73
+
74
+ ...containerStyle.value
75
+ } // 使用响应式样式
70
76
  },
71
77
  [
72
78
  h('table',
@@ -87,8 +93,10 @@ const render = () => {
87
93
  class: ['ct-dialog_header'],
88
94
  style: {
89
95
  'position': 'relative',
90
- 'padding': '10px 20px 10px 20px'
96
+ 'padding': '10px 20px 10px 20px',
97
+ 'cursor': hasDragged.value ? 'move' : 'default'
91
98
  },
99
+ onMousedown: startDrag,
92
100
  }, [
93
101
  h('span',
94
102
  {
@@ -153,9 +161,8 @@ const render = () => {
153
161
  }
154
162
  }
155
163
  //AI弹框宽度自适应
156
- if (!item.attrs.onAIToggle) {
157
- item.attrs.onAIToggle = (newWidth) => {
158
-
164
+ if (!item.attrs.onToggleWdth) {
165
+ item.attrs.onToggleWdth = (newWidth) => {
159
166
  item.width = parseFloat(item.width) + newWidth + 'px';
160
167
  }
161
168
  }
@@ -281,4 +288,8 @@ const render = () => {
281
288
  border-top: initial;
282
289
  border-bottom: initial;
283
290
  }
291
+
292
+ .ct-dialog_draggable{
293
+ cursor: move;
294
+ }
284
295
  </style>
@@ -502,7 +502,7 @@ function deleteFile(file, forceDelete, model) {
502
502
  }
503
503
 
504
504
  }
505
- break;
505
+ break;
506
506
  }
507
507
  }
508
508
  }
@@ -565,29 +565,44 @@ function S4() {
565
565
  return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
566
566
  }
567
567
 
568
- function viewerfile(file, model) {
568
+ function buildMediaAlbum(model, targetFile) {
569
+ // 1. 生成专辑名称
570
+ const albumName = model.controlLabel || '媒体'
569
571
 
570
- let MediaAlbum = [{ albumName: model.controlLabel || "媒体", medias: [] }];
572
+ // 2. 过滤出未被删除的文件
573
+ const medias = model.fileList.filter(item => item.flagDeleted !== true)
571
574
 
572
- let fileList = model.fileList.filter((item) => {
573
- return item.flagDeleted !== true;
574
- });
575
- fileList.forEach((v) => {
576
- MediaAlbum[0].medias.push(v);
577
- });
578
- var index = MediaAlbum[0].medias.findIndex(
579
- (v) => (v === file)
580
- );
575
+
576
+ // 3. 构建专辑对象
577
+ const album = { albumName, medias }
578
+
579
+ // 4. 查找目标文件的索引(如果没有传入则返回 -1)
580
+ const index = targetFile
581
+ ? medias.findIndex(v => v === targetFile)
582
+ : -1
581
583
 
582
- if(model.moreActionRouter){
583
- let submitData = {};
584
- submitData = model.form.$vue.getFileData(model.moreActionRouter);
585
- submitData.index=index;
586
- submitData = model.moreActionRouter.getActionPara(submitData).para;
587
- model.$vue.emit('tableButtonClick',model.moreActionRouter,submitData);
584
+ return { album, index }
585
+ }
586
+
587
+ function viewerfile(file, model, callback) {
588
+
589
+ const { album, index } = buildMediaAlbum(model, file)
590
+ // 如果之前其他地方需要 MediaAlbum 数组,只需 [album] 即可
591
+ const MediaAlbum = [album];
592
+ if (model.mediaViewPageType == 3) {
593
+ callback(MediaAlbum, 0, index);
594
+ return;
588
595
  }
589
- else{
590
- common.viewerfile((model.controlLabel || "预览媒体"), MediaAlbum, 0, index, model.mediaViewPageType);
596
+
597
+ if (model.moreActionRouter) {
598
+ let submitData = {};
599
+ submitData = model.form.$vue.getFileData(model.moreActionRouter);
600
+ submitData.index = index;
601
+ submitData = model.moreActionRouter.getActionPara(submitData).para;
602
+ model.$vue.emit('tableButtonClick', model.moreActionRouter, submitData);
603
+ }
604
+ else {
605
+ common.viewerfile((model.controlLabel || "预览媒体"), MediaAlbum, 0, index, model.mediaViewPageType);
591
606
  }
592
607
  }
593
608
  function selfValidExcute(eventName, model) {
@@ -601,7 +616,7 @@ function selfValidExcute(eventName, model) {
601
616
  }
602
617
  if (model.required) {
603
618
  if (File.getfileListLength(model) === 0) {
604
- model.validMessage = common.LocalizedString("必须上传附件","必須上傳附件");
619
+ model.validMessage = common.LocalizedString("必须上传附件", "必須上傳附件");
605
620
  model.valid = false;
606
621
  model.displayValidMessage = model.validMessage;
607
622
  return false;
@@ -733,6 +748,7 @@ const File = {
733
748
  viewerfile,
734
749
  selfValidExcute,
735
750
  validFileClass,
736
- setPublicClassify
751
+ setPublicClassify,
752
+ buildMediaAlbum
737
753
  };
738
754
  export default File;
@@ -7,7 +7,7 @@ function loadSearchTableApi(action, callBack, searchModel, flagSearch, defaultSe
7
7
  var apiData = searchModel?.searchData ? searchModel.searchData : {};
8
8
 
9
9
  request.postHandler(common.globalUri(), {
10
- action: (appRootUrl||'') + action,
10
+ action: (appRootUrl || '') + action,
11
11
  para: {
12
12
  searchFields: apiData,
13
13
  pageAttribute: {
@@ -49,7 +49,7 @@ function loadSearchTableModel(source, searchModel, defaultSearchData, action, se
49
49
  },
50
50
 
51
51
  },
52
- appRootUrl: appRootUrl||'',
52
+ appRootUrl: appRootUrl || '',
53
53
  selectAll: false,//全选是否选中
54
54
  selectIndex: 0,//选中行的索引
55
55
  pageIndex: 1,//当前显示页数
@@ -280,7 +280,7 @@ function loadSearchTableModel(source, searchModel, defaultSearchData, action, se
280
280
  },
281
281
  //取参数值的 Action名称
282
282
  get parameterAction() {
283
- return (appRootUrl||'') + source.content.parameterAction;
283
+ return (appRootUrl || '') + source.content.parameterAction;
284
284
  },
285
285
  get multiRowSpan() {
286
286
  if (this.isMergeTitle) {
@@ -316,7 +316,10 @@ function loadSearchTableModel(source, searchModel, defaultSearchData, action, se
316
316
  if (source.content.toolButtons) {
317
317
 
318
318
  source.content.toolButtons.forEach((v) => {
319
- v.action = (appRootUrl||'') + v.action;
319
+ if (v.action) {
320
+ v.action = (appRootUrl || '') + v.action;
321
+ }
322
+
320
323
  var button = Router(v);
321
324
  button.is = "ct-button";
322
325
  button.attrs = {
@@ -339,7 +342,9 @@ function loadSearchTableModel(source, searchModel, defaultSearchData, action, se
339
342
  rtn._actionRouter = [];
340
343
  if (source.content.actionRouters) {
341
344
  source.content.actionRouters.forEach((v) => {
342
- v.action = (appRootUrl||'') + v.action;
345
+ if (v.action) {
346
+ v.action = (appRootUrl || '') + v.action;
347
+ }
343
348
  var router = Router(v);
344
349
  router.is = "ct-button";
345
350
  rtn._actionRouter.push(router);
@@ -743,7 +748,9 @@ function loadSearchTableModel(source, searchModel, defaultSearchData, action, se
743
748
  },
744
749
  //初始化button路由
745
750
  getRtnRouter(v) {
746
- v.action = (appRootUrl||'') + v.action;
751
+ if (v.action) {
752
+ v.action = (appRootUrl || '') + v.action;
753
+ }
747
754
  var button = Router(v);
748
755
  button.is = "ct-btn";
749
756
  return button;
@@ -755,15 +762,15 @@ function loadSearchTableModel(source, searchModel, defaultSearchData, action, se
755
762
  }
756
763
  //加载指定页数数据
757
764
  function getPage(index, model, callback) {
758
- model.listData.splice(0, model.listData.length);
765
+ var selectListData = []
766
+ if (model.isRetain) {
767
+ model.listData = model.getSelectRowData({ isMulti: model.isMulti })
768
+ }
769
+ else {
770
+ model.listData.splice(0, model.listData.length);
771
+ }
759
772
  model.pageIndex = index;
760
773
  apiData(model, callback);
761
- model.selectIndex = 0;
762
- model._lastRowspan = null;
763
- if (index === 1) {
764
- setButtonsDisabled(model);
765
- model.selectAll = false;
766
- }
767
774
  }
768
775
  //加载下一页数据
769
776
  function nextPage(model, callback) {
@@ -784,8 +791,17 @@ function apiData(model, callback) {
784
791
  }
785
792
  model.isLoading = true;
786
793
  var newSearchModel = model.getSearchData();
794
+ if (model.isRetain && model.listData && model.listData.length > 0) {
795
+ newSearchModel.fields.push({
796
+ fieldName1: model.primaryFieldMappingDBName ? model.primaryFieldMappingDBName : model.primaryFieldName,
797
+ groupName: model.primaryFieldName,
798
+ operation: Enum.SearchOperation.None,
799
+ searchDataType: Enum.SearchDataType.None,
800
+ searchValue1: JSON.stringify(getSelectValue(model.listData)),
801
+ });
802
+ }
787
803
  request.postHandler(common.globalUri(), {
788
- action: model.appRootUrl + model.searchAction,
804
+ action: model.searchAction ? model.appRootUrl + model.searchAction : model.searchAction,
789
805
  para: {
790
806
  searchFields: newSearchModel ? newSearchModel : {},
791
807
  pageAttribute: model.pageData,
@@ -845,13 +861,18 @@ function apiData(model, callback) {
845
861
  model._buttons = [];
846
862
  model._actions = [];
847
863
  response.content.toolButtons.forEach((v) => {
848
- v.action = model.appRootUrl + v.action;
864
+ if (v.action) {
865
+ v.action = model.appRootUrl + v.action;
866
+ }
849
867
  var button = Router(v);
850
868
  button.is = "ct-button";
851
869
  button.attrs = {
852
870
  size: "small",
853
871
  class: 'btn-gray'
854
872
  }
873
+ if (model.isRetain && button.key.toLowerCase() == 'Retain'.toLowerCase()) {
874
+ button.code1 = true
875
+ }
855
876
  model._buttons.push(button);
856
877
  });
857
878
  model._buttons.forEach((v) => {
@@ -1013,7 +1034,7 @@ function getCurrentRowApiData(model, callback, rtnData, router) {
1013
1034
  });
1014
1035
  }
1015
1036
  request.postHandler(common.globalUri(), {
1016
- action: model.appRootUrl+model.searchAction,
1037
+ action: model.searchAction ? model.appRootUrl + model.searchAction : model.searchAction,
1017
1038
  para: {
1018
1039
  searchFields: searchFields,
1019
1040
  pageAttribute: {
@@ -1075,7 +1096,9 @@ function getCurrentRowApiData(model, callback, rtnData, router) {
1075
1096
  if (response.content.toolButtons) {
1076
1097
  model._buttons = [];
1077
1098
  response.content.toolButtons.forEach((v) => {
1078
- v.action = model.appRootUrl + v.action;
1099
+ if (v.action) {
1100
+ v.action = model.appRootUrl + v.action;
1101
+ }
1079
1102
  var button = Router(v);
1080
1103
  button.is = "ct-button";
1081
1104
  button.attrs = {
@@ -1246,6 +1269,24 @@ function checkCloseTabThen(notification) {
1246
1269
  }
1247
1270
  return rtn;
1248
1271
  }
1272
+ function getSelectValue(model) {
1273
+ let submitData = {};
1274
+ let jsonData = [];
1275
+ if (model.listData != null) {
1276
+ var submitArr = [];
1277
+ model.primaryFieldName.split(',').forEach(v => {
1278
+ submitArr.push(common.initialsToLowerCase(v));
1279
+ })
1280
+ model.listData.forEach((row) => {
1281
+ let jsonModel = {};
1282
+ submitArr.forEach((k) => {
1283
+ jsonModel[common.initialsToLowerCase(k)] = common.getDataOfUpperLower(row, k);
1284
+ });
1285
+ jsonData.push(jsonModel);
1286
+ });
1287
+ }
1288
+ return jsonData
1289
+ }
1249
1290
  const SearchTable = {
1250
1291
  loadSearchTableApi,
1251
1292
  loadSearchTableModel,
package/src/main.js CHANGED
@@ -21,7 +21,7 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
21
21
  }
22
22
 
23
23
  app.use(centaline, {
24
- baseUrl: "http://10.88.22.66/IBS.Mvc/api/",
24
+ baseUrl: "http://10.88.22.66:7080/ibs-api/",
25
25
  //baseUrl:"http://10.88.22.66:7080/ibs-api/",
26
26
  //baseUrl: "https://kq-api.centaline.com.cn/onecard-api/",
27
27
  //baseUrl: "http://10.88.22.13:6060/onecard-api/",
@@ -29,7 +29,7 @@ app.use(centaline, {
29
29
  //baseUrl: "http://10.1.245.111:38028/",
30
30
 
31
31
  flagRouterSelf: true,
32
- flagApp: true,//是否app端
32
+ flagApp: false,//是否app端
33
33
  zindex: 999,
34
34
  showRequestSuccessMessage: true,
35
35
  showRequestErrorMessage: true,
@@ -66,7 +66,7 @@ app.use(centaline, {
66
66
  return {
67
67
 
68
68
  //AuthorizationCode:'Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyaWQiOiIyNTEyMTUxNzQyMTg5QzI4MTgwRDkxRTk0MDhEOTA0QSIsImxvZ2luX3VzZXJfa2V5IjoiN2MzYzNjNjAtNWVjMy00MzdkLWExMDYtOWYxZTMwYjU0Mjg2In0.daG9mS98Gg8KmHSUjYHktMcO2Jk7SVtCcqm2sRB0I8Y2N0TuonIrVUDcHdNdDiuD3v6qO_f010tQWlBsAQ1dqg',
69
- authobject: '{EmpID:"Token_eb197a2a-06d4-4258-af95-90a6d3541b12",MachineCode:"1d6b7fc9-90ff-4a68-9504-1174fa72db7b",SSO_Token:"SSOToken_eb197a2a-06d4-4258-af95-90a6d3541b12",Platform:"WEB"}',
69
+ authobject: '{token:"T5067-2066339039585452032",platform:"WEB"}',
70
70
  //authobject: '{EmpID:"Token_946d56e1-7972-4382-9d10-4a72496aab39",MachineCode:"ae184643-f8e2-453c-a752-ba82612b592f",SSO_Token:"SSOToken_946d56e1-7972-4382-9d10-4a72496aab39",Platform:"WEB"}',
71
71
  //oldToken: 'd92d4a3b-2274-42e8-96f0-100ffb579b6e',
72
72
  //authObject: '{token:"jiangzf-1958445358178844672",platform:"WEB"}',
@@ -0,0 +1,100 @@
1
+ // utils/useDraggable.js
2
+ import { ref, reactive, computed, onBeforeUnmount } from 'vue'
3
+
4
+ /**
5
+ * 对话框拖动组合式函数
6
+ * @param {string} selector - 要拖动的容器选择器(默认 '.ct-dialog_draggable')
7
+ * @param {Object} initialPosition - 初始位置 { left, top }
8
+ * @returns {Object} { containerStyle, startDrag, hasDragged }
9
+ */
10
+ export function useDraggable(selector = '.ct-dialog_draggable', initialPosition = { left: 0, top: 0 }) {
11
+ const isDragging = ref(false)
12
+ const position = reactive({ ...initialPosition })
13
+ const hasDragged = ref(false)
14
+ const offset = reactive({ x: 0, y: 0 })
15
+
16
+ /**
17
+ * 鼠标按下开始拖动
18
+ * @param {MouseEvent} e
19
+ */
20
+ function startDrag(e) {
21
+ // 过滤按钮、关闭图标等元素,避免误触发
22
+ if (e.target.closest('button, .el-icon-close, [role="button"]')) return
23
+
24
+ // 查找真正要移动的对话框容器
25
+ const targetEl = e.currentTarget.closest(selector)
26
+ if (!targetEl) return
27
+
28
+ // 记录鼠标与容器左上角的偏移
29
+ const rect = targetEl.getBoundingClientRect()
30
+ offset.x = e.clientX - rect.left
31
+ offset.y = e.clientY - rect.top
32
+
33
+ // 首次拖动时记录当前位置,并切换为固定定位模式
34
+ if (!hasDragged.value) {
35
+ position.left = rect.left
36
+ position.top = rect.top
37
+ hasDragged.value = true
38
+ }
39
+
40
+ isDragging.value = true
41
+
42
+ // 绑定全局移动和释放事件
43
+ document.addEventListener('mousemove', onDrag)
44
+ document.addEventListener('mouseup', stopDrag)
45
+
46
+ // 阻止默认行为和文本选择
47
+ e.preventDefault()
48
+ }
49
+
50
+ /**
51
+ * 拖动过程中更新位置
52
+ * @param {MouseEvent} e
53
+ */
54
+ function onDrag(e) {
55
+ if (!isDragging.value) return
56
+ position.left = e.clientX - offset.x
57
+ position.top = e.clientY - offset.y
58
+ }
59
+
60
+ /**
61
+ * 停止拖动
62
+ */
63
+ function stopDrag() {
64
+ isDragging.value = false
65
+ document.removeEventListener('mousemove', onDrag)
66
+ document.removeEventListener('mouseup', stopDrag)
67
+ }
68
+
69
+ // 组件卸载时清理事件
70
+ onBeforeUnmount(() => {
71
+ document.removeEventListener('mousemove', onDrag)
72
+ document.removeEventListener('mouseup', stopDrag)
73
+ })
74
+
75
+ /**
76
+ * 对话框容器动态样式
77
+ * - 未拖动前:margin: auto; position: relative; (保持居中)
78
+ * - 拖动后:position: fixed; left/top 由拖动位置控制
79
+ */
80
+ const containerStyle = computed(() => {
81
+ if (hasDragged.value) {
82
+ return {
83
+ position: 'fixed',
84
+ left: position.left + 'px',
85
+ top: position.top + 'px',
86
+ margin: '0'
87
+ }
88
+ }
89
+ return {
90
+ margin: 'auto',
91
+ position: 'relative'
92
+ }
93
+ })
94
+
95
+ return {
96
+ containerStyle,
97
+ startDrag,
98
+ hasDragged
99
+ }
100
+ }
@@ -7,8 +7,8 @@
7
7
  <!-- <ct-searchlist :apiParam="apiParam" :searchConditionApi="'/propertyPublishList/getLayoutOfSearch'"
8
8
 
9
9
  :searchDataApi="'/propertyPublishList/getListOfSearchModel'" :searchStatsApi="'/propertyPublishList/getListStats'"></ct-searchlist> -->
10
- <ct-searchlist :apiParam="apiParam" :searchConditionApi="'/EmployeeAttendanceBillList/getLayoutOfSearchForMy'"
11
- :searchDataApi="'/EmployeeAttendanceBillList/getListOfSearchModelForMy'"></ct-searchlist>
10
+ <ct-searchlist :apiParam="apiParam" :searchConditionApi="'/PropertyComprehensiveQueryList/getLayoutOfSearch'"
11
+ :searchDataApi="'/PropertyComprehensiveQueryList/getListOfSearchModel'"></ct-searchlist>
12
12
 
13
13
 
14
14
  <ct-dialoglist ref="dialogList"></ct-dialoglist>