xm-select-law-user.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <script>
  2. /* eslint-disable */
  3. // sd-skip-auto-import
  4. import SdDraggable from '@/common/components/sd-draggable.vue'
  5. import SdPlaceholderEditor from '@/form-designer/sd-placeholder-editor.vue'
  6. import SdTreePicker from '@/common/components/sd-tree-picker.vue'
  7. import SdUglySelect from '@/form-designer/sd-ugly-select.vue'
  8. import SdRangeInput from '@/form-designer/sd-range-input.vue'
  9. import { Input } from 'ant-design-vue'
  10. import axios from '@/common/services/axios-instance'
  11. import components from './_import-components/xm-select-law-user-import'
  12. export const metaInfo = {
  13. caption: '案件选择原被告名称',
  14. component: 'a-input',
  15. icon: 'sd-list',
  16. order: 400,
  17. }
  18. export const fieldProps = {
  19. dataType: 'string',
  20. attrFD: {
  21. dict: void 0,
  22. multiple: 'false',
  23. selectListItem: [
  24. { label: '选项1', value: '1' },
  25. { label: '选项2', value: '2' },
  26. ],
  27. listItemType: 'appDict',
  28. formItemProps: {
  29. inputProps: {
  30. selectValue: '',
  31. },
  32. },
  33. },
  34. attr: {},
  35. }
  36. var _render = function t() {
  37. var e = this,
  38. a = e._self._c
  39. return a(
  40. 'div',
  41. [
  42. a(
  43. 'a-form-model-item',
  44. [
  45. a(
  46. 'div',
  47. { attrs: { slot: 'label' }, slot: 'label' },
  48. [
  49. e._v(' 选项 '),
  50. a(
  51. 'a-select',
  52. {
  53. on: {
  54. change: () => {
  55. e.component.attrFD.dict = void 0
  56. e.component.attrFD.appDict = void 0
  57. },
  58. },
  59. model: {
  60. value: e.component.attrFD.listItemType,
  61. callback: function(t) {
  62. e.$set(e.component.attrFD, 'listItemType', t)
  63. },
  64. expression: 'component.attrFD.listItemType',
  65. },
  66. },
  67. [
  68. a('a-select-option', { attrs: { value: 'dict' } }, [e._v(' 数据字典 ')]),
  69. a('a-select-option', { attrs: { value: 'appDict' } }, [e._v(' 本应用数据字典 ')]),
  70. ],
  71. 1
  72. ),
  73. ],
  74. 1
  75. ),
  76. a('sd-tree-picker', {
  77. attrs: {
  78. value: [...(e.component.attrFD.dict || []), ...(e.component.attrFD.appDict || [])],
  79. single: '',
  80. 'load-tree-data': e.loadTreeData,
  81. render: e.renderItem,
  82. 'option-label': 'text',
  83. 'search-tree-data':
  84. 'dict' === e.component.attrFD.listItemType ? e.searchTreeData : void 0,
  85. },
  86. on: { change: e.updateSelectListItem },
  87. }),
  88. ],
  89. 2
  90. ),
  91. a(
  92. 'a-form-model-item',
  93. { attrs: { label: '选择机构树的值' } },
  94. [
  95. a('sd-ugly-select', {
  96. attrs: {
  97. 'allow-clear': '',
  98. mode: 'true' === e.component.attrFD.multiple ? 'multiple' : void 0,
  99. options: e.component.attrFD.selectListItem,
  100. },
  101. model: {
  102. value: e.component.attrFD.formItemProps.inputProps.selectValue,
  103. callback: function(t) {
  104. e.$set(e.component.attrFD.formItemProps.inputProps, 'selectValue', t)
  105. },
  106. },
  107. }),
  108. ],
  109. 1
  110. ),
  111. !e.component.readonly
  112. ? a(
  113. 'a-form-model-item',
  114. { attrs: { label: '字符长度范围' } },
  115. [
  116. a('sd-range-input', {
  117. attrs: {
  118. max: e.component.attr.maxLength,
  119. min: e.component.attr.minLength,
  120. 'disable-negative': '',
  121. 'max-max': 2e3,
  122. },
  123. on: {
  124. 'update:max': function(t) {
  125. return e.$set(e.component.attr, 'maxLength', t)
  126. },
  127. 'update:min': function(t) {
  128. return e.$set(e.component.attr, 'minLength', t)
  129. },
  130. },
  131. }),
  132. ],
  133. 1
  134. )
  135. : e._e(),
  136. !e.hideMultipleOption
  137. ? a('sd-placeholder-editor', { attrs: { component: e.component } })
  138. : e._e(),
  139. ],
  140. 1
  141. )
  142. }
  143. var staticRenderFns = []
  144. _render._withStripped = true
  145. export default {
  146. name: 'XmSelectLawUser',
  147. components: {
  148. SdDraggable,
  149. SdPlaceholderEditor,
  150. SdTreePicker,
  151. SdUglySelect,
  152. SdRangeInput,
  153. ...components,
  154. },
  155. props: { hideMultipleOption: { type: Boolean, default: false } },
  156. data() {
  157. return {}
  158. },
  159. created() {
  160. this.component.attrFD.listItemType = this.component.attrFD.listItemType || 'custom'
  161. },
  162. methods: {
  163. loadTreeData(t = -1) {
  164. let e
  165. if ('appDict' === this.component.attrFD.listItemType)
  166. e = axios
  167. .get('api/framework/v1/app-dict/tree-sub/' + this.$route.query.appId + '?parentId=' + t)
  168. .then((t) => t.data)
  169. else
  170. e = Promise.all([
  171. axios.get('api/framework/v1/dict-manager/dictTree?keyId=OA_COMMON&containChildren=true'),
  172. axios.get('api/framework/v1/dict-manager/dictTree?keyId=GENERAL&containChildren=true'),
  173. ]).then((t) => {
  174. const e = [
  175. { id: 'OA_COMMON', text: '公用', leaf: false, props: {}, children: t[0].data },
  176. { id: 'GENERAL', text: '通用审批框架', leaf: false, props: {}, children: t[1].data },
  177. ]
  178. return e
  179. })
  180. return e.then((t) => {
  181. const e = function(t) {
  182. if (t?.length)
  183. t.forEach((t) => {
  184. t.isLeaf = t.leaf
  185. t.checkable = t.leaf
  186. e(t.children)
  187. })
  188. }
  189. e(t)
  190. this.treeData = t
  191. return t
  192. })
  193. },
  194. searchTreeData(t) {
  195. const e = []
  196. const a = function(o) {
  197. if (o?.length)
  198. o.forEach((o) => {
  199. if (o.text.includes(t)) e.push(o)
  200. a(o.children)
  201. })
  202. }
  203. a(this.treeData)
  204. return e
  205. },
  206. renderItem(t) {
  207. const e = this.$createElement
  208. console.log('render', t)
  209. if (t.props) {
  210. const a = Object.keys(t.props)
  211. .map((e) => t.props[e])
  212. .join('|')
  213. return e('span', { attrs: { title: '选项:' + a } }, [t.text])
  214. } else return t.text
  215. },
  216. updateSelectListItem([t]) {
  217. console.log(this.component)
  218. this.component.attrFD.selectListItem = []
  219. this.component.attrFD.dict = []
  220. this.component.attrFD.appDict = []
  221. if (void 0 === t) return
  222. console.log(this.component.attrFD.listItemType)
  223. if ('dict' === this.component.attrFD.listItemType)
  224. this.component.attrFD.dict = [{ id: t.id, text: t.text }]
  225. else this.component.attrFD.appDict = [{ id: t.id, text: t.text }]
  226. console.log([...(this.component.attrFD.dict || []), ...(this.component.attrFD.appDict || [])])
  227. console.log('update', t.props)
  228. if (t.props)
  229. Object.keys(t.props).forEach((e) => {
  230. this.component.attrFD.selectListItem.push({ label: t.props[e], value: e })
  231. })
  232. },
  233. multipleModeChange(t) {
  234. if ('false' === t && this.component.attr.defaultValue?.includes(','))
  235. this.component.attr.defaultValue = void 0
  236. },
  237. },
  238. render: _render,
  239. staticRenderFns: staticRenderFns,
  240. }
  241. </script>
  242. <style module lang="scss">
  243. @use '@/common/design' as *;
  244. .row {
  245. display: flex;
  246. align-items: center;
  247. :global(.handle) {
  248. display: flex;
  249. align-items: center;
  250. align-self: stretch;
  251. width: 15px;
  252. }
  253. /* stylelint-disable-next-line */
  254. :global(.handle_sd-draggable_common::before) {
  255. position: absolute;
  256. /* stylelint-disable-next-line */
  257. color: #999;
  258. content: '\22EE\22EE';
  259. }
  260. }
  261. </style>