centaline-data-driven 1.2.25 → 1.2.28

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.
@@ -113,7 +113,7 @@
113
113
  </ct-tablecurrency>
114
114
 
115
115
  <!--正常的列-->
116
- <div v-else-if="typeof column.template === 'undefined'" :class="column.autoRowHeight ? 'lineFeedCell':'cell'">
116
+ <div v-else-if="typeof column.template === 'undefined'" :class="column.autoRowHeight ? 'lineFeedCell':'cell'" :style="column.style ? column.style:''">
117
117
  {{row[column.id]}}
118
118
  </div>
119
119
 
@@ -0,0 +1,14 @@
1
+ import dynamicSosTt from './src/dynamicSosTt';
2
+ import api from '../api/index'
3
+
4
+ dynamicSosTt.install = function (Vue) {
5
+ Vue.component(dynamicSosTt.name, dynamicSosTt);
6
+
7
+ Vue.use(api);
8
+ }
9
+
10
+ if (typeof window !== 'undefined' && window.Vue) {
11
+ window.Vue.use(dynamicSosTt);
12
+ }
13
+
14
+ export default dynamicSosTt;
@@ -0,0 +1,283 @@
1
+ <template>
2
+ <div class="field-top">
3
+ <div style="width:100%;display:flex">
4
+ <div style="flex:1;" class="ct-so" :class="[(focus || showDrop)?'isfocus':'',model.attrs.size?'ct-so-'+model.attrs.size:''
5
+ ]" @mouseover="mouseOverHandle" @mouseout="mouseOutHandle">
6
+ <div :class="[model.showLabel?'el-input-group el-input-group--prepend':'',!valid?'inputError':'']">
7
+ <div v-if="model.showLabel && model.label" class="el-input-group__prepend" :class="[model.labelClass]">
8
+ {{model.label}}
9
+ </div>
10
+ <el-popover ref="pop" placement="bottom-start" v-model="showDrop" :class="[model.showLabel?'showLabel':'']" :trigger="(!model.paramName || model.lock)? 'manual' : 'click'">
11
+ <div>
12
+ <div>
13
+ <el-input ref="searchInput" :size="model.attrs.size" suffix-icon="el-icon-search" v-model="searchText" @input="searchInputHandle"></el-input>
14
+ </div>
15
+ <ctSelectOptionVertical :model="model" @click="selectOption($event)"></ctSelectOptionVertical>
16
+ </div>
17
+ <input slot="reference" v-bind="model.attrs" readonly="readonly" v-model="model.text" :placeholder="soPlaceholder"
18
+ ref="ct-input" :style="{height:inputHeight + 'px','line-height':inputLineHeight + 'px'}"
19
+ @focus="focusHandle" @blur="blurHandle" @click="clickHandle" @input="inputHandler($event)" @change="changeHandler($event)"
20
+ :disabled="model.lock" :class="model.lock ? 'ct-is-disabled' : 'ct-input_inner'" />
21
+ </el-popover>
22
+ <span v-if="!model.lock" class="el-input__suffix" @click="clickHandle" :class="[model.attrs.size?'el-input--'+model.attrs.size:'']">
23
+ <span v-if="showClear === false" class="el-input__suffix-inner">
24
+ <i class="el-select__caret el-input__icon el-icon-arrow-up" :class="{'is-reverse':showDrop}"></i>
25
+ </span>
26
+ <span v-if="showClear === true" class="el-input__suffix-inner ct-close">
27
+ <i class="el-select__caret el-input__icon el-icon-circle-close is-show-close" @click="clearClickHandle($event)"></i>
28
+ </span>
29
+ </span>
30
+ </div>
31
+ </div>
32
+ <div style="width:40%; margin-left:10px;">
33
+ <el-input :title="model.lock?model.value1:''" :type="model.inputType" v-model="model.value1" v-bind="model.attrs" @input="inputHandler($event);isShowClear()" @change="changeHandler($event)"
34
+ class="ct-flex-div-input max-input" :class="[model.showLabel?'showLabel':'',!valid?'inputError':'']" :disabled="model.lock" :rows="model.rows"
35
+ :readonly="model.readonly" :show-password="model.isPassword" autocomplete="on" :maxlength="model.max" :show-word-limit="model.showWordLimit"
36
+ @keyup.enter.native="search()">
37
+ </el-input>
38
+ </div>
39
+ <span v-if="model.sufLabel" class="spanMessage ct-flex-div-span">{{model.sufLabel}}</span>
40
+ <transition name="el-fade-in">
41
+ <span v-show="!valid" class="errorMessage">
42
+ {{validMessage}}
43
+ </span>
44
+ </transition>
45
+ <div v-if="!model.lock && model.popupSearchListType === 1">
46
+ <el-button v-if="!model.moreActionBtnName" size="mini" class="h26" type="primary" icon="el-icon-search" @click="popupSearchListHandle"></el-button>
47
+ <el-button v-else size="mini" type="primary" class="h26" @click="popupSearchListHandle">{{model.moreActionBtnName}}</el-button>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </template>
52
+
53
+ <script>
54
+ import dynamicElement from '../../mixins/dynamicElement'
55
+ import selectOption from '../../selectOption/src/selectOption'
56
+ import ctSelectOptionVertical from '../../selectOption/src/selectOptionVertical'
57
+ export default {
58
+ name: 'ct-sosTt',
59
+ mixins: [dynamicElement],
60
+ components: {
61
+ 'ctSelectOption': selectOption,
62
+ 'ctSelectOptionVertical': ctSelectOptionVertical
63
+ },
64
+ props: {
65
+ api: String,
66
+ vmodel: Object,
67
+ popShow: {
68
+ type: Boolean,
69
+ default: true
70
+ }
71
+ },
72
+ data() {
73
+ return {
74
+ focus: false,
75
+ showDrop: false,
76
+ inputHeight: 26,
77
+ showClear: false,
78
+ searchText: ""
79
+ }
80
+ },
81
+ created() {
82
+ if (typeof this.vmodel === 'undefined') {
83
+ this.model = this.loaderObj.SosTt(this.source);
84
+ }
85
+ else {
86
+ this.model = this.vmodel;
87
+ }
88
+ this.$watch('model.value', (n, o) => {
89
+ if (typeof this.model.child !== 'undefined') {
90
+ this.model.child.value = this.model.child.defaultValue || '';
91
+ this.model.child.text = this.model.child.defaultText || '';
92
+ }
93
+ });
94
+ this.inputHeight = this.inputLineHeight;
95
+ },
96
+ computed: {
97
+ soPlaceholder: {
98
+ get: function () {
99
+ if (this.model.value !== '') {
100
+ return '';
101
+ }
102
+ else {
103
+ return this.model.attrs.placeholder;
104
+ }
105
+ },
106
+ set: function (v) {
107
+
108
+ }
109
+ },
110
+ inputLineHeight: {
111
+ get: function () {
112
+ switch (this.model.attrs.size) {
113
+ case 'mini':
114
+ return 26;
115
+ case 'small':
116
+ return 32;
117
+ case 'medium':
118
+ return 36;
119
+ default:
120
+ return 40;
121
+ }
122
+ }
123
+ },
124
+ optionColSpan: function () {
125
+ return parseInt(24 / this.model.optionColCount);
126
+ },
127
+ optionRowCount: function () {
128
+ return parseInt(this.model.options.length % this.model.optionColCount > 0 ? (this.model.options.length / this.model.optionColCount) + 1 : this.model.options.length / this.model.optionColCount);
129
+ }
130
+ },
131
+ mounted() {
132
+ var self = this;
133
+ this.$nextTick(function () {
134
+ var dropdown = self.$refs["pop"];
135
+ self.$watch('model.options', function (newVal, oldVal) {
136
+ self.$nextTick(() => {
137
+ if (typeof dropdown.popperJS !== 'undefined' && dropdown.popperJS) {
138
+ dropdown.popperJS.destroy();
139
+ dropdown.popperJS = null;
140
+ dropdown.updatePopper();
141
+ }
142
+ self.$refs["searchInput"].$el.querySelector("input").focus();
143
+ });
144
+ }, { deep: true, immediate: true });
145
+ });
146
+ },
147
+ methods: {
148
+ getOptions: function () {
149
+ var self = this;
150
+ this.model.getOptions(this.api, self.searchText);
151
+ },
152
+ soChange: function () {
153
+ var self = this;
154
+ if (typeof this.model.child !== 'undefined') {
155
+ this.model.child.value = this.model.child.defaultValue || '';
156
+ this.model.child.text = this.model.child.defaultText || '';
157
+ }
158
+ var currentOption = this.model.options.find((value) => {
159
+ return self.model.value === value[self.model.optionAttrs.value];
160
+ });
161
+ if (currentOption) {
162
+ this.model.text =currentOption[self.model.optionAttrs.label];
163
+ }
164
+ else {
165
+ this.model.text = '';
166
+ }
167
+ this.inputHandler(self.model.value);
168
+ this.changeHandler(self.model.value);
169
+ if(this.model.autoSearch) this.$emit('click');
170
+ },
171
+ focusHandle: function () {
172
+ this.$set(this, 'focus', true);
173
+ },
174
+ blurHandle: function () {
175
+ this.$set(this, 'focus', false);
176
+ },
177
+ clickHandle: function () {
178
+ if (this.model.lock) {
179
+ return false;
180
+ }
181
+ if (this.model.paramName) {
182
+ this.$set(this, 'showDrop', !this.showDrop);
183
+ if (this.showDrop) {
184
+ this.getOptions();
185
+ }
186
+ this.focusHandle();
187
+ }
188
+ else if (this.model.popupSearchListType === 1) {
189
+ this.popupSearchListHandle();
190
+ }
191
+ else if ((this.model.popupSearchListType === 0)) {
192
+ this.$message.warning("请配置参数paramName1");
193
+ }
194
+ },
195
+ popupSearchListHandle: function () {
196
+ var self = this;
197
+
198
+ self.$emit('popupSearchList', true, self.model, self.model.moreActionRouter, (option) => {
199
+ if (option) {
200
+ self.model.value = option[self.model.optionAttrs.value];
201
+ self.model.text = option[self.model.optionAttrs.label];
202
+ self.model.options.push(option);
203
+
204
+ self.soChange();
205
+ }
206
+ });
207
+ },
208
+ getOptionText: function (value) {
209
+ var self = this;
210
+ var option = this.model.options.find((v) => { return v[self.model.optionAttrs.value] === value });
211
+ if (option) {
212
+ return option[self.model.optionAttrs.label];
213
+ } else {
214
+ return value;
215
+ }
216
+ },
217
+ getOptionSelect(value) {
218
+ if (this.model.value === value) {
219
+ return "danger";
220
+ }
221
+ else {
222
+ return "success";
223
+ }
224
+ },
225
+ selectOption(value) {
226
+ if (this.model.value === value) {
227
+ this.$set(this, 'showDrop', false);
228
+ return;
229
+ }
230
+ else {
231
+ this.model.value = value;
232
+ }
233
+ this.soChange();
234
+ this.$set(this, 'showDrop', false);
235
+ },
236
+ mouseOverHandle: function () {
237
+ if (this.model.value !== '' && this.model.clearable) {
238
+ this.$set(this, 'showClear', true);
239
+ }
240
+ },
241
+ mouseOutHandle: function () {
242
+ this.$set(this, 'showClear', false);
243
+ },
244
+ //不能共用的数据校验
245
+ selfValidExcute: function (eventName) {
246
+ if (this.required == true && this.model.value1 == "") {
247
+ this.valid = false;
248
+ return false;
249
+ }
250
+ return true;
251
+ },
252
+ clearClickHandle: function (event) {
253
+ this.model.value = '';
254
+ this.soChange();
255
+ event.stopPropagation();
256
+ },
257
+ isShowClear() {
258
+ if (this.model.value1 !== '' && this.model.clearable) {
259
+ this.$set(this, 'showClear', true);
260
+ } else {
261
+ this.$set(this, 'showClear', false);
262
+ }
263
+ },
264
+ searchInputHandle: function () {
265
+ var currentSeatch = this.searchText;
266
+ this.searchTickControl(currentSeatch);
267
+ },
268
+ searchTickControl: function (search) {
269
+ var self = this;
270
+ setTimeout(function () {
271
+ if (search === self.searchText) {
272
+ self.getOptions(self.searchText);
273
+ }
274
+ }, self.model.searchTick);
275
+ }
276
+ }
277
+ }
278
+ </script>
279
+ <style>
280
+ .h26{
281
+ height: 26px;
282
+ }
283
+ </style>