swordpass-ui 1.0.0

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 (330) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/lib/demo.html +10 -0
  4. package/lib/img/icon_found_img.c785c1b7.png +0 -0
  5. package/lib/sword-vue-ui.common.js +61402 -0
  6. package/lib/sword-vue-ui.css +1 -0
  7. package/lib/sword-vue-ui.umd.js +61412 -0
  8. package/lib/sword-vue-ui.umd.min.js +6 -0
  9. package/package.json +109 -0
  10. package/packages/AddQueryStrategy/index.js +7 -0
  11. package/packages/AddQueryStrategy/src/main.vue +236 -0
  12. package/packages/Autocomplete/index.js +7 -0
  13. package/packages/Autocomplete/src/main.vue +192 -0
  14. package/packages/Button/index.js +7 -0
  15. package/packages/Button/src/main.vue +90 -0
  16. package/packages/Cascader/index.js +7 -0
  17. package/packages/Cascader/src/main.vue +210 -0
  18. package/packages/Chart/index.js +7 -0
  19. package/packages/Chart/src/Chart.vue +831 -0
  20. package/packages/Checkbox/index.js +7 -0
  21. package/packages/Checkbox/src/main.vue +200 -0
  22. package/packages/Collapse/index.js +7 -0
  23. package/packages/Collapse/src/ClCollapse.vue +67 -0
  24. package/packages/Collapse/src/ClCollapseItem.vue +21 -0
  25. package/packages/CollapseItem/index.js +7 -0
  26. package/packages/CustomDialog/index.js +7 -0
  27. package/packages/CustomDialog/src/customDialog.js +99 -0
  28. package/packages/CustomDialog/src/main.vue +1944 -0
  29. package/packages/DataView/index.js +7 -0
  30. package/packages/DataView/src/DataView.vue +45 -0
  31. package/packages/Date/index.js +7 -0
  32. package/packages/Date/src/main.vue +180 -0
  33. package/packages/DatePicker/index.js +7 -0
  34. package/packages/DatePicker/src/main.vue +155 -0
  35. package/packages/Demension/index.js +7 -0
  36. package/packages/Demension/src/main.vue +379 -0
  37. package/packages/Dialog/index.js +7 -0
  38. package/packages/Dialog/src/main.vue +160 -0
  39. package/packages/Dictionary/index.js +7 -0
  40. package/packages/Dictionary/src/main.vue +204 -0
  41. package/packages/DimensionSelector/index.js +7 -0
  42. package/packages/DimensionSelector/src/main.vue +359 -0
  43. package/packages/DimensionSelectorInput/index.js +7 -0
  44. package/packages/DimensionSelectorInput/src/main.vue +79 -0
  45. package/packages/Divider/index.js +7 -0
  46. package/packages/Divider/src/main.vue +38 -0
  47. package/packages/Duration/index.js +7 -0
  48. package/packages/Duration/src/main.vue +172 -0
  49. package/packages/Editor/index.js +7 -0
  50. package/packages/Editor/src/main.vue +280 -0
  51. package/packages/Explain/index.js +7 -0
  52. package/packages/Explain/src/main.vue +55 -0
  53. package/packages/FieldTail/index.js +7 -0
  54. package/packages/FieldTail/src/main.vue +163 -0
  55. package/packages/File/index.js +7 -0
  56. package/packages/File/src/FileCard.vue +169 -0
  57. package/packages/File/src/FileList.vue +180 -0
  58. package/packages/File/src/FileTable.vue +223 -0
  59. package/packages/File/src/main.vue +467 -0
  60. package/packages/FileUpload/index.js +7 -0
  61. package/packages/FileUpload/src/main.vue +222 -0
  62. package/packages/FlowChart/index.js +7 -0
  63. package/packages/FlowChart/src/main.vue +386 -0
  64. package/packages/FormItem/index.js +7 -0
  65. package/packages/FormItem/src/main.vue +167 -0
  66. package/packages/Global/index.js +12 -0
  67. package/packages/Global/src/GlobalQuery.vue +200 -0
  68. package/packages/Global/src/GlobalValidate.vue +69 -0
  69. package/packages/Icon/index.js +7 -0
  70. package/packages/Icon/src/icons/ad.js +14 -0
  71. package/packages/Icon/src/icons/address-book.js +14 -0
  72. package/packages/Icon/src/icons/arrow.js +14 -0
  73. package/packages/Icon/src/icons/attachment.js +18 -0
  74. package/packages/Icon/src/icons/balance.js +14 -0
  75. package/packages/Icon/src/icons/ban.js +14 -0
  76. package/packages/Icon/src/icons/bell.js +14 -0
  77. package/packages/Icon/src/icons/block.js +26 -0
  78. package/packages/Icon/src/icons/book.js +14 -0
  79. package/packages/Icon/src/icons/bookmark.js +14 -0
  80. package/packages/Icon/src/icons/bug.js +22 -0
  81. package/packages/Icon/src/icons/bullhorn.js +14 -0
  82. package/packages/Icon/src/icons/calc.js +14 -0
  83. package/packages/Icon/src/icons/checkbox.js +14 -0
  84. package/packages/Icon/src/icons/circle.js +14 -0
  85. package/packages/Icon/src/icons/close.js +14 -0
  86. package/packages/Icon/src/icons/cloud-sun.js +14 -0
  87. package/packages/Icon/src/icons/coffee.js +14 -0
  88. package/packages/Icon/src/icons/component.js +14 -0
  89. package/packages/Icon/src/icons/compress.js +14 -0
  90. package/packages/Icon/src/icons/copyright.js +14 -0
  91. package/packages/Icon/src/icons/dialog.js +14 -0
  92. package/packages/Icon/src/icons/download.js +14 -0
  93. package/packages/Icon/src/icons/duration.js +14 -0
  94. package/packages/Icon/src/icons/excel.js +18 -0
  95. package/packages/Icon/src/icons/expand.js +14 -0
  96. package/packages/Icon/src/icons/export.js +21 -0
  97. package/packages/Icon/src/icons/eye-slash.js +14 -0
  98. package/packages/Icon/src/icons/eye.js +14 -0
  99. package/packages/Icon/src/icons/file.js +18 -0
  100. package/packages/Icon/src/icons/form.js +14 -0
  101. package/packages/Icon/src/icons/ganged.js +14 -0
  102. package/packages/Icon/src/icons/gaode.js +27 -0
  103. package/packages/Icon/src/icons/gift.js +14 -0
  104. package/packages/Icon/src/icons/home.js +14 -0
  105. package/packages/Icon/src/icons/image.js +14 -0
  106. package/packages/Icon/src/icons/import.js +18 -0
  107. package/packages/Icon/src/icons/index.js +67 -0
  108. package/packages/Icon/src/icons/info.js +21 -0
  109. package/packages/Icon/src/icons/laptop.js +14 -0
  110. package/packages/Icon/src/icons/line.js +34 -0
  111. package/packages/Icon/src/icons/lock.js +14 -0
  112. package/packages/Icon/src/icons/map.js +18 -0
  113. package/packages/Icon/src/icons/more.js +19 -0
  114. package/packages/Icon/src/icons/move.js +14 -0
  115. package/packages/Icon/src/icons/org.js +18 -0
  116. package/packages/Icon/src/icons/palette.js +14 -0
  117. package/packages/Icon/src/icons/plan.js +17 -0
  118. package/packages/Icon/src/icons/ppt.js +18 -0
  119. package/packages/Icon/src/icons/question.js +18 -0
  120. package/packages/Icon/src/icons/radio.js +14 -0
  121. package/packages/Icon/src/icons/refresh.js +14 -0
  122. package/packages/Icon/src/icons/search.js +14 -0
  123. package/packages/Icon/src/icons/select.js +14 -0
  124. package/packages/Icon/src/icons/setting.js +18 -0
  125. package/packages/Icon/src/icons/simple-collapse.js +18 -0
  126. package/packages/Icon/src/icons/simple-expand.js +14 -0
  127. package/packages/Icon/src/icons/sort.js +22 -0
  128. package/packages/Icon/src/icons/sword.js +26 -0
  129. package/packages/Icon/src/icons/table.js +14 -0
  130. package/packages/Icon/src/icons/time.js +14 -0
  131. package/packages/Icon/src/icons/tree.js +14 -0
  132. package/packages/Icon/src/icons/typography.js +18 -0
  133. package/packages/Icon/src/icons/upload.js +18 -0
  134. package/packages/Icon/src/icons/user.js +14 -0
  135. package/packages/Icon/src/icons/users.js +30 -0
  136. package/packages/Icon/src/icons/video.js +14 -0
  137. package/packages/Icon/src/icons/word.js +18 -0
  138. package/packages/Icon/src/main.vue +432 -0
  139. package/packages/Image/index.js +7 -0
  140. package/packages/Image/src/main.vue +66 -0
  141. package/packages/Input/index.js +7 -0
  142. package/packages/Input/src/main.vue +552 -0
  143. package/packages/JobSelector/index.js +7 -0
  144. package/packages/JobSelector/src/main.vue +339 -0
  145. package/packages/JobSelectorInput/index.js +7 -0
  146. package/packages/JobSelectorInput/src/main.vue +87 -0
  147. package/packages/Map/index.js +7 -0
  148. package/packages/Map/src/Map.vue +427 -0
  149. package/packages/Milepost/index.js +7 -0
  150. package/packages/Milepost/src/main.vue +45 -0
  151. package/packages/OnlineForm/index.js +7 -0
  152. package/packages/OnlineForm/src/Form.vue +359 -0
  153. package/packages/OrgPostDialog/index.js +7 -0
  154. package/packages/OrgPostDialog/src/main.vue +244 -0
  155. package/packages/OrgSelector/index.js +7 -0
  156. package/packages/OrgSelector/src/main.vue +493 -0
  157. package/packages/OrgSelectorInput/index.js +7 -0
  158. package/packages/OrgSelectorInput/src/OrgSelectorInput.vue +216 -0
  159. package/packages/PostSelector/index.js +7 -0
  160. package/packages/PostSelector/src/main.vue +463 -0
  161. package/packages/PostSelectorInput/index.js +7 -0
  162. package/packages/PostSelectorInput/src/PostSelectorInput.vue +200 -0
  163. package/packages/Preview/index.js +7 -0
  164. package/packages/Preview/src/FillPage.vue +311 -0
  165. package/packages/Preview/src/FrameViewer.vue +135 -0
  166. package/packages/Preview/src/Loading.vue +126 -0
  167. package/packages/Preview/src/PdfViewer.vue +125 -0
  168. package/packages/Preview/src/TextViewer.vue +99 -0
  169. package/packages/Preview/src/main.vue +242 -0
  170. package/packages/Preview/src/watermark.js +124 -0
  171. package/packages/ProcessRecord/index.js +7 -0
  172. package/packages/ProcessRecord/src/main.vue +392 -0
  173. package/packages/Qrcode/index.js +7 -0
  174. package/packages/Qrcode/src/Qrcode.vue +105 -0
  175. package/packages/QuerySqlPreview/index.js +7 -0
  176. package/packages/QuerySqlPreview/src/QuerySqlPreview.vue +163 -0
  177. package/packages/Radio/index.js +7 -0
  178. package/packages/Radio/src/main.vue +172 -0
  179. package/packages/Rate/index.js +7 -0
  180. package/packages/Rate/src/main.vue +89 -0
  181. package/packages/ReadonlyInput/index.js +7 -0
  182. package/packages/ReadonlyInput/src/main.vue +92 -0
  183. package/packages/RelevantFlow/index.js +7 -0
  184. package/packages/RelevantFlow/src/main.vue +547 -0
  185. package/packages/RelevantFlow/src/relevantFlow.js +28 -0
  186. package/packages/RoleSelector/index.js +7 -0
  187. package/packages/RoleSelector/src/main.vue +358 -0
  188. package/packages/RoleSelectorInput/index.js +7 -0
  189. package/packages/RoleSelectorInput/src/main.vue +84 -0
  190. package/packages/SaveButton/index.js +7 -0
  191. package/packages/SaveButton/src/main.vue +73 -0
  192. package/packages/Select/index.js +7 -0
  193. package/packages/Select/src/main.vue +330 -0
  194. package/packages/SelectTree/index.js +7 -0
  195. package/packages/SelectTree/src/SelectTree.vue +352 -0
  196. package/packages/Selector/index.js +7 -0
  197. package/packages/Selector/src/main.vue +617 -0
  198. package/packages/SidebarDialog/index.js +7 -0
  199. package/packages/SidebarDialog/src/main.vue +156 -0
  200. package/packages/Slider/index.js +7 -0
  201. package/packages/Slider/src/main.vue +84 -0
  202. package/packages/Step/index.js +7 -0
  203. package/packages/StepLayout/index.js +7 -0
  204. package/packages/Steps/index.js +7 -0
  205. package/packages/Steps/src/Step.vue +122 -0
  206. package/packages/Steps/src/StepLayout.vue +35 -0
  207. package/packages/Steps/src/Steps.vue +65 -0
  208. package/packages/Subtable/index.js +33 -0
  209. package/packages/Subtable/src/SubDialog.vue +1926 -0
  210. package/packages/Subtable/src/SubExportDialog.vue +115 -0
  211. package/packages/Subtable/src/SubImportDialog.vue +316 -0
  212. package/packages/Subtable/src/SubPagination.vue +112 -0
  213. package/packages/Subtable/src/SubtableBackfill.vue +83 -0
  214. package/packages/Subtable/src/dialog.js +42 -0
  215. package/packages/Switch/index.js +7 -0
  216. package/packages/Switch/src/main.vue +83 -0
  217. package/packages/Table/index.js +7 -0
  218. package/packages/Table/src/CustomColumn.vue +351 -0
  219. package/packages/Table/src/Table.vue +979 -0
  220. package/packages/TableColumn/index.js +7 -0
  221. package/packages/TableColumn/src/main.vue +177 -0
  222. package/packages/TableSearchField/index.js +7 -0
  223. package/packages/TableSearchField/src/main.vue +334 -0
  224. package/packages/TableSearchPanel/index.js +7 -0
  225. package/packages/TableSearchPanel/src/main.vue +149 -0
  226. package/packages/Tabs/index.js +7 -0
  227. package/packages/Tabs/src/Tabs.vue +140 -0
  228. package/packages/Tag/index.js +7 -0
  229. package/packages/Tag/src/main.vue +264 -0
  230. package/packages/TemplateBatchUpdate/index.js +7 -0
  231. package/packages/TemplateBatchUpdate/src/TemplateBatchUpdateDialog.vue +174 -0
  232. package/packages/TemplateForm/index.js +7 -0
  233. package/packages/TemplateForm/src/main.vue +645 -0
  234. package/packages/TemplateFormDialog/index.js +7 -0
  235. package/packages/TemplateFormDialog/src/main.vue +61 -0
  236. package/packages/TemplateImportResult/index.js +7 -0
  237. package/packages/TemplateImportResult/src/main.vue +158 -0
  238. package/packages/TemplatePreview/index.js +19 -0
  239. package/packages/TemplatePreview/src/TemplatePreview.vue +169 -0
  240. package/packages/TemplatePreview/src/TemplatePreviewFile.vue +171 -0
  241. package/packages/TemplatePreview/src/TemplatePreviewImage.vue +83 -0
  242. package/packages/TemplateTaskCirculate/index.js +7 -0
  243. package/packages/TemplateTaskCirculate/src/main.vue +238 -0
  244. package/packages/Text/index.js +7 -0
  245. package/packages/Text/src/main.vue +57 -0
  246. package/packages/TimePicker/index.js +7 -0
  247. package/packages/TimePicker/src/main.vue +139 -0
  248. package/packages/TimeSelect/index.js +7 -0
  249. package/packages/TimeSelect/src/main.vue +96 -0
  250. package/packages/Tree/index.js +7 -0
  251. package/packages/Tree/src/main.vue +439 -0
  252. package/packages/TreeDialog/index.js +7 -0
  253. package/packages/TreeDialog/src/main.vue +293 -0
  254. package/packages/TreeListDialog/index.js +7 -0
  255. package/packages/TreeListDialog/src/main.vue +219 -0
  256. package/packages/Typography/index.js +8 -0
  257. package/packages/Typography/src/create-header.js +72 -0
  258. package/packages/UserDialog/index.js +7 -0
  259. package/packages/UserDialog/src/main.vue +250 -0
  260. package/packages/UserSelector/index.js +7 -0
  261. package/packages/UserSelector/src/main.vue +746 -0
  262. package/packages/UserSelectorInput/index.js +7 -0
  263. package/packages/UserSelectorInput/src/main.vue +319 -0
  264. package/packages/picture/index.js +7 -0
  265. package/packages/picture/src/main.vue +530 -0
  266. package/packages/plugins/Echarts.js +30 -0
  267. package/packages/plugins/Map.js +29 -0
  268. package/packages/plugins/Preview.js +49 -0
  269. package/packages/plugins/Qrcode.js +7 -0
  270. package/packages/plugins/XLSX.js +7 -0
  271. package/packages/plugins/wangeditor.js +19 -0
  272. package/src/assets/icon_found_img.png +0 -0
  273. package/src/assets/table-no-data.png +0 -0
  274. package/src/directive/badge.js +53 -0
  275. package/src/directive/copy.js +47 -0
  276. package/src/directive/ellipsis.js +6 -0
  277. package/src/directive/expandClick.js +23 -0
  278. package/src/directive/express.js +86 -0
  279. package/src/directive/form.js +122 -0
  280. package/src/directive/format.js +24 -0
  281. package/src/directive/formulas.js +708 -0
  282. package/src/directive/index.js +42 -0
  283. package/src/directive/permissionLine.js +59 -0
  284. package/src/directive/permissionLineLable.js +56 -0
  285. package/src/directive/permit.js +23 -0
  286. package/src/directive/popconfirm.js +86 -0
  287. package/src/directive/relatedQuery.js +61 -0
  288. package/src/directive/resize.js +18 -0
  289. package/src/directive/subSort.js +18 -0
  290. package/src/directive/tableDrag.js +25 -0
  291. package/src/directive/tooltip.js +37 -0
  292. package/src/filter/computerSize.js +23 -0
  293. package/src/filter/dateFormat.js +10 -0
  294. package/src/filter/index.js +10 -0
  295. package/src/index.js +267 -0
  296. package/src/locale/format.js +44 -0
  297. package/src/locale/index.js +48 -0
  298. package/src/locale/lang/en.js +59 -0
  299. package/src/locale/lang/zh-CN.js +58 -0
  300. package/src/locale/lang/zh-TW.js +57 -0
  301. package/src/locale/validate/dict.js +223 -0
  302. package/src/math.js +270 -0
  303. package/src/mixins/emitter.js +33 -0
  304. package/src/mixins/form.js +25 -0
  305. package/src/mixins/formDataUpdate.js +32 -0
  306. package/src/mixins/ganged.js +126 -0
  307. package/src/mixins/inputName.js +30 -0
  308. package/src/mixins/linkage.js +403 -0
  309. package/src/mixins/locale.js +9 -0
  310. package/src/mixins/mobileMode.js +27 -0
  311. package/src/mixins/onlineHottable.js +105 -0
  312. package/src/mixins/onlineSubtable.js +468 -0
  313. package/src/mixins/permission.js +84 -0
  314. package/src/mixins/querySqlPreview.js +747 -0
  315. package/src/mixins/regionValidator.js +70 -0
  316. package/src/mixins/script.js +35 -0
  317. package/src/mixins/templatePreview.js +3673 -0
  318. package/src/service.js +336 -0
  319. package/src/services/CustomQuery.js +199 -0
  320. package/src/services/SubPagination.js +132 -0
  321. package/src/styles/index.scss +7 -0
  322. package/src/styles/selector.scss +127 -0
  323. package/src/styles/variables.scss +71 -0
  324. package/src/util/base64.js +21 -0
  325. package/src/util/brower.js +15 -0
  326. package/src/util/clone.js +61 -0
  327. package/src/util/path.js +4 -0
  328. package/src/util/request.js +14 -0
  329. package/src/utils.js +1205 -0
  330. package/src/validate.js +184 -0
@@ -0,0 +1,1926 @@
1
+ <template>
2
+ <div class="inputs" :style="{ display: 'inline-block', float: 'right' }">
3
+ <el-button
4
+ v-if="isShow || initFillData == 'true'"
5
+ type="text"
6
+ size="mini"
7
+ class="custom-dialog-btn"
8
+ @click="showDialog"
9
+ >
10
+ <i
11
+ style="line-height: 10px"
12
+ :class="
13
+ custdialog.icon
14
+ ? 'el-input__icon ' + custdialog.icon
15
+ : 'el-input__icon icon-department'
16
+ "
17
+ class="custom-dialog-icon"
18
+ ></i>
19
+ {{ custdialog.name }}
20
+ </el-button>
21
+
22
+ <el-dialog
23
+ :visible.sync="customDialogShowList"
24
+ :title="customDialog.name"
25
+ :close-on-click-modal="false"
26
+ :before-close="dialogCancel"
27
+ append-to-body
28
+ top="6vh"
29
+ width="60%"
30
+ @opened="afterOpen"
31
+ >
32
+ <el-container :style="style" style="overflow: auto">
33
+ <!-- 组合对话框树 -->
34
+ <el-aside
35
+ v-if="customDialog.style == 2"
36
+ v-show="treeShow"
37
+ style="width: 23%"
38
+ >
39
+ <el-card>
40
+ <div slot="header" class="clearfix">
41
+ <span style="font-size: 16px">{{ leftTreeTitle }}</span>
42
+ </div>
43
+ <el-tree
44
+ ref="combinationTree"
45
+ :data="combinationTreeData"
46
+ :props="defaultProps"
47
+ :node-key="nodeKey"
48
+ highlight-current
49
+ :check-on-click-node="true"
50
+ lazy
51
+ :load="loadTree"
52
+ @node-click="combiTreeClick"
53
+ ></el-tree>
54
+ </el-card>
55
+ </el-aside>
56
+ <el-divider
57
+ v-if="customDialog.style == 2"
58
+ direction="vertical"
59
+ ></el-divider>
60
+ <el-container>
61
+ <el-header v-if="querysShow" class="middle-header">
62
+ <div
63
+ v-for="(condition, index) in conditionBind"
64
+ :key="index"
65
+ class="search-item"
66
+ >
67
+ <p style="font-size: 14px">{{ condition.comment }}:</p>
68
+ <div v-if="condition.controllerType == '1'">
69
+ <el-input
70
+ v-model="queryParams[condition.field]"
71
+ size="small"
72
+ style="width: 180px; padding: 10px 0; margin: 0 5px 0 5px"
73
+ clearable
74
+ :placeholder="placeholders[index]"
75
+ prefix-icon="el-icon-search"
76
+ @keyup.enter.native="searchEnterFun"
77
+ ></el-input>
78
+ </div>
79
+ <div
80
+ v-if="condition.controllerType == '2'"
81
+ style="margin-right: 10px"
82
+ >
83
+ <el-radio
84
+ v-for="(itemR, $index1) in condition.config.options"
85
+ :key="$index1"
86
+ v-model="queryParams[condition.field]"
87
+ :label="itemR.key"
88
+ >
89
+ {{ itemR.value }}
90
+ </el-radio>
91
+ </div>
92
+ <div
93
+ v-if="condition.controllerType == '3'"
94
+ style="margin-right: 10px"
95
+ >
96
+ <cl-select
97
+ v-if="condition.config.choiceType == 'static'"
98
+ v-model="queryParams[condition.field]"
99
+ :placeholder="quickSearch"
100
+ :options="condition.config.options"
101
+ ></cl-select>
102
+ <cl-select
103
+ v-else
104
+ v-model="queryParams[condition.field]"
105
+ :placeholder="quickSearch"
106
+ :ganged="{
107
+ alias: condition.config.customQuery.alias,
108
+ valueBind: condition.config.customQuery.valueBind,
109
+ noInit: '',
110
+ labelBind: condition.config.customQuery.labelBind,
111
+ gangedBind: '{}',
112
+ bind: condition.config.bind,
113
+ }"
114
+ :multiple="false"
115
+ :filterable="false"
116
+ :allow-create="false"
117
+ :selectlist="[]"
118
+ :query-params="queryParams"
119
+ />
120
+ </div>
121
+ <div
122
+ v-if="condition.controllerType == '4'"
123
+ style="margin-right: 10px"
124
+ >
125
+ <cl-tag
126
+ v-model="queryParams[condition.field]"
127
+ :tag-key="condition.config.tag"
128
+ :placeholder="quickSearch"
129
+ :filterable="condition.config.filterable"
130
+ :expand="condition.config.expand"
131
+ />
132
+ </div>
133
+ </div>
134
+ <div class="btn-wrap">
135
+ <el-button
136
+ style="margin-left: 20px"
137
+ size="small"
138
+ type="primary"
139
+ icon="el-icon-search"
140
+ @click="search(true)"
141
+ >
142
+ 查询
143
+ </el-button>
144
+ <el-button size="small" icon="el-icon-refresh" @click="reset">
145
+ 重置
146
+ </el-button>
147
+ </div>
148
+ </el-header>
149
+ <el-main style="padding: 0 20 0 20">
150
+ <el-table
151
+ ref="orgTable"
152
+ :data="dialogData"
153
+ stripe
154
+ border
155
+ class="org-table"
156
+ size="medium"
157
+ style="width: 100%"
158
+ max-height="600px"
159
+ @row-click="orgRowClick"
160
+ @selection-change="orgTableSelection"
161
+ @select="onTableSelect"
162
+ @select-all="selectAll"
163
+ >
164
+ <el-table-column
165
+ v-if="customDialog.selectNum != 1"
166
+ type="selection"
167
+ align="center"
168
+ width="45"
169
+ ></el-table-column>
170
+ <el-table-column
171
+ v-if="customDialog.selectNum === 1"
172
+ align="center"
173
+ width="50"
174
+ >
175
+ <template slot-scope="scope">
176
+ <el-radio
177
+ v-model="undefineda"
178
+ :label="scope.$index"
179
+ class="textRadio"
180
+ @selection-change="orgTableSelection"
181
+ ></el-radio>
182
+ </template>
183
+ </el-table-column>
184
+ <el-table-column
185
+ type="index"
186
+ width="50"
187
+ align="center"
188
+ label="序号"
189
+ ></el-table-column>
190
+ <el-table-column
191
+ v-for="field in displayfield"
192
+ :key="field.field"
193
+ :show-overflow-tooltip="true"
194
+ :prop="field.field"
195
+ :label="field.comment"
196
+ style="width: 100%"
197
+ ></el-table-column>
198
+ </el-table>
199
+ </el-main>
200
+ <el-footer>
201
+ <el-row
202
+ v-if="customDialog.needPage"
203
+ type="flex"
204
+ justify="end"
205
+ style="padding-top: 15px; justify-content: space-between"
206
+ >
207
+ <el-button
208
+ v-if="customDialog.style == 2"
209
+ :icon="toggleBtn"
210
+ size="mini"
211
+ type="default"
212
+ @click="toggleTree"
213
+ ></el-button>
214
+ <el-pagination
215
+ small
216
+ :current-page="pagination.page"
217
+ :page-sizes="[10, 20, 50, 100]"
218
+ :page-size="pagination.pageSize"
219
+ layout="total, sizes, prev, pager, next, jumper"
220
+ :total="total"
221
+ @size-change="handleSizeChange"
222
+ @current-change="handleCurrentChange"
223
+ ></el-pagination>
224
+ </el-row>
225
+ </el-footer>
226
+ </el-container>
227
+ </el-container>
228
+ <span slot="footer" class="dialog-footer" style="text-align: center">
229
+ <el-button size="small" type="primary" @click="dialogConfirm">
230
+ 确认
231
+ </el-button>
232
+ <el-button size="small" @click="dialogCancel">取 消</el-button>
233
+ </span>
234
+ </el-dialog>
235
+
236
+ <el-dialog
237
+ :visible.sync="customDialogShowTree"
238
+ :title="customDialog.name"
239
+ :close-on-click-modal="false"
240
+ :before-close="dialogCancelTree"
241
+ append-to-body
242
+ top="6vh"
243
+ width="40%"
244
+ >
245
+ <el-container :style="style" style="overflow: auto">
246
+ <el-tree
247
+ ref="tree"
248
+ :data="props1"
249
+ :props="defaultProps"
250
+ :node-key="nodeKey"
251
+ highlight-current
252
+ :show-checkbox="customDialog.selectNum === -1"
253
+ :check-on-click-node="true"
254
+ :check-strictly="false"
255
+ lazy
256
+ :load="loadTree"
257
+ @node-click="treeClick"
258
+ @check-change="getChecked"
259
+ ></el-tree>
260
+ </el-container>
261
+ <span slot="footer" class="dialog-footer" style="text-align: center">
262
+ <el-button size="small" type="primary" @click="dialogTreeConfirm">
263
+ 确认
264
+ </el-button>
265
+ <el-button size="small" @click="dialogCancelTree">取 消</el-button>
266
+ </span>
267
+ </el-dialog>
268
+ </div>
269
+ </template>
270
+ <script>
271
+ import { Message } from 'element-ui'
272
+ import utils from '@/utils.js'
273
+ import dialog from './dialog.js'
274
+ import _ from 'lodash'
275
+
276
+ export default {
277
+ name: 'ClSubDialog',
278
+ mixins: [dialog],
279
+ props: {
280
+ custdialog: {
281
+ type: Object,
282
+ default: () => {
283
+ return {}
284
+ },
285
+ },
286
+ initFillData: String,
287
+ initFillDataType: String,
288
+ relation: String,
289
+ maxRow: Number,
290
+ },
291
+ data() {
292
+ return {
293
+ quickSearch: '', //填写提示
294
+ conditionBind: [], //参数查询字段
295
+ nodeKey: 'ID_', //树形数据父Id
296
+ customDialogShowList: false,
297
+ customDialogShowTree: false,
298
+ style: '', //对话框宽高
299
+ selectOrgs: null,
300
+ config: null,
301
+ displayfield: [], //显示字段
302
+ customDialog: {},
303
+ queryParam: '', //查询条件输入的值
304
+ props1: [],
305
+ showData: [],
306
+ checkBoxDataAll: [], //选中对象的集合
307
+ defaultProps: {
308
+ children: 'children',
309
+ label: 'label',
310
+ },
311
+ propsData: [],
312
+ querysShow: false, //是否显示搜索框
313
+ undefineda: '',
314
+ isCurrentChange: false, //是否不执行 orgTableSelection方法
315
+ pagination: {
316
+ page: 1,
317
+ pageSize: 10,
318
+ total: 0,
319
+ },
320
+ param: [], //绑定的表单字段
321
+ treeList: [],
322
+ displayField: {},
323
+ queryParams: [],
324
+ placeholders: [],
325
+ oldselectOrgs: [],
326
+ combinationTreeData: [],
327
+ combiTreeDisplayField: [],
328
+ combinationTreeQuerys: [],
329
+ combinationRule: {},
330
+ toggleBtn: 'el-icon-arrow-left',
331
+ treeShow: true,
332
+ transtionWidth: '25%',
333
+ leftTreeTitle: '',
334
+ isShow: true,
335
+ }
336
+ },
337
+ watch: {
338
+ props1: function () {
339
+ //树形
340
+ if (this.showData != undefined && this.showData.length > 0) {
341
+ const this_ = this
342
+ let data = []
343
+ for (let i = 0; i < this.showData.length; i++) {
344
+ data.push(this.showData[i])
345
+ }
346
+ setTimeout(() => {
347
+ for (let i = 0; i < data.length; i++) {
348
+ this_.$refs.tree.setChecked(data[i], true)
349
+ this_.checkNode(data[i], this_)
350
+ }
351
+ }, 200)
352
+ }
353
+ },
354
+ },
355
+ mounted() {
356
+ let requestType = window.location.href.split('?')[0].split('/')
357
+ let isDoneList = window.location.href.split('/')
358
+ if (
359
+ requestType[requestType.length - 1] == 'get' ||
360
+ requestType[requestType.length - 2] == 'get' ||
361
+ isDoneList[isDoneList.length - 1] == 'doneList'
362
+ ) {
363
+ this.isShow = false
364
+ }
365
+ if (this.initFillData == 'true') {
366
+ this.initTemplateData()
367
+ }
368
+ },
369
+ methods: {
370
+ selectAll(selection) {
371
+ if (this.oldselectOrgs != null && selection.length > 0) {
372
+ for (let x = 0; x < selection.length; x++) {
373
+ if (this.indexArray(this.oldselectOrgs, selection[x]) === -1) {
374
+ this.oldselectOrgs.push(selection[x])
375
+ }
376
+ }
377
+ this.selectOrgs = _.cloneDeep(this.oldselectOrgs)
378
+ } else {
379
+ this.selectOrgs = _.cloneDeep(selection)
380
+ }
381
+ },
382
+ checkNode(data, this_, pnode) {
383
+ if (data.Pid) {
384
+ let node = this_.$refs.tree.getNode(data.Pid)
385
+ node.indeterminate = true
386
+ if (node.data.Pid) {
387
+ this_.$refs.tree.getNode(node.data.Pid).indeterminate = true
388
+ this.checkNode(
389
+ this_.$refs.tree.getNode(node.data.Pid).data,
390
+ this_,
391
+ this_.$refs.tree.getNode(node.data.Pid)
392
+ )
393
+ }
394
+ if (!node.indeterminate) {
395
+ node.indeterminate = true
396
+ }
397
+ } else if (pnode && !pnode.indeterminate) {
398
+ pnode.indeterminate = true
399
+ }
400
+ },
401
+ //回车查询
402
+ searchEnterFun: function (e) {
403
+ var keyCode = window.event ? e.keyCode : e.which
404
+ if (keyCode == 13) {
405
+ this.search()
406
+ }
407
+ },
408
+ handleSizeChange: function (size) {
409
+ this.isCurrentChange = true
410
+ //每页下拉显示数据
411
+ this.pagination.pageSize = size
412
+ this.search()
413
+ },
414
+ handleCurrentChange: function (currentPage) {
415
+ const this_ = this
416
+ if (this.selectOrgs != undefined && this.selectOrgs.length > 0) {
417
+ this.selectOrgs.forEach((row) => {
418
+ let res = this_.indexArray(this_.checkBoxDataAll, row)
419
+ if (res == -1) {
420
+ this_.checkBoxDataAll.push(row)
421
+ }
422
+ })
423
+ }
424
+ this.isCurrentChange = true
425
+ //点击第几页
426
+ this.pagination.page = currentPage
427
+ this.search()
428
+ },
429
+ checkList() {
430
+ const this_ = this
431
+ setTimeout(() => {
432
+ //列表
433
+ if (
434
+ this_.checkBoxDataAll != undefined &&
435
+ this_.checkBoxDataAll.length > 0
436
+ ) {
437
+ this_.checkBoxDataAll.forEach((row) => {
438
+ let res = this_.indexArray(this_.dialogData, row)
439
+ this_.undefineda = res
440
+ if (res != -1) {
441
+ this_.isCurrentChange = true
442
+ this_.toggleRowSelection(res, true)
443
+ }
444
+ })
445
+ }
446
+ }, 300)
447
+ },
448
+ toggleRowSelection(res, val) {
449
+ this.$refs.orgTable.toggleRowSelection(this.dialogData[res], val)
450
+ },
451
+ showDialog() {
452
+ const this_ = this
453
+ //第二次点击子表回填对话框 第一次选中的数据不是选中状态
454
+ if (this_.selectOrgs) {
455
+ this_.selectOrgs.splice(0, this_.selectOrgs.length)
456
+ this_.checkBoxDataAll.splice(0, this_.checkBoxDataAll.length)
457
+ }
458
+ var alias = this.custdialog.custDialog.alias
459
+ this.getDialogByAlias(alias).then((customDialog) => {
460
+ if (!customDialog || !customDialog.alias) {
461
+ Message.error('对话框别名【' + alias + '】不存在!')
462
+ return
463
+ }
464
+ if (customDialog.style == 1) {
465
+ var displaylist = JSON.parse(customDialog.displayfield)
466
+ this_.nodeKey = displaylist.id
467
+ }
468
+ //对话框按表单字段查询(参数传入的)
469
+ let bindList = this_.custdialog.custDialog.conditions
470
+ this_.param = [] //绑定的表单字段
471
+ if (bindList.length > 0) {
472
+ bindList.forEach((ele) => {
473
+ //绑定表单字段
474
+ if (ele.defaultType == '3' && ele.bind) {
475
+ let obj = {}
476
+ obj.field = ele.field
477
+ obj.bind = ele.bind
478
+ this_.param.push(obj)
479
+ }
480
+ })
481
+ }
482
+ //判断对话框查询是否有条件
483
+ let userInputList = JSON.parse(customDialog.conditionfield)
484
+ this_.quickSearch = '' //填写提示 placeholder
485
+ this_.conditionBind = []
486
+ let queryParams = []
487
+ let placeholders = []
488
+ if (userInputList.length > 0) {
489
+ userInputList.forEach((ele) => {
490
+ var obj = {}
491
+ //条件查询参数(用户输入的) 文本框输入
492
+ if (ele.defaultType == '1') {
493
+ obj[ele.field] = ''
494
+ queryParams.push(obj)
495
+ this_.conditionBind.push(ele)
496
+ placeholders.push('请输入' + ele.comment)
497
+ }
498
+ })
499
+ this.$set(this, 'queryParams', queryParams)
500
+ this.$set(this, 'placeholders', placeholders)
501
+ }
502
+ //判断是否显示条件查询输入框
503
+ if (this_.quickSearch != '') {
504
+ this_.querysShow = true
505
+ } else {
506
+ this_.querysShow = true
507
+ }
508
+ this_.quickSearch = '请输入' + this.quickSearch + '查询'
509
+ this_.style = 'height:' + customDialog.height + 'px'
510
+ if (window.screen.height && window.screen.height <= 900) {
511
+ this.style = 'height:440px'
512
+ }
513
+ if (customDialog.style == 0 || customDialog.style == 2) {
514
+ //列表
515
+ this_.customDialogShow({ alias: alias, customDialog: customDialog })
516
+ } else if (customDialog.style == 1) {
517
+ //树形
518
+ this_.pageParam = { alias: alias, customDialog: customDialog }
519
+ this_.customDialog = customDialog
520
+ let param = {}
521
+ this_.conditionfieldTree = []
522
+ //判断是否存在条件
523
+ if (customDialog.conditionfield) {
524
+ this_.conditionfieldTree = JSON.parse(customDialog.conditionfield)
525
+ if (this_.conditionfieldTree.length > 0) {
526
+ for (let i = this_.conditionfieldTree.length - 1; i >= 0; i--) {
527
+ //判断条件字段是否是动态传入(defaultType:4:动态传入,2:固定值 )
528
+ if (this_.conditionfieldTree[i].defaultType == '4') {
529
+ param[this_.conditionfieldTree[i].field] =
530
+ this_.conditionfieldTree[i].comment
531
+ }
532
+ }
533
+ }
534
+ }
535
+ //有动态传入的字段
536
+ if (JSON.stringify(param) != '{}') {
537
+ this_.dialogVisible = true
538
+ } else {
539
+ //无动态传入的字段
540
+ this_.customDialogTreeShow(this_.pageParam)
541
+ }
542
+ }
543
+ })
544
+ },
545
+ //判断数据是否包含某个对象,并返回数据包含对象的下标
546
+ indexArray(array, item) {
547
+ if (array.length == 0) {
548
+ return -1
549
+ }
550
+ for (let i = 0; i < array.length; i++) {
551
+ if (JSON.stringify(array[i]) == JSON.stringify(item)) {
552
+ return i
553
+ }
554
+ }
555
+ return -1
556
+ },
557
+ //点击列表某一个复选框时触发
558
+ onTableSelect(rows, row) {
559
+ this.isCurrentChange = false
560
+ //判断点击列表数据时复选框是否勾选 selected:true不勾选,false勾选
561
+ let selected =
562
+ this.selectOrgs &&
563
+ this.selectOrgs.length > 0 &&
564
+ this.indexArray(this.selectOrgs, row) !== -1
565
+ if (selected) {
566
+ this.isCurrentChange = true
567
+ let res = this.indexArray(this.selectOrgs, row)
568
+ this.selectOrgs.splice(res, 1)
569
+ }
570
+ },
571
+ //点击列表某一条数据时触发
572
+ orgRowClick(row, column, event) {
573
+ if (this.customDialog.selectNum === 1) {
574
+ event.currentTarget &&
575
+ event.currentTarget.children[0] &&
576
+ event.currentTarget.children[0].children[0] &&
577
+ event.currentTarget.children[0].children[0].children[0] &&
578
+ event.currentTarget.children[0].children[0].children[0].dispatchEvent(
579
+ new Event('click')
580
+ )
581
+ this.selectOrgs = []
582
+ this.selectOrgs.push(row)
583
+ } else if (this.customDialog.selectNum != 1) {
584
+ this.isCurrentChange = false
585
+ //判断点击列表数据时复选框是否勾选 selected:true不勾选,false勾选
586
+ let selected =
587
+ this.selectOrgs &&
588
+ this.selectOrgs.length > 0 &&
589
+ this.indexArray(this.selectOrgs, row) !== -1
590
+ if (selected) {
591
+ this.isCurrentChange = true
592
+ let res = this.indexArray(this.selectOrgs, row)
593
+ this.selectOrgs.splice(res, 1)
594
+ }
595
+ this.$refs.orgTable.toggleRowSelection(row)
596
+ }
597
+ },
598
+ //列表复选框有改变时触发
599
+ orgTableSelection(selection) {
600
+ //全选的情况特殊处理(为了与原本功能逻辑不冲突,先复制一份旧的选中数据.然后拿到全选事件中去计算)
601
+ this.oldselectOrgs = _.cloneDeep(this.selectOrgs)
602
+ //多选
603
+ if (this.customDialog.selectNum != 1 && !this.isCurrentChange) {
604
+ if (selection && selection.length > 0) {
605
+ if (
606
+ selection.length == 1 &&
607
+ (!this.selectOrgs || this.selectOrgs.length == 0)
608
+ ) {
609
+ this.selectOrgs = selection
610
+ } else if (
611
+ (!this.selectOrgs || this.selectOrgs.length == 0) &&
612
+ selection.length > 1
613
+ ) {
614
+ if (!this.selectOrgs) {
615
+ this.selectOrgs = []
616
+ }
617
+ for (let i = selection.length - 1; i >= 0; i--) {
618
+ this.selectOrgs.push(selection[i])
619
+ }
620
+ } else if (this.isCurrentChange && selection.length >= 10) {
621
+ if (!this.selectOrgs) {
622
+ this.selectOrgs = []
623
+ } else {
624
+ for (let u = this.selectOrgs.length - 1; u >= 0; u--) {
625
+ let res = this.indexArray(selection, this.selectOrgs[u])
626
+ if (res != -1) {
627
+ this.selectOrgs.splice(res, 1)
628
+ }
629
+ }
630
+ }
631
+ for (let i = 0; i < selection.length; i++) {
632
+ this.selectOrgs.push(selection[i])
633
+ }
634
+ } else {
635
+ for (let i = selection.length - 1; i >= 0; i--) {
636
+ this.selectOrgs.push(selection[i])
637
+ break
638
+ }
639
+ }
640
+ }
641
+ }
642
+ },
643
+ dialogConfirm() {
644
+ if (!this.selectOrgs || this.selectOrgs.length == 0) {
645
+ this.$message.error('请选择数据回填')
646
+ return
647
+ }
648
+ this.queryParam = ''
649
+ this.customDialogShowList = false
650
+ this.syncInputValue()
651
+ },
652
+ //重置
653
+ reset() {
654
+ this.queryParams.forEach((paramObj) => {
655
+ for (let key in paramObj) {
656
+ this.queryParams[key] = ''
657
+ }
658
+ })
659
+ //组合树重置
660
+ if (this.$refs.combinationTree) {
661
+ let nodes = this.$refs.combinationTree.store.nodesMap
662
+ for (let key in nodes) {
663
+ nodes[key].expanded = false
664
+ }
665
+ }
666
+ this.combinationTreeQuerys.splice(0)
667
+ this.search(true)
668
+ },
669
+ //查询
670
+ search(resetPagintion) {
671
+ let querys = [] //查询条件
672
+ let queryFilter = {}
673
+ if (JSON.stringify(this.pagination) == '{}') {
674
+ this.pagination = { page: 1, pageSize: 10, showTotal: 'true' }
675
+ }
676
+ let pageBean = { pageBean: this.pagination }
677
+ if (resetPagintion) {
678
+ pageBean.pageBean = { page: 1, pageSize: 10, showTotal: 'true' }
679
+ }
680
+ //用户输入的
681
+ if (this.queryParams.length != 0 && this.queryParams[0] != '') {
682
+ this.conditionBind.forEach((item) => {
683
+ querys.push({
684
+ property: item.field,
685
+ value: this.queryParams[item.field],
686
+ group: 'main',
687
+ operation: 'LIKE',
688
+ relation: 'AND',
689
+ })
690
+ })
691
+ }
692
+ //参数传入的查询拼接
693
+ if (this.param) {
694
+ const pInst = utils.getOnlineFormInstance(this)
695
+ this.param.forEach((item) => {
696
+ querys.push({
697
+ property: item.field,
698
+ value: utils.getValueByPath(pInst, item.bind),
699
+ group: 'main',
700
+ operation: 'LIKE',
701
+ relation: 'AND',
702
+ })
703
+ })
704
+ }
705
+ //来自组合对话框的
706
+ if (
707
+ this.combinationTreeQuerys &&
708
+ this.combinationTreeQuerys.length != 0
709
+ ) {
710
+ for (let i = 0; i < this.combinationTreeQuerys.length; i++) {
711
+ querys.push(this.combinationTreeQuerys[i])
712
+ }
713
+ }
714
+
715
+ if (querys.length > 0) {
716
+ queryFilter = { pageBean: pageBean.pageBean, querys }
717
+ this.customDialog.pageBean = queryFilter
718
+ this.getListJson(this.customDialog).then(() => {
719
+ this.checkList()
720
+ })
721
+ } else {
722
+ this.customDialog.pageBean = pageBean
723
+ this.getListJson(this.customDialog).then(() => {
724
+ this.checkList()
725
+ })
726
+ }
727
+ },
728
+ async doQuery(param) {
729
+ let paramLoadData = []
730
+ const pInst = utils.getOnlineFormInstance(this)
731
+ //获取关联查询绑定的表单参数
732
+ for (let i = 0; i < param.conditionfield.length; i++) {
733
+ if (param.conditionfield[i].fieldPath != '') {
734
+ let bindVal = utils.getValueByPath(
735
+ pInst,
736
+ param.conditionfield[i].fieldPath,
737
+ null
738
+ )
739
+ let obj = { key: param.conditionfield[i].field, value: bindVal }
740
+ paramLoadData.push(obj)
741
+ }
742
+ }
743
+
744
+ let queryUrl =
745
+ param.dsType == 'dataSource'
746
+ ? '${form}/form/customQuery/v1/doQuery?alias=' +
747
+ param.alias +
748
+ '&page=1'
749
+ : param.url
750
+ let requestMethod = 'POST'
751
+ //如果关联数据列表查询数据不是数据源则请求方法为restful配置的请求方式
752
+ if (param.dsType != 'dataSource') {
753
+ requestMethod = param.requestType
754
+ }
755
+ //查询数据
756
+ this.$requestConfig
757
+ .request({
758
+ url: queryUrl,
759
+ method: requestMethod,
760
+ data: paramLoadData,
761
+ })
762
+ .then((res) => {
763
+ //判断是否有关联查询数据返回
764
+ if (res.data.rows.length > 0) {
765
+ //获取关联查询返回的表单参数
766
+ for (let io = 0; io < param.resultfield.length; io++) {
767
+ if (param.resultfield[io].fieldPath != '') {
768
+ let val = ''
769
+ for (let j = 0; j < res.data.rows.length; j++) {
770
+ if (res.data.rows[j][param.resultfield[io].field]) {
771
+ val =
772
+ val + res.data.rows[j][param.resultfield[io].field] + ','
773
+ }
774
+ }
775
+ val = val.substring(0, val.length - 1)
776
+ let pathArr = param.resultfield[io].fieldPath.split('.')
777
+ if (pathArr.length == 3) {
778
+ //主表
779
+ utils.setValueByPath(
780
+ pInst,
781
+ param.resultfield[io].fieldPath,
782
+ val,
783
+ null
784
+ )
785
+ } else if (pathArr.length == 4) {
786
+ //子表
787
+ let subData = pInst.data[pathArr[1]][pathArr[2]]
788
+ if (subData.length == 0) {
789
+ //子表没数据的情况
790
+ let subTabName = pathArr[2].replace('sub_', '')
791
+ //得到子表的所有字段
792
+ let subInitData =
793
+ pInst.data[pathArr[1]].initData[subTabName] || {}
794
+ //把数组里面的值为 null 转换为空字符串
795
+ let str = JSON.stringify(subInitData).replace(/null/g, '""')
796
+ let subData = JSON.parse(str)
797
+ for (var key in subData) {
798
+ //点添加时判断要新增子表记录中的孙表是否有值
799
+ if (key.indexOf('sub_') == 0 && subData[key].length > 0) {
800
+ subData[key] = [] //有则清空
801
+ }
802
+ //点添加时判断要新增子表记录中的字段是否有值
803
+ if (subData[key]) {
804
+ subData[key] = '' //有则清空
805
+ }
806
+ }
807
+ //新增一条数据
808
+ pInst.data[pathArr[1]][pathArr[2]].push(subData)
809
+ //对话框关联查询返回的值赋值给绑定的字段
810
+ utils.setValueByPath(
811
+ pInst,
812
+ param.resultfield[io].fieldPath,
813
+ val,
814
+ 0
815
+ )
816
+ } else {
817
+ //子表有数据的情况
818
+ for (let p = 0; p < subData.length; p++) {
819
+ //对话框关联查询返回的值赋值给绑定的字段
820
+ utils.setValueByPath(
821
+ pInst,
822
+ param.resultfield[io].fieldPath,
823
+ val,
824
+ p
825
+ )
826
+ }
827
+ }
828
+ }
829
+ }
830
+ }
831
+ } else {
832
+ //没有返回的值则清空
833
+ //获取关联查询返回的表单参数
834
+ for (let iop = 0; iop < param.resultfield.length; iop++) {
835
+ if (param.resultfield[iop].fieldPath != '') {
836
+ let pathArr = param.resultfield[iop].fieldPath.split('.')
837
+ if (pathArr.length == 3) {
838
+ //主表
839
+ //赋值给绑定的字段
840
+ utils.setValueByPath(
841
+ pInst,
842
+ param.resultfield[iop].fieldPath,
843
+ '',
844
+ null
845
+ )
846
+ } else if (pathArr.length == 4) {
847
+ //子表
848
+ let subData = pInst.data[pathArr[1]][pathArr[2]]
849
+ for (let p = 0; p < subData.length; p++) {
850
+ //对话框关联查询返回的值赋值给绑定的字段
851
+ utils.setValueByPath(
852
+ pInst,
853
+ param.resultfield[iop].fieldPath,
854
+ '',
855
+ p
856
+ )
857
+ }
858
+ }
859
+ }
860
+ }
861
+ }
862
+ })
863
+ },
864
+ // 同步选择结果
865
+ syncInputValue() {
866
+ var returnStr = JSON.parse(this.customDialog.resultfield)
867
+ //拿到返回的字段
868
+ var field = new Array([returnStr.length])
869
+ var comment = new Array([returnStr.length])
870
+ var str = []
871
+ var ids = []
872
+ for (var i = 0; i < returnStr.length; i++) {
873
+ field[i] =
874
+ this.customDialog.dsType == 'dataSource'
875
+ ? returnStr[i].field.toLowerCase()
876
+ : returnStr[i].field
877
+ comment[i] =
878
+ this.customDialog.dsType == 'dataSource'
879
+ ? returnStr[i].comment.toLowerCase()
880
+ : returnStr[i].comment
881
+ }
882
+ const this_ = this
883
+ this.selectOrgs.forEach((row) => {
884
+ if (this_.checkBoxDataAll || this_.checkBoxDataAll.length < 1) {
885
+ this_.checkBoxDataAll.push(row)
886
+ } else if (
887
+ JSON.stringify(this_.indexArray).indexOf(JSON.stringify(row)) == -1
888
+ ) {
889
+ this_.checkBoxDataAll.push(row)
890
+ }
891
+ })
892
+ var s = this.selectOrgs
893
+
894
+ if (this.customDialog.selectNum === 1) {
895
+ var temp = ''
896
+ for (var ij = 0; ij < comment.length; ij++) {
897
+ let encodeStr = encodeURIComponent(s[0][field[ij]])
898
+ temp += '"' + comment[ij] + '":"' + encodeStr + '",'
899
+ }
900
+ if (temp != '') {
901
+ temp = '{' + temp.substring(0, temp.length - 1) + '}'
902
+ }
903
+ str.push(utils.parseToJson(temp))
904
+ ids.push(s[0].id)
905
+ } else {
906
+ for (var ii = 0; ii < s.length; ii++) {
907
+ var tempp = ''
908
+ for (var j = 0; j < comment.length; j++) {
909
+ let encodeStr = encodeURIComponent(s[ii][field[j]])
910
+ tempp += '"' + comment[j] + '":"' + encodeStr + '",'
911
+ }
912
+ if (tempp != '') {
913
+ tempp = '{' + tempp.substring(0, tempp.length - 1) + '}'
914
+ }
915
+ str.push(utils.parseToJson(tempp))
916
+ ids.push(s[ii].id)
917
+ }
918
+ }
919
+ const returnData = str
920
+ const _this = this
921
+ const formInst = utils.getOnlineFormInstance(this)
922
+ //处理自动回填配置
923
+ this.instId = formInst.$parent.instId
924
+ let custDialog = this.custdialog
925
+ let fillOrg = {}
926
+ if (
927
+ custDialog.orgConfig &&
928
+ custDialog.orgConfig.name &&
929
+ this.fillOrg &&
930
+ this.fillOrg.id
931
+ ) {
932
+ const namePath = custDialog.orgConfig.name.split('.')
933
+ const orgNameField = namePath[namePath.length - 1]
934
+ fillOrg[orgNameField] = this.fillOrg.name
935
+ if (custDialog.orgConfig.id) {
936
+ const idPath = custDialog.orgConfig.id.split('.')
937
+ const orgIdField = idPath[idPath.length - 1]
938
+ fillOrg[orgIdField] = this.fillOrg.id
939
+ }
940
+ if (custDialog.orgConfig.code) {
941
+ const codePath = custDialog.orgConfig.code.split('.')
942
+ const orgCodeField = codePath[codePath.length - 1]
943
+ fillOrg[orgCodeField] = this.fillOrg.code
944
+ }
945
+ }
946
+ if (custDialog.orgConfig && custDialog.orgConfig.instId) {
947
+ const instIdPath = custDialog.orgConfig.instId.split('.')
948
+ const instIdField = instIdPath[instIdPath.length - 1]
949
+ fillOrg[instIdField] = this.instId
950
+ }
951
+ try {
952
+ let returnSize = returnData.length
953
+ //判断是否是一对一子表
954
+ if (_this.relation && _this.relation == 'onetoone') {
955
+ if (returnSize > 1) {
956
+ this_.$message.error('一对一子表只能选择一条数据')
957
+ this_.customDialogShowList = true
958
+ return
959
+ }
960
+ }
961
+ returnData.forEach((row) => {
962
+ var targetArray = null
963
+ var subLineData = {}
964
+ this.custdialog.custDialog.mappingConf.forEach((con) => {
965
+ if (con.target[0]) {
966
+ targetArray = con.target[0].split('.')
967
+ var from = ''
968
+ if (_this.customDialog.dsType == 'restful') {
969
+ from = con.from
970
+ } else {
971
+ from = con.from.toLowerCase()
972
+ }
973
+ if (row[from] == undefined) {
974
+ from = from.toUpperCase()
975
+ }
976
+ const value =
977
+ decodeURIComponent(row[from]) == 'undefined'
978
+ ? ''
979
+ : decodeURIComponent(row[from])
980
+ subLineData[targetArray[targetArray.length - 1]] = value
981
+ }
982
+ })
983
+ if (targetArray) {
984
+ let subBo = null
985
+ let sunBo = null
986
+ // 如果目标路径有4段,则说明是孙表回填
987
+ if (targetArray.length == 4) {
988
+ // 获取子表数据的索引
989
+ const { index } = utils.getSubScopeElAndIndex(_this.$el)
990
+ if (index == null) {
991
+ throw '未获取到子表的当前行索引,无法进行孙表回填.'
992
+ }
993
+ const _subBo = formInst['data'][targetArray[0]][targetArray[1]]
994
+ // 获取孙表数据对象
995
+ sunBo = _subBo[index][targetArray[2]]
996
+ if (!sunBo) {
997
+ sunBo = _subBo[index][targetArray[2]] = []
998
+ }
999
+ }
1000
+ // 否则 是子表回填
1001
+ else {
1002
+ subBo = formInst['data'][targetArray[0]][targetArray[1]]
1003
+ }
1004
+ //判断是否大于子表数据最大行数
1005
+ if (this_.maxRow != 0) {
1006
+ if (subBo && subBo.length + returnSize > this_.maxRow) {
1007
+ this_.$message.error(
1008
+ '子表数据已超过最大行数【' + this_.maxRow + '】'
1009
+ )
1010
+ this_.customDialogShowList = true
1011
+ throw new Error('EndIterative')
1012
+ } else if (sunBo && sunBo.length + returnSize > this_.maxRow) {
1013
+ this_.$message.error(
1014
+ '孙表数据已超过最大行数【' + this_.maxRow + '】'
1015
+ )
1016
+ this_.customDialogShowList = true
1017
+ throw new Error('EndIterative')
1018
+ }
1019
+ }
1020
+ if (subBo) {
1021
+ //子表中的孙表实体(可能存在多个)
1022
+ let sunBos = utils.getSomeAttributeFromParentElement(
1023
+ _this.$el,
1024
+ 'sunBos'
1025
+ )
1026
+ //如果存在孙表实体则手动添加空孙表数组对象
1027
+ if (sunBos) {
1028
+ let arrayBo = sunBos.split(',')
1029
+ for (let i = 0; i < arrayBo.length; i++) {
1030
+ let key = 'sub_' + arrayBo[i]
1031
+ let value = new Array()
1032
+ subLineData[key] = value
1033
+ }
1034
+ }
1035
+ }
1036
+
1037
+ //判断是否是一对一子表
1038
+ if (_this.relation && _this.relation == 'onetoone') {
1039
+ subBo && subBo.splice(0, subBo.length)
1040
+ sunBo && sunBo.splice(0, sunBo.length)
1041
+ }
1042
+ if (fillOrg && JSON.stringify(fillOrg) != '{}') {
1043
+ subLineData = { ...subLineData, ...fillOrg }
1044
+ }
1045
+ subBo && subBo.push(subLineData)
1046
+ sunBo && sunBo.push(subLineData)
1047
+ returnSize--
1048
+ }
1049
+ })
1050
+ } catch (e) {
1051
+ if (e.message != 'EndIterative') throw e
1052
+ }
1053
+ },
1054
+ //取消按钮
1055
+ dialogCancel() {
1056
+ const this_ = this
1057
+ this_.queryParam = ''
1058
+ this_.setListJson([]).then(() => {
1059
+ this_.customDialogShowList = false
1060
+ //判断是否是点击了确认再点击取消的 inputVal没有值则表示直接点击的取消
1061
+ if (!this_.inputVal) {
1062
+ this_.selectOrgs = []
1063
+ } else {
1064
+ this_.selectOrgs = [...this_.showData]
1065
+ this.checkBoxDataAll = [...this_.selectOrgs]
1066
+ }
1067
+ })
1068
+ },
1069
+ dialogTreeConfirm() {
1070
+ const this_ = this
1071
+ if (this_.propsData.length == 0) {
1072
+ this_.$message.error('请选择数据回填')
1073
+ return
1074
+ }
1075
+ this.setListJson([])
1076
+ var returnStr = JSON.parse(this.customDialog.resultfield)
1077
+ var field = new Array([returnStr.length])
1078
+ var comment = new Array([returnStr.length])
1079
+ var str = []
1080
+ for (var i = 0; i < returnStr.length; i++) {
1081
+ field[i] = returnStr[i].field
1082
+ comment[i] = returnStr[i].comment
1083
+ }
1084
+ if (this.customDialog.selectNum === 1) {
1085
+ var nodes = this.propsData[0]
1086
+ var temp = ''
1087
+ for (var ii = 0; ii < comment.length; ii++) {
1088
+ temp += '"' + comment[ii] + '":"' + nodes[field[ii]] + '",'
1089
+ }
1090
+ if (temp != '') {
1091
+ temp = '{' + temp.substring(0, temp.length - 1) + '}'
1092
+ }
1093
+ str.push(utils.parseToJson(temp))
1094
+ } else {
1095
+ var curNodes = this.propsData
1096
+ curNodes.forEach((item, k) => {
1097
+ var temp = ''
1098
+ for (var i = 0; i < comment.length; i++) {
1099
+ temp += '"' + comment[i] + '":"' + curNodes[field[i]] + '",'
1100
+ temp += '"' + comment[i] + '":"' + curNodes[k][field[i]] + '",'
1101
+ }
1102
+ if (temp != '') {
1103
+ temp = '{' + temp.substring(0, temp.length - 1) + '}'
1104
+ }
1105
+ str.push(utils.parseToJson(temp))
1106
+ })
1107
+ }
1108
+ const returnData = str
1109
+ const formInst = utils.getOnlineFormInstance(this)
1110
+ try {
1111
+ let returnSize = returnData.length
1112
+ //判断是否是一对一子表
1113
+ if (this_.relation && this_.relation == 'onetoone') {
1114
+ if (returnSize > 1) {
1115
+ this_.$message.error('一对一子表只能选择一条数据')
1116
+ this_.customDialogShowTree = true
1117
+ return
1118
+ }
1119
+ }
1120
+ returnData.forEach((row) => {
1121
+ var targetArray = null
1122
+ var subLineData = {}
1123
+ this.custdialog.custDialog.mappingConf.forEach((con) => {
1124
+ if (con.target[0]) {
1125
+ targetArray = con.target[0].split('.')
1126
+ var from = ''
1127
+ if (this_.customDialog.dsType == 'restful') {
1128
+ from = con.from
1129
+ } else {
1130
+ from = con.from.toLowerCase()
1131
+ }
1132
+ if (row[from] == undefined) {
1133
+ from = from.toUpperCase()
1134
+ }
1135
+ subLineData[targetArray[targetArray.length - 1]] =
1136
+ decodeURIComponent(row[from])
1137
+ }
1138
+ })
1139
+ if (targetArray) {
1140
+ var subBo = formInst['data'][targetArray[0]][targetArray[1]]
1141
+ //判断是否大于子表数据最大行数
1142
+ if (this_.maxRow != 0 && subBo.length + returnSize > this_.maxRow) {
1143
+ this_.$message.error(
1144
+ '子表数据已超过最大行数【' + this_.maxRow + '】'
1145
+ )
1146
+ this_.customDialogShowTree = true
1147
+ throw new Error('EndIterative')
1148
+ }
1149
+
1150
+ //子表中的孙表实体(可能存在多个)
1151
+ let sunBos = utils.getSomeAttributeFromParentElement(
1152
+ this_.$el,
1153
+ 'sunBos'
1154
+ )
1155
+ //如果存在孙表实体则手动添加空孙表数组对象
1156
+ if (sunBos) {
1157
+ let arrayBo = sunBos.split(',')
1158
+ for (let i = 0; i < arrayBo.length; i++) {
1159
+ let key = 'sub_' + arrayBo[i]
1160
+ let value = new Array()
1161
+ subLineData[key] = value
1162
+ }
1163
+ }
1164
+ //判断是否是一对一子表
1165
+ if (this_.relation && this_.relation == 'onetoone') {
1166
+ subBo.splice(0, subBo.length)
1167
+ }
1168
+ subBo.push(subLineData)
1169
+ returnSize--
1170
+ }
1171
+ })
1172
+ this.customDialogShowTree = false
1173
+ } catch (e) {
1174
+ if (e.message != 'EndIterative') throw e
1175
+ }
1176
+ },
1177
+ dialogCancelTree() {
1178
+ this.setListJson([])
1179
+ this.customDialogShowTree = false
1180
+ },
1181
+ getChecked(data) {
1182
+ if (this.customDialog.selectNum === 1) {
1183
+ this.propsData = []
1184
+ this.propsData.push(data)
1185
+ } else {
1186
+ this.propsData = this.$refs.tree.getCheckedNodes()
1187
+ }
1188
+ },
1189
+ treeClick(data) {
1190
+ if (this.customDialog.selectNum === 1) {
1191
+ this.propsData = []
1192
+ this.propsData.push(data)
1193
+ }
1194
+ },
1195
+ clearAllSelectOrgs() {
1196
+ this.selectOrgs = null
1197
+ this.$refs.orgTable.clearSelection()
1198
+ },
1199
+ customDialogShow(pageParam) {
1200
+ this.customDialogShowList = true
1201
+ this.customDialog = pageParam.customDialog
1202
+ this.customDialog.queryUrl =
1203
+ this.customDialog.dsType == 'dataSource'
1204
+ ? '${form}/form/customDialog/v1/getListData?alias=' +
1205
+ this.customDialog.alias +
1206
+ '&mapParam=' +
1207
+ (this.customDialog.mapParam ? this.customDialog.mapParam : '')
1208
+ : this.customDialog.url
1209
+ if (this.dialogData.length < 1) {
1210
+ this.pagination = { page: 1, pageSize: 10, showTotal: 'true' }
1211
+ this.search()
1212
+ this.displayfield = JSON.parse(pageParam.customDialog.displayfield)
1213
+ if (this.customDialog.dsType == 'dataSource') {
1214
+ for (var i = 0; i < this.displayfield.length; i++) {
1215
+ this.displayfield[i].field =
1216
+ this.displayfield[i].field.toLowerCase()
1217
+ }
1218
+ }
1219
+ } else if (this.dialogData.length > 1) {
1220
+ this.search()
1221
+ }
1222
+ if (this.dialogData.length > 0 && this.displayfield.length == 0) {
1223
+ this.search()
1224
+ this.displayfield = JSON.parse(pageParam.customDialog.displayfield)
1225
+ if (this.customDialog.dsType == 'dataSource') {
1226
+ for (var j = 0; j < this.displayfield.length; j++) {
1227
+ this.displayfield[j].field =
1228
+ this.displayfield[j].field.toLowerCase()
1229
+ }
1230
+ }
1231
+ }
1232
+ },
1233
+ customDialogTreeShow(pageParam) {
1234
+ this.customDialog = pageParam.customDialog
1235
+ var customDialog = this.customDialog
1236
+ var mapParam = ''
1237
+ if (pageParam.param != undefined) {
1238
+ mapParam = JSON.stringify(pageParam.param)
1239
+ mapParam = mapParam.substring(1, mapParam.length - 1)
1240
+ }
1241
+ var requestType =
1242
+ customDialog.dsType == 'dataSource'
1243
+ ? 'GET'
1244
+ : customDialog.requestType
1245
+ ? customDialog.requestType
1246
+ : 'POST'
1247
+ var url =
1248
+ '${form}/form/customDialog/v1/getTreeData?alias=' +
1249
+ pageParam.alias +
1250
+ '&mapParam=' +
1251
+ mapParam
1252
+ var paramsObj = {}
1253
+ if (customDialog.dsType != 'dataSource') {
1254
+ url = customDialog.url
1255
+ var templatePa = customDialog.dataParam
1256
+ if (customDialog.conditionfield) {
1257
+ var conditions = JSON.parse(customDialog.conditionfield)
1258
+ for (var i = 0; i < conditions.length; i++) {
1259
+ var con = conditions[i]
1260
+ if (requestType == 'POST') {
1261
+ if (templatePa) {
1262
+ templatePa = templatePa.replace(
1263
+ new RegExp('\\{' + con.field + '\\}', 'g'),
1264
+ con.defaultValue
1265
+ )
1266
+ } else {
1267
+ paramsObj[con.field] = con.defaultValue
1268
+ }
1269
+ } else {
1270
+ var ljChar = url.indexOf('?') == -1 ? '?' : '&'
1271
+ url = url + ljChar + con.field + '=' + con.defaultValue
1272
+ }
1273
+ }
1274
+ if (templatePa) {
1275
+ paramsObj = JSON.parse(templatePa)
1276
+ }
1277
+ }
1278
+ }
1279
+ var requestParams = {}
1280
+ requestParams.requestType = requestType
1281
+ requestParams.url = url
1282
+ requestParams.paramsObj = paramsObj
1283
+ this.searchTree(requestParams)
1284
+ this.customDialogShowTree = true
1285
+ },
1286
+ //树形查询
1287
+ searchTree(requestParams) {
1288
+ const this_ = this
1289
+ this.getTreeListJson(requestParams).then(function (response) {
1290
+ //显示字段配置
1291
+ let displayfield = JSON.parse(this_.customDialog.displayfield)
1292
+ this_.displayField = displayfield
1293
+ //把对话框配置的显示字段显示名称赋值给树形的显示值
1294
+ this_.defaultProps.label = displayfield.displayName
1295
+ this_.treeList = response.data
1296
+ //得到要加载树的信息
1297
+ this_.props1 = this_.toTreeData(
1298
+ response.data,
1299
+ displayfield.id,
1300
+ displayfield.pid,
1301
+ displayfield.displayName,
1302
+ displayfield.pvalue ? displayfield.pvalue : 0
1303
+ )
1304
+ })
1305
+ },
1306
+ //加载树的信息
1307
+ toTreeData(data, id, pid, name, pvalue) {
1308
+ // 建立个树形结构,需要定义个最顶层的父节点,pvalue是0
1309
+ return this.translateDataToTree(data, pid, id, name, pvalue)
1310
+ },
1311
+ translateDataToTree(data, pid, id, name, pvalue) {
1312
+ //把树数据有子节点的数据全部过滤掉(只留父节点的数据)
1313
+ let parents = data.filter(
1314
+ (value) =>
1315
+ value[id] == value[pid] || value[pid] == null || value[pid] == pvalue
1316
+ )
1317
+ if (!parents) {
1318
+ parents = data.filter(
1319
+ (value) =>
1320
+ value[pid] !== 'undefined' &&
1321
+ value[pid] != null &&
1322
+ value[id] != value[pid]
1323
+ )
1324
+ }
1325
+ return parents
1326
+ },
1327
+ loadTree(node, resolve) {
1328
+ if (node) {
1329
+ let this_ = this
1330
+ let displayField =
1331
+ this_.customDialog.style == 2
1332
+ ? this_.combiTreeDisplayField
1333
+ : this_.displayField
1334
+ resolve(
1335
+ this.treeList.filter(
1336
+ (value) => value[displayField.pid] === node.data[displayField.id]
1337
+ )
1338
+ )
1339
+ if (this.showData && this.showData.length > 0) {
1340
+ setTimeout(() => {
1341
+ this.showData.forEach((v) => {
1342
+ if (v.Pid == node.key) {
1343
+ this_.$refs.tree.setChecked(v, true)
1344
+ } else {
1345
+ this_.checkNode(v, this_)
1346
+ }
1347
+ })
1348
+ }, 400)
1349
+ }
1350
+ }
1351
+ },
1352
+
1353
+ afterOpen() {
1354
+ //打开对话框之后加载树
1355
+ this.loadCombinationTree()
1356
+ },
1357
+ loadCombinationTree() {
1358
+ if (this.customDialog.style != 2) {
1359
+ return
1360
+ }
1361
+ let combinationRule = JSON.parse(this.customDialog.combinationRule)
1362
+ this.combinationRule = combinationRule
1363
+ let treeAlias = combinationRule.leftTree
1364
+ //获取对话框数据
1365
+ this.$requestConfig
1366
+ .request({
1367
+ url: '${form}/form/customDialog/v2/getByAlias?alias=' + treeAlias,
1368
+ method: 'get',
1369
+ })
1370
+ .then((resp) => {
1371
+ if (resp && resp.value) {
1372
+ let treeDialog = resp.value
1373
+ this.leftTreeTitle = treeDialog.name
1374
+ let requestType =
1375
+ treeDialog.dsType == 'dataSource'
1376
+ ? 'GET'
1377
+ : treeDialog.requestType
1378
+ ? treeDialog.requestType
1379
+ : 'POST'
1380
+ let url =
1381
+ '${form}/form/customDialog/v1/getTreeData?alias=' +
1382
+ treeAlias +
1383
+ '&mapParam='
1384
+ let paramsObj = {}
1385
+ if (treeDialog.dsType != 'dataSource') {
1386
+ url = treeDialog.url
1387
+ let templatePa = treeDialog.dataParam
1388
+ if (treeDialog.conditionfield) {
1389
+ let conditions = JSON.parse(treeDialog.conditionfield)
1390
+ for (let i = 0; i < conditions.length; i++) {
1391
+ let con = conditions[i]
1392
+ if (requestType == 'POST') {
1393
+ if (templatePa) {
1394
+ templatePa = templatePa.replace(
1395
+ new RegExp('\\{' + con.field + '\\}', 'g'),
1396
+ con.defaultValue
1397
+ )
1398
+ } else {
1399
+ paramsObj[con.field] = con.defaultValue
1400
+ }
1401
+ } else {
1402
+ let ljChar = url.indexOf('?') == -1 ? '?' : '&'
1403
+ url = url + ljChar + con.field + '=' + con.defaultValue
1404
+ }
1405
+ }
1406
+ if (templatePa) {
1407
+ paramsObj = JSON.parse(templatePa)
1408
+ }
1409
+ }
1410
+ }
1411
+ let requestParams = {}
1412
+ requestParams.requestType = requestType
1413
+ requestParams.url = url
1414
+ requestParams.paramsObj = paramsObj
1415
+ this.getTreeListJson(requestParams).then((resp) => {
1416
+ if (treeDialog.displayfield && treeDialog.resultfield) {
1417
+ let displayField = JSON.parse(treeDialog.displayfield)
1418
+ let resultfield = JSON.parse(treeDialog.resultfield)
1419
+ this.defaultProps.label = displayField.displayName
1420
+ this.treeList = resp
1421
+ this.combiTreeDisplayField = displayField
1422
+ this.combinationTreeData = this.toTreeData(
1423
+ resp,
1424
+ displayField.id,
1425
+ displayField.pid,
1426
+ displayField.displayName,
1427
+ displayField.pvalue ? displayField.pvalue : '0',
1428
+ resultfield
1429
+ )
1430
+ }
1431
+ })
1432
+ }
1433
+ })
1434
+ },
1435
+ combiTreeClick(paramObj) {
1436
+ //组合对话框点击左树
1437
+ //清空旧的
1438
+ this.combinationTreeQuerys.splice(0)
1439
+ let combinationRule = JSON.parse(this.customDialog.combinationRule)
1440
+ if (!combinationRule.rules || combinationRule.rules.length == 0) {
1441
+ return
1442
+ }
1443
+ let rules = combinationRule.rules
1444
+ for (let i = 0; i < rules.length; i++) {
1445
+ let value = paramObj[rules[i].treeField]
1446
+ let property = rules[i].listField
1447
+ this.combinationTreeQuerys.push({
1448
+ property: property,
1449
+ value: value,
1450
+ group: 'treeGroup',
1451
+ operation: this.getOperation(rules[i].condition),
1452
+ relation: 'AND',
1453
+ })
1454
+ }
1455
+ this.search(true)
1456
+ },
1457
+ //获取运算符号
1458
+ getOperation(old) {
1459
+ if (!old) {
1460
+ return ''
1461
+ }
1462
+ if (old == 'EQ') {
1463
+ return 'EQUAL'
1464
+ }
1465
+ if (old == 'LK') {
1466
+ return 'LIKE'
1467
+ }
1468
+ if (old == 'LFK') {
1469
+ return 'LIKE'
1470
+ }
1471
+ if (old == 'IN') {
1472
+ return 'IN'
1473
+ }
1474
+ },
1475
+ toggleTree() {
1476
+ if (this.treeShow) {
1477
+ this.treeShow = false
1478
+ this.transtionWidth = '0%'
1479
+ this.toggleBtn = 'el-icon-arrow-right'
1480
+ } else {
1481
+ this.treeShow = true
1482
+ this.transtionWidth = '25%'
1483
+ this.toggleBtn = 'el-icon-arrow-left'
1484
+ }
1485
+ },
1486
+ initTemplateData() {
1487
+ let _this = this
1488
+ const custdialog = this.custdialog.custDialog
1489
+ if (
1490
+ !custdialog ||
1491
+ !custdialog.mappingConf ||
1492
+ custdialog.mappingConf.length < 1
1493
+ ) {
1494
+ return
1495
+ }
1496
+ const targetPath = this.getTargetPath(custdialog.mappingConf)
1497
+ const paths = targetPath.split('.')
1498
+ const formInst = utils.getOnlineFormInstance(this)
1499
+ //如果已有数据则不需要再次初始化
1500
+ const curData = formInst['data'][paths[0]][paths[1]]
1501
+ let initType = this.initFillDataType
1502
+ if (
1503
+ (!initType || initType == 'empty') &&
1504
+ curData.length > 0 &&
1505
+ !(curData.length == 1 && JSON.stringify(curData[0]) == '[]')
1506
+ ) {
1507
+ return
1508
+ } else if (initType == 'cover') {
1509
+ formInst['data'][paths[0]][paths[1]] = []
1510
+ }
1511
+ const loading = this.$loading({
1512
+ lock: true,
1513
+ text: '正在初始化填报模板...',
1514
+ spinner: 'el-icon-loading',
1515
+ background: 'rgba(0, 0, 0, 0.7)',
1516
+ })
1517
+ let myCustomDialog = null
1518
+
1519
+ this.$requestConfig
1520
+ .request({
1521
+ url:
1522
+ '${form}/form/customDialog/v1/getByAlias?alias=' + custdialog.alias,
1523
+ method: 'get',
1524
+ })
1525
+ .then(
1526
+ (data) => {
1527
+ myCustomDialog = data
1528
+ _this.customDialog = data
1529
+ },
1530
+ () => {
1531
+ _this.closeLoading(loading)
1532
+ _this.$message({
1533
+ message: '获取自定义对话框失败!',
1534
+ type: 'error',
1535
+ })
1536
+ }
1537
+ )
1538
+ .then(function () {
1539
+ const currentUser = JSON.parse(sessionStorage.getItem('currentUser'))
1540
+ if (
1541
+ !_this.custdialog.orgConfig.code &&
1542
+ !_this.custdialog.orgConfig.name &&
1543
+ !_this.custdialog.orgConfig.id
1544
+ ) {
1545
+ _this.closeLoading(loading)
1546
+ _this.toFillInitData(_this, myCustomDialog.dsType, formInst['data'])
1547
+ } else if (
1548
+ localStorage.getItem('curFillOrg_' + currentUser.account)
1549
+ ) {
1550
+ _this.closeLoading(loading)
1551
+ _this.fillOrg = JSON.parse(
1552
+ localStorage.getItem('curFillOrg_' + currentUser.account)
1553
+ )
1554
+ _this.toFillInitData(_this, myCustomDialog.dsType, formInst['data'])
1555
+ } else {
1556
+ _this.$requestConfig
1557
+ .request({
1558
+ url: '${uc}/api/org/v1/org/getFillOrg',
1559
+ method: 'get',
1560
+ })
1561
+ .then(
1562
+ (respdata) => {
1563
+ _this.closeLoading(loading)
1564
+ const rep = respdata
1565
+ if (rep.state) {
1566
+ _this.fillOrg = rep.value
1567
+ localStorage.setItem(
1568
+ 'curFillOrg_' + currentUser.account,
1569
+ JSON.stringify(rep.value)
1570
+ )
1571
+ _this.toFillInitData(
1572
+ _this,
1573
+ myCustomDialog.dsType,
1574
+ formInst['data']
1575
+ )
1576
+ } else {
1577
+ _this.$message({
1578
+ message: rep.message,
1579
+ type: 'warning',
1580
+ })
1581
+ }
1582
+ },
1583
+ () => {
1584
+ _this.closeLoading(loading)
1585
+ _this.$message({
1586
+ message: '获取当前用户填制单位失败!',
1587
+ type: 'warning',
1588
+ })
1589
+ }
1590
+ )
1591
+ }
1592
+ })
1593
+ },
1594
+ closeLoading(loading) {
1595
+ setTimeout(function () {
1596
+ loading.close()
1597
+ }, 2000)
1598
+ },
1599
+ getTargetPath(mappingConf) {
1600
+ let target = ''
1601
+ if (mappingConf && mappingConf.length > 0) {
1602
+ mappingConf.forEach((map) => {
1603
+ if (map['target'] && map['target'].length == 1 && map['target'][0]) {
1604
+ target = map['target'][0]
1605
+ return target
1606
+ }
1607
+ })
1608
+ }
1609
+ return target
1610
+ },
1611
+ toFillInitData(_this, dsType, curData) {
1612
+ const custdialog = this.custdialog.custDialog
1613
+ let params = [] //绑定的表单字段
1614
+ if (custdialog.conditions) {
1615
+ //对话框按表单字段查询(参数传入的)
1616
+ let bindList = custdialog.conditions
1617
+ if (bindList.length > 0) {
1618
+ bindList.forEach((ele) => {
1619
+ //绑定表单字段
1620
+ if (ele.defaultType == '3' && ele.bind) {
1621
+ let obj = {}
1622
+ obj.field = ele.field
1623
+ const bindArray = ele.bind.split('.')
1624
+ if (bindArray.length == 3) {
1625
+ obj.bind = curData[bindArray[1]][bindArray[2]]
1626
+ params.push(obj)
1627
+ }
1628
+ }
1629
+ })
1630
+ }
1631
+ }
1632
+ let url =
1633
+ '${form}/form/customDialog/v1/getListData?alias=' + custdialog.alias
1634
+ if (params.length > 0) {
1635
+ let paStr = ''
1636
+ params.forEach((pa) => {
1637
+ if (paStr) {
1638
+ paStr += ','
1639
+ }
1640
+ paStr = paStr + '"' + pa.field + '":"' + pa.bind + '"'
1641
+ })
1642
+ url = url + '&mapParam=' + paStr
1643
+ } else {
1644
+ url = url + '&mapParam='
1645
+ }
1646
+ const param = { pageBean: { page: 1, pageSize: 1000, showTotal: true } }
1647
+ _this.$requestConfig
1648
+ .request({
1649
+ url: url,
1650
+ method: 'post',
1651
+ data: param,
1652
+ })
1653
+ .then(
1654
+ (respdata) => {
1655
+ const response = respdata
1656
+ if (response.rows) {
1657
+ _this.syncInitTableValue(
1658
+ _this.maxRow > 0 && response.rows.length > _this.maxRow
1659
+ ? response.rows.splice(0, _this.maxRow)
1660
+ : response.rows,
1661
+ dsType
1662
+ )
1663
+ }
1664
+ },
1665
+ () => {
1666
+ _this.$message({
1667
+ message: '获取初始化数据失败!',
1668
+ type: 'error',
1669
+ })
1670
+ }
1671
+ )
1672
+ },
1673
+ syncInitTableValue(s, dsType) {
1674
+ let custDialog = this.custdialog
1675
+ var returnStr = JSON.parse(this.customDialog.resultfield)
1676
+ //拿到返回的字段
1677
+ var field = new Array([returnStr.length])
1678
+ var comment = new Array([returnStr.length])
1679
+ var str = []
1680
+ var ids = []
1681
+ for (var i = 0; i < returnStr.length; i++) {
1682
+ field[i] =
1683
+ dsType == 'dataSource'
1684
+ ? returnStr[i].field.toLowerCase()
1685
+ : returnStr[i].field
1686
+ comment[i] =
1687
+ dsType == 'dataSource'
1688
+ ? returnStr[i].comment.toLowerCase()
1689
+ : returnStr[i].comment
1690
+ }
1691
+ if (this.customDialog.selectNum === 1) {
1692
+ var temp = ''
1693
+ for (var j = 0; j < comment.length; j++) {
1694
+ let va = s[0][field[j]]
1695
+ va = typeof va == 'undefined' ? '' : va
1696
+ temp += '"' + comment[j] + '":"' + va + '",'
1697
+ }
1698
+ if (temp != '') {
1699
+ temp = '{' + temp.substring(0, temp.length - 1) + '}'
1700
+ }
1701
+ str.push(utils.parseToJson(temp))
1702
+ ids.push(s[0].id)
1703
+ } else {
1704
+ for (var l = 0; l < s.length; l++) {
1705
+ var tempL = ''
1706
+ for (var m = 0; m < comment.length; m++) {
1707
+ let va = s[l][field[m]]
1708
+ va = typeof va == 'undefined' ? '' : va
1709
+ tempL += '"' + comment[m] + '":"' + va + '",'
1710
+ }
1711
+ if (tempL != '') {
1712
+ tempL = '{' + tempL.substring(0, tempL.length - 1) + '}'
1713
+ }
1714
+ str.push(utils.parseToJson(tempL))
1715
+ ids.push(s[l].id)
1716
+ }
1717
+ }
1718
+ const formInst = utils.getOnlineFormInstance(this)
1719
+ this.instId = formInst.$parent.instId
1720
+ //处理填制部门
1721
+ let fillOrg = {}
1722
+ if (
1723
+ custDialog.orgConfig &&
1724
+ custDialog.orgConfig.name &&
1725
+ this.fillOrg.id
1726
+ ) {
1727
+ const namePath = custDialog.orgConfig.name.split('.')
1728
+ const orgNameField = namePath[namePath.length - 1]
1729
+ fillOrg[orgNameField] = this.fillOrg.name
1730
+ if (custDialog.orgConfig.id) {
1731
+ const idPath = custDialog.orgConfig.id.split('.')
1732
+ const orgIdField = idPath[idPath.length - 1]
1733
+ fillOrg[orgIdField] = this.fillOrg.id
1734
+ }
1735
+ if (custDialog.orgConfig.code) {
1736
+ const codePath = custDialog.orgConfig.code.split('.')
1737
+ const orgCodeField = codePath[codePath.length - 1]
1738
+ fillOrg[orgCodeField] = this.fillOrg.code
1739
+ }
1740
+ }
1741
+ if (custDialog.orgConfig.instId) {
1742
+ const instIdPath = custDialog.orgConfig.instId.split('.')
1743
+ const instIdField = instIdPath[instIdPath.length - 1]
1744
+ fillOrg[instIdField] = this.instId
1745
+ }
1746
+ const returnData = str
1747
+ const _this = this
1748
+
1749
+ returnData.forEach((row) => {
1750
+ var subLineData = {}
1751
+ var targetArray = null
1752
+ custDialog.custDialog.mappingConf.forEach((con) => {
1753
+ if (con.target[0]) {
1754
+ targetArray = con.target[0].split('.')
1755
+ var from = ''
1756
+ if (_this.customDialog.dsType == 'restful') {
1757
+ from = con.from
1758
+ } else {
1759
+ from = con.from.toLowerCase()
1760
+ }
1761
+ subLineData[targetArray[targetArray.length - 1]] = row[from]
1762
+ }
1763
+ })
1764
+ if (fillOrg && JSON.stringify(fillOrg) != '{}') {
1765
+ subLineData = { ...subLineData, ...fillOrg }
1766
+ }
1767
+ formInst['data'][targetArray[0]][targetArray[1]].push(subLineData)
1768
+ })
1769
+ },
1770
+ },
1771
+ }
1772
+ </script>
1773
+ <style lang="scss" scoped>
1774
+ ::v-deep .el-button--mini {
1775
+ padding: 0px 15px;
1776
+ font-size: 12px;
1777
+ border-radius: 3px;
1778
+ height: 100%;
1779
+ border-top-left-radius: 0;
1780
+ border-bottom-left-radius: 0;
1781
+ }
1782
+ ::v-deep .el-button--info {
1783
+ background-color: #f5f7fa;
1784
+ border-color: #e4e7ed;
1785
+ color: #c0c4cc;
1786
+ }
1787
+ ::v-deep .el-input__suffix {
1788
+ position: absolute;
1789
+ height: 100%;
1790
+ right: 0px !important;
1791
+ top: 0;
1792
+ text-align: center;
1793
+ color: #c0c4cc;
1794
+ -webkit-transition: all 0.3s;
1795
+ transition: all 0.3s;
1796
+ pointer-events: none;
1797
+ }
1798
+ .el-input__inner[aria-invalid='true'] {
1799
+ border-color: #f56c6c;
1800
+ }
1801
+
1802
+ .el-select__tags {
1803
+ background: #fff;
1804
+ margin-left: 1px;
1805
+ }
1806
+
1807
+ .left-aside {
1808
+ border-right: 1px solid #eee;
1809
+ padding: 10px;
1810
+ }
1811
+
1812
+ .org-tree {
1813
+ height: 440px;
1814
+ margin-top: 10px;
1815
+ }
1816
+
1817
+ .middle-header {
1818
+ height: unset !important;
1819
+ display: flex;
1820
+ flex-direction: row;
1821
+ flex-wrap: wrap;
1822
+ .search-item {
1823
+ display: flex;
1824
+ // width: 33.33%;
1825
+ margin-right: 12px;
1826
+ }
1827
+ .btn-wrap {
1828
+ line-height: 50px;
1829
+ }
1830
+ }
1831
+
1832
+ .org-table {
1833
+ width: 100%;
1834
+ }
1835
+
1836
+ .right-aside {
1837
+ border-left: 1px solid #eee;
1838
+ }
1839
+
1840
+ .select-aside {
1841
+ border-left: 1px solid #eee;
1842
+ }
1843
+
1844
+ .select-header {
1845
+ border-bottom: 1px solid #eee;
1846
+ height: 52px !important;
1847
+ }
1848
+
1849
+ .select-header > span {
1850
+ padding: 10px 0;
1851
+ line-height: 53px;
1852
+ }
1853
+ .select-tree-div {
1854
+ height: calc(100% - 60px);
1855
+ overflow-y: auto;
1856
+ min-height: unset;
1857
+ }
1858
+ ::v-deep .el-dialog__body {
1859
+ padding: 0;
1860
+ overflow-y: auto;
1861
+ }
1862
+
1863
+ ::v-deep .el-card__header {
1864
+ padding: 10px;
1865
+ }
1866
+
1867
+ ::v-deep .el-card__body {
1868
+ padding: 10px;
1869
+ }
1870
+
1871
+ .org-find-card ::v-deep .el-card__header {
1872
+ background: #f5f7fa;
1873
+ }
1874
+
1875
+ ::v-deep .el-main {
1876
+ padding: 0 20px !important;
1877
+ }
1878
+
1879
+ .button-group {
1880
+ width: 70px;
1881
+ height: 170px;
1882
+ margin: 0px auto;
1883
+ position: relative;
1884
+ top: 50%;
1885
+ -webkit-transform: translateY(-50%);
1886
+ -moz-transform: translateY(-50%);
1887
+ -ms-transform: translateY(-50%);
1888
+ -o-transform: translateY(-50%);
1889
+ transform: translateY(-50%);
1890
+ }
1891
+
1892
+ .button-group > button {
1893
+ display: block;
1894
+ margin: 8px 0;
1895
+ }
1896
+ @media (max-width: 1280px) {
1897
+ ::v-deep .el-dialog {
1898
+ width: 96% !important;
1899
+ margin-top: 2vh !important;
1900
+ }
1901
+ }
1902
+ ::v-deep.el-dialog__wrapper {
1903
+ overflow: unset !important;
1904
+ &::-webkit-scrollbar {
1905
+ width: 0;
1906
+ background-color: transparent;
1907
+ }
1908
+ }
1909
+
1910
+ ::v-deep .el-dialog {
1911
+ min-height: 400px;
1912
+ }
1913
+ @media (max-height: 960px) {
1914
+ ::v-deep .el-dialog__body .el-container {
1915
+ height: 100% !important;
1916
+ }
1917
+ }
1918
+ ::v-deep .el-divider--vertical {
1919
+ height: 100%;
1920
+ }
1921
+ .textRadio {
1922
+ ::v-deep .el-radio__label {
1923
+ display: none;
1924
+ }
1925
+ }
1926
+ </style>