cnhis-design-vue 0.2.42-beta → 0.2.45-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.
Files changed (179) hide show
  1. package/es/affix/index.js +8 -8
  2. package/es/affix/style.css +0 -0
  3. package/es/age/index.js +10 -10
  4. package/es/alert/index.js +8 -8
  5. package/es/alert/style.css +0 -0
  6. package/es/anchor/index.js +8 -8
  7. package/es/anchor/style.css +0 -0
  8. package/es/auto-complete/index.js +8 -8
  9. package/es/auto-complete/style.css +0 -0
  10. package/es/avatar/index.js +8 -8
  11. package/es/avatar/style.css +0 -0
  12. package/es/back-top/index.js +8 -8
  13. package/es/back-top/style.css +0 -0
  14. package/es/badge/index.js +8 -8
  15. package/es/badge/style.css +0 -0
  16. package/es/base/index.js +8 -8
  17. package/es/base/style.css +0 -0
  18. package/es/big-table/index.js +169 -136
  19. package/es/big-table/style.css +1 -1
  20. package/es/breadcrumb/index.js +8 -8
  21. package/es/breadcrumb/style.css +0 -0
  22. package/es/button/index.js +64 -61
  23. package/es/calendar/index.js +8 -8
  24. package/es/calendar/style.css +0 -0
  25. package/es/captcha/index.js +3 -3
  26. package/es/card/index.js +8 -8
  27. package/es/card/style.css +0 -0
  28. package/es/carousel/index.js +8 -8
  29. package/es/carousel/style.css +0 -0
  30. package/es/cascader/index.js +8 -8
  31. package/es/cascader/style.css +0 -0
  32. package/es/checkbox/index.js +9 -9
  33. package/es/col/index.js +8 -8
  34. package/es/col/style.css +0 -0
  35. package/es/collapse/index.js +8 -8
  36. package/es/collapse/style.css +0 -0
  37. package/es/color-picker/index.js +1 -1
  38. package/es/comment/index.js +8 -8
  39. package/es/comment/style.css +0 -0
  40. package/es/config-provider/index.js +8 -8
  41. package/es/config-provider/style.css +0 -0
  42. package/es/date-picker/index.js +8 -8
  43. package/es/date-picker/style.css +0 -0
  44. package/es/descriptions/index.js +8 -8
  45. package/es/descriptions/style.css +0 -0
  46. package/es/divider/index.js +8 -8
  47. package/es/divider/style.css +0 -0
  48. package/es/drag-layout/index.js +39 -36
  49. package/es/drawer/index.js +8 -8
  50. package/es/drawer/style.css +0 -0
  51. package/es/dropdown/index.js +8 -8
  52. package/es/dropdown/style.css +0 -0
  53. package/es/editor/index.js +31 -11
  54. package/es/empty/index.js +8 -8
  55. package/es/empty/style.css +0 -0
  56. package/es/fabric-chart/index.js +588 -340
  57. package/es/fabric-chart/style.css +1 -1
  58. package/es/form/index.js +8 -8
  59. package/es/form/style.css +0 -0
  60. package/es/form-model/index.js +8 -8
  61. package/es/form-model/style.css +0 -0
  62. package/es/form-table/index.js +177 -154
  63. package/es/form-table/style.css +1 -1
  64. package/es/grid/index.js +24 -0
  65. package/es/grid/style.css +0 -0
  66. package/es/icon/style.css +0 -0
  67. package/es/index/index.js +1647 -1155
  68. package/es/index/style.css +1 -1
  69. package/es/input/index.js +9 -9
  70. package/es/input-number/index.js +8 -8
  71. package/es/input-number/style.css +0 -0
  72. package/es/layout/index.js +8 -8
  73. package/es/layout/style.css +0 -0
  74. package/es/list/index.js +8 -8
  75. package/es/list/style.css +0 -0
  76. package/es/locale-provider/index.js +8 -8
  77. package/es/locale-provider/style.css +0 -0
  78. package/es/map/index.js +9 -9
  79. package/es/mentions/index.js +8 -8
  80. package/es/mentions/style.css +0 -0
  81. package/es/menu/index.js +8 -8
  82. package/es/menu/style.css +0 -0
  83. package/es/message/index.js +8 -8
  84. package/es/message/style.css +0 -0
  85. package/es/modal/style.css +0 -0
  86. package/es/multi-chat/index.js +176 -146
  87. package/es/multi-chat/style.css +1 -1
  88. package/es/multi-chat-client/index.js +169 -139
  89. package/es/multi-chat-client/style.css +1 -1
  90. package/es/multi-chat-history/index.js +40 -37
  91. package/es/multi-chat-record/index.js +50 -47
  92. package/es/multi-chat-setting/index.js +97 -84
  93. package/es/multi-chat-setting/style.css +1 -1
  94. package/es/multi-chat-sip/index.js +1 -1
  95. package/es/notification/index.js +8 -8
  96. package/es/notification/style.css +0 -0
  97. package/es/page-header/index.js +8 -8
  98. package/es/page-header/style.css +0 -0
  99. package/es/pagination/index.js +8 -8
  100. package/es/pagination/style.css +0 -0
  101. package/es/popconfirm/index.js +8 -8
  102. package/es/popconfirm/style.css +0 -0
  103. package/es/popover/index.js +8 -8
  104. package/es/popover/style.css +0 -0
  105. package/es/progress/index.js +8 -8
  106. package/es/progress/style.css +0 -0
  107. package/es/radio/index.js +9 -9
  108. package/es/rate/index.js +8 -8
  109. package/es/rate/style.css +0 -0
  110. package/es/result/index.js +8 -8
  111. package/es/result/style.css +0 -0
  112. package/es/row/index.js +8 -8
  113. package/es/row/style.css +0 -0
  114. package/es/scale-view/index.js +92 -69
  115. package/es/select/index.js +487 -280
  116. package/es/select/style.css +1 -1
  117. package/es/select-label/index.js +78 -55
  118. package/es/select-person/index.js +63 -63
  119. package/es/select-person/style.css +1 -1
  120. package/es/skeleton/index.js +8 -8
  121. package/es/skeleton/style.css +0 -0
  122. package/es/slider/index.js +8 -8
  123. package/es/slider/style.css +0 -0
  124. package/es/space/index.js +8 -8
  125. package/es/space/style.css +0 -0
  126. package/es/spin/index.js +8 -8
  127. package/es/spin/style.css +0 -0
  128. package/es/statistic/index.js +8 -8
  129. package/es/statistic/style.css +0 -0
  130. package/es/steps/index.js +8 -8
  131. package/es/steps/style.css +0 -0
  132. package/es/switch/index.js +8 -8
  133. package/es/switch/style.css +0 -0
  134. package/es/table-filter/index.js +205 -171
  135. package/es/table-filter/style.css +1 -1
  136. package/es/tabs/index.js +8 -8
  137. package/es/tabs/style.css +0 -0
  138. package/es/tag/index.js +45 -42
  139. package/es/time-picker/index.js +8 -8
  140. package/es/time-picker/style.css +0 -0
  141. package/es/timeline/index.js +8 -8
  142. package/es/timeline/style.css +0 -0
  143. package/es/tooltip/index.js +8 -8
  144. package/es/tooltip/style.css +0 -0
  145. package/es/transfer/index.js +8 -8
  146. package/es/transfer/style.css +0 -0
  147. package/es/tree/index.js +8 -8
  148. package/es/tree/style.css +0 -0
  149. package/es/tree-select/index.js +8 -8
  150. package/es/tree-select/style.css +0 -0
  151. package/es/upload/index.js +8 -8
  152. package/es/upload/style.css +0 -0
  153. package/es/verification-code/index.js +2 -2
  154. package/lib/cui.common.js +2807 -1378
  155. package/lib/cui.umd.js +2807 -1378
  156. package/lib/cui.umd.min.js +77 -77
  157. package/package.json +4 -2
  158. package/packages/big-table/src/BigTable.vue +2 -3
  159. package/packages/big-table/src/utils/bigTableProps.js +9 -1
  160. package/packages/fabric-chart/src/FabricChart.vue +3 -0
  161. package/packages/fabric-chart/src/components/DropPopup.vue +0 -2
  162. package/packages/fabric-chart/src/components/MouseRightClick.vue +1 -1
  163. package/packages/fabric-chart/src/fabric-chart/FabricCanvas.vue +5 -1
  164. package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +181 -92
  165. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +3 -2
  166. package/packages/form-table/src/FormTable.vue +1 -1
  167. package/packages/grid/src/grid.js +3 -0
  168. package/packages/multi-chat/chat/chatMain.vue +1 -1
  169. package/packages/multi-chat/setting/index.vue +6 -1
  170. package/packages/multi-chat/store/actions.js +4 -1
  171. package/packages/select/src/CustomSelect/index.vue +40 -13
  172. package/packages/select/src/TableSelect/index.vue +177 -113
  173. package/packages/select-person/select-person.vue +1 -9
  174. package/packages/table-filter/src/base-search-com/BaseSearch.vue +8 -1
  175. package/packages/table-filter/src/components/multi-select/multi-select.vue +0 -1
  176. package/packages/table-filter/src/components/search-condition/SearchCondition.vue +3 -0
  177. package/src/component/select-pages/index.vue +2 -2
  178. package/packages/select/src/CustomSelect/components/select-pages.vue +0 -53
  179. package/packages/table-filter/src/components/multi-select/select-pages.vue +0 -72
@@ -6,9 +6,12 @@
6
6
  import Vue from 'vue';
7
7
  import 'xe-utils';
8
8
  import VXETable from 'vxe-table';
9
+ import VXETablePluginAntd from 'vxe-table-plugin-antd'
9
10
  import Grid from 'vxe-table/lib/grid';
10
11
  import 'vxe-table/lib/style.css';
12
+ import 'vxe-table-plugin-antd/dist/style.css'
11
13
 
14
+ VXETable.use(VXETablePluginAntd);
12
15
  import create from '@/core/create';
13
16
  import tableMethods from '@/core/table-methods';
14
17
 
@@ -332,7 +332,7 @@ export default {
332
332
  return this.assemblySetting.portraitPanelSetting?.targetIs;
333
333
  },
334
334
  showBroadcast() {
335
- let res = (!this.isServer && this.assemblySetting.broadcast && this.assemblySetting.broadcast.PC.isChecked == 'Y' && this.assemblySetting.broadcast.PC.list.length > 0) || false;
335
+ let res = (!this.isServer && this.assemblySetting?.broadcast?.PC?.isChecked == 'Y' && this.assemblySetting?.broadcast?.PC?.list?.length > 0) || false;
336
336
  return res;
337
337
  },
338
338
  broadcastCarousel() {
@@ -56,6 +56,11 @@ export default {
56
56
  },
57
57
  assemblyId: {
58
58
  type: [String, Number]
59
+ },
60
+ // 是否单独配置的菜单,比如系统设置->配置管理->进入本页面
61
+ isOtherEntry: {
62
+ type: Boolean,
63
+ default: false
59
64
  }
60
65
  },
61
66
  data() {
@@ -125,7 +130,7 @@ export default {
125
130
  },
126
131
  useMenuList() {
127
132
  let exclude = [];
128
- if (!this.isOrgAdmin) {
133
+ if (!this.isOtherEntry && !this.isOrgAdmin) {
129
134
  exclude = exclude.concat([
130
135
  "authority",
131
136
  "base-info",
@@ -53,7 +53,10 @@ export default {
53
53
  userType,
54
54
  relateId: getters.accessParams.relateId
55
55
  };
56
- !isServer && (params.source = 1);
56
+ if (!isServer) {
57
+ params.source = 1;
58
+ params.serviceId = getters.queryParams.serviceId;
59
+ }
57
60
  return fetch
58
61
  .get(`/chat/${isServer ? 'service' : 'access'}/getHistoryRecord`, {
59
62
  params
@@ -1,13 +1,14 @@
1
1
  <template>
2
- <a-select v-on="$listeners" v-bind="$attrs" :showSearch="true" :not-found-content="fetching ? undefined : null">
2
+ <a-select v-on="$listeners" v-bind="$attrs" :showSearch="true" @search="debounceSearch" :filterOption="false">
3
3
  <div slot="dropdownRender" slot-scope="menu">
4
- <a-spin v-if="fetching" slot="notFoundContent" />
4
+ <a-spin style="width: 100%;margin: 100px 0 100px" v-if="fetching" />
5
5
  <template v-else>
6
6
  <v-nodes :vnodes="menu" />
7
- <selectPages v-if="PagerConfig.total > 1" :PagerConfig="searchPageConfig" :handleSearchChangePage="ChangePage" />
7
+ <selectPages v-if="PagerConfig.total > 1" :searchPageConfig="PagerConfig" :handleSearchChangePage="ChangePage" />
8
8
  </template>
9
9
  </div>
10
- <a-select-option v-for="(item, i) in items" :key="i" :value="item.value" :disabled="i === 0">
10
+
11
+ <a-select-option v-for="(item, i) in items" :key="item.value" :value="item.value" :disabled="showTitle && i === 0">
11
12
  <div :class="['custom-select-option', { 'title-line': i === 0 }]">
12
13
  <span v-for="(label, k) in item.showLabel" :key="(k + 9).toString(36) + k">{{ label }}</span>
13
14
  </div>
@@ -23,8 +24,8 @@
23
24
  import Vue from 'vue';
24
25
  import { Select, Divider, Icon, Spin } from 'ant-design-vue';
25
26
  import create from '@/core/create';
26
- // import selectPages from './components/select-pages';
27
27
  import selectPages from '@/component/select-pages';
28
+ import vexutils from '@/utils/vexutils';
28
29
 
29
30
  export default create({
30
31
  name: 'custom-select',
@@ -36,6 +37,10 @@ export default create({
36
37
  optionItems: {
37
38
  type: Array,
38
39
  default: () => []
40
+ },
41
+ showTitle: {
42
+ type: Boolean,
43
+ default: false
39
44
  }
40
45
  },
41
46
  beforeCreate() {
@@ -54,6 +59,7 @@ export default create({
54
59
  selectPages
55
60
  },
56
61
  data() {
62
+ this.debounceSearch = vexutils.debounce(this.debounceSearch, 800);
57
63
  return {
58
64
  fetching: false,
59
65
  items: [],
@@ -62,15 +68,28 @@ export default create({
62
68
  };
63
69
  },
64
70
  mounted() {
65
- this.fetching = true;
66
- setTimeout(() => {
67
- this.allItems = this.group(this.optionItems, 20);
68
- this.PagerConfig.total = this.allItems.length;
69
- this.items.push(...this.allItems[0]);
70
- this.fetching = false;
71
- }, 1000);
71
+ if (this.optionItems.length) {
72
+ this.fetching = true;
73
+ setTimeout(() => {
74
+ this.allItems = this.group(this.showTitle ? this.optionItems.slice(1) : this.optionItems, 20);
75
+ this.PagerConfig.total = this.allItems.length;
76
+ this.items.push(...this.allItems[0]);
77
+ this.fetching = false;
78
+ }, 1000);
79
+ }
72
80
  },
73
81
  methods: {
82
+ debounceSearch(value) {
83
+ this.PagerConfig.page = 1;
84
+ const filters = this.optionItems.filter(v => v.showLabel.some(k => String(k).includes(value)));
85
+ this.allItems = this.group(this.showTitle && !value ? filters.slice(1) : filters, 20);
86
+ this.PagerConfig.total = this.allItems.length;
87
+ if (this.allItems.length) {
88
+ this.items.splice(0, this.items.length, ...this.allItems[0]);
89
+ } else {
90
+ this.items.splice(0, this.items.length);
91
+ }
92
+ },
74
93
  ChangePage(type) {
75
94
  this.fetching = true;
76
95
  setTimeout(() => {
@@ -82,8 +101,16 @@ export default create({
82
101
  group(array, subGroupLength) {
83
102
  let index = 0;
84
103
  let newArray = [];
104
+
85
105
  while (index < array.length) {
86
- newArray.push(array.slice(index, (index += subGroupLength)));
106
+ if (!this.showTitle) {
107
+ newArray.push(array.slice(index, (index += subGroupLength)));
108
+ } else {
109
+ newArray.push([{
110
+ value: `${index}${Date.now()}`,
111
+ showLabel: this.optionItems[0].showLabel
112
+ }, ...array.slice(index, (index += subGroupLength))]);
113
+ }
87
114
  }
88
115
  return newArray;
89
116
  }
@@ -22,9 +22,8 @@
22
22
  :dropdownStyle="{ 'z-index': 100 }"
23
23
  @blur="isSearch = false"
24
24
  @focus="isSearch = true"
25
- @search="search"
25
+ @search="debounceSearch"
26
26
  @change="valueChange"
27
- @dropdownVisibleChange="dropdownVisibleChange"
28
27
  :getPopupContainer="
29
28
  triggerNode => {
30
29
  return triggerNode.parentNode || document.body;
@@ -54,6 +53,7 @@
54
53
  :data="tableData"
55
54
  :radio-config="{ trigger: 'row', checkRowKey: defaultSelecteRow }"
56
55
  :edit-config="{ trigger: 'click', mode: 'cell' }"
56
+ :edit-rules="rules"
57
57
  @radio-change="radioChangeEvent"
58
58
  @cell-click="cellClick"
59
59
  >
@@ -61,6 +61,26 @@
61
61
  <span class="opt-btn" @click="deleteRow(row)">删除</span>
62
62
  </template>
63
63
 
64
+ <template v-for="item in colSelectList" #[item.slots.edit]="scope">
65
+ <a-select
66
+ :key="item.slots.edit"
67
+ show-search
68
+ :placeholder="`请选择${item.title}`"
69
+ style="width: 100%"
70
+ :default-active-first-option="false"
71
+ :filter-option="false"
72
+ :not-found-content="null"
73
+ :defaultValue="scope.row[item.field]"
74
+ v-model="scope.row[item.field]"
75
+ @change="$refs.xTable.updateStatus(scope)"
76
+ @search="value => cellSearch(value, scope.row, item.field)"
77
+ >
78
+ <a-select-option :key="option.value" :value="option.value" v-for="option in item.editRender.options">
79
+ {{option.label}}
80
+ </a-select-option>
81
+ </a-select>
82
+ </template>
83
+
64
84
  <template #empty>
65
85
  <span>
66
86
  <p class="no-data">暂无数据</p>
@@ -74,7 +94,7 @@
74
94
  <a-button type="primary" style="margin-right: auto" @click="addRow">新增</a-button>
75
95
  <span v-show="!isOk" class="tips">请完善表格信息</span>
76
96
  <span v-show="isOk && isRepeat" class="tips">表格信息不能重复</span>
77
- <a-button style="margin-right: 10px" @click="isOpen = false">取消</a-button>
97
+ <a-button style="margin-right: 10px" @click="cancel">取消</a-button>
78
98
  <a-button type="primary" @click="saveRow">确定</a-button>
79
99
  </template>
80
100
  </div>
@@ -93,26 +113,7 @@ import Vue from 'vue';
93
113
  import { Select, Button, Icon, Spin, Pagination } from 'ant-design-vue';
94
114
  import Grid from '~/grid';
95
115
  import create from '@/core/create';
96
-
97
- // 防抖
98
- function debounce(fn, wait, immadiate) {
99
- let timeout;
100
- return function () {
101
- const context = this;
102
- const args = [...arguments];
103
- timeout && clearTimeout(timeout);
104
- if (immadiate) {
105
- !timeout && fn.apply(context, args);
106
- timeout = setTimeout(() => {
107
- timeout = null;
108
- }, wait);
109
- } else {
110
- timeout = setTimeout(() => {
111
- fn.apply(context, args);
112
- }, wait);
113
- }
114
- };
115
- }
116
+ import vexutils from '@/utils/vexutils';
116
117
 
117
118
  export default create({
118
119
  name: 'table-select',
@@ -123,7 +124,7 @@ export default create({
123
124
  },
124
125
  columns: {
125
126
  type: Array,
126
- default: () => []
127
+ require: true
127
128
  },
128
129
  data: {
129
130
  type: Array,
@@ -140,13 +141,20 @@ export default create({
140
141
  fetching: {
141
142
  type: Boolean,
142
143
  default: false
144
+ },
145
+ validRules: {
146
+ type: Object,
147
+ default: () => {}
143
148
  }
144
149
  },
145
150
  computed: {
146
151
  mode() {
147
152
  const obj = this.columns.find(v => v.type);
148
153
  return obj?.type === 'checkbox' || this.type === 'edit' ? 'multiple' : 'default';
149
- }
154
+ },
155
+ colSelectList() {
156
+ return this.columns.filter(v => v.slots?.edit);
157
+ },
150
158
  },
151
159
  beforeCreate() {
152
160
  Vue.use(Select).use(Icon).use(Spin).use(Pagination).use(Button);
@@ -164,14 +172,14 @@ export default create({
164
172
  return {
165
173
  value: this.type === 'edit' ? [] : '',
166
174
  tableData: [],
167
- debounceSearch: '',
168
175
  setDefaultValue: true,
169
176
  defaultSelecteRow: '',
170
177
  isOpen: false,
171
178
  isOk: true,
172
179
  isRepeat: false,
173
180
  page: 1, // 配置page是因为,使用时分页触发page没有同步
174
- isSearch: true
181
+ isSearch: true,
182
+ rules: {}
175
183
  };
176
184
  },
177
185
  watch: {
@@ -179,13 +187,15 @@ export default create({
179
187
  handler(value) {
180
188
  if (value) {
181
189
  this.tableData = JSON.parse(JSON.stringify(this.data));
190
+ const { defaultValue = '' } = this.$attrs;
182
191
  // 默认值相关
183
- if (this.tableData.length && this.type === 'noEdit' && this.setDefaultValue && this.$attrs.defaultValue) {
184
- this.value = this.$attrs.defaultValue;
185
- this.defaultSelecteRow = this.tableData.find(v => v[this.selectAttr] === this.$attrs.defaultValue).id;
192
+ if (this.tableData.length && this.type === 'noEdit' && this.setDefaultValue && defaultValue) {
193
+ this.value = defaultValue;
194
+ this.defaultSelecteRow = this.tableData.find(v => v[this.selectAttr] === defaultValue).id;
186
195
  this.setDefaultValue = false;
187
196
  }
188
- if (this.type === 'edit' && this.setDefaultValue) {
197
+
198
+ if (this.type === 'edit' && this.tableData.length) {
189
199
  this.setValues(this.tableData);
190
200
  }
191
201
  }
@@ -195,60 +205,73 @@ export default create({
195
205
  }
196
206
  },
197
207
  mounted() {
198
- this.$nextTick(() => {
199
- // document.onclick = e => {
200
- // console.log(e.path);
201
- // const focusCondition = e.path.some(v => v.innerHTML.includes('table-select') && v.innerHTML.includes('ant-select-selection__rendered'));
202
- // if (focusCondition) {
203
- // console.log('应该获取焦点');
204
- // this.$refs.selectBox.focus();
205
- // }
206
- // if (!e.path.some(v => v.className === 'ant-select-dropdown-content' || v.className === 'table-select')) {
207
- // this.isOpen = false;
208
- // this.$refs.selectBox.blur();
209
- // }
210
- // };
208
+ this.$nextTick().then(() => {
209
+ document.addEventListener('mouseup', this.handlerMouseUp, true);
211
210
  });
212
211
  },
213
212
  created() {
214
213
  this.init();
215
214
  },
216
215
  methods: {
216
+ cellSearch(value, row, field) {
217
+ // 需要处理:保留不为空的上一个的value值
218
+ if (value) {
219
+ row[field] = value;
220
+ }
221
+ },
217
222
  mousedown(e) {
218
- // console.log(e);
219
223
  this.isOpen = true;
224
+ this.type === 'edit' && (this.isOk = true);
220
225
  if (e.target?.className === 'ant-select-selection__rendered') {
221
- this.isSearch = true;
222
- this.onSearch('');
226
+ if (this.type === 'noEdit') {
227
+ this.isSearch = true;
228
+ // 展开就搜索会导致当前选中行显示错误
229
+ // this.onSearch('');
230
+ }
223
231
  e.preventDefault();
224
232
  }
225
233
  },
226
- init() {
227
- this.debounceSearch = debounce(this.onSearch, 500);
234
+ handlerMouseUp(e) {
235
+ const target = e.target;
236
+ const className = target?.className;
237
+ if (this.isOpen) {
238
+ if (!this.$el?.contains(target) && !className?.includes('vxe-select-option') && !className?.includes('ant-select-dropdown-menu-item')) {
239
+ if (this.type === 'noEdit') {
240
+ this.isOpen = false;
241
+ } else {
242
+ this.cancel();
243
+ }
244
+ }
245
+ }
228
246
  },
229
- dropdownVisibleChange(open) {
230
- // console.log('展开下拉菜单-》', open);
231
- // if (open) {
232
- // // this.isOpen = true;
233
- // this.$refs.selectBox.focus();
234
- // } else {
235
- // // this.isOpen = false;
236
- // this.$refs.selectBox.blur();
237
- // }
247
+ init() {
248
+ this.debounceSearch = vexutils.debounce(this.debounceSearch, 800);
249
+
250
+ this.setValidRules();
238
251
  },
239
- search(value) {
240
- if (this.type === 'noEdit') {
241
- // 防抖
242
- this.debounceSearch(value);
252
+ setValidRules() {
253
+ if (this.type === 'edit') {
254
+ if (!Object.keys(this.validRules || {}).length) {
255
+ const rules = {};
256
+ this.columns.forEach(v => {
257
+ v.field && (rules[v.field] = [{ required: true, message: `请填入${v.title}` }]);
258
+ });
259
+ this.$set(this, 'rules', rules);
260
+ } else {
261
+ this.$set(this, 'rules', JSON.parse(JSON.stringify(this.validRules)));
262
+ }
243
263
  }
244
264
  },
245
- onSearch(value) {
246
- if (this.isSearch) { // 防止离开焦点时触发paginationchange
247
- this.$emit('update:fetching', true);
248
- this.page = 1;
249
- this.$emit('paginationchange', { page: 1, selectAttrVal: value });
265
+ debounceSearch(value) {
266
+ if (this.type === 'noEdit') {
267
+ if (this.isSearch) {
268
+ // 防止离开焦点时触发paginationchange
269
+ this.$emit('update:fetching', true);
270
+ this.page = 1;
271
+ this.$emit('paginationchange', { page: 1, selectAttrVal: value });
272
+ }
273
+ if (!this.isSearch && !value) this.isSearch = true;
250
274
  }
251
- if (!this.isSearch && !value) this.isSearch = true;
252
275
  },
253
276
  change(page, pageSize) {
254
277
  this.$emit('update:fetching', true);
@@ -278,56 +301,90 @@ export default create({
278
301
  const $table = this.$refs.xTable;
279
302
  const tableData = $table.getTableData().tableData;
280
303
  let record = {
281
- id: tableData.length ? parseInt(tableData[tableData.length - 1].id) + 1 : '1'
304
+ id: tableData.length ? +(tableData[tableData.length - 1]?.id || 0) + 1 + '' : '1'
282
305
  };
283
- // if (this.tableData.length) {
284
- // const row = this.tableData[0];
285
- // record = JSON.parse(JSON.stringify(row));
286
- // record.id = parseInt(tableData[tableData.length - 1].id) + 1;
287
- // } else {
288
306
  this.columns.forEach(v => {
289
307
  if (v.field) {
290
308
  record[v.field] = '';
291
309
  }
310
+ if (v?.slots?.edit) {
311
+ record[v.field] = undefined;
312
+ }
292
313
  });
293
- // }
294
314
  const { row: newRow } = await $table.insertAt(record, -1);
295
- // await $table.setActiveCell(newRow, Object.keys(record)[0]);
296
315
  },
297
316
  async deleteRow(row) {
298
317
  const $table = this.$refs.xTable;
299
318
  const index = $table.getRowIndex(row);
300
319
  await $table.remove(row);
301
- this.value.splice(index, 1);
320
+ !!~index && this.value.splice(index, 1);
302
321
  },
303
- saveRow() {
322
+ async cancel() {
323
+ this.isOpen = false;
324
+ const index = this.value?.length || 0;
304
325
  const $table = this.$refs.xTable;
305
326
  const tableData = $table.getTableData().tableData;
306
- // 校验全部值不能为空
307
- const isOk = tableData.every(v => {
308
- return Object.values(v).every(k => k !== '' || v.length);
327
+ const invalidTableData = tableData.slice(index);
328
+ index !== tableData.length && (await $table.remove(invalidTableData));
329
+ },
330
+ async saveRow() {
331
+ const $table = this.$refs.xTable;
332
+ const tableData = $table.getTableData().tableData;
333
+ // 校验已经填入数据的行全部值不能为空
334
+ // const effectiveTableData = tableData.filter(v => Object.keys(v).some(k => k !== 'id' && (v[k] !== '' || v[k].length)));
335
+ // const invalidTableData = tableData.filter(v => Object.keys(v).every(k => k !== 'id' && (!v[k]?.length))); // 失效的数据,即新增全部为空的
336
+
337
+ const effectiveTableData = tableData.filter(v => {
338
+ return Object.keys(v).some(k => {
339
+ if (k == 'id') {
340
+ return false;
341
+ } else {
342
+ return v[k] || v[k]?.length;
343
+ }
344
+ })
309
345
  });
346
+ const invalidTableData = tableData.filter(v => {
347
+ return Object.keys(v).every(k => {
348
+ if (k == 'id') {
349
+ return true;
350
+ } else {
351
+ return !v[k]?.length;
352
+ }
353
+ })
354
+ });
355
+
356
+ let isOk = false;
357
+ if (Object.keys(this.rules).length && this.type === 'edit') {
358
+ const errMap = await $table.validate(effectiveTableData).catch(errMap => errMap);
359
+ isOk = !errMap ? true : false;
360
+ } else {
361
+ isOk = effectiveTableData.every(v => Object.values(v).every(k => k !== '' || v.length));
362
+ }
363
+
310
364
  if (isOk) {
311
365
  this.isOk = true;
312
- if (this.selectAttr) {
313
- this.value = tableData.map(v => v[this.selectAttr]);
314
- this.isOpen = false;
315
- } else {
316
- this.setValues(tableData);
317
- // 表格信息不能重复,否则会报警告
318
- let newArr = this.value.reduce((pre, cur) => {
319
- if (!pre.includes(cur)) {
320
- return pre.concat(cur);
321
- } else {
322
- return pre;
323
- }
324
- }, []);
325
- if (newArr.length !== this.value.length) {
326
- this.isRepeat = true;
366
+ this.setValues(effectiveTableData);
367
+ $table.remove(invalidTableData);
368
+ // 去重 表格信息不能重复,否则会报警告
369
+ let newArr = effectiveTableData.reduce((pre, cur) => {
370
+ let newCur = { ...cur };
371
+ newCur.id && delete newCur.id;
372
+ const index = pre.findIndex(v => {
373
+ let newV = { ...v };
374
+ newV.id && delete newV.id;
375
+ return JSON.stringify(newV) === JSON.stringify(newCur);
376
+ });
377
+ if (!~index) {
378
+ return pre.concat(cur);
327
379
  } else {
328
- this.isRepeat = false;
329
- this.isOpen = false;
380
+ return pre;
330
381
  }
382
+ }, []);
383
+ if (newArr.length !== this.value.length) {
384
+ this.isRepeat = true;
385
+ } else {
386
+ this.isRepeat = false;
387
+ this.isOpen = false;
331
388
  }
332
389
  } else {
333
390
  this.isOk = false;
@@ -336,10 +393,18 @@ export default create({
336
393
  setValues(tableData) {
337
394
  this.value = tableData.map(v => {
338
395
  let newV = { ...v };
339
- Object.keys(v).map(k => {
340
- const cellObj = this.columns.find(j => j.field === k);
341
- if (cellObj?.editRender?.name.includes('select')) {
342
- newV[k] = cellObj.editRender.options.find(q => q.value == v[k]).label;
396
+ Object.keys(v).forEach(k => {
397
+ if (!this.selectAttr || this.selectAttr.includes(k)) {
398
+ const cellObj = this.columns.find(j => j.field === k);
399
+ if (cellObj?.editRender?.name.includes('$select')) {
400
+ newV[k] = cellObj.editRender.options.find(q => q.value == v[k])?.label || '';
401
+ }
402
+ if (cellObj?.editRender?.name.includes('ASelect')) {
403
+ newV[k] = cellObj.editRender.options.find(q => q.value == v[k])?.label || v[k];
404
+ }
405
+ }
406
+ if (this.selectAttr && !this.selectAttr.includes(k)) {
407
+ delete newV[k];
343
408
  }
344
409
  });
345
410
  if (newV.id) delete newV.id;
@@ -354,6 +419,9 @@ export default create({
354
419
  await $table.remove(tableData[index]);
355
420
  this.value = value;
356
421
  }
422
+ },
423
+ beforeDestroy() {
424
+ document.removeEventListener('mouseup', this.handlerMouseUp, true);
357
425
  }
358
426
  });
359
427
  </script>
@@ -404,6 +472,13 @@ export default create({
404
472
  font-size: 14px;
405
473
  }
406
474
  }
475
+
476
+ .ant-select-selection--single {
477
+ height: 28px;
478
+ .ant-select-selection__rendered {
479
+ line-height: 28px;
480
+ }
481
+ }
407
482
  }
408
483
  .vxe-cell .vxe-default-input,
409
484
  .vxe-cell .vxe-default-select,
@@ -415,17 +490,6 @@ export default create({
415
490
  height: 28px;
416
491
  }
417
492
  }
418
- // @{deep} .ant-pagination-prev,
419
- // @{deep} .ant-pagination-next,
420
- // @{deep} .ant-pagination-jump-prev,
421
- // @{deep} .ant-pagination-item,
422
- // @{deep} .ant-pagination-options-quick-jumper,
423
- // @{deep} .ant-select-selection--single,
424
- // @{deep} .ant-pagination-jump-next {
425
- // min-width: 30px;
426
- // height: 30px;
427
- // line-height: 30px;
428
- // }
429
493
  @{deep} .table-select .ant-pagination-item-active a {
430
494
  color: #5585f5 !important;
431
495
  }
@@ -43,13 +43,11 @@
43
43
  </div>
44
44
  <!-- main tree -->
45
45
  <a-tree
46
- v-on="$listeners"
47
46
  class="main-tree-container"
48
47
  v-show="search.status == 0"
49
48
  ref="antTree"
50
49
  v-model="checkedKeys.main"
51
50
  @expand="onExpand"
52
- @check="onCheck"
53
51
  checkable
54
52
  :expandedKeys="expandedKeys"
55
53
  :autoExpandParent="autoExpandParent"
@@ -334,6 +332,7 @@ export default create({
334
332
  this.isAllCheck(val);
335
333
  this.isSearchAllCheck(val)
336
334
  // this.handleEmitValue();
335
+ this.$emit("check", val);
337
336
  }
338
337
  },
339
338
  data: {
@@ -835,13 +834,6 @@ export default create({
835
834
  this.searchFetch();
836
835
  },
837
836
 
838
- // 选中事件
839
- onCheck() {
840
- // this.$emit('check', ...arg)
841
- // console.log(arguments, "oncheck");
842
- // console.log(this.checkedKeys.main, "checkedKeys.main");
843
- },
844
-
845
837
  isAllCheck(checkedKeys = []) {
846
838
  if (!checkedKeys || checkedKeys.length == 0) {
847
839
  this.indeterminate = false;
@@ -30,7 +30,7 @@
30
30
  </a-dropdown>
31
31
  </div>
32
32
  <slot name="classification"></slot>
33
- <li v-if="isShowSetting('hideQuickSearch') && isRelatedSearchFold" ref="quickSearchLi">
33
+ <li v-if="showQuickSearch" ref="quickSearchLi">
34
34
  <a-button class="search-default" type="default" @click="foldQuickSearch">
35
35
  <svg-icon icon-class="xitongtubiaoBIxitongshaixuan" style="color: #2d7aff; margin-right: 6px"></svg-icon>
36
36
  筛选 {{ qqConObjCount ? `(${qqConObjCount})` : '' }}
@@ -745,11 +745,18 @@ export default create({
745
745
  return item.formTitle || item.alias || item.title;
746
746
  })
747
747
  .filter(Boolean);
748
+ if(!strList?.length) return ''
748
749
  str = "输入" + strList.join("/");
749
750
  return str || "请输入关键字搜索";
750
751
  },
751
752
  showRelatedSearch() {
752
753
  return this.showRelatedTreeBtn && this.isShowSetting('hideSearch')
754
+ },
755
+ showQuickSearch() {
756
+ let showQuick = this.isShowSetting('hideQuickSearch')
757
+ // 平铺列表, 左侧不为tree, 而是table
758
+ if(this.editTableSource == 'relatedComponent' && this.relatedBaseInfo?.showType != "TREE") return showQuick
759
+ return showQuick && this.isRelatedSearchFold
753
760
  }
754
761
  },
755
762
  data() {
@@ -63,7 +63,6 @@
63
63
  <script>
64
64
  import { Select, Spin, Icon,Button } from 'ant-design-vue';
65
65
  import utils from '@/utils/utils-map';
66
- // import selectPages from './select-pages';
67
66
  import selectPages from '@/component/select-pages';
68
67
  export default {
69
68
  name: 'multiSelect',