9a241695e539e4a35297d1519088f963ca8c1703.svn-base 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <j-popup
  3. v-bind="popupProps"
  4. @input="handlePopupInput"
  5. />
  6. </template>
  7. <script>
  8. import JVxeCellMixins, { dispatchEvent, vModel } from '@/components/jeecg/JVxeTable/mixins/JVxeCellMixins'
  9. export default {
  10. name: 'JVxePopupCell',
  11. mixins: [JVxeCellMixins],
  12. computed: {
  13. popupProps() {
  14. const {innerValue, originColumn: col, caseId, cellProps} = this
  15. return {
  16. ...cellProps,
  17. value: innerValue,
  18. field: col.field || col.key,
  19. code: col.popupCode,
  20. orgFields: col.orgFields,
  21. destFields: col.destFields,
  22. groupId: caseId,
  23. param: col.param,
  24. sorter: col.sorter,
  25. }
  26. },
  27. },
  28. methods: {
  29. /** popup回调 */
  30. handlePopupInput(value, others) {
  31. const {row, originColumn: col} = this
  32. // 存储输入的值
  33. let popupValue = value
  34. if (others && Object.keys(others).length > 0) {
  35. Object.keys(others).forEach(key => {
  36. let currentValue = others[key]
  37. // 当前列直接赋值,其他列通过vModel赋值
  38. if (key === col.key) {
  39. popupValue = currentValue
  40. } else {
  41. vModel.call(this, currentValue, row, key)
  42. }
  43. })
  44. }
  45. this.handleChangeCommon(popupValue)
  46. },
  47. },
  48. // 【组件增强】注释详见:JVxeCellMixins.js
  49. enhanced: {
  50. aopEvents: {
  51. editActived(event) {
  52. dispatchEvent.call(this, event, 'ant-input')
  53. },
  54. },
  55. },
  56. }
  57. </script>
  58. <style scoped>
  59. </style>