linkList.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="mainBox">
  3. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  4. <myCard @del="del(index)" @add="add('edit',item,index)" :item="item" :btnList="btnList" :index="index+1"
  5. :columns="columns">
  6. </myCard>
  7. </view>
  8. <view class="add" @click="add('add')">
  9. <u-icon name="plus" color="#fff"></u-icon>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import myCard from '../../components/myCard.vue'
  15. export default {
  16. props: {
  17. contact_link_status: {
  18. default: () => []
  19. },
  20. isDrawer: {
  21. default: false
  22. }
  23. },
  24. data() {
  25. return {
  26. columns: [
  27. [{
  28. label: '姓名:',
  29. prop: 'linkName',
  30. type: 'title',
  31. className: 'perce100',
  32. }],
  33. [{
  34. label: '手机:',
  35. prop: 'mobilePhone'
  36. }, {
  37. label: '部门:',
  38. prop: 'deptName',
  39. }],
  40. [{
  41. label: '微信号:',
  42. prop: 'wechat'
  43. }, {
  44. label: '邮箱:',
  45. prop: 'email',
  46. }],
  47. [{
  48. label: '职务:',
  49. prop: 'post',
  50. className: 'perce100',
  51. }],
  52. [{
  53. label: '操作:',
  54. prop: 'action',
  55. type: 'action',
  56. className: 'perce100',
  57. }],
  58. ],
  59. btnList: [{
  60. name: '修改',
  61. apiName: 'add',
  62. btnType: 'primary',
  63. type: '2',
  64. }, {
  65. name: '删除',
  66. apiName: 'del',
  67. btnType: 'error',
  68. type: '2',
  69. pageUrl: '',
  70. }],
  71. tableList: [],
  72. ifChiefList: [{
  73. value: 0,
  74. label: '否'
  75. },
  76. {
  77. value: 1,
  78. label: '是'
  79. }
  80. ]
  81. }
  82. },
  83. components: {
  84. myCard
  85. },
  86. created() {
  87. uni.$off('updatelinKList')
  88. uni.$on('updatelinKList', ({
  89. type,
  90. data
  91. }) => {
  92. if (type == 'add') {
  93. this.tableList.push(data)
  94. } else {
  95. this.$set(this.tableList, data.index, data)
  96. }
  97. if (this.isDrawer) {
  98. uni.$emit('setContact', {
  99. key: 'linKList',
  100. data: this.tableList
  101. })
  102. }
  103. })
  104. },
  105. methods: {
  106. getStatus(status) {
  107. return this.contact_link_status.find(item => item.value == status)?.text
  108. },
  109. init(list) {
  110. if (list) {
  111. this.tableList = JSON.parse(JSON.stringify(list))
  112. }
  113. },
  114. del(index) {
  115. this.tableList.splice(index, 1);
  116. if (this.isDrawer) {
  117. uni.$emit('setContact', {
  118. key: 'linKList',
  119. data: this.tableList
  120. })
  121. }
  122. },
  123. getValue() {
  124. return this.tableList
  125. },
  126. add(type, data, index) {
  127. if (type == 'edit') {
  128. data['index'] = index
  129. }
  130. uni.navigateTo({
  131. url: '/pages/saleManage/contact/components/linkListAdd?type=' + type + (type == 'edit' ?
  132. '&data=' + JSON.stringify(data) : '')
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss" scoped>
  139. .add {
  140. width: 96rpx;
  141. height: 96rpx;
  142. border-radius: 48rpx;
  143. background: #3c9cff;
  144. position: fixed;
  145. bottom: 100rpx;
  146. right: 24rpx;
  147. display: flex;
  148. align-items: center;
  149. justify-content: center;
  150. z-index: 99;
  151. }
  152. </style>