gcs-ui-lib 1.1.433

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 (154) hide show
  1. package/.env.development +5 -0
  2. package/.env.production +7 -0
  3. package/.eslintrc.js +5 -0
  4. package/README.md +97 -0
  5. package/_webpack.config.js +135 -0
  6. package/babel.config.js +17 -0
  7. package/lib/demo.html +10 -0
  8. package/lib/fonts/SIMSUN.5e0c362c.5e0c362c.ttf +0 -0
  9. package/lib/fonts/element-icons.535877f5.535877f5.woff +0 -0
  10. package/lib/fonts/element-icons.732389de.732389de.ttf +0 -0
  11. package/lib/fonts/iconfont.09d221ee.09d221ee.woff +0 -0
  12. package/lib/fonts/iconfont.1c4bfacc.1c4bfacc.ttf +0 -0
  13. package/lib/fonts/iconfont.a6f34dc7.a6f34dc7.woff2 +0 -0
  14. package/lib/fonts/iconfont.f4c32765.f4c32765.ttf +0 -0
  15. package/lib/gcs-ui-lib.common.js +40576 -0
  16. package/lib/gcs-ui-lib.css +3 -0
  17. package/lib/gcs-ui-lib.umd.js +40586 -0
  18. package/lib/gcs-ui-lib.umd.min.js +40 -0
  19. package/lib/img/bankbackground(1).e1f6e40f.jpg +0 -0
  20. package/lib/img/busibackground(2).7e09bf1f.jpg +0 -0
  21. package/lib/img/document.193a282d.svg +8 -0
  22. package/lib/img/folder.8e019792.svg +9 -0
  23. package/lib/img/icon.fc86764f.gif +0 -0
  24. package/npm +1 -0
  25. package/package.json +100 -0
  26. package/packages/DynamicForm/index.js +7 -0
  27. package/packages/DynamicForm/src/components/Amount.vue +51 -0
  28. package/packages/DynamicForm/src/components/AmountRange.vue +76 -0
  29. package/packages/DynamicForm/src/components/CheckboxGroup.vue +63 -0
  30. package/packages/DynamicForm/src/components/DMY.vue +126 -0
  31. package/packages/DynamicForm/src/components/Date.vue +51 -0
  32. package/packages/DynamicForm/src/components/DateRange.vue +51 -0
  33. package/packages/DynamicForm/src/components/Dialog.vue +247 -0
  34. package/packages/DynamicForm/src/components/Input.vue +48 -0
  35. package/packages/DynamicForm/src/components/InputNumber.vue +69 -0
  36. package/packages/DynamicForm/src/components/InputNumberRange.vue +47 -0
  37. package/packages/DynamicForm/src/components/LazySelect.vue +311 -0
  38. package/packages/DynamicForm/src/components/RadioGroup.vue +43 -0
  39. package/packages/DynamicForm/src/components/Rate.vue +57 -0
  40. package/packages/DynamicForm/src/components/Select.vue +307 -0
  41. package/packages/DynamicForm/src/components/Switch.vue +32 -0
  42. package/packages/DynamicForm/src/components/Textarea.vue +58 -0
  43. package/packages/DynamicForm/src/components/TimeSelect.vue +61 -0
  44. package/packages/DynamicForm/src/components/unitTreeSelect.vue +141 -0
  45. package/packages/DynamicForm/src/components/urlLinkInput.vue +100 -0
  46. package/packages/DynamicForm/src/demo/index.vue +486 -0
  47. package/packages/DynamicForm/src/fileUpload.js +232 -0
  48. package/packages/DynamicForm/src/formConfig.js +2910 -0
  49. package/packages/DynamicForm/src/helpers.js +18 -0
  50. package/packages/DynamicForm/src/main.vue +1095 -0
  51. package/packages/FileImport/index.js +7 -0
  52. package/packages/FileImport/src/demo/index.vue +29 -0
  53. package/packages/FileImport/src/main.vue +306 -0
  54. package/packages/SelectTicket/index.js +7 -0
  55. package/packages/SelectTicket/src/Tree/index.vue +13 -0
  56. package/packages/SelectTicket/src/demo/index.vue +139 -0
  57. package/packages/SelectTicket/src/header.js +276 -0
  58. package/packages/SelectTicket/src/main.vue +581 -0
  59. package/packages/SelectTicket/src/printDialog/dialogO.vue +116 -0
  60. package/packages/SelectTicket/src/printDialog/index.vue +69 -0
  61. package/packages/SelectTicket/src/ticketDetail/billInformation/README.MD +6 -0
  62. package/packages/SelectTicket/src/ticketDetail/billInformation/mixins/index.js +35 -0
  63. package/packages/SelectTicket/src/ticketDetail/billInformation/obverse.vue +768 -0
  64. package/packages/SelectTicket/src/ticketDetail/billInformation/overview.vue +115 -0
  65. package/packages/SelectTicket/src/ticketDetail/billInformation/printList.vue +127 -0
  66. package/packages/SelectTicket/src/ticketDetail/billInformation/reverse.vue +205 -0
  67. package/packages/SelectTicket/src/ticketDetail/billInformation//351/231/204/345/212/240/344/277/235/350/257/201/344/277/241/346/201/257/345/255/227/346/256/265/345/257/271/347/205/247.md +246 -0
  68. package/packages/SelectTicket/src/ticketDetail/dialog.vue +73 -0
  69. package/packages/SelectTicket/src/ticketDetail/img/bankbackground(1).jpg +0 -0
  70. package/packages/SelectTicket/src/ticketDetail/img/busibackground(2).jpg +0 -0
  71. package/packages/SelectTicket/src/ticketDetail/img/icon.gif +0 -0
  72. package/packages/SelectTicket/src/ticketDetail/img/icon2.png +0 -0
  73. package/packages/SelectTicket/src/ticketDetail/img/noData.png +0 -0
  74. package/packages/SelectTicket/src/ticketDetail/index.vue +188 -0
  75. package/packages/SelectTreeUnit/index.js +7 -0
  76. package/packages/SelectTreeUnit/src/Tree/document.svg +8 -0
  77. package/packages/SelectTreeUnit/src/Tree/folder.svg +9 -0
  78. package/packages/SelectTreeUnit/src/Tree/index.vue +239 -0
  79. package/packages/SelectTreeUnit/src/demo/index.vue +219 -0
  80. package/packages/SelectTreeUnit/src/forEachs.js +16 -0
  81. package/packages/SelectTreeUnit/src/main.vue +1136 -0
  82. package/packages/SelectTreeUnitForm/index.js +7 -0
  83. package/packages/SelectTreeUnitForm/src/Tree/document.svg +8 -0
  84. package/packages/SelectTreeUnitForm/src/Tree/folder.svg +9 -0
  85. package/packages/SelectTreeUnitForm/src/Tree/index.vue +254 -0
  86. package/packages/SelectTreeUnitForm/src/demo/index.vue +230 -0
  87. package/packages/SelectTreeUnitForm/src/forEachs.js +16 -0
  88. package/packages/SelectTreeUnitForm/src/main.vue +1065 -0
  89. package/packages/Trade/index.js +7 -0
  90. package/packages/Trade/src/components/all/index.vue +891 -0
  91. package/packages/Trade/src/components/dynamicColumnMixin.js +69 -0
  92. package/packages/Trade/src/components/getDCloumn.js +15 -0
  93. package/packages/Trade/src/components/i18n.json +3337 -0
  94. package/packages/Trade/src/components/pendingEvent/index.vue +909 -0
  95. package/packages/Trade/src/components/server-config.js +60 -0
  96. package/packages/Trade/src/components/setUnitName.js +10 -0
  97. package/packages/Trade/src/components/specialHandle.js +171 -0
  98. package/packages/Trade/src/components/topendingTabs.js +21 -0
  99. package/packages/Trade/src/demo/index.vue +42 -0
  100. package/packages/Trade/src/main.vue +86 -0
  101. package/packages/ZipImport/index.js +7 -0
  102. package/packages/ZipImport/src/demo/index.vue +139 -0
  103. package/packages/ZipImport/src/main.vue +303 -0
  104. package/packages/approvel/index.js +8 -0
  105. package/packages/approvel/src/demo/index.vue +28 -0
  106. package/packages/approvel/src/main.vue +26 -0
  107. package/packages/approvel/src/progress.vue +167 -0
  108. package/packages/approvel/src/url.json +29 -0
  109. package/packages/extends/ElSelect.vue +180 -0
  110. package/packages/imgs/list-select.png +0 -0
  111. package/packages/imgs/list-unselect.png +0 -0
  112. package/packages/imgs/list.png +0 -0
  113. package/packages/imgs/tree-select.png +0 -0
  114. package/packages/imgs/tree-unselect.png +0 -0
  115. package/packages/imgs/tree.png +0 -0
  116. package/public/favicon.ico +0 -0
  117. package/public/index.html +19 -0
  118. package/src/App.vue +61 -0
  119. package/src/api/aims.js +8 -0
  120. package/src/api/common.js +103 -0
  121. package/src/api/fileApi.js +22 -0
  122. package/src/config/appSettings.js +12 -0
  123. package/src/config/favicon.ico +0 -0
  124. package/src/css/selectTreeUnit.scss +247 -0
  125. package/src/filter/filter.js +1 -0
  126. package/src/filter/index.js +274 -0
  127. package/src/fonts/demo.css +539 -0
  128. package/src/fonts/iconfont.css +21 -0
  129. package/src/fonts/iconfont.js +1 -0
  130. package/src/fonts/iconfont.json +23 -0
  131. package/src/fonts/iconfont.ttf +0 -0
  132. package/src/index.js +109 -0
  133. package/src/locale/format.js +47 -0
  134. package/src/locale/index.js +48 -0
  135. package/src/locale/lang/cn2hk.json +1270 -0
  136. package/src/locale/lang/en.js +73 -0
  137. package/src/locale/lang/es.js +7 -0
  138. package/src/locale/lang/index.js +66 -0
  139. package/src/locale/lang/ja.js +7 -0
  140. package/src/locale/lang/zh.js +74 -0
  141. package/src/locale/lang/zht.js +28 -0
  142. package/src/main.js +44 -0
  143. package/src/preview/page/Aside/index.vue +60 -0
  144. package/src/preview/router.js +46 -0
  145. package/src/utils/auth.js +12 -0
  146. package/src/utils/directive/asciiWidth.js +107 -0
  147. package/src/utils/directive/clickOutside.js +21 -0
  148. package/src/utils/directive/vtitle.js +140 -0
  149. package/src/utils/index.js +545 -0
  150. package/src/utils/request.js +191 -0
  151. package/src/utils/requestCache.js +68 -0
  152. package/src/utils/thems.js +62 -0
  153. package/types/favicon.ico +0 -0
  154. package/vue.config.js +45 -0
@@ -0,0 +1,1065 @@
1
+ <template>
2
+ <el-select
3
+ ref="selectTreeUnit"
4
+ :placeholder="placeholder"
5
+ :value="valueShow"
6
+ v-title="vTitle"
7
+ :clearable="clearable"
8
+ @clear="clearFn()"
9
+ :disabled="tagDisabled"
10
+ class="input-w nstc-mid"
11
+ popper-class="nstc-unit-select-popper"
12
+ @visible-change="showOpt"
13
+ @outClick="outClick"
14
+ >
15
+ <div
16
+ v-loading="loading"
17
+ class="nstc-unit-box"
18
+ :class="{ single: !multiple }"
19
+ @click="selecetClick($event)"
20
+ >
21
+ <el-option :label="null" :value="null" style="display: none" />
22
+ <el-option
23
+ v-for="(item, i) in wCdList"
24
+ :key="i"
25
+ :label="item[defineProps.label]"
26
+ :value="item[defineProps.value]"
27
+ style="display: none"
28
+ />
29
+ <div class="nstc-unit-select-row">
30
+ <el-input
31
+ v-model="searchKey"
32
+ :validate-event="false"
33
+ :placeholder="$t('common_a_0004')"
34
+ clearable
35
+ @input="debounce(searchTree, 1000)"
36
+ class="input-w nstc-unit-search"
37
+ ></el-input>
38
+ <div class="el-button-group n20-icon-group-button">
39
+ <button
40
+ type="button"
41
+ @click="changeType('tree')"
42
+ v-title="$t('common_a_0009')"
43
+ :class="
44
+ isList ? 'el-button--default is-plain' : 'el-button--primary'
45
+ "
46
+ class="el-button el-button--mini"
47
+ onlyicon=""
48
+ style="width: 31.5px"
49
+ >
50
+ <i class="iconfont icon-goujianshu"></i>
51
+ </button>
52
+ <button
53
+ type="button"
54
+ @click="changeType('list')"
55
+ v-title="$t('common_a_0010')"
56
+ :class="
57
+ isList ? 'el-button--primary' : 'el-button--default is-plain'
58
+ "
59
+ class="el-button el-button--mini"
60
+ onlyicon=""
61
+ style="width: 31.5px"
62
+ >
63
+ <i class="iconfont icon-liebiao"></i>
64
+ </button>
65
+ </div>
66
+ <!-- <div class="nstc-select-icon-box nstc-select-icon-box-fix">
67
+ <div class="nstc-select-icon-box">
68
+ <span
69
+ @click="changeType('tree')"
70
+ v-title="$t('common_a_0009')"
71
+ :class="isList ? 'nstc-select-icon-un' : ''"
72
+ class="nstc-select-icon"
73
+ >
74
+ <i class="iconfont icon-goujianshu"></i>
75
+ </span>
76
+ </div>
77
+ <div class="nstc-select-icon-box">
78
+ <span
79
+ @click="changeType('list')"
80
+ v-title="$t('common_a_0010')"
81
+ :class="isList ? '' : 'nstc-select-icon-un'"
82
+ class="nstc-select-icon"
83
+ >
84
+ <i class="iconfont icon-liebiao"></i>
85
+ </span>
86
+ </div>
87
+ </div> -->
88
+ </div>
89
+ <!-- <i
90
+ :class="isList ? '' : 'nstc-unit-icon-active'"
91
+ class="nstc-unit-icon el-icon-s-unfold"
92
+ @click="changeType('tree')"
93
+ v-title="$t('common_a_0009')"
94
+ ></i> -->
95
+ <!-- <i
96
+ :class="!isList ? '' : 'nstc-unit-icon-active'"
97
+ class="nstc-unit-icon el-icon-menu"
98
+ @click="changeType('list')"
99
+ v-title="$t('common_a_0010')"
100
+ ></i> -->
101
+ <div class="nstc-unit-content">
102
+ <el-checkbox
103
+ ref="allcheck"
104
+ v-if="showAllCheck && multiple && !onlyUnit"
105
+ v-model="checkD"
106
+ class="m-l-lg nstc-unit-content-heightfix"
107
+ :label="$t('common_a_0003')"
108
+ @change="handleCheckBox"
109
+ />
110
+ <Tree
111
+ ref="tree"
112
+ :data="data"
113
+ :isList="isList"
114
+ :node-key="nodeKey"
115
+ :multiple="multiple"
116
+ :defaultExpandedKeys="defaultExpandedKeys"
117
+ :props="defineProps"
118
+ :default-expanded-keys="expandedKeys"
119
+ @check="check"
120
+ @checkedBro="checkedBro"
121
+ @checkedChild="checkedChild"
122
+ @node-click="nodeClick"
123
+ :load="loadNode"
124
+ :lazy="isLazy"
125
+ v-on="$listeners"
126
+ v-bind="$attrs"
127
+ />
128
+ </div>
129
+ <div class="nstc-unit-footer" v-if="multiple">
130
+ <el-button type="primary" size="mini" @click="confirm">{{
131
+ $t("common_a_0001")
132
+ }}</el-button>
133
+ <el-button class="nstc-unit-cancel" size="mini" @click="cancel">{{
134
+ $t("common_a_0002")
135
+ }}</el-button>
136
+ </div>
137
+ </div>
138
+ </el-select>
139
+ </template>
140
+
141
+ <script>
142
+ import emitter from "element-ui/src/mixins/emitter";
143
+ import ElSelect from "../../extends/ElSelect.vue";
144
+ import Tree from "./Tree/index.vue";
145
+ import request from "@/utils/request";
146
+ import { getCommonConfig } from "@/api/common";
147
+ import treeSelectImg from "./../../imgs/tree-select.png";
148
+ import treeUnSelectImg from "./../../imgs/tree-unselect.png";
149
+ import listSelectImg from "./../../imgs/list-select.png";
150
+ import listUnSelectImg from "./../../imgs/list-unselect.png";
151
+ export default {
152
+ name: "SelectTreeUnitForm",
153
+ components: { Tree, ElSelect },
154
+ mixins: [emitter],
155
+ inject: {
156
+ elForm: {
157
+ default: "",
158
+ },
159
+ elFormItem: {
160
+ default: "",
161
+ },
162
+ },
163
+ props: {
164
+ showAllCheck: {
165
+ type: Boolean,
166
+ default: false,
167
+ },
168
+ disabled: {
169
+ type: Boolean,
170
+ default: false,
171
+ },
172
+ clearable: {
173
+ type: Boolean,
174
+ default: true,
175
+ },
176
+ selectFirst: {
177
+ type: Boolean,
178
+ default: false,
179
+ },
180
+ url: {
181
+ type: String,
182
+ default: "/api/nstc-gtcp/1.0/fundTree",
183
+ },
184
+ listUrl: {
185
+ type: String,
186
+ default: "/api/nstc-gtcp/1.0/fundTree/list",
187
+ },
188
+ isUnitDataScope: {
189
+ type: String,
190
+ default: "0",
191
+ },
192
+ seachObj: {
193
+ type: Object,
194
+ default: () => {
195
+ return {};
196
+ },
197
+ },
198
+ multiple: {
199
+ type: Boolean,
200
+ default: false,
201
+ },
202
+ defaultSelectAll: {
203
+ type: Boolean,
204
+ default: false,
205
+ },
206
+ defaultSelect: {
207
+ type: Array,
208
+ default: () => [],
209
+ },
210
+ upDateValue: {
211
+ type: Array,
212
+ default: () => [],
213
+ },
214
+ searchUnitNo: {
215
+ type: String,
216
+ default: "",
217
+ },
218
+ moduleNo: {
219
+ type: String,
220
+ default: "bill-group", //bill-group,bill-collect
221
+ },
222
+ relaNo: {
223
+ type: String,
224
+ default: "",
225
+ },
226
+ value: {
227
+ type: [String, Number, Array],
228
+ default: () => [],
229
+ },
230
+ collapseTags: {
231
+ type: Boolean,
232
+ default: true,
233
+ },
234
+ nodeKey: {
235
+ type: String,
236
+ default: "id",
237
+ },
238
+ placeholder: {
239
+ type: String,
240
+ default: "请选择",
241
+ },
242
+ // showCheckbox: {
243
+ // type: Boolean,
244
+ // default: true,
245
+ // },
246
+ defineProps: {
247
+ type: Object,
248
+ default: () => {
249
+ return {
250
+ label: "unitName",
251
+ value: "unitNo",
252
+ children: "children",
253
+ isLeaf: "isLeaf",
254
+ };
255
+ },
256
+ },
257
+ },
258
+ data() {
259
+ return {
260
+ mounseInTree: false,
261
+ mounseInList: false,
262
+ loading: false,
263
+ isList: false, //是否是平铺
264
+ isLazy: true, //默认开启懒加载
265
+ data: [],
266
+ show: false,
267
+ list: [],
268
+ expandedKeys: [],
269
+ wCdList: [],
270
+ checkD: false,
271
+ queryType: "0", //0,查询顶级单位;1,查询所有;2,查询直属下级(不含本身,包含子孙);3,查询所有下级(不含本身,不含子孙);4,查询兄弟级(不含子孙)5,查询直接父级
272
+ hasQueryAll: false, //是否已请求过全部数据,默认否
273
+ selectData: [],
274
+ selectDataCache: [],
275
+ valueShow: [],
276
+ searchKey: "",
277
+ timer: null,
278
+ onlyUnit: false,
279
+ defaultExpandedKeys: [],
280
+ page: {
281
+ current: 1,
282
+ size: -1,
283
+ },
284
+ treeSelectImg,
285
+ treeUnSelectImg,
286
+ listSelectImg,
287
+ listUnSelectImg,
288
+ };
289
+ },
290
+ computed: {
291
+ vTitle() {
292
+ let vl = this.valueShow.length;
293
+ if (this.multiple) return vl ? this.valueShow.slice(0, 15) : "";
294
+ return vl ? this.valueShow : "";
295
+ },
296
+ tagDisabled() {
297
+ return this.disabled || (this.elForm || {}).disabled;
298
+ },
299
+ valueC: {
300
+ get() {
301
+ return this.value;
302
+ },
303
+ set(val) {
304
+ this.$emit("input", val);
305
+ this.$emit("dataChange", this.selectData);
306
+ },
307
+ },
308
+ },
309
+ async mounted() {
310
+ if (!this.url) {
311
+ this.$message.error("请传入单位树请求地址!");
312
+ return;
313
+ }
314
+ if (this.defaultSelectAll) {
315
+ //默认选择全部时,不会读取传的默认选项
316
+ this.checkD = true;
317
+ await this.getCommonConfig();
318
+ if (this.isList) {
319
+ await this.initList();
320
+ }
321
+ this.handleCheckBox(true);
322
+ return "end";
323
+ }
324
+ if (
325
+ this.defaultSelect &&
326
+ Array.isArray(this.defaultSelect) &&
327
+ this.defaultSelect.length > 0
328
+ ) {
329
+ this.selectData = [...this.defaultSelect];
330
+ // let checkData = this.defaultSelect.map((d) => {
331
+ // return d.unitNo;
332
+ // });
333
+ this.valueShow = this.defaultSelect.map((d) => {
334
+ return d.unitName;
335
+ });
336
+ // this.$emit("input", checkData);
337
+ // this.$emit("dataChange", this.selectData);
338
+ }
339
+ await this.getCommonConfig();
340
+ if (this.isList) {
341
+ this.initList();
342
+ } else {
343
+ this.init();
344
+ }
345
+ },
346
+ watch: {
347
+ value: {
348
+ handler(now) {
349
+ if (!now) {
350
+ this.clearFn();
351
+ }
352
+ },
353
+ },
354
+ },
355
+ methods: {
356
+ changeType(type) {
357
+ if (type == "tree" && this.isList) {
358
+ this.data = [];
359
+ this.init(type);
360
+ this.isList = false;
361
+ } else if (type == "list" && !this.isList) {
362
+ this.data = [];
363
+ this.initList(type);
364
+ this.isList = true;
365
+ }
366
+ },
367
+ async getCommonConfig(resolve) {
368
+ let res = await getCommonConfig();
369
+ if (res && res.length > 0) {
370
+ res.forEach((r) => {
371
+ if (r.configGroupName.includes("单位树")) {
372
+ if (r.configs && r.configs.length > 0) {
373
+ r.configs.forEach((c) => {
374
+ if (c.configGroupName.includes("单位树")) {
375
+ if (c.configValue == "1") {
376
+ this.isList = true;
377
+ } else {
378
+ this.isList = false;
379
+ }
380
+ }
381
+ });
382
+ }
383
+ }
384
+ });
385
+ }
386
+ },
387
+ selecetClick(e) {
388
+ this.$refs.tree.showDropMenu = null;
389
+ },
390
+ init(type) {
391
+ this.$refs.tree.store.lazy = true;
392
+ if (this.searchUnitNo) {
393
+ //查询指定单位的下级
394
+ //暂不支持此模式下的默认单位设置,更新选择单位,没提需求
395
+ this.getUnitTree("6");
396
+ return "end";
397
+ }
398
+ new Promise((resolve) => {
399
+ this.getTreeData("1", { resolve });
400
+ })
401
+ .then(() => {
402
+ // 初始化时,判断是否选择节点
403
+ let temp = [];
404
+ let flatTemp = [];
405
+ this.flatData(this.data, flatTemp);
406
+ this.selectData.forEach((s, i) => {
407
+ flatTemp.forEach((d) => {
408
+ if (d.unitNo == s.unitNo) {
409
+ temp.push(d);
410
+ this.selectData[i] = d;
411
+ }
412
+ });
413
+ });
414
+ //去除没有权限的单位
415
+ temp = temp.filter((s) => {
416
+ return !s.disabled;
417
+ });
418
+ if (this.selectFirst && !type) {
419
+ //切换时不需要
420
+ //初始化时没有传默认单位和all时,根据selectFirst 默认选择第一家单位
421
+ if (temp.length < 1) {
422
+ let first = null;
423
+ let flatTemp = [];
424
+ this.flatData(this.data, flatTemp);
425
+ // flatTemp.reverse(); //递归的第一个单位会放到最后去,所以要反排一次
426
+ for (let i = 0; i < flatTemp.length; i++) {
427
+ if (!flatTemp[i].disabled) {
428
+ //取第一个有权限的单位
429
+ first = flatTemp[i];
430
+ break;
431
+ }
432
+ }
433
+ if (first) {
434
+ temp.push(first);
435
+ }
436
+ }
437
+ }
438
+ // else{
439
+ // this.$refs.tree.setCheckedNodes(temp);
440
+ // }
441
+ // this.$refs.tree.setCheckedNodes(temp);
442
+ //根据后续测试情况,看是否放进判断条件内 -----
443
+ this.$refs.tree.setCheckedNodes(temp);
444
+ this.selectData = temp;
445
+ if (!type) {
446
+ //模式切换时,不更新值
447
+ this.valueShow = this.selectData.map((s) => s.unitName);
448
+ let data = this.selectData.map((s) => s.unitNo);
449
+ this.$emit("input", this.multiple ? data : data[0]);
450
+ // this.$emit("input", data);
451
+ this.$emit("dataChange", this.selectData);
452
+ }
453
+ })
454
+ .finally(() => {
455
+ this.$emit("loaded");
456
+ });
457
+ },
458
+ /**
459
+ * @queryType 类型 //0,查询顶级单位;1,查询所有;2,查询直属下级(不含本身,不包含子孙);3,查询所有下级(不含本身,包含子孙);4,查询兄弟级(不含子孙)5,查询直接父级
460
+ */
461
+ getTreeData(queryType, dataT) {
462
+ this.loading = true;
463
+ let str =
464
+ "?moduleNo=" +
465
+ this.moduleNo +
466
+ "&isUnitDataScope=" +
467
+ this.isUnitDataScope;
468
+ if (queryType) {
469
+ str += "&queryType=" + queryType;
470
+ }
471
+ if (dataT) {
472
+ if (["2", "3", "4", "6"].includes(queryType)) {
473
+ //节点懒加载展开
474
+ str += "&unitNo=" + dataT.unitNo;
475
+ if (!dataT.unitNo) {
476
+ return "end";
477
+ }
478
+ }
479
+ }
480
+ for (let i in this.seachObj) {
481
+ str += `&${i}=${this.seachObj[i]}`;
482
+ }
483
+ if (["1", "6"].includes(queryType) && this.searchKey) {
484
+ //搜索是在查询全部的模式下进行
485
+ str += "&unitNameOrNoLike=" + this.searchKey;
486
+ }
487
+ const headers = {
488
+ relaNo: this.relaNo,
489
+ };
490
+ request({
491
+ url: this.url + str,
492
+ method: "GET",
493
+ cache: true,
494
+ headers,
495
+ }).then((res) => {
496
+ let data = res.fundTreeVoList;
497
+ this.loading = false;
498
+ if (data && data.length > 0) {
499
+ data.forEach((d) => {
500
+ d.isLeaf = !Boolean(d.hasChild);
501
+ });
502
+ }
503
+ if (["0", "1", "6"].includes(queryType)) {
504
+ //树赋值
505
+ this.data = data;
506
+ if (["1", "6"].includes(queryType)) {
507
+ //查询过全部,就关闭懒加载
508
+ this.$refs.tree.$refs.tree.store.lazy = false;
509
+ this.hasQueryAll = true;
510
+ this.$nextTick(() => {
511
+ if (this.selectData.length > 0) {
512
+ //去除没有权限的单位
513
+ this.selectData = this.selectData.filter((s) => {
514
+ return !s.disabled;
515
+ });
516
+ this.$refs.tree.setCheckedNodes(this.selectData);
517
+ }
518
+ });
519
+ }
520
+ if (dataT.expandFlag) {
521
+ //筛选时,将展开单位传入
522
+ dataT.resolve(res.firstAuthUnit);
523
+ } else {
524
+ if (res.onlyUnit) {
525
+ //如果只有一家单位的权限时,默认勾选
526
+ this.onlyUnit = true;
527
+ this.data = [res.onlyUnit];
528
+ this.selectData = [res.onlyUnit];
529
+ this.$refs.tree.setCheckedNodes(this.selectData);
530
+ let cdata = this.selectData.map((s) => s.unitNo);
531
+ this.valueShow = this.selectData.map((s) => s.unitName);
532
+ this.$emit("input", this.multiple ? cdata : cdata[0]);
533
+ // this.$emit("input", cdata);
534
+ this.$emit("dataChange", this.selectData);
535
+ } else {
536
+ dataT.resolve(data);
537
+ }
538
+ }
539
+ }
540
+ if (queryType == "2" && dataT) {
541
+ if (dataT.type && dataT.type == "direct") {
542
+ //查询直接下级,并勾选,抛到方法里面去做
543
+ dataT.resolve(data);
544
+ } else {
545
+ //节点懒加载展开,只更新直属子节点
546
+ dataT.resolve(data);
547
+ //更新子节点后根据选择的数据,确定节点选择状态
548
+ // 传递的defaultSelect和upDateValue没有id,需要在加载时,重新对选择数据赋值
549
+ this.selectData.forEach((s, i) => {
550
+ data.forEach((d) => {
551
+ if (s.unitNo == d.unitNo) {
552
+ this.selectData[i] = d;
553
+ }
554
+ });
555
+ });
556
+ this.$nextTick(() => {
557
+ if (this.selectData.length > 0) {
558
+ //去除没有权限的单位
559
+ this.selectData = this.selectData.filter((s) => {
560
+ return !s.disabled;
561
+ });
562
+ this.$refs.tree.setCheckedNodes(this.selectData);
563
+ }
564
+ });
565
+ return;
566
+ }
567
+ }
568
+ if (queryType == "4" && dataT) {
569
+ //兄弟节点
570
+ dataT.resolve(data);
571
+ return;
572
+ }
573
+ if (queryType == "3" && dataT) {
574
+ //所有下级节点
575
+ dataT.resolve(data);
576
+ return;
577
+ }
578
+ });
579
+ },
580
+ debounce(fn, delay) {
581
+ let context = this;
582
+ clearTimeout(context.timer);
583
+ context.timer = setTimeout(() => {
584
+ fn.apply(context);
585
+ }, delay);
586
+ },
587
+ searchTree(type) {
588
+ if (this.isList) {
589
+ if (!type) {
590
+ this.selectData = [];
591
+ }
592
+ this.checkD = false;
593
+ this.$refs.tree.setCheckedNodes([]);
594
+ this.getListData("search");
595
+ } else {
596
+ //搜索取消所有选中状态
597
+ this.checkD = false;
598
+ if (!type) {
599
+ this.selectData = [];
600
+ }
601
+ this.$refs.tree.setCheckedNodes([]);
602
+ new Promise((resolve) => {
603
+ if (this.searchUnitNo) {
604
+ //指定单位编号的搜索
605
+ this.getTreeData("6", {
606
+ unitNo: this.searchUnitNo,
607
+ resolve,
608
+ expandFlag: true,
609
+ });
610
+ } else {
611
+ this.getTreeData("1", { resolve, expandFlag: true });
612
+ }
613
+ }).then((data) => {
614
+ if (data) {
615
+ //默认展开节点
616
+ this.defaultExpandedKeys = [data.id];
617
+ }
618
+ });
619
+ }
620
+ },
621
+ outClick() {
622
+ // this.cancel()
623
+ },
624
+ clearFn() {
625
+ this.checkD = false;
626
+ this.selectData = [];
627
+ this.valueShow = [];
628
+ this.$refs.tree.setCheckedNodes([]);
629
+ this.$emit("input", this.multiple ? [] : "");
630
+ this.$emit("dataChange", this.selectData,'clear');
631
+ },
632
+ loadNode(node, resolve) {
633
+ //懒加载,查询子节点
634
+ this.getTreeData("2", { unitNo: node.data.unitNo, resolve: resolve });
635
+ },
636
+ check(data, { checkedKeys }) {
637
+ // let checkData = [...this.valueC]
638
+ if (checkedKeys.includes(data.id)) {
639
+ // this.valueShow.push(data.unitName)
640
+ this.selectData.push(data);
641
+ let hash = {};
642
+ let temp = [];
643
+ this.selectData.forEach((s) => {
644
+ //去重
645
+ if (!hash[s.unitNo + ""]) {
646
+ hash[s.unitNo + ""] = true;
647
+ temp.push(s);
648
+ }
649
+ });
650
+ this.selectData = temp;
651
+ // checkData.push(data.unitNo)
652
+ } else {
653
+ let temp = this.selectData.filter((s) => s.unitNo != data.unitNo);
654
+ this.selectData = temp;
655
+ // this.valueShow = temp.map(t => t.unitName)
656
+ // checkData = temp.map(t => t.unitNo)
657
+ }
658
+ // this.$emit('input', checkData)
659
+ },
660
+ showOpt(flag) {
661
+ this.$refs.tree.showDropMenu = null;
662
+ if (flag) {
663
+ // this.init();
664
+ //打开时暂存选择的节点
665
+ this.selectDataCache = JSON.parse(JSON.stringify(this.selectData));
666
+ } else {
667
+ //关闭时清空暂存
668
+ this.selectDataCache = [];
669
+ if (this.searchKey) {
670
+ this.searchKey = "";
671
+ this.searchTree("cache");
672
+ }
673
+ }
674
+ // debugger
675
+ // if (this.show) return
676
+ // this.show = true
677
+ // this.$refs['tree'].setCheckedKeys(this.value)
678
+ },
679
+ getUnitTree(type) {
680
+ new Promise((resolve) => {
681
+ this.getTreeData("6", { unitNo: this.searchUnitNo, resolve: resolve });
682
+ }).then(() => {
683
+ // this.$nextTick(() => {
684
+ // let temp = [];
685
+ // this.flatData(this.data, temp);
686
+ // setTimeout(() => {
687
+ // //默认全选时,选中数据
688
+ // //去除没有权限的单位
689
+ // temp = temp.filter((s) => {
690
+ // return !s.disabled;
691
+ // });
692
+ // this.$refs.tree.setCheckedNodes(temp);
693
+ // });
694
+ // this.selectData = temp;
695
+ // });
696
+ });
697
+ },
698
+ handleCheckBox(key) {
699
+ // debugger
700
+ if (key) {
701
+ //全选时,需要先查全部数据
702
+ if (!this.hasQueryAll) {
703
+ if (this.isList) {
704
+ return;
705
+ }
706
+ new Promise((resolve) => {
707
+ this.getTreeData("1", { resolve });
708
+ }).then(() => {
709
+ this.$nextTick(() => {
710
+ let temp = [];
711
+ this.flatData(this.data, temp);
712
+ //默认全选时,选中数据
713
+ //去除没有权限的单位
714
+ temp = temp.filter((s) => {
715
+ return !s.disabled;
716
+ });
717
+ this.$refs.tree.setCheckedNodes(temp);
718
+ this.selectData = temp;
719
+ // let s = temp.map((t) => {
720
+ // return t.unitNo;
721
+ // });
722
+ this.valueShow = temp.map((t) => {
723
+ return t.unitName;
724
+ });
725
+ this.$emit("dataChange", this.selectData);
726
+ });
727
+ });
728
+ } else {
729
+ let temp = [];
730
+ this.flatData(this.data, temp);
731
+ //去除没有权限的单位
732
+ temp = temp.filter((s) => {
733
+ return !s.disabled;
734
+ });
735
+ this.$refs.tree.setCheckedNodes(temp);
736
+ // const data = this.$refs.tree.getCheckedKeys()
737
+ this.selectData = temp;
738
+ // let s = temp.map((t) => {
739
+ // return t.unitNo;
740
+ // });
741
+ this.valueShow = temp.map((t) => {
742
+ return t.unitName;
743
+ });
744
+ this.$emit("dataChange", this.selectData);
745
+ // this.$emit('input', s)
746
+ }
747
+ } else {
748
+ this.$refs.tree.setCheckedNodes([]);
749
+ this.selectData = [];
750
+ // this.valueShow = []
751
+ // this.$emit('input', [])
752
+ // this.$message.warning(this.$t("common_a_0005"));
753
+ }
754
+ },
755
+ checkedBro(data) {
756
+ this.$refs.selectTreeUnit.handleClose(false);
757
+ new Promise((resolve) => {
758
+ this.getTreeData("4", { unitNo: data.unitNo, resolve });
759
+ }).then((bro) => {
760
+ this.selectData = this.selectData.concat(bro);
761
+ let hash = {};
762
+ let temp = [];
763
+ this.selectData.forEach((s) => {
764
+ //去重
765
+ if (!hash[s.unitNo + ""]) {
766
+ hash[s.unitNo + ""] = true;
767
+ temp.push(s);
768
+ }
769
+ });
770
+ this.selectData = temp;
771
+ //去除没有权限的单位
772
+ this.selectData = this.selectData.filter((s) => {
773
+ return !s.disabled;
774
+ });
775
+ this.$refs.tree.setCheckedNodes(this.selectData);
776
+ const data = this.$refs.tree.getCheckedKeys();
777
+ // this.$emit('input', data)
778
+ });
779
+ },
780
+ checkedChild(obj) {
781
+ this.$refs.selectTreeUnit.handleClose(false);
782
+ if (obj.type === "cancel") {
783
+ //取消勾选所有下级
784
+ new Promise((resolve) => {
785
+ this.getTreeData("3", { unitNo: obj.data.unitNo, resolve });
786
+ }).then((child) => {
787
+ if (!child || child.length < 1) {
788
+ return "end";
789
+ }
790
+ let temp1 = [];
791
+ this.flatData(child, temp1);
792
+ let ids = temp1.map((t) => t.id);
793
+ this.selectData = this.selectData.filter((s) => {
794
+ return !ids.includes(s.id);
795
+ });
796
+ this.$refs.tree.setCheckedNodes(this.selectData);
797
+ // const data = this.$refs.tree.getCheckedKeys()
798
+ // this.$emit('input', data)
799
+ });
800
+ } else if (obj.type == "all") {
801
+ //所有下级未完成开发todo
802
+ //勾选所有下级单位时,会先请求所有数据,取消懒加载模式,再请求对应的下级单位数据再勾选(包括已经勾选的数据)
803
+ new Promise((resolve) => {
804
+ this.getTreeData("3", { unitNo: obj.data.unitNo, resolve });
805
+ }).then((child) => {
806
+ if (!child || child.length < 1) {
807
+ return "end";
808
+ }
809
+ let temp1 = [];
810
+ this.flatData(child, temp1);
811
+ this.selectData = this.selectData.concat(temp1);
812
+ let hash = {};
813
+ let temp = [];
814
+ this.selectData.forEach((s) => {
815
+ //去重
816
+ if (!hash[s.unitNo + ""]) {
817
+ hash[s.unitNo + ""] = true;
818
+ temp.push(s);
819
+ }
820
+ });
821
+ this.selectData = temp;
822
+ //去除没有权限的单位
823
+ this.selectData = this.selectData.filter((s) => {
824
+ return !s.disabled;
825
+ });
826
+ this.$refs.tree.setCheckedNodes(this.selectData);
827
+ // const data = this.$refs.tree.getCheckedKeys()
828
+ // this.$emit('input', data)
829
+ });
830
+ } else {
831
+ // 勾选直接下级
832
+ new Promise((resolve) => {
833
+ this.getTreeData("2", {
834
+ unitNo: obj.data.unitNo,
835
+ resolve,
836
+ type: "direct",
837
+ });
838
+ }).then((child) => {
839
+ if (!child || child.length < 1) {
840
+ return "end";
841
+ }
842
+ let temp1 = [];
843
+ this.flatData(child, temp1);
844
+ this.selectData = this.selectData.concat(temp1);
845
+ let hash = {};
846
+ let temp = [];
847
+ this.selectData.forEach((s) => {
848
+ //去重
849
+ if (!hash[s.unitNo + ""]) {
850
+ hash[s.unitNo + ""] = true;
851
+ temp.push(s);
852
+ }
853
+ });
854
+ this.selectData = temp;
855
+ //去除没有权限的单位
856
+ this.selectData = this.selectData.filter((s) => {
857
+ return !s.disabled;
858
+ });
859
+ this.$refs.tree.setCheckedNodes(this.selectData);
860
+ // const data = this.$refs.tree.getCheckedKeys()
861
+ // this.$emit('input', data)
862
+ });
863
+ }
864
+ },
865
+ confirm() {
866
+ if (this.selectData.length < 1) {
867
+ this.$message.warning(this.$t("common_a_0005"));
868
+ return;
869
+ }
870
+ //去除没有权限的单位
871
+ this.selectData = this.selectData.filter((s) => {
872
+ return !s.disabled;
873
+ });
874
+ this.valueShow = this.selectData.map((s) => s.unitName);
875
+ let data = this.selectData.map((s) => s.unitNo);
876
+
877
+ this.$emit("input", this.multiple ? data : data[0]);
878
+ // this.$emit("input", data);
879
+ this.$emit("dataChange", this.selectData, "confirm");
880
+ this.$refs.selectTreeUnit.blur();
881
+ },
882
+ cancel() {
883
+ this.selectData = JSON.parse(JSON.stringify(this.selectDataCache));
884
+ //去除没有权限的单位
885
+ this.selectData = this.selectData.filter((s) => {
886
+ return !s.disabled;
887
+ });
888
+ this.$refs.tree.setCheckedNodes(this.selectData);
889
+ this.$refs.selectTreeUnit.blur();
890
+ },
891
+ flatData(arr, temp) {
892
+ arr.forEach((a) => {
893
+ temp.push(a);
894
+ if (
895
+ a &&
896
+ a.children &&
897
+ Array.isArray(a.children) &&
898
+ a.children.length > 0
899
+ ) {
900
+ this.flatData(a.children, temp);
901
+ }
902
+ });
903
+ },
904
+ nodeClick(data) {
905
+ this.$refs.tree.showDropMenu = null;
906
+ //单选才会进入
907
+ if (this.multiple) {
908
+ return;
909
+ }
910
+ if (!data.disabled) {
911
+ //有权限的单位才返回
912
+ this.selectData = [data];
913
+ this.valueShow = data.unitName;
914
+ this.$emit("input", data.unitNo);
915
+ this.$emit("dataChange", this.selectData, "click");
916
+ this.$refs.selectTreeUnit.blur();
917
+ }
918
+ },
919
+ upDateShowValue(flag) {
920
+ let isEqual =
921
+ JSON.stringify(this.selectData) === JSON.stringify(this.upDateValue);
922
+ // if(this.isList){
923
+ // //列表结构更新
924
+ // }else{
925
+ // //树结构更新
926
+
927
+ // }
928
+ if (this.upDateValue && Array.isArray(this.upDateValue) && !isEqual) {
929
+ //更新值和选择值不相等时才触发,避免使用的死循环
930
+ this.selectData = [...this.upDateValue];
931
+ let checkData = this.upDateValue.map((d) => {
932
+ return d.unitNo;
933
+ });
934
+ this.valueShow = this.upDateValue.map((d) => {
935
+ return d.unitName;
936
+ });
937
+ this.$emit("input", this.multiple ? checkData : checkData[0]);
938
+ this.$emit("dataChange", this.selectData);
939
+ }
940
+ if (flag) {
941
+ if (this.isList) {
942
+ // 列表模式
943
+ this.$refs.tree.setCheckedNodes([]);
944
+ this.$refs.tree.setCheckedNodes(this.selectData);
945
+ } else {
946
+ //传true时,会刷新整个树的状态,更新选择状态,有权限的单位才会选中
947
+ new Promise((resolve) => {
948
+ this.getTreeData("1", { resolve });
949
+ }).then(() => {
950
+ // 只加载顶级节点时,判断是否选择顶级节点
951
+ let temp = [];
952
+ const datas = [];
953
+ this.flatData(this.data, datas);
954
+ this.selectData.forEach((s, i) => {
955
+ datas.forEach((d) => {
956
+ if (d.unitNo == s.unitNo) {
957
+ temp.push(d);
958
+ this.selectData[i] = d; //传进来的单位没有id,将请求的数据节点,赋值给selectData
959
+ }
960
+ });
961
+ });
962
+ // this.selectData = temp;
963
+ //去除没有权限的单位
964
+ temp = temp.filter((s) => {
965
+ return !s.disabled;
966
+ });
967
+ this.$refs.tree.setCheckedNodes(temp);
968
+ });
969
+ }
970
+ }
971
+ },
972
+ async initList() {
973
+ await this.getListData();
974
+ },
975
+ async getListData(type) {
976
+ this.loading = true;
977
+ this.$refs.tree.store.lazy = false;
978
+ let params = {
979
+ current: this.page.current,
980
+ size: this.page.size,
981
+ ...this.seachObj,
982
+ data: {
983
+ ...this.seachObj,
984
+ moduleNo: this.moduleNo,
985
+ isUnitDataScope: this.isUnitDataScope,
986
+ unitNameOrNoLike: this.searchKey,
987
+ },
988
+ };
989
+ // if(type=="search"){
990
+ // params.data.unitNameOrNoLike =
991
+ // }
992
+ const headers = {
993
+ relaNo: this.relaNo,
994
+ };
995
+ let res = await request({
996
+ url: this.listUrl,
997
+ method: "POST",
998
+ data: params,
999
+ headers,
1000
+ cache: true,
1001
+ });
1002
+ this.loading = false;
1003
+ if (res.records && res.records.length > 0) {
1004
+ res.records.forEach((r) => {
1005
+ r.children = null;
1006
+ });
1007
+ this.data = res.records;
1008
+ } else {
1009
+ this.data = [];
1010
+ }
1011
+ //全选时的逻辑
1012
+ if (this.defaultSelectAll && !this.selectData.length) {
1013
+ let temp = JSON.parse(JSON.stringify(this.data));
1014
+ this.selectData = temp.filter((s) => {
1015
+ return !s.disabled;
1016
+ });
1017
+ this.setCheck(type);
1018
+ return;
1019
+ }
1020
+ this.setId();
1021
+ //去除没有权限的单位
1022
+ // this.selectData = this.selectData.filter((s) => {
1023
+ // return !s.disabled;
1024
+ // });
1025
+ if (this.selectFirst && !type) {
1026
+ //切换时不需要
1027
+ //初始化时没有传默认单位和all时,根据selectFirst 默认选择第一家单位
1028
+ if (this.selectData.length < 1 && this.data.length > 0) {
1029
+ this.selectData = [this.data[0]];
1030
+ }
1031
+ }
1032
+ this.setCheck(type);
1033
+ },
1034
+ setId() {
1035
+ //初始化设置时,传入进来的单位id可能不对,也可能不存在,用请求数据通过unitNo匹配重新设置选中数据
1036
+ this.selectData.forEach((s, i) => {
1037
+ this.data.forEach((d) => {
1038
+ if (d.unitNo == s.unitNo) {
1039
+ this.selectData[i] = d;
1040
+ }
1041
+ });
1042
+ });
1043
+ },
1044
+ setCheck(type) {
1045
+ this.valueShow = this.selectData.map((t) => {
1046
+ return t.unitName;
1047
+ });
1048
+ let data = this.selectData.map((s) => s.unitNo);
1049
+ if (!type) {
1050
+ this.$emit("input", this.multiple ? data : data[0]);
1051
+ this.$emit("dataChange", this.selectData);
1052
+ }
1053
+ this.$nextTick(() => {
1054
+ this.$refs.tree.setCheckedNodes(this.selectData);
1055
+ });
1056
+ this.$emit("loaded");
1057
+ },
1058
+ },
1059
+ };
1060
+ </script>
1061
+ <style scoped lang="scss">
1062
+ .nstc-unit-search ::v-deep .el-input__validateIcon {
1063
+ display: none !important;
1064
+ }
1065
+ </style>