xm-iam-rectify-user-handler.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div :class="$style.userDiv">
  3. <sd-user-picker ref="iamRectifyUser" :single="true" @change="save"></sd-user-picker>
  4. </div>
  5. </template>
  6. <script>
  7. import components from './_import-components/xm-iam-rectify-user-handler-import'
  8. export default {
  9. name: 'XmIamRectifyUserHandler',
  10. components,
  11. data() {
  12. return {
  13. visible: false,
  14. button: {},
  15. initValues: [],
  16. childTable: undefined,
  17. selectedRows: [],
  18. eventScript: undefined,
  19. }
  20. },
  21. methods: {
  22. run({ button, eventScript, context: { childTable, selectedRows } }) {
  23. this.button = button
  24. this.childTable = childTable
  25. this.selectedRows = selectedRows
  26. // 根据需修改的字段,获取字段信息
  27. this.eventScript = eventScript
  28. /// 获取非隐藏 且 包含在事件配置修改字段中的字段
  29. // this.initValues =
  30. // childTable?.fields.filter((f) => !f.attrFD?.hidden && modifyFields.includes(f.name)) || []
  31. this.$refs.iamRectifyUser.openPicker()
  32. },
  33. save(userList) {
  34. this.selectedRows.forEach((item) => {
  35. if (this.eventScript.userName && this.eventScript.userName.length > 0) {
  36. item[this.eventScript.userName[0].id] = userList[0].name
  37. }
  38. if (this.eventScript.userId && this.eventScript.userId.length > 0) {
  39. item[this.eventScript.userId[0].id] = userList[0].code
  40. }
  41. if (this.eventScript.userAccount && this.eventScript.userAccount.length > 0) {
  42. item[this.eventScript.userAccount[0].id] = userList[0].code
  43. }
  44. })
  45. },
  46. },
  47. }
  48. </script>
  49. <style module lang="scss">
  50. @use '@/common/design' as *;
  51. .user-div {
  52. display: none;
  53. }
  54. </style>