centaline-data-driven 1.6.44 → 1.6.45

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.
@@ -0,0 +1,336 @@
1
+ <template>
2
+ <div class="field-top-noimportant">
3
+ <div class="ccai ct-tags" style="width:100%;display:flex">
4
+ <div style="flex:1;display:flex;margin-right: 5px;" :class="[(focus || showDrop)?'isfocus':'',model.attrs.size?'ct-tags-'+model.attrs.size:''
5
+ ]" @mouseover="mouseOverHandle" @mouseout="mouseOutHandle">
6
+ <div style="flex:1;position: relative;" :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-select ref="refselect" :key="model.itemKey" v-model="model.value" :no-data-text="nodatatext"
11
+ :disabled="model.locked" :placeholder="soPlaceholder" :clearable="model.clearable" style="width:100%"
12
+ :filter-method="getOptions" :filterable="model.filterable" :multiple="model.multiple"
13
+ @change="tagsChange" @clear="clearClickHandle" @focus="clickHandle" @visible-change="visibleChange"
14
+ @compositionstart="handleCompositionStart" @compositionend="handleCompositionEnd">
15
+ <el-option v-for="item in model.options" :key="item.code" :label="item.name" :value="item.code">
16
+ <el-tooltip :disabled="!item.toolTip" :content="item.toolTip" placement="right">
17
+ <span v-html="item.displayName || item.name"></span>
18
+ </el-tooltip>
19
+ </el-option>
20
+ </el-select>
21
+ </div>
22
+ <span v-show="!valid" class="errorMessage">
23
+ {{validMessage}}
24
+ </span>
25
+ </div>
26
+
27
+ <div v-if="model.popupSearchListType === 1 && !model.lock">
28
+ <el-button v-if="!model.moreActionBtnName" class="h26" size="mini" type="primary" icon="el-icon-search" @click="popupSearchListHandle"></el-button>
29
+ <el-button v-else size="mini" type="primary" class="h26" @click="popupSearchListHandle">{{model.moreActionBtnName}}</el-button>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </template>
34
+
35
+ <script>
36
+ import dynamicElement from '../../mixins/dynamicElement'
37
+ export default {
38
+ name: 'ct-tagsNew',
39
+ mixins: [dynamicElement],
40
+ components: {
41
+ },
42
+ props: {
43
+ api: String,
44
+ vmodel: Object,
45
+ popShow: {
46
+ type: Boolean,
47
+ default: true
48
+ }
49
+ },
50
+ data() {
51
+ return {
52
+ focus: false,
53
+ showDrop: false,
54
+ showClear: false,
55
+ nodatatext:' ',
56
+ open:false,
57
+ isComposing: false,
58
+ }
59
+ },
60
+ created() {
61
+ if (typeof this.vmodel === 'undefined') {
62
+ this.model = this.loaderObj.TagsNew(this.source);
63
+ }
64
+ else {
65
+ this.model = this.vmodel;
66
+ }
67
+ this.model.$self=this;
68
+ this.showPrefix();
69
+ },
70
+ destroyed (){
71
+ this.model = null;
72
+ this.$el = null;
73
+ },
74
+ computed: {
75
+ soPlaceholder: {
76
+ get: function () {
77
+ if (this.model.value.length > 0) {
78
+ return '';
79
+ }
80
+ else {
81
+ return this.model.label;
82
+ }
83
+ },
84
+ set: function (v) {
85
+
86
+ }
87
+ },
88
+ },
89
+ mounted() {
90
+ },
91
+ methods: {
92
+ getOptions: function (query) {
93
+ if(!this.isComposing){
94
+ this.model.getOptions(this.api, query);
95
+ }
96
+ },
97
+ handleCompositionStart() {
98
+ this.isComposing = true;
99
+ },
100
+ handleCompositionEnd() {
101
+ this.isComposing = false;
102
+ },
103
+ visibleChange() {
104
+ if (this.model.popupSearchListType === 1){
105
+ this.$refs.refselect.popperElm.hidden = true
106
+ }
107
+ },
108
+ showPrefix(){
109
+ if(this.$refs.refselect && this.$refs.refselect.$refs.tags
110
+ && this.model.isList
111
+ && this.model.attrs.placeholder
112
+ && this.model.displayLabelAfterSelected
113
+ ){
114
+ if(this.model.value && this.model.value.length>0){
115
+ if(!this.model.isShowPrefix){
116
+ const newElement = document.createElement('span');
117
+ newElement.textContent = '楼盘名称:';
118
+ newElement.style.fontSize='small';
119
+ this.$refs.refselect.$refs.tags.prepend(newElement);
120
+ this.model.isShowPrefix=true;
121
+ }
122
+ }
123
+ else{
124
+ this.$refs.refselect.$refs.tags.firstChild.remove();
125
+ this.model.isShowPrefix=false;
126
+ }
127
+ }
128
+ },
129
+ tagsChange: function () {
130
+ this.model.setCode();
131
+ this.showPrefix();
132
+
133
+ this.inputHandler(this.model.value);
134
+ this.changeHandler(this.model.value);
135
+ if(this.model.autoSearch) this.$emit('click');
136
+ },
137
+ focusHandle: function () {
138
+ this.$set(this, 'focus', true);
139
+ },
140
+ blurHandle: function () {
141
+ this.$set(this, 'focus', false);
142
+ },
143
+ clickHandle: function () {
144
+ if (this.model.lock) {
145
+ return false;
146
+ }
147
+ if (this.model.paramName) {
148
+ this.$set(this, 'showDrop', !this.showDrop);
149
+ if (this.showDrop) {
150
+ this.getOptions();
151
+ }
152
+ this.focusHandle();
153
+ }
154
+ else if(this.model.popupSearchListType === 1) {
155
+ this.popupSearchListHandle();
156
+ }
157
+ else if ((this.model.popupSearchListType === 0)) {
158
+ this.$message({
159
+ message: "请配置参数paramName1",
160
+ type: 'warning',
161
+ showClose:true,
162
+ });
163
+ }
164
+ },
165
+ popupSearchListHandle: function () {
166
+ var self = this;
167
+ self.showDrop=false;
168
+ self.$emit('popupSearchList', false, self.model, self.model.moreActionRouter, (optionArr) => {
169
+ self.selectOptionArr(optionArr);
170
+ });
171
+ },
172
+ resize() {
173
+ },
174
+ deleteOption(value, event) {
175
+ var self = this;
176
+ this.model.value.splice(
177
+ this.model.value.findIndex(
178
+ (v) => {
179
+ return v === value;
180
+ }
181
+ )
182
+ , 1);
183
+ self.resize();
184
+ if (event) {
185
+ event.stopPropagation();
186
+ }
187
+ this.tagsChange();
188
+ this.$emit('input', this.model.value);
189
+ },
190
+ selectOption(value) {
191
+ if (this.model.value.find((v) => { return v === value })) {
192
+ if(this.model.lockedValue && this.model.lockedValue.length>0 && this.model.lockedValue.includes(value)){
193
+ }
194
+ else{
195
+ this.deleteOption(value);
196
+ }
197
+ }
198
+ else {
199
+ this.model.value.push(value);
200
+ }
201
+ this.resize();
202
+ this.tagsChange();
203
+ this.$emit('input', this.model.value);
204
+ },
205
+ selectOptionArr(optionArr) {
206
+ var self = this;
207
+ optionArr.forEach((s) => {
208
+ if (!self.model.value.find((v) => { return v === s.code })) {
209
+ let op={};
210
+ op.code=s.code;
211
+ op.name=s.name;
212
+ op.rowID='';
213
+ op.flagDeleted=false;
214
+ self.model.options.push(op);
215
+ self.model.value.push(s.code);
216
+ }
217
+ });
218
+
219
+ self.resize();
220
+ self.tagsChange();
221
+ self.$emit('input', self.model.value);
222
+ },
223
+ mouseOverHandle: function () {
224
+ if (this.model.value.length > 0 && this.model.clearable) {
225
+ this.$set(this, 'showClear', true);
226
+ }
227
+ },
228
+ mouseOutHandle: function () {
229
+ this.$set(this, 'showClear', false);
230
+ },
231
+ clearClickHandle: function (event) {
232
+ var self =this;
233
+ this.model.reset();
234
+ if(this.model.lockedValue.length>0){
235
+ this.model.lockedValue.forEach((v) => {
236
+ self.model.value.push(v);
237
+ });
238
+ }
239
+ this.resize();
240
+ this.tagsChange();
241
+ this.$emit('input', this.model.value);
242
+ },
243
+ },
244
+ watch: {
245
+ popShow: function (newV, oldV) {
246
+ this.resize();
247
+ }
248
+ }
249
+ }
250
+ </script>
251
+ <style>
252
+ .ct-tags .ct-input_inner::-webkit-input-placeholder {
253
+ color: var(--bagGray);
254
+ }
255
+
256
+ .ct-tags .ct-input_inner::-moz-placeholder {
257
+ color: var(--bagGray);
258
+ }
259
+
260
+ .ct-tags .ct-input_inner:-ms-input-placeholder {
261
+ color: var(--bagGray);
262
+ }
263
+
264
+ .ct-tags .ct-input_inner:hover {
265
+ border-color: var(--bagGray); /*border-color:var(--bagGray)*/
266
+ }
267
+
268
+ .ct-tags.isfocus .ct-input_inner:hover {
269
+ border-color: var(--centalineBlue); /*border-color:var(--bagGray)*/
270
+ }
271
+
272
+ .ct-tags.isfocus .ct-input_inner {
273
+ border-color: var(--centalineBlue);
274
+ }
275
+
276
+ .ct-tags .el-input__suffix {
277
+ right: 10px;
278
+ cursor: pointer;
279
+ display: flex;
280
+ align-items: center;
281
+ justify-content: center;
282
+ }
283
+
284
+ .ct-tags .el-select__caret {
285
+ color: #BBBBBB;
286
+ font-size: inherit;
287
+ -webkit-transition: -webkit-transform .3s;
288
+ transition: -webkit-transform .3s;
289
+ transition: transform .3s;
290
+ transition: transform .3s, -webkit-transform .3s;
291
+ transition: transform .3s,-webkit-transform .3s;
292
+ -webkit-transform: rotateZ(180deg);
293
+ transform: rotateZ(180deg);
294
+ cursor: pointer;
295
+ }
296
+
297
+ .ct-tags .is-reverse {
298
+ -webkit-transform: rotateZ(0deg);
299
+ transform: rotateZ(0deg);
300
+ }
301
+
302
+ .ct-tags .el-tag {
303
+ -webkit-box-sizing: border-box;
304
+ box-sizing: border-box;
305
+ border-color: transparent;
306
+ margin: 2px 0 2px 1px;
307
+ background-color: #f0f2f5;
308
+ }
309
+
310
+ .ct-tags.ct-tags-mini {
311
+ font-size: 12px;
312
+ }
313
+
314
+ .ct-tags.ct-tags-small {
315
+ font-size: 13px;
316
+ }
317
+
318
+ .ct-tags.ct-tags-medium {
319
+ font-size: 14px;
320
+ }
321
+
322
+ .ct-option {
323
+ margin: 5px;
324
+ cursor:pointer;
325
+ }
326
+ .ct-tags .ct-close > .el-select__caret.is-show-close:hover {
327
+ color: var(--centalineMediumGray);
328
+ }
329
+ .ct-tags-value-label {
330
+ /* padding-left: 15px; */
331
+ font-size: small;
332
+ }
333
+ .h26{
334
+ height: 26px;
335
+ }
336
+ </style>
@@ -262,6 +262,21 @@ const Form = function (source, callBack, apiParam, failCallBack, isFormList) {
262
262
  }
263
263
 
264
264
  rtn1.source[attrKey] = attrValue;
265
+ if (rtn1.source.controlType === 23) {
266
+ if (rtn1["options"].length == 0) {
267
+ rtn1["options"] = [{ code: '', name: '', value: '', label: '' }];
268
+ }
269
+ if (attrKey == 'code1') {
270
+ rtn1["value"] = attrValue;
271
+ rtn1["options"][0]["code"] = attrValue
272
+ rtn1["options"][0]["value"] = attrValue
273
+ }
274
+ if (attrKey == 'name1') {
275
+ rtn1["options"][0]["name"] = attrValue
276
+ rtn1["options"][0]["label"] = rtn1.prefix+attrValue
277
+ }
278
+ if (rtn1.itemKey) rtn1.itemKey = Math.random()
279
+ }
265
280
  this.form.hatchHandle(id, attrKey, attrValue, rtn1);
266
281
 
267
282
  //用于处理源数据改动,强制更新视图数据 todo
@@ -0,0 +1,101 @@
1
+ import base from '../../index';
2
+ import Base from './Base';
3
+ import valid from '../../../validate/index';
4
+ import Axios from 'axios';
5
+ import common from '../../../common';
6
+ import Vue from 'vue';
7
+ const SosNew = function (source, moreActionRouter) {
8
+ var rtn = {
9
+ itemKey : Math.random(),
10
+ options: [{ code: source.code1, name: source.name1, value: source.code1, label: (source.isList && source.placeholder1 && source.displayLabelAfterSelected && source.code1?source.placeholder1 + ":":'')+source.name1 }],
11
+ get filterable() {
12
+ return true;
13
+ },
14
+ get multiple() {
15
+ return false;
16
+ },
17
+ get prefix() {
18
+ if (source.isList && source.placeholder1 && source.displayLabelAfterSelected && rtn.value) {
19
+ return source.placeholder1 + ":";
20
+ }
21
+ return '';
22
+ },
23
+
24
+ get parentName() {
25
+ return source.parentField;
26
+ },
27
+ defaultText: source.defaultName1,
28
+ get labelValue() {
29
+ if (source.name1) {
30
+ return source.name1;
31
+ }
32
+ else {
33
+ return '';
34
+ }
35
+ },
36
+ optionAttrs: {
37
+ value: 'code',
38
+ label: 'name',
39
+ displayLabel:'displayName',
40
+ actionType: 'actionType',
41
+ flagDeleted: 'flagDeleted'
42
+ },
43
+ get clearable() {
44
+ if (typeof source.clear === 'undefined') {
45
+ return true;
46
+ }
47
+ if (source.clear) {
48
+ return true;
49
+ }
50
+ else {
51
+ return false;
52
+ }
53
+ },
54
+ set clearable(v) {
55
+ source.clear = v;
56
+ },
57
+ getOptions(paramsAction,key) {
58
+ var self = this;
59
+ var apiAddrs = paramsAction || this.api;
60
+ var params = {
61
+ action: apiAddrs,
62
+ para: {
63
+ paramName: self.paramName,
64
+ parentValue: rtn.getFormParentFieldPara(),
65
+ key: key,
66
+ extraData: rtn.getFormRefFieldPara()
67
+ }
68
+ };
69
+ Vue.prototype.$api.postHandler(common.globalUri(), params).then((response) => {
70
+ if (response.rtnCode === 200) {
71
+ self.options = response.content;
72
+ self.options.forEach(item => {
73
+ item.value=item.code;
74
+ item.label=self.prefix +item.name;
75
+ });
76
+ }
77
+ });
78
+ },
79
+ moreActionRouter: moreActionRouter,//更多高级查询
80
+ //弹出SearchList类型,0不弹框,1点按钮弹框,2直接点搜索框弹框
81
+ get popupSearchListType() {
82
+ if (moreActionRouter) {
83
+ return 1;
84
+ }
85
+
86
+ return 0;
87
+ },
88
+ get moreActionBtnName() {
89
+ if (moreActionRouter) {
90
+ return moreActionRouter.label;
91
+ }
92
+
93
+ return null;
94
+ },
95
+ };
96
+ rtn = base.copy(Base(source), rtn);
97
+ rtn = base.copy(rtn, valid.Init(rtn));
98
+ return rtn;
99
+ }
100
+
101
+ export default SosNew;
@@ -0,0 +1,222 @@
1
+ import base from '../../index';
2
+ import Base from './Base';
3
+ import valid from '../../../validate/index';
4
+ import common from '../../../common';
5
+ import Vue from 'vue';
6
+ import Enum from './lib/Enum';
7
+ const TagsNew = function (source, moreActionRouter) {
8
+ var rtn = {
9
+ itemKey : Math.random(),
10
+ isShowPrefix : false,
11
+ get filterable() {
12
+ return true;
13
+ },
14
+ get multiple() {
15
+ return true;
16
+ },
17
+ options: source.code1 === '' ? [] : [].concat(JSON.parse(source.code1)),
18
+ _lockedValue: null,
19
+ _value: null,
20
+ get value() {
21
+ if (this._value !== null) {
22
+ return this._value;
23
+ }
24
+ else {
25
+ this._value = [];
26
+ if(source.code1){
27
+ JSON.parse(source.code1).forEach((v) => {
28
+ if (v.flagDeleted !== 1) {
29
+ if(v.flagDeleted!=undefined && v.flagDeleted==true){
30
+ }
31
+ else{
32
+ this._value.push(v.code);
33
+ }
34
+ }
35
+ });
36
+ }
37
+ return this._value;
38
+ }
39
+ },
40
+ set value(v) {
41
+ this._value = v;
42
+ },
43
+ get labelValue() {
44
+ if (source.code1 && rtn.multiple) {
45
+ let rtnLabelValue = [];
46
+ JSON.parse(source.code1).forEach((op) => {
47
+ if (op.flagDeleted !== 1) {
48
+ if (op.flagDeleted != undefined && op.flagDeleted == true) {
49
+ }
50
+ else {
51
+ rtnLabelValue.push(op)
52
+ }
53
+ }
54
+ });
55
+ return rtnLabelValue;
56
+ }
57
+ else {
58
+ return [];
59
+ }
60
+ },
61
+ //初始数据
62
+ get globalOptions() {
63
+ if (rtn.multiple) {
64
+ if (source.code1 === '') {
65
+ return []
66
+ }
67
+ else {
68
+ return [].concat(JSON.parse(source.code1));
69
+ }
70
+ }
71
+ return []
72
+ },
73
+ //重新赋值code1
74
+ setCode() {
75
+ let currentOptions = this.labelValue.filter((v) => {
76
+ return this.value.indexOf(v['code']) > -1;
77
+ });
78
+ let currentOptions1 = this.options.filter((v) => {
79
+ return this.value.indexOf(v['code']) > -1;
80
+ });
81
+ currentOptions1.forEach((v) => {
82
+ let item = currentOptions.find((v1) => {
83
+ return v1.code === v.code;
84
+ });
85
+ if (!item) {
86
+ currentOptions.push(v)
87
+ }
88
+ });
89
+
90
+ if (source.code1 != '') {
91
+ let checked = JSON.parse(source.code1 || '[]')
92
+ checked.forEach((v) => {
93
+ let item = rtn.globalOptions.find((v1) => {
94
+ return v1.code === v.code;
95
+ });
96
+ if (item && this.value.indexOf(v['code']) < 0) {
97
+ if (!item.locked) {
98
+ v['flagDeleted'] = true;
99
+ }
100
+ }
101
+ else {
102
+ return
103
+ }
104
+ currentOptions.push(v)
105
+ });
106
+ source.code1 = JSON.stringify(currentOptions);
107
+ }
108
+ else {
109
+ source.code1 = JSON.stringify(currentOptions);
110
+ }
111
+
112
+ this.labelValue = currentOptions.filter((v) => {
113
+ return !v.flagDeleted;
114
+ });
115
+ },
116
+
117
+
118
+ get valueLabel() {
119
+ if (source.isList && this.value.length > 0 && rtn.attrs.placeholder) {
120
+ return rtn.attrs.placeholder + ":";
121
+ }
122
+ return '';
123
+ },
124
+ get parentName() {
125
+ return source.parentField;
126
+ },
127
+ attrs: {
128
+ style: {
129
+ width: '100%'
130
+ },
131
+ clearable: true
132
+ },
133
+ apiParams: {
134
+ paramName: 'k',
135
+ parentName: 'pk',
136
+ parentValue: 'pv',
137
+ search: 't'
138
+ },
139
+ get defaultValue() {
140
+ var rtnArr = [];
141
+ if (this.defaultText !== '') {
142
+ [].concat(JSON.parse(this.defaultText)).forEach((v) => {
143
+ rtnArr.push(v.code);
144
+ });
145
+ }
146
+ return rtnArr;
147
+ },
148
+ defaultText: source.code1,
149
+ get clearable() {
150
+ if (typeof source.clear === 'undefined') {
151
+ return true;
152
+ }
153
+ if (source.clear) {
154
+ return true;
155
+ }
156
+ else {
157
+ return false;
158
+ }
159
+ },
160
+ set clearable(v) {
161
+ source.clear = v;
162
+ },
163
+ get searchTick() {
164
+ return parseInt(source.searchTick) || 250;
165
+ },
166
+ set searchTick(v) {
167
+ source.searchTick = v;
168
+ },
169
+ getOptions(paramsAction, key) {
170
+ var self = this;
171
+ var apiAddrs = paramsAction || this.api;
172
+ var params = {
173
+ action: apiAddrs,
174
+ para: {
175
+ paramName: self.paramName,
176
+ parentValue: rtn.getFormParentFieldPara(),
177
+ key: key,
178
+ extraData: rtn.getFormRefFieldPara()
179
+ }
180
+ };
181
+ Vue.prototype.$api.postHandler(common.globalUri(), params).then((response) => {
182
+ if (response.rtnCode === Enum.ReturnCode.Successful) {
183
+ self.options = response.content;
184
+ }
185
+ });
186
+ },
187
+ moreActionRouter: moreActionRouter,//更多高级查询
188
+ //弹出SearchList类型,0不弹框,1点按钮弹框,2直接点搜索框弹框
189
+ get popupSearchListType() {
190
+ if (moreActionRouter) {
191
+ return 1;
192
+ }
193
+
194
+ return 0;
195
+ },
196
+ get moreActionBtnName() {
197
+ if (moreActionRouter) {
198
+ return moreActionRouter.label;
199
+ }
200
+
201
+ return null;
202
+ },
203
+ get lockedValue() {
204
+ if (this._lockedValue !== null) {
205
+ return this._lockedValue;
206
+ }
207
+ else {
208
+ this._lockedValue = [];
209
+ this.options.forEach((v) => {
210
+ if(v.locked){
211
+ this._lockedValue.push(v.code);
212
+ }
213
+ });
214
+ return this._lockedValue;
215
+ }
216
+ },
217
+ };
218
+ rtn = base.copy(Base(source), rtn);
219
+ rtn = base.copy(rtn, valid.Init(rtn));
220
+ return rtn;
221
+ }
222
+ export default TagsNew;