dk-save-button.js 2.0 KB

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