d30dcd0a7603ae6f5eae07cb9111266cee0e947f.svn-base 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <!-- 定义在这里的参数都是不可在外部覆盖的,防止出现问题 -->
  3. <j-select-biz-component
  4. :value="value"
  5. :ellipsisLength="25"
  6. :listUrl="url.list"
  7. :columns="columns"
  8. v-on="$listeners"
  9. v-bind="attrs"
  10. />
  11. </template>
  12. <script>
  13. import JDate from '@comp/jeecg/JDate'
  14. import JSelectBizComponent from './JSelectBizComponent'
  15. export default {
  16. name: 'JSelectMultiUser',
  17. components: {JDate, JSelectBizComponent},
  18. props: {
  19. value: null, // any type
  20. queryConfig: {
  21. type: Array,
  22. default: () => []
  23. },
  24. },
  25. data() {
  26. return {
  27. url: { list: '/sys/user/list' },
  28. columns: [
  29. { title: '姓名', align: 'center', width: '25%', widthRight: '70%', dataIndex: 'realname' },
  30. { title: '账号', align: 'center', width: '25%', dataIndex: 'username' },
  31. { title: '电话', align: 'center', width: '20%', dataIndex: 'phone' },
  32. { title: '出生日期', align: 'center', width: '20%', dataIndex: 'birthday' }
  33. ],
  34. // 定义在这里的参数都是可以在外部传递覆盖的,可以更灵活的定制化使用的组件
  35. default: {
  36. name: '用户',
  37. width: 1200,
  38. displayKey: 'realname',
  39. returnKeys: ['id', 'username'],
  40. queryParamText: '账号',
  41. },
  42. // 多条件查询配置
  43. queryConfigDefault: [
  44. {
  45. key: 'sex',
  46. label: '性别',
  47. // 如果包含 dictCode,那么就会显示成下拉框
  48. dictCode: 'sex',
  49. },
  50. {
  51. key: 'birthday',
  52. label: '生日',
  53. placeholder: '请选择出生日期',
  54. // 如果想要使用局部注册的组件,就必须要使用箭头函数
  55. customRender: ({key, queryParam, options}) => {
  56. return <j-date {...options} vModel={queryParam[key]} style="width:180px;"/>
  57. },
  58. },
  59. ],
  60. }
  61. },
  62. computed: {
  63. attrs() {
  64. return Object.assign(this.default, this.$attrs, {
  65. queryConfig: this.queryConfigDefault.concat(this.queryConfig)
  66. })
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="less" scoped></style>