| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <template>
- <view class="mainBox">
- <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
- <myCard :item="item" :btnList="btnList" :index="index+1" :columns="columns" @del="del(index)">
- <uni-data-picker slot="linkId" v-model="item.linkId" placeholder="请选择" :localdata="linkList"
- :map="{text:'linkName',value:'id'}" @change="linkChange(item)">
- </uni-data-picker>
- <u--input placeholder="请输入" slot="goal" v-model="item.goal">
- </u--input>
- <uni-data-picker slot="influenceCode" v-model="item.influenceCode" @change="influenceChange(item)"
- placeholder="请选择" :localdata="influence_level_code">
- </uni-data-picker>
- <uni-data-picker slot="attitudeCode" v-model="item.attitudeCode" @change="attitudeChange(item)"
- placeholder="请选择" :localdata="attittude_code">
- </uni-data-picker>
- </myCard>
- </view>
- <u-toast ref="uToast"></u-toast>
- <view class="add" @click="add('add')">
- <u-icon name="plus" color="#fff"></u-icon>
- </view>
- <view style="height: 84rpx;" v-if="isDrawer"></view>
- <view class="footerButton" v-if="isDrawer">
- <u-button type="primary" @click="save" text="保存"></u-button>
- </view>
- </view>
- </template>
- <script>
- import {
- getByCode
- } from '@/api/pda/common.js'
- import myCard from '../../components/myCard.vue'
- export default {
- components: {
- myCard,
- },
- data() {
- return {
- tableList: [],
- btnList: [{
- name: '删除',
- apiName: 'del',
- btnType: 'error ',
- type: '2',
- pageUrl: '',
- }],
- columns: [
- [{
- label: '姓名:',
- prop: 'linkId',
- slot: 'linkId',
- style: {
- marginBottom: '10rpx'
- }
- }, {
- label: '职位:',
- prop: 'linkPost',
- style: {
- marginBottom: '10rpx'
- }
- }],
- [{
- label: '联系方式:',
- prop: 'linkMobilePhone',
- style: {
- marginBottom: '10rpx'
- }
- }],
- [{
- label: '影响力:',
- prop: 'influenceCode',
- slot: 'influenceCode',
- style: {
- marginBottom: '10rpx'
- }
- }, {
- label: '态度:',
- prop: 'attitudeCode',
- slot: 'attitudeCode',
- style: {
- marginBottom: '10rpx'
- }
- }],
- [{
- label: '项目目标/期望:',
- prop: 'goal',
- slot: 'goal',
- className: 'perce100',
- style: {
- marginBottom: '10rpx'
- }
- }],
- [{
- label: '操作:',
- prop: 'action',
- type: 'action',
- className: 'perce100',
- }],
- ],
- influence_level_code: [],
- attittude_code: []
- }
- },
- props: {
- linkList: {
- default: []
- },
- isDrawer: {
- default: false
- }
- },
- created() {
- this.getByCode()
- },
- methods: {
- init(list) {
- if (list) {
- this.tableList = JSON.parse(JSON.stringify(list))
- }
- },
- del(index) {
- this.tableList.splice(index, 1);
- },
- getValue() {
- return this.tableList
- },
- getByCode() {
- const codeS = ['influence_level_code', 'attittude_code']
- codeS.forEach(async (code) => {
- const codeValue = await getByCode(code);
- this[code] = codeValue.map(item => {
- const key = Object.keys(item)[0]
- return {
- value: key,
- text: item[key]
- }
- })
- })
- },
- linkChange(e) {
- const data = this.linkList.find(item => item.id == e.linkId)
- e.linkPost = data.post
- e.linkMobilePhone = data.mobilePhone
- },
- attitudeChange(e) {
- const data = this.attittude_code.find(item => item.value == e.attitudeCode)
- e.attitudeName = data.text
- },
- influenceChange(e) {
- const data = this.influence_level_code.find(item => item.value == e.influenceCode)
- e.influenceName = data.text
- },
- save() {
- uni.$emit('setBusinessOpportunity')
- },
- add() {
- if (this.linkList.length == 0) {
- this.$refs.uToast.show({
- type: "error",
- message: "请先选择客户",
- })
- return
- }
- this.tableList.push({
- key: null,
- linkId: '',
- linkPost: '',
- linkMobilePhone: '',
- goal: '',
- influenceCode: '',
- influenceName: '',
- attitudeCode: '',
- attitudeName: ''
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .add {
- width: 96rpx;
- height: 96rpx;
- border-radius: 48rpx;
- background: #3c9cff;
- position: fixed;
- bottom: 100rpx;
- right: 24rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- z-index: 99;
- }
- .footerButton {
- width: 100%;
- height: 84rpx;
- display: flex;
- position: fixed;
- bottom: 0;
- z-index: 10;
- /deep/.u-button {
- height: 100%;
- }
- >view {
- flex: 1;
- }
- }
- .item {
- display: flex;
- flex-direction: column;
- padding: 16rpx;
- >view {
- padding-top: 14rpx;
- }
- .item_title {
- font-size: 32rpx;
- font-weight: 800;
- display: flex;
- align-items: center;
- .u-icon {
- margin-left: 12rpx;
- }
- }
- .item_list {
- display: flex;
- align-items: center;
- text {
- font-size: 28rpx;
- }
- .lable {
- color: #626060;
- }
- .value {
- color: #333;
- margin-left: 12rpx;
- flex: 1
- }
- }
- }
- /deep/.u-swipe-action-item__right__button__wrapper {
- background-color: #f56c6c !important;
- }
- /deep/.u-input {
- padding: 0 !important;
- }
- </style>
|