schemeList.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view class="scheme">
  3. <u-list class="listContent">
  4. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  5. <myCard :item="item" @details="add('view',item)" @edit="add('edit',item,index)" :index="index+1"
  6. :columns="columns" :btnList="btnData">
  7. </myCard>
  8. </view>
  9. </u-list>
  10. <view class="add" @click="add('add')" v-if="type != 'view'">
  11. <u-icon name="plus" color="#fff"></u-icon>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import myCard from '@/pages/saleManage/components/myCard.vue'
  17. export default {
  18. components: {
  19. myCard
  20. },
  21. props: {
  22. type: {
  23. type: String,
  24. default: 'edit'
  25. },
  26. itemList: {
  27. type: Array,
  28. default: () => []
  29. },
  30. },
  31. watch: {
  32. itemList: {
  33. handler(newVal) {
  34. let list = JSON.parse(JSON.stringify(newVal));
  35. this.tableList = list
  36. },
  37. deep: true,
  38. immediate: true
  39. }
  40. },
  41. data() {
  42. return {
  43. columns: [
  44. [{
  45. label: '名称:',
  46. prop: 'name',
  47. type: 'title',
  48. className: 'perce100',
  49. }],
  50. [{
  51. label: '项目:',
  52. prop: 'typeId',
  53. formatter: (row) => {
  54. let typeId = row.typeId;
  55. return typeId == 1 ?
  56. '工时' :
  57. typeId == 2 ?
  58. '零配件' :
  59. typeId == 3 ?
  60. '差旅费' : ''
  61. }
  62. }],
  63. [{
  64. label: '编码:',
  65. prop: 'code'
  66. }, ],
  67. [{
  68. label: '型号:',
  69. prop: 'categoryModel'
  70. }, {
  71. label: '规格:',
  72. prop: 'specification',
  73. }],
  74. [{
  75. label: '仓库:',
  76. prop: 'warehouseName'
  77. }],
  78. [{
  79. label: '库存:',
  80. prop: 'warehouseNum',
  81. }, {
  82. label: '单位:',
  83. prop: 'measureUnit'
  84. }],
  85. [{
  86. label: '数量:',
  87. prop: 'totalCount',
  88. }, {
  89. label: '单价:',
  90. prop: 'singlePrice'
  91. }],
  92. [{
  93. label: '合计:',
  94. prop: 'settlementPrice',
  95. }],
  96. [{
  97. label: '详细内容:',
  98. prop: 'content'
  99. }],
  100. [{
  101. label: '操作:',
  102. prop: 'action',
  103. type: 'action',
  104. className: 'perce100',
  105. }],
  106. ],
  107. btnList: [{
  108. name: '修改',
  109. apiName: 'edit',
  110. btnType: 'primary',
  111. type: '2',
  112. pageUrl: '',
  113. juge: [{
  114. authorities: '',
  115. }, {
  116. key: 'customize',
  117. value: ['5'],
  118. }]
  119. }],
  120. tableList: []
  121. }
  122. },
  123. computed: {
  124. btnData() {
  125. if (this.type == 'view') {
  126. return [];
  127. }
  128. return this.btnList;
  129. }
  130. },
  131. created() {
  132. uni.$off('updateInfo');
  133. uni.$on('updateInfo', (data) => {
  134. console.log(data,'data ----')
  135. data.customize = '5';
  136. if (data.index || data.index == 0) {
  137. let index = data.index;
  138. delete data.index;
  139. this.$set(this.tableList, index, data);
  140. return
  141. }
  142. this.tableList.push(data);
  143. })
  144. },
  145. onShow() {
  146. },
  147. methods: {
  148. add(type, item = {}, index) {
  149. if (type == 'edit') {
  150. item.index = index;
  151. }
  152. let data = JSON.stringify(item);
  153. uni.navigateTo({
  154. url: `/pages/salesServiceManagement/workOrder/components/schemeAdd?obtain=仓库&type=${type}&data=${data}`
  155. })
  156. },
  157. getTabData() {
  158. return this.tableList || [];
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. @import url('@/pages/salesServiceManagement/demandList/components/invoice.scss');
  165. .scheme {
  166. padding: 10rpx 20rpx;
  167. }
  168. .add {
  169. width: 96rpx;
  170. height: 96rpx;
  171. border-radius: 48rpx;
  172. background: #3c9cff;
  173. position: fixed;
  174. bottom: 100rpx;
  175. right: 24rpx;
  176. display: flex;
  177. align-items: center;
  178. justify-content: center;
  179. }
  180. </style>