cnhis-design-vue 0.2.19-beta → 0.2.23-beta

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.
@@ -4,17 +4,36 @@
4
4
  <a-tag v-for="v in labelSelectedList" :key="v.labelId" :style="handleLabelColor(v, true)" :closable="item_is_edit" @close="closeTag(v)">
5
5
  {{ v.labelName }}
6
6
  </a-tag>
7
- <span class="form-add-icon form-add-icon-label" @click="handleEditLabel" :class="{ disable: isLock }" v-show="item_is_edit">
7
+ <span v-if="!explicit" class="form-add-icon form-add-icon-label" @click="handleEditLabel" :class="{ disable: isLock }" v-show="item_is_edit">
8
8
  <a-icon class="add-icon" type="plus-circle" />
9
9
  新增
10
10
  </span>
11
11
  </div>
12
- <div class="common-label" v-if="sourceType == 'form' && commonLabelList.length && item_is_edit">
12
+ <div class="common-label" v-if="sourceType == 'form' && commonLabelList.length && item_is_edit && !explicit">
13
13
  <span>常用</span>
14
14
  <a-checkable-tag v-for="(item, i) in commonLabelList" v-model="item.isSelect" @change="handleCommonLabelChange($event, item)" :key="i" :style="handleLabelColor(item)">
15
15
  {{ item.labelName }}
16
16
  </a-checkable-tag>
17
17
  </div>
18
+ <div v-if="explicit">
19
+ <labelFormContent
20
+ :explicit="explicit"
21
+ v-bind="$attrs"
22
+ ref="labelFormContent"
23
+ :labelVisible="labelVisible"
24
+ :item="item"
25
+ :isEdit="isEdit"
26
+ :isLock="isLock"
27
+ :labelSelectedList="labelSelectedList"
28
+ :isChangeWindow="isChangeWindow"
29
+ :labelOptions="editLabelItem.labelObj"
30
+ :sourceType="sourceType"
31
+ @updateLabelData="updateLabelData"
32
+ @explicitOnChange="explicitOnChange"
33
+ ></labelFormContent>
34
+ </div>
35
+
36
+ <!-- 弹窗 -->
18
37
  <a-modal
19
38
  class="label-form-modal-wrap modal-wrap standard-modal standard-modal-white"
20
39
  v-model="labelVisible"
@@ -58,6 +77,7 @@
58
77
  </div>
59
78
  </template>
60
79
  <labelFormContent
80
+ :explicit="explicit"
61
81
  v-bind="$attrs"
62
82
  ref="labelFormContent"
63
83
  :labelVisible="labelVisible"
@@ -105,7 +125,8 @@ export default create({
105
125
  modalWidth: '763px',
106
126
  modalHeight: '404px',
107
127
  maxHeight: '404px',
108
- commonLabelList: []
128
+ commonLabelList: [],
129
+ multipleChoiceConfig: {}
109
130
  };
110
131
  },
111
132
  props: {
@@ -139,6 +160,16 @@ export default create({
139
160
  type: Function,
140
161
  default: () => Promise.resolve({ rows: [] })
141
162
  },
163
+
164
+ explicit:{ // 标签选择外显
165
+ type: Boolean,
166
+ default: false
167
+ },
168
+
169
+ explicitHeiht:{
170
+ type: String,
171
+ default: ""
172
+ }
142
173
  },
143
174
  computed: {
144
175
  item_is_edit() {
@@ -146,6 +177,16 @@ export default create({
146
177
  return (item.is_edit == 1 || item.isShow) && !this.isDetail;
147
178
  }
148
179
  },
180
+ mounted() {
181
+ // 外显初始化
182
+ if(this.explicit){
183
+ this.handleEditLabel();
184
+ } else {
185
+ // 获取标签分类
186
+ this.handleGetMultipleChoiceConfig(this.item);
187
+ }
188
+
189
+ },
149
190
  watch: {
150
191
  selectedList: {
151
192
  immediate: true,
@@ -189,13 +230,19 @@ export default create({
189
230
  selectedList.splice(fdIndex, 1);
190
231
  }
191
232
  this.handleEmit(selectedList);
233
+ this.hanldeSetLabelItem(d.labelId, false);
192
234
  },
193
235
  handleCommonLabelChange(v, d) {
194
- const selectedList = this.labelSelectedList || [];
236
+ let multipleChoiceConfig = this.multipleChoiceConfig;
237
+ let selectedList = this.labelSelectedList || [];
195
238
  if (v) {
196
239
  if (selectedList.some(n => n.labelId == d.labelId)) {
197
240
  return;
198
241
  }
242
+ // 不允许多选的类型,先删除,再新增
243
+ if('2' == multipleChoiceConfig[d.typeId]){
244
+ selectedList = selectedList.filter(item => item.typeId !== d.typeId);
245
+ }
199
246
  selectedList.push(d);
200
247
  } else {
201
248
  const fdIndex = selectedList.findIndex(n => n.labelId == d.labelId);
@@ -215,12 +262,16 @@ export default create({
215
262
  }
216
263
  });
217
264
  },
218
- handleEditLabel() {
265
+ handleEditLabel(type) {
219
266
  if (this.isLock) return;
220
- this.labelVisible = true;
267
+ if(!this.explicit && type !== 'init') {
268
+ this.labelVisible = true;
269
+ }
221
270
  this.handleGetLabelData(this.item)
222
271
  },
223
272
  handleLabelCancel() {
273
+ if(this.explicit) return;
274
+
224
275
  this.$refs.labelFormContent?.resetShowAdd();
225
276
  this.editLabelItem.showAdd = false;
226
277
  this.editLabelItem = {};
@@ -258,7 +309,7 @@ export default create({
258
309
 
259
310
  async handleGetLabelData(v, update) {
260
311
  const { rows, results } = await this.getLabelList(v);
261
- console.log(rows, results)
312
+ // console.log(rows, results)
262
313
  const labelList = rows || [];
263
314
  const labelObj = {};
264
315
  const cacheKey = `${v.val_key}_${v.name}`;
@@ -271,6 +322,7 @@ export default create({
271
322
  * typeName 按照分类处理
272
323
  * 没有分类创建分类,有则添加
273
324
  */
325
+ this.$set(n,'isSelect',false)
274
326
  if (labelObj[n.typeName]) {
275
327
  labelObj[n.typeName].itemList.push({ ...n });
276
328
  } else {
@@ -299,48 +351,60 @@ export default create({
299
351
  setLabelTypeStatus(results) {
300
352
  if (!results) return false;
301
353
  let keys = Object.keys(results);
302
-
354
+ let multipleChoiceConfig ={};
303
355
  let choiceTypes = (results.typeList || []).reduce((obj, item) => {
304
- obj[item.typeName] = item.multipleChoice;
356
+ multipleChoiceConfig[item.typeId] = item.multipleChoice
357
+
358
+ obj[item.typeName] = {
359
+ multipleChoice:item.multipleChoice,
360
+ parentColor: item.parentColor,
361
+ allowCreateByPersonal:item.allowCreateByPersonal
362
+ }
305
363
  return obj;
306
364
  }, {});
365
+
366
+ if(this.explicit){
367
+ this.multipleChoiceConfig = multipleChoiceConfig;
368
+ }
307
369
  keys.forEach(key => {
308
370
  if (key === 'typeList') return;
309
371
  // 空,允许
310
372
  if (key === 'emptyTypes') {
311
373
  results[key].forEach(item => {
312
- this.$set(this.editLabelItem.labelObj, item.typeName, {
313
- multipleChoice: choiceTypes[item.typeName],
374
+ this.$set(this.editLabelItem.labelObj, item.typeName, Object.assign({
314
375
  addVal: '',
315
376
  showAdd: false,
316
377
  itemList: [],
317
378
  typeId: item.typeId,
318
379
  typeName: item.typeName
319
- });
380
+ },choiceTypes[item.typeName] || {}));
320
381
  });
321
382
  return;
322
383
  }
323
384
  if (utils.isPlainObject(results[key])) {
324
385
  // 空,不允许
325
386
  if (!this.editLabelItem.labelObj[key]) {
326
- this.$set(this.editLabelItem.labelObj, key, {
327
- multipleChoice: choiceTypes[key],
387
+ this.$set(this.editLabelItem.labelObj, key, Object.assign({
328
388
  addVal: '',
329
389
  showAdd: false,
330
390
  itemList: false,
331
391
  typeId: '',
332
392
  typeName: key
333
- });
393
+ },{...(choiceTypes[key] || {})}));
334
394
  } else {
335
395
  // 非空,不允许
336
396
  this.$set(this.editLabelItem.labelObj[key], 'isNoAdd', true);
337
- this.$set(this.editLabelItem.labelObj[key], 'multipleChoice', choiceTypes[key]);
397
+ this.$set(this.editLabelItem.labelObj[key], 'multipleChoice', choiceTypes[key]?.multipleChoice);
398
+ this.$set(this.editLabelItem.labelObj[key], 'allowCreateByPersonal', choiceTypes[key]?.allowCreateByPersonal);
399
+ this.$set(this.editLabelItem.labelObj[key], 'parentColor', choiceTypes[key]?.parentColor);
338
400
  }
339
401
  } else {
340
- this.$set(this.editLabelItem.labelObj[key], 'multipleChoice', choiceTypes[key]);
402
+ this.$set(this.editLabelItem.labelObj[key], 'multipleChoice', choiceTypes[key]?.multipleChoice);
403
+ this.$set(this.editLabelItem.labelObj[key], 'allowCreateByPersonal', choiceTypes[key]?.allowCreateByPersonal);
404
+ this.$set(this.editLabelItem.labelObj[key], 'parentColor', choiceTypes[key]?.parentColor);
341
405
  }
342
406
  });
343
- },
407
+ },
344
408
 
345
409
  updateLabelData(){
346
410
  this.handleGetLabelData(this.item, true)
@@ -360,6 +424,31 @@ export default create({
360
424
  this.getCommonlabelsList(this.item.label_type);
361
425
  });
362
426
  }
427
+ },
428
+
429
+ // 标签外显发生变化
430
+ explicitOnChange(){
431
+ this.handleSaveLabel();
432
+ },
433
+
434
+ hanldeSetLabelItem(id, state){
435
+ if(this.explicit){
436
+ this.$nextTick(()=>{
437
+ this.$refs.labelFormContent?.hanldeSetLabelItem(id, state);
438
+ })
439
+ }
440
+ },
441
+
442
+ async handleGetMultipleChoiceConfig(v){
443
+ const { rows, results } = await this.getLabelList(v);
444
+ if (!results) return false;
445
+ let multipleChoiceConfig = (results.typeList || []).reduce((obj, item) => {
446
+ obj[item.typeId] = item.multipleChoice
447
+ return obj;
448
+ }, {});
449
+
450
+ this.multipleChoiceConfig = multipleChoiceConfig;
451
+ this.$set(this,'multipleChoiceConfig',multipleChoiceConfig);
363
452
  }
364
453
  }
365
454
  });
@@ -391,6 +480,10 @@ export default create({
391
480
  .tag-label {
392
481
  /deep/ .ant-tag {
393
482
  margin-bottom: 4px;
483
+ border: 1px solid #f1f1f1;
484
+ .anticon-close {
485
+ color: #fff;
486
+ }
394
487
  }
395
488
  }
396
489
  .common-label {
@@ -100,7 +100,7 @@
100
100
 
101
101
  <!-- 平铺列表 tree -->
102
102
  <template v-if="showRelatedTreeBtn">
103
- <li :class="[showRelatedSearchFold ? 'related-search-input' : 'related-search-input-expand']">
103
+ <li v-if="showRelatedSearch" :class="[isRelatedSearchFold ? 'related-search-input' : 'related-search-input-expand']">
104
104
  <a-input-search
105
105
  ref="relatedSearchInput"
106
106
  class="my-input-search my-input-search-related"
@@ -737,7 +737,7 @@ export default create({
737
737
  }
738
738
  },
739
739
  searchPlaceHolder() {
740
- if (!this.useFieldList?.length) return "请输入关键字搜索";
740
+ if (!this.useFieldList?.length || this.showRelatedTreeBtn) return "请输入关键字搜索";
741
741
  let str = "";
742
742
  let strList = this.useFieldList
743
743
  ?.map(item => {
@@ -745,8 +745,11 @@ export default create({
745
745
  return item.formTitle || item.alias || item.title;
746
746
  })
747
747
  .filter(Boolean);
748
- str = strList.join("/");
748
+ str = "输入" + strList.join("/");
749
749
  return str || "请输入关键字搜索";
750
+ },
751
+ showRelatedSearch() {
752
+ return this.showRelatedTreeBtn && this.isShowSetting('hideSearch')
750
753
  }
751
754
  },
752
755
  data() {
@@ -2083,11 +2086,13 @@ export default create({
2083
2086
  searchPlaceHolder: {
2084
2087
  immediate: true,
2085
2088
  handler(val) {
2086
- if (!val) return;
2089
+ if (!val || this.showRelatedTreeBtn) return;
2087
2090
  this.$nextTick(() => {
2088
2091
  this.showPlaceholderPrefix = false;
2089
2092
  let dom = this.$refs.baseSearchPlaceholderSpan;
2090
- let w = dom.offsetWidth;
2093
+ if(!dom) return;
2094
+ // input 框有padding 32px ...显示需要多预留一些宽度12px
2095
+ let w = dom.offsetWidth + 45;
2091
2096
  console.log(w, "wwww");
2092
2097
  let maxW = this.showOutSearch ? 284 : 244;
2093
2098
  this.inputSearchW = w > maxW ? 300 : w < 200 ? 200 : w;
@@ -383,7 +383,15 @@ export const outQuickSearchFn = {
383
383
  arr.forEach(el => {
384
384
  el.setting = typeof el.setting == "string" ? JSON.parse(el.setting) : el.setting;
385
385
  const attr = el?.settingObj?.attr || "";
386
+ const isPreciseSearch = el?.settingObj?.isPreciseSearch || "";
386
387
  const showSetting = el?.setting?.showSetting || []
388
+ /**
389
+ * NUMBER和TEXT属性字段
390
+ * 如果 开启了精准搜索,则传条件的时候 要传 EQ
391
+ * isPreciseSearch: 0/1
392
+ */
393
+ let textCon = el.fieldType == "TEXT" && isPreciseSearch == 1 ? 'EQ' : 'CL';
394
+
387
395
  // 映射优先级最高
388
396
  if (showSetting?.length) {
389
397
  let tvalue = []
@@ -484,7 +492,7 @@ export const outQuickSearchFn = {
484
492
  this.handleSetLabelOptions(el.setting.labelType, el);
485
493
  }
486
494
  } else if ("PASSWORD" === attr) {
487
- this.$set(el, "con", el.fieldType === "NUMBER" ? "EQ" : "CL");
495
+ this.$set(el, "con", el.fieldType === "NUMBER" ? "EQ" : textCon);
488
496
  this.$set(el, "comAttr", "PASSWORD");
489
497
  this.$set(el, "PASSWORDTYPE", true);
490
498
  this.$set(el, "value", "");
@@ -495,7 +503,7 @@ export const outQuickSearchFn = {
495
503
  this.$set(el, "com", "Text");
496
504
  this.$set(el, "attr", "DURATION");
497
505
  } else {
498
- this.$set(el, "con", "CL");
506
+ this.$set(el, "con", textCon);
499
507
  this.$set(el, "value", "");
500
508
  this.$set(el, "com", "Text");
501
509
  }
@@ -991,6 +991,8 @@ export default create({
991
991
  handlerInitSearchItem(arr) {
992
992
  if (!Array.isArray(arr)) return;
993
993
  arr.forEach(el => {
994
+ const isPreciseSearch = el?.settingObj?.isPreciseSearch || "";
995
+
994
996
  if (el.setting) {
995
997
  // el.seting 可能是 string / object
996
998
  el.setting = typeof el.setting == "string" ? JSON.parse(el.setting) : el.setting;
@@ -1085,8 +1087,14 @@ export default create({
1085
1087
  });
1086
1088
  }
1087
1089
  } else if (el.fieldType == "TEXT") {
1088
- this.$set(el, "con", "CL");
1089
- this.$set(el, "CL", "");
1090
+ /**
1091
+ * NUMBER和TEXT属性字段
1092
+ * 如果 开启了精准搜索,则传条件的时候 要传 EQ
1093
+ * isPreciseSearch: 0/1
1094
+ */
1095
+ let con = isPreciseSearch == 1 ? 'EQ': 'CL';
1096
+ this.$set(el, "con", con);
1097
+ this.$set(el, con, "");
1090
1098
  } else if (el.fieldType == "JSONB") {
1091
1099
  this.$set(el, "con", "EQ");
1092
1100
  this.$set(el, "EQ", "");
@@ -1783,6 +1791,7 @@ export default create({
1783
1791
  line-height: 32px;
1784
1792
  text-align: right;
1785
1793
  padding-left: 12px;
1794
+ color: #000;
1786
1795
  }
1787
1796
  .quick-item-col {
1788
1797
  padding: 0 12px;
@@ -1873,11 +1882,11 @@ export default create({
1873
1882
 
1874
1883
  // 标签
1875
1884
  .label-attr-container {
1876
- div.label-container {
1877
- // overflow: hidden;
1878
- // width: 380px;
1879
- // height: 84px;
1880
- // flex: none;
1885
+ .edit-label {
1886
+ color: #000000;
1887
+ font-size: 14px;
1888
+ line-height: 32px;
1889
+ padding-left: 0;;
1881
1890
  }
1882
1891
  .label-container-height {
1883
1892
  overflow: hidden;