centaline-data-driven-v3 0.1.14 → 0.1.16

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.
@@ -1,48 +1,95 @@
1
1
  <template>
2
2
  <div class="ct-field">
3
- <div class="el-form-item el-form-item--small" :class="[!model.valid ? 'is-error' : '']">
4
- <div class="el-form-item__label" v-if="model.showLabel && model.controlLabel">
5
- <!-- 插槽--控件显示的label -->
6
- <slot name="ControlLabel">
7
- <div :class="[model.required ? 'requiredLabel' : '']" :style="model.isList?'white-space: nowrap':''">
8
- <span>{{ model.controlLabel }}</span>
3
+ <div class="el-form-item el-form-item--small"
4
+ :class="[!model.valid ? 'is-error' : '', 'label-' + model.labelPlacement]">
5
+
6
+ <!-- 使用单一元素结构 -->
7
+ <template v-if="model.isList">
8
+ <div class="el-form-item__label" v-if="model.showLabel && model.controlLabel">
9
+ <slot name="ControlLabel">
10
+ <div :class="[model.required ? 'requiredLabel' : '']"
11
+ :style="model.isList ? 'white-space: nowrap' : ''">
12
+ <span>{{ model.controlLabel }}</span>
13
+ </div>
14
+ </slot>
15
+ </div>
16
+ <template v-else>
17
+ <div class="el-form-item__label" v-if="model.labelPlacement == '1'"></div>
18
+ </template>
19
+
20
+ <slot name="PreLabel">
21
+ <div v-if="model.preLabel1" class="preLabel">
22
+ <span v-html="model.preLabel1"></span>
9
23
  </div>
10
24
  </slot>
11
- </div>
12
- <!-- 插槽--控件前面的内容 -->
13
- <slot name="PreLabel">
14
- <div v-if="model.preLabel1" class="preLabel">
15
- <span v-html="model.preLabel1"></span>
25
+ </template>
26
+ <div class="label-wrapper" v-else>
27
+ <div class="el-form-item__label" v-if="model.showLabel && model.controlLabel">
28
+ <slot name="ControlLabel">
29
+ <div :class="[model.required ? 'requiredLabel' : '']"
30
+ :style="model.isList ? 'white-space: nowrap' : ''">
31
+ <span>{{ model.controlLabel }}</span>
32
+ </div>
33
+ </slot>
16
34
  </div>
17
- </slot>
18
-
19
- <!-- 插槽--控件的内容 -->
20
- <slot name="Control">
21
-
22
- </slot>
23
- <!-- 插槽--控件后面的内容 -->
24
- <slot name="SufLabel" v-if="model.controlType != Enum.ControlType.CheckBox
25
- &&model.controlType != Enum.ControlType.MultiLineText
26
- &&model.controlType != Enum.ControlType.Switch">
27
- <span v-if="model.sufLabel1" class="sufLabel" v-html="model.sufLabel1"></span>
28
- </slot>
29
- <!-- 插槽--验证提示的内容 -->
30
- <slot name="ValidMessage">
31
- <span v-show="!model.valid" class="errorMessage">
32
- {{ model.validMessage }}
33
- </span>
34
- </slot>
35
- <!-- 插槽--控件后面的按钮 -->
36
- <slot name="Sufbutton">
37
-
38
- </slot>
35
+ <template v-else>
36
+ <div class="el-form-item__label" v-if="model.labelPlacement == '1'"></div>
37
+ </template>
38
+
39
+ <slot name="PreLabel">
40
+ <div v-if="model.preLabel1" class="preLabel">
41
+ <span v-html="model.preLabel1"></span>
42
+ </div>
43
+ </slot>
44
+ </div>
45
+
46
+ <div class="control-wrapper">
47
+ <!-- 插槽--控件的内容 -->
48
+ <slot name="Control">
49
+ </slot>
50
+ <!-- 插槽--控件后面的内容 -->
51
+ <slot name="SufLabel" v-if="model.controlType != Enum.ControlType.CheckBox
52
+ && model.controlType != Enum.ControlType.MultiLineText
53
+ && model.controlType != Enum.ControlType.Switch">
54
+ <span v-if="model.sufLabel1" class="sufLabel" v-html="model.sufLabel1"></span>
55
+ </slot>
56
+ <!-- 插槽--验证提示的内容 -->
57
+ <slot name="ValidMessage">
58
+ <span v-show="!model.valid" class="errorMessage">
59
+ {{ model.validMessage }}
60
+ </span>
61
+ </slot>
62
+ <!-- 插槽--控件后面的按钮 -->
63
+ <slot name="Sufbutton">
64
+
65
+ </slot>
66
+ </div>
39
67
  </div>
40
68
  </div>
41
69
  </template>
42
- <script lang="ts" setup>
70
+ <script lang="ts" setup>
43
71
  import Enum from '../../utils/Enum'
44
72
  const props = defineProps({
45
73
  vmodel: Object,
46
74
  })
47
75
  const model = props.vmodel
48
- </script>
76
+ </script>
77
+
78
+ <style lang="scss" scoped>
79
+ .control-wrapper {
80
+ display: flex;
81
+ width: 100%;
82
+ }
83
+
84
+ .label-wrapper {
85
+ display: flex;
86
+ }
87
+
88
+ .el-form-item.label-1 {
89
+ flex-direction: column;
90
+
91
+ .el-form-item__label {
92
+ justify-content: flex-start;
93
+ }
94
+ }
95
+ </style>
@@ -318,6 +318,10 @@ function getSuffix(file) {
318
318
  return "";
319
319
  }
320
320
  function handleChange(file, fileList) {
321
+ if (file && model.maxSize && file.size > model.maxSize) {
322
+ this.$message.error(`文件大小不能超过 ${model.maxSize / (1024 * 1024)}MB`);
323
+ fileList.pop(); // 移除不符合要求的文件
324
+ }
321
325
  changeHandler(model.value, emit);
322
326
  }
323
327
  //上传之前的钩子
@@ -16,7 +16,7 @@
16
16
  <template v-for="(col, index) in relationParentFormFields" :key="index">
17
17
  <div style="display: flex; flex: 0 0 100%;" v-if="col.show !== false && col.lineFeed">
18
18
  </div>
19
- <el-col v-if="col.show !== false" :span="col.colspan" style="padding:5px">
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
20
  <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey"
21
21
  :parameterAction="model.parameterAction" v-bind="col.bindPara"
22
22
  :fileData="getFileData(col)" @change="changeHandler"
@@ -34,7 +34,7 @@
34
34
  <template v-for="(col, index) in model.collapseFields[0]" :key="index">
35
35
  <div style="display: flex; flex: 0 0 100%;" v-if="col.show !== false && col.lineFeed">
36
36
  </div>
37
- <el-col v-if="col.show !== false" :span="col.colspan" style="padding:5px">
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
38
  <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey"
39
39
  :parameterAction="model.parameterAction" v-bind="col.bindPara"
40
40
  :fileData="getFileData(col)" @change="changeHandler"
@@ -55,7 +55,7 @@
55
55
  <template v-for="(col, i) in model.collapseFields[index + 1]" :key="i">
56
56
  <div style="display: flex; flex: 0 0 100%;"
57
57
  v-if="col.show !== false && col.lineFeed"></div>
58
- <el-col :span="col.colspan" v-if="col.show !== false" style="padding:5px">
58
+ <el-col :span="col.colspan" v-if="col.show !== false" style="padding:5px" :class="[col.is=='ct-button'&&col.labelPlacement=='1' ? 'el-col1' : '']">
59
59
  <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey"
60
60
  :parameterAction="model.parameterAction" v-bind="col.bindPara"
61
61
  :fileData="getFileData(col)" @change="changeHandler"
@@ -91,7 +91,7 @@
91
91
  <template v-for="(col, i) in model.collapseFields[index + 1]" :key="i">
92
92
  <div style="display: flex; flex: 0 0 100%;"
93
93
  v-if="col.show !== false && col.lineFeed"></div>
94
- <el-col :span="col.colspan" v-if="col.show !== false" style="padding:5px">
94
+ <el-col :span="col.colspan" v-if="col.show !== false" style="padding:5px" :class="[col.is=='ct-button'&&col.labelPlacement=='1' ? 'el-col1' : '']">
95
95
  <component ref="Fields" :is="col.is" :vmodel="col" :key="itemKey"
96
96
  :parameterAction="model.parameterAction" v-bind="col.bindPara"
97
97
  :fileData="getFileData(col)" @change="changeHandler"
@@ -114,7 +114,7 @@
114
114
  <template v-for="(col, index) in model.independentItem" :key="index">
115
115
  <div style="display: flex; flex: 0 0 100%;" v-if="col.show !== false && col.lineFeed">
116
116
  </div>
117
- <el-col v-if="col.show !== false" :span="col.colspan" style="padding:5px">
117
+ <el-col v-if="col.show !== false" :span="col.colspan" style="padding:5px" :class="[col.is=='ct-button'&&col.labelPlacement=='1' ? 'el-col1' : '']">
118
118
  <component ref="Fields" :is="col.is" :vmodel="col"
119
119
  :parameterAction="model.parameterAction" v-bind="col.bindPara"
120
120
  @change="changeHandler" :key="itemKey" :fileData="getFileData(col)"
@@ -127,7 +127,7 @@
127
127
  </template>
128
128
  </el-row>
129
129
  <el-row v-if="model.links.findIndex((v) => { return v.show }) > -1" style="margin-top: 8px;">
130
- <el-col :span="24" style="text-align:left">
130
+ <el-col :span="24" style="text-align:left" >
131
131
  <template v-for="(btn, index) in model.links" :key="index">
132
132
  <component :is="btn.is" :vmodel="btn" v-if="btn.show" @fieldClick="clickHandler">
133
133
  </component>
@@ -140,7 +140,7 @@
140
140
  :style="['max-width:' + buttonsWidth(), isWebScroll ? 'position: fixed;' : '']">
141
141
  <el-col :span="24"
142
142
  style="text-align:center;padding-bottom: 1px;padding-left: 5px;padding-right: 5px;"
143
- class="btnPadBom">
143
+ class="btnPadBom" >
144
144
  <template v-for="(btn, index) in model.buttons" :key="index">
145
145
  <component :is="btn.is" :vmodel="btn" v-if="btn.show" @fieldClick="clickHandler"
146
146
  :style="{ 'float': btn.isCheckbox ? btn.alignCss : '' }"></component>
@@ -43,7 +43,7 @@
43
43
  ]" @mousemove="thMouseMoveHandle($event)"
44
44
  @mousedown="thMouseDownHandle($event, colIndex)" @mouseover="theadTitleHover"
45
45
  @mouseout="theadTitleLeave" v-bind="column.attrs" id="thHeight">
46
- <span>{{ column.name }}</span>
46
+ <span v-html="column.name"></span>
47
47
  <span class="caret-wrapper" v-if="column.sort" @click="toSort($event, column)"
48
48
  @contextmenu.prevent="clearSort($event, column)">
49
49
  <i class="sort-caret ascending" @click.left="toSort($event, column, 'asc')"
@@ -555,6 +555,7 @@ function importComplete(res, field) {
555
555
  message: data.rtnMsg,
556
556
  type: 'success',
557
557
  showClose: true,
558
+ dangerouslyUseHTMLString:true,
558
559
  });
559
560
  }
560
561
  getPage(1, false);
@@ -565,6 +566,7 @@ function importComplete(res, field) {
565
566
  message: data.rtnMsg,
566
567
  type: 'warning',
567
568
  showClose: true,
569
+ dangerouslyUseHTMLString:true,
568
570
  });
569
571
  }
570
572
  },
@@ -607,6 +609,7 @@ function importComplete(res, field) {
607
609
  message: data.rtnMsg,
608
610
  type: 'success',
609
611
  showClose: true,
612
+ dangerouslyUseHTMLString:true,
610
613
  });
611
614
  }
612
615
  getPage(1, false);
@@ -617,6 +620,7 @@ function importComplete(res, field) {
617
620
  message: data.rtnMsg,
618
621
  type: 'warning',
619
622
  showClose: true,
623
+ dangerouslyUseHTMLString:true,
620
624
  });
621
625
  }
622
626
  },
@@ -20,7 +20,7 @@
20
20
  :is="col.is" :vmodel="col" :parameterAction="model.parameterAction"
21
21
  @fieldClick="searchHandler(col)" @change="changeHandler(col)"
22
22
  @SaveSearchWhere="SaveSearchWhere" @SearchWhereManage="SearchWhereManage"
23
- @clickSearchWhere="clickSearchWhere"></component>
23
+ :actionRouters="model.actionRouters" @clickSearchWhere="clickSearchWhere"></component>
24
24
  <br v-else-if="col.controlType === Enum.ControlType.LineFeed" />
25
25
  <component v-else :from="from" class="list-field" v-bind="col.listBind" :is="col.is"
26
26
  :vmodel="col" :parameterAction="model.parameterAction" @search="searchHandler(col)"
@@ -54,9 +54,11 @@
54
54
  </template>
55
55
  <script setup lang="ts">
56
56
  import { ref, nextTick, onDeactivated } from 'vue'
57
+
57
58
  import SearchScreen from '../../loader/src/SearchScreen'
58
59
  import Enum from '../../utils/Enum'
59
60
  import common from '../../utils/common';
61
+ import { RouterClickHandler } from '../../utils/mixins';
60
62
  const emit = defineEmits(['loaded', 'failLoad', 'showTitle', 'search', 'resetSearch', 'saveShortcut'])
61
63
  const props = defineProps({
62
64
  api: String,
@@ -206,14 +208,31 @@ function validExcute() {
206
208
  }
207
209
  return rtnBool;
208
210
  }
209
- function SaveSearchWhere() {
210
-
211
+ function SaveSearchWhere(field) {
212
+ if (model.value.searchData.fields.length == 0) {
213
+ common.message("没有选择任何搜索条件,无需保存!")
214
+ return;
215
+ }
216
+ var submitData = {};
217
+ submitData["jsonData"] = JSON.stringify(model.value.searchData.fields);
218
+ RouterClickHandler(field, submitData, null, model.value, 'form');
211
219
  }
212
- function clickSearchWhere() {
213
-
220
+ function clickSearchWhere(col) {
221
+ if (typeof col.scripts !== 'undefined') {
222
+ model.value.reset();
223
+ model.value.scripts.formData = model.value.formData;
224
+ model.value.scripts.formData.form = model.value;
225
+ model.value.scripts.formData.excuteData = model.value.screen;
226
+ model.value.scripts.formData.fieldsDic = model.value.screenDic;
227
+ common.excute.call(model.value.scripts, col.scripts);
228
+ emit('search', model.value.scripts.formData.form);
229
+ }
214
230
  }
215
- function SearchWhereManage() {
216
-
231
+ function SearchWhereManage(v) {
232
+ let field = model.value.actionRouters.find((b) => {
233
+ return b.key === v.routerKey;
234
+ });
235
+ RouterClickHandler(field, {}, null, model.value, 'form');
217
236
  }
218
237
  function saveShortcut() {
219
238
  emit('saveShortcut', model.value);
@@ -18,7 +18,7 @@ const Button = function (source) {
18
18
  // }
19
19
  return source.borderColor
20
20
  },
21
- //允许的文件类型(针对上传控件)
21
+ //允许的文件类型(针对上传控件)
22
22
  get fileAccept1() {
23
23
  return source.fileAccept1 || '';
24
24
  },
@@ -37,7 +37,10 @@ const Button = function (source) {
37
37
  }
38
38
  return source.action
39
39
  },
40
- set action(v) {
40
+ get routerKey() {
41
+ return source.routerKey;
42
+ },
43
+ set action(v) {
41
44
  source.action = v;
42
45
  },
43
46
  get isSearchRouterKey() {
@@ -9,19 +9,19 @@ const DatePicker = function (source) {
9
9
  if (source.controlType == Enum.ControlType.DateTime || source.controlType == Enum.ControlType.DateTimeRange || this.flagtime) {
10
10
  return 'yyyy-MM-dd HH:mm:ss'
11
11
  }
12
- else if(source.controlType == Enum.ControlType.DateYearMonth
13
- || source.controlType == Enum.ControlType.MonthRange){
14
- return 'yyyy-MM'
12
+ else if (source.controlType == Enum.ControlType.DateYearMonth
13
+ || source.controlType == Enum.ControlType.MonthRange) {
14
+ return 'yyyy-MM'
15
15
  }
16
16
  return 'yyyy-MM-dd'
17
17
  },
18
18
  //APP格式
19
19
  get valueFormatAPP() {
20
- if(source.controlType == Enum.ControlType.DateYearMonth
21
- || source.controlType == Enum.ControlType.MonthRange){
22
- return ['year', 'month']
23
- }
24
- return ['year', 'month', 'day']
20
+ if (source.controlType == Enum.ControlType.DateYearMonth
21
+ || source.controlType == Enum.ControlType.MonthRange) {
22
+ return ['year', 'month']
23
+ }
24
+ return ['year', 'month', 'day']
25
25
  },
26
26
  //是否时间
27
27
  get flagtime() {
@@ -30,33 +30,67 @@ const DatePicker = function (source) {
30
30
  }
31
31
  return false
32
32
  },
33
+ get flagDateTime() {
34
+ if (source.controlType == Enum.ControlType.DateTime || source.controlType == Enum.ControlType.DateTimeRange) {
35
+ return true
36
+ }
37
+ return false
38
+ },
39
+ get format() {
40
+ let dateformat = 'YYYY-MM-DD';
41
+
42
+ if (this.flagtime) {
43
+ dateformat = 'HH:mm';
44
+ if (source.paramName1 && source.paramName1.length >= 2) {
45
+ dateformat = source.paramName1;
46
+ }
47
+ }
48
+
49
+ else if (source.paramName1 && source.paramName1.length >= 10) {
50
+ dateformat = source.paramName1;
51
+ }
52
+ else if (source.controlType == Enum.ControlType.DateTime || source.controlType == Enum.ControlType.DateTimeRange) {
53
+ dateformat = 'YYYY-MM-DD HH:mm';
54
+ }
55
+ else if (source.controlType == Enum.ControlType.DateYearMonth) {
56
+ dateformat = 'YYYY-MM';
57
+ }
58
+ return dateformat
59
+ },
60
+ get minuteStep() {
61
+ let step = 1
62
+ if (source.paramName2 && !isNaN(source.paramName2) && source.paramName2 > 0 && source.paramName2 < 60) {
63
+ step = parseInt(source.paramName2)
64
+ }
65
+ return step
66
+ },
33
67
  //是否区间
34
68
  get flagrange() {
35
- if (source.controlType == Enum.ControlType.DateRange
36
- || source.controlType == Enum.ControlType.DateTimeRange
37
- || source.controlType == Enum.ControlType.MonthRange
38
- || source.controlType == Enum.ControlType.TimeRange) {
69
+ if (source.controlType == Enum.ControlType.DateRange
70
+ || source.controlType == Enum.ControlType.DateTimeRange
71
+ || source.controlType == Enum.ControlType.MonthRange
72
+ || source.controlType == Enum.ControlType.TimeRange) {
39
73
  return true
40
74
  }
41
75
  return false
42
76
  },
43
77
  //控件类型
44
78
  get dateType() {
45
- if (source.controlType == Enum.ControlType.DateTime
46
- || source.controlType == Enum.ControlType.DateTimeRange) {
79
+ if (source.controlType == Enum.ControlType.DateTime
80
+ || source.controlType == Enum.ControlType.DateTimeRange) {
47
81
  return 'datetime'
48
82
  }
49
83
  else if (this.flagtime) {
50
84
  return 'time'
51
85
  }
52
- else if (source.controlType == Enum.ControlType.DateYearMonth
53
- || source.controlType == Enum.ControlType.MonthRange) {
86
+ else if (source.controlType == Enum.ControlType.DateYearMonth
87
+ || source.controlType == Enum.ControlType.MonthRange) {
54
88
  return 'month'
55
89
  }
56
90
  return 'date'
57
91
  },
58
92
  get code1() {
59
- if (this.flagtime&&!common.flagApp()) {
93
+ if (this.flagtime && !common.flagApp()) {
60
94
  if (source.code1 && Object.prototype.toString.call(source.code1) === "[object String]") {
61
95
  if (source.code1.length <= 8) {
62
96
  return common.formatDate(new Date(), 'yyyy-MM-dd') + ' ' + source.code1;
@@ -66,15 +100,15 @@ const DatePicker = function (source) {
66
100
  return source.code1
67
101
  },
68
102
  set code1(v) {
69
- if(common.flagApp()||Object.prototype.toString.call(v) === "[object String]"){
103
+ if (common.flagApp() || Object.prototype.toString.call(v) === "[object String]") {
70
104
  source.code1 = v
71
105
  }
72
- else{
106
+ else {
73
107
  source.code1 = common.formatDate(v, rtn.valueFormat)
74
108
  }
75
109
  },
76
110
  get code2() {
77
- if (this.flagtime&&!common.flagApp()) {
111
+ if (this.flagtime && !common.flagApp()) {
78
112
  if (source.code2 && Object.prototype.toString.call(source.code2) === "[object String]") {
79
113
  if (source.code2.length <= 8) {
80
114
  return common.formatDate(new Date(), 'yyyy-MM-dd') + ' ' + source.code2;
@@ -84,10 +118,10 @@ const DatePicker = function (source) {
84
118
  return source.code2
85
119
  },
86
120
  set code2(v) {
87
- if(common.flagApp()||Object.prototype.toString.call(v) === "[object String]"){
121
+ if (common.flagApp() || Object.prototype.toString.call(v) === "[object String]") {
88
122
  source.code2 = v
89
123
  }
90
- else{
124
+ else {
91
125
  source.code2 = common.formatDate(v, rtn.valueFormat)
92
126
  }
93
127
  },