|
@@ -1,348 +1,372 @@
|
|
|
<template>
|
|
|
<basic-container>
|
|
|
<el-tabs v-model="tabData" type="card" @tab-click="handleClick">
|
|
|
- <el-tab-pane label="修改额度" name="XGED">
|
|
|
- <avue-form ref="formEditRef" v-model="formEidtData" :option="optionEidt">
|
|
|
- <template slot="amountUpdate">
|
|
|
- <el-input v-model="formEidtData.amountUpdate" size="small" clearable
|
|
|
- placeholder="请输入修改额度" @input="amountInput" ></el-input>
|
|
|
- </template>
|
|
|
- </avue-form>
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane label="历史记录" name="LSJL">
|
|
|
- <avue-crud :option="option"
|
|
|
- :table-loading="loading"
|
|
|
- :data="data"
|
|
|
- :page.sync="page"
|
|
|
- :permission="permissionList"
|
|
|
- :before-open="beforeOpen"
|
|
|
- v-model="form"
|
|
|
- ref="crud"
|
|
|
- @row-update="rowUpdate"
|
|
|
- @row-save="rowSave"
|
|
|
- @row-del="rowDel"
|
|
|
- @search-change="searchChange"
|
|
|
- @search-reset="searchReset"
|
|
|
- @selection-change="selectionChange"
|
|
|
- @current-change="currentChange"
|
|
|
- @size-change="sizeChange"
|
|
|
- @refresh-change="refreshChange"
|
|
|
- @on-load="onLoad"
|
|
|
- @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 340)"
|
|
|
- @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 340)" >
|
|
|
- <template slot="menuLeft">
|
|
|
- <el-button type="danger"
|
|
|
- size="small"
|
|
|
- icon="el-icon-delete"
|
|
|
- plain
|
|
|
- @click="handleDelete">删 除
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </avue-crud>
|
|
|
- </el-tab-pane>
|
|
|
+ <el-tab-pane label="修改额度" name="XGED">
|
|
|
+ <avue-form ref="formEditRef" v-model="formEidtData" :option="optionEidt">
|
|
|
+ <template slot="amountUpdate">
|
|
|
+ <el-input v-model="formEidtData.amountUpdate" size="small" clearable placeholder="请输入修改额度"
|
|
|
+ @input="amountInput"></el-input>
|
|
|
+ </template>
|
|
|
+ </avue-form>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="历史记录" name="LSJL">
|
|
|
+ <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList"
|
|
|
+ :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave"
|
|
|
+ @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
|
|
|
+ @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
|
|
|
+ @refresh-change="refreshChange" @on-load="onLoad"
|
|
|
+ @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 340)"
|
|
|
+ @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 340)">
|
|
|
+ <template slot="menuLeft">
|
|
|
+ <el-button type="danger" size="small" icon="el-icon-delete" plain @click="handleDelete">删 除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </avue-crud>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="消费记录" name="XFJL">
|
|
|
+ <avue-crud :option="option2" :table-loading="loading" :data="data" :page.sync="page"
|
|
|
+ :permission="permissionList" :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate"
|
|
|
+ @row-save="rowSave" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
|
|
|
+ @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
|
|
|
+ @refresh-change="refreshChange" @on-load="onLoad"
|
|
|
+ @resetColumn="resetColumnTwo('crud', 'option2', 'optionList2', 436)"
|
|
|
+ @saveColumn="saveColumnTwo('crud', 'option2', 'optionList2', 436)">
|
|
|
+ </avue-crud>
|
|
|
+ </el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</basic-container>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {limitrecordList, limitrecordDetail, limitrecordSubmit, limitrecordRemove} from "@/api/tirePartsMall/basicData/customerInformation/limitrecord";
|
|
|
- import {mapGetters} from "vuex";
|
|
|
- import {regularBurdenfloating, regularInteger} from "@/util/regularJudgment";
|
|
|
+import { limitrecordList, limitrecordDetail, limitrecordSubmit, limitrecordRemove } from "@/api/tirePartsMall/basicData/customerInformation/limitrecord";
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import { regularBurdenfloating, regularInteger } from "@/util/regularJudgment";
|
|
|
+import { Header } from "element-ui";
|
|
|
|
|
|
- export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- tabData:'XGED', // tab切换
|
|
|
- // 表单的配置项
|
|
|
- optionEidt:{
|
|
|
- menuBtn: false,
|
|
|
- column: [
|
|
|
- {
|
|
|
- label: "原额度",
|
|
|
- prop: "amountOld",
|
|
|
- disabled:true,
|
|
|
- rules: [{
|
|
|
- required: true,
|
|
|
- message: "请输入原额度",
|
|
|
- trigger: "blur"
|
|
|
- }],
|
|
|
- },
|
|
|
- {
|
|
|
- label: "修改额度",
|
|
|
- prop: "amountUpdate",
|
|
|
- rules: [{
|
|
|
- required: true,
|
|
|
- message: "请输入本次修改额度",
|
|
|
- trigger: "blur"
|
|
|
- }]
|
|
|
- },
|
|
|
- {
|
|
|
- label: "修改后额度",
|
|
|
- prop: "amountNew",
|
|
|
- disabled:true,
|
|
|
- rules: [{
|
|
|
- required: true,
|
|
|
- message: "请输入修改后额度",
|
|
|
- trigger: "blur"
|
|
|
- }]
|
|
|
- },
|
|
|
- {
|
|
|
- label: "备注",
|
|
|
- prop: "remarks",
|
|
|
- span:24,
|
|
|
- type: 'textarea',
|
|
|
- minRows: 3,
|
|
|
- },
|
|
|
- ]
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ tabData: 'XGED', // tab切换
|
|
|
+ // 表单的配置项
|
|
|
+ optionEidt: {
|
|
|
+ menuBtn: false,
|
|
|
+ column: [
|
|
|
+ {
|
|
|
+ label: "原额度",
|
|
|
+ prop: "amountOld",
|
|
|
+ disabled: true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入原额度",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "修改额度",
|
|
|
+ prop: "amountUpdate",
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入本次修改额度",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "修改后额度",
|
|
|
+ prop: "amountNew",
|
|
|
+ disabled: true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入修改后额度",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "备注",
|
|
|
+ prop: "remarks",
|
|
|
+ span: 24,
|
|
|
+ type: 'textarea',
|
|
|
+ minRows: 3,
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ formEidtData: {
|
|
|
+ amountOld: this.amountOld ? this.amountOld : 0
|
|
|
+ }, // 表单数据
|
|
|
+ form: {},
|
|
|
+ query: {},
|
|
|
+ loading: true,
|
|
|
+ page: {
|
|
|
+ pageSize: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ selectionList: [],
|
|
|
+ option: {},
|
|
|
+ optionList: {
|
|
|
+ height: 'auto',
|
|
|
+ maxHeight: '200',
|
|
|
+ calcHeight: 30,
|
|
|
+ tip: false,
|
|
|
+ searchShow: true,
|
|
|
+ searchMenuSpan: 6,
|
|
|
+ border: true,
|
|
|
+ index: true,
|
|
|
+ viewBtn: true,
|
|
|
+ selection: true,
|
|
|
+ dialogClickModal: false,
|
|
|
+ menu: false,
|
|
|
+ column: [
|
|
|
+ {
|
|
|
+ label: "原额度",
|
|
|
+ prop: "amountOld",
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入原额度",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "本次修改额度",
|
|
|
+ prop: "amountUpdate",
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "本次修改额度",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "修改后额度",
|
|
|
+ prop: "amountNew",
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "修改后额度",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "备注",
|
|
|
+ prop: "remarks",
|
|
|
},
|
|
|
- formEidtData:{
|
|
|
- amountOld:this.amountOld?this.amountOld:0
|
|
|
- }, // 表单数据
|
|
|
- form: {},
|
|
|
- query: {},
|
|
|
- loading: true,
|
|
|
- page: {
|
|
|
- pageSize: 10,
|
|
|
- currentPage: 1,
|
|
|
- total: 0
|
|
|
- },
|
|
|
- selectionList: [],
|
|
|
- option:{},
|
|
|
- optionList: {
|
|
|
- height:'auto',
|
|
|
- maxHeight:'200',
|
|
|
- calcHeight: 30,
|
|
|
- tip: false,
|
|
|
- searchShow: true,
|
|
|
- searchMenuSpan: 6,
|
|
|
- border: true,
|
|
|
- index: true,
|
|
|
- viewBtn: true,
|
|
|
- selection: true,
|
|
|
- dialogClickModal: false,
|
|
|
- menu:false,
|
|
|
- column: [
|
|
|
- {
|
|
|
- label: "原额度",
|
|
|
- prop: "amountOld",
|
|
|
- rules: [{
|
|
|
- required: true,
|
|
|
- message: "请输入原额度",
|
|
|
- trigger: "blur"
|
|
|
- }],
|
|
|
- },
|
|
|
- {
|
|
|
- label: "本次修改额度",
|
|
|
- prop: "amountUpdate",
|
|
|
- rules: [{
|
|
|
- required: true,
|
|
|
- message: "本次修改额度",
|
|
|
- trigger: "blur"
|
|
|
- }]
|
|
|
- },
|
|
|
- {
|
|
|
- label: "修改后额度",
|
|
|
- prop: "amountNew",
|
|
|
- rules: [{
|
|
|
- required: true,
|
|
|
- message: "修改后额度",
|
|
|
- trigger: "blur"
|
|
|
- }]
|
|
|
- },
|
|
|
- {
|
|
|
- label: "备注",
|
|
|
- prop: "remarks",
|
|
|
- },
|
|
|
- ]
|
|
|
- },
|
|
|
- data: []
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ option2: {},
|
|
|
+ optionList2: {
|
|
|
+ height: 'auto',
|
|
|
+ maxHeight: '200',
|
|
|
+ calcHeight: 30,
|
|
|
+ tip: false,
|
|
|
+ border: true,
|
|
|
+ index: true,
|
|
|
+ menu: false,
|
|
|
+ header: false,
|
|
|
+ column: [
|
|
|
+ {
|
|
|
+ label: "业务编号",
|
|
|
+ prop: "amountOld",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "业务类型",
|
|
|
+ prop: "amountUpdate",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "业务时间",
|
|
|
+ prop: "amountNew",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "消费额度",
|
|
|
+ prop: "remarks",
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ data: [],
|
|
|
+ data2: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ amountOld: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ },
|
|
|
+ pid: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["permission"]),
|
|
|
+ permissionList() {
|
|
|
+ return {
|
|
|
+ addBtn: this.vaildData(this.permission.limitrecord_add, false),
|
|
|
+ viewBtn: this.vaildData(this.permission.limitrecord_view, false),
|
|
|
+ delBtn: this.vaildData(this.permission.limitrecord_delete, false),
|
|
|
+ editBtn: this.vaildData(this.permission.limitrecord_edit, false)
|
|
|
};
|
|
|
},
|
|
|
- props:{
|
|
|
- amountOld:{
|
|
|
- type:Number,
|
|
|
- default:0
|
|
|
- },
|
|
|
- pid:{
|
|
|
- type:String,
|
|
|
- default: ''
|
|
|
- }
|
|
|
+ ids() {
|
|
|
+ let ids = [];
|
|
|
+ this.selectionList.forEach(ele => {
|
|
|
+ ids.push(ele.id);
|
|
|
+ });
|
|
|
+ return ids.join(",");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async created() {
|
|
|
+ this.option = await this.getColumnData(this.getColumnName(340), this.optionList);
|
|
|
+ this.option2 = await this.getColumnData(this.getColumnName(436), this.optionList);
|
|
|
+ // this.$set(this.formEidtData,'amountOld',this.amountOld?this.amountOld:0)
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // tabs 切换
|
|
|
+ handleClick() {
|
|
|
+ if (this.tabData == 'LSJL') {
|
|
|
+ this.query = {}
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.onLoad(this.page, this.query);
|
|
|
+ }
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapGetters(["permission"]),
|
|
|
- permissionList() {
|
|
|
- return {
|
|
|
- addBtn: this.vaildData(this.permission.limitrecord_add, false),
|
|
|
- viewBtn: this.vaildData(this.permission.limitrecord_view, false),
|
|
|
- delBtn: this.vaildData(this.permission.limitrecord_delete, false),
|
|
|
- editBtn: this.vaildData(this.permission.limitrecord_edit, false)
|
|
|
- };
|
|
|
- },
|
|
|
- ids() {
|
|
|
- let ids = [];
|
|
|
- this.selectionList.forEach(ele => {
|
|
|
- ids.push(ele.id);
|
|
|
+ // 修改额度input 监听
|
|
|
+ amountInput(value) {
|
|
|
+ this.$set(this.formEidtData, 'amountUpdate', regularBurdenfloating(value))
|
|
|
+ this.$set(this.formEidtData, 'amountNew', Number(this.formEidtData.amountOld) + Number(this.formEidtData.amountUpdate))
|
|
|
+ },
|
|
|
+ rowSave(row, done, loading) {
|
|
|
+ limitrecordSubmit(row).then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
});
|
|
|
- return ids.join(",");
|
|
|
- }
|
|
|
+ done();
|
|
|
+ }, error => {
|
|
|
+ loading();
|
|
|
+ window.console.log(error);
|
|
|
+ });
|
|
|
},
|
|
|
- async created() {
|
|
|
- this.option = await this.getColumnData(this.getColumnName(340), this.optionList);
|
|
|
- // this.$set(this.formEidtData,'amountOld',this.amountOld?this.amountOld:0)
|
|
|
+ rowUpdate(row, index, done, loading) {
|
|
|
+ limitrecordSubmit(row).then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ done();
|
|
|
+ }, error => {
|
|
|
+ loading();
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
},
|
|
|
- methods: {
|
|
|
- // tabs 切换
|
|
|
- handleClick(){
|
|
|
- if (this.tabData == 'LSJL') {
|
|
|
- this.query = {}
|
|
|
- this.page.currentPage = 1;
|
|
|
- this.onLoad(this.page, this.query);
|
|
|
- }
|
|
|
- },
|
|
|
- // 修改额度input 监听
|
|
|
- amountInput(value){
|
|
|
- this.$set(this.formEidtData,'amountUpdate',regularBurdenfloating(value))
|
|
|
- this.$set(this.formEidtData,'amountNew',Number(this.formEidtData.amountOld) + Number(this.formEidtData.amountUpdate))
|
|
|
- },
|
|
|
- rowSave(row, done, loading) {
|
|
|
- limitrecordSubmit(row).then(() => {
|
|
|
+ rowDel(row) {
|
|
|
+ this.$confirm("确定将选择数据删除?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ return limitrecordRemove(row.id);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
this.onLoad(this.page);
|
|
|
this.$message({
|
|
|
type: "success",
|
|
|
message: "操作成功!"
|
|
|
});
|
|
|
- done();
|
|
|
- }, error => {
|
|
|
- loading();
|
|
|
- window.console.log(error);
|
|
|
});
|
|
|
- },
|
|
|
- rowUpdate(row, index, done, loading) {
|
|
|
- limitrecordSubmit(row).then(() => {
|
|
|
+ },
|
|
|
+ handleDelete() {
|
|
|
+ if (this.selectionList.length === 0) {
|
|
|
+ this.$message.warning("请选择至少一条数据");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$confirm("确定将选择数据删除?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ return limitrecordRemove(this.ids);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
this.onLoad(this.page);
|
|
|
this.$message({
|
|
|
type: "success",
|
|
|
message: "操作成功!"
|
|
|
});
|
|
|
- done();
|
|
|
- }, error => {
|
|
|
- loading();
|
|
|
- console.log(error);
|
|
|
+ this.$refs.crud.toggleSelection();
|
|
|
});
|
|
|
- },
|
|
|
- rowDel(row) {
|
|
|
- this.$confirm("确定将选择数据删除?", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- return limitrecordRemove(row.id);
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.onLoad(this.page);
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!"
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- handleDelete() {
|
|
|
- if (this.selectionList.length === 0) {
|
|
|
- this.$message.warning("请选择至少一条数据");
|
|
|
- return;
|
|
|
- }
|
|
|
- this.$confirm("确定将选择数据删除?", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- return limitrecordRemove(this.ids);
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.onLoad(this.page);
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!"
|
|
|
- });
|
|
|
- this.$refs.crud.toggleSelection();
|
|
|
- });
|
|
|
- },
|
|
|
- beforeOpen(done, type) {
|
|
|
- if (["edit", "view"].includes(type)) {
|
|
|
- limitrecordDetail(this.form.id).then(res => {
|
|
|
- this.form = res.data.data;
|
|
|
- });
|
|
|
- }
|
|
|
- done();
|
|
|
- },
|
|
|
- searchReset() {
|
|
|
- this.query = {};
|
|
|
- this.onLoad(this.page);
|
|
|
- },
|
|
|
- searchChange(params, done) {
|
|
|
- this.query = params;
|
|
|
- this.page.currentPage = 1;
|
|
|
- this.onLoad(this.page, params);
|
|
|
- done();
|
|
|
- },
|
|
|
- selectionChange(list) {
|
|
|
- this.selectionList = list;
|
|
|
- },
|
|
|
- selectionClear() {
|
|
|
- this.selectionList = [];
|
|
|
- this.$refs.crud.toggleSelection();
|
|
|
- },
|
|
|
- currentChange(currentPage){
|
|
|
- this.page.currentPage = currentPage;
|
|
|
- },
|
|
|
- sizeChange(pageSize){
|
|
|
- this.page.pageSize = pageSize;
|
|
|
- },
|
|
|
- refreshChange() {
|
|
|
- this.onLoad(this.page, this.query);
|
|
|
- },
|
|
|
- onLoad(page, params = {}) {
|
|
|
- this.loading = true;
|
|
|
- limitrecordList(page.currentPage, page.pageSize, {
|
|
|
- ...Object.assign(params, this.query),
|
|
|
- pid:this.pid
|
|
|
- }).then(res => {
|
|
|
- const data = res.data.data;
|
|
|
- this.page.total = data.total;
|
|
|
- this.data = data.records;
|
|
|
- this.loading = false;
|
|
|
- this.selectionClear();
|
|
|
+ },
|
|
|
+ beforeOpen(done, type) {
|
|
|
+ if (["edit", "view"].includes(type)) {
|
|
|
+ limitrecordDetail(this.form.id).then(res => {
|
|
|
+ this.form = res.data.data;
|
|
|
});
|
|
|
- },
|
|
|
- //自定义列保存
|
|
|
- async saveColumnTwo(ref, option, optionBack, code) {
|
|
|
- /**
|
|
|
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
|
|
|
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
|
|
|
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
|
|
|
- */
|
|
|
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
|
|
|
- if (inSave) {
|
|
|
- this.$message.success("保存成功");
|
|
|
- //关闭窗口
|
|
|
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
|
|
|
- }
|
|
|
- },
|
|
|
- //自定义列重置
|
|
|
- async resetColumnTwo(ref, option, optionBack, code) {
|
|
|
- this[option] = this[optionBack];
|
|
|
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
|
|
|
- if (inSave) {
|
|
|
- this.$message.success("重置成功");
|
|
|
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
|
|
|
- }
|
|
|
- },
|
|
|
+ }
|
|
|
+ done();
|
|
|
+ },
|
|
|
+ searchReset() {
|
|
|
+ this.query = {};
|
|
|
+ this.onLoad(this.page);
|
|
|
+ },
|
|
|
+ searchChange(params, done) {
|
|
|
+ this.query = params;
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.onLoad(this.page, params);
|
|
|
+ done();
|
|
|
+ },
|
|
|
+ selectionChange(list) {
|
|
|
+ this.selectionList = list;
|
|
|
+ },
|
|
|
+ selectionClear() {
|
|
|
+ this.selectionList = [];
|
|
|
+ this.$refs.crud.toggleSelection();
|
|
|
+ },
|
|
|
+ currentChange(currentPage) {
|
|
|
+ this.page.currentPage = currentPage;
|
|
|
+ },
|
|
|
+ sizeChange(pageSize) {
|
|
|
+ this.page.pageSize = pageSize;
|
|
|
+ },
|
|
|
+ refreshChange() {
|
|
|
+ this.onLoad(this.page, this.query);
|
|
|
+ },
|
|
|
+ onLoad(page, params = {}) {
|
|
|
+ this.loading = true;
|
|
|
+ limitrecordList(page.currentPage, page.pageSize, {
|
|
|
+ ...Object.assign(params, this.query),
|
|
|
+ pid: this.pid
|
|
|
+ }).then(res => {
|
|
|
+ const data = res.data.data;
|
|
|
+ this.page.total = data.total;
|
|
|
+ this.data = data.records;
|
|
|
+ this.loading = false;
|
|
|
+ this.selectionClear();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //自定义列保存
|
|
|
+ async saveColumnTwo(ref, option, optionBack, code) {
|
|
|
+ /**
|
|
|
+ * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
|
|
|
+ * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
|
|
|
+ * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
|
|
|
+ */
|
|
|
+ const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
|
|
|
+ if (inSave) {
|
|
|
+ this.$message.success("保存成功");
|
|
|
+ //关闭窗口
|
|
|
+ this.$refs[ref].$refs.dialogColumn.columnBox = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //自定义列重置
|
|
|
+ async resetColumnTwo(ref, option, optionBack, code) {
|
|
|
+ this[option] = this[optionBack];
|
|
|
+ const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
|
|
|
+ if (inSave) {
|
|
|
+ this.$message.success("重置成功");
|
|
|
+ this.$refs[ref].$refs.dialogColumn.columnBox = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- }
|
|
|
- };
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
-<style>
|
|
|
-</style>
|
|
|
+<style></style>
|