dk-save-button.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*******************************************************************************
  2. * Copyright(c) 2022 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:
  5. * 编辑履历:
  6. * 作者 日期 版本 修改内容
  7. * 周兴 2024-3-12 1.00 底部工具栏-保存
  8. *******************************************************************************/
  9. Component({
  10. /**
  11. * 组件的属性列表
  12. */
  13. properties: {
  14. // 按钮
  15. buttonList: {
  16. type: Array,
  17. },
  18. // 内容
  19. contentList: {
  20. type: Array,
  21. },
  22. // 内容是否一行显示
  23. contentLineFlag: {
  24. type: Boolean,
  25. },
  26. // 按钮自动宽度
  27. btnAutoWidthFlag: {
  28. type: Boolean,
  29. },
  30. // 按钮是居右
  31. btnRightFlag: {
  32. type: Boolean,
  33. },
  34. cssType: { //css 样式
  35. type: String,
  36. value: 'default'
  37. },
  38. // 结果集
  39. value: {
  40. type: String,
  41. observer: function (newVal) {
  42. if (newVal) {
  43. this.setData({
  44. form: JSON.parse(newVal) || {}
  45. })
  46. } else {
  47. this.setData({
  48. form: {}
  49. })
  50. }
  51. }
  52. },
  53. },
  54. /**
  55. * 组件的初始数据
  56. */
  57. data: {
  58. form: {}
  59. },
  60. /**
  61. * 组件生命周期
  62. */
  63. lifetimes: {
  64. attached: function () {
  65. },
  66. detached: function () {
  67. // 在组件实例被从页面节点树移除时执行
  68. },
  69. },
  70. /**
  71. * 组件的方法列表
  72. */
  73. methods: {
  74. /**
  75. * @desc : 修改复选框的值
  76. * @author : 周兴
  77. * @date : 2024/2/2 11:46
  78. */
  79. change(e) {
  80. let code = e.currentTarget.dataset.code
  81. let form = this.data.form
  82. form[code] = e.detail
  83. this.setData({
  84. form: form,
  85. value: JSON.stringify(form)
  86. })
  87. this.triggerEvent("change", { code: code })
  88. },
  89. /**
  90. * @desc : 点击按钮
  91. * @author : 周兴
  92. * @date : 2024/2/2 11:46
  93. */
  94. submit(e) {
  95. let item = e.currentTarget.dataset.item
  96. console.log(e)
  97. this.triggerEvent("open", { name: item.code, customUrl: item.customUrl })
  98. },
  99. }
  100. })