centaline-data-driven-v3 0.1.11 → 0.1.13

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.11",
3
+ "version": "0.1.13",
4
4
  "private": false,
5
5
  "description": "centaline-data-driven-v3",
6
6
  "main": "dist/centaline-data-driven-v3.umd.js",
@@ -9,7 +9,7 @@
9
9
  </template>
10
10
  </van-field>
11
11
  <van-field clearable :type="model.inputType" :rows="model.rows" v-bind="model.attrs" v-model="model.code1"
12
- :readonly="model.readonly" :disabled="model.locked" :maxlength="model.maxValue1"
12
+ :readonly="model.readonly" :disabled="model.locked" :maxlength="model.controlType !== Enum.ControlType.NumericTextBox ? model.maxValue1 : ''"
13
13
  :show-word-limit="model.showWordLimit" :label-align="model.inputType == 'textarea' ? 'top' : 'left'"
14
14
  @input="input()" @blur="change()" class="ct-text" autocomplete="off">
15
15
  <template #label v-if="model.showLabel && model.controlLabel">
@@ -44,6 +44,18 @@ const props = defineProps({
44
44
  source: Object,
45
45
  })
46
46
  const model = initData(props, TextBox)
47
+ model.value.selfValidExcute = () => {
48
+ model.value.valid = true;
49
+ if (model.value.controlType === Enum.ControlType.NumericTextBox) {
50
+ if (model.value.minValue1 && model.value.code1 < parseFloat(model.value.minValue1)) {
51
+ model.value.validMessage = "最小值为" + model.value.minValue1 + "";
52
+ model.value.valid = false;
53
+ return false;
54
+ }
55
+
56
+ }
57
+ return model.value.valid;
58
+ }
47
59
  //弹出选择列表
48
60
  function popupSearchListHandle() {
49
61
  let isSingle = model.value.moreActionRouter.isSingle
@@ -1,11 +1,12 @@
1
1
  <template>
2
2
  <ct-field :vmodel="model">
3
3
  <template #Control>
4
- <el-select-v2 ref="refselect" :key="model.itemKey" v-model="model.value" :options="model.options" :no-data-text="nodatatext"
5
- :props="model.optionAttrs" v-bind="model.attrs" :disabled="model.locked" clearable @change="change"
6
- :placeholder="model.placeholder" @visible-change="visibleChange" @clear="clear"
7
- :filterable="model.filterable" :multiple="model.multiple" class="fieldControl" :height="300"
8
- @click="clickHandler" :class="[model.moreActionRouter ? 'selectmore' : '', open ? 'open' : '']"
4
+ <el-select-v2 ref="refselect" :key="model.itemKey" v-model="model.value" :options="model.options"
5
+ :no-data-text="nodatatext" :props="model.optionAttrs" v-bind="model.attrs" :disabled="model.locked"
6
+ clearable @change="change" :placeholder="model.placeholder" @visible-change="visibleChange"
7
+ @clear="clear" :filterable="model.filterable" :multiple="model.multiple" class="fieldControl"
8
+ :height="300" @click="clickHandler"
9
+ :class="[model.moreActionRouter ? 'selectmore' : '', open ? 'open' : '']"
9
10
  :filter-method="debouncedRemoteMethod" @compositionstart="handleCompositionStart"
10
11
  @compositionend="handleCompositionEnd">
11
12
  <template #default="{ item }">
@@ -27,9 +28,8 @@
27
28
  </el-select-v2>
28
29
  <template v-if="model.flagaFterText">
29
30
  <el-input type="text" v-model="model.code2" v-bind="model.attrs" @change="changeHandler(model, emit)"
30
- :disabled="model.locked" :rows="model.rows" :readonly="model.readonly"
31
- :maxlength="model.maxValue1" :show-word-limit="model.showWordLimit" clearable
32
- class="fieldControl ml10">
31
+ :disabled="model.locked" :rows="model.rows" :readonly="model.readonly" :maxlength="model.maxValue1"
32
+ :show-word-limit="model.showWordLimit" clearable class="fieldControl ml10">
33
33
  </el-input>
34
34
  </template>
35
35
  </template>
@@ -61,17 +61,17 @@ const refselect = ref()
61
61
  const open = ref(false)
62
62
  const isComposing = ref(false);
63
63
  const nodatatext = ref(' ')
64
- model.value.itemKey=Math.random();
64
+ model.value.itemKey = Math.random();
65
65
  let cancelTokenSource = null; // 用于存储取消令牌
66
66
 
67
- const qrtimer=ref(null)
68
- onBeforeUnmount(()=>{
69
- model.value=null
70
- refselect.value=null
71
- if (qrtimer.value) {
72
- clearTimeout(qrtimer.value);
73
- qrtimer.value = null;
74
- }
67
+ const qrtimer = ref(null)
68
+ onBeforeUnmount(() => {
69
+ model.value = null
70
+ refselect.value = null
71
+ if (qrtimer.value) {
72
+ clearTimeout(qrtimer.value);
73
+ qrtimer.value = null;
74
+ }
75
75
  })
76
76
 
77
77
  //下拉框出现/隐藏时触发
@@ -97,55 +97,55 @@ function visibleChange(visible) {
97
97
  //获取数据列表
98
98
  function getOptions(key) {
99
99
  if (cancelTokenSource) {
100
- // 取消上一次未完成的请求
101
- cancelTokenSource.cancel('取消上一次请求');
100
+ // 取消上一次未完成的请求
101
+ cancelTokenSource.cancel('取消上一次请求');
102
102
  }
103
103
 
104
104
  // 创建新的取消令牌
105
105
  cancelTokenSource = Axios.CancelToken.source();
106
- if (!isComposing.value &&!model.value.moreActionRouter) {
107
- model.value.getOptions(props.parameterAction, key,cancelTokenSource, function (data) {
108
- if(data){
109
- data.forEach((v) => {
110
- let item = model.value.globalOptions.find((v1) => {
111
- return v1.code === v.code && v1.locked;
106
+ if (!isComposing.value && !model.value.moreActionRouter) {
107
+ model.value.getOptions(props.parameterAction, key, cancelTokenSource, function (data) {
108
+ if (data) {
109
+ data.forEach((v) => {
110
+ let item = model.value.globalOptions.find((v1) => {
111
+ return v1.code === v.code && v1.locked;
112
+ });
113
+ if (item) {
114
+ v.locked = true
115
+ }
116
+ v.label = v.displayName || v.name
117
+ v.value = v.code
118
+ v.disabled = v.locked
119
+ if (v.options) {
120
+ let data1 = v.options;
121
+ data1.forEach((v2) => {
122
+ let item1 = model.value.globalOptions.find((v3) => {
123
+ return v3.code === v2.code && v3.locked;
124
+ });
125
+ if (item1) {
126
+ v2.locked = true
127
+ }
128
+ v2.label = v2.displayName || v2.name
129
+ v2.value = v2.code
130
+ v2.disabled = v2.locked
131
+ });
132
+ }
112
133
  });
113
- if (item) {
114
- v.locked = true
134
+ if (JSON.stringify(model.value.options) != JSON.stringify(data)) {
135
+ model.value.options = data;
115
136
  }
116
- v.label = v.displayName || v.name
117
- v.value = v.code
118
- v.disabled = v.locked
119
- if (v.options) {
120
- let data1 = v.options;
121
- data1.forEach((v2) => {
122
- let item1 = model.value.globalOptions.find((v3) => {
123
- return v3.code === v2.code && v3.locked;
124
- });
125
- if (item1) {
126
- v2.locked = true
127
- }
128
- v2.label = v2.displayName || v2.name
129
- v2.value = v2.code
130
- v2.disabled = v2.locked
131
- });
137
+
138
+ if (data.length == 0) {
139
+ nodatatext.value = common.LocalizedString('无数据', '無數據');
132
140
  }
133
- });
134
- if (JSON.stringify(model.value.options) != JSON.stringify(data)) {
135
- model.value.options = data;
136
- }
137
141
 
138
- if(data.length==0){
139
- nodatatext.value = common.LocalizedString('无数据', '無數據');
142
+ nextTick(function () {
143
+ setminWidth()
144
+ });
145
+ }
146
+ else {
147
+ nodatatext.value = common.LocalizedString('无数据', '無數據');
140
148
  }
141
-
142
- nextTick(function () {
143
- setminWidth()
144
- });
145
- }
146
- else{
147
- nodatatext.value = common.LocalizedString('无数据', '無數據');
148
- }
149
149
  })
150
150
  }
151
151
 
@@ -155,7 +155,7 @@ function debounce(func, delay) {
155
155
  return function () {
156
156
  const context = this;
157
157
  const args = arguments;
158
- if(qrtimer.value)clearTimeout(qrtimer.value);
158
+ if (qrtimer.value) clearTimeout(qrtimer.value);
159
159
  qrtimer.value = setTimeout(() => {
160
160
  func.apply(context, args);
161
161
  }, delay);
@@ -171,6 +171,9 @@ function change(val) {
171
171
  model.value.value = val
172
172
  model.value.itemKey = Math.random()
173
173
  }
174
+ else {
175
+ val = ''
176
+ }
174
177
  }
175
178
  model.value.setcode(val)
176
179
  changeHandler(model.value, emit)
@@ -227,13 +230,13 @@ function setminWidth() {
227
230
  let maxLength = -1;
228
231
  let text;
229
232
  for (let item of model.value.options) {
230
- if (item.name) {
231
- if (item.name.length > maxLength) {
232
- maxLength = item.name.length;
233
- text = item.name;
233
+ if (item.name) {
234
+ if (item.name.length > maxLength) {
235
+ maxLength = item.name.length;
236
+ text = item.name;
237
+ }
234
238
  }
235
- }
236
- }
239
+ }
237
240
 
238
241
  let span = document.createElement('span');
239
242
  span.innerText = text;
@@ -241,12 +244,12 @@ function setminWidth() {
241
244
  span.style.width = 'auto';
242
245
  span.style.fontSize = '17px';
243
246
  document.body.appendChild(span);
244
-
247
+
245
248
  if ((span.getBoundingClientRect().width + 40) <= refselect.value.selectRef.offsetWidth) {
246
- refselect.value.popperSize = refselect.value.selectRef.offsetWidth;
249
+ refselect.value.popperSize = refselect.value.selectRef.offsetWidth;
247
250
  }
248
- else{
249
- refselect.value.popperSize = span.getBoundingClientRect().width + 40;
251
+ else {
252
+ refselect.value.popperSize = span.getBoundingClientRect().width + 40;
250
253
  }
251
254
 
252
255
  document.body.removeChild(span);
@@ -1,11 +1,13 @@
1
1
  <template>
2
2
  <ct-field :vmodel="model">
3
3
  <template #Control v-if="model.code1">
4
- <template v-if="model.controlType==Enum.ControlType.HtmlLabel">
5
- <span class="ct-html" :class="{ 'cursor-pointer': model.onChanged }" @click="clickHandle" v-html="model.value"></span>
4
+ <template v-if="model.controlType == Enum.ControlType.HtmlLabel">
5
+ <span class="ct-html" :class="{ 'cursor-pointer': model.onChanged }" @click="clickHandle"
6
+ v-html="HtmlReplace(model.value)"></span>
6
7
  </template>
7
8
  <template v-else-if="model.flagJson">
8
- <el-tag v-for="item in model.value" :key="item" type="info" :disable-transitions="true" style="margin: 2px 6px 2px 0px;">{{ item
9
+ <el-tag v-for="item in model.value" :key="item" type="info" :disable-transitions="true"
10
+ style="margin: 2px 6px 2px 0px;">{{ item
9
11
  }}</el-tag>
10
12
  </template>
11
13
  <template v-else>
@@ -16,7 +18,8 @@
16
18
  <div :style="{ 'width': (model.value.length > 66 ? '400px' : 'auto') }" v-html="model.value">
17
19
  </div>
18
20
  </template>
19
- <span class="ct-lable" :class="{ 'cursor-pointer': model.onChanged }" @mouseover="onMouseOver($event)" v-html="model.value" @click="clickHandle"></span>
21
+ <span class="ct-lable" :class="{ 'cursor-pointer': model.onChanged }"
22
+ @mouseover="onMouseOver($event)" v-html="model.value" @click="clickHandle"></span>
20
23
  </el-tooltip>
21
24
  <span class="unitName">{{ model.unitName1 }}</span>
22
25
  </template>
@@ -36,7 +39,7 @@ import { ref, nextTick } from 'vue'
36
39
  import { initData } from '../../utils/mixins';
37
40
  import Enum from '../../utils/Enum'
38
41
  import Label from '../../loader/src/Label';
39
- const emit = defineEmits(['popupSearchList','change'])
42
+ const emit = defineEmits(['popupSearchList', 'change'])
40
43
  const props = defineProps({
41
44
  parameterAction: String,
42
45
  vmodel: Object,
@@ -51,7 +54,7 @@ function onMouseOver(event) {
51
54
  let ev = event.target;
52
55
  nextTick(function () {
53
56
  // 判断是否禁用tooltip功能
54
- if(ev.clientWidth>0){
57
+ if (ev.clientWidth > 0) {
55
58
  isShowTooltip.value = refComputLabel.value.clientWidth <= ev.clientWidth;
56
59
  }
57
60
  isShowComput.value = false
@@ -61,12 +64,15 @@ function onMouseOver(event) {
61
64
  }
62
65
  //弹出选择列表
63
66
  function popupSearchListHandle() {
64
- let isSingle=model.value.moreActionRouter.isSingle
67
+ let isSingle = model.value.moreActionRouter.isSingle
65
68
  emit('popupSearchList', isSingle, model, model.value.moreActionRouter);
66
69
  }
67
- function clickHandle(){
70
+ function clickHandle() {
68
71
  emit('change', model);
69
72
  }
73
+ function HtmlReplace(v) {
74
+ return v.replace(/ /g, "&nbsp;&nbsp;")
75
+ }
70
76
  defineExpose({
71
77
  model
72
78
  })
@@ -83,17 +89,20 @@ defineExpose({
83
89
  -webkit-line-clamp: 1;
84
90
  word-break: break-all;
85
91
  }
86
- .ct-html{
92
+
93
+ .ct-html {
87
94
  line-height: 26px;
88
95
  font-size: 12px;
89
96
  color: #3D5ECC;
90
97
  }
98
+
91
99
  .el-tag.el-tag--info {
92
100
  --el-tag-text-color: var(--el-color-info);
93
101
  color: var(--el-color-info);
94
102
  }
95
103
 
96
104
  .cursor-pointer {
97
- cursor: pointer; /* 鼠标悬停时显示为“小手”形状 */
105
+ cursor: pointer;
106
+ /* 鼠标悬停时显示为“小手”形状 */
98
107
  }
99
108
  </style>
@@ -45,8 +45,8 @@ defineExpose({
45
45
  </script>
46
46
  <style scoped>
47
47
  .el-date-editor {
48
- height: 24px;
49
- line-height: 24px;
48
+ height: 26px;
49
+ line-height: 26px;
50
50
  }
51
51
 
52
52
  .el-range-input {
@@ -176,6 +176,7 @@ function searchHandler(field) {
176
176
  model.value.reset();
177
177
  model.value.screen.forEach((v) => {
178
178
  SearchScreen.hiddenHandle(v, model.value);
179
+ SearchScreen.displayHandle(v, model.value);
179
180
  })
180
181
  if (validExcute()) {
181
182
  emit('resetSearch', model.value);
@@ -1,20 +1,22 @@
1
1
  <template>
2
2
  <ct-field :vmodel="model">
3
3
  <template #Control>
4
- <div v-if="model.controlType === Enum.ControlType.MultiLineText" style="width: 100%;">
5
- <el-input :type="model.inputType" v-model="model.code1" v-bind="model.attrs" @input="input()" @change="change()"
6
- :disabled="model.locked" :rows="model.rows" :readonly="model.readonly"
7
- :show-password="model.inputType == 'password'" autocomplete="on" :maxlength="model.maxValue1"
8
- :show-word-limit="model.showWordLimit" clearable @keyup.enter.native="search()" class="fieldControl">
9
- <template #suffix>
10
- <span v-if="model.unitName1">{{ model.unitName1 }}</span>
11
- </template>
12
- </el-input>
13
- <span v-if="model.sufLabel1" class="sufLabel" v-html="model.sufLabel1"></span>
14
- </div>
15
- <el-input v-else :type="model.inputType" v-model="model.code1" v-bind="model.attrs" @input="input()" @change="change()"
16
- :disabled="model.locked" :rows="model.rows" :readonly="model.readonly"
17
- :show-password="model.inputType == 'password'" autocomplete="on" :maxlength="model.maxValue1"
4
+ <div v-if="model.controlType === Enum.ControlType.MultiLineText" style="width: 100%;">
5
+ <el-input :type="model.inputType" v-model="model.code1" v-bind="model.attrs" @input="input()"
6
+ @change="change()" :disabled="model.locked" :rows="model.rows" :readonly="model.readonly"
7
+ :show-password="model.inputType == 'password'" autocomplete="on" :maxlength="model.maxValue1"
8
+ :show-word-limit="model.showWordLimit" clearable @keyup.enter.native="search()"
9
+ class="fieldControl">
10
+ <template #suffix>
11
+ <span v-if="model.unitName1">{{ model.unitName1 }}</span>
12
+ </template>
13
+ </el-input>
14
+ <span v-if="model.sufLabel1" class="sufLabel" v-html="model.sufLabel1"></span>
15
+ </div>
16
+ <el-input v-else :type="model.inputType" v-model="model.code1" v-bind="model.attrs" @input="input()"
17
+ @change="change()" :disabled="model.locked" :rows="model.rows" :readonly="model.readonly"
18
+ :show-password="model.inputType == 'password'" autocomplete="on"
19
+ :maxlength="model.controlType !== Enum.ControlType.NumericTextBox ? model.maxValue1 : ''"
18
20
  :show-word-limit="model.showWordLimit" clearable @keyup.enter.native="search()" class="fieldControl">
19
21
  <template #suffix>
20
22
  <span v-if="model.unitName1">{{ model.unitName1 }}</span>
@@ -35,7 +37,7 @@
35
37
  import { initData, changeHandler } from '../../utils/mixins';
36
38
  import TextBox from '../../loader/src/TextBox';
37
39
  import Enum from '../../utils/Enum'
38
- const emit = defineEmits(['input', 'change', 'click','search','popupSearchList'])
40
+ const emit = defineEmits(['input', 'change', 'click', 'search', 'popupSearchList'])
39
41
  const props = defineProps({
40
42
  parameterAction: String,
41
43
  vmodel: Object,
@@ -46,25 +48,37 @@ const props = defineProps({
46
48
  },
47
49
  })
48
50
  const model = initData(props, TextBox)
51
+ model.value.selfValidExcute = () => {
52
+ model.value.valid = true;
53
+ if (model.value.controlType === Enum.ControlType.NumericTextBox) {
54
+ if (model.value.minValue1 && model.value.code1 < parseFloat(model.value.minValue1)) {
55
+ model.value.validMessage = "最小值为" + model.value.minValue1 + "";
56
+ model.value.valid = false;
57
+ return false;
58
+ }
59
+
60
+ }
61
+ return model.value.valid;
62
+ }
49
63
  function search() {
50
- if (model.value.autoSearch||props.from=='tree') {
64
+ if (model.value.autoSearch || props.from == 'tree') {
51
65
  emit('search');
52
66
  }
53
67
  }
54
68
  function input() {
55
- if(model.value.controlType===Enum.ControlType.MultiLineText || model.value.controlType===Enum.ControlType.TextBox){
56
- }
57
- else{
58
- change();
59
- }
60
- }
69
+ if (model.value.controlType === Enum.ControlType.MultiLineText || model.value.controlType === Enum.ControlType.TextBox) {
70
+ }
71
+ else {
72
+ change();
73
+ }
74
+ }
61
75
  function change() {
62
- changeHandler(model.value, emit);
63
- if (props.from == 'tree') { emit('search'); }
76
+ changeHandler(model.value, emit);
77
+ if (props.from == 'tree') { emit('search'); }
64
78
  }
65
79
  //弹出选择列表
66
80
  function popupSearchListHandle() {
67
- let isSingle=model.value.moreActionRouter.isSingle
81
+ let isSingle = model.value.moreActionRouter.isSingle
68
82
  emit('popupSearchList', isSingle, model, model.value.moreActionRouter);
69
83
  }
70
84
  defineExpose({
@@ -93,6 +93,20 @@ const Base = function (source, moreActionRouter) {
93
93
  set hiddenRelationFieldValue(v) {
94
94
  source.hiddenRelationFieldValue = v;
95
95
  },
96
+ //决定其显示相关的字段
97
+ get displayRelationField() {
98
+ return source.displayRelationField;
99
+ },
100
+ set displayRelationField(v) {
101
+ source.displayRelationField = v;
102
+ },
103
+ //决定其显示相关字段的值
104
+ get displayRelationFieldValue() {
105
+ return source.displayRelationFieldValue;
106
+ },
107
+ set displayRelationFieldValue(v) {
108
+ source.displayRelationFieldValue = v;
109
+ },
96
110
  //决定其必填相关的字段
97
111
  get requiredRelationField() {
98
112
  return source.requiredRelationField;
@@ -801,11 +815,21 @@ const Base = function (source, moreActionRouter) {
801
815
  if (typeof source.show !== "undefined") {
802
816
  return source.show;
803
817
  }
818
+ if (source.hidden) {
819
+ return !source.hidden;
820
+ }
804
821
  return true;
805
822
  },
806
823
  set show(v) {
807
824
  source.show = v;
808
825
  },
826
+ //是否显示
827
+ get hidden() {
828
+ return source.hidden;
829
+ },
830
+ set hidden(v) {
831
+ source.hidden = v;
832
+ },
809
833
  //重置
810
834
  reset() {
811
835
  if (this.controlType === Enum.ControlType.Hidden
@@ -829,10 +853,10 @@ const Base = function (source, moreActionRouter) {
829
853
  }
830
854
  else {
831
855
  this.value = this.defaultCode1
832
- if(this.searchName){
833
- this.searchName=''
834
- this.searchValue=''
835
- this.searchValue1=''
856
+ if (this.searchName) {
857
+ this.searchName = ''
858
+ this.searchValue = ''
859
+ this.searchValue1 = ''
836
860
  }
837
861
  }
838
862
 
@@ -853,8 +877,8 @@ const Base = function (source, moreActionRouter) {
853
877
  this.code1 = this.defaultCode1 || '';
854
878
  this.code2 = this.defaultCode2 || '';
855
879
  this.name1 = this.defaultName1 || '';
856
- if(this.controlType === Enum.ControlType.SearchListBox && this.defaultCode1 && this.defaultName1){
857
- this.options=[{ value: this.code1, label: this.name1 }]
880
+ if (this.controlType === Enum.ControlType.SearchListBox && this.defaultCode1 && this.defaultName1) {
881
+ this.options = [{ value: this.code1, label: this.name1 }]
858
882
  }
859
883
  }
860
884
  else {
@@ -971,7 +995,7 @@ const Base = function (source, moreActionRouter) {
971
995
  getFormParentFieldPara() {
972
996
  if (rtn.form && typeof rtn.parentFields !== 'undefined' && rtn.parentFields.length > 0) {
973
997
  if (typeof rtn.form.getRefFieldPara === 'function') {
974
- return rtn.form.getParentFieldPara(rtn.parentFields,rtn.form);
998
+ return rtn.form.getParentFieldPara(rtn.parentFields, rtn.form);
975
999
  }
976
1000
  }
977
1001
  return null;