dk-save-button.js 2.3 KB

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