Commit 7b8aaa33 by liangjianmin

style: 优化代码格式,提升可读性

parent 344c58c8
Showing with 162 additions and 0 deletions
<template>
<div class="pagex">
<div class="section-page">
<!--列表区-->
<div class="data-box">
<el-table :data="list" border max-height="600" @selection-change="handleSelectionChange">
<el-table-column type="index" label="序号" width="50" align="center" fixed></el-table-column>
<el-table-column prop="bill_name" label="文件类型" min-width="170" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="status_text" label="文件名称" min-width="170" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="total_amount" label="文件说明" min-width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="unpaid_amount" label="有效期" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="paid_amount" label="上传人" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="paying_amount" label="上传时间" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
</el-table>
<el-pagination layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 50, 100, 200]" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"></el-pagination>
</div>
</div>
<Menu></Menu>
</div>
</template>
<script>
import Vue from 'vue';
import Menu from "@/components/menu.vue";
import {Autocomplete, Button, DatePicker, Descriptions, DescriptionsItem, Dialog, Divider, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Message, MessageBox, Option, Pagination, Popover, Select, Table, TableColumn, Tag, Tooltip} from 'element-ui'
import {NODE_ENVS} from "@/ajax";
import Tool from "@/tool";
Vue.prototype.$message = Message
Vue.prototype.$confirm = MessageBox.confirm;
Vue.use(Button).use(Link).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Popover).use(Tag).use(Divider);
Vue.use(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Descriptions).use(DescriptionsItem);
export default {
name: "fileManagement",
data() {
return {
multipleSelection: [],
total: 0,
page: 1,
limit: 10,
list: [],
formParam: {
bill_sn: '',
status: '',
goods_name: '',
create_time: []
}
};
},
created() {
this.getData()
},
methods: {
getData() {
// 处理日期范围
let params = Object.assign({}, this.formParam);
if (params.create_time && params.create_time.length === 2) {
params.create_time = params.create_time.join(' ~ ');
}
params = Object.assign(params, { page: this.page, limit: this.limit });
this.$http('GET', "/api/bill/getVerifiedBillList", params).then(res => {
if (res.code === 0) {
this.list = res.data.list || [];
this.total = Number(res.data.total) || 0;
} else {
this.$message({
message: res.msg,
type: 'error'
});
}
})
},
/**
* 型号监听
* @param queryString
* @param cb
*/
querySearchAsync(queryString, cb) {
if (!queryString) {
cb([]);
return;
}
this.$http('GET', "/api/search/getspu", { spu_name: queryString }).then(res => {
if (res.code == 0 && res.data.list?.length) {
const arr = res.data.list.map(item => ({
value: item.spu_name
}));
cb(arr);
} else {
cb([]);
}
}).catch(() => {
cb([]);
});
},
/**
* 操作按钮监听
*/
handleCommand(command) {
let bill_id = this.multipleSelection.map(item => item.bill_id).join(',');
if (!bill_id) {
this.$message({
message: '请选择账单',
type: 'warning'
});
return;
}
if (this.multipleSelection.length > 1) {
this.$message.warning('不支持批量导出操作');
return;
}
let url = NODE_ENVS + '/api/bill/exportVerifiedBill?bill_id=' + bill_id + '&token=' + Tool.getCookie('token') + '&type=' + command;
Tool.openNewWindow(url);
},
/**
* 搜索
*/
onSubmit() {
this.page = 1;
this.getData();
},
/**
* 重置表单
* @param formName
*/
resetForm(formName) {
this.formParam.date = '';
this.$refs[formName].resetFields();
},
/**
* 列表分页条数筛选监听
* @param val
*/
handleSizeChange(val) {
this.limit = val;
this.getData();
},
/**
* 列表分页输入页码监听
* @param val
*/
handleCurrentChange(val) {
this.page = val;
this.getData();
},
/**
* chebox 选择监听
* @param val
*/
handleSelectionChange(val) {
this.multipleSelection = val;
}
},
components: {
Menu
}
};
</script>
<style scoped>
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment