personnelList.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view class="mainBox">
  3. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  4. <myCard :item="item" :btnList="btnList" :index="index+1" :columns="columns" @del="del(index)">
  5. <uni-data-picker slot="linkId" v-model="item.linkId" placeholder="请选择" :localdata="linkList"
  6. :map="{text:'linkName',value:'id'}" @change="linkChange(item)">
  7. </uni-data-picker>
  8. <u--input placeholder="请输入" slot="goal" v-model="item.goal">
  9. </u--input>
  10. <uni-data-picker slot="influenceCode" v-model="item.influenceCode" @change="influenceChange(item)"
  11. placeholder="请选择" :localdata="influence_level_code">
  12. </uni-data-picker>
  13. <uni-data-picker slot="attitudeCode" v-model="item.attitudeCode" @change="attitudeChange(item)"
  14. placeholder="请选择" :localdata="attittude_code">
  15. </uni-data-picker>
  16. </myCard>
  17. </view>
  18. <u-toast ref="uToast"></u-toast>
  19. <view class="add" @click="add('add')">
  20. <u-icon name="plus" color="#fff"></u-icon>
  21. </view>
  22. <view style="height: 84rpx;" v-if="isDrawer"></view>
  23. <view class="footerButton" v-if="isDrawer">
  24. <u-button type="primary" @click="save" text="保存"></u-button>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import {
  30. getByCode
  31. } from '@/api/pda/common.js'
  32. import myCard from '../../components/myCard.vue'
  33. export default {
  34. components: {
  35. myCard,
  36. },
  37. data() {
  38. return {
  39. tableList: [],
  40. btnList: [{
  41. name: '删除',
  42. apiName: 'del',
  43. btnType: 'error ',
  44. type: '2',
  45. pageUrl: '',
  46. }],
  47. columns: [
  48. [{
  49. label: '姓名:',
  50. prop: 'linkId',
  51. slot: 'linkId',
  52. }, {
  53. label: '职位:',
  54. prop: 'linkPost',
  55. }],
  56. [{
  57. label: '联系方式:',
  58. prop: 'linkMobilePhone',
  59. }],
  60. [{
  61. label: '影响力:',
  62. prop: 'influenceCode',
  63. slot: 'influenceCode',
  64. }, {
  65. label: '态度:',
  66. prop: 'attitudeCode',
  67. slot: 'attitudeCode',
  68. }],
  69. [{
  70. label: '项目目标/期望:',
  71. prop: 'goal',
  72. slot: 'goal',
  73. className: 'perce100',
  74. }],
  75. [{
  76. label: '操作:',
  77. prop: 'action',
  78. type: 'action',
  79. className: 'perce100',
  80. }],
  81. ],
  82. influence_level_code: [],
  83. attittude_code: []
  84. }
  85. },
  86. props: {
  87. linkList: {
  88. default: []
  89. },
  90. isDrawer: {
  91. default: false
  92. }
  93. },
  94. created() {
  95. this.getByCode()
  96. },
  97. methods: {
  98. init(list) {
  99. if (list) {
  100. this.tableList = JSON.parse(JSON.stringify(list))
  101. }
  102. },
  103. del(index) {
  104. this.tableList.splice(index, 1);
  105. },
  106. getValue() {
  107. return this.tableList
  108. },
  109. getByCode() {
  110. const codeS = ['influence_level_code', 'attittude_code']
  111. codeS.forEach(async (code) => {
  112. const codeValue = await getByCode(code);
  113. this[code] = codeValue.map(item => {
  114. const key = Object.keys(item)[0]
  115. return {
  116. value: key,
  117. text: item[key]
  118. }
  119. })
  120. })
  121. },
  122. linkChange(e) {
  123. const data = this.linkList.find(item => item.id == e.linkId)
  124. e.linkPost = data.post
  125. e.linkMobilePhone = data.mobilePhone
  126. },
  127. attitudeChange(e) {
  128. const data = this.attittude_code.find(item => item.value == e.attitudeCode)
  129. e.attitudeName = data.text
  130. },
  131. influenceChange(e) {
  132. const data = this.influence_level_code.find(item => item.value == e.influenceCode)
  133. e.influenceName = data.text
  134. },
  135. save() {
  136. uni.$emit('setBusinessOpportunity')
  137. },
  138. add() {
  139. if (this.linkList.length == 0) {
  140. this.$refs.uToast.show({
  141. type: "error",
  142. message: "请先选择客户",
  143. })
  144. return
  145. }
  146. this.tableList.push({
  147. key: null,
  148. linkId: '',
  149. linkPost: '',
  150. linkMobilePhone: '',
  151. goal: '',
  152. influenceCode: '',
  153. influenceName: '',
  154. attitudeCode: '',
  155. attitudeName: ''
  156. })
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="scss" scoped>
  162. .add {
  163. width: 96rpx;
  164. height: 96rpx;
  165. border-radius: 48rpx;
  166. background: #3c9cff;
  167. position: fixed;
  168. bottom: 100rpx;
  169. right: 24rpx;
  170. display: flex;
  171. align-items: center;
  172. justify-content: center;
  173. z-index: 99;
  174. }
  175. .footerButton {
  176. width: 100%;
  177. height: 84rpx;
  178. display: flex;
  179. position: fixed;
  180. bottom: 0;
  181. z-index: 10;
  182. /deep/.u-button {
  183. height: 100%;
  184. }
  185. >view {
  186. flex: 1;
  187. }
  188. }
  189. .item {
  190. display: flex;
  191. flex-direction: column;
  192. padding: 16rpx;
  193. >view {
  194. padding-top: 14rpx;
  195. }
  196. .item_title {
  197. font-size: 32rpx;
  198. font-weight: 800;
  199. display: flex;
  200. align-items: center;
  201. .u-icon {
  202. margin-left: 12rpx;
  203. }
  204. }
  205. .item_list {
  206. display: flex;
  207. align-items: center;
  208. text {
  209. font-size: 28rpx;
  210. }
  211. .lable {
  212. color: #626060;
  213. }
  214. .value {
  215. color: #333;
  216. margin-left: 12rpx;
  217. flex: 1
  218. }
  219. }
  220. }
  221. /deep/.u-swipe-action-item__right__button__wrapper {
  222. background-color: #f56c6c !important;
  223. }
  224. /deep/.u-input {
  225. padding: 0 !important;
  226. }
  227. </style>