xm-select-law-action-render.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <a-input v-bind="$attrs" :read-only="readOnly" @click="selectCase" @input="caseInput" />
  3. </template>
  4. <script>
  5. import { Input } from 'ant-design-vue'
  6. import lawCaseSelectPicker from '@product/iam/law/components/picker/law-case-select-picker.vue'
  7. import pickValues from '@/common/services/pick-values'
  8. import components from './_import-components/xm-select-law-action-import'
  9. export default {
  10. name: 'XmSelectLawActionRender',
  11. components: {
  12. 'a-input': Input,
  13. ...components,
  14. },
  15. props: {
  16. selectValue: {
  17. type: String,
  18. default: '',
  19. },
  20. treeName: {
  21. type: String,
  22. default: '案由',
  23. },
  24. },
  25. data() {
  26. return {
  27. readOnly: false,
  28. }
  29. },
  30. inject: {
  31. webflow: { default: () => {} },
  32. SdFormContext: { default: () => {} },
  33. },
  34. methods: {
  35. selectCase() {
  36. // 如果不是选择组织的值,则直接返回
  37. if (!this.selectValue.split(',').includes(this.webflow.getFieldValue('CASE_TYPE'))) {
  38. this.readOnly = false
  39. return
  40. }
  41. this.readOnly = true
  42. pickValues(lawCaseSelectPicker, {
  43. single: false,
  44. topNodeText: this.treeName,
  45. }).then((res) => {
  46. if (!res | (res && res.length === 0)) return
  47. this.caseChange(res)
  48. })
  49. },
  50. caseChange(e) {
  51. this.SdFormContext.setFieldValue('ACTION_NAME', e[0].text)
  52. this.SdFormContext.setFieldValue('ACTION_CODE', e[0].id)
  53. },
  54. caseInput(e) {
  55. this.SdFormContext.setFieldValue('ACTION_NAME', e.currentTarget.value)
  56. },
  57. },
  58. }
  59. </script>
  60. <style module lang="scss">
  61. @use '@/common/design' as *;
  62. .xmselinput {
  63. :global .ant-input {
  64. width: 70%;
  65. margin-right: 10px;
  66. }
  67. :global .ant-btn {
  68. width: auto;
  69. padding: 0 10px;
  70. }
  71. }
  72. </style>