|
|
<template> <div class="mod-config"> <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -10px;"> <el-button @click="getData()" type="primary" style="margin-left: 2px;margin-top: 33px">查询</el-button> </el-form>
<el-table :height="height" :data="dataList" border v-loading="dataListLoading" style="width: 100%;"> <el-table-column header-align="center" align="center" width="150" label="操作"> <template slot-scope="scope"> <a type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</a> <a type="text" size="small" @click="deleteHandle(scope.row.id)">删除</a> </template> </el-table-column> <el-table-column v-for="(item,index) in columnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column>
</el-table> </div></template>
<script>
import { getTableDefaultListLanguage, getTableUserListLanguage, } from "@/api/table.js" import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
export default { name: "null", data() { return {
height: 200, dataList:[], dataListLoading: false,
columnList: [ { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1ProjectId', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "projectId", headerAlign: "center", align: "left", columnLabel: "项目号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1ProjectType', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "projectType", headerAlign: "center", align: "left", columnLabel: "项目类型", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1ProjectName', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "projectName", headerAlign: "center", align: "left", columnLabel: "项目名称", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1Status', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "status", headerAlign: "center", align: "left", columnLabel: "项目状态", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1Priority', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "priority", headerAlign: "center", align: "left", columnLabel: "优先级", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 40 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1ProjectManagerId', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "projectManagerId", headerAlign: "center", align: "left", columnLabel: "项目负责人", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1ProjectSource', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "projectSource", headerAlign: "center", align: "left", columnLabel: "项目来源", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1CustomerId', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "customerId", headerAlign: "center", align: "left", columnLabel: "客户代码", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1CustomerName', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "customerName", headerAlign: "center", align: "left", columnLabel: "客户名称", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1CreateDate', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "createDate", headerAlign: "center", align: "left", columnLabel: "创建时间", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1CreateBy', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "createBy", headerAlign: "center", align: "left", columnLabel: "创建人", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1UpdateDate', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "updateDate", headerAlign: "center", align: "left", columnLabel: "修改时间", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 }, { userId: this.$store.state.user.name, functionId: 101002001, serialNumber: '101002001Table1UpdateBy', tableId: "101002001Table1", tableName: "项目信息主表", columnProp: "updateBy", headerAlign: "center", align: "left", columnLabel: "修改人", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, ],
} }, watch: { // $route: {
// handler: function (val, oldVal) {
// this.$router.onReady(() => {
// if (this.$route.query.order) {
// this.modelData.orderNo = this.$route.query.order
// this.modelData.site = this.$route.query.site
// this.modelData.user = this.$route.query.user
// if (this.modelData.orderNo) {
// this.tableHanddle(this.modelData)
// }
// }
// })
// },
// // 深度观察监听
// deep: true
// },
// updateData: {
// deep: true,
// handler: function (newV, oldV) {
// this.updateData.projectID = this.updateData.projectID.toUpperCase();
// this.updateData.oriSOOrderNo = this.updateData.oriSOOrderNo.toUpperCase();
// this.updateData.orderType = this.updateData.orderType.toUpperCase();
// }
// }
}, mounted() { this.$nextTick(() => { this.height = window.innerHeight - 240; }) }, methods: { // 动态列开始 获取 用户保存的 格式列
async getTableUserColumn(tableId, columnId) { let queryTableUser = { userId: this.$store.state.user.name, functionId: this.$route.meta.menuId, tableId: tableId, status: true, languageCode: this.$i18n.locale } await getTableUserListLanguage(queryTableUser).then(({data}) => { if (data.rows.length > 0) { //this.columnList = []
switch (columnId) { case 1: this.columnList = data.rows break; // case 2:
// this.columnList1 = data.rows
// break;
// case 3:
// this.columnList2 = data.rows
// break;
// case 4:
// this.columnList3 = data.rows
// break;
}
} else { this.getColumnList(tableId, columnId) } })
},
// 获取 tableDefault 列
async getColumnList(tableId, columnId) { this.queryTable.tableId = tableId let queryTable= { functionId: this.$route.meta.menuId, tableId: tableId, languageCode: this.$i18n.locale } await getTableDefaultListLanguage(queryTable).then(({data}) => { if (!data.rows.length == 0) { switch (columnId) { case 1: this.columnList = data.rows break; // case 2:
// this.columnList1 = data.rows
// break;
// case 3:
// this.columnList2 = data.rows
// break;
// case 4:
// this.columnList3 = data.rows
// break;
} } else { // this.showDefault = true
} })
}, //动态列结束
}, created() { this.getTableUserColumn(this.$route.meta.menuId+'table1',1) } }</script>
<style scoped>
</style>
|