config.js 2.75 KB

//组件参数数据
export const componentsData = {
};

// 搜索model
export const bookSearchModel = {
  	  'code': null
};

       
// 表格展示配置
export const tableColumns = function() {
    return [
       {
            type: 'checkbox',
            fixed: 'left'
        },
        {
          text: '书本编号',
          field: 'code',
          minWidth: 200,
          render: (h, param) => {
return h('elLink', {
  props: {
    type: 'primary'
  },
  on: {
    click: () => {
      this.handleOpt('VIEW', param.row);
    }
  }
}, param.row.code);
          },
          align: 'left'
        },
        {
          text: '书本名称',
          field: 'name',
          width: 200,
          align: 'left'
        },
        {
          text: '书本介绍',
          field: 'introduce',
          width: 200,
          align: 'left'
        },
        {
          text: '书本排序',
          field: 'showorder',
          width: 80,
          align: 'left'
        },
        {
          text: '创建人',
          field: 'createdByName',
          align: 'left',
          width: 100
        },
        {
          text: '创建时间',
          field: 'createdAt',
          width: 160,
          sortable: true,
          render: (h, param) => {
            if(param.row.createdAt){
              	const text = param.row.createdAt.substr(0,16);
                return text;
            }
			return '--';
          },
          align: 'left'
        },
        {
            field: 'opt',
            fixed: 'right',
            text: '操作',
            width: 100,
            render: (h, param) => {
                const row = param.row;
                const optArr = [];
                const editBtn = h('QgButton', {
                    props: {
                    	toolTip: '编辑',
                   		type: 'text',
                        icon: 'el-icon-edit'
                    },
                    on: {
                        click: () => {
                            this.handleOpt('EDIT', row);
                        }
                    }
                });
                optArr.push(editBtn);

                const deleteBtn = h('QgButton', {
                    props: {
                    	toolTip: '删除',
                   		type: 'text',
                        icon: 'el-icon-delete'
                    },
                    on: {
                        click: () => {
                            this.handleOpt('DELETE', row);
                        }
                    }
                });
                optArr.push(deleteBtn);

                return h('div', optArr, '');
            }
        }
    ];
};

// 表单对象
export const bookModel = {
    code:null,
    name:null,
    introduce:null,
    showorder:undefined
};