| | |
| | | <svg-icon icon-class="exportIcon" style="margin-right: 8px"/> |
| | | 导出数据 |
| | | </el-button> |
| | | <el-button :disabled="isReserve" @click="handleImport" size="small"> |
| | | <el-button :disabled="!isReserve" @click="handleImport" size="small"> |
| | | <svg-icon icon-class="importIcon" style="margin-right: 8px"/> |
| | | 导入数据 |
| | | </el-button> |
| | | </div> |
| | | <div class="add-btn"> |
| | | <el-tooltip content="新增" effect="dark" placement="top"> |
| | | <el-button :disabled="isReserve" circle icon="el-icon-plus" @click="add()" size="small"/> |
| | | <el-button :disabled="!isReserve" circle icon="el-icon-plus" @click="add()" size="small"/> |
| | | </el-tooltip> |
| | | </div> |
| | | <VisibilityToolbar |
| | | v-model:showSearch="showSearch" |
| | | :columns="columns" |
| | | :columns="defaultColumns" |
| | | @queryTable="handleQuery" |
| | | @update:sort="handleUpdateSort" |
| | | @update:columns="handleUpdateColumns" |
| | | @update:resetSort="handleResetSort" |
| | | ></VisibilityToolbar> |
| | | <!-- @update:columns="handleUpdateColumns"--> |
| | | <!-- @update:sort="handleUpdateSort"--> |
| | | <!-- @update:resetSort="handleResetSort"--> |
| | | </div> |
| | | </div> |
| | | </el-form> |
| | | |
| | | <el-table |
| | | ref="elTable" |
| | | style="margin-top: 20px" |
| | | v-loading="loading" |
| | | :data="projectInfoList" |
| | | @selection-change="handleSelectionChange" |
| | | height="60vh" |
| | | sortable="custom" |
| | | :show-overflow-tooltip="true"> |
| | | <el-table-column type="selection" width="55" align="center"/> |
| | | |
| | | <!-- 动态列 --> |
| | | <template v-for="item in columns"> |
| | | <el-table-column |
| | | v-for="item in columns" |
| | | :key="item.id" |
| | | v-if="item.visible" |
| | | :prop="item.id" |
| | | :label="item.label" |
| | |
| | | <span v-else>{{ scope.row[item.id] }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | |
| | | <!-- 操作列 --> |
| | | <el-table-column label="操作" width="140" align="center" > |
| | |
| | | > |
| | | </el-button> |
| | | <el-button |
| | | v-if="isReserve" |
| | | size="medium" |
| | | type="text" |
| | | icon="el-icon-edit" |
| | |
| | | > |
| | | </el-button> |
| | | <el-button |
| | | v-if="isReserve" |
| | | size="medium" |
| | | type="text" |
| | | icon="el-icon-delete" |
| | |
| | | |
| | | <script> |
| | | import {listInfo, getInfo, delInfo, addInfo, updateInfo} from "@/api/projectInfo"; |
| | | import {current} from './list'; |
| | | import {current, currentRest} from './list'; |
| | | import FileDialog from '../component/FileDialog'; |
| | | |
| | | export default { |
| | |
| | | fileDialogVisible: false, |
| | | //是否需要新增按钮(储蓄项目需要) |
| | | isReserve: false, |
| | | //项目状态筛选条件 |
| | | isProjectCategory: false, |
| | | //表头 |
| | | columns: [], |
| | | defaultColumns: [], |
| | | //控制更多筛选显隐 |
| | | popoverValue: false, |
| | | // 遮罩层 |
| | |
| | | }; |
| | | }, |
| | | created() { |
| | | this.columns = current.map((item, index) => { |
| | | const projectCategory = this.$route.query.projectCategory; |
| | | if(!projectCategory || projectCategory === '1'){ |
| | | this.isReserve = true; |
| | | } |
| | | if(projectCategory){ |
| | | this.isProjectCategory = true; |
| | | } |
| | | const columns = current.map((item, index) => { |
| | | item.index = index + 1; |
| | | item.key = index; |
| | | item.serialNumber = index + 1; |
| | | return item; |
| | | }); |
| | | this.columns = columns; |
| | | this.defaultColumns = JSON.parse(JSON.stringify(columns)); |
| | | this.getList(); |
| | | }, |
| | | methods: { |
| | | // 重置排序的方法 |
| | | handleResetSort() { |
| | | this.defaultColumns = currentRest.map((item, index) => { |
| | | item.index = index + 1; |
| | | item.key = index; |
| | | item.serialNumber = index + 1 |
| | | return item; |
| | | }); |
| | | this.columns = currentRest.map((item, index) => { |
| | | item.index = index + 1; |
| | | item.key = index; |
| | | item.serialNumber = index + 1 |
| | | return item; |
| | | }); |
| | | }, |
| | | // 更新列的方法 |
| | | handleUpdateColumns(row) { |
| | | // this.currentColumns = row; |
| | | this.columns = this.columns.map(item => { |
| | | if (item.key === row.key) { |
| | | return row; |
| | | } |
| | | return item; |
| | | }); |
| | | }, |
| | | handleUpdateSort(data) { |
| | | console.log( this.columns, '排序前的列'); |
| | | this.columns = this.columns.map(item => { |
| | | if (item.key === data.key) { |
| | | item.serialNumber = data.serialNumber; |
| | | } |
| | | return item; |
| | | }); |
| | | this.defaultColumns = JSON.parse(JSON.stringify(this.columns)).sort((a, b) => a.index - b.index); |
| | | this.columns.sort((a, b) => a.serialNumber - b.serialNumber); |
| | | |
| | | console.log( this.columns, '排序后的列'); |
| | | }, |
| | | // 关闭文件处理弹框的方法 |
| | | fileDialogCancel() { |
| | | this.tableLoading = true; |
| | |
| | | /** 查询项目管理基础信息列表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | console.log("查询") |
| | | listInfo(this.queryParams).then(response => { |
| | | this.projectInfoList = response.data; |
| | | this.total = response.total; |