centaline-data-driven-v3 0.1.37 → 0.1.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "centaline-data-driven-v3",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "private": false,
5
5
  "description": "centaline-data-driven-v3",
6
6
  "main": "dist/centaline-data-driven-v3.umd.js",
@@ -25,6 +25,7 @@
25
25
  "vue-cropper": "^1.1.1",
26
26
  "vue-router": "^4.2.5",
27
27
  "vue-ueditor-wrap": "^3.0.8",
28
+ "vue3-json-viewer": "^2.4.1",
28
29
  "vue3-pdf-app": "^1.0.3",
29
30
  "vuedraggable": "^4.1.0"
30
31
  },
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <div ref="refForm" v-loading="loading" :style="{width:pageWidth?pageWidth+'px':'100%',margin:'auto','min-height': minHeight}">
2
+ <div ref="refForm" v-loading="loading"
3
+ :style="{ width: pageWidth ? pageWidth + 'px' : '100%', margin: 'auto', 'min-height': minHeight }">
3
4
  <div style="display: flex; width: 100%;">
4
5
  <div style="flex: 1; min-width: 0;">
5
6
  <div v-if="model !== null && !loading" class="ct-form">
@@ -11,13 +12,18 @@
11
12
 
12
13
  <!--可根据场景判断显示el-card还是el-main-->
13
14
  <component :is="model.showTitle ? 'el-main' : 'el-card'">
15
+ <div class="ct-from-title" v-if="typeof model.title !== 'undefined' && model.flagShowTitle">
16
+ <span style="font-weight:bold">{{ model.title }}</span>
17
+ </div>
18
+
14
19
  <!--relationParentFormFields-->
15
20
  <el-row v-if="relationParentFormFields.length > 0">
16
21
  <template v-for="(col, index) in relationParentFormFields" :key="index">
17
22
  <div style="display: flex; flex: 0 0 100%;" v-if="col.show !== false && col.lineFeed">
18
23
  </div>
19
- <el-col v-if="col.show !== false" :span="col.colspan" style="padding:5px" :class="[col.is=='ct-button'&&col.labelPlacement=='1' ? 'el-col1' : '']">
20
- <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey"
24
+ <el-col v-if="col.show !== false" :span="col.colspan" style="padding:5px"
25
+ :class="[col.is == 'ct-button' && col.labelPlacement == '1' ? 'el-col1' : '']">
26
+ <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey" :listHeight="listHeight"
21
27
  :parameterAction="model.parameterAction" v-bind="col.bindPara"
22
28
  :fileData="getFileData(col)" @change="changeHandler"
23
29
  @importComplete="importComplete" @popupLocation="popupLocationHandler"
@@ -34,8 +40,9 @@
34
40
  <template v-for="(col, index) in model.collapseFields[0]" :key="index">
35
41
  <div style="display: flex; flex: 0 0 100%;" v-if="col.show !== false && col.lineFeed">
36
42
  </div>
37
- <el-col v-if="col.show !== false" :span="col.colspan" style="padding:5px" :class="[col.is=='ct-button'&&col.labelPlacement=='1' ? 'el-col1' : '']">
38
- <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey"
43
+ <el-col v-if="col.show !== false" :span="col.colspan" style="padding:5px"
44
+ :class="[col.is == 'ct-button' && col.labelPlacement == '1' ? 'el-col1' : '']">
45
+ <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey" :listHeight="listHeight"
39
46
  :parameterAction="model.parameterAction" v-bind="col.bindPara"
40
47
  :fileData="getFileData(col)" @change="changeHandler"
41
48
  @importComplete="importComplete" @popupLocation="popupLocationHandler"
@@ -47,19 +54,20 @@
47
54
  </template>
48
55
  </el-row>
49
56
  <!--tabs-->
50
- <el-tabs v-if="model.isHorizontalLayout" v-model="activeName">
57
+ <el-tabs v-if="model.isHorizontalLayout" v-model="activeName" @tab-click="tabClick">
51
58
  <template v-for="(item, index) in model.collapse" :key="index">
52
- <el-tab-pane :name="index.toString()" :lazy="item.lazyLoad"
53
- v-if="item.show !== false" :key="index">
54
- <template #label>
59
+ <el-tab-pane :name="index.toString()" :lazy="item.lazyLoad" v-if="item.show !== false"
60
+ :key="index">
61
+ <template #label>
55
62
  <span v-html="item.controlLabel"></span>
56
63
  </template>
57
64
  <el-row>
58
65
  <template v-for="(col, i) in model.collapseFields[index + 1]" :key="i">
59
66
  <div style="display: flex; flex: 0 0 100%;"
60
67
  v-if="col.show !== false && col.lineFeed"></div>
61
- <el-col :span="col.colspan" v-if="col.show !== false" style="padding:5px" :class="[col.is=='ct-button'&&col.labelPlacement=='1' ? 'el-col1' : '']">
62
- <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey"
68
+ <el-col :span="col.colspan" v-if="col.show !== false" style="padding:5px"
69
+ :class="[col.is == 'ct-button' && col.labelPlacement == '1' ? 'el-col1' : '']">
70
+ <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey" :listHeight="listHeight"
63
71
  :parameterAction="model.parameterAction" v-bind="col.bindPara"
64
72
  :fileData="getFileData(col)" @change="changeHandler"
65
73
  @fieldClick="fieldClickHandler"
@@ -86,7 +94,7 @@
86
94
  <template #title>
87
95
  <i class="sign"></i>
88
96
  <span :class="[item.required ? 'requiredLabel' : '']">{{ item.controlLabel
89
- }}</span>
97
+ }}</span>
90
98
  <span v-html="item.sufLabel1"></span>
91
99
  </template>
92
100
 
@@ -94,8 +102,9 @@
94
102
  <template v-for="(col, i) in model.collapseFields[index + 1]" :key="i">
95
103
  <div style="display: flex; flex: 0 0 100%;"
96
104
  v-if="col.show !== false && col.lineFeed"></div>
97
- <el-col :span="col.colspan" v-if="col.show !== false" style="padding:5px" :class="[col.is=='ct-button'&&col.labelPlacement=='1' ? 'el-col1' : '']">
98
- <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey"
105
+ <el-col :span="col.colspan" v-if="col.show !== false" style="padding:5px"
106
+ :class="[col.is == 'ct-button' && col.labelPlacement == '1' ? 'el-col1' : '']">
107
+ <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey" :listHeight="listHeight"
99
108
  :parameterAction="model.parameterAction" v-bind="col.bindPara"
100
109
  :fileData="getFileData(col)" @change="changeHandler"
101
110
  @fieldClick="fieldClickHandler"
@@ -117,8 +126,9 @@
117
126
  <template v-for="(col, index) in model.independentItem" :key="index">
118
127
  <div style="display: flex; flex: 0 0 100%;" v-if="col.show !== false && col.lineFeed">
119
128
  </div>
120
- <el-col v-if="col.show !== false" :span="col.colspan" style="padding:5px" :class="[col.is=='ct-button'&&col.labelPlacement=='1' ? 'el-col1' : '']">
121
- <component ref="Fields" :is="col.is" :vmodel="col"
129
+ <el-col v-if="col.show !== false" :span="col.colspan" style="padding:5px"
130
+ :class="[col.is == 'ct-button' && col.labelPlacement == '1' ? 'el-col1' : '']">
131
+ <component ref="Fields" :is="col.is" :vmodel="col" :listHeight="listHeight"
122
132
  :parameterAction="model.parameterAction" v-bind="col.bindPara"
123
133
  @change="changeHandler" :key="itemKey" :fileData="getFileData(col)"
124
134
  @fieldClick="fieldClickHandler" @popupSearchList="popupSearchListHandler"
@@ -130,7 +140,7 @@
130
140
  </template>
131
141
  </el-row>
132
142
  <el-row v-if="model.links.findIndex((v) => { return v.show }) > -1" style="margin-top: 8px;">
133
- <el-col :span="24" style="text-align:left" >
143
+ <el-col :span="24" style="text-align:left">
134
144
  <template v-for="(btn, index) in model.links" :key="index">
135
145
  <component :is="btn.is" :vmodel="btn" v-if="btn.show" @fieldClick="clickHandler">
136
146
  </component>
@@ -143,7 +153,7 @@
143
153
  :style="['max-width:' + buttonsWidth(), isWebScroll ? 'position: fixed;' : '']">
144
154
  <el-col :span="24"
145
155
  style="text-align:center;padding-bottom: 1px;padding-left: 5px;padding-right: 5px;"
146
- class="btnPadBom" >
156
+ class="btnPadBom">
147
157
  <template v-for="(btn, index) in model.buttons" :key="index">
148
158
  <component :is="btn.is" :vmodel="btn" v-if="btn.show" @fieldClick="clickHandler"
149
159
  :style="{ 'float': btn.isCheckbox ? btn.alignCss : '' }"></component>
@@ -196,7 +206,6 @@ import { useRouter } from 'vue-router';
196
206
  import util from '../../utils/pub-use'
197
207
  import Enum from '../../utils/Enum';
198
208
  import AIChat from '../web/AIChat.vue';
199
- import { fi } from 'element-plus/es/locale';
200
209
  const emit = defineEmits(['loaded', 'failLoad', 'submit', 'AIToggle'])
201
210
  const props = defineProps({
202
211
  api: String,
@@ -230,6 +239,10 @@ const props = defineProps({
230
239
  String,
231
240
  default: 'close',
232
241
  },
242
+ pageStyle: {
243
+ String,
244
+ default: '',
245
+ },
233
246
  openType: {
234
247
  String,
235
248
  default: '',
@@ -246,6 +259,7 @@ const props = defineProps({
246
259
  },
247
260
  dialogHeight: Number,
248
261
  dialoWidth: Number,
262
+ listHeight: Number,
249
263
  })
250
264
 
251
265
  const itemKey = ref(1)
@@ -261,6 +275,7 @@ const downloadUrl = ref('')
261
275
  const minHeight = ref('auto')
262
276
  const showAI = ref(false);
263
277
  const dialogHeight = ref(props.dialogHeight || (window.innerHeight - 60));
278
+ const tabActiveNameKey = ref('')
264
279
 
265
280
  const qrtimer1 = ref(null)
266
281
  const qrtimer2 = ref(null)
@@ -336,6 +351,22 @@ function load(data) {
336
351
  });
337
352
  }
338
353
  loading.value = false;
354
+
355
+ if (props.openType == 'detail') {
356
+ tabActiveNameKey.value = props.api + model.value.title + props.pageStyle;
357
+ var tagkey = window.localStorage.getItem(tabActiveNameKey.value);
358
+ if (window.localStorage) {
359
+ if (model.value.collapseFields && model.value.collapse) {
360
+ for (var i = 0; i < model.value.collapse.length; i++) {
361
+ if (tagkey == model.value.collapse[i].fieldName1) {
362
+ activeName.value = i.toString();
363
+ }
364
+ }
365
+ }
366
+
367
+ }
368
+ }
369
+
339
370
  //通知父组件加载完成
340
371
  emit('loaded', model.value);
341
372
  }
@@ -378,9 +409,9 @@ function fieldClickHandler(field) {
378
409
  let data = Form.getRouterAndSubmitData(field, model.value);
379
410
  clickHandler(data.router, data.submitData);
380
411
  }
381
- function clickHandler(field, submitData,formList) {
412
+ function clickHandler(field, submitData, formList) {
382
413
  if (field.isOpenFileDialog) {
383
- common.excuteFunStr.call(model.value.scripts, field.onChanged, {files: field.fileList,columns: formList?.source?.rows[0].columns });
414
+ common.excuteFunStr.call(model.value.scripts, field.onChanged, { files: field.fileList, columns: formList?.source?.rows[0].columns });
384
415
  }
385
416
  else {
386
417
  RouterClickHandler(field, submitData, null, model.value, 'form');
@@ -678,6 +709,12 @@ function buttonsWidth() {
678
709
  return rtn;
679
710
  }
680
711
 
712
+ function tabClick(event) {
713
+ if (props.openType == 'detail') {
714
+ window.localStorage.setItem(tabActiveNameKey.value, model.value.collapse[event.index].fieldName1);//存储
715
+ }
716
+ }
717
+
681
718
  </script>
682
719
 
683
720
  <style scoped>
@@ -0,0 +1,102 @@
1
+ <template>
2
+
3
+ <div class="josnViewerBox" :style="{ height: model.height || 'auto','max-height':(listHeight?listHeight-130+'px':'calc(100vh - 130px)') }" v-if="isRefresh">
4
+ <JsonViewer :value="model.json" copyable show-array-index show-double-quotes theme="light" :expanded="true"
5
+ :expand-depth="2" @onKeyClick="keyClick">
6
+ <template #copy="{ copied }">
7
+ <div class="btn-iocn"><el-icon title="复原到初始状态" @click.stop="resetJSON">
8
+ <Refresh />
9
+ </el-icon>
10
+
11
+ <!-- 复制按钮 -->
12
+ <el-icon :class="{ 'copied': copied }" title="复制JSON内容">
13
+ <CopyDocument />
14
+ </el-icon>
15
+ </div>
16
+ </template>
17
+ </JsonViewer>
18
+ </div>
19
+ </template>
20
+
21
+ <script setup>
22
+ import { JsonViewer } from "vue3-json-viewer"
23
+ import "vue3-json-viewer/dist/vue3-json-viewer.css";
24
+ import { nextTick, ref } from "vue";
25
+ const props = defineProps({
26
+ api: String,
27
+ vmodel: Object,
28
+ actionRouter: Array,
29
+ listHeight: Number,
30
+ })
31
+ const model = ref({});
32
+ const isRefresh = ref(true);
33
+
34
+
35
+ init()
36
+ //初始化数据
37
+ function init() {
38
+
39
+ nextTick(function () {
40
+ if (props.vmodel) {
41
+ load(props.vmodel);
42
+ }
43
+ });
44
+ }
45
+ function load(data) {
46
+ model.value = data;
47
+ }
48
+ const resetJSON = () => {
49
+ isRefresh.value = false;
50
+ nextTick(() => {
51
+ isRefresh.value = true;
52
+ });
53
+ };
54
+
55
+
56
+
57
+ const keyClick = (keyName) => {
58
+ console.log(keyName, "it was click")
59
+ }
60
+ </script>
61
+
62
+ <style scoped>
63
+ :deep(.jv-container .jv-code) {
64
+ padding: 0px !important;
65
+ }
66
+
67
+ :deep(.jv-tooltip) {
68
+ position: sticky !important;
69
+ top: 0 !important;
70
+ right: 0 !important;
71
+ /* 新增:靠右定位 */
72
+ z-index: 10;
73
+ margin-left: auto;
74
+ /* 辅助:确保靠右 */
75
+ float: right;
76
+
77
+ }
78
+
79
+
80
+
81
+ .josnViewerBox {
82
+ overflow: auto;
83
+ width: 100%;
84
+ border: 1px solid #eee;
85
+ border-radius: 4px;
86
+ padding: 2px;
87
+ /* 明确设置背景色 */
88
+ /* 增加内边距让边框更明显 */
89
+ box-sizing: border-box;
90
+ background-color: #ffffff;
91
+ }
92
+ .josnViewerBox:focus {
93
+ border: 1px solid #3D5ECC;
94
+ }
95
+
96
+
97
+ .btn-iocn {
98
+ display: flex;
99
+ gap: 10px;
100
+
101
+ }
102
+ </style>
@@ -7,8 +7,8 @@
7
7
 
8
8
  <div ref="detailForm" v-if="pageType == 'Form'" style="overflow: auto;"
9
9
  :style="{ height: (listHeight - 5) + 'px' }">
10
- <ct-form :api="rowSelectRouter.action" :apiParam="apiParam" @submit="submit" :flagScroll="'true'"
11
- :drowerClose="drowerClose" :openType="'detail'">
10
+ <ct-form :api="rowSelectRouter.action" :pageStyle="rowSelectRouter.pageStyle" :apiParam="apiParam" @submit="submit" :flagScroll="'true'"
11
+ :drowerClose="drowerClose" :openType="'detail'" :listHeight="listHeight">
12
12
  </ct-form>
13
13
  </div>
14
14
 
@@ -0,0 +1,20 @@
1
+ function loadJsonViewerModel(source) {
2
+ let rtn = {
3
+ get json() {
4
+ if (source.code1 && typeof source.code1 === 'string') {
5
+ return JSON.parse(source.code1);
6
+
7
+ } else {
8
+ return source.code1;
9
+ }
10
+ },
11
+ get height() {
12
+ return source.rows ? source.rows * 20 + 'px' : 'auto';
13
+ }
14
+ };
15
+ return rtn;
16
+ }
17
+ const JsonViewer = {
18
+ loadJsonViewerModel
19
+ };
20
+ export default JsonViewer;
@@ -23,6 +23,7 @@ import Steps from './Steps';
23
23
  import Tags from './Tags';
24
24
  import Location from './Location';
25
25
  import AIChat from './AIChat';
26
+ import JsonViewer from './JsonViewer';
26
27
  const LibFunction = {
27
28
  install(app) {
28
29
  },
@@ -80,7 +81,7 @@ const LibFunction = {
80
81
  moreActionRouter = LibFunction.getRouter(source.actionRouters, field.moreActionRouterKey);
81
82
  }
82
83
 
83
- item = Field(field, moreActionRouter,source.labelPlacement);
84
+ item = Field(field, moreActionRouter, source.labelPlacement);
84
85
  item.isList = isList;
85
86
  switch (field.controlType) {
86
87
  case Enum.ControlType.Group:
@@ -217,10 +218,10 @@ const LibFunction = {
217
218
  item.is = 'ct-customizecolumns'
218
219
  break;
219
220
  case Enum.ControlType.Location:
220
- moreActionRouter = LibFunction.getRouter(source.actionRouters, field.moreActionRouterKey);
221
- item = Location(item,moreActionRouter);
222
- item.is = 'ct-location';
223
- break;
221
+ moreActionRouter = LibFunction.getRouter(source.actionRouters, field.moreActionRouterKey);
222
+ item = Location(item, moreActionRouter);
223
+ item.is = 'ct-location';
224
+ break;
224
225
  case Enum.ControlType.SearchPage: //搜索列表页面
225
226
  //item = {};
226
227
  item.is = 'ct-searchlist';
@@ -255,8 +256,8 @@ const LibFunction = {
255
256
  case Enum.ControlType.Image:
256
257
  item.is = 'ct-image'
257
258
  break;
258
-
259
- case Enum.ControlType.AIChat: //AI
259
+
260
+ case Enum.ControlType.AIChat: //AI
260
261
  var router = {};
261
262
  if (source.actionRouters) {
262
263
  router = source.actionRouters.find((v1) => {
@@ -270,10 +271,14 @@ const LibFunction = {
270
271
  } else {
271
272
  messages = field.code1 && field.code1 != "[]" ? JSON.parse(field.code1) : [];
272
273
  }
273
-
274
+
274
275
  item = AIChat.loadFromModel(item, messages, router);
275
276
  item.is = 'ct-aichat';
276
277
  break;
278
+ case Enum.ControlType.JsonViewer: //JSON预览控件
279
+ item = JsonViewer.loadJsonViewerModel(item);
280
+ item.is = 'ct-jsonviewer';
281
+ break;
277
282
  default:
278
283
  item = Label(item)
279
284
  item.is = 'ct-label'
@@ -85,6 +85,11 @@ function loadSearchTableModel(source, searchModel, defaultSearchData, action, se
85
85
  set title(v) {
86
86
  source.content.title = v;
87
87
  },
88
+ get flagShowTitle() {
89
+ let v = false;
90
+ if (source.flagShowTitle) v = source.flagShowTitle;
91
+ return v;
92
+ },
88
93
  //源数据
89
94
  get source() {
90
95
  return source;
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.13:7080/ibs-api/",
25
25
  //baseUrl:"http://10.88.22.13:7070/onecard-api/",
26
26
  //baseUrl: "https://kq-api.centaline.com.cn/onecard-api/",
27
27
  //baseUrl: "http://10.88.22.13:6060/onecard-api/",
@@ -65,7 +65,7 @@ app.use(centaline, {
65
65
  //获取请求头
66
66
  getRequestHeaders: function () {
67
67
  return {
68
- authobject: '{EmpID:"Token_3d65f2f0-d6a3-432e-9af6-5c378b501b76",MachineCode:"ae184643-f8e2-453c-a752-ba82612b592f",SSO_Token:"SSOToken_3d65f2f0-d6a3-432e-9af6-5c378b501b76",Platform:"WEB"}',
68
+ authobject: '{token:"T5067-1993594422771769344",platform:"WEB"}',
69
69
  //oldToken: 'd92d4a3b-2274-42e8-96f0-100ffb579b6e',
70
70
  //authObject: '{token:"jiangzf-1958445358178844672",platform:"WEB"}',
71
71
  //authObject: '{EmpID:"Token_4e09499b-4b76-46df-9ce5-5498d48ed062",MachineCode:"ae184643-f8e2-453c-a752-ba82612b592f",SSO_Token:"SSOToken_4e09499b-4b76-46df-9ce5-5498d48ed062",Platform:"WEB"}',
package/src/utils/Enum.js CHANGED
@@ -309,7 +309,11 @@ const Enum = {
309
309
  /// <summary>
310
310
  /// AI会话控件
311
311
  /// </summary>
312
- AIChat: 62
312
+ AIChat: 62,
313
+ /// <summary>
314
+ /// Json预览控件
315
+ /// </summary>
316
+ JsonViewer: 63
313
317
  },
314
318
 
315
319
  //返回状态码