personnelList.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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. style: {
  53. marginBottom: '10rpx'
  54. }
  55. }, {
  56. label: '职位:',
  57. prop: 'linkPost',
  58. style: {
  59. marginBottom: '10rpx'
  60. }
  61. }],
  62. [{
  63. label: '联系方式:',
  64. prop: 'linkMobilePhone',
  65. style: {
  66. marginBottom: '10rpx'
  67. }
  68. }],
  69. [{
  70. label: '影响力:',
  71. prop: 'influenceCode',
  72. slot: 'influenceCode',
  73. style: {
  74. marginBottom: '10rpx'
  75. }
  76. }, {
  77. label: '态度:',
  78. prop: 'attitudeCode',
  79. slot: 'attitudeCode',
  80. style: {
  81. marginBottom: '10rpx'
  82. }
  83. }],
  84. [{
  85. label: '项目目标/期望:',
  86. prop: 'goal',
  87. slot: 'goal',
  88. className: 'perce100',
  89. style: {
  90. marginBottom: '10rpx'
  91. }
  92. }],
  93. [{
  94. label: '操作:',
  95. prop: 'action',
  96. type: 'action',
  97. className: 'perce100',
  98. }],
  99. ],
  100. influence_level_code: [],
  101. attittude_code: []
  102. }
  103. },
  104. props: {
  105. linkList: {
  106. default: []
  107. },
  108. isDrawer: {
  109. default: false
  110. }
  111. },
  112. created() {
  113. this.getByCode()
  114. },
  115. methods: {
  116. init(list) {
  117. if (list) {
  118. this.tableList = JSON.parse(JSON.stringify(list))
  119. }
  120. },
  121. del(index) {
  122. this.tableList.splice(index, 1);
  123. },
  124. getValue() {
  125. return this.tableList
  126. },
  127. getByCode() {
  128. const codeS = ['influence_level_code', 'attittude_code']
  129. codeS.forEach(async (code) => {
  130. const codeValue = await getByCode(code);
  131. this[code] = codeValue.map(item => {
  132. const key = Object.keys(item)[0]
  133. return {
  134. value: key,
  135. text: item[key]
  136. }
  137. })
  138. })
  139. },
  140. linkChange(e) {
  141. const data = this.linkList.find(item => item.id == e.linkId)
  142. e.linkPost = data.post
  143. e.linkMobilePhone = data.mobilePhone
  144. },
  145. attitudeChange(e) {
  146. const data = this.attittude_code.find(item => item.value == e.attitudeCode)
  147. e.attitudeName = data.text
  148. },
  149. influenceChange(e) {
  150. const data = this.influence_level_code.find(item => item.value == e.influenceCode)
  151. e.influenceName = data.text
  152. },
  153. save() {
  154. uni.$emit('setBusinessOpportunity')
  155. },
  156. add() {
  157. if (this.linkList.length == 0) {
  158. this.$refs.uToast.show({
  159. type: "error",
  160. message: "请先选择客户",
  161. })
  162. return
  163. }
  164. this.tableList.push({
  165. key: null,
  166. linkId: '',
  167. linkPost: '',
  168. linkMobilePhone: '',
  169. goal: '',
  170. influenceCode: '',
  171. influenceName: '',
  172. attitudeCode: '',
  173. attitudeName: ''
  174. })
  175. }
  176. }
  177. }
  178. </script>
  179. <style lang="scss" scoped>
  180. .add {
  181. width: 96rpx;
  182. height: 96rpx;
  183. border-radius: 48rpx;
  184. background: #3c9cff;
  185. position: fixed;
  186. bottom: 100rpx;
  187. right: 24rpx;
  188. display: flex;
  189. align-items: center;
  190. justify-content: center;
  191. z-index: 99;
  192. }
  193. .footerButton {
  194. width: 100%;
  195. height: 84rpx;
  196. display: flex;
  197. position: fixed;
  198. bottom: 0;
  199. z-index: 10;
  200. /deep/.u-button {
  201. height: 100%;
  202. }
  203. >view {
  204. flex: 1;
  205. }
  206. }
  207. .item {
  208. display: flex;
  209. flex-direction: column;
  210. padding: 16rpx;
  211. >view {
  212. padding-top: 14rpx;
  213. }
  214. .item_title {
  215. font-size: 32rpx;
  216. font-weight: 800;
  217. display: flex;
  218. align-items: center;
  219. .u-icon {
  220. margin-left: 12rpx;
  221. }
  222. }
  223. .item_list {
  224. display: flex;
  225. align-items: center;
  226. text {
  227. font-size: 28rpx;
  228. }
  229. .lable {
  230. color: #626060;
  231. }
  232. .value {
  233. color: #333;
  234. margin-left: 12rpx;
  235. flex: 1
  236. }
  237. }
  238. }
  239. /deep/.u-swipe-action-item__right__button__wrapper {
  240. background-color: #f56c6c !important;
  241. }
  242. /deep/.u-input {
  243. padding: 0 !important;
  244. }
  245. </style>