dk-save-button.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. checkFlag:{
  31. type: Boolean,
  32. value:false,
  33. },
  34. // 按钮是居右
  35. btnRightFlag: {
  36. type: Boolean,
  37. },
  38. cssType: { //css 样式
  39. type: String,
  40. value: 'default'
  41. },
  42. // 结果集
  43. value: {
  44. type: String,
  45. observer: function (newVal) {
  46. if (newVal) {
  47. this.setData({
  48. form: JSON.parse(newVal) || {}
  49. })
  50. } else {
  51. this.setData({
  52. form: {}
  53. })
  54. }
  55. }
  56. },
  57. },
  58. /**
  59. * 组件的初始数据
  60. */
  61. data: {
  62. form: {}
  63. },
  64. /**
  65. * 组件生命周期
  66. */
  67. lifetimes: {
  68. attached: function () {
  69. },
  70. detached: function () {
  71. // 在组件实例被从页面节点树移除时执行
  72. },
  73. },
  74. /**
  75. * 组件的方法列表
  76. */
  77. methods: {
  78. /**
  79. * @desc : 修改复选框的值
  80. * @author : 周兴
  81. * @date : 2024/2/2 11:46
  82. */
  83. change(e) {
  84. if(this.data.checkFlag){
  85. return
  86. }
  87. let code = e.currentTarget.dataset.code
  88. let form = this.data.form
  89. form[code] = e.detail
  90. this.setData({
  91. form: form,
  92. value: JSON.stringify(form)
  93. })
  94. this.triggerEvent("change", { code: code })
  95. },
  96. /**
  97. * @desc : 点击按钮
  98. * @author : 周兴
  99. * @date : 2024/2/2 11:46
  100. */
  101. submit(e) {
  102. let item = e.currentTarget.dataset.item
  103. console.log(e)
  104. this.triggerEvent("open", { name: item.code, customUrl: item.customUrl })
  105. },
  106. }
  107. })