| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <template>
- <view class="mainBox">
- <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
- <myCard @del="del(index)" @add="add('edit',item,index)" :item="item" :btnList="btnList" :index="index+1"
- :columns="columns">
- </myCard>
- </view>
- <view class="add" @click="add('add')">
- <u-icon name="plus" color="#fff"></u-icon>
- </view>
- </view>
- </template>
- <script>
- import myCard from '../../components/myCard.vue'
- export default {
- props: {
- contact_link_status: {
- default: () => []
- },
- isDrawer: {
- default: false
- }
- },
- data() {
- return {
- columns: [
- [{
- label: '姓名:',
- prop: 'linkName',
- type: 'title',
- className: 'perce100',
- }],
- [{
- label: '手机:',
- prop: 'mobilePhone'
- }, {
- label: '部门:',
- prop: 'deptName',
- }],
- [{
- label: '微信号:',
- prop: 'wechat'
- }, {
- label: '邮箱:',
- prop: 'email',
- }],
- [{
- label: '职务:',
- prop: 'post',
- className: 'perce100',
- }],
- [{
- label: '操作:',
- prop: 'action',
- type: 'action',
- className: 'perce100',
- }],
- ],
- btnList: [{
- name: '修改',
- apiName: 'add',
- btnType: 'primary',
- type: '2',
- }, {
- name: '删除',
- apiName: 'del',
- btnType: 'error',
- type: '2',
- pageUrl: '',
- }],
- tableList: [],
- ifChiefList: [{
- value: 0,
- label: '否'
- },
- {
- value: 1,
- label: '是'
- }
- ]
- }
- },
- components: {
- myCard
- },
- created() {
- uni.$off('updatelinKList')
- uni.$on('updatelinKList', ({
- type,
- data
- }) => {
- if (type == 'add') {
- this.tableList.push(data)
- } else {
- this.$set(this.tableList, data.index, data)
- }
- if (this.isDrawer) {
- uni.$emit('setContact', {
- key: 'linKList',
- data: this.tableList
- })
- }
- })
- },
- methods: {
- getStatus(status) {
- return this.contact_link_status.find(item => item.value == status)?.text
- },
- init(list) {
- if (list) {
- this.tableList = JSON.parse(JSON.stringify(list))
- }
- },
- del(index) {
- this.tableList.splice(index, 1);
- if (this.isDrawer) {
- uni.$emit('setContact', {
- key: 'linKList',
- data: this.tableList
- })
- }
- },
- getValue() {
- return this.tableList
- },
- add(type, data, index) {
- if (type == 'edit') {
- data['index'] = index
- }
- uni.navigateTo({
- url: '/pages/saleManage/contact/components/linkListAdd?type=' + type + (type == 'edit' ?
- '&data=' + JSON.stringify(data) : '')
- })
- }
- }
- }
- </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;
- }
- </style>
|