| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud ref="crud" :table-loading="loading" :data="data" :option="option" :page.sync="page" :search.sync="search" |
| | | <avue-crud ref="crud" :data="data" :option="option" :page.sync="page" :search.sync="search" :table-loading="loading" |
| | | @on-load="getDataList" @row-save="handleSave" @row-del="handleDelete" @row-update="handleEdit" |
| | | @refresh-change="handleRefresh" @size-change="handleSizePage" @current-change="handleCurrentPage" |
| | | @selection-change="selectionChange" @row-click="handleRowClick"> |
| | |
| | | <el-option v-for="item in selectOption" :key="item.value" :label="item.label" :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | <el-input :placeholder="`请输入${selectValue === 'id' ? '系统编号' : '系统名称'}并按回车查询`" :size="size" |
| | | style="width:300px;margin-left: 10px;" v-model="search[selectValue]" clearable |
| | | @keyup.enter.native="handleEnter" @clear="handleClear"></el-input> |
| | | <el-input v-model="search[selectValue]" :placeholder="`请输入${selectValue === 'id' ? '系统编号' : '系统名称'}并按回车查询`" |
| | | :size="size" clearable style="width:300px;margin-left: 10px;" |
| | | @clear="handleClear" @keyup.enter.native="handleEnter"></el-input> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | <script> |
| | | import { getSysInfoList, sysInfoAdd, sysInfoEdit, sysInfoDel } from '@/api/integration/sysInfo.js' |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | }, |
| | | methods: { |
| | | // 获取列表 |
| | | // async getDataList() { |
| | | // this.loading = true |
| | | // console.log(this.search) |
| | | // const { pageSize, currentPage } = this.page |
| | | // let param = { size: pageSize, current: currentPage } |
| | | // this.search = Object.keys(this.search) |
| | | // .filter((key) => this.search[key] !== null && this.search[key] !== undefined && this.search[key] !== "") |
| | | // .reduce((acc, key) => ({ ...acc, [key]: this.search[key] }), {}); |
| | | // const response = await getSysInfoList(pageSize,currentPage,{...param}) |
| | | // if (response.status === 200) { |
| | | // console.log(response) |
| | | // this.loading = false |
| | | // const data = response.data.data |
| | | // this.data = data.records |
| | | // this.page.total = data.total |
| | | // } else this.loading = false |
| | | // }, |
| | | async getDataList() { |
| | | this.loading = true |
| | | console.log(this.search) |
| | | const { pageSize, currentPage } = this.page |
| | | let param = { size: pageSize, current: currentPage } |
| | | this.search = Object.keys(this.search) |
| | | .filter((key) => this.search[key] !== null && this.search[key] !== undefined && this.search[key] !== "") |
| | | .reduce((acc, key) => ({ ...acc, [key]: this.search[key] }), {}); |
| | | const response = await getSysInfoList({ ...param, ...this.search }) |
| | | this.loading = true; |
| | | console.log(this.search); |
| | | const { pageSize, currentPage } = this.page; |
| | | const conditions = {}; |
| | | if (Object.keys(this.search).length > 0) { |
| | | for (const key in this.search) { |
| | | if (this.search[key]) { |
| | | conditions[`conditionMap[${key}_like]`] = this.search[key]; |
| | | } |
| | | } |
| | | } |
| | | const response = await getSysInfoList(pageSize, currentPage, conditions); |
| | | if (response.status === 200) { |
| | | console.log(response) |
| | | this.loading = false |
| | | const data = response.data.data |
| | | this.data = data.records |
| | | this.page.total = data.total |
| | | } else this.loading = false |
| | | console.log(response); |
| | | this.loading = false; |
| | | const data = response.data.data; |
| | | this.data = data.records; |
| | | this.page.total = data.total; |
| | | } else { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | // 新增 |
| | | async handleSave(row, done, loading) { |