123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <template>
- <div>
- <basic-container>
- <avue-crud
- :option="option"
- :data="dataList"
- ref="crud"
- v-model="form"
- :page.sync="page"
- :search.sync="search"
- @search-change="searchChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- :table-loading="loading"
- @saveColumn="saveColumn"
- @resetColumn="resetColumn"
- @expand-change="expandChange"
- >
- <template slot-scope="scope" slot="expand">
- <el-table :data="scope.row.insideList" v-loading="scope.row.loading">
- <el-table-column label="发货单号" prop="billNo" align="center" show-overflow-tooltip width="200"></el-table-column>
- <el-table-column label="订单号" prop="orderNo" align="center" show-overflow-tooltip width="200"></el-table-column>
- <el-table-column label="金额" prop="overpayment" align="center" show-overflow-tooltip width="200"></el-table-column>
- <el-table-column label="消费类型" prop="overpaymentType" align="center" show-overflow-tooltip width="200">
- <template slot-scope="scope">
- <span>{{ scope.row.overpaymentType == 0? '增加': '消费' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="创建时间" prop="createTime" align="center" show-overflow-tooltip width="200"></el-table-column>
- <el-table-column label="创建人" prop="createUserName" align="center" show-overflow-tooltip width="200"></el-table-column>
- </el-table>
- </template>
- <template slot="corpIdSearch">
- <crop-select
- v-model="search.corpId"
- corpType="KH"
- ></crop-select>
- </template>
- <template slot-scope="scope" slot="corpId">
- {{ scope.row.corpName }}
- </template>
- </avue-crud>
- </basic-container>
- </div>
- </template>
- <script>
- import option from './config/mainList.json';
- import {getList, overpaymentDetail} from '@/api/maintenance/overpayment';
- export default {
- name: "index",
- data() {
- return {
- option: {},
- dataList: [],
- form: {},
- page: {
- pageSize: 10,
- pagerCount: 5,
- total: 0,
- },
- search: {},
- loading: false,
- }
- },
- async created() {
- // this.option = option
- this.option = await this.getColumnData(this.getColumnName(53), option);
- let i = 0;
- this.option.column.forEach(item => {
- if (item.search) i++
- })
- if (i % 3 !== 0){
- const num = 3 - Number(i % 3)
- this.option.searchMenuSpan = num * 8;
- this.option.searchMenuPosition = "right";
- }
- },
- methods: {
- searchChange(params, done) {
- this.onLoad(this.page, params);
- done();
- },
- currentChange(val) {
- this.page.currentPage = val;
- },
- sizeChange(val) {
- this.page.currentPage = 1;
- this.page.pageSize = val;
- },
- refreshChange() {
- this.dataList.forEach(item => {
- this.$refs.crud.toggleRowExpansion(item, false)
- })
- this.page.currentPage = 1;
- this.onLoad(this.page, this.search);
- },
- onLoad(page, params) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, params)
- .then(res => {
- this.dataList = res.data.data.records ? res.data.data.records : [];
- this.page.total = res.data.data.total;
- if (this.page.total) {
- this.option.height = window.innerHeight - 260;
- }
- this.dataList.forEach(item => {
- this.$set(item,'insideList',[])
- this.$set(item,'loading', true)
- })
- })
- .finally(() => {
- this.loading = false;
- });
- },
- // 表格展开触发
- expandChange(row, index) {
- if (row.loading) {
- overpaymentDetail({pid: row.id}).then(res => {
- row.insideList = res.data.data? res.data.data.records: []
- row.loading = false
- })
- }
- },
- async saveColumn() {
- const inSave = await this.saveColumnData(
- this.getColumnName(53),
- this.option
- );
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- async resetColumn() {
- const inSave = await this.delColumnData(
- this.getColumnName(53),
- option
- );
- if (inSave) {
- this.$message.success("重置成功");
- this.option = option;
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- },
- }
- </script>
- <style scoped>
- /deep/ .el-table__expanded-cell .el-table__header-wrapper .cell {
- font-size: 8px !important;
- }
- /deep/ .el-table__body-wrapper .cell {
- font-size: 8px;
- }
- </style>
|