xm-select-law-action.vue 8.1 KB

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