render iview tab select的添加和input的添加

单选 && 多选 select

{
                    title: '班组',
                    key: 'shift',
                    render: (h, params) => {
                        // const _this = this
                        // let values = params.row.values.name;
                        // debugger
                        return h('div', [
                            h('Select', {
                                props: {
                                    value: '',//多选的话这里就是数组[]
                                    multiple: true
                                },
                                on: {
                                    'on-change': (event) => {
                                        console.log(event);
                                    }
                                },
                                style: {
                                    width: '80px'
                                }
                            },
                            this.shiftGroup.map(item => {
                                return h('Option', {
                                    props: {value: item.name, key: item.id}
                                }, item);
                            })
                            )
                        ]);
                    }
                }
            ],

input的添加

{
                    title: '排序',
                    key: 'sortNum',
                    sortable: true,
                    align: 'center',
                    width: 80,
                    render: (h, params) => {
                        return h('div', [
                            h('Input', {
                                props: {
                                    type: 'text',
                                    value: this.tableData[params.index].sortNum
                                },
                                style: {
                                    width: '50px',
                                    textAlign: 'center'
                                    // marginRight: '5px'
                                },
                                on: {
                                    'on-enter': (val) => {
                                        console.log(val.target.value)
                                        // this.dataRow = params.row;
                                        const param = {
                                            id: params.row.id,
                                            code: params.row.code,
                                            name: params.row.name,
                                            parentId: params.row.parentId,
                                            navUrl: params.row.navUrl,
                                            iconUrl: params.row.iconUrl,
                                            sortNum: val.target.value,
                                            remark: params.row.remark,
                                            state: params.row.state === '启用' ? 1 : 0
                                        }
                                        // debugger
                                        this.$post(api.SaveModulemanager(), param).then((res) => {
                                            // debugger
                                            let content = res.data;
                                            if (content.status === 200) {
                                                this.isUpdateTreeData = true;
                                                this.getModuleList('');
                                                console.log('编辑成功');
                                            }
                                        });
                                        // console.log(params);
                                    }
                                }
                            })
                        ]);
                    }
                },

 

posted @ 2018-06-20 17:11  大大✌  阅读(909)  评论(1编辑  收藏  举报